mirror of
https://github.com/boltgolt/howdy.git
synced 2024-09-12 09:41:18 +02:00
refactor: remove useless conversion
This commit is contained in:
parent
0eb3eeb6a7
commit
466c859cb8
5 changed files with 14 additions and 15 deletions
|
@ -40,16 +40,16 @@ config.read(paths_factory.config_file_path())
|
||||||
|
|
||||||
use_cnn = config.getboolean("core", "use_cnn", fallback=False)
|
use_cnn = config.getboolean("core", "use_cnn", fallback=False)
|
||||||
if use_cnn:
|
if use_cnn:
|
||||||
face_detector = dlib.cnn_face_detection_model_v1(str(paths_factory.mmod_human_face_detector_path()))
|
face_detector = dlib.cnn_face_detection_model_v1(paths_factory.mmod_human_face_detector_path())
|
||||||
else:
|
else:
|
||||||
face_detector = dlib.get_frontal_face_detector()
|
face_detector = dlib.get_frontal_face_detector()
|
||||||
|
|
||||||
pose_predictor = dlib.shape_predictor(str(paths_factory.shape_predictor_5_face_landmarks_path()))
|
pose_predictor = dlib.shape_predictor(paths_factory.shape_predictor_5_face_landmarks_path())
|
||||||
face_encoder = dlib.face_recognition_model_v1(str(paths_factory.dlib_face_recognition_resnet_model_v1_path()))
|
face_encoder = dlib.face_recognition_model_v1(paths_factory.dlib_face_recognition_resnet_model_v1_path())
|
||||||
|
|
||||||
user = builtins.howdy_user
|
user = builtins.howdy_user
|
||||||
# The permanent file to store the encoded model in
|
# The permanent file to store the encoded model in
|
||||||
enc_file = str(paths_factory.user_model_path(user))
|
enc_file = paths_factory.user_model_path(user)
|
||||||
# Known encodings
|
# Known encodings
|
||||||
encodings = []
|
encodings = []
|
||||||
|
|
||||||
|
|
|
@ -57,13 +57,13 @@ use_cnn = config.getboolean('core', 'use_cnn', fallback=False)
|
||||||
|
|
||||||
if use_cnn:
|
if use_cnn:
|
||||||
face_detector = dlib.cnn_face_detection_model_v1(
|
face_detector = dlib.cnn_face_detection_model_v1(
|
||||||
str(paths_factory.mmod_human_face_detector_path())
|
paths_factory.mmod_human_face_detector_path()
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
face_detector = dlib.get_frontal_face_detector()
|
face_detector = dlib.get_frontal_face_detector()
|
||||||
|
|
||||||
pose_predictor = dlib.shape_predictor(str(paths_factory.shape_predictor_5_face_landmarks_path()))
|
pose_predictor = dlib.shape_predictor(paths_factory.shape_predictor_5_face_landmarks_path())
|
||||||
face_encoder = dlib.face_recognition_model_v1(str(paths_factory.dlib_face_recognition_resnet_model_v1_path()))
|
face_encoder = dlib.face_recognition_model_v1(paths_factory.dlib_face_recognition_resnet_model_v1_path())
|
||||||
|
|
||||||
encodings = []
|
encodings = []
|
||||||
models = None
|
models = None
|
||||||
|
|
|
@ -45,7 +45,7 @@ def init_detector(lock):
|
||||||
global face_detector, pose_predictor, face_encoder
|
global face_detector, pose_predictor, face_encoder
|
||||||
|
|
||||||
# Test if at lest 1 of the data files is there and abort if it's not
|
# Test if at lest 1 of the data files is there and abort if it's not
|
||||||
if not os.path.isfile(str(paths_factory.shape_predictor_5_face_landmarks_path())):
|
if not os.path.isfile(paths_factory.shape_predictor_5_face_landmarks_path()):
|
||||||
print(_("Data files have not been downloaded, please run the following commands:"))
|
print(_("Data files have not been downloaded, please run the following commands:"))
|
||||||
print("\n\tcd " + paths_factory.dlib_data_dir_path())
|
print("\n\tcd " + paths_factory.dlib_data_dir_path())
|
||||||
print("\tsudo ./install.sh\n")
|
print("\tsudo ./install.sh\n")
|
||||||
|
@ -54,13 +54,13 @@ def init_detector(lock):
|
||||||
|
|
||||||
# Use the CNN detector if enabled
|
# Use the CNN detector if enabled
|
||||||
if use_cnn:
|
if use_cnn:
|
||||||
face_detector = dlib.cnn_face_detection_model_v1(str(paths_factory.mmod_human_face_detector_path()))
|
face_detector = dlib.cnn_face_detection_model_v1(paths_factory.mmod_human_face_detector_path())
|
||||||
else:
|
else:
|
||||||
face_detector = dlib.get_frontal_face_detector()
|
face_detector = dlib.get_frontal_face_detector()
|
||||||
|
|
||||||
# Start the others regardless
|
# Start the others regardless
|
||||||
pose_predictor = dlib.shape_predictor(str(paths_factory.shape_predictor_5_face_landmarks_path()))
|
pose_predictor = dlib.shape_predictor(paths_factory.shape_predictor_5_face_landmarks_path())
|
||||||
face_encoder = dlib.face_recognition_model_v1(str(paths_factory.dlib_face_recognition_resnet_model_v1_path()))
|
face_encoder = dlib.face_recognition_model_v1(paths_factory.dlib_face_recognition_resnet_model_v1_path())
|
||||||
|
|
||||||
# Note the time it took to initialize detectors
|
# Note the time it took to initialize detectors
|
||||||
timings["ll"] = time.time() - timings["ll"]
|
timings["ll"] = time.time() - timings["ll"]
|
||||||
|
|
|
@ -10,8 +10,7 @@ subdir('po')
|
||||||
paths_h = configure_file(
|
paths_h = configure_file(
|
||||||
input: 'paths.hh.in',
|
input: 'paths.hh.in',
|
||||||
output: 'paths.hh',
|
output: 'paths.hh',
|
||||||
configuration: pam_module_conf_data,
|
configuration: pam_module_conf_data
|
||||||
install_dir: get_option('pam_dir')
|
|
||||||
)
|
)
|
||||||
|
|
||||||
pamdir = get_option('pam_dir') != '' ? get_option('pam_dir') : join_paths(get_option('prefix'), get_option('libdir'), 'security')
|
pamdir = get_option('pam_dir') != '' ? get_option('pam_dir') : join_paths(get_option('prefix'), get_option('libdir'), 'security')
|
||||||
|
|
|
@ -30,7 +30,7 @@ def generate(frames, text_lines):
|
||||||
# Add the Howdy logo if there's space to do so
|
# Add the Howdy logo if there's space to do so
|
||||||
if len(frames) > 1:
|
if len(frames) > 1:
|
||||||
# Load the logo from file
|
# Load the logo from file
|
||||||
logo = cv2.imread(str(paths_factory.logo_path()))
|
logo = cv2.imread(paths_factory.logo_path())
|
||||||
# Calculate the position of the logo
|
# Calculate the position of the logo
|
||||||
logo_y = frame_height + 20
|
logo_y = frame_height + 20
|
||||||
logo_x = frame_width * len(frames) - 210
|
logo_x = frame_width * len(frames) - 210
|
||||||
|
@ -54,7 +54,7 @@ def generate(frames, text_lines):
|
||||||
|
|
||||||
# Generate a filename based on the current time
|
# Generate a filename based on the current time
|
||||||
filename = datetime.datetime.utcnow().strftime("%Y%m%dT%H%M%S.jpg")
|
filename = datetime.datetime.utcnow().strftime("%Y%m%dT%H%M%S.jpg")
|
||||||
filepath = str(paths_factory.snapshot_path(filename))
|
filepath = paths_factory.snapshot_path(filename)
|
||||||
# Write the image to that file
|
# Write the image to that file
|
||||||
cv2.imwrite(filepath, snap)
|
cv2.imwrite(filepath, snap)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue