This commit is contained in:
Glenn Jocher 2019-10-05 13:47:06 +02:00
parent 8610026e2c
commit 563dad3b53
1 changed files with 19 additions and 17 deletions

View File

@ -643,8 +643,9 @@ def cutout(image, labels):
# Intersection over box2 area
return inter_area / box2_area
# random mask_size up to 50% image size
s = 0.5 # scale
# create random masks
scales = [0.5] * 1 # + [0.25] * 4 + [0.125] * 16 # image size fraction
for s in scales:
mask_h = random.randint(1, int(h * s))
mask_w = random.randint(1, int(w * s))
@ -663,6 +664,7 @@ def cutout(image, labels):
box = np.array([xmin, ymin, xmax, ymax], dtype=np.float32)
ioa = bbox_ioa(box, labels[:, 1:5]) # intersection over area
labels = labels[ioa < 0.90] # remove >90% obscured labels
return labels