New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dice coefficient no change during training,is always very close to 0 #173
Comments
And the prediction was all black. |
@milesial |
Yes the mask images should be B&W, not RGB. Try that. |
Hi! I changed the mask images to B&W,but the loss is negative when I was trainning,and Dice coeff is > 1.I don't know why.Thank you very much. |
if the loss is negative you are loading your masks wrong, check that you correctly modified the preprocess method |
I had the same problem. When my mask images were B&W, the loss is negetive and Dice coeff >1. Can you be more specific,please? |
@Cassie0207 You have to check that your loaded masks after the preprocess method, if you have 2 or 1 classes, are 0s and 1s only. If they are not, you should modify this method to fit your dataset |
I had the same problem.The prediction was all black. what is B&W,is that a kind of color style in PIL? |
B&W means black & white. With PIL you can convert to greyscale https://pillow.readthedocs.io/en/stable/reference/Image.html#PIL.Image.Image.convert . |
With 50 training data and no data augmentation I don't think you can expect good generalization results. |
how many images does the training set need? |
I have the same issue that even though the training is completed and prediction works and it outputs almost correct labels, the Dice coefficient is always very close to 0 |
It depends on the difficulty of your task and the data augmentation you're willing to do. For Carvana the training set was more than 4000 images. |
To help me debug the DICE issue, could you please give me a sample of what your Lines 11 to 12 in 84f8392
Also, how many images are in your validation set? |
thanks for your advice |
My dice score now seems to be representing the correct number and it's fixed. I think the problem was the learning rate, and after adjusting that, the model seemed to learn much better even though I was getting mask prediction while the dice score was very close to 0. |
I meet same issue, but I have solved it when I changed the learn rate to 0.0001. I hope it can help you. |
it works for me ,thanks |
It works for me , too . Thanks a lot ! |
|
You can try changing the optimizer. |
I have a similar problem. The dice score is very close to zero and the training is stopped by an error (IndexError: Target 198 is out of bounds.) This happens on line 93 when calculating the loss function. |
preprocess() missing 1 required positional argument: 'is_mask' |
But why did the car dataset work successfully? I replaced the dataset with my own dataset, and the format was the same as the original dataset, but an error occurred : IndexError: Target 225 is out of bounds. I searched all methods about this error but.... could you explained the 'missing' in more details please? |
I converted the mask to black and white and changed the learning rate to 0.0001, but Dice coefficient also no change during training,is always very close to 0. @milesial can you help me? |
Hi!I trained the model on the ultrasonic grayscale image, since there are only two classes, I changed the code to net = UNet(n_channels=1, n_classes=1, bilinear=True), and when I trained, the loss (batch) was around 0.1, but the validation dice coeff was always low, like 7.218320015785669e-9. Is this related to the number of channels? My dataset MASK background is black and the target is red, does it need to be changed to black and white? The dataset MASK and IMG are both 8-bit.
The text was updated successfully, but these errors were encountered: