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.37k stars 404 forks source link

all-zero output [deepmedic] #83

Closed YilinLiu97 closed 6 years ago

YilinLiu97 commented 6 years ago

Hi, I retrained the deepmedic model with my dataset. The training looks fine, but the segmented output is either all-zero or like this: screenshot 2018-04-22 23 45 38

My config file:

[T1]
path_to_search = /home/yilinliu/Dataset/Training
filename_contains =
filename_not_contains =
spatial_window_size = (57,57,57)
pixdim = (1.0, 1.0, 1.0)
axcodes=(A, R, S)
interp_order = 3

[parcellation]
path_to_search = /home/yilinliu/Dataset/FullStructureLabels
filename_contains = _RIGHT_all_labels_8bit_path
filename_not_contains =
spatial_window_size = (9,9,9)
pixdim = (1.0, 1.0, 1.0)
axcodes=(A, R, S)
interp_order = 0

%system configuration sections
[SYSTEM]
cuda_devices = 0
num_threads = 2
num_gpus = 1
model_dir = ./models/deepmedic

[NETWORK]
name = deepmedic
activation_function = prelu
batch_size = 10
decay = 0
reg_type = L2

% volume level preprocessing
volume_padding_size = 12
% histogram normalisation
histogram_ref_file = ./example_volumes/monomodal_parcellation/standardisation_models.txt
norm_type = percentile
cutoff = (0.01, 0.99)
normalisation = False
whitening = True
normalise_foreground_only=True
foreground_type = otsu_plus
multimod_foreground_type = and

queue_length = 25
window_sampling = uniform

[TRAINING]
sample_per_volume = 1000
rotation_angle = (-10.0, 10.0)
scaling_percentage = (-10.0, 10.0)
lr = 0.01
loss_type = CrossEntropy
starting_iter = 0
save_every_n = 3
max_iter = 500
max_checkpoints = 1000

[INFERENCE]
border = (24,24,24)
#inference_iter = 294
save_seg_dir = ./segmentation_output/
output_interp_order = 0
spatial_window_size = (105,105,105)

I've tried using different iterations for the inference, but the segmentation results show no improvement.

Any help is appreciated!!

wyli commented 6 years ago

Hi @YilinLiu97 The config looks ok to me. I'd suggest that you start with simple tasks, e.g. training with a few volumes (or even synthetic examples) and making inferences on the training cases. In that way we can narrow down the issue -- if there is any.

YilinLiu97 commented 6 years ago

Hi @wyli , I've tried using just 1 subject as the input and it just outputs zeros (though the loss has been decreased to ~0.008.) Also I'm using the training sample for inference as the 'exclude_fraction_for_validation' function doesn't seem to be implemented in the 0.2.1 version or it's simply not included in the config file.

MancaZerovnikMekuc commented 6 years ago

I have the same problem as @wyli . The loss on validation as well as on the training set is getting really low but the result after inference is mostly 0. Is this because of shape constraints?

fepegar commented 6 years ago

Probably. Have you read the U-Net shape tutorial?

MancaZerovnikMekuc commented 6 years ago

Thank you. Yes I have read it. I have solved my problem with the help of #76 . As suggested there I had changed my loss function from Dice to generalised Dice (GDSC) since my data is imabalanced.