leohsuofnthu / Pytorch-IterativeFCN

Pytorch implementation of the paper Iterative fully convolutional neural networks for automatic vertebra segmentation accepted in MIDL2018.
61 stars 24 forks source link

Step into an endless loop when instance segment images #1

Open cao1124 opened 4 years ago

cao1124 commented 4 years ago

Hi CHIH CHAO, When I'm testing the code (instance_segment.py), I found the program will step into an endless loop when segment images (case6, case9...) . There are two situations in converge iterations: 1.The Modified centre is always the same as prev centre and will not break out of the loop 2.when iters=lim_alternate_times, converge ,update ins and mask, to this point, z_up may exceed the image shape, cause the program to crash. Why does this happen after doing correction to be in-frame? Looking forward to hearing from you, thank you~

leohsuofnthu commented 4 years ago

Hi, Thanks for your attention to my work. I didn't notice that before cuz I just try that on test images, thanks for pointing out. I recently working on another side project I have. Would you mind waiting a bit? I will take a look at this ASAP :) I assume that my pre-trained weights might not be robust enough if other images can be segmented successfully. Did you successfully do the instance segmentation on other images? Thx and be healthy !

cao1124 commented 4 years ago

Hi CHIH CHAO, The endless loop problem was mainly due to some small bugs in the processing of image boundaries.I solved the problem of endless loop by limiting the number of while loops (because the maximum number of vertebrae is a certain number). on the other hand, I found that the dataset you are processing is square in transverse plane, so there will be no boundaries Problems, but images with transverse plane other than squares will have border problems, which I avoided it by padding the image. After doing that, I still have boundaries Problems sometimes, Because the size and shape of my test samples(xVertSeg2019) are random.Why didn't I encounter this problem in the mhd dataset, but encountered th problem in the xVertSeg2019 ataset? I wanna avoid the boundary problem by:When converge iterations , if iters = 20 and the xyz_up is greater than image shape, then Z = now [0] + 64, Y = now [1], X = now [2], and continue to jump out of the current loop ; What do you think of my approach? Looking forward to hearing from you. Wishing you the best~

leohsuofnthu commented 4 years ago

got ur msg! It s been a while I finish this repo, like last year. I'll do some review and check it once I finish my class project this semester (~4/17). Hope u don't mind!

cao1124 commented 4 years ago

Waiting for your message~O(∩_∩)O ps:I found some boundaries Problems because you did not consider that the shape of the image may be less than 128.

FoilHao commented 4 years ago

Hi, cao1124! I also meet endless loop problem. I still don't understand why this happened and how to solve it. Can you please help me out?

FoilHao commented 4 years ago

@cao1124 @leohsuofnthu Also I'm puzzled why there is no endless loop problem with author's pretrained weight.

cao1124 commented 4 years ago

@cao1124 @leohsuofnthu Also I'm puzzled why there is no endless loop problem with author's pretrained weight. Hi,FoilHao~You need to preprocess the image first ,make sure the height is same as the width of the image.

leohsuofnthu commented 4 years ago

Hi, Thanks for noticing my work, I didn't expect that this implementation will be noticed haha. I implement this paper casually in my free time without paying attention to details, so I lost 70% memory of this now. I am really happy that people start to re-run the experiment and provide more robust results on this. Thanks!

FoilHao commented 4 years ago

@cao1124 @leohsuofnthu Also I'm puzzled why there is no endless loop problem with author's pretrained weight. Hi,FoilHao~You need to preprocess the image first ,make sure the height is same as the width of the image.

Thanks for your help! Do you mean I should make axis x and y have the same value? The test images do have same x and y shape. It worked okay with author's pretrained weights, but get into endless loop with my trained weights(the modified centre is always the same as prev centre) I saw u met similar problem and solved by limiting while loops. Can you share more detailed information? Thanks a lot!!!

cao1124 commented 4 years ago

@cao1124 @leohsuofnthu Also I'm puzzled why there is no endless loop problem with author's pretrained weight. Hi,FoilHao~You need to preprocess the image first ,make sure the height is same as the width of the image.

Thanks for your help! Do you mean I should make axis x and y have the same value? The test images do have same x and y shape. It worked okay with author's pretrained weights, but get into endless loop with my trained weights(the modified centre is always the same as prev centre) I saw u met similar problem and solved by limiting while loops. Can you share more detailed information? Thanks a lot!!!

I did not solve the boundary problem actuallyo(╥﹏╥)o. I forced program to exit the while loop if the bone strength obtained reached a certain threshold, but there are still boundary problems. @leohsuofnthu what's your view on this ?(*❦ω❦)

taiyuyan commented 3 years ago

@cao1124 Have you tried out this code? I have a lot of mistakes when I run this code. Can you send me a correct code to me ? Thanks a lot!

Azkarehman commented 3 years ago

Hi CHIH CHAO, The endless loop problem was mainly due to some small bugs in the processing of image boundaries.I solved the problem of endless loop by limiting the number of while loops (because the maximum number of vertebrae is a certain number). on the other hand, I found that the dataset you are processing is square in transverse plane, so there will be no boundaries Problems, but images with transverse plane other than squares will have border problems, which I avoided it by padding the image. After doing that, I still have boundaries Problems sometimes, Because the size and shape of my test samples(xVertSeg2019) are random.Why didn't I encounter this problem in the mhd dataset, but encountered th problem in the xVertSeg2019 ataset? I wanna avoid the boundary problem by:When converge iterations , if iters = 20 and the xyz_up is greater than image shape, then Z = now [0] + 64, Y = now [1], X = now [2], and continue to jump out of the current loop ; What do you think of my approach? Looking forward to hearing from you. Wishing you the best~

hi can u provide me with ur updated code? please?

css277 commented 1 year ago

Waiting for your message~O(∩_∩)O ps:I found some boundaries Problems because you did not consider that the shape of the image may be less than 128.

How do you deal with the problem that the image size is less than 128? thank you