JustinShenk / fer

Facial Expression Recognition with a deep neural network as a PyPI package
MIT License
350 stars 80 forks source link

Padding only applied to first bounding box if needed #33

Open geloescht opened 3 years ago

geloescht commented 3 years ago

From scanning the code I can detect a possible error that could result in subtle mispredictions. When a bounding box overlaps the top or left edge of the input image (why not bottom and right?), the image is padded with 40 pixels in line https://github.com/justinshenk/fer/blob/1810e3e895bc10853872689c88961f11c19f6a00/src/fer/fer.py#L219 and the corresponding bounding box adjusted accordingly. Unfortunately the padding is permanent but the adjustment only applied to this one bounding box. All following bounding boxes will be out of alignment with the padded image. Also if another bounding box also overlaps the former top or left edge, the image will be padded again. A solution would be to do an in-place adjustment to all bounding boxes when the padding happens.

JustinShenk commented 3 years ago

Thanks for catching this and opening the issue. Indeed, these should be fixed. I don't have time for a complete solution, but does https://github.com/justinshenk/fer/pull/34 look alright to you?

geloescht commented 3 years ago

I guess that should work, unless always applying padding somehow slows down detection too much. Someone with experience in using this repository should test that, I might not have the time to use it as much as I thought I would. Thanks for the quick reaction!

JustinShenk commented 3 years ago

Thanks in any case for the quick response!

On Wed, Oct 13, 2021 at 4:18 PM geloescht @.***> wrote:

I guess that should work, unless always applying padding somehow slows down detection too much. Someone with experience in using this repository should test that, I might not have the time to use it as much as I thought I would. Thanks for the quick reaction!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/justinshenk/fer/issues/33#issuecomment-942354922, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACOLMZDZPOP3HROX7HMG3T3UGWILXANCNFSM5FX2SDBQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.