yanhuanli commited on
Commit
4b2cb7a
·
verified ·
1 Parent(s): 5e54a5b

Upload README_zn.md

Browse files
Files changed (1) hide show
  1. README_zn.md +115 -0
README_zn.md ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ pretty_name: SpatialBrain
3
+ language:
4
+ - en
5
+ license: other
6
+ task_categories:
7
+ - image-to-text
8
+ - feature-extraction
9
+ tags:
10
+ - fmri
11
+ - neuroscience
12
+ - brain-decoding
13
+ - spatial-reasoning
14
+ - coco
15
+ - multimodal
16
+ size_categories:
17
+ - 10K<n<100K
18
+ ---
19
+
20
+ # SpatialBrain
21
+
22
+ SpatialBrain 将 73,000 张 COCO 自然图像、空间语义标注与自然场景数据集 8 名被试的视觉皮层 fMRI 响应关联起来。本数据集适用于视觉脑解码、脑与图像表征对齐以及空间关系建模等研究。
23
+
24
+ ## 数据集内容
25
+
26
+ - `coco_images_73k_224_float16.hdf5`:73,000 张调整为 224 x 224 分辨率并以 float16 存储的图像。
27
+ - `annotations.json`:COCO ID、目标实例、边界框、属性、caption、绝对位置和目标间成对关系。
28
+ - `subject_to_COCO73k_ID.hdf5`:各被试的视觉刺激与图像之间的映射关系。
29
+ - `shared_COCO73k_ID.npy`:多名被试共享的图像 ID。
30
+ - `subjXX/func1pt8mm/*_nsdgeneral_betas.hdf5`:NSD general ROI 的 trial-by-voxel beta 矩阵。
31
+ - `subjXX/func1pt8mm/*_prf-visualrois_betas.hdf5`:pRF visual ROI 的 trial-by-voxel beta 矩阵。
32
+ - `subjXX/func1pt8mm/*_brainmask_betas.hdf5`:全脑掩膜范围的 trial-by-voxel beta 矩阵。
33
+
34
+ 处理后的 beta 矩阵以 float16 HDF5 数据集存储。每一行表示一次视觉刺激 trial,每一列表示一个选定体素。HDF5 文件还包含 trial、session、COCO 图像 ID、掩膜和体素索引等元数据。模型需要时,可在加载阶段将 beta 数组转换为 float32;该转换不会恢复 float16 存储过程中已经损失的精度。
35
+
36
+ ## 文本标注使用说明
37
+
38
+ `annotations.json` 是一个 JSON 数组,每条记录对应一张图像。使用 `COCO73kID` 可以将标注与图像数组关联,也可以与被试 fMRI HDF5 文件中的 `coco73k_ids` 关联。`COCO2017ID` 表示对应图像在 COCO 2017 中的原始 ID。
39
+
40
+ 每条记录包含以下字段:
41
+
42
+ - `instances`:目标类别、格式为 `[x, y, width, height]` 的边界框,以及简短属性描述。
43
+ - `captions`:整张图像的自然语言描述。
44
+ - `absolute_position`:每个目标实例在图像中的粗粒度位置及其占据的网格编号。
45
+ - `relative_position`:两个目标实例之间的有向关系,分别由 `subject_id` 和 `object_id` 标识。
46
+
47
+ 实例 ID 是记录中 `instances` 列表的零基索引。当目标没有对应的单一粗粒度位置标签时,绝对位置字段 `position` 可能为空。相对关系既包含 `to the left of` 等空间关系,也包含 `with`、`on`、`hold` 和 `carry` 等上下文关系。
48
+
49
+ ```python
50
+ import json
51
+ import h5py
52
+
53
+ with open("annotations.json", encoding="utf-8") as f:
54
+ annotations = json.load(f)
55
+
56
+ # COCO73kID 是图像数组索引,也是跨模态关联键。
57
+ by_id = {record["COCO73kID"]: record for record in annotations}
58
+ record = by_id[0]
59
+
60
+ print(record["captions"])
61
+ for item in record["absolute_position"]:
62
+ instance = record["instances"][item["instance_id"]]
63
+ print(instance["category"], item["position"], item["grids"])
64
+
65
+ for relation in record["relative_position"]:
66
+ subject = record["instances"][relation["subject_id"]]["category"]
67
+ obj = record["instances"][relation["object_id"]]["category"]
68
+ print(subject, relation["relation"], obj)
69
+
70
+ # 将一名被试的 fMRI trial 与文本标注关联。
71
+ with h5py.File("subj01/func1pt8mm/subj01_nsdgeneral_betas.hdf5", "r") as f:
72
+ trial_coco_ids = f["coco73k_ids"][:]
73
+ first_trial_annotation = by_id[int(trial_coco_ids[0])]
74
+ ```
75
+
76
+ 完整加载该 JSON 文件需要在内存中保存全部记录。对于内存受限的工作流,建议使用流式 JSON 解析器,或预先将文件转换为支持索引的格式。
77
+
78
+ ## 最小加载示例
79
+
80
+ ```python
81
+ import h5py
82
+
83
+ path = "subj01/func1pt8mm/subj01_nsdgeneral_betas.hdf5"
84
+
85
+ with h5py.File(path, "r") as f:
86
+ betas = f["betas"][:] # trial x voxel,float16
87
+ betas_fp32 = betas.astype("float32")
88
+ coco73k_ids = f["coco73k_ids"][:]
89
+ sessions = f["sessions"][:]
90
+ trials = f["trials"][:]
91
+ ```
92
+
93
+ ## 访问与使用
94
+
95
+ fMRI 数据来源于自然场景数据集。使用者必须阅读并遵守 [NSD 使用条款](https://cvnlab.slite.page/p/IB6BSeW_7o/Terms-and-Conditions),并填写 [NSD 数据访问表](https://forms.gle/xue2bCdM9LaFNMeb7)。来源于 COCO 的图像和标注仍受适用的 COCO 条款及原始图像许可证约束。本仓库不授予任何额外许可。
96
+
97
+ 本数据集包含人类神经影像数据。使用者只能在符合原始知情同意、伦理审批和适用机构要求的研究中使用这些数据,不得尝试重新识别被试身份。
98
+
99
+ ## 引用
100
+
101
+ 使用本数据集时,请引用自然场景数据集:
102
+
103
+ ```bibtex
104
+ @article{allen2022massive,
105
+ title = {A massive 7T fMRI dataset to bridge cognitive neuroscience and artificial intelligence},
106
+ author = {Allen, Emily J. and St-Yves, Ghislain and Wu, Yihan and Breedlove, Jesse L. and Prince, Jacob S. and Dowdle, Logan T. and Nau, Matthias and Caron, Brad and Pestilli, Franco and Charest, Ian and Hutchinson, J. Benjamin and Naselaris, Thomas and Kay, Kendrick},
107
+ journal = {Nature Neuroscience},
108
+ volume = {25},
109
+ pages = {116--126},
110
+ year = {2022},
111
+ doi = {10.1038/s41593-021-00962-x}
112
+ }
113
+ ```
114
+
115
+ 使用 COCO 图像或标注时,请按照原始数据集的要求引用相应的 COCO 论文。