Yolov7_ Custom_ Object_ Detection
owaiskha9654Introduction
This repository demonstrates custom object detection using the YOLOv7 model, focusing on detecting "Person" and "Car" from images. The project includes training, inference, and evaluation of a custom-trained YOLOv7 model.
Architecture
YOLOv7 is a state-of-the-art object detection model known for its speed and accuracy. It is implemented in PyTorch and designed to handle various object detection tasks efficiently.
Training
- Data Acquisition: The dataset, containing images of people and cars, is available on Kaggle.
- Data Preparation: Images are pre-processed using Roboflow to ensure compatibility with YOLOv7's requirements. The dataset is exported to YOLOv7 format with appropriate annotations.
- Training Process:
- Clone the YOLOv7 repository and install necessary packages.
- Download the starting checkpoint for YOLOv7.
- Train the model using the custom dataset, specifying parameters like image size, batch size, epochs, and weights for transfer learning.
- Optional tools like Weights & Biases (W&B) can be used for logging and visualization.
Guide: Running Locally
- Clone and Set Up:
git clone https://github.com/WongKinYiu/yolov7 cd yolov7 pip install -qr requirements.txt pip install -q roboflow
- Download Checkpoint:
wget "https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7.pt"
- Prepare Dataset: Use Roboflow to convert your dataset to YOLOv7 format and download it.
- Train the Model:
python train.py --batch 16 --cfg cfg/training/yolov7.yaml --epochs 30 --data {dataset_location}/data.yaml --weights 'yolov7.pt' --device 0
- Inference:
python detect.py --weights runs/train/exp/weights/best.pt --img 416 --conf 0.75 --source {test_images_folder}
- Display Results:
for images in glob.glob('runs/detect/exp/*.jpg')[0:10]: display(Image(filename=images))
Cloud GPUs: Training can be resource-intensive. It is recommended to use cloud services like AWS, Google Cloud, or Azure for access to powerful GPUs.
License
The repository and its contents are governed by the licensing terms specified in the original YOLOv7 repository managed by WongKinYiu. Ensure to comply with these terms when using or distributing the model and related artifacts.