File size: 4,663 Bytes
9bc3674
 
d0522cf
 
 
 
c7dee24
 
 
 
d0522cf
a2394aa
d0522cf
 
 
 
c7dee24
 
 
 
 
 
 
 
d0522cf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c7dee24
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d0522cf
 
c7dee24
5a54381
c7dee24
 
bf9652f
 
 
 
 
 
 
 
 
9bc3674
bf9652f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
---
license: other
dataset_info:
  features:
  - name: subject_id
    dtype: int64
  - name: trial_id
    dtype: int64
  - name: session_id
    dtype: int64
  - name: nsd_id
    dtype: int64
  - name: image
    dtype: image
  - name: activity
    dtype: image
  - name: subject
    dtype: string
  - name: flagged
    dtype: bool
  - name: BOLD5000
    dtype: bool
  - name: shared1000
    dtype: bool
  - name: coco_split
    dtype: string
  - name: coco_id
    dtype: int64
  - name: objects
    struct:
    - name: area
      sequence: int64
    - name: bbox
      sequence:
        sequence: float64
    - name: category
      sequence: string
    - name: iscrowd
      sequence: int64
    - name: segmentation
      list:
      - name: counts
        dtype: string
      - name: poly
        sequence:
          sequence: float64
      - name: size
        sequence: int64
    - name: supercategory
      sequence: string
    - name: target
      sequence: int64
  - name: captions
    sequence: string
  - name: repetitions
    struct:
    - name: subject1_rep0
      dtype: int64
    - name: subject1_rep1
      dtype: int64
    - name: subject1_rep2
      dtype: int64
    - name: subject2_rep0
      dtype: int64
    - name: subject2_rep1
      dtype: int64
    - name: subject2_rep2
      dtype: int64
    - name: subject3_rep0
      dtype: int64
    - name: subject3_rep1
      dtype: int64
    - name: subject3_rep2
      dtype: int64
    - name: subject4_rep0
      dtype: int64
    - name: subject4_rep1
      dtype: int64
    - name: subject4_rep2
      dtype: int64
    - name: subject5_rep0
      dtype: int64
    - name: subject5_rep1
      dtype: int64
    - name: subject5_rep2
      dtype: int64
    - name: subject6_rep0
      dtype: int64
    - name: subject6_rep1
      dtype: int64
    - name: subject6_rep2
      dtype: int64
    - name: subject7_rep0
      dtype: int64
    - name: subject7_rep1
      dtype: int64
    - name: subject7_rep2
      dtype: int64
    - name: subject8_rep0
      dtype: int64
    - name: subject8_rep1
      dtype: int64
    - name: subject8_rep2
      dtype: int64
  splits:
  - name: train
    num_bytes: 26695182666.0
    num_examples: 195000
  download_size: 20619988360
  dataset_size: 26695182666.0
task_categories:
- image-to-image
- object-detection
tags:
- biology
- neuroscience
- fmri
size_categories:
- 100K<n<1M
---

# NSD-Flat
[[`GitHub`]](https://github.com/clane9/NSD-Flat) [[🤗 `Hugging Face Hub`]](https://huggingface.co/datasets/clane9/NSD-Flat)

A Hugging Face dataset of pre-processed brain activity flat maps from the [Natural Scenes Dataset](https://naturalscenesdataset.org/), constrained to a visual cortex region of interest and rendered as PNG images.

## Load the dataset

Load the dataset from [Hugging Face Hub](https://huggingface.co/datasets/clane9/NSD-Flat)

```python
from datasets import load_dataset

dataset = load_dataset("clane9/NSD-Flat", split="train")
```

## Building the dataset

### 1. Download source data

Run [`download_data.sh`](download_data.sh) to download the required source data:

- NSD stimuli images and presentation info
- COCO annotations
- NSD beta activity maps in fsaverge surface space

```bash
bash download_data.sh
```

### 2. Convert the COCO annotations

Run  [`convert_nsd_annotations.py`](convert_nsd_annotations.py) to crop and reorganize the COCO annotations for NSD.

```bash
python convert_nsd_annotations.py
```

### 3. Generate the dataset

Run [`generate_dataset.py`](generate_dataset.py) to generate the huggingface dataset in Arrow format.

```bash
python generate_dataset.py --img_size 256 --workers 8
```

## Citation

If you find this dataset useful, please consider citing:

```
@article{allen2022massive,
  title     = {A massive 7T fMRI dataset to bridge cognitive neuroscience and artificial intelligence},
  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 others},
  journal   = {Nature neuroscience},
  volume    = {25},
  number    = {1},
  pages     = {116--126},
  year      = {2022},
  publisher = {Nature Publishing Group US New York}
}
```

```
@misc{lane2023nsdflat,
  author       = {Connor Lane},
  title        = {NSD-Flat: Pre-processed brain activity flat maps from the Natural Scenes Dataset},
  howpublished = {\url{https://huggingface.co/datasets/clane9/NSD-Flat}},
  year         = {2023},
}
```

## License

Usage of this dataset constitutes agreement to the [NSD Terms and Conditions](https://cvnlab.slite.page/p/IB6BSeW_7o/Terms-and-Conditions).