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

Consider changing the image color normalization #168

Open
KevinJMcEntee opened this issue Nov 16, 2022 · 1 comment
Open

Consider changing the image color normalization #168

KevinJMcEntee opened this issue Nov 16, 2022 · 1 comment
Assignees
Labels
module: models Related to models type: enhancement New feature or request

Comments

@KevinJMcEntee
Copy link

Bug description

I wrote a short python script to try out the pyro-vision model. It can be found at https://github.com/KevinJMcEntee/WildfireDetector. It contains this image color normalization transform:

normalize = transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])

These values were copied from the pyro-vision/README.md file. Further internet searches showed me these values are the mean and standard deviation values of the ImageNet image database.

Here is an image I ran through my script. It shows a wildfire I photographed with my iPhone a few summers ago.
Santa5FireResized

Here is that same image, transformed using the ImageNet values shown above. Notice the transform has left the smoke with a color closely matching the surrounding sky. The pyro-vision model predicted this image is negative for wildfire.
Santa5Fire_withImageNetNormalization

My manual visual inspection led to this insight. So, just for a baseline, I changed the transform to:
normalize = transforms.Normalize(mean=[0.5, 0.5, 0.5], std=[0.5, 0.5, 0.5])
This resulted in this normalized image:
Santa5Fire_withPoint5Normalization

Using this last image transform, pyro-vision predicted this image is positive for wildfire.

This investigation leads me to recommend developing a color transform that is specific to the wildfire smoke training set rather than using the general purpose ImageNet as the source of those values.

Code snippet to reproduce the bug

No Errors

Error traceback

No Errors

Environment

python3 on Macbook Air running MacOS 12.6. Using values from pyro-vision as of November 14, 2022. Script found at https://github.com/KevinJMcEntee/WildfireDetector/blob/main/cliWildFireDetect.py

@frgfm frgfm added type: enhancement New feature or request module: models Related to models labels Nov 16, 2022
@frgfm
Copy link
Member

frgfm commented Nov 16, 2022

Hi Kevin :)

Thanks a lot for reporting that here! I'll run some experiments with different normalization stats to see whether it helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: models Related to models type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants