Spaces:
Paused
Paused
Zhen Ye commited on
Commit ·
882ee33
1
Parent(s): e9834ad
removed extra bbox lable and track id
Browse files207 unmodified lines2082092102112122132142152161 unmodified line2182192202212222231990 unmodified lines22142215221622172218221922202221207 unmodified lineslabel = Noneif labels and idx < len(labels):label = labels[idx]if not label:label = f"object_{idx}"color = _color_for_label(label)overlay[mask_bool] = coloroutput = cv2.addWeighted(output, 1.0, overlay, alpha, 0)contours, _ = cv2.findContours(1 unmodified line)if contours:cv2.drawContours(output, contours, -1, color, thickness=2)if label:coords = np.column_stack(np.where(mask_bool))if coords.size:1990 unmodified linesdisplay_labels.append("")continuelbl = d.get("label", "obj")if "track_id" in d:lbl = f"{d['track_id']} {lbl}"if d.get("gpt_distance_m") is not None:try:lbl = f"{lbl} {int(float(d['gpt_distance_m']))}m"207 unmodified lines2082092102112122132142152161 unmodified line2182192202212222232241990 unmodified lines221522162217221822192220207 unmodified lineslabel = Noneif labels and idx < len(labels):label = labels[idx]# Use a fallback key for consistent color even when no label textcolor_key = label if label else f"object_{idx}"color = _color_for_label(color_key)overlay[mask_bool] = coloroutput = cv2.addWeighted(output, 1.0, overlay, alpha, 0)contours, _ = cv2.findContours(1 unmodified line)if contours:cv2.drawContours(output, contours, -1, color, thickness=2)# Only draw label text when explicit labels were providedif label:coords = np.column_stack(np.where(mask_bool))if coords.size:1990 unmodified linesdisplay_labels.append("")continuelbl = d.get("label", "obj")if d.get("gpt_distance_m") is not None:try:lbl = f"{lbl} {int(float(d['gpt_distance_m']))}m"
inference.py+4-5