ONNX-YOLOv8-Instance-Segmentation
ONNX-YOLOv8-Instance-Segmentation copied to clipboard
yolov8n-seg onnx value error
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)
俺也一样
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.
command :
yolo export model=<torch model path> format=onnx batch=16|32 dynamic=True device=0
Use batch
, dynamic
as per your requirement.