Unexpected behavior in Loss Functions' loss/epoch curves #7615
Replies: 4 comments 4 replies
-
Hello! Can you possible to have a little more information on the code used? What dataset do you use? Have you looked at the evaluation metrics in the 2 cases? In any case, can you provide a little more information about the code you're using to help us understand whether this behaviour is normal or not? The first thing to look at might be the |
Beta Was this translation helpful? Give feedback.
-
Hello @Lucas-rbnt !
Training
Evaluation
The mean Dice score for class one is 0.026 and for class two is 0.008 for 1000 epochs. While for the code with torch.nn.CrossEntropyLoss() as loss function in conjunction with Monai's UNet model, the mean Dice score for class one is 0.26 and for class two is 0.002 for 1000 epochs. Your assistance would be greatly appreciated. |
Beta Was this translation helpful? Give feedback.
-
Hello @Lucas-rbnt ! Warm regards. |
Beta Was this translation helpful? Give feedback.
-
Hello, it's a bit complicated to answer without knowing all the ins and outs. You mention two classes in the results but your OneHot mentions 3. Is it possible to make a OneHot with just two labels by removing the background? If you have two classes you can simply produce an output with two channels, the first channel would be made up of 1 for the label DiceCELoss(to_onehot_y=False, sigmoid=True) Otherwise the problem may come from the way the metrics are calculated or assembled via patching, since in all cases the values are quite low, whether with CrossEntropy or DiceCELoss. Finally, the dataset you're using isn't public, I imagine, but it's made up of how many samples, and are the augmentations/preprocessing appropriate? In the hope that this will provide a few more insights for your investigation! |
Beta Was this translation helpful? Give feedback.
-
Hello,
I'm working on a multi-class 3D segmentation project with Monai's UNet network and loss functions, Diceloss and DiceCE. However, I'm encountering an issue with these loss functions. With using Diceloss and DiceCE, the loss per epoch shoots up to 5 or 6, while it stays between 0 and 1 with torch.nn.CrossEntropyLoss() in conjunction with Monai's UNet model. I've attached the results for reference (The loss/epoch curves for Diceloss and DiceCEloss are plotted over 1000 epochs, while for cross-entropy cover 20 epochs). Could you help me understand why this happens with Monai's Diceloss and DiceCE?
Thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions