'yolov5 custom trained weights converted to ONNX showing wrong labels
After converting custom trained Yolov5 weights (.pt) to ONNX and running inference on the ONNX file using:
https://github.com/BlueMirrors/Yolov5-ONNX.git
the detection works well but my image labels/classes are using COCO labels (ie person, airplane, etc) instead of my labels. How can I change the labels to my own. I'm unsure of the formatting of the json (or yaml?) file. Thanks!
def detect_image(device, weight, image_path, output_image):
# load model
model = Yolov5Onnx(classes="coco",
backend="onnx",
weight=weight,
device=device)
# read image
image = cv2.imread(image_path)
# inference
preds = model(image)
print(preds)
# draw image
preds.draw(image)
# write image
cv2.imwrite(output_image, image)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
