A speed monitoring and object detection system with a real-time web interface.
This system detects and measures the speed of moving objects by watching the RTSP video stream for motion. Speed is only recorded when an object is also recognized by the detection algorithm (this can be changed in the settings). Each detection saves an image along with the object's speed, color, and type (e.g., car, person, etc.). These results are shown on the detections page and summarized on the analytics page for a clear overview.
Dashboard |
Detections |
Analytics |
![]() Analytics |
On the settings page, YOLOv8 models can be automatically downloaded when selected. A better solution would be to customize these models to better adjust them to your use case. Or use the latest versions of YOLO. Suggestions would be greatly appreciated!
Link to the YOLO models
I recommend running this on a home server using Docker. The web interface works well on mobile devices, so you can check detections from anywhere. While not tested, it may also run on a Raspberry Pi if it has enough resources for the RTSP stream and detection. It currently runs on my home Docker server with Tailscale for remote access.
The web server can be accessed at http://localhost:5000 (HTTP not HTTPS)
- Python 3.9+ (for local installation)
- Docker & Docker Compose (for Docker installation)
- IP Camera or camera with RTSP stream capability
-
Download the Application
git clone https://github.com/julbov/speed-object-detection-camera.git cd speed-object-detection-camera -
Build and Run with Docker
docker-compose up -d
-
Access the Web Interface
Go to:
http://localhost:5000
-
Download the Application
git clone https://github.com/julbov/speed-object-detection-camera.git cd speed-object-detection-camera -
Install Python Dependencies
pip install -r requirements.txt
-
Configure Your Camera
Edit
config.jsonwith your RTSP URL details:{ "camera_settings": { "rtsp_url": "rtsp://username:password@your-camera-ip:554/h264" } } -
Run the Application
python speed_camera_web.py
-
Access the Web Interface
Go to:
http://localhost:5000
- YOLO Models: The YOLOv8 nano model is included, but it’s highly recommended to download a better model. Models are saved in the
models/folder. - Detection Data: All speed detections and images are saved in the
detections/folder. - GPU Support: Can use GPU if available, falls back to CPU (can be toggled in settings).
- Mobile Friendly: The web interface works on mobile devices.
Most settings can be updated and changed live like the detection lines. Some settings, however, require a camera restart (stop/start).
- RTSP URL: Common RTSP protocols
- Camera Framerate
- YOLO Models: See Yolo models for object Detection
- Confidence Threshold: This can be adjusted to change the confidence of the YOLO model when it classifies something as that object.
- Use GPU: Defaults to CPU if no GPU can be found.
- Min Detection Area: Can be adjusted to filter small detections.
- Motion Sensitivity: Removes noise from detection. Smaller values (1–5) are more sensitive to small movements but may detect noise, while larger values (10–50) reduce false detections from shadows and small movements but may miss smaller vehicles. Default is 10.
- Speed Limit: If an object exceeds this limit, it's flagged as a violation on the detections page.
- Speed in MPH
- Minimum Speed / Maximum Speed: Filters unrealistically slow or fast speeds.
- Min / Max Time Difference: The time a vehicle must be tracked before the system will calculate its speed.
- Min Track Length: Minimum distance in pixels an object must travel.
- Track Counter: Number of frames an object must travel.
Higher values = more accurate speed (more data points), but slower detection.
Lower values = faster detection, but potentially less accurate.
Configure detection area and speed lines:
- Left to Right Enabled & Right to Left Enabled: Allow detection only in one direction.
- L2R Line: Left-to-right speed measurement line position.
- R2L Line: Right-to-left speed measurement line position.
- Detection Area Top, Bottom, Left and Right: The detection area margins.
- L2R / R2L Object Size in mm: Real-life size.
- L2R / R2L Object Size in Pixels: Size on screen.
How to Calibrate
- Measure a known object like the vehicle length. Lookup vehicle dimensions
- Count pixels for the same object in the camera view.
- Set calibration values.
For a more in-depth guide on how to calibrate the camera, I recommend this guide from @pageauc.
- Save Images: When disabled, the detections still get recorded but no image is saved. A placeholder is used instead of an image.
- Image Quality: JPEG image quality to reduce file size.
- Ignore YOLO Validation: If enabled, every object that gets detected by YOLO gets logged. If it can't be classified, it gets the class "unknown".
- Vehicle Classes: Specify classes that are considered valid. These classes are also shown in the analytics and detection page.
- Make sure to use HTTP and not HTTPS.
- Check if port 5000 is already in use.
- Verify RTSP URL with VLC or a similar player.
Thanks to pageauc/speed-camera for the speed functionality.
Apache-2.0 license
Copyright [2025] [julbov]
Note: This software is provided for educational and research purposes only. The author is not responsible for any misuse or violation of local laws. It is your responsibility to ensure legal compliance in your jurisdiction.




