Error training with Roboflow: No labels found in cache

We’re attempting to train a model with Roboflow. We can export and train with yolov8 without issue. After training for over an hour, we got this error:

e[34me[1mval: e[0mNo labels found in /tmp/cache/dataset/test/labels.cache, can not start training. See https://docs.ultralytics.com/yolov5/tutorials/train_custom_data
Traceback (most recent call last):
  File "/app/run_and_catch_error.py", line 11, in <module>
    runpy._run_module_as_main(args.module)
  File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/app/yolov8_object_detection_config.py", line 10, in <module>
    main()
  File "/app/yolov8_object_detection_config.py", line 6, in main
    trainer.monitored_train()
  File "/app/src/abstract_monitored_trainer.py", line 34, in monitored_train
    raise self.exc
  File "/app/src/abstract_monitored_trainer.py", line 40, in monitor_train
    self.train()
  File "/app/src/yolov8/base.py", line 305, in train
    _, test_class_map = self.get_class_map("test", self.model)
  File "/app/src/yolov8/base.py", line 208, in get_class_map
    validator(model=model.model)
  File "/usr/local/lib/python3.8/dist-packages/torch/autograd/grad_mode.py", line 27, in decorate_context
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/ultralytics/yolo/engine/validator.py", line 137, in __call__
    self.dataloader = self.dataloader or self.get_dataloader(self.data.get(self.args.split), self.args.batch)
  File "/usr/local/lib/python3.8/dist-packages/ultralytics/yolo/v8/detect/val.py", line 208, in get_dataloader
    dataset = self.build_dataset(dataset_path, batch=batch_size, mode='val')
  File "/usr/local/lib/python3.8/dist-packages/ultralytics/yolo/v8/detect/val.py", line 186, in build_dataset
    return build_yolo_dataset(self.args, img_path, batch, self.data, mode=mode, stride=gs)
  File "/usr/local/lib/python3.8/dist-packages/ultralytics/yolo/data/build.py", line 74, in build_yolo_dataset
    return YOLODataset(
  File "/usr/local/lib/python3.8/dist-packages/ultralytics/yolo/data/dataset.py", line 39, in __init__
    super().__init__(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/ultralytics/yolo/data/base.py", line 72, in __init__
    self.labels = self.get_labels()
  File "/usr/local/lib/python3.8/dist-packages/ultralytics/yolo/data/dataset.py", line 123, in get_labels
    raise FileNotFoundError(f'{self.prefix}No labels found in {cache_path}, can not start training. {HELP_URL}')
FileNotFoundError: e[34me[1mval: e[0mNo labels found in /tmp/cache/dataset/test/labels.cache, can not start training. See https://docs.ultralytics.com/yolov5/tutorials/train_custom_data

Any idea why this might be happening? Thanks!

The error message you’re seeing indicates that the training process is unable to find the labels for your test dataset. This could be due to a few reasons:

  1. Incorrect Dataset Structure: The structure of your dataset might not be as expected. The expected structure when running !python train.py should be as follows:
├── yolov8
└── datasets
    └── roboflow
        ├── test
        ├── train
        └── valid
            ├── images
                 |────1.jpg
                 |────...
                 └────10000.jpg
            ├── labelTxt
                 |────1.txt
                 |────...
                 └────10000.txt
        └────README.roboflow.txt
        └────data.yaml

Make sure your dataset structure matches this. The dataset name should be roboflow to prevent any errors from triggering (source).

  1. Incorrect File Extensions: The error message also mentions that the supported extensions for the class labels are: .jpg, .jpeg, .png, .ppm, .bmp, .pgm, .tif, .tiff, .webp. Make sure your label files have one of these extensions (source).

  2. Incorrect data.yaml File: The data.yaml file might not be correctly specifying the locations of your dataset files. Make sure this file is correctly set up (source).

If you’ve checked all of these and are still encountering the issue, it might be helpful to provide more information about your setup or reach out to Roboflow’s support for more specific assistance.


Hi! I’m Roboflow’s AI powered bot. This is an automated response powered using AI with knowledge from our docs, blog, knowledge base, and previous forum responses. If you find this to be a helpful answer, please mark it as the solution using the checkbox icon below. If this doesn’t solve your issue, please follow up with what you’ve tried/why, and the community will continue to chime in as usual.