Skip to content

Commit

Permalink
Fix visual prompting dataset for empty nonzero mask (#3854)
Browse files Browse the repository at this point in the history
* Fix pytorchcv version

* Fix for empty nonzero points
  • Loading branch information
sungchul2 authored Aug 16, 2024
1 parent ac61247 commit fa530a7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/otx/core/data/dataset/visual_prompting.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def _get_item_impl(self, index: int) -> VisualPromptingDataEntity | None:
if isinstance(annotation, dmPolygon):
mask = tvMask(polygon_to_bitmap([annotation], *img_shape)[0])
mask_points = torch.nonzero(mask)
if len(mask_points[0]) == 0:
if len(mask_points) == 0:
# skip very small region
continue

Expand Down Expand Up @@ -225,7 +225,7 @@ def _get_item_impl(self, index: int) -> ZeroShotVisualPromptingDataEntity | None
# generate prompts from polygon
mask = tvMask(polygon_to_bitmap([annotation], *img_shape)[0])
mask_points = torch.nonzero(mask)
if len(mask_points[0]) == 0:
if len(mask_points) == 0:
# skip very small region
continue

Expand Down

0 comments on commit fa530a7

Please sign in to comment.