0

getting IndexError: index 1 is out of bounds for dimension 1 with size 1 while training yolo v8

I am trying defect detection with yolov8 and i am expecting a detection of those defect on full scale image Input is 416 * 416 image using Python 3.8.6,windows11 pro

data.yaml file: path: /Users/pksha/yolo train: train/images val: val/images nc: 0 names: ['particle'] **python code:

pip install ultralytics
from ultralytics import YOLO
# LOAD model
 model=YOLO("yolov8l.yaml")
 results=model.train(data="data.yaml",epochs=1)

I have tried both increasing and decresing to check if it works but both showed error.

1 Answers1

0

'nc' in a data.yaml file corresponds to the 'number of classes'. In your case it is equal to 1 (one class 'particle'), not 0. Also, look at the 'names' format, it should be like this:

names:
  0: particle

Value 0 in 'names' corresponds to the class index (starts from 0).

More about yolov8 object detection dataset format: https://docs.ultralytics.com/datasets/detect/

hanna_liavoshka
  • 115
  • 1
  • 6