Add model card and RBF transform
Browse filesFiles changed (2)
- README.mdAdded+42
- rbf_transform.npzAdded+3
123456789101112131415161718192021222324252627282930313233343536373839404142---tags:- pytorch- fmri- neuroscience- representation-learning- brain-atlas---
# BrainLEAP
[](https://github.com/OneMore1/BrainLEAP) [](https://huggingface.co/OneMore1/BrainLEAP)
BrainLEAP is a pretrained fMRI encoder that pairs each region's time series with an encoding of its spatial support. This release contains the RBF-conditioned main model and the frozen transform needed to use it with a new atlas. The implementation and input manifest format are in [OneMore1/BrainLEAP](https://github.com/OneMore1/BrainLEAP/tree/10e93cc0c52a731de7b970d7b8608946f2ea6aa8).
| File | Use || --- | --- || `brainleap.pth` | PyTorch checkpoint after the 160th epoch. The frozen extractor loads the encoder, not the pretraining projector. || `rbf_transform.npz` | The paired transform: spatial anchors, RBF bandwidths, standardization statistics and PCA basis. Use it as supplied; do not refit it on the target atlas. |
## Inputs and outputs
The encoder takes preprocessed ROI time series and matching 128-dimensional geometry codes in the same ROI order. The default window is 200 time points. A forward pass yields a 768-dimensional CLS representation per window, or a 768-dimensional contextual representation per ROI after temporal pooling. These are features, not diagnostic scores or calibrated predictions.
The main encoder has 12 Transformer blocks, 12 attention heads and 96,240,896 parameters. It was trained on 47,943 windows. During pretraining, each ROI window was min-max scaled before cropping and augmentation, and each view was then z-scored over time. For frozen extraction, the loader z-scores each ROI window directly without augmentation. Supply unscaled, preprocessed ROI signals to the loader; do not manually apply a second normalization.
## Use with the BrainLEAP code
Install the [BrainLEAP source package](https://github.com/OneMore1/BrainLEAP) and run the commands below from its repository root. Download both files from this model repository into `checkpoints/`. Keep the checkpoint as downloaded: `configs/brainleap.yaml` checks its file digest and verifies the RBF transform identity recorded in the encoded atlas.
```bashbrainleap-geometry encode --atlas data/atlas.nii.gz --transform checkpoints/rbf_transform.npz --out data/atlas_ge.npzbrainleap-extract --config configs/brainleap.yaml --manifest data/downstream.csv --checkpoint checkpoints/brainleap.pth --output outputs/features --device cpu```
Use the generated geometry file in the manifest, with paths relative to the manifest location; see the [data format](https://github.com/OneMore1/BrainLEAP/blob/10e93cc0c52a731de7b970d7b8608946f2ea6aa8/docs/data.md). For regional features, add `--representation roi` and use a separate output directory. The model does not require an atlas-ID embedding. It does require the atlas mask to be in the coordinate space of the supplied transform and each feature row to identify the correct ROI.
## Intended use and limits
For research on fMRI representation learning, frozen readouts and cross-atlas transfer. No participant data, cohort manifests or task-specific readout heads are included. Performance on a different cohort, acquisition protocol or atlas must be evaluated independently. This release is not validated for clinical diagnosis or individual decision-making.
The source repository's Apache-2.0 licence applies to the code. It does not grant a licence to the model weights, the paired transform or the underlying datasets.123version https://git-lfs.github.com/spec/v1oid sha256:0f9c488a828efac15172b1eed1d1089decc6df27cbd9300ab959c3def6566fd7size 374237README.mdAdded+42
rbf_transform.npzAdded+3