Yolo V5 问题“异常:未找到数据集”在本地机器上

问题描述

我正在尝试使用 Yolo V5 训练模型。

我遇到了找不到数据库的问题。

我有一个包含所有图像和标签文件的训练、测试和有效文件

我已经在 googlecolap 上测试了这些文件并且它起作用了。但是,在我的本地机器上,它显示Exception: Dataset not found.

的问题
  (Yolo_5) D:\\YOLO_V_5\Yolo_V5\yolov5>python train.py --img 416 --batch 8 --epochs 100 --data /data.yaml --cfg models/yolov5s.yaml --weights '' --name yolov5s_results  --cache
Using torch 1.7.0 CUDA:0 (GeForce GTX 1080,8192MB)

Namespace(adam=False,batch_size=8,bucket='',cache_images=True,cfg='models/yolov5s.yaml',data='.\\data.yaml',device='',epochs=100,evolve=False,exist_ok=False,global_rank=-1,hyp='data/hyp.scratch.yaml',image_weights=False,img_size=[416,416],local_rank=-1,log_imgs=16,multi_scale=False,name='yolov5s_results',noautoanchor=False,nosave=False,notest=False,project='runs/train',rect=False,resume=False,save_dir='runs\\train\\yolov5s_results55',single_cls=False,sync_bn=False,total_batch_size=8,weights="''",workers=16,world_size=1)
Start Tensorboard with "tensorboard --logdir runs/train",view at http://localhost:6006/
Hyperparameters {'lr0': 0.01,'lrf': 0.2,'momentum': 0.937,'weight_decay': 0.0005,'warmup_epochs': 3.0,'warmup_momentum': 0.8,'warmup_bias_lr': 0.1,'Box': 0.05,'cls': 0.5,'cls_pw': 1.0,'obj': 1.0,'obj_pw': 1.0,'IoU_t': 0.2,'anchor_t': 4.0,'anchors': 3,'fl_gamma': 0.0,'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}

WARNING: Dataset not found,nonexistent paths: ['D:\\me1eye\\Yolo_V5\\valid\\images']
Traceback (most recent call last):
  File "train.py",line 501,in <module>
    train(hyp,opt,device,tb_writer,wandb)
  File "train.py",line 78,in train
    check_dataset(data_dict)  # check
  File "D:\me1eye\YOLO_V_5\Yolo_V5\yolov5\utils\general.py",line 92,in check_dataset
    raise Exception('Dataset not found.')
Exception: Dataset not found.
Internal process exited

(Olive_Yolo_5) D:\me1eye\YOLO_V_5\Yolo_V5\yolov5>

解决方法

好吧!我也遇到过这个问题,现在解决了。

您所要做的就是保留训练、测试、验证(这三个文件夹包含图像和标签)和yolov5文件夹(克隆来自 GitHub)在同一目录中。另外,'data.yaml' 文件必须保存在 yolov5 文件夹中。

训练模型的命令如下:

!python train.py --img 416 --batch 16 --epochs 10 --data ./data.yaml --cfg ./models/yolov5m.yaml --weights '' --name yolov5m_results