Reference¶
BrainFMBench evaluates frozen features from brain MRI models on five Reproducible Brain Charts datasets (NKI, HBN, PNC, BHRC, CCNP) across eight tasks: sex, age, BMI, handedness, p factor, p factor nonzero, internalizing and externalizing. You submit your model; we run feature extraction on our cluster against preprocessed data (turboprep, turboprep-affine, CAT12 or raw), then score the returned features.
What you submit¶
Open a Pull Request adding one folder under models/:
models/<your-model>/
model.yaml # metadata
extract.py # your feature-extraction code (fixed interface, see below)
weights.txt # direct-download URL(s) to your checkpoint(s)
requirements.txt # optional; pinned dependencies for your extract.py
You do not upload weights to this repo. Host them yourself and list the URL(s); we download them at run time.
See example-submission/ for a minimal, working template you can copy.
extract.py — the interface¶
Your extract.py must define exactly this function:
def extract(input_dir, output_csv, weights_dir):
...
input_dir— a directory of preprocessed volumes, one folder per subject:<input_dir>/<subject_id>/normalized.nii.gz. (This is turboprep output.)
CAT12. Set preprocessing: cat12 to receive the CAT12 VBM modulated grey
matter map instead: <input_dir>/<subject_id>/mwp1.nii.
Affine registration. Set preprocessing: turboprep-affine for turboprep
with affine registration to MNI 1 mm, shape 193 × 229 × 193. Its normalized.nii.gz is z scored with background near
−60, so mask with the accompanying mask.nii.gz, not img > 0.
Your own preprocessing. Set preprocessing: raw to receive the
unprocessed T1 instead: <raw_dir>/<subject_id>/T1w.nii.gz. Scans come
straight from the scanner, so shapes and voxel sizes vary by site
(e.g. 1 mm or 0.8 mm). Add a preprocess.py next to extract.py:
def preprocess(raw_dir, out_dir):
# read <raw_dir>/<subject_id>/T1w.nii.gz
# write <out_dir>/<subject_id>/<any files your extract.py reads>
It runs once per dataset before extract, and extract then receives
out_dir as its input_dir. The output is cached and only rebuilt when
preprocess.py changes. Without preprocess.py, extract receives the
raw folder directly. Set walltime in model.yaml to cover preprocessing,
and list any tools beyond pip packages (ANTs, FSL, ...) in your PR.
If preprocessing cannot run on the validator's tiny random test volume,
set cluster_only: true.
- weights_dir — a directory containing the checkpoint file(s) downloaded
from your weights.txt.
- output_csv — write features here as subject_id,f0,f1,...,fN,
one row per subject.
Extract frozen features only (a forward pass / embedding). Do not train. Determinism is expected — set your seeds.
model.yaml¶
name: My Model
authors:
- Lastname, F., et al.
submitted_by: Your Name
description: one-line description
preprocessing: turboprep # turboprep (default), turboprep-affine, cat12, or raw
embedding_dim: 768 # your feature dimension
architecture: short description
paper: https://... # paper or preprint (DOI, arXiv, bioRxiv)
model_card: https://... # e.g. Hugging Face model page
code: https://... # public code repository
project: https://... # optional: project or platform the model is part of
datasets: [NKI, HBN, PNC, BHRC, CCNP]
tasks: [sex, age, bmi, p_factor_nonzero, p_factor, internalizing, externalizing, handedness]
paper, model_card and code are shown as links on the leaderboard, so please
include whichever exist. If you are an author of the benchmark or the model was
designed or tuned on one of the benchmark datasets, add a note: explaining it;
it is shown as a footnote next to your results.
weights.txt¶
One direct-download URL per line. Supported hosts:
- Hugging Face — use the
/resolve/URL, e.g.https://huggingface.co/<user>/<model>/resolve/main/checkpoint.pth - Zenodo, GitHub Releases, or an institutional raw link (
/-/raw/)
Not supported: Google Drive, Dropbox, or /blob/ viewer pages (they return
HTML, not the file). Multi-file checkpoints: one URL per line.
The evaluation environment¶
By default your code runs in a shared PyTorch environment on the cluster. Available packages include: torch, torchvision, monai, nibabel, numpy, scipy, scikit-learn, pandas, nilearn, einops, SimpleITK, tqdm and more.
If your model needs versions that differ from the shared environment, add a
requirements.txt to your submission folder. When present, extraction runs in
an isolated virtualenv built from that file instead of the shared environment.
Pin exact versions:
torch==2.4.0
monai==1.3.0
Every package must be available in the Alliance wheelhouse — cluster compute
nodes have no outbound network, so PyPI is unreachable at build time. Check
availability at https://docs.alliancecan.ca/wiki/Available_Python_wheels before
submitting. If something you need is missing, open an issue and we will work
out an alternative. The venv is built once per submission, reused across
datasets, and rebuilt only when requirements.txt changes.
What happens after you open the PR¶
- Automated validation checks your submission is well-formed (yaml parses,
extract.pydefinesextract(...), weights URLs are direct download links). If you supplied arequirements.txt, yourextract.pyis run against a synthetic volume inside an environment built from it. - A maintainer reviews and merges.
- On merge, extraction runs on the cluster; the resulting features are scored and the leaderboard updates automatically.
Because extraction runs on our allocation, only maintainer-approved submissions are executed — we never run unreviewed code automatically.
Versioning¶
Results are versioned so every number can be cited and reproduced.
- New model: no new version. The leaderboard updates on merge.
- Minor release, e.g. 1.1: new datasets, tasks or preprocessing options. Existing numbers do not change.
- Major release, e.g. 2.0: a new probe head or CV scheme, or any change to existing numbers, such as label corrections.
Each release is tagged, listed in Releases and archived on Zenodo with a DOI.
Releases are quarterly: changes to datasets, tasks, preprocessing or scoring are collected and released together every three months, with the next release planned for March 2027. Suggestions are welcome as an issue or a PR; suggestions received before a release are considered for it.