利来w66-利来w66app

官网首页 > 信息资讯 > 公司动态 >
最新案例
点击这里给我发消息
建站咨询热线:
公司动态

直接可用的人脸识别+人脸对齐模块

来源:   日期:2019-10-09 10:25
# save_root = '/home/lpadas1/share/HDD/jory.d/dataset/fer2013/'save_root = '/hom......
# save_root = '/home/lpadas1/share/HDD/jory.d/dataset/fer2013/' save_root = '/home/lpadas1/share/HDD/ShareFromWind2/jory.d/dataset/fer2013+/' # save_root = '/home/lpadas1/share/HDD/jory.d/dataset/face_short_videos/' fs = 'Test' read_path = save_root + '/' + fs save_path = save_root + '/' + fs + '_cutface' save_path2 = save_root + '/' + fs + '_noface' mkdir_if_not_exist mkdir_if_not_exist with tf.device: detector = MTCNN files = glob.glob for f in files: subdir = f.split[-2] fullpath = save_path + '/' + subdir mkdir_if_not_exist fullpath2 = save_path2 + '/' + subdir mkdir_if_not_exist filename = osp.basename # f = '0_Parade_Parade_0_730.jpg' img = cv2.imread if img is None: continue src_h, src_w, c = img.shape face_list = detector.detect_faces if len == 0: save_filepath = osp.join shutil.copy continue for item in face_list: box = item['box'] conf = item['confidence'] keyprints_dict = item['keypoints'] left_eyeXY = keyprints_dict['left_eye'] right_eyeXY = keyprints_dict['right_eye'] mouth_leftXY = keyprints_dict['mouth_left'] mouth_rightXY = keyprints_dict['mouth_right'] noseXY = keyprints_dict['nose'] if conf .2: print x, y, w, h = box offset = 5 x = x - offset if x offset else 0 y = y - offset if y offset else 0 w = w + offset if x + w + offset = src_w else src_w - x h = h + offset if y + h + offset = src_h else src_h - y crop_face = img[y:y + h, x:x + w, :] save_filepath = osp.join if not osp.exists: cv2.imwrite # line = ','.join,' '.join, # ' '.join, ' '.join, # ' '.join]) + ' ' # wf.write print)