Skip to content

YOLOv8/11 postprocess support exp#254

Open
ret7020 wants to merge 3 commits intosophgo:masterfrom
ret7020:yolov8_postproc
Open

YOLOv8/11 postprocess support exp#254
ret7020 wants to merge 3 commits intosophgo:masterfrom
ret7020:yolov8_postproc

Conversation

@ret7020
Copy link

@ret7020 ret7020 commented Dec 1, 2025

Yolov8/11 models have new head architecture, so current postproc implementation in coco_mAP.py don't work. I created experimental postproc_yolov8 function that can handle yolov11 model (I don't check it yet on multi-class models and yolov8, but I will check it later).

I modified model_eval.py --postprocess_type arg to select default postproc if it coco_mAP and use my implementation if arg is coco_mAP_yolov8.

If this approach will be approved I will tune other code (because I have problem with using visual_tool, I think problem also in old post processing).

And also I use following model export from pt to onnx:

from ultralytics import YOLO
import types
import sys

input_size = (int(sys.argv[2]), int(sys.argv[3]))

def forward2(self, x):
  x_reg = [self.cv2[i](x[i]) for i in range(self.nl)]
  x_cls = [self.cv3[i](x[i]) for i in range(self.nl)]
  return x_reg + x_cls

model_path = sys.argv[1]
model = YOLO(model_path)
model.model.model[-1].forward = types.MethodType(forward2, model.model.model[-1])
model.export(format='onnx', opset=11, imgsz=input_size)

This custom head forward method used in CV181x docs (and TDL SDK implementation for CV181x also waits for such outputs)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant