Skip to content Skip to sidebar Skip to footer

FileNotFoundError: [Errno 2] :No Such File Or Directory: 'C:/Users/My_computer/Desktop/Compare/MHAN-master/AID_train/AID_train_LR/x4\\9.png'

I'm very new to python environment. I have tried to compile a super-resolution code for upscaling factor 4 using my own dataset. The low resolution RGB images are kept in 'C:/Users

Solution 1:

'C:/Users/My_computer/Desktop/Compare/MHAN-master/AID_train/AID_train_LR/x4\\9.png'

Your string contains a double backslash at the end of the path, that's why you can't access the directory

use a raw string like

r'yourString'

or review your os.path.join

EDIT:

Try to convert every string into a raw-String, like mentioned above. You are still getting double backslashes, because certain \character combinations are escaped.

These are the escaped characters:

[1]: https://i.stack.imgur.com/5UdXQ.png

Edit your code to:

self.HR =r'C:/Users/My_computer/Desktop/Compare/MHAN- 
master/AID_train/AID_train_HR'
self.LR =r'C:/Users/My_computer/Desktop/Compare/MHAN- 
master/AID_train/AID_train_LR/x4'

Please notice the "r" in front of the string to convert them into raw-Strings.


Post a Comment for "FileNotFoundError: [Errno 2] :No Such File Or Directory: 'C:/Users/My_computer/Desktop/Compare/MHAN-master/AID_train/AID_train_LR/x4\\9.png'"