ibaiGorordo / ONNX-YOLOv8-Instance-Segmentation

Python scripts performing Instance Segmentation using the YOLOv8 model in ONNX.
MIT License
142 stars 30 forks source link

yolov8n-seg onnx value error #5

Open apanand14 opened 1 year ago

apanand14 commented 1 year ago

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)
qq2499017550 commented 1 year ago

俺也一样

kishcs commented 9 months ago

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 commented 9 months ago

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