Skip to content

Commit f159dd6

Browse files
committed
Finalizing scripts for release
1 parent 05f8d7b commit f159dd6

File tree

8 files changed

+79
-53
lines changed

8 files changed

+79
-53
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ Code for the paper Vladimir S. Fonov, Mahsa Dadar, The PREVENT-AD Research Group
3636
## Files
3737
3838
* Shell scripts:
39-
* `download_minimal_results.sh` - download pretrained model to run automatic qc
40-
* `make_figures.sh` - Draw Figure 2 and 3 for the paper
39+
* `download_minimal_models.sh` - download QCResNET-18 with reference pretrained model to run automatic qc (43mb)
40+
* `download_all_models.sh` - download all pretrained models to run automatic qc
4141
* Directory `python`:
4242
* `run_all_experiments.sh` - run experiments with different versions of ResNet and SquezeNet
4343
* `aqc_apply.py` - apply pre-trained network
44-
* `aqc_convert_to_cpu.py`- helper script to convert network from GPU to CPU
44+
* `aqc_convert_to_cpu.py`- helper script to convert network from GPU to CPU
4545
* `aqc_data.py` - module to load QC data
4646
* `aqc_training.py` - deep nearal net training script
4747
* `model/resnet_qc.py` - module with ResNET implementation, based on https://github.com/pytorch/vision/blob/master/torchvision/models/resnet.py
@@ -50,7 +50,7 @@ Code for the paper Vladimir S. Fonov, Mahsa Dadar, The PREVENT-AD Research Group
5050
* Image files:
5151
* `mni_icbm152_t1_tal_nlin_sym_09c_0.jpg`,`mni_icbm152_t1_tal_nlin_sym_09c_1.jpg`,`mni_icbm152_t1_tal_nlin_sym_09c_2.jpg` - reference slices, needed for both training and running pretrained model
5252
* `results` - figures for the paper
53-
* `data` - training data and reference image
53+
* `data` - reference images
5454
5555
## Validating correct operation (requires minc-toolkit and minc2_simple python module)
5656

download_all_models.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#! /bin/bash
2+
set -e
3+
prefix="https://github.com/vfonov/DARQ/releases/download/v0.1/"
4+
5+
echo "Downloading all pretrained models"
6+
7+
function download {
8+
set -e
9+
for f in $@;do
10+
if [ ! -e ${f} ];then
11+
curl --location "${prefix}/${f}" -o ${f}
12+
fi
13+
done
14+
}
15+
16+
download DARQ_models_all.tar.xz
17+
18+
echo "Unpacking..."
19+
20+
tar xJf DARQ_models_all.tar.xz

download_minimal_models.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#! /bin/bash
2+
set -e
3+
prefix="https://github.com/vfonov/DARQ/releases/download/v0.1/"
4+
5+
echo "Downloading QCResNET-18 with reference"
6+
7+
function download {
8+
set -e
9+
for f in $@;do
10+
if [ ! -e ${f} ];then
11+
curl --location "${prefix}/${f}" -o ${f}
12+
fi
13+
done
14+
}
15+
16+
download DARQ_models_minimal.tar.xz
17+
18+
echo "Unpacking..."
19+
20+
tar xJf DARQ_models_minimal.tar.xz

download_minimal_results_python.sh

Lines changed: 0 additions & 21 deletions
This file was deleted.

make_figures_2_3.sh

Lines changed: 0 additions & 24 deletions
This file was deleted.

python/aqc_apply.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,17 @@ def parse_options():
7575

7676

7777
if params.load is None:
78-
params.load = default_data_dir + os.sep \
79-
+ ('dist' if params.dist else 'cls')+os.sep \
80-
+ 'model_' + params.net + ('_ref' if params.ref else '') + os.sep + \
81-
'best_tnr.pth' # if params.gpu else 'best_tnr_cpu.pth' )
78+
79+
if params.dist:
80+
params.load = default_data_dir + os.sep \
81+
+ 'dist' + os.sep \
82+
+ 'model_dist_' + params.net + ('_ref' if params.ref else '') + os.sep + \
83+
'best_loss.pth'
84+
else:
85+
params.load = default_data_dir + os.sep \
86+
+ 'cls' + os.sep \
87+
+ 'model_' + params.net + ('_ref' if params.ref else '') + os.sep + \
88+
'best_tnr.pth'
8289

8390
if not os.path.exists(params.load):
8491
print("Missing model:",params.load,file=sys.stderr)
File renamed without changes.

results/make_figures_2_3.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#! /bin/sh
2+
3+
# figure 3: network
4+
dot aqc_net.dot -Tpng -Gsize=9,10\! -Gdpi=300 -o Figure_3.png
5+
6+
# figure 2: examples
7+
montage -tile 4x3 \
8+
-geometry +1+1 \
9+
-pointsize 22 \
10+
-label "" \
11+
../data/bestlinreg_claude/ADNI/002_S_0295/m72/qc/aqc_002_S_0295_m72_0.jpg \
12+
../data/bestlinreg_claude/ADNI/002_S_0295/m72/qc/aqc_002_S_0295_m72_1.jpg \
13+
../data/bestlinreg_claude/ADNI/002_S_0295/m72/qc/aqc_002_S_0295_m72_2.jpg \
14+
-label "" label:"A: Passed QC" \
15+
../data/bestlinreg-xcorr/ADNI/002_S_0619/m12/qc/aqc_002_S_0619_m12_0.jpg \
16+
../data/bestlinreg-xcorr/ADNI/002_S_0619/m12/qc/aqc_002_S_0619_m12_1.jpg \
17+
../data/bestlinreg-xcorr/ADNI/002_S_0619/m12/qc/aqc_002_S_0619_m12_2.jpg \
18+
-label "" label:"B: Failed QC" \
19+
-label "Axial" data/mni_icbm152_t1_tal_nlin_sym_09c_0.jpg \
20+
-label "Sagittal" data/mni_icbm152_t1_tal_nlin_sym_09c_1.jpg \
21+
-label "Coronal" data/mni_icbm152_t1_tal_nlin_sym_09c_2.jpg \
22+
-label "" label:"C: Reference:\nMNI ICBM 152\n2009c" \
23+
Figure_2.png
24+

0 commit comments

Comments
 (0)