-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: AutoJenkins <[email protected]>
- Loading branch information
1 parent
0caadf9
commit 81101af
Showing
3 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from brainscore_vision import model_registry | ||
from brainscore_vision.model_helpers.brain_transformation import ModelCommitment | ||
from .model import get_model, LAYERS | ||
|
||
BIBTEX = """@inproceedings{radosavovic2020designing, | ||
title={Designing network design spaces}, | ||
author={Radosavovic, Ilija and Kosaraju, Raj Prateek and Girshick, Ross and He, Kaiming and Doll{\'a}r, Piotr}, | ||
booktitle={Proceedings of the IEEE/CVF conference on computer vision and pattern recognition}, | ||
pages={10428--10436}, | ||
year={2020} | ||
}""" | ||
|
||
model_registry['regnet_y_400mf'] = lambda: ModelCommitment( | ||
identifier='regnet_y_400mf', activations_model=get_model(), layers=LAYERS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import functools | ||
|
||
import torchvision.models | ||
|
||
from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper | ||
from brainscore_vision.model_helpers.activations.pytorch import load_preprocess_images | ||
|
||
# these layer choices were not investigated in any depth, we blindly picked all high-level blocks | ||
LAYERS = ['trunk_output.block1', 'trunk_output.block2', 'trunk_output.block3', 'trunk_output.block4'] | ||
|
||
|
||
def get_model(): | ||
model = torchvision.models.regnet_y_400mf(pretrained=True) | ||
preprocessing = functools.partial(load_preprocess_images, image_size=224) | ||
wrapper = PytorchWrapper(identifier='regnet_y_400mf', model=model, preprocessing=preprocessing) | ||
wrapper.image_size = 224 | ||
return wrapper |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import logging | ||
import sys | ||
|
||
import pytest | ||
from pytest import approx | ||
|
||
from brainscore_vision import score | ||
|
||
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG) | ||
|
||
|
||
@pytest.mark.travis_slow | ||
@pytest.mark.memory_intense | ||
def test_score(): | ||
actual_score = score(model_identifier="regnet_y_400mf", benchmark_identifier="MajajHong2015public.IT-pls", | ||
conda_active=True) | ||
assert actual_score == approx(0.532, abs=0.0005) |