Update app.py
Browse files
app.py
CHANGED
@@ -416,18 +416,18 @@ def detect_objects(query_text):
|
|
416 |
|
417 |
# Use multiple models for detection and get high confidence results
|
418 |
# First try the specialized detector
|
419 |
-
detections = T.countgd_object_detection(object_name, image, conf_threshold=0.
|
420 |
|
421 |
# If no high-confidence detections, try the more general object detector
|
422 |
if not detections:
|
423 |
# Try a different model with the same high threshold
|
424 |
try:
|
425 |
-
detections = T.grounding_dino_detection(object_name, image, box_threshold=0.
|
426 |
except:
|
427 |
pass
|
428 |
|
429 |
# Only keep high confidence detections
|
430 |
-
high_conf_detections = [det for det in detections if det.get("score", 0) > 0.
|
431 |
|
432 |
# Visualize only high confidence results with clear labeling
|
433 |
result_image = T.overlay_bounding_boxes(
|
|
|
416 |
|
417 |
# Use multiple models for detection and get high confidence results
|
418 |
# First try the specialized detector
|
419 |
+
detections = T.countgd_object_detection(object_name, image, conf_threshold=0.55)
|
420 |
|
421 |
# If no high-confidence detections, try the more general object detector
|
422 |
if not detections:
|
423 |
# Try a different model with the same high threshold
|
424 |
try:
|
425 |
+
detections = T.grounding_dino_detection(object_name, image, box_threshold=0.55)
|
426 |
except:
|
427 |
pass
|
428 |
|
429 |
# Only keep high confidence detections
|
430 |
+
high_conf_detections = [det for det in detections if det.get("score", 0) > 0.55]
|
431 |
|
432 |
# Visualize only high confidence results with clear labeling
|
433 |
result_image = T.overlay_bounding_boxes(
|