Closed preddythandra closed 1 year ago
Fixed solution: Change the number of unrolling arguments to 5 to properly unfold the detection arguments.
detections = sv.Detections.from_ultralytics(result)
labels = [
f"{model.model.names[class_id]} {confidence:0.2f}"
for _,_, confidence, class_id, _ in detections
]
image = sv.BoxAnnotator(thickness=2, text_thickness=2, text_scale=1).annotate(image, detections, labels)
success, encoded_image = cv2.imencode(".jpg", image)
Detailed Description:
The server returns a image with the boundary box, but since labels information is not generated from the detection metadata, it return just the class number of the object identified.
Steps to Reproduce:
Change the detection's unloading from 5 (for ,, confidence, classid, in detection) variable to 3 variable (for confidence,classid, in detection)
Expected Behavior:
The server sends the image with object boundary box along with label and probability of label .
Actual Behavior:
The server only send the image with object boundary box, the labels are the class number with not label or probability information.
Before Fixing the bug:
After Fixing the bug: