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

Error while training #6

Open
vi1729 opened this issue Jan 7, 2020 · 6 comments
Open

Error while training #6

vi1729 opened this issue Jan 7, 2020 · 6 comments

Comments

@vi1729
Copy link

vi1729 commented Jan 7, 2020

Hi Mayank,

I created a folder "data" and placed the data and images folder from the google sites. I'm getting below error. Please guide me any corrections.

Total training examples: 24443
Total validation examples: 2813
Traceback (most recent call last):
File "train.py", line 104, in
train(config)
File "train.py", line 43, in train
for iteration, (img_orig, img_haze) in enumerate(train_loader):
File "C:\Users\aruna\Anaconda3\envs\test\lib\site-packages\torch\utils\data\dataloader.py", line 336, in next
return self._process_next_batch(batch)
File "C:\Users\aruna\Anaconda3\envs\test\lib\site-packages\torch\utils\data\dataloader.py", line 357, in _process_next_batch
raise batch.exc_type(batch.exc_msg)
FileNotFoundError: Traceback (most recent call last):
File "C:\Users\aruna\Anaconda3\envs\test\lib\site-packages\torch\utils\data\dataloader.py", line 106, in _worker_loop
samples = collate_fn([dataset[i] for i in batch_indices])
File "C:\Users\aruna\Anaconda3\envs\test\lib\site-packages\torch\utils\data\dataloader.py", line 106, in
samples = collate_fn([dataset[i] for i in batch_indices])
File "C:\Users\aruna\PycharmProjects\PyTorch-Image-Dehazing-master\dataloader.py", line 90, in getitem
data_orig = Image.open(data_orig_path)
File "C:\Users\aruna\Anaconda3\envs\test\lib\site-packages\PIL\Image.py", line 2766, in open
fp = builtins.open(filename, "rb")
FileNotFoundError: [Errno 2] No such file or directory: 'data\images\data\data\NYU2_714.jpg'

@JiechaoSheng
Copy link

I have received the same problem

1 similar comment
@Fakerworker
Copy link

I have received the same problem

@18119496488
Copy link

I have received the same problem too

@gravity-123
Copy link

The cause of this error is the line "image_list_haze = glob.glob(hazy_images_path + "*.jpg")" in "dataloader.py". The path obtained by the "glob.glob" function under windows and linux systems is slightly different. The path of the same file in windows system is "data/images/data\NYU2_714.jpg", and the path in linux system is "data/images/data/NYU2_714.jpg". After the above path is sliced by the code "image = image.split("/")[-1]" on line 27, the "image" variable is "data/NYU2_714.jpg". The code can be changed to "image = image.split("\\")[-1]", after the string is sliced, the "image" variable is "NYU2_714.jpg"

@phongfire
Copy link

The cause of this error is the line "image_list_haze = glob.glob(hazy_images_path + "*.jpg")" in "dataloader.py". The path obtained by the "glob.glob" function under windows and linux systems is slightly different. The path of the same file in windows system is "data/images/data\NYU2_714.jpg", and the path in linux system is "data/images/data/NYU2_714.jpg". After the above path is sliced by the code "image = image.split("/")[-1]" on line 27, the "image" variable is "data/NYU2_714.jpg". The code can be changed to "image = image.split("\")[-1]", after the string is sliced, the "image" variable is "NYU2_714.jpg"

——————————————————————————————————
Hello,I have received the same problem too, but I run the code on the linux system. And I don't know how to solve this problem. Could you help me?
Traceback (most recent call last):
File "train.py", line 140, in
main(config_args)
File "train.py", line 97, in main
for step, (ori_image, haze_image) in enumerate(train_loader):
File "/root/miniconda3/envs/my-env/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 681, in next
data = self._next_data()
File "/root/miniconda3/envs/my-env/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 721, in _next_data
data = self._dataset_fetcher.fetch(index) # may raise StopIteration
File "/root/miniconda3/envs/my-env/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 49, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/root/miniconda3/envs/my-env/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 49, in
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/root/autodl-tmp/AOD-Net-PyTorch/data.py", line 27, in getitem
ori_image = self.transforms(Image.open(ori_image_name))
File "/root/miniconda3/envs/my-env/lib/python3.7/site-packages/PIL/Image.py", line 3068, in open
fp = builtins.open(filename, "rb")
FileNotFoundError: [Errno 2] No such file or directory: '/root/autodl-tmp/AOD-Net-PyTorch/data/train/haze/33_outdoor.jpg'

@Jackdachun
Copy link

The cause of this error is the line "image_list_haze = glob.glob(hazy_images_path + "*.jpg")" in "dataloader.py". The path obtained by the "glob.glob" function under windows and linux systems is slightly different. The path of the same file in windows system is "data/images/data\NYU2_714.jpg", and the path in linux system is "data/images/data/NYU2_714.jpg". After the above path is sliced by the code "image = image.split("/")[-1]" on line 27, the "image" variable is "data/NYU2_714.jpg". The code can be changed to "image = image.split("\")[-1]", after the string is sliced, the "image" variable is "NYU2_714.jpg"

thanks,I need to train other datasets. How should I handle datasets? And modify the dataloader??

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

7 participants