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

Adds 4 Missing Models #1685

Merged
merged 12 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions brainscore_vision/models/efficientnet_b0/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from brainscore_vision import model_registry
from brainscore_vision.model_helpers.brain_transformation import ModelCommitment
from .model import get_model, get_layers

model_registry['efficientnet_b0'] = lambda: ModelCommitment(identifier='efficientnet_b0',
activations_model=get_model('efficientnet_b0'),
layers=get_layers('efficientnet_b0'))
45 changes: 45 additions & 0 deletions brainscore_vision/models/efficientnet_b0/model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import functools
from brainscore_vision.model_helpers.activations.pytorch import load_preprocess_images
from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper
from brainscore_vision.model_helpers.check_submission import check_models
import torchvision.models

import ssl
ssl._create_default_https_context = ssl._create_unverified_context

def get_model(name):
assert name == 'efficientnet_b0'
model = torchvision.models.efficientnet_b0(pretrained=True)
preprocessing = functools.partial(load_preprocess_images, image_size=224)
wrapper = PytorchWrapper(identifier='efficientnet_b0', model=model, preprocessing=preprocessing)
wrapper.image_size = 224
return wrapper

def get_layers(name):
assert name == 'efficientnet_b0'
return ['features.0.2',
'features.2.1.stochastic_depth',
'features.3.1.stochastic_depth',
'features.4.1.stochastic_depth',
'features.4.2.stochastic_depth',
'features.5.1.stochastic_depth',
'features.5.2.stochastic_depth',
'features.6.1.stochastic_depth',
'features.6.2.stochastic_depth',
'features.8.2','classifier.0','classifier.1',
]


def get_bibtex(model_identifier):
return """@misc{tan2020efficientnet,
title={EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks},
author={Mingxing Tan and Quoc V. Le},
year={2020},
eprint={1905.11946},
archivePrefix={arXiv},
primaryClass={cs.LG}
}"""


if __name__ == '__main__':
check_models.check_base_models(__name__)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"IT": "features.6.1.stochastic_depth", "V4": "features.4.1.stochastic_depth", "V1": "features.3.1.stochastic_depth", "V2": "features.6.1.stochastic_depth"}
2 changes: 2 additions & 0 deletions brainscore_vision/models/efficientnet_b0/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
torch
torchvision
8 changes: 8 additions & 0 deletions brainscore_vision/models/efficientnet_b0/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import pytest
import brainscore_vision


@pytest.mark.travis_slow
def test_has_identifier():
model = brainscore_vision.load_model('efficientnet_b0')
assert model.identifier == 'efficientnet_b0'
9 changes: 9 additions & 0 deletions brainscore_vision/models/resnet50_VITO_8deg_cc/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from brainscore_vision.model_helpers.brain_transformation import ModelCommitment
from brainscore_vision import model_registry
from .model import get_layers, get_model


model_registry['resnet50-VITO-8deg-cc'] = lambda: ModelCommitment(identifier='resnet50-VITO-8deg-cc',
activations_model=get_model('resnet50-VITO-8deg-cc'),
layers=get_layers('resnet50-VITO-8deg-cc'))

Loading
Loading