zhilin007 / FFA-Net

FFA-Net: Feature Fusion Attention Network for Single Image Dehazing
601 stars 141 forks source link

when I run the main.py .I have this problem and can't solve it,anyone can help me? #11

Open xiaoxiaoyuxieing opened 4 years ago

xiaoxiaoyuxieing commented 4 years ago

D:\python\envs\pytorch\python.exe E:/FFA-Net-master/net/main.py Namespace(blocks=20, bs=16, crop=False, crop_size=240, device='cpu', eval_step=5000, gps=3, lr=0.0001, model_dir='./trained_models/its_train_ffa_3_20.pk', net='ffa', no_lr_sche=False, perloss=False, resume=True, steps=100000, testset='its_test', trainset='its_train') model_dir: ./trained_models/its_train_ffa_3_20.pk 16 E:\FFA-Net-master\net crop size whole_img crop size whole img crop size whole_img crop size whole img log_dir : logs/its_train_ffa_3_20 model_name: its_train_ffa_3_20 train from scratch *** Traceback (most recent call last): File "E:/FFA-Net-master/net/main.py", line 156, in train(net,loader_train,loader_test,optimizer,criterion) File "E:/FFA-Net-master/net/main.py", line 62, in train x,y=next(iter(loader_train)) File "D:\python\envs\pytorch\lib\site-packages\torch\utils\data\dataloader.py", line 346, in next data = self._dataset_fetcher.fetch(index) # may raise StopIteration File "D:\python\envs\pytorch\lib\site-packages\torch\utils\data_utils\fetch.py", line 47, in fetch return self.collate_fn(data) File "D:\python\envs\pytorch\lib\site-packages\torch\utils\data_utils\collate.py", line 79, in default_collate return [default_collate(samples) for samples in transposed] File "D:\python\envs\pytorch\lib\site-packages\torch\utils\data_utils\collate.py", line 79, in return [default_collate(samples) for samples in transposed] File "D:\python\envs\pytorch\lib\site-packages\torch\utils\data_utils\collate.py", line 55, in default_collate return torch.stack(batch, 0, out=out) RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 0. Got 460 and 407 in dimension 2 at C:\w\1\s\tmp_conda_3.6_081743\conda\conda-bld\pytorch_1572941935551\work\aten\src\TH/generic/THTensor.cpp:689

Process finished with exit code 1

binwang777 commented 4 years ago

D:\python\envs\pytorch\python.exe E:/FFA-Net-master/net/main.py Namespace(blocks=20, bs=16, crop=False, crop_size=240, device='cpu', eval_step=5000, gps=3, lr=0.0001, model_dir='./trained_models/its_train_ffa_3_20.pk', net='ffa', no_lr_sche=False, perloss=False, resume=True, steps=100000, testset='its_test', trainset='its_train') model_dir: ./trained_models/its_train_ffa_3_20.pk 16 E:\FFA-Net-master\net crop size whole_img crop size whole img crop size whole_img crop size whole img log_dir : logs/its_train_ffa_3_20 model_name: its_train_ffa_3_20 train from scratch * Traceback (most recent call last): File "E:/FFA-Net-master/net/main.py", line 156, in train(net,loader_train,loader_test,optimizer,criterion) File "E:/FFA-Net-master/net/main.py", line 62, in train x,y=next(iter(loader_train)) File "D:\python\envs\pytorch\lib\site-packages\torch\utils\data\dataloader.py", line 346, in next** data = self._dataset_fetcher.fetch(index) # may raise StopIteration File "D:\python\envs\pytorch\lib\site-packages\torch\utils\data_utils\fetch.py", line 47, in fetch return self.collate_fn(data) File "D:\python\envs\pytorch\lib\site-packages\torch\utils\data_utils\collate.py", line 79, in default_collate return [default_collate(samples) for samples in transposed] File "D:\python\envs\pytorch\lib\site-packages\torch\utils\data_utils\collate.py", line 79, in return [default_collate(samples) for samples in transposed] File "D:\python\envs\pytorch\lib\site-packages\torch\utils\data_utils\collate.py", line 55, in default_collate return torch.stack(batch, 0, out=out) RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 0. Got 460 and 407 in dimension 2 at C:\w\1\s\tmp_conda_3.6_081743\conda\conda-bld\pytorch_1572941935551\work\aten\src\TH/generic/THTensor.cpp:689

Process finished with exit code 1

