YOLO11n Municipal Hazard and Waste Detection
Model Summary
This repository provides an optimized YOLO11 nano-architecture object detection model trained to detect three critical municipal infrastructure hazards: solid waste accumulations, roadway potholes, and uncovered manholes.
The model is designed for high-throughput, low-latency edge and server deployments, operating at a base resolution of 640x640 with 2.59 million parameters and 6.5 GFLOPs.
Model Details
- Architecture: Ultralytics YOLO11n (Anchor-free decoupled head, C3k2, SPPF, C2PSA)
- Task: 2D Bounding Box Object Detection
- Input Dimensions: 640 x 640 x 3 (RGB)
- Parameter Count: 2,590,425
- GFLOPs: 6.5
- Framework: PyTorch / Ultralytics
Classes and Taxonomy
The model predicts three discrete classes:
| Class ID | Class Label | Description |
|---|---|---|
0 | waste_pile | Concentrated accumulations of roadside solid waste, plastics, paper, and general refuse across pavement, asphalt, and open ground. |
1 | pothole | Structural asphalt damage, cavities, depressions, and surface craters on vehicular roadways. |
2 | open_manhole | Uncovered, displaced, or missing sewer, storm drain, and utility access apertures. |
Quickstart and Usage
Prerequisites
Install the official Ultralytics runtime:
pip install ultralytics torch torchvision
Python API Inference
from ultralytics import YOLO
import cv2
# Load model weights
model = YOLO("waste , pothole and open manhole detection.pt")
# Execute inference on an image
results = model.predict(
source="path/to/test_image.jpg",
conf=0.30, # Confidence threshold
iou=0.45, # NMS IoU threshold
imgsz=640,
device=0 # Use 0 for GPU, 'cpu' for CPU
)
# Process detections
for result in results:
boxes = result.boxes
for box in boxes:
cls_id = int(box.cls[0].item())
conf = float(box.conf[0].item())
xyxy = box.xyxy[0].tolist()
label = model.names[cls_id]
print(f"Detected {label} with confidence {conf:.3f} at coordinates {xyxy}")
# Display or save annotated result
annotated_frame = result.plot()
cv2.imwrite("output_prediction.jpg", annotated_frame)
Video and Stream Processing
# Process a video file or live RTSP stream
results = model.predict(
source="path/to/video.mp4", # Or rtsp://... or webcam index (0)
conf=0.35,
save=True,
stream=True
)
for r in results:
pass # Processing generator frames
Command-Line Interface (CLI)
# Predict on an image or directory
yolo task=detect mode=predict model="waste , pothole and open manhole detection.pt" source="image.jpg" conf=0.30 save=True
# Run on directory of videos using GPU
yolo task=detect mode=predict model="waste , pothole and open manhole detection.pt" source="video_dir/" device=0 save=True
Dataset Engineering and Preprocessing
The model was trained on a consolidated, multi-source corpus curated to minimize false-positive rates in urban and rural environments:
-
Spatial Aggregation for Waste: Individual litter annotations were algorithmically clustered into unified macro-bounding boxes (
waste_pile) based on spatial proximity ($L_2$ centroid threshold $\le 0.18$ normalized screen space). This prevents fragmented bounding-box predictions across dispersed litter zones. -
Vehicle Artifact Removal: Standard road damage corpuses frequently contain visible car hood reflections and dashboard edges that induce false-positive pothole triggers. All vehicular frame intrusions were filtered out.
-
Crack vs. Aperture Discrimination: Superficial linear road cracks were explicitly filtered to ensure Class 1 represents true structural craters and Class 2 represents open geometric cavities rather than cosmetic surface fissures.
Training Configuration
- Optimizer: AdamW ($\beta_1 = 0.937, \beta_2 = 0.999$, weight decay = 0.0005)
- Epochs: 100
- Learning Rate: $\eta_0 = 1\times 10^{-3}$ with Cosine Annealing decay down to $1\times 10^{-5}$
- Warmup: 5 epochs with bias learning rate of 0.01
- Regularization & Augmentations:
- Mosaic Augmentation: 1.0 (deactivated during terminal 15 epochs)
- Mixup: 0.15
- Copy-Paste: 0.15
- Rotation: 180 degrees
- Scale Invariance: 0.6
- Random Erasing: 0.3
Deployment and Model Export
The model can be converted to optimized runtime engines via the Ultralytics export API:
from ultralytics import YOLO
model = YOLO("waste , pothole and open manhole detection.pt")
# Export to ONNX Runtime (CPU / GPU)
model.export(format="onnx", imgsz=640, simplify=True)
# Export to TensorRT (High-throughput NVIDIA GPUs)
model.export(format="engine", imgsz=640, half=True, device=0)
# Export to OpenVINO (Intel CPUs / iGPUs / VPUs)
model.export(format="openvino", imgsz=640, half=True)
# Export to Tencent NCNN (ARM Cortex / Embedded edge platforms)
model.export(format="ncnn", imgsz=640)
Evaluation Recommendations
- Default Operational Threshold: Set
conf=0.30andiou=0.45for balanced precision and recall. - High-Precision Safety-Critical Mode: For autonomous alerting on
open_manhole, set class-specific confidence filtering:waste_pile:conf >= 0.25pothole:conf >= 0.35open_manhole:conf >= 0.40