Yolov8 train model and how Can I use?

Hi everyone,

First and foremost, I wish everyone productive work. I am new to YOLO and object detection. I have a Jetson Nano and I want to create and run my own dataset with it. From what I’ve seen in most videos online, people use Google Colab for training. However, I want to do this locally using Python code in PyCharm. With the help of Roboflow, I have created my dataset and downloaded it to my specified folder. Now, I need to train this model and after completing the training, I want to write a simple program for plate detection to test on my Jetson Nano. I couldn’t find the necessary Python code for training a model with YOLOv8. Can you assist me with this? Additionally, if there are any steps I need to follow after completing the model training, could you guide me through them?
image

Ok. When I try to this code return this fail. I’m controlling data.yaml file path everything see ok.

Look like this;

names:
- plate
nc: 1
roboflow:
  license: CC BY 4.0
  project: plate-detection-j2gjj
  url: https://universe.roboflow.com/test-yolov8-uijmr/plate-detection-j2gjj/dataset/1
  version: 1
  workspace: test-yolov8-uijmr
test: ../test/images
train: Plate/train/images
val: Plate/valid/images

but receive this failure;

(venv) PS C:\Users\Musa\Desktop\Yolov8> yolo task=detect mode=train model=yolov8s.pt data=Plate/data.yaml epochs=100 imgsz=640
Ultralytics YOLOv8.1.15 🚀 Python-3.9.13 torch-2.2.0+cpu CPU (12th Gen Intel Core(TM) i7-12700H)
engine\trainer: task=detect, mode=train, model=yolov8s.pt, data=Plate/data.yaml, epochs=100, time=None, patience=50, batch=16, imgsz=640, save=True, save_period=
-1, cache=False, device=None, workers=8, project=None, name=train, exist_ok=False, pretrained=True, optimizer=auto, verbose=True, seed=0, deterministic=True, sin
gle_cls=False, rect=False, cos_lr=False, close_mosaic=10, resume=False, amp=True, fraction=1.0, profile=False, freeze=None, multi_scale=False, overlap_mask=True,
 mask_ratio=4, dropout=0.0, val=True, split=val, save_json=False, save_hybrid=False, conf=None, iou=0.7, max_det=300, half=False, dnn=False, plots=True, source=N
one, vid_stride=1, stream_buffer=False, visualize=False, augment=False, agnostic_nms=False, classes=None, retina_masks=False, embed=None, show=False, save_frames
=False, save_txt=False, save_conf=False, save_crop=False, show_labels=True, show_conf=True, show_boxes=True, line_width=None, format=torchscript, keras=False, op
timize=False, int8=False, dynamic=False, simplify=False, opset=None, workspace=4, nms=False, lr0=0.01, lrf=0.01, momentum=0.937, weight_decay=0.0005, warmup_epoc
hs=3.0, warmup_momentum=0.8, warmup_bias_lr=0.1, box=7.5, cls=0.5, dfl=1.5, pose=12.0, kobj=1.0, label_smoothing=0.0, nbs=64, hsv_h=0.015, hsv_s=0.7, hsv_v=0.4, 
degrees=0.0, translate=0.1, scale=0.5, shear=0.0, perspective=0.0, flipud=0.0, fliplr=0.5, mosaic=1.0, mixup=0.0, copy_paste=0.0, auto_augment=randaugment, erasing=0.4, crop_fraction=1.0, cfg=None, tracker=botsort.yaml, save_dir=runs\detect\train
Traceback (most recent call last):
  File "C:\Users\Musa\Desktop\Yolov8\venv\lib\site-packages\ultralytics\engine\trainer.py", line 133, in __init__
    self.data = check_det_dataset(self.args.data)
  File "C:\Users\Musa\Desktop\Yolov8\venv\lib\site-packages\ultralytics\data\utils.py", line 327, in check_det_dataset
    raise FileNotFoundError(m)
FileNotFoundError:
Dataset 'Plate/data.yaml' images not found ⚠️, missing path 'C:\Users\Musa\Desktop\Yolov8\datasets\Plate\Plate\valid\images'
Note dataset download directory is 'C:\Users\Musa\Desktop\Yolov8\datasets'. You can update this in 'C:\Users\Musa\AppData\Roaming\Ultralytics\settings.yaml'     

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\Musa\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\Musa\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\Musa\Desktop\Yolov8\venv\Scripts\yolo.exe\__main__.py", line 7, in <module>
  File "C:\Users\Musa\Desktop\Yolov8\venv\lib\site-packages\ultralytics\cfg\__init__.py", line 568, in entrypoint
    getattr(model, mode)(**overrides)  # default args from model
  File "C:\Users\Musa\Desktop\Yolov8\venv\lib\site-packages\ultralytics\engine\model.py", line 582, in train
    self.trainer = (trainer or self._smart_load("trainer"))(overrides=args, _callbacks=self.callbacks)
  File "C:\Users\Musa\Desktop\Yolov8\venv\lib\site-packages\ultralytics\engine\trainer.py", line 137, in __init__
    raise RuntimeError(emojis(f"Dataset '{clean_url(self.args.data)}' error ❌ {e}")) from e
RuntimeError: Dataset 'Plate/data.yaml' error
Dataset 'Plate/data.yaml' images not found , missing path 'C:\Users\Musa\Desktop\Yolov8\datasets\Plate\Plate\valid\images'
Note dataset download directory is 'C:\Users\Musa\Desktop\Yolov8\datasets'. You can update this in 'C:\Users\Musa\AppData\Roaming\Ultralytics\settings.yaml'

Hi @urania

Generally, we only provide support regarding our product, as well as the resources we create, including our notebooks, but we do not have the resources to provide support for training your model using the Ultralytics package locally. I recommend looking to the Ultralytics repo regarding this issue.

If you need help with Roboflow or our resources, feel free to create another topic.

I think you have to add the file path in data.yaml.

test: …/test/images
train: Plate/train/images
val: Plate/valid/images

If you use vscode, right click to the image in the test and copy path and add that path to the test like this for example.

test: D:\your_path\test\images
train: D:\your_path\train\images
val: D:\your_path\valid\images

Hope it works.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.