def main(mode, face_id_model_root, id_features_dir, font_path):
    print('Loading models...')
    det_models = load_detect_faces_models()
    face_id_model = load_face_id_model(model_root=face_id_model_root)
    id_npy = load_id_files(id_features_dir)
    crop_size = 112
    max_size = 1024
    reference = get_reference_facial_points(default_square=True)
    font = ImageFont.FreeTypeFont(font=font_path, size=24)
    print('Starting image processing...')
    if (mode == Mode.DEMO):
        demo(det_models=det_models, face_id_model=face_id_model, reference=reference, crop_size=crop_size, id_npy=id_npy, max_size=max_size, font=font)
    elif (mode == Mode.FILE):
        process_files(input_dir=STREAM_DIR, output_dir=RESULT_DIR, det_models=det_models, face_id_model=face_id_model, reference=reference, crop_size=crop_size, id_npy=id_npy, max_size=max_size, font=font)
    else:
        raise ValueError('Invalid mode: {}'.format(mode))
def main(mode, face_id_model_root, id_features_dir, font_path):
    print('Loading models...')
    det_models = load_detect_faces_models()
    face_id_model = load_face_id_model(model_root=face_id_model_root)
    id_npy = load_id_files(id_features_dir)
    crop_size = 112
    max_size = 1024
    reference = get_reference_facial_points(default_square=True)
    font = ImageFont.FreeTypeFont(font=font_path, size=24)
    print('Starting image processing...')
    if (mode == Mode.DEMO):
        demo(det_models=det_models, face_id_model=face_id_model, reference=reference, crop_size=crop_size, id_npy=id_npy, max_size=max_size, font=font)
    elif (mode == Mode.FILE):
        process_files(input_dir=STREAM_DIR, output_dir=RESULT_DIR, det_models=det_models, face_id_model=face_id_model, reference=reference, crop_size=crop_size, id_npy=id_npy, max_size=max_size, font=font)
    else:
        raise ValueError('Invalid mode: {}'.format(mode))