@@ -66,15 +66,15 @@ def visualize(self, dets, meta, class_names, score_thres, wait=0):
6666 self .class_names = dict (zip (class_ids ,class_names ))
6767 np .random .seed (12345 )
6868 for bb , conf , cid in zip (bboxes , confidences , class_ids ):
69- bbox_colors = {key : np .random .randint (0 , 255 , size = (3 ,)).tolist () for key in self .class_names .keys ()}
70- clr = [int (c ) for c in bbox_colors [cid ]]
71- cv2 .rectangle (self .image , (bb [0 ], bb [1 ]), (bb [0 ] + bb [2 ], bb [1 ] + bb [3 ]), clr , 2 )
72- label = "{}:{:.4f}" .format (self .class_names [cid ], conf )
73- (label_width , label_height ), baseLine = cv2 .getTextSize (label , cv2 .FONT_HERSHEY_SIMPLEX , 0.5 , 2 )
74- y_label = max (bb [1 ], label_height )
75- cv2 .rectangle (self .image , (bb [0 ], y_label - label_height ), (bb [0 ] + label_width , y_label + baseLine ),
76- (255 , 255 , 255 ), cv2 .FILLED )
77- cv2 .putText (self .image , label , (bb [0 ], y_label ), cv2 .FONT_HERSHEY_SIMPLEX , 0.5 , clr , 2 )
69+ # bbox_colors = {key: np.random.randint(0, 255, size=(3,)).tolist() for key in self.class_names.keys()}
70+ # clr = [int(c) for c in bbox_colors[cid]]
71+ cv2 .rectangle (self .image , (bb [0 ], bb [1 ]), (bb [0 ] + bb [2 ], bb [1 ] + bb [3 ]), ( 253 , 230 , 224 ) , 2 )
72+ # label = "{}:{:.4f}".format(self.class_names[cid], conf)
73+ # (label_width, label_height), baseLine = cv2.getTextSize(label, cv2.FONT_HERSHEY_SIMPLEX, 0.5, 2)
74+ # y_label = max(bb[1], label_height)
75+ # cv2.rectangle(self.image, (bb[0], y_label - label_height), (bb[0] + label_width, y_label + baseLine),
76+ # (255, 255, 255), cv2.FILLED)
77+ # cv2.putText(self.image, label, (bb[0], y_label), cv2.FONT_HERSHEY_SIMPLEX, 0.5, clr, 2)
7878 bboxes = np .array (bboxes ).astype ('int' )
7979 confidences = np .array (confidences )
8080 return bboxes , confidences , class_ids , self .image
0 commit comments