Alessio Grancini commited on
Commit
84fbecb
·
verified ·
1 Parent(s): eef9637

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -5
app.py CHANGED
@@ -254,11 +254,16 @@ def get_detection_data(image_data):
254
  img = np.array(img)
255
  img = cv2.cvtColor(img, cv2.COLOR_RGB2BGR)
256
 
257
- # Apply model size and confidence threshold
258
- print(f"Applying default settings - Model Size: {model_size}, Confidence Threshold: {confidence_threshold}")
259
- model_selector(model_size) # Update models based on input
260
- update_confidence_threshold(confidence_threshold * 100) # Scale to 0-100 for consistency
261
- print(f"Received new settings - Model Size: {model_size}, Confidence Threshold: {confidence_threshold}")
 
 
 
 
 
262
 
263
  #image = utils.resize(img)
264
  resized_image = utils.resize(img) #depth requires resizing
 
254
  img = np.array(img)
255
  img = cv2.cvtColor(img, cv2.COLOR_RGB2BGR)
256
 
257
+ # Log received values for reference (settings applied by prior API calls)
258
+ print(f"Received settings from payload (reference) - Model Size: {model_size}, Confidence Threshold: {confidence_threshold}")
259
+ # Verify actual models and threshold used
260
+ expected_yolo = "yolov8s-seg" if model_size == "Small - Better performance and less accuracy" else \
261
+ "yolov8m-seg" if model_size == "Medium - Balanced performance and accuracy" else "yolov8l-seg"
262
+ expected_midas = "midas_v21_small_256" if model_size == "Small - Better performance and less accuracy" else \
263
+ "dpt_hybrid_384" if model_size == "Medium - Balanced performance and accuracy" else "dpt_large_384"
264
+ print(f"Expected YOLO model: {expected_yolo}, Actual YOLO model: {img_seg.model_type}")
265
+ print(f"Expected MiDaS model: {expected_midas}, Actual MiDaS model: {depth_estimator.model_type}")
266
+ print(f"Actual confidence threshold: {img_seg.confidence_threshold}")
267
 
268
  #image = utils.resize(img)
269
  resized_image = utils.resize(img) #depth requires resizing