jesseab commited on
Commit
4fdb49e
·
1 Parent(s): 77d89e1

Code changes

Browse files
Files changed (2) hide show
  1. README.md +15 -11
  2. inference_brain2vec_PCA.py +1 -1
README.md CHANGED
@@ -36,29 +36,33 @@ pip install -r requirements.txt
36
  # this script loads the radiata-ai/brain-structure dataset from Hugging Face
37
  python create_csv.py
38
 
39
- mkdir pca_cache
40
  mkdir pca_output
41
 
42
  # train the model
43
- nohup python train_brain2vec_PCA.py --inputs_csv inputs.csv --output_dir ./pca_output --pca_type standard --n_components 1200 > train_log.txt 2>&1 &
 
 
 
 
 
44
 
45
  # model inference
46
- python inference_brain2vec_PCA.py \
47
- --pca_model /path/to/pca_model.joblib \
48
- --input_images /path/to/img1.nii.gz /path/to/img2.nii.gz \
49
- --output_dir /path/to/out
50
 
51
  # or if you have a CSV with image paths:
52
- python inference_brain2vec_PCA.py \
53
- --pca_model /path/to/pca_model.joblib \
54
- --csv_input /path/to/images.csv \
55
- --output_dir /path/to/out
56
  ```
57
 
58
  # Methods
59
  Input scan image dimensions are 113x137x113, 1.5mm^3 resolution, aligned to MNI152 space (see [radiata-ai/brain-structure](https://huggingface.co/datasets/radiata-ai/brain-structure)).
60
 
61
- The image transform crops to 80 x 96 x 80, 2mm^3 resolution, and scales image intensity to range [0,1].
62
 
63
  PCA is performed using [sklearn.decomposition.PCA](https://scikit-learn.org/stable/modules/generated/sklearn.decomposition.PCA.html).
64
 
 
36
  # this script loads the radiata-ai/brain-structure dataset from Hugging Face
37
  python create_csv.py
38
 
 
39
  mkdir pca_output
40
 
41
  # train the model
42
+ nohup python train_brain2vec_PCA.py \
43
+ --inputs_csv inputs.csv \
44
+ --output_dir ./pca_output \
45
+ --pca_type standard \
46
+ --n_components 1200 \
47
+ > train_log.txt 2>&1 &
48
 
49
  # model inference
50
+ python inference_brain2vec_PCA.py \
51
+ --pca_model /path/to/pca_model.joblib \
52
+ --input_images /path/to/img1.nii.gz /path/to/img2.nii.gz \
53
+ --output_dir /path/to/out
54
 
55
  # or if you have a CSV with image paths:
56
+ python inference_brain2vec_PCA.py \
57
+ --pca_model /path/to/pca_model.joblib \
58
+ --csv_input /path/to/input.csv \
59
+ --output_dir /path/to/out
60
  ```
61
 
62
  # Methods
63
  Input scan image dimensions are 113x137x113, 1.5mm^3 resolution, aligned to MNI152 space (see [radiata-ai/brain-structure](https://huggingface.co/datasets/radiata-ai/brain-structure)).
64
 
65
+ The image transform crops to 80 x 96 x 80, 2mm^3 resolution, and scales image intensity to range [0,1]. Images are flattened to 614400-length 1D vectors.
66
 
67
  PCA is performed using [sklearn.decomposition.PCA](https://scikit-learn.org/stable/modules/generated/sklearn.decomposition.PCA.html).
68
 
inference_brain2vec_PCA.py CHANGED
@@ -18,7 +18,7 @@ Or, if you have a CSV with image paths:
18
 
19
  python inference_brain2vec_PCA.py \
20
  --pca_model /path/to/pca_model.joblib \
21
- --csv_input /path/to/images.csv \
22
  --output_dir /path/to/out
23
  """
24
 
 
18
 
19
  python inference_brain2vec_PCA.py \
20
  --pca_model /path/to/pca_model.joblib \
21
+ --csv_input /path/to/input.csv \
22
  --output_dir /path/to/out
23
  """
24