ONNX-YOLOv8-Instance-Segmentation icon indicating copy to clipboard operation
ONNX-YOLOv8-Instance-Segmentation copied to clipboard

yolov8n-seg onnx value error

Open apanand14 opened this issue 1 year ago • 3 comments

Hello,

I would like to run inference using my converted onnx model but somehow I'm getting this error. Can you please look into it if possible? Thank you in advance

C:\AI\yolo\ONNX-YOLOv8-Instance-Segmentation\yoloseg\utils.py:49: RuntimeWarning: invalid value encountered in divide
  iou = intersection_area / union_area
Traceback (most recent call last):
  File "C:\AI\yolo\ONNX-YOLOv8-Instance-Segmentation\image_instance_segmentation.py", line 15, in <module>
    boxes, scores, class_ids, masks = yoloseg(img)
  File "C:\AI\yolo\ONNX-YOLOv8-Instance-Segmentation\yoloseg\YOLOSeg.py", line 21, in __call__
    return self.segment_objects(image)
  File "C:\AI\yolo\ONNX-YOLOv8-Instance-Segmentation\yoloseg\YOLOSeg.py", line 38, in segment_objects
    self.mask_maps = self.process_mask_output(mask_pred, outputs[1])
  File "C:\AI\yolo\ONNX-YOLOv8-Instance-Segmentation\yoloseg\YOLOSeg.py", line 99, in process_mask_output
    num_mask, mask_height, mask_width = mask_output.shape  # CHW
ValueError: not enough values to unpack (expected 3, got 2)

apanand14 avatar Oct 19 '23 16:10 apanand14

俺也一样

qq2499017550 avatar Oct 27 '23 07:10 qq2499017550

Seems your model's output dimension is not as expected. You need to check how you converted Torch model to Onnx. You can use ultralytics yolo to export to onnx.

kishcs avatar Jan 18 '24 11:01 kishcs

command : yolo export model=<torch model path> format=onnx batch=16|32 dynamic=True device=0 Use batch, dynamic as per your requirement.

kishcs avatar Jan 18 '24 11:01 kishcs