Data.yaml not find with all datasets when importing into Google Colab

Hi,

I’m trying out some datasets on Yolov4-tiny (Darknet) via the Google Colab from Roboflow.
So far I tried multiple datasets and get the same error.
I added the dataset like this:

from roboflow import Roboflow
rf = Roboflow(api_key="*********")
project = rf.workspace("ballz-ky4w9").project("ballz")
dataset = project.version(1).download("darknet")

And got this error:
Loading Roboflow workspace...
loading Roboflow project...
Downloading Dataset Version Zip in ballz-1 to darknet: 100% [454702 / 454702] bytes
Extracting Dataset Version Zip to ballz-1 in darknet:: 100%|██████████| 42/42 [00:00<00:00, 2333.19it/s]
---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
<ipython-input-4-6cc20de6d68a> in <module>
      2 rf = Roboflow(api_key="********")
      3 project = rf.workspace("ballz-ky4w9").project("ballz")
----> 4 dataset = project.version(1).download("darknet")

2 frames
/usr/local/lib/python3.8/dist-packages/roboflow/util/annotations.py in amend_data_yaml(path, callback)
      6 
      7 def amend_data_yaml(path: str, callback: Callable[[dict], dict]):
----> 8     with open(path) as source:
      9         content = yaml.safe_load(source)
     10     content = callback(content)

FileNotFoundError: [Errno 2] No such file or directory: 'ballz-1/data.yaml'

Any ideas on what to do?

Thanks!

Hello, I experienced the same issue today, despite the fact that I had run the code on Friday and it had worked perfectly.

It’s possible that the data.yaml file was not properly exported from Roboflow or was accidentally deleted from your Google Colab project.

In general, Roboflow should automatically generate the data.yaml file for you when you export a dataset in Darknet format. If you previously ran the same code with the same dataset and the data.yaml file was generated successfully, then it’s possible that the issue is related to the current state of your Google Colab project or the dataset itself.

You can try the following steps to see if they resolve the issue:

  1. Check if the data.yaml file is still present in your Roboflow workspace or project. If it is, try downloading it again and uploading it to your Google Colab project.
  2. If the data.yaml file is not present in your Roboflow workspace or project, you can create it manually following the format I mentioned in my previous answer.
  3. Double-check that the path to the data.yaml file in your code matches the actual location of the file in your Google Colab project.
  4. Check that the file permissions are set correctly for the data.yaml file, and that it is not set to read-only or write-protected.
  5. Restart the Google Colab kernel and try running the code again to see if it resolves the issue.

If none of the above steps work, you can provide more information about the steps you took to export the dataset from Roboflow and how you imported it into Google Colab, and I can help you diagnose the issue further.

I have the same problem. I want to try using your solution but I’m having trouble checking whether data.yaml exists or not. I can’t find a menu to check for data.yaml in my Roboflow workspace. Could you please explain in more detail how to check for the existence of the data.yaml?

Hi @Badeend and @Amir_Azizi do you experience those problems when you work with our notebooks GitHub - roboflow/notebooks: Set of Jupyter Notebooks linked to Roboflow blog posts and used in our YouTube videos. ? And if so could you tell me which one?

Did you solve this issue?

Hi, please use the workaround for now and install roboflow==0.2.29

So I’m trying to export the dataset for a retinanet model but its not generating a data.yaml file. How do I solve this?

I am getting a similar error. …/valid/images was not found at first so I downloaded the whole project file into my drive, unzipped it and edited the YAML file to include a path. This is my YAML:

path: ./content/drive/MyDrive/CRB_v1i_yolov8
train: ../train/images
val: ../valid/images
test: ../test/images

nc: 5
names: ['healthy_frond', 'healthy_tree', 'infested_frond', 'infested_tree', 'notch']

roboflow:
  workspace: crb
  project: coconut-rhinoceros-beetle-infested-palm-tree-detection
  version: 1
  license: MIT
  url: https://universe.roboflow.com/crb/coconut-rhinoceros-beetle-infested-palm-tree-detection/dataset/1

I was able to train, but when it came to validating I ran into an error (after training for an hour :frowning: )

This is the output I am getting:

Hi @robobobo what is roboflow pip package version that you used?

It looks like YOLO 8.0.20. I got I’m using the V8 colab from the youtube video for custom model training.

I was able to fix it by creating a data.yaml on my drive and using absolute paths for all of my images rather than relative :v:

thank you so much :heartpulse:

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