Skip to content

Commit 63ddb6f

Browse files
authored
Update autoanchor.py (#6794)
* Update autoanchor.py * Update autoanchor.py
1 parent c2403eb commit 63ddb6f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

utils/autoanchor.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,10 @@ def metric(k): # compute metric
5757
anchors = torch.tensor(anchors, device=m.anchors.device).type_as(m.anchors)
5858
m.anchors[:] = anchors.clone().view_as(m.anchors) / m.stride.to(m.anchors.device).view(-1, 1, 1) # loss
5959
check_anchor_order(m)
60-
LOGGER.info(f'{PREFIX}New anchors saved to model. Update model *.yaml to use these anchors in the future.')
60+
s = f'{PREFIX}Done ✅ (optional: update model *.yaml to use these anchors in the future)'
6161
else:
62-
LOGGER.info(f'{PREFIX}Original anchors better than new anchors. Proceeding with original anchors.')
62+
s = f'{PREFIX}Done ⚠️ (original anchors better than new anchors, proceeding with original anchors)'
63+
LOGGER.info(emojis(s))
6364

6465

6566
def kmean_anchors(dataset='./data/coco128.yaml', n=9, img_size=640, thr=4.0, gen=1000, verbose=True):
@@ -120,7 +121,7 @@ def print_results(k, verbose=True):
120121
# Filter
121122
i = (wh0 < 3.0).any(1).sum()
122123
if i:
123-
LOGGER.info(f'{PREFIX}WARNING: Extremely small objects found. {i} of {len(wh0)} labels are < 3 pixels in size.')
124+
LOGGER.info(f'{PREFIX}WARNING: Extremely small objects found: {i} of {len(wh0)} labels are < 3 pixels in size')
124125
wh = wh0[(wh0 >= 2.0).any(1)] # filter > 2 pixels
125126
# wh = wh * (npr.rand(wh.shape[0], 1) * 0.9 + 0.1) # multiply by random scale 0-1
126127

0 commit comments

Comments
 (0)