roboflow / notebooks

Examples and tutorials on using SOTA computer vision models and techniques. Learn everything from old-school ResNet, through YOLO and object-detection transformers like DETR, to the latest models like Grounding DINO and SAM.
https://roboflow.com/models
5.09k stars 788 forks source link

Dataset missing path error #69

Closed ElinLiu0 closed 1 year ago

ElinLiu0 commented 1 year ago

Search before asking

Notebook name

train-yolov8-object-detection-on-custom-dataset.ipynb

Bug

FileNotFoundError: Dataset '/home/elin/model_training/yolov8/ClassAction-1/data.yaml' not found ⚠️, missing paths ['/home/elin/model_training/yolov8/datasets/ClassAction-1/valid/images']

Environment

Minimal Reproducible Example

Fully reproduce Jupyter code here:

from roboflow import Roboflow
rf = Roboflow(api_key=input("Please Provide API Key"))
project = rf.workspace("elinswork").project("classaction")
dataset = project.version(1).download("yolov8")
import os 
from IPython.display import clear_output
if os.path.exists("ClassAction-1"):  
    clear_output()
    print("Dataset already downloaded")
else:
    clear_output()
    print("Failed to download dataset due to invalid API key or network error")
Dataset already downloaded
from ultralytics import checks
checks()
Ultralytics YOLOv8.0.20 🚀 Python-3.9.13 torch-1.13.1+cu117 CUDA:0 (NVIDIA GeForce RTX 2060, 6144MiB)
Setup complete ✅ (12 CPUs, 15.5 GB RAM, 137.0/1006.9 GB disk)
from ultralytics import YOLO
model = YOLO("yolov8s.pt")
model.train(
    data=dataset.location+"/data.yaml",
    imgsz=640,
    batch=4,
    epochs=100,
)
Ultralytics YOLOv8.0.20 🚀 Python-3.9.13 torch-1.13.1+cu117 CUDA:0 (NVIDIA GeForce RTX 2060, 6144MiB)
yolo/engine/trainer: task=detect, mode=train, model=yolov8s.yaml, data=/home/elin/model_training/yolov8/ClassAction-1/data.yaml, epochs=100, patience=50, batch=4, imgsz=640, save=True, cache=False, device=, workers=8, project=None, name=None, exist_ok=False, pretrained=False, optimizer=SGD, verbose=False, seed=0, deterministic=True, single_cls=False, image_weights=False, rect=False, cos_lr=False, close_mosaic=10, resume=False, overlap_mask=True, mask_ratio=4, dropout=False, val=True, save_json=False, save_hybrid=False, conf=0.001, iou=0.7, max_det=300, half=False, dnn=False, plots=False, source=ultralytics/assets/, show=False, save_txt=False, save_conf=False, save_crop=False, hide_labels=False, hide_conf=False, vid_stride=1, line_thickness=3, visualize=False, augment=False, agnostic_nms=False, classes=None, retina_masks=False, boxes=True, format=torchscript, keras=False, optimize=False, int8=False, dynamic=False, simplify=False, opset=17, workspace=4, nms=False, lr0=0.01, lrf=0.01, momentum=0.937, weight_decay=0.001, warmup_epochs=3.0, warmup_momentum=0.8, warmup_bias_lr=0.1, box=7.5, cls=0.5, dfl=1.5, fl_gamma=0.0, label_smoothing=0.0, nbs=64, hsv_h=0.015, hsv_s=0.7, hsv_v=0.4, degrees=0.0, translate=0.1, scale=0.5, shear=0.0, perspective=0.0, flipud=0.0, fliplr=0.5, mosaic=1.0, mixup=0.0, copy_paste=0.0, cfg=None, v5loader=False, save_dir=runs/detect/train3

---------------------------------------------------------------------------

FileNotFoundError                         Traceback (most recent call last)

/tmp/ipykernel_1976/1704976871.py in <module>
      1 from ultralytics import YOLO
      2 model = YOLO("yolov8s.pt")
----> 3 model.train(
      4     data=dataset.location+"/data.yaml",
      5     imgsz=640,

~/anaconda3/lib/python3.9/site-packages/ultralytics/yolo/engine/model.py in train(self, **kwargs)
    201             overrides["resume"] = self.ckpt_path
    202 
--> 203         self.trainer = self.TrainerClass(overrides=overrides)
    204         if not overrides.get("resume"):  # manually set model only if not resuming
    205             self.trainer.model = self.trainer.get_model(weights=self.model if self.ckpt else None, cfg=self.model.yaml)

~/anaconda3/lib/python3.9/site-packages/ultralytics/yolo/engine/trainer.py in __init__(self, cfg, overrides)
    120         self.data = self.args.data
    121         if self.data.endswith(".yaml"):
--> 122             self.data = check_det_dataset(self.data)
    123         elif self.args.task == 'classify':
    124             self.data = check_cls_dataset(self.data)

~/anaconda3/lib/python3.9/site-packages/ultralytics/yolo/data/utils.py in check_det_dataset(dataset, autodownload)
    235                 LOGGER.warning(msg)
    236             else:
--> 237                 raise FileNotFoundError(msg)
    238             t = time.time()
    239             if s.startswith('http') and s.endswith('.zip'):  # URL

FileNotFoundError: 
Dataset '/home/elin/model_training/yolov8/ClassAction-1/data.yaml' not found ⚠️, missing paths ['/home/elin/model_training/yolov8/datasets/ClassAction-1/valid/images']
!tree -L 2
.
├── ClassAction-1
│   ├── README.dataset.txt
│   ├── README.roboflow.txt
│   ├── data.yaml
│   ├── test
│   ├── train
│   └── valid
├── runs
│   └── detect
├── train.ipynb
└── yolov8s.pt

6 directories, 5 files

Additional

No response

Are you willing to submit a PR?

github-actions[bot] commented 1 year ago

👋 Hello @RosterMouch, thank you for leaving an issue on Roboflow Notebooks.

🐞 Bug reports

If you are filing a bug report, please be as detailed as possible. This will help us more easily diagnose and resolve the problem you are facing. To learn more about contributing, check out our Contributing Guidelines.

If you require support with custom code that is not part of Roboflow Notebooks, please reach out on the Roboflow Forum or on the GitHub Discussions page associated with this repository.

💬 Get in touch

Do you have more questions about Roboflow that we haven't responded to yet? Feel free to ask them on the Roboflow Discuss forum. Our developer advocates and community team actively respond to questions there.

To ask questions about Notebooks, head over to the GitHub Discussions section of this repository.

ElinLiu0 commented 1 year ago

Close this issue due to upgrade ultralytics==8.0.40 and fix workspace dir like this: image And config yaml file like this: image

SkalskiP commented 1 year ago

Nice to hear that your problem is solved. We also introduced changes on our side with roboflow=0.2.31. So I hope you wouldn't experience any more problems.

One more thing @RosterMouch, could you point me to the changes you feel solved the issue on ultralytics side?

ElinLiu0 commented 1 year ago

Nice to hear that your problem is solved. We also introduced changes on our side with roboflow=0.2.31. So I hope you wouldn't experience any more problems.

One more thing @RosterMouch, could you point me to the changes you feel solved the issue on ultralytics side?

Those guys are really nice too,they told me they also have a recently update which may be can solve my problem. I update it and search documentation then i relized that there must be a folder called datasets which contained the real datasets besides training script. But then,all things done pretty well and my thesis done. Nice job buddy! Greetings Elin Liu