Skip to content

Add InceptionV1 (GoogLeNet) model#59

Open
mdda wants to merge 3 commits into
fchollet:masterfrom
mdda:master
Open

Add InceptionV1 (GoogLeNet) model#59
mdda wants to merge 3 commits into
fchollet:masterfrom
mdda:master

Conversation

@mdda

@mdda mdda commented Apr 24, 2017

Copy link
Copy Markdown

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

mdda commented May 3, 2017

Copy link
Copy Markdown
Author

This typo is already fixed in the later commit d83b434

@deltadu

deltadu commented Apr 3, 2018

Copy link
Copy Markdown

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

deltadu commented Apr 11, 2018

Copy link
Copy Markdown

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

@airesearch2018

airesearch2018 commented Aug 1, 2018

Copy link
Copy Markdown

@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
Copy Markdown

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
Copy Markdown

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

@danielvarga

Copy link
Copy Markdown

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
Copy Markdown

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

@bmiselis

bmiselis commented Jul 24, 2020

Copy link
Copy Markdown

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