Minor updates and improvements (#216)

Co-authored-by: Hardik Dava <39372750+hardikdava@users.noreply.github.com>
Co-authored-by: Onuralp Sezer <thunderbirdtr@fedoraproject.org>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Glenn Jocher
2023-01-11 00:13:44 +01:00
committed by GitHub
parent 959c11b9bc
commit 7f9d7142c2
6 changed files with 21 additions and 20 deletions

View File

@ -43,7 +43,8 @@ class DetectionValidator(BaseValidator):
def init_metrics(self, model):
head = model.model[-1] if self.training else model.model.model[-1]
self.is_coco = self.data.get('val', '').endswith(f'coco{os.sep}val2017.txt') # is COCO dataset
val = self.data.get('val', '') # validation path
self.is_coco = isinstance(val, str) and val.endswith(f'coco{os.sep}val2017.txt') # is COCO dataset
self.class_map = ops.coco80_to_coco91_class() if self.is_coco else list(range(1000))
self.args.save_json |= self.is_coco and not self.training # run on final val if training COCO
self.nc = head.nc