TOG icon indicating copy to clipboard operation
TOG copied to clipboard

ZeroDivisionError: division by zero

Open s5377689 opened this issue 1 year ago • 0 comments

ZeroDivisionError Traceback (most recent call last) in 69 # Compute training statistics 70 epoch_loss = float(np.mean(epoch_loss)) ---> 71 ASR_TOG = score_adv / num_rois 72 ASR_Rand = score_rand / num_rois 73

ZeroDivisionError: division by zero

############################## ############################## ##############################

If some images fail to detect objects

Is this modification correct?

############################## ############################## ##############################

Compute training statistics

epoch_loss = float(np.mean(epoch_loss))
###########################################code i added
+     if num_rois > 0:
+          ASR_TOG = score_adv / num_rois
+         ASR_Rand = score_rand / num_rois
+     else:
+         ASR_TOG = 0.0
+         ASR_Rand = 0.0
    ###########################################code i added
    ASR_TOG = score_adv / num_rois
    ASR_Rand = score_rand / num_rois

s5377689 avatar Jul 30 '23 04:07 s5377689