lokesh341 commited on
Commit
0cfc068
·
1 Parent(s): c45c8a6

Update services/operations_maintenance/pothole_detection.py

Browse files
services/operations_maintenance/pothole_detection.py CHANGED
@@ -20,6 +20,7 @@ MODEL_PATH = os.path.abspath(os.path.join(BASE_DIR, "../../models/yolov8m.pt"))
20
  try:
21
  model = YOLO(MODEL_PATH)
22
  logging.info("Loaded YOLOv8m model for pothole detection.")
 
23
  except Exception as e:
24
  logging.error(f"Failed to load YOLOv8m model: {str(e)}")
25
  model = None
@@ -60,7 +61,7 @@ def process_potholes(frame: np.ndarray) -> Tuple[List[Dict[str, Any]], np.ndarra
60
  for r in results:
61
  for box in r.boxes:
62
  conf = float(box.conf[0])
63
- if conf < 0.5:
64
  continue
65
  cls = int(box.cls[0])
66
  label = model.names[cls]
@@ -77,7 +78,7 @@ def process_potholes(frame: np.ndarray) -> Tuple[List[Dict[str, Any]], np.ndarra
77
  "coordinates": [x_min, y_min, x_max, y_max]
78
  })
79
 
80
- color = (255, 127, 80) # Coral (red + orange mix)
81
  cv2.rectangle(frame, (x_min, y_min), (x_max, y_max), color, 2)
82
  cv2.putText(
83
  frame,
 
20
  try:
21
  model = YOLO(MODEL_PATH)
22
  logging.info("Loaded YOLOv8m model for pothole detection.")
23
+ logging.info(f"Model class names: {model.names}")
24
  except Exception as e:
25
  logging.error(f"Failed to load YOLOv8m model: {str(e)}")
26
  model = None
 
61
  for r in results:
62
  for box in r.boxes:
63
  conf = float(box.conf[0])
64
+ if conf < 0.3:
65
  continue
66
  cls = int(box.cls[0])
67
  label = model.names[cls]
 
78
  "coordinates": [x_min, y_min, x_max, y_max]
79
  })
80
 
81
+ color = (255, 127, 80) # Coral (red + orange mix) for potholes
82
  cv2.rectangle(frame, (x_min, y_min), (x_max, y_max), color, 2)
83
  cv2.putText(
84
  frame,