| 220 | return (model,) |
| 221 | |
| 222 | class 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 | |
| 245 | def add_noise(image, factor): |
| 246 | seed = int(torch.sum(image).item()) % 1000000007 |
nothing calls this directly
no outgoing calls
no test coverage detected