Spaces:
Runtime error
Runtime error
Update services/operations_maintenance/pothole_detection.py
Browse files
services/operations_maintenance/pothole_detection.py
CHANGED
@@ -26,17 +26,6 @@ except Exception as e:
|
|
26 |
model = None
|
27 |
|
28 |
def process_potholes(frame: np.ndarray) -> Tuple[List[Dict[str, Any]], np.ndarray]:
|
29 |
-
"""
|
30 |
-
Detect potholes in a video frame using YOLOv8m.
|
31 |
-
|
32 |
-
Args:
|
33 |
-
frame (np.ndarray): Input frame in BGR format.
|
34 |
-
|
35 |
-
Returns:
|
36 |
-
Tuple[List[Dict[str, Any]], np.ndarray]: A tuple containing:
|
37 |
-
- List of detected potholes.
|
38 |
-
- Annotated frame with bounding boxes and labels.
|
39 |
-
"""
|
40 |
# Validate input frame
|
41 |
if not isinstance(frame, np.ndarray) or frame.size == 0:
|
42 |
logging.error("Invalid input frame provided to pothole_detection.")
|
@@ -78,7 +67,7 @@ def process_potholes(frame: np.ndarray) -> Tuple[List[Dict[str, Any]], np.ndarra
|
|
78 |
"coordinates": [x_min, y_min, x_max, y_max]
|
79 |
})
|
80 |
|
81 |
-
color = (255,
|
82 |
cv2.rectangle(frame, (x_min, y_min), (x_max, y_max), color, 2)
|
83 |
cv2.putText(
|
84 |
frame,
|
|
|
26 |
model = None
|
27 |
|
28 |
def process_potholes(frame: np.ndarray) -> Tuple[List[Dict[str, Any]], np.ndarray]:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
# Validate input frame
|
30 |
if not isinstance(frame, np.ndarray) or frame.size == 0:
|
31 |
logging.error("Invalid input frame provided to pothole_detection.")
|
|
|
67 |
"coordinates": [x_min, y_min, x_max, y_max]
|
68 |
})
|
69 |
|
70 |
+
color = (255, 0, 0) # Red for potholes
|
71 |
cv2.rectangle(frame, (x_min, y_min), (x_max, y_max), color, 2)
|
72 |
cv2.putText(
|
73 |
frame,
|