From cb527d3af93bf30b5c3d6ca2a01d29975b325ba3 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Thu, 9 Jul 2020 17:03:12 -0700 Subject: [PATCH] new nc=len(names) check --- train.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/train.py b/train.py index 4943336..6bfa428 100644 --- a/train.py +++ b/train.py @@ -57,7 +57,7 @@ def train(hyp): yaml.dump(hyp, f, sort_keys=False) with open(Path(log_dir) / 'opt.yaml', 'w') as f: yaml.dump(vars(opt), f, sort_keys=False) - + epochs = opt.epochs # 300 batch_size = opt.batch_size # 64 weights = opt.weights # initial training weights @@ -68,7 +68,8 @@ def train(hyp): data_dict = yaml.load(f, Loader=yaml.FullLoader) # model dict train_path = data_dict['train'] test_path = data_dict['val'] - nc = 1 if opt.single_cls else int(data_dict['nc']) # number of classes + nc, names = (1, ['item']) if opt.single_cls else (int(data_dict['nc']), data_dict['names']) # number classes, names + assert len(names) == nc, '%g names found for nc=%g dataset in %s' % (len(names), nc, opt.data) # check # Remove previous results for f in glob.glob('*_batch*.jpg') + glob.glob(results_file):