fnzhan / RABIT

Bi-level feature alignment for versatile image translation and manipulation [ECCV 2022]
18 stars 3 forks source link

about some bugs in you code #1

Open rorschach-xiao opened 2 years ago

rorschach-xiao commented 2 years ago

Hi zhan, I appreciate your work so much! However , I met some bugs when I tried to use your code.

1、models/networks/correspondence.py (line 385)


elif self.opt.warp_mask_losstype == 'cycle':
# f_div_C_v = F.softmax(f_WTA.transpose(1, 2), dim=-1)
f_WTA_v = f.transpose(1, 2)
f_div_C_v = f_WTA_v / f_WTA_v.sum(-1).view(-1, N, 1)
        seg = F.interpolate(seg_map, scale_factor=1 / self.down, mode='nearest')
        channel = seg.shape[1]
        seg = seg.view(batch_size, channel, -1)
        seg = seg.permute(0, 2, 1)
        warp_mask_to_ref = torch.matmul(f_div_C_v, seg)  # 2*1936*channel
        warp_mask = torch.matmul(f_div_C, warp_mask_to_ref)  # 2*1936*channel
        warp_mask = warp_mask.permute(0, 2, 1).contiguous()
        coor_out['warp_mask'] = warp_mask.view(batch_size, channel, feat_height, feat_width)  # 2*3*44*44
'f' and 'f_div_C' is not defined

> 2、models/networks/generator.py (line 47)
``` python
     self.conv_img1 = nn.Conv2d(1, seg, 3, padding=1)
     self.up = nn.Upsample(scale_factor=2)

'seg' is not defined

would you please fix these bugs?

peterkim333 commented 2 years ago

same problem.

fnzhan commented 2 years ago

Seems you set --warp_mask_losstype cycle in training, you may follow the default setting of --warp_mask_losstype direct

I have corrected the bug in generator.py