Skip to content

Commit

Permalink
Updated segmentation dataloader to work with >255 instances (see ultr…
Browse files Browse the repository at this point in the history
…alytics/yolov5#9461 and PR #9493 of the yolov5 repo) (#866)
  • Loading branch information
DylanAuty committed Oct 4, 2022
1 parent 89428f8 commit 1dc3461
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion seg/utils/segment/dataloaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,8 @@ def polygons2masks(img_size, polygons, color, downsample_ratio=1):

def polygons2masks_overlap(img_size, segments, downsample_ratio=1):
"""Return a (640, 640) overlap mask."""
masks = np.zeros((img_size[0] // downsample_ratio, img_size[1] // downsample_ratio), dtype=np.uint8)
masks = np.zeros((img_size[0] // downsample_ratio, img_size[1] // downsample_ratio),
dtype=np.int32 if len(segments) > 255 else np.uint8)
areas = []
ms = []
for si in range(len(segments)):
Expand Down

0 comments on commit 1dc3461

Please sign in to comment.