ultralytics / yolov3

YOLOv3 in PyTorch > ONNX > CoreML > TFLite
https://docs.ultralytics.com
GNU Affero General Public License v3.0
10.18k stars 3.44k forks source link

FileNotFoundError: [Errno 2] No such file or directory: 'data\\test.shapes' #1023

Closed wwl33 closed 4 years ago

wwl33 commented 4 years ago

🐛 Bug

when i try to train ,it tell me can not find a file named test.shape... how can i get it ?

D:\anaconda\envs\pytorch\python.exe D:/Py_Program/yolov3-master/train.py Namespace(accumulate=4, adam=False, batch_size=16, bucket='', cache_images=False, cfg='cfg/yolov3-spp.cfg', data='data/rbc.data', device='', epochs=300, evolve=False, img_size=[416], multi_scale=False, name='', nosave=False, notest=False, rect=False, resume=False, single_cls=False, weights='weights/yolov3-spp-ultralytics.pt') Using CPU

Run 'tensorboard --logdir=runs' to view tensorboard at http://localhost:6006/ Model Summary: 225 layers, 6.27835e+07 parameters, 6.27835e+07 gradients Caching labels (4649 found, 0 missing, 0 empty, 0 duplicate, for 4649 images): 100%|██████████| 4649/4649 [00:02<00:00, 1579.04it/s] Reading image shapes: 0%| | 0/464 [00:00<?, ?it/s]Traceback (most recent call last): File "D:\Py_Program\yolov3-master\utils\datasets.py", line 290, in init with open(sp, 'r') as f: # read existing shapefile FileNotFoundError: [Errno 2] No such file or directory: 'data\test.shapes'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "D:/Py_Program/yolov3-master/train.py", line 423, in train() # train normally File "D:/Py_Program/yolov3-master/train.py", line 193, in train single_cls=opt.single_cls), File "D:\Py_Program\yolov3-master\utils\datasets.py", line 294, in init s = [exif_size(Image.open(f)) for f in tqdm(self.img_files, desc='Reading image shapes')] File "D:\Py_Program\yolov3-master\utils\datasets.py", line 294, in s = [exif_size(Image.open(f)) for f in tqdm(self.imgfiles, desc='Reading image shapes')] File "D:\anaconda\envs\pytorch\lib\site-packages\PIL\Image.py", line 2809, in open fp = builtins.open(filename, "rb") FileNotFoundError: [Errno 2] No such file or directory: 'data\images\2S1(107).jpg' Reading image shapes: 0%| | 0/464 [00:00<?, ?it/s]

Process finished with exit code 1

github-actions[bot] commented 4 years ago

Hello @wwl33, thank you for your interest in our work! Please visit our Custom Training Tutorial to get started, and see our Google Colab Notebook, Docker Image, and GCP Quickstart Guide for example environments.

If this is a bug report, please provide screenshots and minimum viable code to reproduce your issue, otherwise we can not help you.

glenn-jocher commented 4 years ago

@wwl33 shapes files are created automatically, they contain the shapes of your training and test images. This error will occur if a shapesfile is corrupted.

Try deleting all *.shapes files you find, and then train again.

wwl33 commented 4 years ago

thanks very much and i have all problems done.it is because of the wrong file path in train.txt,my dataset is JPEG while the voc_label.py creates JPG...when i changed the voc_label.py , errors disappeared.

thanks very much for your apply and forgive my poor English.

-------- 原始邮件 -------- 发件人:Glenn Jocher notifications@github.com 时间:2020年4月9日 01:29 收件人:ultralytics/yolov3 yolov3@noreply.github.com 抄送:wwl33 15528126506@163.com,Mention mention@noreply.github.com 主题:Re: [ultralytics/yolov3] FileNotFoundError: [Errno 2] No such file or directory: 'data\test.shapes' (#1023)

@wwl33 shapes files are created automatically, they contain the shapes of your training and test images. This error will occur if a shapesfile is corrupted.

Try deleting all *.shapes files you find, and then train again.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

[ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/ultralytics/yolov3/issues/1023#issuecomment-611089435", "url": "https://github.com/ultralytics/yolov3/issues/1023#issuecomment-611089435", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]

glenn-jocher commented 4 years ago

@wwl33 ah great, good luck!

glenn-jocher commented 1 year ago

Hi @shmy123, thank you for reaching out to us!

If a dataset file path is not being identified by PyCharm due to a name issue, a solution could be to try renaming the file path to a name that PyCharm can recognize.

Alternatively, you could try using an absolute file path in the train.txt file instead of a relative file path, as an absolute file path should work regardless of the name of the project.

Please let us know if this solution works for you!