--- license: mit language: - en task_categories: - image-classification tags: - medical - brain-data - mri pretty_name: 3D Brain Structure MRI PCA --- ## 🧠 Model Summary # brain2vec An linear PCA model for brain structure T1 MRIs. The models takes in a 3d MRI NIfTI file and compresses to 1200 latent dimensions before reconstructing the image. # Training data [Radiata brain-structure](https://huggingface.co/datasets/radiata-ai/brain-structure): 3066 scans from 2085 individuals in the 'train' split. Mean age = 45.1 +- 24.5, including 2847 scans from cognitively normal subjects and 219 scans from individuals with an Alzheimer's disease clinical diagnosis. # Example usage ``` # get brain2vec model repository git clone https://huggingface.co/radiata-ai/brain2vec cd brain2vec # set up virtual environemt python3 -m venv venv_brain2vec source venv_brain2vec/bin/activate # install Python libraries pip install -r requirements.txt # create the csv file inputs.csv listing the scan paths and other info # this script loads the radiata-ai/brain-structure dataset python create_csv.py mkdir ae_cache mkdir ae_output # train the model nohup python brain2vec.py train \ --dataset_csv /home/ubuntu/brain2vec/inputs.csv \ --cache_dir ./ae_cache \ --output_dir ./ae_output \ --n_epochs 10 \ > train_log.txt 2>&1 & # run model inference to create *_embeddings.npz files python brain2vec.py infererence \ --dataset_csv home/ubuntu/brain2vec/inputs.csv \ --aekl_ckpt /home/ubuntu/brain2vec/autoencoder_final.pth \ --output_dir /home/ubuntu/brain2vec ``` # Methods transform: (80, 96, 80) pixdim=2 10 epochs max_batch_size: int = 2, batch_size: int = 16, lr: float = 1e-4, # References Puglisi Pinaya # Citation ``` @dataset{Radiata-Brain-Structure, author = {Jesse Brown and Clayton Young}, title = {Brain-Structure: Processed Structural MRI Brain Scans Across the Lifespan}, year = {2025}, url = {https://huggingface.co/datasets/radiata-ai/brain-structure}, note = {Version 1.0}, publisher = {Hugging Face} } ``` # License MIT License Copyright (c) 2025 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.