Comments (3)
@TonightGo hi there,
Thank you for reaching out and providing a detailed description of the issue you're encountering. Let's work through this together.
First, to ensure we can effectively investigate and address the problem, please verify the following:
-
Minimum Reproducible Example: Could you provide a minimal code snippet that reproduces the issue? This helps us isolate the problem more efficiently. You can refer to our Minimum Reproducible Example Guide for more details on how to create one.
-
Package Versions: Ensure you are using the latest versions of
torch
andultralytics
. You can upgrade them using the following commands:pip install --upgrade torch ultralytics
Regarding the error you're encountering, it seems related to multiprocessing and data loading. Here are a few steps you can take to troubleshoot and potentially resolve the issue:
Multiprocessing Setup
The error suggests an issue with the multiprocessing setup. Ensure that the multiprocessing code is protected by if __name__ == "__main__":
to avoid issues with spawning new processes:
if __name__ == "__main__":
import sys
sys.path.insert(0, 'ultralytics')
import torch
import cv2
from ultralytics import YOLO
torch.set_num_threads(1)
cv2.setNumThreads(1)
NUM_THREADS = 2
import torch.multiprocessing as mp
mp.set_start_method('spawn', force=True)
model = YOLO("/content/drive/MyDrive/ultralytics/ultralytics/cfg/models/v8/test.yaml", verbose=True)
model.train(data="/content/drive/MyDrive/ultralytics/ultralytics/cfg/datasets/test.yaml", epochs=300, project='test', name='debug', device='0', imgsz=640, batch=2, exist_ok=True, workers=1, resume=False, optimizer='SGD')
DataLoader Workers
The error message suggests trying to rerun with num_workers=0
for better error tracing. This can help identify if the issue is related to multiprocessing:
model.train(data="/content/drive/MyDrive/ultralytics/ultralytics/cfg/datasets/test.yaml", epochs=300, project='test', name='debug', device='0', imgsz=640, batch=2, exist_ok=True, workers=0, resume=False, optimizer='SGD')
Dataset and Cache
The assertion error in get_labels
indicates a potential issue with the dataset cache. Try clearing the cache or ensuring that the dataset paths and annotations are correct:
# Clear cache
import os
cache_path = "/content/drive/MyDrive/ultralytics/ultralytics/cfg/datasets/test.cache"
if os.path.exists(cache_path):
os.remove(cache_path)
Debugging
If the issue persists, consider running the training with a smaller dataset or fewer epochs to isolate the problem. Additionally, you can enable more verbose logging to get detailed insights into the training process.
Please try these steps and let us know if the issue persists. We're here to help!
from ultralytics.
I used the above code and it works. Thank you for your timely and effective reply.
from ultralytics.
Hi @TonightGo,
I'm glad to hear that the provided solution worked for you! 🎉 If you encounter any further issues or have additional questions, feel free to reach out. We're here to help!
Happy training! 🚀
from ultralytics.
Related Issues (20)
- Unable to explain validation results, different from prediction HOT 2
- Sort bounding boxes HOT 10
- Documentation mismatch in val.py#L200-L214 HOT 4
- export error HOT 4
- Extracting Keypoint IDs (an, if possible, Keypoint Labels) in YOLOv8 for Pose Estimation HOT 9
- New YOLOv# Format for Pose Estimation with Keypoints Labels HOT 2
- Error after running make and ./Yolov8CPPInference in C++ HOT 3
- rtdetr fp16 inference HOT 4
- Simple question: How can I check the visual result of tracking video in Colab? HOT 2
- got an unexpected keyword argument 'allow_empty HOT 3
- How to publish an application to the client in python and run it using the GPU HOT 13
- When predicting, does yolov8's behavior change when there are different sized images in the input image list? HOT 2
- Yolov9 onnx export HOT 3
- Trainning not improving: Decreasing mAP and Early Stopping at Epoch 100 HOT 1
- Training on a new dataset based on best.pt HOT 7
- The effect of the random function HOT 3
- During validation, the result is different when setting the "save_txt" is True or False HOT 5
- SPAM HOT 2
- Erro when export yolo8n.pt to yolov8n.engine HOT 14
- When I use device='cpu', I always get' Process finished with exit code-1073741819 (0xC0000005) ' HOT 10
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.