Detection pipeline

Pothole detection flowchart

Every decision a frame passes through in live mode, from capture to the CSV log.

Start / stop Process Decision Fusion Rejected
01Capture
System start
1
ESP32-CAM captures a frame
OV2640 → JPEG via DMA
2
WiFi transport
MJPEG over 802.11, port 81
3
Python / OpenCV decode
cv2.VideoCapture → frame
02Detect and track
4
YOLOv8m inference
detector.py · forward pass
5
Any detection with conf ≥ 0.25?
No
Next frame
nothing to track
Yes
6
SORT tracking
sort.py · Kalman + Hungarian · track ID
03Filter false positives
7
Box area > 25% of frame?
Yes
Reject: large object
truck, bridge shadow
No
8
Aspect ratio > 3.0?
Yes
Reject: crack or bump
speed bump, tar snake
No
9
Stationary for > 10 frames?
Yes
Reject: static object
shadow of a stopped car
No
10
Track already queried?
Yes
Skip: duplicate ID
one query per pothole
04Trigger
11
Centre crossed the reference line?
cy ≥ 0.75 × frame height
No
Keep tracking
check again next frame
Yes
12
HTTP GET /query?pothole_id=N
5 reads · 0.5 s timeout each
13
Sensor node replies with JSON
ax, ay, az · RTC time · GPS
05Confirm and score
14
Peak jerk ≥ 1.5 m/s³?
No
Reject: no impact
shadow, puddle, manhole
Yes
15
Sensor fusion
S = 0.7·conf + 0.3·min(J / 20, 1)
06Log
16
Write a row to pothole_log.csv
time · ID · conf · jerk · severity · GPS
17
Annotate the frame
OpenCV overlay → MP4
18
System still running?
Yes
Back to step 1
next frame
No
System stop

Offline mode (a video file, no sensor node) follows the same path up to step 11, then skips steps 12 to 14: severity is vision-only and the jerk and GPS columns stay empty.