0

I have a problem with the implementation of Yolov8 in colab. I downloaded the model using,

from ultralytics import YOLO
model = YOLO("yolov8n-cls.pt")

data directory,
data_dir='/content/gdrive/MyDrive/yolo'

I have two folders inside it- train and val which in turn has two folders corresponding to two classes

But when I start the training,

results = model.train(data=DATA_DIR, epochs=1, imgsz=64) 
I run into this issue
error: Caught error in DataLoader worker process 0.
Original Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/torch/utils/data/_utils/worker.py", line 308, in _worker_loop
    data = fetcher.fetch(index)
  File "/usr/local/lib/python3.10/dist-packages/torch/utils/data/_utils/fetch.py", line 51, in fetch
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/usr/local/lib/python3.10/dist-packages/torch/utils/data/_utils/fetch.py", line 51, in <listcomp>
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/usr/local/lib/python3.10/dist-packages/ultralytics/yolo/data/dataset.py", line 260, in __getitem__
    sample = self.album_transforms(image=cv2.cvtColor(im, cv2.COLOR_BGR2RGB))['image']
cv2.error: OpenCV(4.7.0) /io/opencv/modules/imgproc/src/color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cvtColor'

I expected the training to start but it does not and throws this error

jared
  • 4,165
  • 1
  • 8
  • 31
  • Does this answer your question? [imread returns None, violating assertion !\_src.empty() in function 'cvtColor' error](https://stackoverflow.com/questions/52676020/imread-returns-none-violating-assertion-src-empty-in-function-cvtcolor-er) – kggn Jul 17 '23 at 01:34

0 Answers0