I guess you did n’t expand your input to four dimensions, your 0 dimension should be batchsize, if you only have one image, it should be 0

LEOGML commented 3 years ago

你解决了吗,我出现了这样的问题 C:\ProgramData\Anaconda3\python.exe F:/data/FFA-Net/net/main.py Namespace(blocks=20, bs=16, crop=False, crop_size=240, device='cpu', eval_step=5000, gps=3, lr=0.0001, model_dir='./trained_models/its_train_ffa_3_20.pk', net='ffa', no_lr_sche=False, perloss=False, resume=True, steps=100000, testset='its_test', trainset='its_train') model_dir: ./trained_models/its_train_ffa_3_20.pk 16 F:\data\FFA-Net\net crop size whole_img crop size whole img crop size whole_img crop size whole img log_dir : logs/its_train_ffa_3_20 model_name: its_train_ffa_3_20 train from scratch *** Traceback (most recent call last): File "F:/data/FFA-Net/net/main.py", line 156, in train(net,loader_train,loader_test,optimizer,criterion) File "F:/data/FFA-Net/net/main.py", line 62, in train x,y=next(iter(loader_train)) File "C:\ProgramData\Anaconda3\lib\site-packages\torch\utils\data\dataloader.py", line 435, in next data = self._next_data() File "C:\ProgramData\Anaconda3\lib\site-packages\torch\utils\data\dataloader.py", line 475, in _next_data data = self._dataset_fetcher.fetch(index) # may raise StopIteration File "C:\ProgramData\Anaconda3\lib\site-packages\torch\utils\data_utils\fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "C:\ProgramData\Anaconda3\lib\site-packages\torch\utils\data_utils\fetch.py", line 44, in data = [self.dataset[idx] for idx in possibly_batched_index] File "F:\data\FFA-Net\net\data_utils.py", line 54, in getitem clear=Image.open(os.path.join(self.clear_dir,clear_name)) File "C:\ProgramData\Anaconda3\lib\site-packages\PIL\Image.py", line 2580, in open fp = builtins.open(filename, "rb") FileNotFoundError: [Errno 2] No such file or directory: '../data/RESIDE/ITS\clear\ITS\hazy\1120.png'

Process finished with exit code 1

leolan2001 commented 1 year ago

你解决了吗,我出现了这样的问题 C:\ProgramData\Anaconda3\python.exe F:/data/FFA-Net/net/main.py Namespace(blocks=20, bs=16, crop=False, crop_size=240, device='cpu', eval_step=5000, gps=3, lr=0.0001, model_dir='./trained_models/its_train_ffa_3_20.pk', net='ffa', no_lr_sche=False, perloss=False, resume=True, steps=100000, testset='its_test', trainset='its_train') model_dir: ./trained_models/its_train_ffa_3_20.pk 16 F:\data\FFA-Net\net crop size whole_img crop size whole img crop size whole_img crop size whole img log_dir : logs/its_train_ffa_3_20 model_name: its_train_ffa_3_20 train from scratch * Traceback (most recent call last): File "F:/data/FFA-Net/net/main.py", line 156, in train(net,loader_train,loader_test,optimizer,criterion) File "F:/data/FFA-Net/net/main.py", line 62, in train x,y=next(iter(loader_train)) File "C:\ProgramData\Anaconda3\lib\site-packages\torch\utils\data\dataloader.py", line 435, in next data = self._next_data() File "C:\ProgramData\Anaconda3\lib\site-packages\torch\utils\data\dataloader.py", line 475, in _next_data data = self._dataset_fetcher.fetch(index) # may raise StopIteration File "C:\ProgramData\Anaconda3\lib\site-packages\torch\utils\data_utils\fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "C:\ProgramData\Anaconda3\lib\site-packages\torch\utils\data_utils\fetch.py", line 44, in data = [self.dataset[idx] for idx in possibly_batched_index] File "F:\data\FFA-Net\net\data_utils.py", line 54, in getitem** clear=Image.open(os.path.join(self.clear_dir,clear_name)) File "C:\ProgramData\Anaconda3\lib\site-packages\PIL\Image.py", line 2580, in open fp = builtins.open(filename, "rb") FileNotFoundError: [Errno 2] No such file or directory: '../data/RESIDE/ITS\clear\ITS\hazy\1120.png'

Process finished with exit code 1

您好,请问您这个问题解决了吗?谢谢!

suse-chen commented 6 months ago

我也遇到了相同的问题