Skip to main content

A scalable framework for fMRI dataset aggregation and modeling of human vision

Project description

mosaic-dataset

Load the mosaic dataset (Lahner et al.) and the associated pre-trained models

pip install mosaic-dataset
import mosaic

dataset = mosaic.load(
    names_and_subjects={
        "nsd": [2,3],
        "deep_recon": "all",
    },
    folder="/research/datasets/mosaic-dataset" 
)

print(dataset[0])

Visualization

import mosaic
from mosaic.utils import visualize
from IPython.display import IFrame

dataset = mosaic.load(
    names_and_subjects={
        "bold_moments": [1],
    },
    folder="/research/datasets/mosaic-dataset" 
)

visualize(
    betas=dataset[0]["betas"],
    ## set rois to None if you want to visualize all of the rois
    rois=[
        "L_FFC",
        "R_FFC",
    ],
    ## other modes are: 'white', 'midthickness', 'pial', 'inflated', 'very_inflated', 'flat', 'sphere'
    mode = "midthickness",
    save_as = "plot.html",
)

Loading pre-trained models

import mosaic

model = mosaic.from_pretrained(
    backbone_name="resnet18",
    vertices="visual",
    framework="multihead",
    subjects="all"
)

Running inference with pre-trained models:

from mosaic.utils.inference import MosaicInference
from PIL import Image

inference = MosaicInference(
    model=model,
    batch_size=32,
    device="cuda:0"
)

results = inference.run(
    images = [
        Image.open("cat.jpg"),
        Image.open("cat.jpg")
    ]
)

## (2, num_voxels)
print(results.shape)

Dev Setup

pip install git+https://github.com/Mayukhdeb/mosaic-dataset.git
cd mosaic-dataset
python setup.py develop

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mosaic_dataset-0.0.1.tar.gz (32.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mosaic_dataset-0.0.1-py3-none-any.whl (39.9 kB view details)

Uploaded Python 3

File details

Details for the file mosaic_dataset-0.0.1.tar.gz.

File metadata

  • Download URL: mosaic_dataset-0.0.1.tar.gz
  • Upload date:
  • Size: 32.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for mosaic_dataset-0.0.1.tar.gz
Algorithm Hash digest
SHA256 892c9f32faa89b123813f9b642572325837e366c25d56001a7de9c7f0f17a33c
MD5 2b134f5c2959312b24e9c8828d43b209
BLAKE2b-256 7173ccaf0d73a3b70274793ebff1d29eaa4004374b5a94e024d1b0aaaa820bd9

See more details on using hashes here.

File details

Details for the file mosaic_dataset-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: mosaic_dataset-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 39.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for mosaic_dataset-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 07b782b5e5f8115814c2da120ab28dbbd711500343df3ed34c1f64bbc99dee0b
MD5 3b52c157add1b2bbf4a0311d7be4326e
BLAKE2b-256 cab7bc93c057c1be328d71bd848ceb8ed7719dadf932719427e3e0c522c3f3c0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page