I am using doing binary segmentation using Signet, IoU loss. the problem is Precision, recall and f1 score values become exp. kindly guide me if there is an issue with my loss function or there is any other issue.i have pasted the loss code below
def __init__(self, weight=None, size_average=True):
def forward(self, inputs, targets, smooth=1):
inputs = inputs.view(-1)
targets = targets.view(-1)
intersection = (inputs * targets).sum()
total = (inputs + targets).sum()
union = total - intersection
IoU = (intersection + smooth)/(union + smooth)
return 1 - IoU
The result table indicates that the precision, recall, F1, and Ji are all zero. You can ignore the small numbers and basically treat them as zero values, so you should check your metric calculation as well as the results of your model.
If I stop and then resume the training everything works fine. I have used PyTorch anomaly detection and even tried to clip gradient between -5 to 5 but it’s also not working. but the problem is what can be the issue then
- Data does not contain any nan value.
- Changing the model does not work.
- Gradient clipping does not work.
- learning rate is 1e^-3 at the start of training and updating it using lr scheduler
- Apparently there is no issue in metric and loss calculation code.
then what can be the issue
kindly guide me
Any help will be appreciated
I don’t see any NaNs in your output, so I’m unsure why you are checking for these invalid values.
In your table the scientific notation is used, which is indicating values close to zero.