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

Added model zoo #232

Merged
merged 33 commits into from
Nov 16, 2018
Merged

Added model zoo #232

merged 33 commits into from
Nov 16, 2018

Conversation

bveliqi
Copy link
Contributor

@bveliqi bveliqi commented Oct 25, 2018

From a user's point of view the API is basically this:

from foolbox import zoo
model = zoo.get_model(url = '[email protected]:bethgelab/cifar10_challenge.git')

Model owners wanting to make the model foolbox-ready need to put a foolbox_model.py containing a simple create() function into the root folder of their git repository.

Besides https://github.com/bethgelab/analysis-by-synthesis-model, I have done this already for three other models:

Model providers who provide the weights of their models in another place than the git repo itself, get use the following foolbox.zoo utilities to download the weights:

from foolbox import zoo

weights_path = zoo.fetch_weights(
        'https://www.dropbox.com/s/ywc0hg8lr5ba8zd/secret.zip?dl=1',
        unzip=True
    )

Full example: https://github.com/bethgelab/cifar10_challenge/blob/master/foolbox_model.py#L10

This test here: https://github.com/bveliqi/foolbox/blob/6a54bfafc89723fb9c73293ba7593a93b26a0dfe/foolbox/tests/test_model_zoo.py is more of an integration test than a unit test and depends on the git/weights providers being up & accessible. So I'm not sure whether we want to run these each & every time on our CI systems since they might take a bite more time compared to our other tests until now...

Also, I will have to add the documentation for the model zoo - but you can already review the code while I'll do that.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.03%) to 99.97% when pulling 2f56b9e on bveliqi:model_zoo_v2 into 9ce045b on bethgelab:master.

@coveralls
Copy link

coveralls commented Nov 5, 2018

Coverage Status

Coverage decreased (-0.06%) to 99.94% when pulling 219add5 on bveliqi:model_zoo_v2 into 9ce045b on bethgelab:master.

setup.py Outdated
@@ -21,6 +21,7 @@
'numpy',
'scipy',
'setuptools',
'pytest'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete

@@ -9,3 +9,6 @@ flake8 >= 3.3.0
python-coveralls >= 2.9.1
pillow >= 4.1.1
randomgen >= 1.14.4
requests >= 2.18.4
GitPython >= 2.1.10
Copy link
Contributor Author

@bveliqi bveliqi Nov 15, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add to setup.py not to -dev.txt



def _filename_from_uri(url):
filename = url.rsplit('/', 1)[-1]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add comment

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use split instead of rsplit

@@ -9,3 +9,6 @@ flake8 >= 3.3.0
python-coveralls >= 2.9.1
pillow >= 4.1.1
randomgen >= 1.14.4
requests >= 2.18.4
GitPython >= 2.1.10
responses >= 0.9.0
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add to -dev.txt

@jonasrauber
Copy link
Member

Great job! Once the final changes that we just discussed have been integrated this can be merged. Please don't forget to add comments for the less obvious parts.

@jonasrauber
Copy link
Member

Looks good! Two comments regarding the example in the docs:

  1. You shouldn't use imagenet_example on the CIFAR model
  2. Are you sure that model takes BGR instead of RGB

@jonasrauber jonasrauber merged commit fe0307f into bethgelab:master Nov 16, 2018
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.

3 participants