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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -15
app.py CHANGED
@@ -233,13 +233,13 @@ def get_detection_data(image_data):
233
  nested_dict = image_data.get("image", {}).get("image", {})
234
  full_data_url = nested_dict.get("data", "")
235
  # get model size and confidence threshold
236
- model_size = image_data.get("model_size", "Small - Better performance and less accuracy")
237
- confidence_threshold = image_data.get("confidence_threshold", 0.6) # Default to 60%
238
  else:
239
  full_data_url = image_data
240
 
241
- model_size = "Small - Better performance and less accuracy" # Fallback default
242
- confidence_threshold = 0.6 # Fallback default
243
 
244
  if not full_data_url:
245
  return {"error": "No base64 data found in input."}
@@ -254,17 +254,6 @@ def get_detection_data(image_data):
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
270
  print(f"Debug - Resized image shape: {resized_image.shape}")
 
233
  nested_dict = image_data.get("image", {}).get("image", {})
234
  full_data_url = nested_dict.get("data", "")
235
  # get model size and confidence threshold
236
+ #model_size = image_data.get("model_size", "Small - Better performance and less accuracy")
237
+ #confidence_threshold = image_data.get("confidence_threshold", 0.6) # Default to 60%
238
  else:
239
  full_data_url = image_data
240
 
241
+ #model_size = "Small - Better performance and less accuracy" # Fallback default
242
+ #confidence_threshold = 0.6 # Fallback default
243
 
244
  if not full_data_url:
245
  return {"error": "No base64 data found in input."}
 
254
  img = np.array(img)
255
  img = cv2.cvtColor(img, cv2.COLOR_RGB2BGR)
256
 
 
 
 
 
 
 
 
 
 
 
 
257
  #image = utils.resize(img)
258
  resized_image = utils.resize(img) #depth requires resizing
259
  print(f"Debug - Resized image shape: {resized_image.shape}")