Spaces:
Runtime error
Runtime error
Men-wome-detection-using-yolov8
This guide will provide instructions on how to convert OIDv4 data into the YOLO format for use with YOLOv8 object detection algorithms.
Getting Started
git clone https://github.com/prince0310/Men-wome-detection-using-yolov8-.git
Dataset
For training custom data set on yolo model you need to have data set arrangement in yolo format. which includes Images and Their annotation file.
clone the repository and run donload the data set and their annotation file
git clone https://github.com/prince0310/OIDv4_ToolKit.git
Implement convert annotation.ipynb
notebook
it will create data in below format
Custom dataset
|
|─── train
| |
| └───Images --- 0fdea8a716155a8e.jpg
| └───Labels --- 0fdea8a716155a8e.txt
|
└─── test
| └───Images --- 0b6f22bf3b586889.jpg
| └───Labels --- 0b6f22bf3b586889.txt
|
└─── validation
| └───Images --- 0fdea8a716155a8e.jpg
| └───Labels --- 0fdea8a716155a8e.txt
|
└─── data.yaml
Install
Pip install the ultralytics package including all requirements.txt in a 3.10>=Python>=3.7 environment, including PyTorch>=1.7.
pip install ultralytics
Train
Python
from ultralytics import YOLO
# Train
model = YOLO("yolov8n.pt")
results = model.train(data="data.yaml", epochs=200, workers=1, batch=8,imgsz=640) # train the model
Cli
yolo detect train data=data.yaml model=yolov8n.pt epochs=200 imgsz=640
Detect
Python
from ultralytics import YOLO
# Load a model
model = YOLO("best.pt") # load a custom model
# Predict with the model
results = model("image.jpg", save = True) # predict on an image
Cli
yolo detect predict model=path/to/best.pt source="images.jpg" # predict with custom model