Code changes
Browse files- README.md +15 -11
- 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
|
|
|
|
|
|
|
|
|
|
|
44 |
|
45 |
# model inference
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
|
51 |
# or if you have a CSV with image paths:
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
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/
|
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 |
|