This project is based on the YOLOv10 repository by Ultralytics.
YOLOv10 is licensed under the AGPL-3.0 License.
All modifications and derived works in this repository therefore also comply with the AGPL-3.0 license.
This project is a custom implementation based on the official YOLOv10 repository. The goal is to train and evaluate a car detection model on a custom dataset.
Original YOLOv10 repository: https://github.com/THU-MIG/yolov10
Dự án này sử dụng YOLOv10 (Ultralytics) để huấn luyện và kiểm thử mô hình phát hiện xe (car detection) trên ảnh và video.
- Framework: Ultralytics YOLOv10
- Ngôn ngữ: Python
- Môi trường: Miniconda (conda env)
- Bài toán: Object Detection – 1 class (car)
Dự án bao gồm:
- Train model với dataset tự chuẩn YOLO format
- Predict trên ảnh / thư mục ảnh / video
- Xuất kết quả bounding box
yolov10_test/
│
├── train.py # Script train model
├── output.py # Script predict (ảnh / video)
│
├── yolov10/
│ └── yolo_data/
│ ├── train/
│ │ ├── images/
│ │ └── labels/
│ ├── val/
│ │ ├── images/
│ │ └── labels/
│ └── data.yml
│
├── runs/ # YOLO tự sinh (weights, output)
├── datasets/ # Ultralytics cache
└── README.md
-
Tải bản:
- Windows 64-bit
- Python 3.9 hoặc 3.10
-
Double click file
.exe -
Chọn:
- ✔ Just Me
- ✔ Add Miniconda to PATH (nếu có)
-
Next → Install
Mở Anaconda Prompt hoặc PowerShell:
conda --versionconda create -n object_detection python=3.10 -y
conda activate object_detectionpip install --upgrade pip
pip install ultralytics opencv-python matplotlibKiểm tra:
yolo versionimage.jpg
label.txt
label.txt:
<class_id> <x_center> <y_center> <width> <height>
path: yolov10/yolo_data
train: train/images
val: val/images
nc: 1
names:
- carChạy trong thư mục gốc project:
python train.pyVí dụ train.py:
from ultralytics import YOLO
model = YOLO("yolov10n.pt")
model.train(
data="yolov10/yolo_data/data.yml",
epochs=50,
imgsz=640,
batch=8
)📁 Model sau khi train nằm tại:
runs/detect/train*/weights/best.pt
from ultralytics import YOLO
model = YOLO("runs/detect/train10/weights/best.pt")
model.predict(
source="yolov10/yolo_data/val/images",
save=True,
conf=0.25
)📁 Output:
runs/detect/predict/
model.predict(
source="test_videos/test.mp4",
save=True,
conf=0.25
)👉 Dùng VLC hoặc convert:
ffmpeg -i output.avi output.mp4pip install ultralytics- Kiểm tra
data.yml - Không dùng đường dẫn tuyệt đối
- Project được sử dụng dựa trên source của yolov10 !!!