Skip to content

Commit

Permalink
[attack] Fix box variation for empty bounding boxes
Browse files Browse the repository at this point in the history
  • Loading branch information
wuhanstudio committed Feb 6, 2024
1 parent 605f7e3 commit 39d5741
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions examples/attack/yolov3_pcb_attack_evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,11 @@
indexes = indexes.flatten()
tb.log_scalar('box variation', (len(boxes) + len(last_boxes) - len(indexes)) / len(boxes), n)
elif last_boxes.size == 0 and boxes.size == 0:
tb.log_scalar('box variation', 0.0, n)
else:
# No bounding boxes, all consistent
tb.log_scalar('box variation', 1.0, n)
else:
# Either one is empty, none consistent
tb.log_scalar('box variation', 0.0, n)
else:
tb.log_scalar('box variation', 1.0, n)

Expand Down
6 changes: 4 additions & 2 deletions examples/attack/yolov3_tog_attack_evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,11 @@
indexes = indexes.flatten()
tb.log_scalar('box variation', (len(boxes) + len(last_boxes) - len(indexes)) / len(boxes), n)
elif last_boxes.size == 0 and boxes.size == 0:
tb.log_scalar('box variation', 0.0, n)
else:
# No bounding boxes, all consistent
tb.log_scalar('box variation', 1.0, n)
else:
# Either one is empty, none consistent
tb.log_scalar('box variation', 0.0, n)
else:
tb.log_scalar('box variation', 1.0, n)

Expand Down

0 comments on commit 39d5741

Please sign in to comment.