MIC-DKFZ / BraTS2017

Apache License 2.0
74 stars 16 forks source link

Why transpose the seg? #15

Closed yianzhongguo closed 5 years ago

yianzhongguo commented 5 years ago

@FabianIsensee Hi, sir. I am troubled by the line 219 in the train_network.py : seg = data_dict["seg_onehot"].astype(np.float32).transpose(0, 2, 3, 4, 1).reshape((-1, num_classes)). Why transpose the seg ?

FabianIsensee commented 5 years ago

because the 'class' dimension must be at the very end before reshaping to a vector. That was originally needed to make it work with crossentropy loss. You could write the dice loss differently so that it takes tensors but I am not working with that code anymore and am thus not going through the hassle