Datasets:
The dataset viewer is not available for this split.
Error code: JobManagerCrashedError
Need help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.
SpatialBrain
SpatialBrain links 73,000 COCO natural images with spatial-semantic annotations and processed visual-cortex fMRI responses from eight Natural Scenes Dataset participants. It is intended for visual brain decoding, brain-image representation alignment, and spatial-relation modeling.
Dataset Contents
coco_images_73k_224_float16.hdf5: 73,000 images resized to 224 x 224 and stored as float16.annotations.json: COCO IDs, instances, bounding boxes, attributes, captions, absolute positions, and pairwise relations.subject_to_COCO73k_ID.hdf5: subject-specific stimulus-to-image mappings.shared_COCO73k_ID.npy: image IDs shared across participants.subjXX/func1pt8mm/*_nsdgeneral_betas.hdf5: trial-by-voxel beta matrices for the NSD general ROI.subjXX/func1pt8mm/*_prf-visualrois_betas.hdf5: trial-by-voxel beta matrices for pRF visual ROIs.subjXX/func1pt8mm/*_brainmask_betas.hdf5: trial-by-voxel beta matrices for whole-brain ROIs.
The processed beta matrices are stored as float16 HDF5 datasets. Each row represents a stimulus trial and each column represents a selected voxel. The HDF5 files also contain trial, session, COCO image ID, mask, and voxel-index metadata. Convert beta arrays to float32 at load time when required by a model; this does not restore precision lost during float16 storage.
Text Annotation Usage
annotations.json is a JSON array with one record per image. Use COCO73kID to join an annotation with the image array and with coco73k_ids in a subject's fMRI HDF5 file. COCO2017ID identifies the corresponding source image in COCO 2017.
Each record contains:
instances: object category,[x, y, width, height]bounding box, and a short attribute phrase.captions: natural-language descriptions of the full image.absolute_position: the coarse image location and occupied grid cells for each instance.relative_position: directed relations between two instances, identified bysubject_idandobject_id.
Instance IDs are zero-based indices into the record's instances list. Absolute position may be empty when no single coarse label is assigned. Relative relations include spatial terms such as to the left of as well as contextual terms such as with, on, hold, and carry.
import json
import h5py
with open("annotations.json", encoding="utf-8") as f:
annotations = json.load(f)
# COCO73kID is the image-array index and the cross-modal join key.
by_id = {record["COCO73kID"]: record for record in annotations}
record = by_id[0]
print(record["captions"])
for item in record["absolute_position"]:
instance = record["instances"][item["instance_id"]]
print(instance["category"], item["position"], item["grids"])
for relation in record["relative_position"]:
subject = record["instances"][relation["subject_id"]]["category"]
obj = record["instances"][relation["object_id"]]["category"]
print(subject, relation["relation"], obj)
# Join one subject's fMRI trials to text annotations.
with h5py.File("subj01/func1pt8mm/subj01_nsdgeneral_betas.hdf5", "r") as f:
trial_coco_ids = f["coco73k_ids"][:]
first_trial_annotation = by_id[int(trial_coco_ids[0])]
Loading the full JSON file requires memory for all records. For memory-constrained workflows, use a streaming JSON parser or preprocess the file into an indexed format once.
Minimal Loading Example
import h5py
path = "subj01/func1pt8mm/subj01_nsdgeneral_betas.hdf5"
with h5py.File(path, "r") as f:
betas = f["betas"][:] # trial x voxel, float16
betas_fp32 = betas.astype("float32")
coco73k_ids = f["coco73k_ids"][:]
sessions = f["sessions"][:]
trials = f["trials"][:]
Access and Use
The fMRI data originate from the Natural Scenes Dataset. Users must review and comply with the NSD Terms and Conditions and complete the NSD Data Access form. COCO-derived images and annotations remain subject to the applicable COCO terms and source-image licenses. No additional license is granted by this repository.
The dataset contains human neuroimaging data. Use it only for research consistent with the original consent, ethics approvals, and applicable institutional requirements. Do not attempt participant re-identification.
Citation
Please cite the Natural Scenes Dataset:
@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 Hutchinson, J. Benjamin and Naselaris, Thomas and Kay, Kendrick},
journal = {Nature Neuroscience},
volume = {25},
pages = {116--126},
year = {2022},
doi = {10.1038/s41593-021-00962-x}
}
When using COCO images or annotations, cite the relevant COCO publications as required by the original dataset.
- Downloads last month
- 16