Set confidence threshold to 80% and remove slider from frontend

 Frontend Changes:
- Removed confidence threshold slider from web interface
- Added fixed 80% confidence display with green info box
- Updated JavaScript to use fixed 0.8 threshold
- Removed slider-related CSS styles

 Backend Changes:
- Updated all API endpoints to default to 80% confidence (0.8)
- Modified POST /detect, GET /detect/hardcoded, POST /detect/base64
- Updated comments to reflect new default threshold

 Testing Updates:
- Updated test_api.py to use 80% confidence for all tests
- Ensures consistent testing with new threshold

 Benefits:
- High precision mode (80% confidence) reduces false positives
- Simplified user interface without threshold adjustment
- Consistent detection behavior across all endpoints
This commit is contained in:
Aherobo Ovie Victor
2025-07-11 20:47:04 +01:00
parent c4de90fbec
commit 26a6f6f625
6 changed files with 31 additions and 40 deletions
+6 -6
View File
@@ -149,8 +149,8 @@ def detect_memory_modules():
'success': False
}), 400
# Get confidence threshold from form data
conf_threshold = float(request.form.get('confidence', 0.5))
# Get confidence threshold from form data (default 80%)
conf_threshold = float(request.form.get('confidence', 0.8))
# Save uploaded file temporarily
filename = secure_filename(file.filename)
@@ -219,8 +219,8 @@ def detect_hardcoded_image():
'success': False
}), 404
# Get confidence threshold from query parameters
conf_threshold = float(request.args.get('confidence', 0.5))
# Get confidence threshold from query parameters (default 80%)
conf_threshold = float(request.args.get('confidence', 0.8))
# Run detection
detections, annotated_image = detector.detect(
@@ -283,8 +283,8 @@ def detect_base64_image():
'success': False
}), 400
# Get confidence threshold
conf_threshold = float(data.get('confidence', 0.5))
# Get confidence threshold (default 80%)
conf_threshold = float(data.get('confidence', 0.8))
# Decode base64 image
try: