SwinTransformer / AiT

101 stars 8 forks source link

denorm twice in eval_coco.py #11

Open JJJYmmm opened 10 months ago

JJJYmmm commented 10 months ago

Hello! I find that /vae/utils/eval_coco.py denorm the reconstruction image twice in line 45.

if hasattr(vae, 'get_codebook_indices'):
                code = vae.get_codebook_indices(mask)
                remask = vae.decode(code)[0, 0, :, :].cpu().numpy() * 0.5 + 0.5 # why denorm here?

because in class func decode, the attr use_norm is True, so decode will denorm the image, but the code denorm after decodeing. I will try to investigate the effect when evaluating.

JJJYmmm commented 10 months ago

Actually, the origin code won't get in the branch. Because this time vae is ddp model. Correct code should be below.

if hasattr(vae.module, 'get_codebook_indices'):
                code = vae.module.get_codebook_indices(mask)
                remask = vae.module.decode(code)[0, 0, :, :].cpu().numpy()