Spaces:
Running
Running
Commit
·
c69b39b
1
Parent(s):
8d69367
Fix: cv2 text insertion
Browse files
app.py
CHANGED
@@ -48,9 +48,9 @@ def draw_detections(boxes, colors, names, img):
|
|
48 |
xmin, ymin, xmax, ymax = map(int, box[0].tolist())
|
49 |
cv2.rectangle(img, (xmin, ymin), (xmax, ymax), color, 2)
|
50 |
print('name', name)
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
return img
|
55 |
|
56 |
# Load the appropriate YOLO model based on the version
|
@@ -68,8 +68,6 @@ def load_yolo_model(version="yolov5"):
|
|
68 |
model.cpu()
|
69 |
return model
|
70 |
|
71 |
-
# Main function for Grad-CAM visualization
|
72 |
-
# Main function for Grad-CAM visualization
|
73 |
def process_image(image, yolo_versions=["yolov5"]):
|
74 |
image = np.array(image)
|
75 |
image = cv2.resize(image, (640, 640))
|
|
|
48 |
xmin, ymin, xmax, ymax = map(int, box[0].tolist())
|
49 |
cv2.rectangle(img, (xmin, ymin), (xmax, ymax), color, 2)
|
50 |
print('name', name)
|
51 |
+
cv2.putText(img, name, (xmin, ymin - 5),
|
52 |
+
cv2.FONT_HERSHEY_SIMPLEX, 0.8, color, 2,
|
53 |
+
lineType=cv2.LINE_AA)
|
54 |
return img
|
55 |
|
56 |
# Load the appropriate YOLO model based on the version
|
|
|
68 |
model.cpu()
|
69 |
return model
|
70 |
|
|
|
|
|
71 |
def process_image(image, yolo_versions=["yolov5"]):
|
72 |
image = np.array(image)
|
73 |
image = cv2.resize(image, (640, 640))
|