hca97 commited on
Commit
8ead15f
·
1 Parent(s): eedca6c

make sure that text will be visible

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -10,7 +10,7 @@ from my_models import YOLOV5CLIPModel, YOLOV8CLIPModel
10
  def annotated_image(
11
  image: np.ndarray, label: str, conf: float, bbox: list
12
  ) -> np.ndarray:
13
- line_thickness = int(0.005 * max(image.shape[:2]))
14
  image = cv2.cvtColor(image, cv2.COLOR_RGB2BGR)
15
  image = cv2.rectangle(
16
  image,
@@ -27,7 +27,7 @@ def annotated_image(
27
  thickness=max(line_thickness // 2, 1),
28
  lineType=cv2.LINE_AA,
29
  color=(0, 0, 0),
30
- fontScale=0.1 * line_thickness,
31
  )
32
  image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
33
 
 
10
  def annotated_image(
11
  image: np.ndarray, label: str, conf: float, bbox: list
12
  ) -> np.ndarray:
13
+ line_thickness = max(1, int(0.005 * max(image.shape[:2])))
14
  image = cv2.cvtColor(image, cv2.COLOR_RGB2BGR)
15
  image = cv2.rectangle(
16
  image,
 
27
  thickness=max(line_thickness // 2, 1),
28
  lineType=cv2.LINE_AA,
29
  color=(0, 0, 0),
30
+ fontScale=max(0.5, 0.1 * line_thickness),
31
  )
32
  image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
33