allow batches of kps images, fix #80
This commit is contained in:
+3
-2
@@ -376,7 +376,7 @@ class FaceKeypointsPreprocessor:
|
||||
CATEGORY = "InstantID"
|
||||
|
||||
def preprocess_image(self, faceanalysis, image):
|
||||
face_kps = extractFeatures(faceanalysis, image[0].unsqueeze(0), extract_kps=True)
|
||||
face_kps = extractFeatures(faceanalysis, image, extract_kps=True)
|
||||
|
||||
if face_kps is None:
|
||||
face_kps = torch.zeros_like(image)
|
||||
@@ -437,7 +437,8 @@ class ApplyInstantID:
|
||||
if face_embed is None:
|
||||
raise Exception('Reference Image: No face detected.')
|
||||
|
||||
face_kps = extractFeatures(insightface, image_kps[0].unsqueeze(0) if image_kps is not None else image[0].unsqueeze(0), extract_kps=True)
|
||||
# if no keypoints image is provided, use the image itself (only the first one in the batch)
|
||||
face_kps = extractFeatures(insightface, image_kps if image_kps is not None else image[0].unsqueeze(0), extract_kps=True)
|
||||
|
||||
if face_kps is None:
|
||||
face_kps = torch.zeros_like(image) if image_kps is None else image_kps
|
||||
|
||||
@@ -58,7 +58,7 @@ The person is posed based on the keypoints generated from the reference image. Y
|
||||
|
||||
## Noise Injection
|
||||
|
||||
The default InstantID implementation seems to really burn the image, I find that by injecting noise to the negative embeds we can mitigate the effect and also increase the likeliness to the reference. The default Apply InstantID node automatically injects 35% noise, if you want to fine tune the effect you use the Advanced InstantID node.
|
||||
The default InstantID implementation seems to really burn the image, I find that by injecting noise to the negative embeds we can mitigate the effect and also increase the likeliness to the reference. The default Apply InstantID node automatically injects 35% noise, if you want to fine tune the effect you can use the Advanced InstantID node.
|
||||
|
||||
This is still experimental and may change in the future.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user