Views
No views yet
runs/detect/yolov8m_stage1_smart/weights/best.pt - Stage 1 modelruns/detect/yolov8m_stage2_improved/weights/best.pt - Final improved modeldataset/ - Main training dataset (8,219 images + labels)new_finetunedata/ - Fine-tuning dataset (92 images + labels)input and output/test_video.mp4 - Input test videoinput and output/detection_output_improved.mp4 - Output with detectionsmain.py - Main application for vehicle detection and countingtest_improved_model.bat - Testing scriptPROJECT_REPORT.md - Complete project documentationdataset/data.yaml - Main dataset configurationnew_finetunedata/data.yaml - Fine-tuning dataset configurationrequirements.txt - Python dependenciespip install ultralytics opencv-python numpy1from ultralytics import YOLO
2
3# Load the trained model
4model = YOLO('runs/detect/yolov8m_stage2_improved/weights/best.pt')
5
6# Process video
7results = model('input and output/test_video.mp4', save=True)python main.pydataset/)new_finetunedata/)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.md1from ultralytics import YOLO
2import cv2
3
4# Load model
5model = YOLO('runs/detect/yolov8m_stage2_improved/weights/best.pt')
6
7# Detect objects in image
8results = model('path/to/image.jpg')
9
10# Process results
11for result in results:
12 boxes = result.boxes
13 for box in boxes:
14 x1, y1, x2, y2 = box.xyxy[0]
15 conf = box.conf[0]
16 cls = int(box.cls[0])
17 print(f"Class: {cls}, Confidence: {conf:.2f}")1# Process video file
2results = model('input and output/test_video.mp4', save=True, save_txt=True)1@misc{highway-vehicle-detection-full,
2 title={Highway Vehicle Detection - Complete Project},
3 author={Nguyen Quoc Viet},
4 year={2024},
5 url={https://huggingface.co/datasets/bichuche0705/highway-vehicle-detection-full}
6}