Zheng Ge commited on
Commit
15a66fe
·
1 Parent(s): b6391d4

fix vis font

Browse files
demo/OpenVINO/cpp/yolox_openvino.cpp CHANGED
@@ -391,7 +391,7 @@ static void draw_objects(const cv::Mat& bgr, const std::vector<Object>& objects)
391
  sprintf(text, "%s %.1f%%", class_names[obj.label], obj.prob * 100);
392
 
393
  int baseLine = 0;
394
- cv::Size label_size = cv::getTextSize(text, cv::FONT_HERSHEY_COMPLEX, 0.4, 1, &baseLine);
395
 
396
  cv::Scalar txt_bk_color = color * 0.7 * 255;
397
 
@@ -407,7 +407,7 @@ static void draw_objects(const cv::Mat& bgr, const std::vector<Object>& objects)
407
  txt_bk_color, -1);
408
 
409
  cv::putText(image, text, cv::Point(x, y + label_size.height),
410
- cv::FONT_HERSHEY_COMPLEX, 0.4, txt_color, 1);
411
  }
412
 
413
  cv::imwrite("_demo.jpg" , image);
 
391
  sprintf(text, "%s %.1f%%", class_names[obj.label], obj.prob * 100);
392
 
393
  int baseLine = 0;
394
+ cv::Size label_size = cv::getTextSize(text, cv::FONT_HERSHEY_SIMPLEX, 0.4, 1, &baseLine);
395
 
396
  cv::Scalar txt_bk_color = color * 0.7 * 255;
397
 
 
407
  txt_bk_color, -1);
408
 
409
  cv::putText(image, text, cv::Point(x, y + label_size.height),
410
+ cv::FONT_HERSHEY_SIMPLEX, 0.4, txt_color, 1);
411
  }
412
 
413
  cv::imwrite("_demo.jpg" , image);
demo/TensorRT/cpp/yolox.cpp CHANGED
@@ -394,7 +394,7 @@ static void draw_objects(const cv::Mat& bgr, const std::vector<Object>& objects,
394
  sprintf(text, "%s %.1f%%", class_names[obj.label], obj.prob * 100);
395
 
396
  int baseLine = 0;
397
- cv::Size label_size = cv::getTextSize(text, cv::FONT_HERSHEY_COMPLEX, 0.4, 1, &baseLine);
398
 
399
  cv::Scalar txt_bk_color = color * 0.7 * 255;
400
 
@@ -410,7 +410,7 @@ static void draw_objects(const cv::Mat& bgr, const std::vector<Object>& objects,
410
  txt_bk_color, -1);
411
 
412
  cv::putText(image, text, cv::Point(x, y + label_size.height),
413
- cv::FONT_HERSHEY_COMPLEX, 0.4, txt_color, 1);
414
  }
415
 
416
  cv::imwrite("det_res.jpg", image);
 
394
  sprintf(text, "%s %.1f%%", class_names[obj.label], obj.prob * 100);
395
 
396
  int baseLine = 0;
397
+ cv::Size label_size = cv::getTextSize(text, cv::FONT_HERSHEY_SIMPLEX, 0.4, 1, &baseLine);
398
 
399
  cv::Scalar txt_bk_color = color * 0.7 * 255;
400
 
 
410
  txt_bk_color, -1);
411
 
412
  cv::putText(image, text, cv::Point(x, y + label_size.height),
413
+ cv::FONT_HERSHEY_SIMPLEX, 0.4, txt_color, 1);
414
  }
415
 
416
  cv::imwrite("det_res.jpg", image);
yolox/utils/visualize.py CHANGED
@@ -24,7 +24,7 @@ def vis(img, boxes, scores, cls_ids, conf=0.5, class_names=None):
24
  color = (_COLORS[cls_id] * 255).astype(np.uint8).tolist()
25
  text = '{}:{:.1f}%'.format(class_names[cls_id], score * 100)
26
  txt_color = (0, 0, 0) if np.mean(_COLORS[cls_id]) > 0.5 else (255, 255, 255)
27
- font = cv2.FONT_HERSHEY_COMPLEX
28
 
29
  txt_size = cv2.getTextSize(text, font, 0.4, 1)[0]
30
  cv2.rectangle(img, (x0, y0), (x1, y1), color, 2)
 
24
  color = (_COLORS[cls_id] * 255).astype(np.uint8).tolist()
25
  text = '{}:{:.1f}%'.format(class_names[cls_id], score * 100)
26
  txt_color = (0, 0, 0) if np.mean(_COLORS[cls_id]) > 0.5 else (255, 255, 255)
27
+ font = cv2.FONT_HERSHEY_SIMPLEX
28
 
29
  txt_size = cv2.getTextSize(text, font, 0.4, 1)[0]
30
  cv2.rectangle(img, (x0, y0), (x1, y1), color, 2)