#12 but only works when there's one face selected
This commit is contained in:
@@ -106,7 +106,7 @@ class Pytorch_RetinaFace:
|
||||
|
||||
# Crop the region and add padding to form a square
|
||||
cropped_imgs.append(image[crop_y1:crop_y2, crop_x1:crop_x2])
|
||||
bbox_infos.append((original_crop_x1, original_crop_y1, original_crop_x2, original_crop_y2))
|
||||
bbox_infos.append(((original_crop_x2-original_crop_x1, original_crop_y2-original_crop_y1),(original_crop_x1, original_crop_y1, original_crop_x2, original_crop_y2)))
|
||||
return cropped_imgs, bbox_infos
|
||||
|
||||
def detect_faces(self, img):
|
||||
|
||||
+5
-3
@@ -132,13 +132,14 @@ class AutoCropFaces:
|
||||
|
||||
# If we haven't selected anything, then return original images.
|
||||
if len(selected_faces) == 0:
|
||||
selected_crop_data = [(0, 0, img.shape[3], img.shape[2]) for img in original_images]
|
||||
return (image, selected_crop_data)
|
||||
# selected_crop_data = [(0, 0, img.shape[3], img.shape[2]) for img in original_images]
|
||||
return (image, None)
|
||||
|
||||
# If there is only one detected face in batch of images, just return that one.
|
||||
elif len(selected_faces) <= 1:
|
||||
out = selected_faces[0]
|
||||
return (out, selected_crop_data)
|
||||
crop_data = selected_crop_data[0] # to be compatible with WAS
|
||||
return (out, crop_data)
|
||||
|
||||
# Determine the index of the face with the maximum width
|
||||
max_width_index = max(range(len(selected_faces)), key=lambda i: selected_faces[i].shape[1])
|
||||
@@ -165,6 +166,7 @@ class AutoCropFaces:
|
||||
else:
|
||||
out = torch.cat((out, face_image), dim=0)
|
||||
|
||||
#TODO: WAS doesn't not support multiple faces, so this won't work with WAS.
|
||||
return (out, selected_crop_data)
|
||||
|
||||
NODE_CLASS_MAPPINGS = {
|
||||
|
||||
Reference in New Issue
Block a user