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: 'F:\\my' #183

Open yuanyuan814 opened 1 year ago

yuanyuan814 commented 1 year ago

Traceback (most recent call last): File "F:/my python/faster r-cnn/faster-rcnn-pytorch-master/train.py", line 439, in 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 "F:\my python\faster r-cnn\faster-rcnn-pytorch-master\utils\utils_fit.py", line 19, in fit_one_epoch for iteration, batch in enumerate(gen): File "E:\Anaconda3\envs\pytorch\lib\site-packages\torch\utils\data\dataloader.py", line 628, in next data = self._next_data() File "E:\Anaconda3\envs\pytorch\lib\site-packages\torch\utils\data\dataloader.py", line 1333, in _next_data return self._process_data(data) File "E:\Anaconda3\envs\pytorch\lib\site-packages\torch\utils\data\dataloader.py", line 1359, in _process_data data.reraise() File "E:\Anaconda3\envs\pytorch\lib\site-packages\torch_utils.py", line 543, in reraise raise exception FileNotFoundError: Caught FileNotFoundError in DataLoader worker process 0. Original Traceback (most recent call last): File "E:\Anaconda3\envs\pytorch\lib\site-packages\torch\utils\data_utils\worker.py", line 302, in _worker_loop data = fetcher.fetch(index) File "E:\Anaconda3\envs\pytorch\lib\site-packages\torch\utils\data_utils\fetch.py", line 58, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "E:\Anaconda3\envs\pytorch\lib\site-packages\torch\utils\data_utils\fetch.py", line 58, in data = [self.dataset[idx] for idx in possibly_batched_index] File "F:\my python\faster r-cnn\faster-rcnn-pytorch-master\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 "F:\my python\faster r-cnn\faster-rcnn-pytorch-master\utils\dataloader.py", line 44, in get_random_data image = Image.open(line[0]) File "E:\Anaconda3\envs\pytorch\lib\site-packages\PIL\Image.py", line 3227, in open fp = builtins.open(filename, "rb") FileNotFoundError: [Errno 2] No such file or directory: 'F:\my'

bubbliiiing commented 1 year ago

空格

yuanyuan814 commented 1 year ago

您能具体说一下吗?什么空格?我把文件从F盘拷到E盘,仍出现同上的错误FileNotFoundError: [Errno 2] No such file or directory: 'F:\my'

Zhangjq7585 commented 6 months ago

我的问题和你的一样,FileNotFoundError: [Errno 2] No such file or directory: 'D:\pycharm'

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'