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

Should check if image is 0 pixels before calling cv2.resize() #210

Closed
quildtide opened this issue Oct 8, 2020 · 2 comments
Closed

Should check if image is 0 pixels before calling cv2.resize() #210

quildtide opened this issue Oct 8, 2020 · 2 comments
Labels

Comments

@quildtide
Copy link

In:
https://github.com/1adrianb/face-alignment/blob/master/face_alignment/utils.py#L127

When called by:
https://github.com/1adrianb/face-alignment/blob/master/face_alignment/api.py#L225

cv2.resize() is sometimes called on a 0-pixel area; I've found this more likely to happen when faces are approaching the edges of an image.

I know this occurred occasionally while running Blazeface; I am unsure about other detection backends.

I would offer to add a check for this in a pull request, but there's also the question of what should be done if the detection area is 0 pixels. I assume a reasonable step would be to treat it as a false positive detection and skip over it.

In that case, the question then shifts to when that check for a 0-pixel area should be done.

@1adrianb
Copy link
Owner

Hi @thalassocracy,

I believe the face detector should not return faces than have an area equal to 0 since arguable that's not a correct detection. As such I will prefer to keep the check on the face detector. You could add this to the core face detection class and apply the check to all detectors.

Feel free to make a pull request when you have the time.

Thanks!

@1adrianb 1adrianb added the bug label Dec 13, 2020
@1adrianb
Copy link
Owner

@thalassocracy let me know please if you still plan to make a pull request, otherwise I will look into it. Thanks! :)

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

No branches or pull requests

2 participants