fixed a bug that caused my eye_open to not work after making the older version work

added arguments for numpy threads and landmark detection threads
This commit is contained in:
Cowwan 2024-02-06 10:04:19 -05:00
parent 76390857f8
commit fd930f0d67
2 changed files with 8 additions and 4 deletions

View file

@ -2,7 +2,7 @@
import os import os
#limits the threads used by numpy to 1 #limits the threads used by numpy to 1
#setting this and the landmarks model to use 1 means the cpu usage is pretty low #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 argparse
import traceback import traceback
import threading 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("--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("--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("--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() args = parser.parse_args()
os.environ["OMP_NUM_THREADS"] = str(args.landmark_detection_threads)
def messaging(messageQueue): def messaging(messageQueue):
while True: while True:
message = messageQueue.get() message = messageQueue.get()

View file

@ -77,10 +77,10 @@ class FeatureExtractor():
f_pts = self.align_points(pts[42], pts[45], pts[[43, 44, 47, 46]]) 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) 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_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) 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 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) features["eyebrow_updown_l"] = self.eyebrow_updown_l.update(f)