Skip to content

ZeroDivisionError: division by zero #27

Description

@s5377689

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions