Skip to content

Commit

Permalink
Fix for warning raised if model outputs no box predictions (microsoft…
Browse files Browse the repository at this point in the history
…#988)

* Fix for warning when no predictions are made

* Same thing for boxes

Co-authored-by: Adam J. Stewart <[email protected]>
  • Loading branch information
ashnair1 and adamjstewart authored Dec 30, 2022
1 parent 8a16a65 commit b7df83e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions torchgeo/datasets/nasa_marine_debris.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,12 @@ def plot(
"""
ncols = 1

image = draw_bounding_boxes(image=sample["image"], boxes=sample["boxes"])
image = sample["image"]
if "boxes" in sample and len(sample["boxes"]):
image = draw_bounding_boxes(image=sample["image"], boxes=sample["boxes"])
image = image.permute((1, 2, 0)).numpy()

if "prediction_boxes" in sample:
if "prediction_boxes" in sample and len(sample["prediction_boxes"]):
ncols += 1
preds = draw_bounding_boxes(
image=sample["image"], boxes=sample["prediction_boxes"]
Expand Down

0 comments on commit b7df83e

Please sign in to comment.