LeeJunHyun / Image_Segmentation

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

about the issue #11

Closed YangBai1109 closed 5 years ago

YangBai1109 commented 5 years ago

hello can you help me to solve this problem i dont know how to deal with

Traceback (most recent call last): File "/home/panpan/RRE/Image_Segmentation-master/main.py", line 101, in <module> main(config) File "/home/panpan/RRE/Image_Segmentation-master/main.py", line 61, in main solver.train() File "/home/panpan/RRE/Image_Segmentation-master/solver.py", line 140, 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) RuntimeError: 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/RRE/Image_Segmentation-master/data_loader.py", line 89, in __getitem__ image = Norm_(image) File "/home/panpan/anaconda3/lib/python3.6/site-packages/torchvision/transforms/transforms.py", line 163, in __call__ return F.normalize(tensor, self.mean, self.std, self.inplace) File "/home/panpan/anaconda3/lib/python3.6/site-packages/torchvision/transforms/functional.py", line 208, in normalize tensor.sub_(mean[:, None, None]).div_(std[:, None, None]) RuntimeError: output with shape [1, 256, 256] doesn't match the broadcast shape [3, 256, 256]

LeeJunHyun commented 5 years ago

hello again, @PanPan0210 .

can you check the number of output channel?

LeeJunHyun commented 5 years ago

If you don't have further issues, I will close the issue. I hope my answer was helpful :)