0

I'm stuck with the problem of Run cell in Colab to Train Model YOLOv8. The code will use this code.

import os from ultralytics
import YOLO
model = YOLO("yolov8x.yaml")
results = model.train(data=os.path.join(ROOT_DIR, "google_colab_config.yaml"), epochs=60)

There will be a total of 15863 images in this train. When running at 1, 5, or 21 epochs there is no problem, the model can be run as normal, but when I start using a higher number of epochs, for example, I use 70 epochs. Then an error will occur at epochs 38 saying FileNotFoundError : Image Not Found followed by path of that image or I use 60 epochs it will error at epochs 35 saying FileNotFoundError : Image Not Found followed by path of that image

I have checked the image paths and verified they are normal images that can be opened normally.

I still do not know the exact cause of what causes the error and how I can fix it.

screenshot of error message

Tim R
  • 2,622
  • 1
  • 3
  • 19

1 Answers1

0

The code is looking for a file in the specified location:

rootdir/google_colab_config.yaml

Did you upload that google_colab_config.yaml file to colab?

There is a file explorer on the side with an ability to create or upload files.

The code you typed will likely need to be changed or you will need to link the "ROOT_DIR" variable to where colab stores files (typically /content folder)

Grab the google_colab_config.yaml file, upload it to your colab workbook, then right click on it and select 'copy path' then paste that in place of the current code, so it goes from:

os.path.join(ROOT_DIR, "google_colab_config.yaml"

To:

import os 
from ultralytics import YOLO 
model = YOLO("yolov8x.yaml") 
results = model.train(data="/content/google_colab_config.yaml", epochs=60)

It will still not work though until you get that file uploaded, if this is for a course of some sort you will need to reach out to the instructor or your fellow classmates for that file.

There is a possibility another portion of your assignment was to create that google colab config yaml file, I am not sure.

That is your current problem though, your code will continue to fail until that file is provided.

J Wylie
  • 1
  • 2