{"id":29550826,"url":"https://github.com/techieworld2/car_speed_detector","last_synced_at":"2026-05-18T00:05:37.982Z","repository":{"id":304974581,"uuid":"1020767043","full_name":"techieworld2/Car_Speed_Detector","owner":"techieworld2","description":"Detects car speed using YOLOv8 and OpenCV, classifies vehicles as Passed or Failed, and saves annotated results.","archived":false,"fork":false,"pushed_at":"2025-07-16T11:39:18.000Z","size":6768,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-17T15:26:40.746Z","etag":null,"topics":["object-detection","opencv","speed-estimation","yolov8"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/techieworld2.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-16T11:11:17.000Z","updated_at":"2025-07-16T11:39:21.000Z","dependencies_parsed_at":"2025-07-17T18:48:58.003Z","dependency_job_id":"bc1535c1-108d-4d91-b3f6-62accdd1745d","html_url":"https://github.com/techieworld2/Car_Speed_Detector","commit_stats":null,"previous_names":["techieworld2/car_speed_detector"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/techieworld2/Car_Speed_Detector","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techieworld2%2FCar_Speed_Detector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techieworld2%2FCar_Speed_Detector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techieworld2%2FCar_Speed_Detector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techieworld2%2FCar_Speed_Detector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/techieworld2","download_url":"https://codeload.github.com/techieworld2/Car_Speed_Detector/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techieworld2%2FCar_Speed_Detector/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265697902,"owners_count":23813098,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["object-detection","opencv","speed-estimation","yolov8"],"created_at":"2025-07-18T04:01:09.882Z","updated_at":"2026-05-18T00:05:32.957Z","avatar_url":"https://github.com/techieworld2.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Car Speed Detector using YOLOv8\n\nA Python-based vehicle speed detection system that uses **YOLOv8 object detection** to track vehicles in a video, calculate their speed, and classify them as **Passed** or **Failed** based on a speed threshold.\n\n---\n\n## Demo Output\n\n- Draws a detection line on video.\n- Tracks vehicles and calculates their speed using distance between frames.\n- Classifies each vehicle as:\n  - `Passed` (within speed limit)\n  - `Failed` (over speed limit)\n- Annotates video with:\n  - Bounding boxes\n  - Speed labels\n  - Summary stats (Passed/Failed count)\n- Saves cropped images of detected vehicles into:\n  - `passed/`\n  - `failed/`\n\n---\n\n## Tech Stack\n\n- [Ultralytics YOLOv8](https://github.com/ultralytics/ultralytics)\n- OpenCV\n- Python 3.8+\n\n---\n\n## Project Structure\n\n```bash\ncar_speed_detector/\n│\n├── input/                   # Input videos (e.g., cars.mp4)\n│   └── cars.mp4\n│\n├── output/                  # Processed output video and results\n│\n├── passed/                 # Cropped images of vehicles within speed limit\n├── failed/                 # Cropped images of vehicles over speed limit\n│\n├── yolov8n.pt              # Pre-trained YOLOv8 model\n│\n├── config.py               # Configuration settings\n├── detector.py             # Core logic for detection and speed check\n├── utils.py                # Utility functions (e.g., speed calculations)\n└── main.py                 # Entry point for running the pipeline\n```\n\n---\n\n## How It Works\n\n1. Loads the video and detects cars frame-by-frame.\n2. Tracks each vehicle using YOLOv8 object tracking.\n3. Computes pixel displacement between frames.\n4. Converts it into speed (km/h) using:\n\n```python\nspeed = (pixel_distance / PIXELS_PER_METER) * FPS * 3.6\n```\n\n5. If speed \u003e threshold → marked as \"Failed\", else \"Passed\".\n6. Saves vehicle snapshot into `passed/` or `failed/` folders.\n\n---\n\n## How to Run\n\n### 1. Install Requirements\n\n```bash\npip install ultralytics opencv-python\n```\n\n### 2. Place Input Video\n\nPut your `.mp4` file in the `input/` directory (e.g., `input/cars.mp4`).\n\n### 3. Run the Detector\n\n```bash\npython main.py\n```\n\n### 4. View Output\n\n- Annotated video: `output/output_speed_check.mp4`\n- Image snapshots: `passed/`, `failed/`\n\n---\n\n## Configuration\n\nEdit `config.py` to change:\n\n- Speed limit (e.g., 30 or 40 km/h)\n- Line position\n- Distance calibration (PIXELS_PER_METER)\n\n---\n\n## Limitations\n\n- Assumes a fixed camera angle.\n- Speed is estimated using pixel displacement — **not GPS-accurate**.\n- Requires calibration (e.g., pixels per meter) to match real-world scale.\n\n---\n\n## Credits\n\nBuilt with:\n- [Ultralytics YOLOv8](https://github.com/ultralytics/ultralytics)\n- [OpenCV](https://opencv.org/)\n\n---\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftechieworld2%2Fcar_speed_detector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftechieworld2%2Fcar_speed_detector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftechieworld2%2Fcar_speed_detector/lists"}