Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
jameslahm committed May 23, 2024
1 parent 841fa14 commit 6faa17d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ultralytics/models/yolo/detect/val.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def init_metrics(self, model):
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.class_map = converter.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.args.save_json |= self.is_coco # run on final val if training COCO
self.names = model.names
self.nc = len(model.names)
self.metrics.names = self.names
Expand Down
3 changes: 3 additions & 0 deletions ultralytics/models/yolov10/predict.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

class YOLOv10DetectionPredictor(DetectionPredictor):
def postprocess(self, preds, img, orig_imgs):
if isinstance(preds, dict):
preds = preds["one2one"]

if isinstance(preds, (list, tuple)):
preds = preds[0]

Expand Down
2 changes: 1 addition & 1 deletion ultralytics/models/yolov10/val.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def __init__(self, *args, **kwargs):
self.args.save_json |= self.is_coco

def postprocess(self, preds):
if self.training:
if isinstance(preds, dict):
preds = preds["one2one"]

if isinstance(preds, (list, tuple)):
Expand Down
2 changes: 1 addition & 1 deletion ultralytics/nn/modules/head.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ def forward(self, x):
if not self.training:
one2one = self.inference(one2one)
if not self.export:
return one2one
return {"one2many": one2many, "one2one": one2one}
else:
assert(self.max_det != -1)
boxes, scores, labels = ops.v10postprocess(one2one.permute(0, 2, 1), self.max_det)
Expand Down

0 comments on commit 6faa17d

Please sign in to comment.