Comments (12)
👋 Hello @casperking666, thank you for your interest in Ultralytics YOLOv8 🚀! We recommend a visit to the Docs for new users where you can find many Python and CLI usage examples and where many of the most common questions may already be answered.
If this is a 🐛 Bug Report, please provide a minimum reproducible example to help us debug it.
If this is a custom training ❓ Question, please provide as much information as possible, including dataset image examples and training logs, and verify you are following our Tips for Best Training Results.
Join the vibrant Ultralytics Discord 🎧 community for real-time conversations and collaborations. This platform offers a perfect space to inquire, showcase your work, and connect with fellow Ultralytics users.
Install
Pip install the ultralytics
package including all requirements in a Python>=3.8 environment with PyTorch>=1.8.
pip install ultralytics
Environments
YOLOv8 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):
- Notebooks with free GPU:
- Google Cloud Deep Learning VM. See GCP Quickstart Guide
- Amazon Deep Learning AMI. See AWS Quickstart Guide
- Docker Image. See Docker Quickstart Guide
Status
If this badge is green, all Ultralytics CI tests are currently passing. CI tests verify correct operation of all YOLOv8 Modes and Tasks on macOS, Windows, and Ubuntu every 24 hours and on every commit.
from ultralytics.
@casperking666 hi there! 👋
Thank you for reaching out and providing detailed information about your issue. Let's work through this together.
Firstly, it looks like your dataset structure and YAML file paths might be causing the issue. To ensure everything is set up correctly, please follow these steps:
-
Verify Dataset Structure: Ensure your dataset follows the required structure. For a classification task, it should look something like this:
datasets/ ├── train/ │ ├── class1/ │ │ ├── image1.jpg │ │ └── image2.jpg │ ├── class2/ │ │ ├── image1.jpg │ │ └── image2.jpg ├── val/ (optional) │ ├── class1/ │ │ ├── image1.jpg │ │ └── image2.jpg │ ├── class2/ │ │ ├── image1.jpg │ │ └── image2.jpg └── test/ ├── class1/ │ ├── image1.jpg │ └── image2.jpg ├── class2/ │ ├── image1.jpg │ └── image2.jpg
-
Check YAML File: Ensure your YAML file correctly points to the dataset directories. Here’s an example of how it should look:
path: /absolute/path/to/datasets # or relative path train: train val: val # optional test: test
-
Absolute vs. Relative Paths: When specifying paths in your YAML file, ensure they are correct. If using relative paths, they should be relative to the location of the YAML file. Absolute paths should be complete and correct.
-
Verify Python Script: Ensure your training script correctly references the YAML file. Here’s an example:
from ultralytics import YOLO # Load a model model = YOLO("yolov8n-cls.pt") # load a pretrained model # Train the model results = model.train(data="/absolute/path/to/your/yaml_file.yaml", epochs=100, imgsz=640)
-
Check Environment: Ensure you are using the latest versions of
torch
andultralytics
. You can update them using:pip install --upgrade torch ultralytics
If you have verified all the above and the issue persists, please provide a minimum reproducible example of your code and dataset structure. This will help us investigate further. You can refer to our minimum reproducible example guide for more details.
Feel free to reach out if you have any more questions or need further assistance. We're here to help! 😊
from ultralytics.
Will try that. Thanks!
from ultralytics.
You're welcome! 😊
Please give those steps a try and let us know if you encounter any further issues. If the problem persists, providing a minimum reproducible example would be very helpful for us to investigate further. You can refer to our minimum reproducible example guide for more details.
Additionally, ensure you are using the latest versions of torch
and ultralytics
by running:
pip install --upgrade torch ultralytics
Feel free to reach out with any more questions or updates. We're here to help! 🚀
from ultralytics.
I changed the file structure and updated the yaml file, the same error persists. Out of nowhere I got rid of the yaml file and just left the path in the python code and training starts to work. Not sure if it is a bug, but that contradicts everywhere I have looked even in your previous comment, the data argument is looking for a yaml file. But in my case, it needs a path. FYI I am using the newest ultralytics version 8.2.35.
from ultralytics.
Hi @casperking666,
Thank you for the update! It's interesting to hear that removing the YAML file and directly specifying the path in your Python code resolved the issue. This behavior is indeed unexpected, as the data
argument typically expects a YAML file.
To help us investigate further, could you please provide a minimum reproducible code example? This will allow us to reproduce the issue on our end and identify any potential bugs. You can refer to our minimum reproducible example guide for more details.
In the meantime, here's a quick example of how the data
argument should typically be used with a YAML file:
from ultralytics import YOLO
# Load a model
model = YOLO("yolov8n-cls.pt") # load a pretrained model
# Train the model
results = model.train(data="/absolute/path/to/your/data.yaml", epochs=100, imgsz=640)
If you continue to experience issues, please ensure that your YAML file is correctly formatted and that all paths within it are accurate.
Looking forward to your reproducible example so we can get to the bottom of this! 😊
from ultralytics.
Hi @glenn-jocher,
The code really is just boilerplate code, running the below code would cause the error, removing the data.yaml runs normal.
import comet_ml
from ultralytics import YOLO
comet_ml.init(project_name="cow-project-test-v100")
model = YOLO('yolov8s-cls.pt') # Load model
# model = YOLO('runs/classify/train23/weights/last.pt') # Load model
results = model.train(data = "/user/work/yf20630/cow-dataset-project/datasets/cow_cls/data.yaml", epochs=40, imgsz=640, device=0)
attrs==23.2.0
certifi==2024.6.2
charset-normalizer==3.3.2
comet-ml==3.43.1
configobj==5.0.8
contourpy==1.2.1
cycler==0.12.1
dulwich==0.22.1
everett==3.1.0
filelock==3.15.1
fonttools==4.53.0
fsspec==2024.6.0
idna==3.7
Jinja2==3.1.4
joblib==1.4.2
jsonschema==4.22.0
jsonschema-specifications==2023.12.1
kiwisolver==1.4.5
markdown-it-py==3.0.0
MarkupSafe==2.1.5
matplotlib==3.9.0
mdurl==0.1.2
mpmath==1.3.0
networkx==3.3
numpy==1.26.4
nvidia-cublas-cu12==12.1.3.1
nvidia-cuda-cupti-cu12==12.1.105
nvidia-cuda-nvrtc-cu12==12.1.105
nvidia-cuda-runtime-cu12==12.1.105
nvidia-cudnn-cu12==8.9.2.26
nvidia-cufft-cu12==11.0.2.54
nvidia-curand-cu12==10.3.2.106
nvidia-cusolver-cu12==11.4.5.107
nvidia-cusparse-cu12==12.1.0.106
nvidia-nccl-cu12==2.20.5
nvidia-nvjitlink-cu12==12.5.40
nvidia-nvtx-cu12==12.1.105
opencv-python==4.10.0.82
packaging==24.1
pandas==2.2.2
pillow==10.3.0
psutil==5.9.8
py-cpuinfo==9.0.0
Pygments==2.18.0
pyparsing==3.1.2
python-box==6.1.0
python-dateutil==2.9.0.post0
pytz==2024.1
PyYAML==6.0.1
referencing==0.35.1
requests==2.32.3
requests-toolbelt==1.0.0
rich==13.7.1
rpds-py==0.18.1
scikit-learn==1.5.0
scipy==1.13.1
seaborn==0.13.2
semantic-version==2.10.0
sentry-sdk==2.5.1
simplejson==3.19.2
six==1.16.0
sympy==1.12.1
threadpoolctl==3.5.0
torch==2.3.1
torchvision==0.18.1
tqdm==4.66.4
triton==2.3.1
typing_extensions==4.12.2
tzdata==2024.1
ultralytics==8.2.35
ultralytics-thop==2.0.0
urllib3==2.2.1
wrapt==1.16.0
wurlitzer==3.1.1
from ultralytics.
Hi @casperking666,
Thank you for providing the detailed information and code snippet. Let's work through this issue together.
Firstly, it's great to hear that removing the data.yaml
file allows the training to proceed. However, the data
argument is indeed intended to point to a YAML file that specifies the dataset paths and other configurations.
To help us investigate further, could you please provide a minimum reproducible example of your data.yaml
file? This will allow us to reproduce the issue on our end and identify any potential bugs. You can refer to our minimum reproducible example guide for more details.
In the meantime, please ensure that your data.yaml
file is correctly formatted and that all paths within it are accurate. Here’s an example of how the YAML file should look:
path: /user/work/yf20630/cow-dataset-project/datasets/cow_cls # or relative path
train: train
val: val # optional
test: test
Additionally, please verify that you are using the latest versions of torch
and ultralytics
:
pip install --upgrade torch ultralytics
If the issue persists, providing the contents of your data.yaml
file will be very helpful for us to investigate further.
Looking forward to your response so we can get to the bottom of this! 😊
from ultralytics.
path: /user/work/yf20630/cow-dataset-project/datasets/cow_cls/
train: train
val: val
test: test
names:
0: cow0
1: cow1
2: cow2
3: cow3
4: cow4
5: cow5
6: cow6
7: cow7
from ultralytics.
Hi @casperking666,
Thank you for sharing your data.yaml
file. It looks well-structured. Given that the training starts when you remove the YAML file, it seems there might be an issue with how the paths are being interpreted.
Here are a few steps to troubleshoot this:
-
Path Verification: Ensure that the paths specified in your
data.yaml
file are correct and accessible. Thepath
should be the root directory containing yourtrain
,val
, andtest
folders. -
Absolute vs. Relative Paths: Double-check that the paths are correctly specified. If using absolute paths, ensure they are complete and correct. If using relative paths, they should be relative to the location of the YAML file.
-
Environment Check: Ensure you are using the latest versions of
torch
andultralytics
. You can update them using:pip install --upgrade torch ultralytics
-
Minimum Reproducible Example: If the issue persists, please provide a minimum reproducible example. This will help us investigate further. You can refer to our minimum reproducible example guide for more details.
Here’s a quick example of how your training script should look:
from ultralytics import YOLO
# Load a model
model = YOLO('yolov8s-cls.pt') # Load model
# Train the model
results = model.train(data="/user/work/yf20630/cow-dataset-project/datasets/cow_cls/data.yaml", epochs=40, imgsz=640, device=0)
If you continue to experience issues, please let us know. We're here to help! 😊
from ultralytics.
The same problem.
from ultralytics.
Please ensure you are using the latest versions of torch
and ultralytics
by running pip install --upgrade torch ultralytics
. If the issue persists, verify that your dataset paths in the YAML file are correct and accessible. If you continue to experience problems, please provide more details about your setup and the specific error message you're encountering. This will help us diagnose the issue more effectively.
from ultralytics.
Related Issues (20)
- YOLOv8, v10, RT-DETR albumentation do not apply HOT 5
- How can i train better my project ? YOLOV8 HOT 14
- Codebase for running YoloV10 with ONNX HOT 8
- xywh returns wrong result while xyxy returns right result HOT 1
- Support distributed evaluation during training process HOT 1
- Is there an example of yolov8n-segn Android split HOT 2
- @glenn-jocher tracker is not working for custom trained models,
- multi input video to YOLOv8 and using bytetrack.yaml return same ID to different object and keep increasing HOT 2
- The engine model RTX3060 exported by RTX4070 cannot be inferred HOT 3
- YOLO(model_yaml).load(model.pt) not work. HOT 5
- Exporting after training on YoloV10 raise a ValueError with MultiGPU HOT 7
- Yolov8 classifier training: impossible to disable some augmentation options HOT 5
- Decoupled Head in YOLOv8 HOT 5
- How to increase the weight of segmentation loss in a segmentation task? HOT 11
- Why is the performance of detection task better than segmentation task? HOT 9
- Permission Denied Error in the middle/end of training. HOT 5
- Show the true label HOT 1
- The confidence difference of pt and onnx model on yolov9. HOT 3
- About Detection Speed YOLOV8 HOT 5
- why YOLO cannot load my dataset HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ultralytics.