You need to agree to share your contact information to access this model

This repository is publicly accessible, but you have to accept the conditions to access its files and content.

Log in or Sign Up to review the conditions and access this model content.

Highway Vehicle Detection - Complete Project

A comprehensive vehicle detection system for highway traffic monitoring, including trained models, datasets, videos, and complete source code.

πŸ“ Project Contents

πŸ€– Trained Models

  • runs/detect/yolov8m_stage1_smart/weights/best.pt - Stage 1 model
  • runs/detect/yolov8m_stage2_improved/weights/best.pt - Final improved model

πŸ“Š Datasets

  • dataset/ - Main training dataset (8,219 images + labels)
  • new_finetunedata/ - Fine-tuning dataset (92 images + labels)

🎬 Videos

  • input and output/test_video.mp4 - Input test video
  • input and output/detection_output_improved.mp4 - Output with detections

πŸ’» Source Code

  • main.py - Main application for vehicle detection and counting
  • test_improved_model.bat - Testing script
  • PROJECT_REPORT.md - Complete project documentation

πŸ“‹ Configuration

  • dataset/data.yaml - Main dataset configuration
  • new_finetunedata/data.yaml - Fine-tuning dataset configuration
  • requirements.txt - Python dependencies

πŸš€ Quick Start

Installation

pip install ultralytics opencv-python numpy

Run Detection

from ultralytics import YOLO

# Load the trained model
model = YOLO('runs/detect/yolov8m_stage2_improved/weights/best.pt')

# Process video
results = model('input and output/test_video.mp4', save=True)

Using the Main Application

python main.py

πŸ“ˆ Model Performance

Classes Detected

  1. auto - Three-wheelers
  2. bus - Public transport vehicles
  3. car - Passenger cars
  4. lcv - Light Commercial Vehicles
  5. motorcycle - Two-wheelers
  6. multiaxle - Multi-axle heavy vehicles
  7. tractor - Agricultural/construction vehicles
  8. truck - Heavy vehicles

Training Stages

  • Stage 1: Initial training on 8,219 highway images
  • Stage 2: Fine-tuning on 92 additional images for improved truck/bus detection

πŸ“Š Dataset Statistics

Main Dataset (dataset/)

  • Images: 8,219 highway traffic images
  • Labels: 8,219 corresponding annotation files
  • Classes: 8 vehicle types
  • Format: YOLO format (.txt files)

Fine-tuning Dataset (new_finetunedata/)

  • Images: 92 additional images
  • Focus: Improved truck and bus detection
  • Classes: Enhanced examples for problematic classes

🎯 Applications

  • Highway traffic monitoring
  • Vehicle counting and classification
  • Traffic flow analysis
  • Automated surveillance systems
  • Road safety monitoring
  • Traffic data collection

πŸ“ File Structure

highway-vehicle-detection-full/
β”œβ”€β”€ runs/
β”‚   └── detect/
β”‚       β”œβ”€β”€ yolov8m_stage1_smart/
β”‚       β”‚   └── weights/
β”‚       β”‚       β”œβ”€β”€ best.pt
β”‚       β”‚       └── last.pt
β”‚       └── yolov8m_stage2_improved/
β”‚           └── weights/
β”‚               β”œβ”€β”€ best.pt
β”‚               └── last.pt
β”œβ”€β”€ dataset/
β”‚   β”œβ”€β”€ data.yaml
β”‚   └── train/
β”‚       β”œβ”€β”€ images/ (8,219 images)
β”‚       └── labels/ (8,219 label files)
β”œβ”€β”€ new_finetunedata/
β”‚   β”œβ”€β”€ data.yaml
β”‚   └── train/
β”‚       β”œβ”€β”€ images/ (92 images)
β”‚       └── labels/ (92 label files)
β”œβ”€β”€ input and output/
β”‚   β”œβ”€β”€ test_video.mp4
β”‚   └── detection_output_improved.mp4
β”œβ”€β”€ main.py
β”œβ”€β”€ PROJECT_REPORT.md
β”œβ”€β”€ requirements.txt
└── README.md

πŸ”§ Technical Details

  • Model Architecture: YOLOv8m (Medium)
  • Framework: Ultralytics YOLO
  • Input Format: Images/Videos
  • Output Format: Bounding boxes with class labels and confidence scores
  • Training Hardware: GPU recommended
  • Inference: CPU/GPU compatible

πŸ“ Usage Examples

Basic Detection

from ultralytics import YOLO
import cv2

# Load model
model = YOLO('runs/detect/yolov8m_stage2_improved/weights/best.pt')

# Detect objects in image
results = model('path/to/image.jpg')

# Process results
for result in results:
    boxes = result.boxes
    for box in boxes:
        x1, y1, x2, y2 = box.xyxy[0]
        conf = box.conf[0]
        cls = int(box.cls[0])
        print(f"Class: {cls}, Confidence: {conf:.2f}")

Video Processing

# Process video file
results = model('input and output/test_video.mp4', save=True, save_txt=True)

πŸ“„ License

MIT License - See LICENSE file for details

🀝 Contributing

This is a research project. For questions or improvements, please contact the author.

πŸ“ž Contact

Author: Nguyen Quoc Viet
Repository: https://huggingface.co/datasets/bichuche0705/highway-vehicle-detection-full

πŸ“š Citation

If you use this dataset or model in your research, please cite:

@misc{highway-vehicle-detection-full,
  title={Highway Vehicle Detection - Complete Project},
  author={Nguyen Quoc Viet},
  year={2024},
  url={https://huggingface.co/datasets/bichuche0705/highway-vehicle-detection-full}
}
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support