bubbliiiing / faster-rcnn-pytorch

这是一个faster-rcnn的pytorch实现的库,可以利用voc数据集格式的数据进行训练。
MIT License
1.6k stars 357 forks source link

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

Open Zhangjq7585 opened 6 months ago

Zhangjq7585 commented 6 months ago

训练时运行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 commented 6 months ago

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