def show(image_index, threshold=0.000000001):
imgs = [trans(Image.open(image_list[image_index]))]
for i in range(1, 4):
aged_face = trans(Image.open('FaceAging/evaluation/imgs/0-{}-morph-ProgressiveGAN-{}.png'.format(i, image_names[image_index])))
if i == 1:
j = 0
elif i == 2:
j = 1
elif i == 3:
j = 3
aging_effct = aged_face - imgs[j]
aging_effct[torch.abs(aging_effct) < threshold] = 0
# aging_effct = torch.mean(aging_effct, dim=0).unsqueeze(0).repeat(3, 1, 1)
aging_effct = torch.mean(aging_effct, dim=0)
# aging_effct = torch.mean(torch.abs(aging_effct), dim=0)
# aging_effct[aging_effct < threshold] = 0
aging_effct = aging_effct.numpy()
# pmin = np.min(aging_effct)
# pmax = np.max(aging_effct)
# aging_effct = ((aging_effct - pmin) / (pmax - pmin))
aging_effct = Image.fromarray(np.uint8(cm.Greys(aging_effct) * 255)).convert('RGB')
aging_effct = trans(aging_effct)
aging_effct = aging_effct.float()
imgs.extend([aged_face, aging_effct])
imgs = torchvision.utils.make_grid(imgs, nrow=7, pad_value=1, padding=0)
imgs = torchvision.transforms.ToPILImage()(imgs)
return imgs
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}