mirror of
https://github.com/boltgolt/howdy.git
synced 2024-09-19 09:51:19 +02:00
one more detector init thread
This commit is contained in:
parent
62aabdf480
commit
4f11da686f
1 changed files with 14 additions and 8 deletions
|
@ -94,16 +94,19 @@ timings['ll'] = time.time()
|
||||||
import dlib
|
import dlib
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
|
face_detector = None
|
||||||
pose_predictor = None
|
pose_predictor = None
|
||||||
face_encoder = None
|
face_encoder = None
|
||||||
|
|
||||||
use_cnn = config.getboolean('core', 'use_cnn', fallback=False)
|
use_cnn = config.getboolean('core', 'use_cnn', fallback=False)
|
||||||
if use_cnn:
|
|
||||||
face_detector = dlib.cnn_face_detection_model_v1(
|
def init_detector():
|
||||||
PATH + '/dlib-data/mmod_human_face_detector.dat'
|
global face_detector
|
||||||
)
|
if use_cnn:
|
||||||
else:
|
face_detector = dlib.cnn_face_detection_model_v1(
|
||||||
face_detector = dlib.get_frontal_face_detector()
|
PATH + '/dlib-data/mmod_human_face_detector.dat'
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
face_detector = dlib.get_frontal_face_detector()
|
||||||
|
|
||||||
def init_predictor():
|
def init_predictor():
|
||||||
global pose_predictor
|
global pose_predictor
|
||||||
|
@ -120,12 +123,15 @@ def init_encoder():
|
||||||
|
|
||||||
init_thread1 = Thread(target=init_encoder)
|
init_thread1 = Thread(target=init_encoder)
|
||||||
init_thread2 = Thread(target=init_predictor)
|
init_thread2 = Thread(target=init_predictor)
|
||||||
|
init_thread3 = Thread(target=init_detector)
|
||||||
|
init_thread3.start()
|
||||||
init_thread1.start()
|
init_thread1.start()
|
||||||
init_thread2.start()
|
init_thread2.start()
|
||||||
|
|
||||||
|
init_thread3.join()
|
||||||
init_thread2.join()
|
init_thread2.join()
|
||||||
init_thread1.join()
|
init_thread1.join()
|
||||||
del init_thread1, init_thread2
|
del init_thread1, init_thread2, init_thread3
|
||||||
timings['ll'] = time.time() - timings['ll']
|
timings['ll'] = time.time() - timings['ll']
|
||||||
|
|
||||||
# Fetch the max frame height
|
# Fetch the max frame height
|
||||||
|
|
Loading…
Reference in a new issue