def get_subjects_from_faceboxes(self, color_img, faceboxes): #face crop face_images = [ gaze_tools.crop_face_from_image(color_img, b) for b in faceboxes ] subjects = [] #각 facebox의 x,y좌표의 min,max 총 4개의 요소를 가진 리스트를 가지는 리스트 #0~4 까지 각각 xmin, ymin. xmax, ymax roi_box_list = [ parse_roi_box_from_bbox(facebox) for facebox in faceboxes ] initial_pts68_list = self.ddfa_forward_pass(color_img, roi_box_list) roi_box_refined_list = [ parse_roi_box_from_landmark(initial_pts68) for initial_pts68 in initial_pts68_list ] #plot landmark point pts68_list = self.ddfa_forward_pass(color_img, roi_box_refined_list) #face_image를 color_img로 변경함. for pts68, face_image, facebox in zip(pts68_list, face_images, faceboxes): np_landmarks = np.array((pts68[0], pts68[1])).T subjects.append( TrackedSubject(np.array(facebox), face_image, np_landmarks)) return subjects
def get_subjects_from_faceboxes(self, color_img, faceboxes): face_images = [ gaze_tools.crop_face_from_image(color_img, b) for b in faceboxes ] subjects = [] roi_box_list = [ parse_roi_box_from_bbox(facebox) for facebox in faceboxes ] initial_pts68_list = self.ddfa_forward_pass(color_img, roi_box_list) roi_box_refined_list = [ parse_roi_box_from_landmark(initial_pts68) for initial_pts68 in initial_pts68_list ] pts68_list = self.ddfa_forward_pass(color_img, roi_box_refined_list) for pts68, face_image, facebox in zip(pts68_list, face_images, faceboxes): np_landmarks = np.array((pts68[0], pts68[1])).T transformed_landmarks = self.transform_landmarks( np_landmarks, facebox) subjects.append( TrackedSubject(np.array(facebox), face_image, transformed_landmarks, np_landmarks)) tqdm.write('Extracted landmarks for {} subject(s)'.format( len(subjects))) return subjects