NifTK / NiftyNet

[unmaintained] An open-source convolutional neural networks platform for research in medical image analysis and image-guided therapy
http://niftynet.io
Apache License 2.0
1.36k stars 403 forks source link

Classification task #429

Closed ProofOC closed 5 years ago

ProofOC commented 5 years ago

This is probably most similar to #42 and #312, but reading through those did not provide me any clarity. I am just trying to train a trivial whole-image classification network to get a feel for the NiftyNet framework, and running into significant difficulty understanding the process and results.

I have sets of T1-weighted and T2-weighted MR images and I'm trying to train a network to discriminate the two. My label images are 1x1x1 int32 NIfTI volumes with label_0.nii having voxel value 0 and label_1.nii having voxel value 1.

config.ini

[subjects]
csv_file = /home/user/nntest/subjects.csv
spatial_window_size = (32, 32, 32)
interp_order = 1

[labels]
csv_file = /home/user/nntest/labels.csv
spatial_window_size = (1, 1, 1)
interp_order = -1

[SYSTEM]
dataset_split_file = /home/user/nntest/split.csv

[NETWORK]
name = resnet
window_sampling = resize

[TRAINING]
loss_type = CrossEntropy
max_iter=50

[INFERENCE]

[CLASSIFICATION]
image = subjects
label = labels
output_prob = False
num_classes = 2
label_normalisation = False

subjects.csv

1,/home/user/data/subj_1001/anat/T1/T1.nii.gz
2,/home/user/data/subj_1002/anat/T1/T1.nii.gz
3,/home/user/data/subj_1003/anat/T1/T1.nii.gz
...
65,/home/user/data/subj_1065/anat/T2/T2.nii.gz
66,/home/user/data/subj_1066/anat/T2/T2.nii.gz
67,/home/user/data/subj_1067/anat/T2/T2.nii.gz

labels.csv

1,/home/user/data/labels/label_0.nii
2,/home/user/data/labels/label_0.nii
3,/home/user/data/labels/label_0.nii
...
65,/home/user/data/labels/label_1.nii
66,/home/user/data/labels/label_1.nii
67,/home/user/data/labels/label_1.nii

split.csv

1,training
2,training
3,inference
...
65,training
66,training
67,inference

After python net_classify.py train -c config.ini and python net_classify.py inference -c config.ini, I have csv files in the model/output folder that look like this:

csv_67__niftynet_out.csv

,0
0,0.0
1,0.0
2,0.0

I guess I have a couple of questions.