MCPcopy Create free account
hub / github.com/cubiq/ComfyUI_InstantID / FaceKeypointsPreprocessor

Class FaceKeypointsPreprocessor

InstantID.py:222–243  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

220 return (model,)
221
222class FaceKeypointsPreprocessor:
223 @classmethod
224 def INPUT_TYPES(s):
225 return {
226 "required": {
227 "faceanalysis": ("FACEANALYSIS", ),
228 "image": ("IMAGE", ),
229 },
230 }
231 RETURN_TYPES = ("IMAGE",)
232 FUNCTION = "preprocess_image"
233 CATEGORY = "InstantID"
234
235 def preprocess_image(self, faceanalysis, image):
236 face_kps = extractFeatures(faceanalysis, image, extract_kps=True)
237
238 if face_kps is None:
239 face_kps = torch.zeros_like(image)
240 print(f"\033[33mWARNING: no face detected, unable to extract the keypoints!\033[0m")
241 #raise Exception('Face Keypoints Image: No face detected.')
242
243 return (face_kps,)
244
245def add_noise(image, factor):
246 seed = int(torch.sum(image).item()) % 1000000007

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected