Skip to content

Commit 717ddb8

Browse files
authored
Update data_augment.py
1 parent d29219d commit 717ddb8

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

data/data_augment.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,6 @@ def _crop(image, boxes, labels, img_dim):
3737
boxes_t = boxes[mask_a].copy()
3838
labels_t = labels[mask_a].copy()
3939

40-
# ignore tiny faces
41-
b_w_t = (boxes_t[:, 2] - boxes_t[:, 0] + 1) / w * img_dim
42-
b_h_t = (boxes_t[:, 3] - boxes_t[:, 1] + 1) / h * img_dim
43-
mask_b = np.minimum(b_w_t, b_h_t) > 16.0
44-
boxes_t = boxes_t[mask_b]
45-
labels_t = labels_t[mask_b]
46-
4740
if boxes_t.shape[0] == 0:
4841
continue
4942

@@ -54,6 +47,16 @@ def _crop(image, boxes, labels, img_dim):
5447
boxes_t[:, 2:] = np.minimum(boxes_t[:, 2:], roi[2:])
5548
boxes_t[:, 2:] -= roi[:2]
5649

50+
# keep the cropped image after resizing has at less one face > 16 pixel
51+
b_w_t = (boxes_t[:, 2] - boxes_t[:, 0] + 1) / w * img_dim
52+
b_h_t = (boxes_t[:, 3] - boxes_t[:, 1] + 1) / h * img_dim
53+
mask_b = np.minimum(b_w_t, b_h_t) > 16.0
54+
boxes_t = boxes_t[mask_b]
55+
labels_t = labels_t[mask_b]
56+
57+
if boxes_t.shape[0] == 0:
58+
continue
59+
5760
pad_image_flag = False
5861

5962
return image_t, boxes_t, labels_t, pad_image_flag

0 commit comments

Comments
 (0)