Skip to content

Commit

Permalink
Update reverse2original.py
Browse files Browse the repository at this point in the history
  • Loading branch information
NNNNAI committed Jul 19, 2021
1 parent 0b4e6de commit 00e7412
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions util/reverse2original.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def encode_segmentation_rgb(segmentation, no_neck=True):
mouth_map[valid_index] = 255
# valid_index = np.where(parse==hair_id)
# hair_map[valid_index] = 255

#return np.stack([face_map, mouth_map,hair_map], axis=2)
return np.stack([face_map, mouth_map], axis=2)


Expand Down Expand Up @@ -108,7 +108,7 @@ def reverse2wholeimage(b_align_crop_tenor_list,swaped_imgs, mats, crop_size, ori
parsing = out.squeeze(0).detach().cpu().numpy().argmax(0)
vis_parsing_anno = parsing.copy().astype(np.uint8)
tgt_mask = encode_segmentation_rgb(vis_parsing_anno)
if tgt_mask.sum() != 0:
if tgt_mask.sum() >= 5000:
# face_mask_tensor = tgt_mask[...,0] + tgt_mask[...,1]
target_mask = cv2.resize(tgt_mask, (224, 224))
# print(source_img)
Expand Down

0 comments on commit 00e7412

Please sign in to comment.