Are you sure you want to delete this task? Once this task is deleted, it cannot be recovered.
yult0821 4b2cf07aaa | 1 year ago | |
---|---|---|
brain-score | 2 years ago | |
brainio | 2 years ago | |
candidate_models | 2 years ago | |
logs | 2 years ago | |
model-tools | 2 years ago | |
pics | 1 year ago | |
result_caching | 2 years ago | |
results | 2 years ago | |
sample-model-submission | 2 years ago | |
Brainscore_my_eg_model.pth | 1 year ago | |
README.md | 1 year ago | |
__init__.py | 2 years ago | |
alexnet-owt-4df8aa71.pth | 2 years ago | |
alexnet_eg.py | 2 years ago | |
brainscore_test.sh | 1 year ago | |
custom_model.py | 2 years ago | |
score_a_model_user.py | 1 year ago |
Adapted from Brain-score (DiCarlo's Lab) to measure the similarity between the activations of a DNN model and neural activities recorded from monkeys.
https://github.com/brain-score
【基础镜像】dockerhub.pcl.ac.cn:5000/user-images/openi:brainscore_brief2
Brain & Deep-learning Interdisciplinary Platform (BDIP)组织管理并开放了一个“神经反演计算” (Neural Inversion Computing, NIC)平台网站,该平台依托openI启智社区进行建设,拥有丰富的神经数据、深度学习模型以及模型评测、可视化技术,帮助脑科学研究者运用深度学习技术,为人工智能研究者提供神经数据,推动脑科学与人工智能交叉研究,促进类脑智能研究。欢迎感兴趣的小伙伴前往访问使用,同时也非常欢迎加入我们成为贡献者!
本仓库为brainscore打榜任务提供基础代码库、基础镜像及测试样例。为了解最新榜单,请参见网页brainscore-ANN打榜排名。
如果您想要参与brainscore打榜任务,请按照下述说明进行操作。
1、注册成为openI启智社区用户,加入组织Brain & Deep-learning Interdisciplinary Platform (BDIP),成为贡献者。
2、准备好预训练模型:模型基于PyTorch
,输入图片尺寸为224x224x3。
3、本仓库运行所需的镜像已安装好brainscore相关依赖包,可以作为新建仓库的基础镜像。项目仓库中brain-score
, brainio
, candidate_models
, model-tools
, result_caching
和sample-model-submission
文件夹为Brain-score的源码,一般情况下请勿修改。所需数据集已上传至/gdata/brainscore_data
路径,包含本仓库运行所需的相关数据。
4、在本示例仓库基础上新建项目仓库,首先需更新、替换custom_model.py
,该文件负责模型自定义及模型导入。预训练模型可以在对应仓库以数据集的形式上传,模型文件可命名为model.pth
(需压缩为zip文件进行上传,zip文件可根据模型特点或版本由用户任意命名)。此外,预训练模型也能够通过仓库模型
栏目上传,启动任务时可通过模型
选项进行选择,启动任务后存储于/pretrainmodel/xxx.pth
(建议首选此类新方式,方便在评测任务
中使用)。启动云脑任务DEBUG模式,选择镜像dockerhub.pcl.ac.cn:5000/user-images/openi:brainscore_brief2
,选择前述上传的数据集zip文件,安装依赖包,调试代码,使其可运行成功。请注意单次DEBUG任务最长可持续4小时。调试成功后需要在仓库“云脑”栏目对应任务条目下停止
任务前选择提交镜像
,自行命名,以备后续使用。此外,镜像中应安装requests, json, argparse, datetime, sys, os
等基础Python包。
启动DEBUG
任务后,仓库代码可见于/code/
路径下,其中示例测试脚本为score_a_model_user.py
,用户可在正式评测之前通过该示例脚本进行调试,以确保评测任务能正常运行。在任务启动时数据集/模型
选择预训练模型,如此启动任务后预训练模型可见于/dataset/
路径下(例如,当前仓库运行使用的数据集为Brainscore_my_examplar_model.zip
,则预训练模型存储于/dataset/Brainscore_my_examplar_model/model.pth
),或者/pretrainmodel/xxx.pth
。调试过程可通过修改/code/
路径下的brainscore_test.sh
进行,仅需替换并补充相应的信息,再运行bash /code/brainscore_test.sh
即可。
评测过程需要用户准备一个custom_model.py
文件。该文件主要涵盖如下功能:模型定义、模型初始化、模型实例化(导入预训练模型、封装模型以进行神经相似性评测)、定义待比较网络层等。详情请参见该仓库中的示例文件custom_model.py
,用户在实际应用中需对该文件进行更新替换。评测结果包括相似性评分的平均值score、标准差std,以及测试耗时。
5、正式进行模型评测:启动云脑评测任务
,选择模型评测
,并填入相应信息。任务名称
填写模型名称,例如myModel
(同一仓库下不可存在重复的任务名称
,若要重复使用同一个任务名称
,需先行删除之前的任务记录);任务描述
填写模型简介;评测类型
选择brainscore
;子类型/脑区
从下拉框四选一(V1\V2\V4\IT
),选择指定脑区的活动进行对比;镜像
选择前述自行搭建的镜像;模型
选择预训练模型对应的文件。填写信息完成之后,点击新建任务
即可开始模型评测任务。在openI云脑测试任务中,社区提供1个GPU (V100)和4个CPU的计算资源。任务结束后,评测脚本会将任务相关信息、模型相关信息、及测试结果写入后端数据库,并据此更新榜单页面。随后,用户可以通过云脑
栏目下对应任务条目的评测类型
按钮(即brainscore
)查看最新的榜单页面。
6、下述两段代码分别展示了测试所需的shell脚本brainscore_test.sh
和测试脚本score_a_model.py
中的重要代码片段。
#!/bin/bash
cd /code/
# self debugging
/opt/conda/bin/python /code/score_a_model_user.py --brainRegion 'V1' --modelname 'my_eg_model' --modelpath '/dataset/Brainscore_my_examplar_model/model.pth' --modeldescription 'A simple exemplary model'
# --modelpath '/dataset/model.pth'
# --modelpath '/pretrainmodel/xxx.pth'
# /opt/conda/bin/python /code/score_a_model_user.py --brainRegion 'V1' --modelname 'alexnet' --modelpath '/code/alexnet-owt-4df8aa71.pth' --modeldescription 'AlexNet'
sys.path.append("/code/")
import custom_model
if args.modelname == 'alexnet':
import alexnet_eg as custom_model
model_identifier = custom_model.get_model_identifier()
layers = custom_model.get_layers(model_identifier)
model_instance = custom_model.get_model(model_identifier, abs_modelpath)
...
...
model = ModelCommitment(identifier=model_identifier, activations_model=model_instance, layers=layers)
score = score_model(model_identifier=model_identifier, model=model, benchmark_identifier=benchmark)
图1:预训练模型以数据集形式上传。
similarity2brain_ann
nesC Pickle Jupyter Notebook CSV Python other
Dear OpenI User
Thank you for your continuous support to the Openl Qizhi Community AI Collaboration Platform. In order to protect your usage rights and ensure network security, we updated the Openl Qizhi Community AI Collaboration Platform Usage Agreement in January 2024. The updated agreement specifies that users are prohibited from using intranet penetration tools. After you click "Agree and continue", you can continue to use our services. Thank you for your cooperation and understanding.
For more agreement content, please refer to the《Openl Qizhi Community AI Collaboration Platform Usage Agreement》