-
-
Notifications
You must be signed in to change notification settings - Fork 5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dataset yaml not found error #1201
Comments
👋 Hello! Thanks for asking about YOLOv8 🚀 dataset formatting. To train correctly your data must be in YOLO format. Please see our Train Custom Data tutorial for full documentation on dataset setup and all steps required to start training your first model. This applies to both YOLOv5 and YOLOv8. A few excerpts from the tutorial: 1.1 Create dataset.yamlCOCO128 is an example small tutorial dataset composed of the first 128 images in COCO train2017. These same 128 images are used for both training and validation to verify our training pipeline is capable of overfitting. data/coco128.yaml, shown below, is the dataset config file that defines 1) the dataset root directory # Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
path: ../datasets/coco128 # dataset root dir
train: images/train2017 # train images (relative to 'path') 128 images
val: images/train2017 # val images (relative to 'path') 128 images
test: # test images (optional)
# Classes (80 COCO classes)
names:
0: person
1: bicycle
2: car
...
77: teddy bear
78: hair drier
79: toothbrush
1.2 Create LabelsAfter using a tool like Roboflow Annotate to label your images, export your labels to YOLO format, with one
The label file corresponding to the above image contains 2 persons (class 1.3 Organize DirectoriesOrganize your train and val images and labels according to the example below. YOLO assumes ../datasets/coco128/images/im0.jpg # image
../datasets/coco128/labels/im0.txt # label Good luck 🍀 and let us know if you have any other questions! |
@glenn-jocher that tutorial link, maybe be pointing at something else than you intended. do you have a tutorial link to train yolov8*.yaml with one or two classes? such that I can run this code and train my custom model?
does CUSTOM.yaml look like this:
and does yolov8mCUSTOM.yaml look like this for 2 classes or are there any other changes needed?
EDIT: the answer for above seems to be yes |
@glenn-jocher : I have followed the steps you mentioned but still the problem persists. This is how my dataset.yaml looks like: I have now moved my project directory to a completely new location but still, it looks for the old path where I created the project initially. This old path does not exist anymore hence it throws an error. I even updated the path in the yaml file as you can see in the screenshot but it somehow is still looking for the old path. Update!: It works though when I recreate the old path and move the project files to this old path location. Seems like this path is cached somewhere. |
In fact, you can change the path in your *.yaml, the code runs successfully after I change the path. |
So the solution to this is:
|
@TimbusCalin @ShiKeQuan I think you guys might be referring to your dataset path in your yolo settings. Just type |
Update! Replacing the relative path with the absolute path to your dataset directory in yaml file solves the issue on Apple M2 Mac. |
👋 Hello there! We wanted to give you a friendly reminder that this issue has not had any recent activity and may be closed soon, but don't worry - you can always reopen it if needed. If you still have any questions or concerns, please feel free to let us know how we can help. For additional resources and information, please see the links below:
Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed! Thank you for your contributions to YOLO 🚀 and Vision AI ⭐ |
I have encountered this issue again. This time I am running a classification model. The dataset directory structure under datasets/: Each of these folders (train/val/test) contains class folders (A/B/C/D) which contain images. I do not understand why does it always look for incorrect path i.e. /Users/aamit/datasets/dataset_config.yaml/train. Why is it appending yaml file in the path? This is the error message that I get:
|
I got the same error, when it was always addressing the different directory. |
@treoa it seems that your dataset path for your classification model is not being correctly recognized by the YOLOv5 engine. The error message you provided shows that it is trying to download your dataset and saves it in the wrong directory. One possible reason for this issue is that the path to your dataset directory is incorrectly defined in your yaml file. You may need to double-check that the path is specified correctly under Another solution is to update your dataset download directory in Once you have updated the dataset path or the download directory, you should be able to run your classification model without any issues. |
So how to train more than one yolov8 project conveniently? The yolo engine always use the same setting in |
I also met this error. |
It seems that the error experienced by @Votun is due to a file naming mismatch. This error can be resolved by ensuring that the filename specified within the code matched the actual filename of the file. To elaborate, when working with external files, it is important to ensure that the filenames are accurate so that the code can reference the required file. By making a naming mistake in the filename, such as using It is important to double-check the filename and file extension during the development process to ensure that the code can access the appropriate files needed for the program to run without errors. In general, developers should also provide clear and meaningful error messages to assist other developers and end-users in understanding and fixing issues they may encounter during the runtime. |
@HasanBeratSoke hello, We appreciate your feedback and we are glad to hear that adding the path For others who may encounter a similar issue, it is possible that the To make sure that the path to the dataset is correctly specified, you may need to modify the We hope that this helps and please let us know if you encounter any other issues. |
@glenn-jocher unable to find this ghost file.. |
@jaideep11061982 hello, The error message "no module named 'utils'" indicates that Python is unable to locate the module 'utils'. The 'utils' module is likely specific to the YOLOv8 project and should be located within the project's directory. Now, there could be two reasons why you're facing this issue:
To verify this, you can print your Python PATH in your Python script by importing the 'sys' module and adding If these steps don't resolve your issue, it could be helpful to provide more information so that one can further diagnose the problem. It would be helpful to know more about your development environment, e.g. operating system, Python version, and the project's directory structure. Hope this helps! Let us know if you need any further assistance. |
@ftmhabibii in order to import the 'utils.py' file, Python must be able to locate it. The Python interpreter searches for modules in the directories specified in To add the 'utils.py' module to the Python directory path, you'll need to ensure that the directory containing 'utils.py' is included in Here is the general syntax for what that would look like: import sys
sys.path.append('/path/to/your/utils') Replace Remember to include this line of code at the start of your script to ensure Python can find 'utils.py' whenever it needs to import it. If your 'utils.py' file is in the same directory as your main script, you shouldn't have to modify Lastly, ensure that your 'utils.py' is error-free and is named correctly (including the I hope this helps! Let me know if you have any further questions. |
👋 Hello there! We wanted to give you a friendly reminder that this issue has not had any recent activity and may be closed soon, but don't worry - you can always reopen it if needed. If you still have any questions or concerns, please feel free to let us know how we can help. For additional resources and information, please see the links below:
Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed! Thank you for your contributions to YOLO 🚀 and Vision AI ⭐ |
Hello, glenn-jocher please help me |
@sjussjs hello, It appears there may be an issue with the path configuration in your dataset. Please ensure that your |
thanks you sir @glenn-jocher |
Hello @sjussjs, If your model is trained but not detecting objects in images it was trained on, consider the following:
For further assistance, please share details about your training process, including the number of epochs, batch size, and any output logs that indicate the model's performance during training. |
I changed to train with 338 images of tomatoes, including two types: ripe tomatoes and unripe tomatoes that download from Kaggle. https://www.kaggle.com/datasets/techkhid/riped-and-unriped-tomato-dataset/discussion |
@sjussjs hello, Training with a specific dataset like the one you've downloaded for ripe and unripe tomatoes should work fine. Whether you use Colab or another environment depends on your preference and resource availability. Colab can provide free access to GPUs, which can speed up training. Just ensure your dataset is correctly formatted for YOLOv8, with a proper |
@glenn-jocher Hi,I am having the same problem with the tune() function: |
@Johnny-zbb hello, It seems there might be an issue with how the |
@glenn-jocher Hi,I was using the jupyter compiler before, and this time I tried to run the python script, and it still says that my dataset does not exist:
But actually my file exists, here is my code and environment:
Command line run directory:/coding/yolo-seg/tune |
Hello @Johnny-zbb, The error indicates that the Please ensure that the path to If the problem persists, verify that the environment where you're running the script has the necessary permissions to access the file and that there are no typos in the file path. |
@glenn-jocher Hello, I am running my code in the |
Hello @Johnny-zbb, Given that you've verified the existence of |
@glenn-jocher Hey, I'm facing the same issue, using the absolute path doesnt solve it. RuntimeError: Dataset '/work/bbu/xxx/PeopleCounting/gender_data/data.yaml' error ❌ [Errno 20] Not a directory: '/work/bbu/xxx/PeopleCounting/gender_data/data.yaml/train' . my data.yaml is in /work/bbu/xxx/PeopleCounting/gender_data/ while the data is in /work/bbu/xxx/PeopleCounting/PeopleCounting/gender_data/dataset data.yaml has the following info:
|
@kyatha hello, The error suggests that the |
works with a custom model but not the classification model. Is the data supposed to be organized differently? In a different post, you mentioned something about having separate folders for the images i.e male and female within the train and val folders. |
@kyatha it seems like the issue you're encountering is related to the dataset configuration YAML file not being found at the expected location. This could be due to a few reasons:
Here are a few steps you can take to resolve the issue:
If you continue to face issues, please provide the exact command or code snippet you're using to initialize the |
Hey @glenn-jocher I am running into the same issue with model.tune() and haven't been able to solve it based on the suggestions provided. Minimum example would be: from ultralytics import YOLO
model = YOLO('path/to/yolov8s.yaml')
# This works - data.yaml is found
model.train(data='path/to/data.yaml', cfg='path/to/cfg.yaml', **other_params)
# this does not work - data.yaml is not found
model.tune(data='same/path/to/data.yaml', **other params) What could be the issue? |
In my cfg file, the data param was empty (as I provided it in The solution in my case is to provide the data.yaml path in the config file and the I think there is some bug as we shouldn't need to provide this twice, (considering not providing it in the cfg file works for |
Hey @RoadToML 👋, Thanks for reaching out! The For # Inside your cfg.yaml
data: path/to/data.yaml
# Other configurations... And then in your Python script: model.tune(data='path/to/data.yaml', cfg='path/to/cfg.yaml', **other_params) We'll look into why this discrepancy exists between |
TypeError: 'str' object does not support item assignment The above exception was the direct cause of the following exception: RuntimeError Traceback (most recent call last) RuntimeError: Dataset '/content/drive/MyDrive/data/data.yaml' error ❌ 'str' object does not support item assignment can any one help me please? |
@bozekry hey there! 🌟 It seems like the issue you're encountering is trying to assign a value to a string, which is not allowed in Python. Given the context, it looks like there’s an attempt to modify the Here’s a quick suggestion: ensure that any modifications to paths or configurations are done using correct data structures or through methods designed for such updates. If you’re trying to update paths or configurations, use a dictionary or similar data structure rather than a string. Without knowing the exact intention behind assigning values to If the issue persists or if there's more to the context, feel free to share more details! Happy coding! 😊 |
@glenn-jocher I tried every solution here, but it didn't work. i connected my google drive to google colab and accessing the data from there, I'm not sure what's the issue, trying this since a week now but I keep getting the same error. it says "You can update this in '/root/.config/Ultralytics/settings.yaml'" I did updated the file with my actual location (I tried without quotes in the datasets_dir: but that didn't work as well) could someone please help me |
Hey there! 😊 It looks like you've encountered quite a stubborn issue with setting up your dataset from Google Drive in Colab. Let's try to address this. First, ensure that your Google Drive is correctly mounted in Colab: from google.colab import drive
drive.mount('/content/drive') After mounting, verify that your train: /content/drive/MyDrive/your_dataset_path/train/images
val: /content/drive/MyDrive/your_dataset_path/val/images If you've already done that and updated the from ultralytics import YOLO
model = YOLO(data='/content/drive/MyDrive/your_dataset_path/data.yaml') Ensure there are no typos in paths and that you're using the full, correct path to your dataset. Hope this helps! If you're still stuck, could you share the exact error message you're seeing? That could give us more clues. 🕵️♂️ |
@glenn-jocher seems there is no argument data for YOLO (using yolov8) this line used to work before, so I tried to use both at the time but it still the same issue. |
Hey there! 😊 It seems there's been a slight confusion around using the Here's how you can do it: from ultralytics import YOLO
# Initialize the model
model = YOLO('path/to/model.yaml')
# Now, specify your dataset YAML when calling train
model.train(data='/content/drive/MyDrive/your_dataset_path/data.yaml') This should help you get past the issue you're facing. The direct |
Hi @glenn-jocher thanks for your reply, unfortunately, the above solution didn't work, it's the same thing that I tried at the start. I want to use the pre-trained model so I was using this line
I still get the same error here is my yaml file https://drive.google.com/file/d/1YTXGlEhrvQaRnA33qbE8HoOOcek1tkHv/view?usp=sharing |
@srikarnikhil hi there! Thanks for reaching out again 🌼. I'm sorry to hear that the solution didn't resolve the issue. Since you're using a pre-trained model with For using a pre-trained model and specifying your dataset, ensure you're invoking the from ultralytics import YOLO
# Load the pre-trained model
model = YOLO('yolov8n.pt')
# Specify your dataset YAML when calling train
model.train(data='/content/drive/MyDrive/your_dataset_path/data.yaml') Make sure Also, could you check that your Google Drive is properly mounted in your notebook? Sometimes, the path issues may stem from the Drive not being correctly accessible. If the issue persists, please double-check the YAML file's format and paths to ensure they're all correct and accessible. The YAML file you've shared seems fine, but unfortunately, I can't access it directly due to Google Drive's permissions - ensuring it follows the correct formatting is key. Hope this helps, and looking forward to getting you past this hiccup! 🛠 |
Search before asking
YOLOv8 Component
Training
Bug
After I created the dataset and splits i.e. train, test and val and stored them in datatset/ directory. I tried to train the model using python API but fell into this Dataset config yaml file not found error. The path it complains about is an old path that does not exist as I renamed the project directory. So in the screenshot test_notebook/ directory does not exist but it assumes the config to be existing on this old path.
Then I tried with CLI and I got the same problem. As I was running all this in Jupyter Lab so I thought perhaps it could be due to jupyter notebook might cached somewhere the old path so I tried on terminal instead but the problem persisted. I was wondering if this could be something to do with yolov8? Has anyone faced such issues?
Environment
Minimal Reproducible Example
No response
Additional
No response
Are you willing to submit a PR?
The text was updated successfully, but these errors were encountered: