deepinsight / insightface

State-of-the-art 2D and 3D Face Analysis Project
https://insightface.ai
23.08k stars 5.38k forks source link

mask_renderer.py Why is the face data made with masks not real at all? #1878

Open APeiZou opened 2 years ago

APeiZou commented 2 years ago

import os, sys, datetime import numpy as np import os.path as osp import cv2 import insightface from insightface.app import MaskRenderer from insightface.data import get_image as ins_get_image

if name == "main":

make sure that you have download correct insightface model pack.

#make sure that BFM.mat and BFM_UV.mat have been generated
tool = MaskRenderer()
tool.prepare(ctx_id=0, det_size=(128,128))
image = ins_get_image('Tom_Hanks_54745')
mask_image  = "mask_black"
params = tool.build_params(image)
mask_out = tool.render_mask(image, mask_image, params)

cv2.imwrite('output_mask.jpg', mask_out)

output_mask @nttstar

nttstar commented 2 years ago

Your BFM mat files are not correct.

szad670401 commented 2 years ago

Can you show your raw face image and mask image ?