Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -171,7 +171,7 @@ async def detect_multiple_dogs(image, conf_threshold=0.35, iou_threshold=0.55):
|
|
171 |
dogs = []
|
172 |
boxes = []
|
173 |
for box in results.boxes:
|
174 |
-
if box.cls == 16: # COCO dataset class for dog is 16
|
175 |
xyxy = box.xyxy[0].tolist()
|
176 |
confidence = box.conf.item()
|
177 |
boxes.append((xyxy, confidence))
|
@@ -287,7 +287,7 @@ async def predict(image):
|
|
287 |
top1_prob, topk_breeds, topk_probs_percent = await predict_single_dog(cropped_image)
|
288 |
color = color_list[i % len(color_list)]
|
289 |
draw.rectangle(box, outline=color, width=3)
|
290 |
-
draw.text((box[0] + 5, box[1] + 5), f"Dog {i+1}", fill=color, font=font)
|
291 |
|
292 |
|
293 |
combined_confidence = detection_confidence * top1_prob
|
|
|
171 |
dogs = []
|
172 |
boxes = []
|
173 |
for box in results.boxes:
|
174 |
+
if box.cls == 16: # COCO dataset class for dog is 16
|
175 |
xyxy = box.xyxy[0].tolist()
|
176 |
confidence = box.conf.item()
|
177 |
boxes.append((xyxy, confidence))
|
|
|
287 |
top1_prob, topk_breeds, topk_probs_percent = await predict_single_dog(cropped_image)
|
288 |
color = color_list[i % len(color_list)]
|
289 |
draw.rectangle(box, outline=color, width=3)
|
290 |
+
draw.text((box[0] + 5, box[1] + 5), f"Dog {i+1}", fill=color, font=font) # Adjust the mark place
|
291 |
|
292 |
|
293 |
combined_confidence = detection_confidence * top1_prob
|