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
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. Processes 15-20 FPS with instant audio alerts. Built with PyTorch, TensorFlow, OpenCV.
Quick Start:
git clone https://github.com/Methasit-Pun/BEAM-detection-system.git
cd BEAM-detection-system
pip install -r requirements.txt
python detect_e_scooter.py --config config.yaml- ๐ฏ 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 100+ campus-specific labeled images
- 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
- Empty scooter
- Single rider (compliant)
- Multiple riders (violation)
- (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 "empty\nsingle_rider\nmulti_rider" > 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>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.






