Skip to content
This repository has been archived by the owner on Mar 17, 2021. It is now read-only.

Classification task #429

Closed
ProofOC opened this issue Aug 6, 2019 · 0 comments
Closed

Classification task #429

ProofOC opened this issue Aug 6, 2019 · 0 comments
Assignees

Comments

@ProofOC
Copy link

ProofOC commented Aug 6, 2019

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.

  • I am new to NiftyNet -- is there is a misconfiguration for what I'm trying to achieve?
  • If the configuration is correct, what is the correct interpretation of the output above? I am expecting a prediction of '1' or '0'.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants