YOLOv6 icon indicating copy to clipboard operation
YOLOv6 copied to clipboard

assert osp.exists(label_dir), f"{label_dir} is an invalid directory path!"

Open thangarajdeivasikamani opened this issue 2 years ago • 3 comments

Hello All, I have followed the https://github.com/meituan/YOLOv6/blob/main/docs/Train_custom_data.md tutorial for my custom data Training. But could not able to Train I am getting below error.

Folder structure: image

Training command: !python tools/train.py --batch 256 --conf configs/yolov6s_finetune.py --data /content/drive/MyDrive/Ineuron_DeepLearning/YOLO_6/YOLOv6/data/data_1.yaml --device cpu

Yaml:

image

dataset.py failed line: /content/drive/MyDrive/Ineuron_DeepLearning/YOLO_6/YOLOv6/yolov6/data/datasets.py

image

Using CPU for training... training args are: Namespace(batch_size=256, check_images=False, check_labels=False, conf_file='configs/yolov6s_finetune.py', data_path='/content/drive/MyDrive/Ineuron_DeepLearning/YOLO_6/YOLOv6/data/data_1.yaml', device='cpu', dist_url='env://', epochs=400, eval_final_only=False, eval_interval=20, gpu_count=0, heavy_eval_range=50, img_size=640, local_rank=-1, name='exp', output_dir='./runs/train', rank=-1, resume=False, save_dir='runs/train/exp12', workers=8, world_size=1)

Image path: /content/drive/MyDrive/Ineuron_DeepLearning/YOLO_6/YOLOv6/data/images/train Label dir path: /content/drive/MyDrive/Ineuron_DeepLearning/YOLO_6/YOLOv6/data/labels/train Traceback (most recent call last): File "tools/train.py", line 114, in main(args) File "tools/train.py", line 103, in main trainer = Trainer(args, cfg, device) File "/content/drive/MyDrive/Ineuron_DeepLearning/YOLO_6/YOLOv6/yolov6/core/engine.py", line 44, in init self.train_loader, self.val_loader = self.get_data_loader(args, cfg, self.data_dict) File "/content/drive/MyDrive/Ineuron_DeepLearning/YOLO_6/YOLOv6/yolov6/core/engine.py", line 228, in get_data_loader check_labels=args.check_labels, data_dict=data_dict, task='train')[0] File "/content/drive/MyDrive/Ineuron_DeepLearning/YOLO_6/YOLOv6/yolov6/data/data_load.py", line 54, in create_dataloader task=task, File "/content/drive/MyDrive/Ineuron_DeepLearning/YOLO_6/YOLOv6/yolov6/data/datasets.py", line 63, in init self.img_paths, self.labels = self.get_imgs_labels(self.img_dir) File "/content/drive/MyDrive/Ineuron_DeepLearning/YOLO_6/YOLOv6/yolov6/data/datasets.py", line 259, in get_imgs_labels assert osp.exists(label_dir), f"{label_dir} is an invalid directory path!"

thangarajdeivasikamani avatar Jul 16 '22 12:07 thangarajdeivasikamani

Can you try this one? https://github.com/meituan/YOLOv6/issues/336

Arunavameister avatar Jul 16 '22 16:07 Arunavameister

Hi Arunavameister, I tried above suggestion. Still same issue exist. image

thangarajdeivasikamani avatar Jul 17 '22 01:07 thangarajdeivasikamani

Hi, do you have the directory /content/drive/MyDrive/Ineuron_DeepLearning/YOLO_6/YOLOv6/data/labels/train in your computer?

mtjhl avatar Jul 17 '22 10:07 mtjhl

Solved: After ensuring the below points

Ensure that data.yaml is correct format.

  • Example End folder should not /
  • There should be space b/w train: /
  • If it's full path we need to specify / not ./

thangarajdeivasikamani avatar Aug 20 '22 04:08 thangarajdeivasikamani