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 405 forks source link

Loss is low enough but seg result is pretty bad #106

Closed YilinLiu97 closed 6 years ago

YilinLiu97 commented 6 years ago

screenshot 2018-05-28 12 10 08

This is the seg result when loss is about 0.13 (Originally it was ~1.2). Does anyone know what happened? I used the balanced sampler. Previously I used a different architecture (same dataset) and it worked well. I also tried using this architecture (with the same dataset) but on a different framework, and it also worked very well.

Thanks so much.

Zach-ER commented 6 years ago

What are you segmenting? The balanced sampler makes it equally likely for each class label to be at the centre of the image. For unbalanced problems, this may result in the network choosing these less-likely labels at too many points.

YilinLiu97 commented 6 years ago

@Zach-ER Thanks for the reply. I'm segmenting some very small subcortical structures, and use the patch size of 27x27x27. The network I used is something I implemented myself using the Niftynet, and that architecture has been tested on other framework - it worked very well. Yes I'm also aware of that issue - too many maybe redundant patches from less-likely labels, but since this could be a highly imbalanced problem, and my patch size is small (required by the architecture), it seems that I have to use the balanced sampler and extract a lot of patches - so there may be a trade-off here (?)

I've also tried the uniform sampler and it didn't work either.

Zach-ER commented 6 years ago

What loss function are you using?

Sometimes people use a schedule whereby balanced sampler could be used at the beginning of training, and then the learning rate could be decreased and the uniform sampler could be used.

Also, in your image, is that showing logits?

YilinLiu97 commented 6 years ago

No, that's the final output, not logits. For loss function, I've tried both GDSC and CrossEntropy. I've tried a combination of balanced and uniform sampler and somehow it became worse. Originally I used the deepmedic architecture and it worked pretty well. My architecture is actually very similar to deepmedic except that it doesn't have the second pathway.