From c962db2749aed8f19371fd3e3a46c4381da4d455 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E4=B8=8D=E7=9B=88?= <33193090+YellowAndGreen@users.noreply.github.com> Date: Mon, 8 Aug 2022 23:15:18 +0800 Subject: [PATCH] Fix anchor incorrectly initialized (#8891) * Fix anchor incorrectly initialized Using --noautoanchor and --evolve simultaneously leads to anchor incorrectly initialized. --noautoanchor denotes anchors don't need to evolve, thus removing anchors from hyp will fix it. * Update train.py * Update train.py Co-authored-by: Glenn Jocher --- train.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/train.py b/train.py index cd24c8d2c8d5..9f67e93534d5 100644 --- a/train.py +++ b/train.py @@ -569,6 +569,8 @@ def main(opt, callbacks=Callbacks()): hyp = yaml.safe_load(f) # load hyps dict if 'anchors' not in hyp: # anchors commented in hyp.yaml hyp['anchors'] = 3 + if opt.noautoanchor: + del hyp['anchors'], meta['anchors'] opt.noval, opt.nosave, save_dir = True, True, Path(opt.save_dir) # only val/save final epoch # ei = [isinstance(x, (int, float)) for x in hyp.values()] # evolvable indices evolve_yaml, evolve_csv = save_dir / 'hyp_evolve.yaml', save_dir / 'evolve.csv'