Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
image = cv.imread(filename) # BGR
image = image[:, :, ::-1] # RGB
dets = self.detector(image, 1)
num_faces = len(dets)
if num_faces > 0:
# Find the 5 face landmarks we need to do the alignment.
faces = dlib.full_object_detections()
for detection in dets:
faces.append(self.sp(image, detection))
image = dlib.get_face_chip(image, faces[0], size=img_size)
else:
image = cv.resize(image, (img_size, img_size), cv.INTER_CUBIC)
if self.usage == 'train':
image = aug_pipe.augment_image(image)
batch_inputs[j, i_batch] = preprocess_input(image)
return [batch_inputs[0], batch_inputs[1], batch_inputs[2]], batch_dummy_target