tencent-ailab / IP-Adapter

The image prompt adapter is designed to enable a pretrained text-to-image diffusion model to generate images with image prompt.
Apache License 2.0
5.08k stars 331 forks source link

When I use the insightface module for actual inference, some uploaded faces cannot extract faceid. #281

Open lxd941213 opened 8 months ago

lxd941213 commented 8 months ago

import cv2
import numpy as np import insightface from insightface.app import FaceAnalysis from insightface.data import get_image as ins_get_image from insightface.utils import face_align

app = FaceAnalysis(providers=['CUDAExecutionProvider', 'CPUExecutionProvider']) app.prepare(ctx_id=0, det_size=(640, 640)) img = cv2.imread("person.png")

faces = app.get(img) norm_face = face_align.norm_crop(img, landmark=faces[0].kps, image_size=224)

When I use the above code to crop the face, and then use the insightface module, the faceid cannot be extracted. Have you ever encountered this problem? Hope to get your reply, thank you!

xiaohu2015 commented 8 months ago

face detector sometime fails to detect face

lxd941213 commented 8 months ago

face detector sometime fails to detect face

I see that your IP-Adapter-portrait is also a cropped face, so there should be a high probability that the ID embedding will not be detected? ​

xiaohu2015 commented 8 months ago

face detector sometime fails to detect face

I see that your IP-Adapter-portrait is also a cropped face, so there should be a high probability that the ID embedding will not be detected?​

I firstly get id embedding befrore crop face ( you can also pad the cropped face image to increase the probability)

lxd941213 commented 8 months ago

face detector sometime fails to detect face

I see that your IP-Adapter-portrait is also a cropped face, so there should be a high probability that the ID embedding will not be detected?​

I firstly get id embedding befrore crop face ( you can also pad the cropped face image to increase the probability)

Thank you very much for your quick reply!