-
Notifications
You must be signed in to change notification settings - Fork 542
Optim wip: Fix InceptionV1 color space #582
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
Optim wip: Fix InceptionV1 color space #582
Conversation
Thank you @ProGamerGov for finding the issue. It looks like Ludwig didn't swap the channels but changed the values? I'm not familiar with this transformation. Is that what he actually wanted to reach here (RGB to BGR)? |
@NarineK It looks like Ludwig copied the The InceptionV1 model does use BGR according to Lucid here: https://github.com/tensorflow/lucid/blob/master/lucid/modelzoo/caffe_models/InceptionV1.py#L34, so I'm not entirely sure where the RGB to BGR conversion occurs then since the one I added to |
Thank you @ProGamerGov for the prompt reply! |
@NarineK For Lucid, it looks like it's used in the base class which the InceptionV1 model inherits: https://github.com/tensorflow/lucid/blob/master/lucid/modelzoo/vision_base.py#L184 |
I see - Interesting if that option was used in any of their experiments. Perhaps for some of their case studies or experiments? |
@NarineK Lucid seems to use it as a class variable for initializing the input preprocessing, so I think that it wasn't really an optional setting if you wanted to use the correct preprocessing. https://github.com/tensorflow/lucid/blob/master/lucid/modelzoo/vision_base.py#L196 Github's references option shows |
Thank you for checking it! Merged! |
This PR doesn't overlap with any other PRs. We don't need a RGB to BGR transform inside the model. Currently InceptionV1 is optimizing images in RGB instead of BGR, which results in really bluish visualization images. Visualization results should now match the colors found on OpenAI Microscope: https://microscope.openai.com/models/inceptionv1/mixed4c_0/?models.op.feature_vis.type=channel&models.op.technique=feature_vis
Ludwig's model had the RGB to BGR transform commented out here as well: https://github.com/ludwigschubert/captum/blob/f1fd0729dece59564a7c10b7b397617d8a09a247/captum/optim/models/inception_v1.py#L200-L209