Skip to content

Commit 2f092bd

Browse files
committed
Don't extract crops unless they are really required
1 parent 6abb652 commit 2f092bd

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/api_trt/modules/face_model.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,10 @@ async def get(self, img, extract_embedding: bool = True, extract_ga: bool = True
211211
boxes = self.reproject_points(boxes, img.scale_factor)
212212
landmarks = self.reproject_points(landmarks, img.scale_factor)
213213
# Crop faces from original image instead of resized to improve quality
214-
crops = face_align.norm_crop_batched(img.orig_image, landmarks)
214+
if extract_ga or extract_embedding or return_face_data:
215+
crops = face_align.norm_crop_batched(img.orig_image, landmarks)
216+
else:
217+
crops = [None] * len(boxes)
215218

216219
for i, _crop in enumerate(crops):
217220

0 commit comments

Comments
 (0)