Skip to main content

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

Project description

mosaic-dataset

python module to load the mosaic dataset (Lahner et al.)

pip install git+https://github.com/Mayukhdeb/mosaic-dataset.git
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)

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.0.tar.gz (32.3 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.0-py3-none-any.whl (39.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mosaic_dataset-0.0.0.tar.gz
  • Upload date:
  • Size: 32.3 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.0.tar.gz
Algorithm Hash digest
SHA256 2176854aba6f889d5695fbf7cc5a22b2512f0f96e3e1ff3c61a72904f91149c6
MD5 887acbe8d9865f30185193ae37471c34
BLAKE2b-256 fac00fa2c54f32b14589960e8446d9281c53efe1942ee315c937eebe0237dbf2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mosaic_dataset-0.0.0-py3-none-any.whl
  • Upload date:
  • Size: 39.8 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a356b78f47738ca607adad290938ed4c4552742179ee9cecb347cd024faee203
MD5 2cb15a2167e94a318f0473d2333f57cd
BLAKE2b-256 0058bb182eb91bde1bbdaf6ae58dbe64693561faca85698e5844f045e2e916ce

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