Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exception thrown when nonzero_indices is empty #15

Open
hturki opened this issue Apr 17, 2020 · 1 comment
Open

exception thrown when nonzero_indices is empty #15

hturki opened this issue Apr 17, 2020 · 1 comment

Comments

@hturki
Copy link

hturki commented Apr 17, 2020

While training the model on a custom dataset I notice that I run into cases where nonzero_indices is empty and https://github.com/GuYuc/WS-DAN.PyTorch/blob/master/utils.py#L157 then throws an exception.

Is this behavior expected to happen? I'm guessing one could set:

                height_min = 0
                height_max = imgH
                width_min = 0
                width_max = imgW

when nonzero_indices

But I wanted to first confirm that I was understanding this code correctly and that nonzero_indices being empty wasn't symptomatic of a deeper issue.

@GuYuc
Copy link
Owner

GuYuc commented Apr 20, 2020

@hturki Hi. Thank you for posting this question. I think this problem could happen if no value in attention map larger than the threshold, which could make all values in crop_mask become zeros. You may try to manually catch this exception and set them to (0, imgH) as you mentioned, or initialize attention conv layers appropriately to make sure it outputs some large values (maybe close to 1) in early stage of training.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants