A scalable framework for fMRI dataset aggregation and modeling of human vision
Project description
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],
"deeprecon": "all",
},
folder="./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="./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")
]
)
Visualizing model predictions
inference.plot(
image=Image.open("cat.jpg"),
save_as="predicted_voxel_responses.html",
dataset_name="NSD",
subject_id=1,
mode="inflated",
)
Dev Setup
git clone 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.2.tar.gz
(34.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mosaic_dataset-0.0.2.tar.gz.
File metadata
- Download URL: mosaic_dataset-0.0.2.tar.gz
- Upload date:
- Size: 34.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e1e11a2cafe422160a7af99e5de4cf97025b184d756634cd5d91a6c114d49f57
|
|
| MD5 |
d588f5ea82e9d587575421b632b69b49
|
|
| BLAKE2b-256 |
32e63784cc5c3dd48a451dd35fce6941ce2d4160e7c4347dc905d40c7d09b7b1
|
File details
Details for the file mosaic_dataset-0.0.2-py3-none-any.whl.
File metadata
- Download URL: mosaic_dataset-0.0.2-py3-none-any.whl
- Upload date:
- Size: 41.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
30d90eee66c0c98b91e8f868653a4676f62423c849c6e9f1c6f2ffb0c92c2502
|
|
| MD5 |
23e96d9902c300c8b8e3885a583b9c73
|
|
| BLAKE2b-256 |
dd354bde57c1b5d116a6cf97d6ee540d676257095d6140eed35e87ba69a377e4
|