unet
unet copied to clipboard
[Errno 2] No such file or directory: '../npydata/imgs_train.npy'
[Errno 2] No such file or directory: '../npydata/imgs_train.npy' Does anyone have any idea?
Hey, I encountered the same problem and I resolved it by providing the correct path details. So I started by making a separate results folder, within the unet folder.
I modified lines- 164, 169 and 173 in unet.py as follows: ` np.save('/Users/sukritipaul/unet/results/imgs_mask_test.npy', imgs_mask_test)
def save_img(self):
print("array to image")
imgs = np.load('/Users/sukritipaul/unet/results/imgs_mask_test.npy')
# This should match the address in line 164
for i in range(imgs.shape[0]):
img = imgs[i]
img = array_to_img(img)
img.save("/Users/sukritipaul/unet/results/%d.jpg"%(i))
`
You will find the output images in the .../unet/results folder. Hope this helps! :)
Thanks but I still struggle with the same error. It appears that there should be a file named "imgs_train.npy" that I don't have.
Looks like you haven't implemented data.py before unet.py. Here's what I did, and it worked fine for me!
-
I created a folder called npydata i.e. .../unet/data/npydata
-
I edited the code in data.py and changed the data_path , label_path, test_path and npy_path to the correct path (corresponding to the directories in my system). You can try editing these in line 138, in data.py (I've included in below).
def __init__(self, out_rows, out_cols, data_path = "/Users/sukritipaul/unet/data/train/image", label_path = "/Users/sukritipaul/unet/data/train/label", test_path = "/Users/sukritipaul/unet/data/test", npy_path = "/Users/sukritipaul/unet/data/npydata", img_type = "tif"):
- Run data.py. Go to .../unet/data/npydata and check if you have these 3 files:
- imgs_mask_train.npy
- imgs_test.npy
- imgs_train.npy
4.Edit and run unet.py and you're good to go :)
".../data.py", line 162, in create_train_data midname=imgname[imgname.rindex("/")+1:]
Value error: substring not found
Hello, Plz help to resolve this error...
Just replace data.py 138
with this line :
def __init__(self, out_rows, out_cols, data_path = "./data/train/image", label_path = "./data/train/label", test_path = "./data/test", npy_path = "./data/npydata/", img_type = "tif"):
Then line 181 and 182
np.save(self.npy_path + '/imgs_train.npy', imgdatas)
np.save(self.npy_path + '/imgs_mask_train.npy', imglabels)
line 202 to
np.save(self.npy_path + '/imgs_test.npy', imgdatas)
line 209, 211
imgs_train = np.load('./data/npydata/imgs_train.npy')
imgs_mask_train = np.load('./data/npydata/imgs_mask_train.npy')
For testing purpose create a test_fileloading.py in same folder and run this code after you execute data.py
import glob
print(glob.glob('./data/train/image/*.tif'))
If you see a list with images name , You are set to go.
Thank you.. It worked for me.. but now I am facing this error... Plz help to remove this..
Error-- File "...\Anaconda3\lib\site-packages\PIL\Image.py", line 2548, in open fp = builtins.open(filename, "rb")
FileNotFoundError: [Errno 2] No such file or directory: '.../.spyder-py3/data/train/image/image\0.tif'
Have you replaced all the path same as I suggested?
Yes, I have replaced all the paths..
I have the same problem. @msng1 FileNotFoundError: [Errno 2] No such file or directory: './data/train/image/image\0.tif'
Hey :) So I've written an article about how I went about training RGB images, using U-Net. Hope this clears a few queries!
https://medium.com/@sukritipaul005/learn-how-to-train-u-net-on-your-dataset-8e3f89fbd623
hey i cant find line 164
there is no unet.py file in the https://github.com/zhixuhao/unet . plz answer me
hey i cant find line 164
The code has been changed. Look in the previous version of commits in data.py
Thank you.. It worked for me.. but now I am facing this error... Plz help to remove this..
Error-- File "...\Anaconda3\lib\site-packages\PIL\Image.py", line 2548, in open fp = builtins.open(filename, "rb")
FileNotFoundError: [Errno 2] No such file or directory: '.../.spyder-py3/data/train/image/image\0.tif'
Have you solved this error?
I have the same problem. @msng1 FileNotFoundError: [Errno 2] No such file or directory: './data/train/image/image\0.tif'
have you solved this error?
Hey :) So I've written an article about how I went about training RGB images, using U-Net. Hope this clears a few queries!
https://medium.com/@sukritipaul005/learn-how-to-train-u-net-on-your-dataset-8e3f89fbd623
I am getting this error after running the code. ` midname = imgname[imgname.rindex("/")+1:]
ValueError: substring not found`
Can anyone update the article? This repository has changed, and the old one seems to not work.
Thank you.. It worked for me.. but now I am facing this error... Plz help to remove this..
Error-- File "...\Anaconda3\lib\site-packages\PIL\Image.py", line 2548, in open fp = builtins.open(filename, "rb")
FileNotFoundError: [Errno 2] No such file or directory: '.../.spyder-py3/data/train/image/image\0.tif'
I solved it by making another image folder inside the image folder and paste all the image in it
Can anyone update the article? This repository has changed, and the old one seems to not work.
Please use the server 2 repository.