LeeJunHyun / Image_Segmentation

Pytorch implementation of U-Net, R2U-Net, Attention U-Net, and Attention R2U-Net.
2.68k stars 595 forks source link

FileNotFoundError: [Errno 2] No such file or directory: '. #2

Closed YangBai1109 closed 5 years ago

YangBai1109 commented 5 years ago

hello i have some problems about this code Traceback (most recent call last): File "/home/panpan/wenjian/pytorchImage_Segmentation-master/dataset.py", line 115, in main(config) File "/home/panpan/wenjian/pytorchImage_Segmentation-master/dataset.py", line 55, in main copyfile(src, dst) File "/home/panpan/anaconda3/lib/python3.6/shutil.py", line 120, in copyfile with open(src, 'rb') as fsrc: FileNotFoundError: [Errno 2] No such file or directory: '../ISIC/dataset/train_data/ISIC_33.png'

i dont know how to deal with ,can you help me ?thanks a lot

LeeJunHyun commented 5 years ago

Dear @PanPan0210 , I think your directory name is different from mine.

YangBai1109 commented 5 years ago

yeah i think so ,could you tell me your directory name ? i didnot find it in the readme.md document

LeeJunHyun commented 5 years ago

In the 'dataset.py' ,

parser.add_argument('--origin_data_path', type=str, default='../ISIC/dataset/ISIC2018_Task1-2_Training_Input')
parser.add_argument('--origin_GT_path', type=str, default='../ISIC/dataset/ISIC2018_Task1_Training_GroundTruth')

parser.add_argument('--train_path', type=str, default='./dataset/train/')
parser.add_argument('--train_GT_path', type=str, default='./dataset/train_GT/')
parser.add_argument('--valid_path', type=str, default='./dataset/valid/')
parser.add_argument('--valid_GT_path', type=str, default='./dataset/valid_GT/')
parser.add_argument('--test_path', type=str, default='./dataset/test/')
parser.add_argument('--test_GT_path', type=str, default='./dataset/test_GT/')

'../ISIC/dataset/ISIC2018_Task1-2_Training_Input' is the origin image path, '../ISIC/dataset/ISIC2018_Task1_Training_GroundTruth' is the origin ground truth path './dataset/train/' is the path for split dataset. './dataset/train_GT/' is the path for ground truth of split dataset.

YangBai1109 commented 5 years ago

hello ,thank you dor your answer ,but i have another problem

RuntimeError: Given groups=1, weight of size [64, 3, 3, 3], expected input[1, 1, 256, 256] to have 3 channels, but got 1 channels instead

how can i solve it ? i'am so sorry because this is my first study ,so i have a lot questions .

LeeJunHyun commented 5 years ago

It's ok, I think you read the wrong data as a input. (may be ground truth image)

ISIC input image file have RGB 3 channels, but your file has only 1 channel like the gray scale image.

YangBai1109 commented 5 years ago

yeah,i just use a gray scale image ,so what should i do to use it?

LeeJunHyun commented 5 years ago

You should use RGB 3 channels images as the input. You can get the ISIC 2018 RGB images at here or https://challenge2018.isic-archive.com/task1/training/. I had used this dataset, so you can use my code with these.

YangBai1109 commented 5 years ago

so ,i can't use my dataset in this code ?

LeeJunHyun commented 5 years ago

Do you have only 1 channel image?

Then, you should change setting to img_ch=1 at the solver.py#L55.

YangBai1109 commented 5 years ago

thank you very much for your help but how can i save the segmentation result image ? that is prediction result

LeeJunHyun commented 5 years ago

solver.py#L231 Here is the code for saving images. You can modify this code to save whole images.

YangBai1109 commented 5 years ago

thank you very much ; how can i plot the accuracy and loss curve???

LeeJunHyun commented 5 years ago

I didn't implement the code for plotting a graph, but you can refer here :)

YangBai1109 commented 5 years ago

thank you for your help , could you tell me how to solve this problem? Traceback (most recent call last): File "/home/panpan/wenjian/pytorchImage_Segmentation-master/main.py", line 105, in <module> main(config) File "/home/panpan/wenjian/pytorchImage_Segmentation-master/main.py", line 61, in main solver.train() File "/home/panpan/wenjian/pytorchImage_Segmentation-master/solver.py", line 139, in train for i, (images, GT) in enumerate(self.train_loader): File "/home/panpan/anaconda3/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 637, in __next__ return self._process_next_batch(batch) File "/home/panpan/anaconda3/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 658, in _process_next_batch raise batch.exc_type(batch.exc_msg) TypeError: Traceback (most recent call last): File "/home/panpan/anaconda3/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 138, in _worker_loop samples = collate_fn([dataset[i] for i in batch_indices]) File "/home/panpan/anaconda3/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 138, in <listcomp> samples = collate_fn([dataset[i] for i in batch_indices]) File "/home/panpan/wenjian/pytorchImage_Segmentation-master/data_loader.py", line 58, in __getitem__ image = Transform(image) File "/home/panpan/anaconda3/lib/python3.6/site-packages/torchvision/transforms/transforms.py", line 49, in __call__ img = t(img) File "/home/panpan/anaconda3/lib/python3.6/site-packages/torchvision/transforms/transforms.py", line 822, in __call__ return F.rotate(img, angle, self.resample, self.expand, self.center) File "/home/panpan/anaconda3/lib/python3.6/site-packages/torchvision/transforms/functional.py", line 595, in rotate return img.rotate(angle, resample, expand, center) TypeError: rotate() takes from 2 to 4 positional arguments but 5 were given

i do not know how to solve it

LeeJunHyun commented 5 years ago

I think your pytorch version is not fit with your code. Or you can change the code for image rotation.

YangBai1109 commented 5 years ago

hello,i want to know

Epoch [3/150], Loss: 1130.9463, [Training] Acc: 0.7911, SE: 0.9983, SP: 0.7911, PC: 0.0002, F1: 0.0004, JS: 0.0002, DC: 0.0004 [Validation] Acc: 0.7926, SE: 1.0000, SP: 0.7926, PC: 0.0002, F1: 0.0004, JS: 0.0002, DC: 0.0004

why the value of 'Loss'is so big ?i do not know if it is a error ?

LeeJunHyun commented 5 years ago

Is it for your own data? or ISIC data?

YangBai1109 commented 5 years ago

on my own data ,the loss is very high ,and the result is bad ,

LeeJunHyun commented 5 years ago

then I cannot help you. because I have not any information about your data. You should check the your data. Sorry :(

YangBai1109 commented 5 years ago

thank you ,

LeeJunHyun commented 5 years ago

If you have no further questions, I will close the issue. I hope my answer was helpful.