diff --git a/facetracker.py b/facetracker.py index 62e8a24..1625b28 100644 --- a/facetracker.py +++ b/facetracker.py @@ -2,7 +2,7 @@ import os #limits the threads used by numpy to 1 #setting this and the landmarks model to use 1 means the cpu usage is pretty low -os.environ["OMP_NUM_THREADS"] = str(1) + import argparse import traceback import threading @@ -32,10 +32,14 @@ parser.add_argument("-s", "--silent", type=int, help="Set this to 1 to prevent t parser.add_argument("--model", type=int, help="This can be used to select the tracking model. Higher numbers are models with better tracking quality, but slower speed, except for model 4, which is wink optimized.", default=3, choices=[0, 1, 2, 3, 4]) parser.add_argument("--preview", type=int, help="Preview the frames sent to the tracker", default=0) parser.add_argument("--feature-type", type=int, help="Sets which version of feature extraction is used. 0 is my new version that works well for me and allows for some customization, 1 is EmilianaVT's version aka, normal OpenSeeFace operation", default=0, choices=[0, 1]) +parser.add_argument("--numpy-threads", type=int, help="Numer of threads Numpy can use, doesn't seem to effect much", default=1) +parser.add_argument("--landmark-detection-threads", type=int, help="Numer of threads used for landmark detection. Default is 1 (~15ms per frame on my computer), 2 gets slightly faster frames (~10ms on my computer), more than 2 doesn't seem to help much", default=1) + + args = parser.parse_args() - +os.environ["OMP_NUM_THREADS"] = str(args.landmark_detection_threads) def messaging(messageQueue): while True: message = messageQueue.get() diff --git a/featureExtractor.py b/featureExtractor.py index 19b4ffb..cf47afd 100644 --- a/featureExtractor.py +++ b/featureExtractor.py @@ -77,10 +77,10 @@ class FeatureExtractor(): f_pts = self.align_points(pts[42], pts[45], pts[[43, 44, 47, 46]]) f = (f_pts[0][1]/2 + f_pts[1][1]/2) - (f_pts[2][1]/2 + f_pts[3][1]/2) - features["eye_l"] = -self.eye_l.update(f) + features["eye_l"] = -1 + self.eye_l.update(f) f_pts = self.align_points(pts[36], pts[39], pts[[37, 38, 41, 40]]) f = (f_pts[0][1]/2 + f_pts[1][1]/2) - (f_pts[2][1]/2 + f_pts[3][1]/2) - features["eye_r"] = -self.eye_r.update(f) + features["eye_r"] = -1 + self.eye_r.update(f) f = ((pts[22][1]/2 + pts[26][1]/2) - (pts[42][1]/2 + pts[45][1]/2))/norm_distance_y features["eyebrow_updown_l"] = self.eyebrow_updown_l.update(f)