Allow test-dev2017.txt for val (#14519)

Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
This commit is contained in:
zhiqiang yang 2024-07-18 21:04:29 +08:00 committed by GitHub
parent bfcd85323d
commit 43aeed7356
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -68,7 +68,11 @@ class DetectionValidator(BaseValidator):
def init_metrics(self, model):
"""Initialize evaluation metrics for YOLO."""
val = self.data.get(self.args.split, "") # validation path
self.is_coco = isinstance(val, str) and "coco" in val and val.endswith(f"{os.sep}val2017.txt") # is COCO
self.is_coco = (
isinstance(val, str)
and "coco" in val
and (val.endswith(f"{os.sep}val2017.txt") or val.endswith(f"{os.sep}test-dev2017.txt"))
) # is COCO
self.is_lvis = isinstance(val, str) and "lvis" in val and not self.is_coco # is LVIS
self.class_map = converter.coco80_to_coco91_class() if self.is_coco else list(range(len(model.names)))
self.args.save_json |= (self.is_coco or self.is_lvis) and not self.training # run on final val if training COCO