deepinsight / insightface

State-of-the-art 2D and 3D Face Analysis Project
https://insightface.ai
23.38k stars 5.41k forks source link

Just for use "insight_face"!!! get_multi_input() is ok??? #1120

Open yungongzi opened 4 years ago

yungongzi commented 4 years ago

About detecting multiple faces,Minor change on "get_input": an attribute of FaceModel in face_model.py def get_multi_input(self, face_img): """ get multi-inputs/aligned """ ret = self.detector.detect_face(face_img, det_type=self.args.det) if ret is None: return None bboxs, points = ret if bboxs.shape[0] == 0: return None aligned_list = [] for b, p in zip(bboxs, points): bbox = b[0:4] points = p.reshape((2, 5)).T

print(bbox)

        # print(points)
        # face_acc = b[-1]
        # print("Face Acc: {0:.3f}".format(face_acc))
        nimg = face_preprocess.preprocess(face_img, bbox, points, image_size='112,112')
        nimg = cv2.cvtColor(nimg, cv2.COLOR_BGR2RGB)
        aligned = np.transpose(nimg, (2, 0, 1))
        aligned_list.append(aligned)
    return np.array(aligned_list)
yungongzi commented 4 years ago

Oops, there's no format