
where should I set the path for my dataset
@Rajasekhar06 Hello! Please see the custom data tutorial in the wiki:
https://github.com/ultralytics/yolov3/wiki
@glenn-jocher
can you please let me know where should I give the address to dataset/labels/img1.txt...so on files in the code only that part I'm stuck at!
Thank You sir!
@Rajasekhar06 data formatting directions are in the custom training tutorials in https://github.com/ultralytics/yolov3/wiki.
I am having the exact same problem with the COCO dataset, downloaded by data/get_coco_dataset.sh.
The wiki you reference only says to use the same folder structure as in data/get_coco_dataset.sh. Since data/get_coco_dataset.sh does not create a working folder structure, this is a bit of an unhelpful circular reference.
Could you provide a simple project folder structure example?
Reading labels: 100%|โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ| 117264/117264 [00:00<00:00, 357898.71it/s]
Traceback (most recent call last):
File "train.py", line 421, in
train() # train normally
File "train.py", line 194, in train
cache_images=False if opt.prebias else opt.cache_images)
File "/home/mking/Projects/pytorch/yolov3/utils/datasets.py", line 368, in __init__
assert nf > 0, 'No labels found. Recommend correcting image and label paths.'
AssertionError: No labels found. Recommend correcting image and label paths.
Folder structure
(pytorch) mking@cortex-2:~/Projects/pytorch/yolov3$ cd ..
(pytorch) mking@cortex-2:~/Projects/pytorch$ ls -l coco
total 194796
-rw-r--r-- 1 mking mking 230000 May 3 2017 5k.part
-rw-r--r-- 1 mking mking 410000 Oct 2 00:41 5k.txt
drwxr-xr-x 2 mking mking 4096 Oct 2 10:37 annotations
drwxr-xr-x 2 mking mking 4096 Oct 1 16:23 common
drwxr-xr-x 4 mking mking 4096 Oct 2 00:38 images
-rw-r--r-- 1 mking mking 165168220 Mar 29 2017 instances_train-val2014.zip
drwxr-xr-x 4 mking mking 4096 Apr 16 2015 labels
-rw-r--r-- 1 mking mking 17940023 Apr 30 2017 labels.tgz
-rw-r--r-- 1 mking mking 1533 Oct 1 16:23 license.txt
drwxr-xr-x 3 mking mking 4096 Oct 1 16:23 LuaAPI
drwxr-xr-x 3 mking mking 4096 Oct 1 16:23 MatlabAPI
drwxr-xr-x 3 mking mking 4096 Oct 1 16:23 PythonAPI
-rw-r--r-- 1 mking mking 1286 Oct 1 16:23 README.txt
drwxr-xr-x 2 mking mking 4096 Oct 1 16:23 results
-rw-r--r-- 1 mking mking 5722468 May 3 2017 trainvalno5k.part
-rw-r--r-- 1 mking mking 9943972 Oct 2 00:41 trainvalno5k.txt
Follow the tutorial https://github.com/ultralytics/yolov3/wiki/Train-Custom-Data
Do not add 'image' or 'label' in the previous folder like
/your_workspace/1000_images/images/example0001.jpg // it is wrong because of using two times of 'image'
/your_workspace/1000/images/example0001.jpg // it is right
In the dataset.py, it is defined for detecting the words of 'image' and 'label' in the folder. Also, this github is easy to use custom data, but you should follow the format by the master.
Reading labels: 100%|โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ| 117264/117264 [00:00<00:00, 357898.71it/s]
Traceback (most recent call last):
File "train.py", line 421, in
train() # train normally
File "train.py", line 194, in train
cache_images=False if opt.prebias else opt.cache_images)
File "/home/mking/Projects/pytorch/yolov3/utils/datasets.py", line 368, in **init**
assert nf > 0, 'No labels found. Recommend correcting image and label paths.'
AssertionError: No labels found. Recommend correcting image and label paths.Folder structure
(pytorch) mking@cortex-2:~/Projects/pytorch/yolov3$ cd .. (pytorch) mking@cortex-2:~/Projects/pytorch$ ls -l coco
total 194796
-rw-r--r-- 1 mking mking 230000 May 3 2017 5k.part
-rw-r--r-- 1 mking mking 410000 Oct 2 00:41 5k.txt
drwxr-xr-x 2 mking mking 4096 Oct 2 10:37 annotations
drwxr-xr-x 2 mking mking 4096 Oct 1 16:23 common
drwxr-xr-x 4 mking mking 4096 Oct 2 00:38 images
-rw-r--r-- 1 mking mking 165168220 Mar 29 2017 instances_train-val2014.zip
drwxr-xr-x 4 mking mking 4096 Apr 16 2015 labels
-rw-r--r-- 1 mking mking 17940023 Apr 30 2017 labels.tgz
-rw-r--r-- 1 mking mking 1533 Oct 1 16:23 license.txt
drwxr-xr-x 3 mking mking 4096 Oct 1 16:23 LuaAPI
drwxr-xr-x 3 mking mking 4096 Oct 1 16:23 MatlabAPI
drwxr-xr-x 3 mking mking 4096 Oct 1 16:23 PythonAPI
-rw-r--r-- 1 mking mking 1286 Oct 1 16:23 README.txt
drwxr-xr-x 2 mking mking 4096 Oct 1 16:23 results
-rw-r--r-- 1 mking mking 5722468 May 3 2017 trainvalno5k.part
-rw-r--r-- 1 mking mking 9943972 Oct 2 00:41 trainvalno5k.txt
Were you able to solve the issue, I face the same error.
@Arc2019 follow the wiki custom training tutorial. If you follow it exactly everything works fine:
rm -rf yolov3 # remove
git clone https://github.com/ultralytics/yolov3
bash yolov3/data/get_coco2017.sh
cd yolov3
python3 train.py
I've followed the tutorial exactly and I still get "No labels found". I've tried using my own dataset as well as the sample coco dataset from 'get_coco2017.sh' but both result in the error. Does anyone have any ideas?
EDIT: Found the issue. The tutorial says paths in the txt file should be '../coco/images/*.jpg' but it should just be './coco/images/*.jpg'.
@mschoerner the yolov3 and coco folders should be side by side. Is this a point of confusion in the tutorial? Perhaps we should make this more clear.
@glenn-jocher O ok I see now. I think that is a mistake on my part during the setup. Thank you for the clarification.
I have the problem like this
Optimizer groups: 62 .bias, 70 conv.weight, 59 other
Scanning labels /Users/shantong/Downloads/coco/labels/train2017.cache (1 found, 0 missing, 0 empty, 0 duplicate, for 1 images): 1it [00:00, 1248.68it/s]
Traceback (most recent call last):
File "/Users/shantong/Downloads/yolov5-master/train.py", line 456, in
train(hyp, opt, device, tb_writer)
File "/Users/shantong/Downloads/yolov5-master/train.py", line 177, in train
testloader = create_dataloader(test_path, imgsz_test, total_batch_size, gs, opt,
File "/Users/shantong/Downloads/yolov5-master/utils/datasets.py", line 53, in create_dataloader
dataset = LoadImagesAndLabels(path, imgsz, batch_size,
File "/Users/shantong/Downloads/yolov5-master/utils/datasets.py", line 349, in __init__
assert n > 0, 'No images found in %s. See %s' % (path, help_url)
AssertionError: No images found in /Users/shantong/Downloads/coco/labels/train2017/. See https://github.com/ultralytics/yolov5/wiki/Train-Custom-Data
@baba1587 if you are trying to train coco, coco128 or voc, you can simply run the train command and the datasets will autodownload. If you are trying to train a custom dataset you need to ensure your paths are correct, follow the tutorial.
@baba1587 if you are trying to train coco, coco128 or voc, you can simply run the train command and the datasets will autodownload. If you are trying to train a custom dataset you need to ensure your paths are correct, follow the tutorial.
thank you sir I have solve my problem ่ฐข่ฐข๏ผ๏ผ๏ผ
Most helpful comment
I've followed the tutorial exactly and I still get "No labels found". I've tried using my own dataset as well as the sample coco dataset from 'get_coco2017.sh' but both result in the error. Does anyone have any ideas?
EDIT: Found the issue. The tutorial says paths in the txt file should be '../coco/images/*.jpg' but it should just be './coco/images/*.jpg'.