Maclory / Deep-Iterative-Collaboration

Pytorch implementation of Deep Face Super-Resolution with Iterative Collaboration between Attentive Recovery and Landmark Estimation (CVPR 2020)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

LR size 32 to SR size 128

Yakuho opened this issue · comments

你好,感谢作者,我以成功使用模型。但是我想要更改LR的大小,改成3232放大4倍图像,我在dic_arch.py中已经更改了
elif self.upscale_factor == 4: stride = 2 padding = 1 kernel_size = 4
在train_
**.json options文件中也已经更改了scale和size大小,但是当我运行的时候,报错了
Traceback (most recent call last): File "train.py", line 207, in <module> main() File "train.py", line 114, in main iter_loss = solver.train_step() File "/content/code/solvers/SRLandmarkSolver.py", line 122, in train_step SR_list, heatmap_list = self.model(self.LR) File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py", line 727, in _call_impl result = self.forward(*input, **kwargs) File "/usr/local/lib/python3.7/dist-packages/torch/nn/parallel/data_parallel.py", line 159, in forward return self.module(*inputs[0], **kwargs[0]) File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py", line 727, in _call_impl result = self.forward(*input, **kwargs) File "/content/code/networks/dic_arch.py", line 102, in forward FB_out = self.block(x, merge_heatmap_5(heatmap, self.detach_attention)) File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py", line 727, in _call_impl result = self.forward(*input, **kwargs) File "/content/code/networks/srfbn_hg_arch.py", line 74, in forward x = self.fusion_block(x, heatmap) File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py", line 727, in _call_impl result = self.forward(*input, **kwargs) File "/content/code/networks/blocks.py", line 153, in forward feature = feature.view(batch_size, self.num_heatmap, -1, w, h) * attention.unsqueeze(2) RuntimeError: The size of tensor a (64) must match the size of tensor b (32) at non-singleton dimension 4
你能指导我怎么做吗

你好,这个部分就是尺寸不匹配,可能是因为特征和注意力图的维度不一致导致的,所以把两部分的网络结构和设置都对应调整应该就可以解决问题。

你能指导一下更多细节吗,关于3232到128128的4x设置,我尝试在networks/modules/StakedHourGlass.py更改image输出size,但是未能成功。感谢您。