Views
No views yet

causal-conv1d, mamba-ssm, and flash-attn.1conda create -n flexibrain python=3.10
2conda activate flexibrain
3pip install -r requirements.txt
4pip install -e .1python -m flexibrain --help
2python -m flexibrain pretrain --help
3python -m flexibrain downstream --help96 x 96 x 96 x T--default-tr / data.default_tr.T_prime and tau_seconds control the selected temporal length:1kt = round(tau_seconds / TR)
2T_selected = T_prime * kt1python data_process.py \
2 --input-root /path/to/input_root \
3 --output-root /path/to/output_root \
4 --spaces all \
5 --groups class0,class1,class21input_root/
2|-- nativespace/class0/*.nii.gz
3|-- t1space/class0/*.nii.gz
4`-- mnispace/class0/*.nii.gz--groups. For MNI-space inputs, provide --template-mask when the default mask is not available.1/path/to/sub-0001_bold.nii.gz
2/path/to/sub-0002_bold.nii.gz1Subject,Group_idx
2003_S_0908,2
3011_S_0002,1
41001,0Subject and Group_idx. path_id_mode=auto supports ADNI-style IDs such as 003_S_0908, ADHD-style filenames, and fallback digit IDs.python -m flexibrain pretrain --config configs/pretrain_example.yaml1python -m flexibrain pretrain \
2 --train-list /path/to/pretrain_train.txt \
3 --val-list /path/to/pretrain_val.txt \
4 --checkpoint-dir ./checkpoints/pretrain/example \
5 --log-dir ./logs/pretrain/example \
6 --embed-dim 512 \
7 --depth 24 \
8 --predictor-depth 2 \
9 --bimamba-type v2 \
10 --if-devide-out \
11 --batch-size 4 \
12 --epochs 30 \
13 --lr 5e-4 \
14 --weight-decay 0.05 \
15 --warmup-epochs 3 \
16 --mask-ratio 0.65 \
17 --grad-accumulation-steps 4 \
18 --t-prime 30 \
19 --tau-seconds 6.0 \
20 --use-amp1checkpoint_latest.pt
2checkpoint_best.pt
3pretrain_*.logpython -m flexibrain downstream --config configs/downstream_example.yaml1python -m flexibrain downstream \
2 --train-list /path/to/downstream_train.txt \
3 --val-list /path/to/downstream_val.txt \
4 --test-list /path/to/downstream_test.txt \
5 --csv /path/to/labels.csv \
6 --pretrain-checkpoint /path/to/checkpoint_best.pt \
7 --num-classes 3 \
8 --head-type transformer \
9 --batch-size 8 \
10 --epochs 30 \
11 --lr 1e-5 \
12 --lr-backbone 6e-6 \
13 --lr-head 6e-5 \
14 --checkpoint-dir ./checkpoints/downstream/example \
15 --log-dir ./logs/downstream/example \
16 --use-ampdownstream_best.pt. The test set is evaluated once at the end after loading that best validation checkpoint, and the final metrics are written to test_metrics.json.data/:1configs/pretrain_example.yaml
2configs/downstream_example.yaml/path/to/checkpoint_best.ptuse_checkpoint_config: true, model-shape settings stored in the checkpoint are applied before loading the backbone.LICENSE and NOTICE for license boundaries and preserved notices.