git clone https://github.com/mangoggul/YOLOv8-training-inference.git
├── dataName
│ ├── train
│ ├── images
│ └── labels
│ ├── val
│ ├── images
│ └── labels
So For example
├── wheatCOCO
│ ├── train
│ ├── images
│ └── labels
│ ├── val
│ ├── images
│ └── labels
Important Thing : YOLO doesnt support json Annotation Files so you need to change json to txt
if you only have json file use json2txt.py to convert json file to txt
first you need to make yaml file.
names:
0: backGround
1: wheat
nc : 2
path: C:/Users/user/Desktop/vscodeOD/YOLO_v8/wheatCOCO/ # Base dataset directory
train: train/images
val: val/images
this one is my yaml file.
names : class name
<YOLO detect background also So if you want to detect 1 object you need to write Object name and background>
nc : class number
path : dataset Path
train : dataset/train Path
val : dataset/val Path
use train.ipynb file to train your own custom data
you can choose epochs, workers, etc.
consider below documents to know more about parameters
After Training you can use inference.ipynb file. from ultralytics import YOLO
# Load a model
model = YOLO("runs/detect/train17/weights/best.pt") # pretrained YOLOv8n model
In this part, put your pt file to run inference!
Enjoy Detection!