Skip to content

Commit

Permalink
fix segment dataloading error (#153)
Browse files Browse the repository at this point in the history
* fix segment dataloading error

* refactor
  • Loading branch information
fcakyon authored Sep 24, 2022
1 parent 6fbfe59 commit f9d9cde
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions yolov5/utils/segment/dataloaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,17 +140,14 @@ def __getitem__(self, index):
labels[:, 1:] = xywhn2xyxy(labels[:, 1:], ratio[0] * w, ratio[1] * h, padw=pad[0], padh=pad[1])

if self.augment:
img, labels, segments = random_perspective(
img,
labels,
segments=segments,
degrees=hyp["degrees"],
translate=hyp["translate"],
scale=hyp["scale"],
shear=hyp["shear"],
perspective=hyp["perspective"],
return_seg=True,
)
img, labels, segments = random_perspective(img,
labels,
segments=segments,
degrees=hyp["degrees"],
translate=hyp["translate"],
scale=hyp["scale"],
shear=hyp["shear"],
perspective=hyp["perspective"])

nl = len(labels) # number of labels
if nl:
Expand Down

0 comments on commit f9d9cde

Please sign in to comment.