LeeJunHyun / Image_Segmentation

Pytorch implementation of U-Net, R2U-Net, Attention U-Net, and Attention R2U-Net.
2.72k stars 600 forks source link

poor result on isbi challenge #31

Closed Lijiatu321 closed 5 years ago

Lijiatu321 commented 5 years ago

Hi: thank you for the code, i have trained the unet with the isbi dataset 100 epoch,batch size is 8(30 gray picture),but the result is very bad, about 11 percent(accuracy). And i wonder is there something wrong that i have done, could you give me some advise? data_loader .txt main .txt I just modify the data_loader.py and change the input channel to 1(the picture is gray)

LeeJunHyun commented 5 years ago

Hi, @Lijiatu321 . I am not familiar with ISBI challenge, but is it classification task? (because you only mentioned accuracy metric) U_Net architecture is for segmentation, not for classification. Could you please explain about the task and the dataset?

Lijiatu321 commented 5 years ago

Hi,@LeeJunHyun Thank you for you reply.I'm sorry I didn't make it clear before. isbi challenge is a segmantation task.In this challenge, a full stack of EM slices will be used to train machine learning algorithms for the purpose of automatic segmentation of neural structures .The original paper(U-net) use the isbi challenge data to train the network.Here is the linkhttp://brainiac2.mit.edu/isbi_challenge/. There are only 30 pictures in the training set and 30 picture in the testing set. The picture and the mask are all gray. Here is the example of the picture and the ground truth. 0 0

LeeJunHyun commented 5 years ago

Thank you for kind explanation. How about result images? Did you check the results?

Lijiatu321 commented 5 years ago

Hi, @LeeJunHyun . I have finally find the problem. There are two things. One thing is that something wrong with the evaluation. Let me take get_accuracy() as an example, when you call the function you can calculate the accuracy of one batch size, but in the solver.train() when a epoch finished you do the acc = acc/length. And the length is the size of data(number of the train picture), in my opinion i think the length should be the length of the train loader. When we use the batch size 1 that is all right but if we change the batch size the accuracy will be decline. I am not sure if i am right . So, would you like to check you code and give me the answer? The other thing is that the result of the model that i trained is not bad (accuracy : 90 percent), but i have some questions about the output of the network. When training you use the output of the network and the gt as the input of the evaluate function but during validate you add the sigmod function. i don't understand why.

LeeJunHyun commented 5 years ago

Oh, I implemented only for batch size 1. At the first time, I had wanted to support more than batch size, but I didn't need that. Sorry for confusion of code. I'm not 100% sure, but I think I applied sigmoid function because of thresholding. (To make binary segmentation results with threshold 0.5) You can fix that part as you want :)

Lijiatu321 commented 5 years ago

Thank you very much for your patient and time , wish you have a good day!!