Samarth991 commited on
Commit
070106a
·
1 Parent(s): 1102d40

added image detection code to display predicted bboxes

Browse files
Files changed (2) hide show
  1. tool_utils/yolo_world.py +1 -1
  2. utils.py +1 -1
tool_utils/yolo_world.py CHANGED
@@ -80,5 +80,5 @@ class YoloWorld:
80
  )
81
 
82
  cv2.imwrite('final_mask.png', cv2.cvtColor(detected_image,cv2.COLOR_BGR2RGB))
83
- return "Predicted image mask : final_mask.jpg . Details :{}".format(processed_predictions[0])
84
 
 
80
  )
81
 
82
  cv2.imwrite('final_mask.png', cv2.cvtColor(detected_image,cv2.COLOR_BGR2RGB))
83
+ return "Predicted image mask : final_mask.jpg . Details :{}".format(processed_predictions[0]['boxes'])
84
 
utils.py CHANGED
@@ -49,5 +49,5 @@ def draw_bboxes(rgb_frame,boxes,labels,color=None,line_thickness=3):
49
  # label = label2id[int(label.numpy())]
50
  t_size = cv2.getTextSize(str(label), 0, fontScale=tl / 3, thickness=tf)[0]
51
  c2 = c1[0] + t_size[0], c1[1] - t_size[1] - 3
52
- cv2.putText(rgb_frame_copy, str(label), (c1[0], c1[1] - 2), 0, tl / 3, [225, 255, 255], thickness=tf, lineType=cv2.LINE_AA)
53
  return rgb_frame_copy
 
49
  # label = label2id[int(label.numpy())]
50
  t_size = cv2.getTextSize(str(label), 0, fontScale=tl / 3, thickness=tf)[0]
51
  c2 = c1[0] + t_size[0], c1[1] - t_size[1] - 3
52
+ cv2.putText(rgb_frame_copy, str(label), (c1[0], c1[1] - 2), 0, tl / 3, [225, 0, 255], thickness=tf, lineType=cv2.LINE_AA)
53
  return rgb_frame_copy