Real-time computer vision system for detecting multi-rider e-scooter violations
Deployed at Chulalongkorn University | 90.74% Detection Accuracy | 87% Violation Reduction in 5 Days
Features โข Architecture โข Results โข Installation โข Documentation
This project was trained and tested using NVIDIA's jetson-inference repo running directly on the Jetson Nano โ data capture (camera-capture), training (train_ssd.py), ONNX export (onnx_export.py), and inference testing (detectnet) were all done on-device, not on a separate training workstation. Training used a custom dataset of 200+ campus-collected images across 2 classes (beam, person), then the model was deployed for a 5-day field pilot at Chulalongkorn University. It is not an actively maintained product, and it is not turnkey-reproducible from a fresh clone:
- The trained model weights (
ssd-mobilenet.onnx) and the raw labeled image set are not published here. They're tied to a specific campus location/hardware setup rather than being a general-purpose release dataset, and the.onnxfile was never committed. scripts/train_model.sh and labels.txt are included, so the exact training recipe used is reproducible if you supply your own images. - sample.py is an earlier, standalone prototype (YOLOv5 via
torch.hub) written before thesrc/pipeline below existed. It is kept for reference only, uses a different model architecture than the documented SSD-MobileNet pipeline, and is not part of the maintained codebase. - The accuracy/violation-reduction figures in this README come from field-test logs from the original deployment, not from an automated benchmark you can reproduce by running this repo as-is.
If you want to build on this project: read Implementation for the actual training/export steps used, treat config.yaml and src/ as the reference pipeline, and expect to supply your own images (200+ recommended, beam/person classes, Pascal VOC format) before running detect_e_scooter.py.
Real-time AI system detecting multi-rider e-scooter violations at Chulalongkorn University using SSD-MobileNet on Jetson Nano. 90.74% accuracy, 87% violation reduction in 5 days (field-test results, not independently reproducible from this repo โ see Project Status). Processes 15-20 FPS with instant audio alerts. Built with PyTorch, TensorFlow, OpenCV.
Quick Start (requires a trained model โ see Data Collection Workflow; this will not run out of the box):
git clone https://github.com/Methasit-Pun/BEAM-detection-system.git
cd BEAM-detection-system
pip install -r requirements.txt
# Train (or supply) models/trained-model/ssd-mobilenet.onnx first โ see Implementation section
python detect_e_scooter.py --config config.yamlโ ๏ธ Project Status- ๐ฏ Problem Statement
- ๐ก Solution Overview
- ๐ Key Results
- ๐ Features
- โ๏ธ Technical Stack
- ๐๏ธ System Architecture
- ๐ป Implementation
- ๐งช Field Testing Results
- ๐ Installation
- ๐ฎ Future Work
- ๐ค Contributing
- ๐ License
Multiple riders on single e-scooters create safety hazards on campus. This common violation increases accident risk and requires automated monitoring.
Real-time computer vision system that:
- Detects e-scooters and counts riders using SSD-MobileNet
- Triggers audio alerts when 2+ riders detected
- Runs on Jetson Nano for edge deployment
- Processes video at 15-20 FPS
| Metric | Value | Impact |
|---|---|---|
| Detection Accuracy | 90.74% | High reliability in real-world conditions |
| Violation Reduction | 31% โ 4% | 87% decrease in 5 days |
| Processing Speed | 15-20 FPS | Real-time monitoring capability |
| Response Time | <200ms | Instant alert generation |
| False Positive Rate | <10% | Minimal incorrect alerts |
Field Deployment Statistics:
- ๐ Alert-to-incident correlation: >95%
- ๐ฅ User compliance: Variable (0-50%), decreasing trend over time
- โฐ Test period: 5 days across multiple campus locations
- ๐ Test hours: Morning (08:00-10:00) and Evening (16:00-18:00)
- Real-time Detection: Processes video at 15-20 FPS on edge hardware
- High Accuracy: 90.74% detection accuracy in real-world deployment
- Instant Alerts: Audio notifications triggered within 200ms of detection
- Edge Computing: Runs entirely on Jetson Nano without cloud dependency
- Custom Dataset: Trained on 200+ campus-specific labeled images (
beam,personclasses) - Scalable Architecture: Easily deployable across multiple locations
|
|
|
|
%%{init: {'theme':'base', 'themeVariables': { 'fontSize':'16px'}}}%%
graph LR
A["๐น Camera<br/>(CSI/USB)"] --> B["๐ฌ Video<br/>Capture"]
B --> C["๐ Preprocess<br/>(300x300)"]
C --> D["๐ง Model<br/>(SSD-MobileNet)"]
D --> E["๐ฆ Detections"]
E --> F{"๐ Multi-Rider<br/>Check"}
F -->|"โ Yes"| G["๐จ ALERT<br/>(Audio+Visual)"]
F -->|"โ No"| H["โ
Continue<br/>Monitoring"]
G --> I["๐ Log<br/>Violation"]
H --> B
I --> B
style F fill:#ffeb3b,stroke:#f57c00,stroke-width:4px,color:#000
style G fill:#ff6b6b,stroke:#c62828,stroke-width:3px,color:#fff
style H fill:#51cf66,stroke:#2e7d32,stroke-width:2px,color:#000
style D fill:#339af0,stroke:#1565c0,stroke-width:2px,color:#fff
style A fill:#e3f2fd,stroke:#1976d2,stroke-width:2px
style B fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px
- Video Acquisition โ Camera captures 1080p video at 30 FPS
- Frame Processing โ Resize to 300ร300, normalize pixel values
- Inference โ SSD-MobileNet processes frame (~50ms)
- Post-Processing โ Extract bounding boxes with confidence scores
- Violation Logic โ Check spatial overlap between scooter and person boxes
- Alert Generation โ Trigger audio if multi-rider detected
- Display & Logging โ Render annotated frame and log event
| Component | Technology | Purpose |
|---|---|---|
| Detection Model | SSD-MobileNet (ONNX) | Real-time object detection |
| Inference Engine | TensorRT / TensorFlow Lite | Optimized inference on Jetson |
| Video Handler | OpenCV VideoCapture | Frame acquisition and processing |
| Violation Detector | Custom Python Logic | Spatial overlap analysis |
| Alert System | PyAudio + Wave | Audio alert playback |
| Logger | Python Logging | Event tracking and statistics |
Camera โ Frame Buffer โ Preprocessing โ Neural Network โ
Detected Objects โ Violation Check โ Alert/Log โ Display
Processing Stages:
- Input: 1920ร1080 RGB frame
- Preprocessed: 300ร300 RGB tensor
- Detection: Bounding boxes + class labels + confidence scores
- Analysis: Rider count per scooter
- Output: Alert trigger + annotated frame
The model is a 2-class object detector โ beam (scooter) and person. "Multi-rider" is not a training class; it's derived at runtime by ViolationChecker, which counts how many person boxes overlap (IoU) a given beam box and flags a violation at 2+ riders. See labels.txt.
- (Future) Speed detection
- (Future) Direction compliance
1. Setup Dataset Structure
cd jetson-inference/python/training/detection/ssd/data
mkdir <your-dataset>
cd <your-dataset>
echo -e "beam\nperson" > labels.txt2. Capture & Label Images
Using jetson-inference camera-capture tool:
camera-capture csi://0 # MIPI CSI camera
camera-capture /dev/video0 # USB camera- Set mode to "Detection" in UI
- Freeze frame, draw bounding boxes
- Assign class labels
- Save and repeat
Note: We initially tried Kaggle e-scooter dataset but accuracy was insufficient. Custom campus-specific data performed better.
3. Train Model
cd jetson-inference/python/training/detection/ssd
python3 train_ssd.py --dataset-type=voc --data=data/<your-dataset> --model-dir=models/<your-model>4. Export to ONNX
python3 onnx_export.py --model-dir=models/<your-model>scripts/train_model.sh wraps steps 3-4 with the actual parameters used for this project (dataset name,
beam/personclasses, output paths) and copies the resultingssd-mobilenet.onnx+labels.txtintomodels/trained-model/whereconfig.yamlexpects them.
5. Deploy Detection
NET=models/<your-model>
detectnet --model=$NET/ssd-mobilenet.onnx --labels=$NET/labels.txt \
--input-blob=input_0 --output-cvg=scores --output-bbox=boxes \
csi://06. Audio Alert Integration
import pyaudio
import wave
def trigger_alert():
"""Play alert sound when violation detected"""
audio_file = "violation_alert.wav"
wf = wave.open(audio_file, 'rb')
p = pyaudio.PyAudio()
stream = p.open(format=p.get_format_from_width(wf.getsampwidth()),
channels=wf.getnchannels(),
rate=wf.getframerate(),
output=True)
stream.write(wf.readframes(1024))- Similar Implementation: Scooter Radar Backend
- Jetson Inference Docs: Official Guide
- ML Detection Demo: YouTube Tutorial
Observations:
- Morning sessions: higher compliance
- Evening (16:00-18:00): lower compliance
- Detection responsiveness: consistent across sessions
- User behavior: compliance decreased over time
Insights:
- High detection reliability (90.74%)
- Need stronger enforcement beyond audio alerts
- Consider visual indicators or mobile notifications
- Behavior change requires sustained intervention
| Component | Specification |
|---|---|
| Hardware | NVIDIA Jetson Nano (4GB) |
| Camera | CSI or USB (1080p recommended) |
| Audio | Speaker/Buzzer for alerts |
| Power | 5V 4A DC adapter |
| Storage | 32GB+ microSD card |
Python 3.8+
PyTorch 1.10+
TensorFlow 2.0+
OpenCV 4.5+
PyAudio
NumPy# Clone repository
git clone https://github.com/Methasit-Pun/BEAM-detection-system.git
cd BEAM-detection-system
# Install dependencies
pip3 install -r requirements.txt
# Run detection system
python3 detect_e_scooter.py --camera csi://0 --model models/trained-model/ssd-mobilenet.onnxEdit config.yaml to customize:
- Detection threshold
- Alert sensitivity
- Camera input source
- Model path
- Audio alert settings
Model Improvements:
- Expand training data: diverse lighting, angles, clothing
- Reduce false positives in crowded scenes
- Integrate weight sensors for validation
Enhanced Alerts:
- LED visual indicators
- Progressive warning system
- Mobile push notifications
Detection Capabilities:
- Speed monitoring
- Directional compliance
- Integration with campus enforcement
Deployment Expansion:
- Campus gates and intersections
- Parking zone monitoring
- Multi-campus rollout
Contributions are welcome! Whether you're fixing bugs, improving documentation, or proposing new features.
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- Follow PEP 8 style guide for Python code
- Add tests for new features
- Update documentation as needed
- Ensure all tests pass before submitting PR
MIT License - See LICENSE file for details.
- NVIDIA Jetson Inference: Official Documentation
- Pascal VOC Format: Dataset Specification
- Similar Projects: Scooter Radar Backend
- ML Detection Tutorial: YouTube Guide
Special Thanks:
- Chulalongkorn University for deployment support
- NVIDIA for Jetson Nano platform
- Open-source computer vision community
Made with โค๏ธ for campus safety
Report Bug ยท Request Feature ยท Documentation
ยฉ 2024-2026 BEAM Detection System Team. All rights reserved.






