car-detection-system
Science Score: 44.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (13.7%) to scientific vocabulary
Repository
Basic Info
- Host: GitHub
- Owner: SoObai
- License: gpl-3.0
- Language: Python
- Default Branch: main
- Size: 0 Bytes
Statistics
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
- Releases: 0
Metadata Files
README.md
Car Detection System
A comprehensive car detection system built on YOLOv5, providing real-time vehicle detection and classification capabilities.
= Overview
This project implements a state-of-the-art car detection system using YOLOv5 (You Only Look Once version 5), a fast and accurate object detection model. The system can detect various types of vehicles including cars, trucks, buses, and motorcycles in images and video streams.
(' Features
- Real-time Detection: Fast inference for live video streams
- Multiple Vehicle Types: Detects cars, trucks, buses, motorcycles, and more
- High Accuracy: State-of-the-art YOLOv5 models for precise detection
- Multiple Input Formats: Supports images, videos, and webcam streams
- Easy Training: Tools for custom dataset training
- Export Options: Convert models to various formats (ONNX, TensorRT, etc.)
- Web Interface: Optional Flask REST API for easy integration
= Installation
Prerequisites
- Python 3.8 or higher
- CUDA-compatible GPU (optional, for faster inference)
Quick Start
Clone the repository
bash git clone https://github.com/SoObai/Car-Detection-System.git cd Car-Detection-SystemInstall dependencies
bash pip install -r requirements.txtDownload pre-trained weights (optional) ```bash
Download YOLOv5s weights
wget https://github.com/ultralytics/yolov5/releases/download/v7.0/yolov5s.pt ```
= Usage
Basic Detection
Detect cars in an image
bash
python detect.py --source path/to/image.jpg --weights yolov5s.pt
Detect cars in a video
bash
python detect.py --source path/to/video.mp4 --weights yolov5s.pt
Real-time webcam detection
bash
python detect.py --source 0 --weights yolov5s.pt
Advanced Options
Save results
bash
python detect.py --source path/to/image.jpg --weights yolov5s.pt --save-txt --save-conf
Adjust confidence threshold
bash
python detect.py --source path/to/image.jpg --weights yolov5s.pt --conf 0.5
Use different model sizes
```bash
YOLOv5n (nano) - fastest
python detect.py --weights yolov5n.pt
YOLOv5s (small) - balanced
python detect.py --weights yolov5s.pt
YOLOv5m (medium) - more accurate
python detect.py --weights yolov5m.pt
YOLOv5l (large) - very accurate
python detect.py --weights yolov5l.pt
YOLOv5x (extra large) - most accurate
python detect.py --weights yolov5x.pt ```
< Training
Train on Custom Dataset
Prepare your dataset in YOLO format:
dataset/ %%% images/ % %%% train/ % %%% val/ %%% labels/ %%% train/ %%% val/Create dataset configuration (
data/cars.yaml):yaml path: ../dataset train: images/train val: images/val nc: 1 # number of classes names: ['car'] # class namesStart training:
bash python train.py --data data/cars.yaml --weights yolov5s.pt --epochs 100
Training Options
Resume training
bash
python train.py --resume runs/train/exp/weights/last.pt
Multi-GPU training
bash
python train.py --data data/cars.yaml --weights yolov5s.pt --device 0,1
Hyperparameter tuning
bash
python train.py --data data/cars.yaml --weights yolov5s.pt --hyp data/hyps/hyp.scratch-high.yaml
= Validation
Validate trained model
bash
python val.py --weights runs/train/exp/weights/best.pt --data data/cars.yaml
Validate with custom confidence
bash
python val.py --weights runs/train/exp/weights/best.pt --data data/cars.yaml --conf 0.5
=' Model Export
Export to different formats
ONNX format
bash
python export.py --weights yolov5s.pt --include onnx
TensorRT format
bash
python export.py --weights yolov5s.pt --include engine --device 0
CoreML format
bash
python export.py --weights yolov5s.pt --include coreml
TensorFlow formats
bash
python export.py --weights yolov5s.pt --include saved_model pb tflite
< Web API
Start Flask REST API
bash
python utils/flask_rest_api/restapi.py
API Usage
bash
curl -X POST "http://localhost:5000/v1/object-detection/yolov5s" \
-H "Content-Type: image/jpeg" \
--data-binary @path/to/image.jpg
= Project Structure
Car-Detection-System/
%%% detect.py # Detection script
%%% train.py # Training script
%%% val.py # Validation script
%%% export.py # Model export script
%%% requirements.txt # Python dependencies
%%% models/ # Model configurations
% %%% yolo.py # YOLO model definition
% %%% common.py # Common model components
% %%% hub/ # Pre-configured models
%%% data/ # Dataset configurations
% %%% coco.yaml # COCO dataset config
% %%% hyps/ # Hyperparameter files
%%% utils/ # Utility functions
% %%% general.py # General utilities
% %%% plots.py # Plotting functions
% %%% torch_utils.py # PyTorch utilities
% %%% flask_rest_api/ # Web API
%%% classify/ # Classification module
%%% segment/ # Segmentation module
< Supported Datasets
- COCO: Common Objects in Context
- VOC: Pascal VOC
- ImageNet: Large-scale image classification
- Custom: Your own datasets
=
Detection Classes
The system can detect various vehicle types: - Car - Truck - Bus - Motorcycle - Bicycle - And more (depending on training data)
= Performance
| Model | Size | Speed (ms) | mAP@0.5 | mAP@0.5:0.95 | |-------|------|------------|---------|--------------| | YOLOv5n | 1.9M | 6.3 | 28.0 | 45.7 | | YOLOv5s | 7.2M | 6.4 | 37.4 | 56.8 | | YOLOv5m | 21.2M | 8.2 | 45.4 | 64.1 | | YOLOv5l | 46.5M | 10.1 | 49.0 | 67.3 | | YOLOv5x | 87.7M | 12.1 | 50.7 | 68.9 |
Performance metrics on COCO dataset
> Contributing
We welcome contributions! Please see our Contributing Guidelines for details.
How to Contribute
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
= License
This project is licensed under the MIT License - see the LICENSE file for details.
=O Acknowledgments
- Ultralytics for the YOLOv5 implementation
- PyTorch for the deep learning framework
- The open-source community for various tools and libraries
= Support
If you encounter any issues or have questions:
- Check the Issues page
- Create a new issue with detailed information
- Join our community discussions
= Updates
Stay updated with the latest features and improvements by: - Starring this repository - Watching for updates - Following our release notes
Made with d' for the computer vision community
Citation (CITATION.cff)
cff-version: 1.2.0
preferred-citation:
type: software
message: If you use YOLOv5, please cite it as below.
authors:
- family-names: Jocher
given-names: Glenn
orcid: "https://orcid.org/0000-0001-5950-6979"
title: "YOLOv5 by Ultralytics"
version: 7.0
doi: 10.5281/zenodo.3908559
date-released: 2020-5-29
license: GPL-3.0
url: "https://github.com/ultralytics/yolov5"
GitHub Events
Total
- Issue comment event: 7
- Push event: 2
- Pull request event: 4
- Create event: 3
Last Year
- Issue comment event: 7
- Push event: 2
- Pull request event: 4
- Create event: 3
Dependencies
- actions/cache v3 composite
- actions/checkout v3 composite
- actions/setup-python v4 composite
- actions/checkout v3 composite
- github/codeql-action/analyze v2 composite
- github/codeql-action/autobuild v2 composite
- github/codeql-action/init v2 composite
- actions/checkout v3 composite
- docker/build-push-action v3 composite
- docker/login-action v2 composite
- docker/setup-buildx-action v2 composite
- docker/setup-qemu-action v2 composite
- actions/first-interaction v1 composite
- actions/stale v7 composite
- actions/checkout v3 composite
- actions/setup-node v3 composite
- dephraiim/translate-readme main composite
- nvcr.io/nvidia/pytorch 22.12-py3 build
- gcr.io/google-appengine/python latest build
- Pillow >=7.1.2
- PyYAML >=5.3.1
- gitpython *
- ipython *
- matplotlib >=3.2.2
- numpy >=1.18.5
- opencv-python >=4.1.1
- pandas >=1.1.4
- psutil *
- requests >=2.23.0
- scipy >=1.4.1
- seaborn >=0.11.0
- tensorboard >=2.4.1
- thop >=0.1.1
- torchvision >=0.8.1
- tqdm >=4.64.0
- Flask ==1.0.2
- gunicorn ==19.9.0
- pip ==21.1