From c036c5684abe671229333630e51734032ad791cc Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Sat, 26 Feb 2022 19:11:30 +0100 Subject: [PATCH 1/2] Update autoanchor.py --- utils/autoanchor.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/utils/autoanchor.py b/utils/autoanchor.py index 27d6fb68bb38..f9a0a9e5eb28 100644 --- a/utils/autoanchor.py +++ b/utils/autoanchor.py @@ -57,9 +57,10 @@ def metric(k): # compute metric anchors = torch.tensor(anchors, device=m.anchors.device).type_as(m.anchors) m.anchors[:] = anchors.clone().view_as(m.anchors) / m.stride.to(m.anchors.device).view(-1, 1, 1) # loss check_anchor_order(m) - LOGGER.info(f'{PREFIX}New anchors saved to model. Update model *.yaml to use these anchors in the future.') + s = f'{PREFIX}Done ✅ (optional: update model *.yaml to use these anchors in the future)' else: - LOGGER.info(f'{PREFIX}Original anchors better than new anchors. Proceeding with original anchors.') + s = f'{PREFIX}Done ⚠️ (original anchors better than new anchors, proceeding with original anchors)' + LOGGER.info(emojis(s)) 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): # Filter i = (wh0 < 3.0).any(1).sum() if i: - LOGGER.info(f'{PREFIX}WARNING: Extremely small objects found. {i} of {len(wh0)} labels are < 3 pixels in size.') + LOGGER.info(f'{PREFIX}WARNING: Extremely small objects found. {i} of {len(wh0)} labels are < 3 pixels in size') wh = wh0[(wh0 >= 2.0).any(1)] # filter > 2 pixels # wh = wh * (npr.rand(wh.shape[0], 1) * 0.9 + 0.1) # multiply by random scale 0-1 From d73bcc592b3e6e93a9ee78ba31b44c17d22c4b55 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Sat, 26 Feb 2022 19:12:32 +0100 Subject: [PATCH 2/2] Update autoanchor.py --- utils/autoanchor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/autoanchor.py b/utils/autoanchor.py index f9a0a9e5eb28..51d4de306efd 100644 --- a/utils/autoanchor.py +++ b/utils/autoanchor.py @@ -121,7 +121,7 @@ def print_results(k, verbose=True): # Filter i = (wh0 < 3.0).any(1).sum() if i: - LOGGER.info(f'{PREFIX}WARNING: Extremely small objects found. {i} of {len(wh0)} labels are < 3 pixels in size') + LOGGER.info(f'{PREFIX}WARNING: Extremely small objects found: {i} of {len(wh0)} labels are < 3 pixels in size') wh = wh0[(wh0 >= 2.0).any(1)] # filter > 2 pixels # wh = wh * (npr.rand(wh.shape[0], 1) * 0.9 + 0.1) # multiply by random scale 0-1