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

Get individual layer score #1297

Open
amirozhan opened this issue Oct 3, 2024 · 4 comments
Open

Get individual layer score #1297

amirozhan opened this issue Oct 3, 2024 · 4 comments

Comments

@amirozhan
Copy link

Hello, is it possible to get individual layer scores when running on vision benchmarks? (Instead of getting the best score)

@mike-ferguson
Copy link
Member

Hi @amirozhan, thanks for opening an issue. Right now you can do this by forcing Brain-Score to run only on one layer:

In your model.py's get_layers() function, you can pass in a single layer that your are interested in, instead of multiple ones. Let me know if you would like any more clarification/help!

@amirozhan
Copy link
Author

Hi @mike-ferguson, thanks for your quick response. I am already doing this approach, however, it requires a lot of processing time and memory. I wanted to see if there is a shortcut to get scores per layer.

@mike-ferguson
Copy link
Member

Ah I see. Off the top of my head, I do not know a way to do what you are after - @mschrimpf any thoughts on how this could be done?

@mschrimpf
Copy link
Member

Hi @amirozhan, you can use the LayerScores class which is also used internally to determine the best layers on separate data. It pre-runs all the layers to save processing time:

if i == 0 and prerun: # pre-run activations together to avoid running every layer separately
# we can only pre-run stimuli in response to the benchmark, since we might otherwise be missing
# visual_degrees resizing.
layer_model = PreRunLayers(model=model, layers=layers, forward=layer_model)

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

No branches or pull requests

3 participants