Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

运行train.py报错。FileNotFoundError: [Errno 2] No such file or directory: 'D:\\pycharm' #209

Open
Zhangjq7585 opened this issue May 28, 2024 · 2 comments

Comments

@Zhangjq7585
Copy link

训练时运行train.py报错。VOC数据集和标签正常导入,model_data/voc_weights_resnet.pth可以加载,前面的预训练参数没有问题。从Start train的时候就报错了。

Epoch 1/100:   0%|          | 0/4354 [00:04<?, ?it/s<class 'dict'>]
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "D:\Program files\PyCharm 2020.1\plugins\python\helpers\pydev\_pydev_bundle\pydev_umd.py", line 197, in runfile
    pydev_imports.execfile(filename, global_vars, local_vars)  # execute the script
  File "D:\Program files\PyCharm 2020.1\plugins\python\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "D:/pycharm project/faster-rcnn-pytorch-bubbliiing/train.py", line 451, in <module>
    fit_one_epoch(model, train_util, loss_history, eval_callback, optimizer, epoch, epoch_step, epoch_step_val, gen, gen_val, UnFreeze_Epoch, Cuda, fp16, scaler, save_period, save_dir)
  File "D:\pycharm project\faster-rcnn-pytorch-bubbliiing\utils\utils_fit.py", line 19, in fit_one_epoch
    for iteration, batch in enumerate(gen):
  File "D:\Anaconda\envs\pytorch1.8\lib\site-packages\torch\utils\data\dataloader.py", line 517, in __next__
    data = self._next_data()
  File "D:\Anaconda\envs\pytorch1.8\lib\site-packages\torch\utils\data\dataloader.py", line 1199, in _next_data
    return self._process_data(data)
  File "D:\Anaconda\envs\pytorch1.8\lib\site-packages\torch\utils\data\dataloader.py", line 1225, in _process_data
    data.reraise()
  File "D:\Anaconda\envs\pytorch1.8\lib\site-packages\torch\_utils.py", line 429, in reraise
    raise self.exc_type(msg)
FileNotFoundError: Caught FileNotFoundError in DataLoader worker process 0.
Original Traceback (most recent call last):
  File "D:\Anaconda\envs\pytorch1.8\lib\site-packages\torch\utils\data\_utils\worker.py", line 202, in _worker_loop
    data = fetcher.fetch(index)
  File "D:\Anaconda\envs\pytorch1.8\lib\site-packages\torch\utils\data\_utils\fetch.py", line 44, in fetch
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "D:\Anaconda\envs\pytorch1.8\lib\site-packages\torch\utils\data\_utils\fetch.py", line 44, in <listcomp>
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "D:\pycharm project\faster-rcnn-pytorch-bubbliiing\utils\dataloader.py", line 26, in __getitem__
    image, y    = self.get_random_data(self.annotation_lines[index], self.input_shape[0:2], random = self.train)
  File "D:\pycharm project\faster-rcnn-pytorch-bubbliiing\utils\dataloader.py", line 44, in get_random_data
    image   = Image.open(line[0])
  File "D:\Anaconda\envs\pytorch1.8\lib\site-packages\PIL\Image.py", line 2912, in open
    fp = builtins.open(filename, "rb")
FileNotFoundError: [Errno 2] No such file or directory: 'D:\\pycharm'
@Zhangjq7585
Copy link
Author

我的电脑里并没有'D:\pycharm'路径,我的代码文件在 D:\pycharm project\faster-rcnn-pytorch-bubbliiing

@wulibu
Copy link

wulibu commented Dec 17, 2024

我也是这个问题,好兄弟解决了吗

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants