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

Add InceptionV1 (GoogLeNet) model #59

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

mdda
Copy link

@mdda mdda commented Apr 24, 2017

Looking at the accuracy vs size vs FLOPs graph makes it clear why GoogLeNet is commonly sought as a standard model in Keras.

This PR includes an implementation in Keras of the GoogLeNet model that is a cleaner (refactored) version of the TensorFlow-slim model zoo model.

Tests show that the results at each layer are identical throughout the networks, and the weights provided in the TensorFlow-slim model zoo can be copied over cleanly. Using the Keras implementation, with the tf-slim weights loaded, I've then saved off the model_weights as Keras .h5 files. If this PR is approved, it would be great to have the weights stored somewhere other than my servers...

If you'd like to see the 'workings' of transferring the model contents over, please see this notebook.

One issue that I'd like some guidance on is how you'd like to handle the 1001-classes output by this model (there's an additional background class0). At the moment, I've left it in (as in the original). However, it could be modified to fall into line with the other models here by shifting over the logits layer weights (and reducing the number of output classes to 1000).

@mdda
Copy link
Author

mdda commented May 3, 2017

This typo is already fixed in the later commit d83b434

@deltadu
Copy link

deltadu commented Apr 3, 2018

Thank you for writing this model!

There is a small error: "TypeError: _obtain_input_shape() got an unexpected keyword argument 'include_top' " due to the updated syntax of Keras. 'include_top' is not used anymore, and should be substituted with 'require_flatten'

@deltadu
Copy link

deltadu commented Apr 11, 2018

Hi @mdda, Why is branch 2b 1x1 followed by 3x3, it should be 5x5 according to the paper, right?

@airesearch2018
Copy link

airesearch2018 commented Aug 1, 2018

@deltadu
You are right, it should be 5x5 instead of 3x3.
This PR is based on the TF slim model, which also contains this inconsistency.
Also the Local Response Normalization seems to be missing, but this should have little impact on the results.
Have a look at:
tensorflow/models#2545

Caffe model implemented it according to the paper:
https://github.com/BVLC/caffe/tree/master/models/bvlc_googlenet

@bmiselis
Copy link

Is there any reason this has not been merged or made available to keras.applications? I feel this might be useful for some research, even considering the fact that InceptionV1 may be seen as outdated 🤔

@ngonthier
Copy link

Even if InceptionV1 is an old model, it can still be useful for some research work.

@danielvarga
Copy link

Even if InceptionV1 is an old model, it can still be useful for some research work.

Seconded. Here's some work we did with exactly this model, thanks @mdda!

https://users.renyi.hu/~daniel/lucid/
https://users.renyi.hu/~daniel/lucid-stylegan2/

@ngonthier
Copy link

By the way, @mdda you should mention that the model weights come from the slim reimplementation of Inception V1.

@bmiselis
Copy link

bmiselis commented Jul 24, 2020

Do you think it's good to be merged? If so, let's do it! 😉

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

Successfully merging this pull request may close these issues.

9 participants