YOLOv6 icon indicating copy to clipboard operation
YOLOv6 copied to clipboard

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

Open oariasmx opened this issue 2 years ago • 4 comments

Hello

I try to train with a custom dataset, but having following error

/home/aro2ju/painted-markings-search/yolov6/YOLOv6 Using 1 GPU for training... training args are: Namespace(batch_size=32, check_images=False, check_labels=False, conf_file='configs/yolov6s.py', data_path='data/mask.yaml', device='0', dist_url='env://', epochs=20, eval_final_only=False, eval_interval=20, gpu_count=0, heavy_eval_range=50, img_size=416, local_rank=-1, name='exp', output_dir='./runs/train', rank=-1, resume=False, save_dir='runs/train/exp55', workers=8, world_size=1)

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 "/home/aro2ju/painted-markings-search/yolov6/YOLOv6/yolov6/core/engine.py", line 47, in init self.train_loader, self.val_loader = self.get_data_loader(args, cfg, self.data_dict) File "/home/aro2ju/painted-markings-search/yolov6/YOLOv6/yolov6/core/engine.py", line 326, in get_data_loader train_loader = create_dataloader(train_path, args.img_size, args.batch_size // args.world_size, grid_size, File "/home/aro2ju/painted-markings-search/yolov6/YOLOv6/yolov6/data/data_load.py", line 41, in create_dataloader dataset = TrainValDataset( File "/home/aro2ju/painted-markings-search/yolov6/YOLOv6/yolov6/data/datasets.py", line 65, in init self.img_paths, self.labels = self.get_imgs_labels(self.img_dir) File "/home/aro2ju/painted-markings-search/yolov6/YOLOv6/yolov6/data/datasets.py", line 258, in get_imgs_labels assert osp.exists(label_dir), f"{label_dir} is an invalid directory path!" AssertionError: /home/aro2ju/painted-markings-search/yolov6/short/images/labels/ is an invalid directory path!

My yaml file is configured in the following way

yaml: is_coco: false names:

  • Sign nc: 1 train: /home/aro2ju/painted-markings-search/yolov6/short/images/train/ val: /home/aro2ju/painted-markings-search/yolov6/short/images/val/

My folder structure is created in this way ( I was not able to attach pictures for some reason)

yolov6 short images train im1.png im2.png val im3.png im4.png labels train im1.txt im2.txt val im3.txt im4.txt

  YOLOv6
	Assets
	Config
	data

Any idea how to fix it?? I already tried putting the dataset in different folders, verified that image and labels matched

Thanks a lot

oariasmx avatar Jul 29 '22 20:07 oariasmx

Hi, could you paste your data/mask.yaml here so we can try to locate the problem?

mtjhl avatar Aug 01 '22 02:08 mtjhl

Hello, I don't have this error anymore, ( I moved my image and labels folders to the same level as assets, data, etc), but now I have another error "trainvaldataset' object has no attribute 'img_paths' also I see another error wich mentions my images are corrupted, find screenshot

noattribute img_paths

Here is my folder structure

folderstructure_main folderstructure

Here my yaml file zipped mask (1).zip

oariasmx avatar Aug 01 '22 18:08 oariasmx

Also, I don't know what happens but now having also this error erorrexpected2

oariasmx avatar Aug 01 '22 18:08 oariasmx

you might check your ymal to follow

is_coco: False
names: ['Sign']
nc: 1
train: ./images/train
val: ./images/val

shensheng272 avatar Sep 07 '22 12:09 shensheng272