feat: new LEAP model beta

This commit is contained in:
Prohurtz 2024-05-30 09:52:47 -05:00
parent fc8bbfc8db
commit cc780526b1
9 changed files with 41192 additions and 35 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 232 B

After

Width:  |  Height:  |  Size: 408 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 514 B

After

Width:  |  Height:  |  Size: 570 B

File diff suppressed because it is too large Load Diff

View File

@ -155,12 +155,12 @@ class CameraWidget:
button_color="#6f4ca1",
tooltip="Start eye calibration. Look all arround to all extreams without blinking until sound is heard.",
),
# sg.Button(
# "3D Calibration",
# key=self.gui_restart_3d_calibration,
# button_color="#6f4ca1",
# tooltip="Start 3d eye calibration, must have steamvr open and eyes in hmd",
# ),
sg.Button(
"3D Calibration",
key=self.gui_restart_3d_calibration,
button_color="#6f4ca1",
tooltip="Start 3d eye calibration, must have steamvr open and eyes in hmd",
),
sg.Button(
"Stop Calibration",
key=self.gui_stop_calibration,

View File

@ -4,7 +4,7 @@ import sys ; sys.setrecursionlimit(sys.getrecursionlimit() * 5)
block_cipher = None
resources=[("Audio/*", "Audio"), ("Images/*", "Images/"), ("Tools/*", "Tools/"), ("pye3d/refraction_models/*", "pye3d/refraction_models/"), ("Models/*", "Models/")]
resources=[("Audio/*", "Audio"), ("Images/*", "Images/"), ("pye3d/refraction_models/*", "pye3d/refraction_models/"), ("Models/*", "Models/")]
a = Analysis(
['eyetrackapp.py'],
@ -43,5 +43,5 @@ exe = EXE(
target_arch=None,
codesign_identity=None,
entitlements_file=None,
icon="Images/logo.ico",
)
icon="Images/logo.ico",
)

View File

@ -56,13 +56,19 @@ def run_model(input_queue, output_queue, session):
img_np = np.array(frame)
img_np = img_np.astype(np.float32) / 255.0
img_np = np.transpose(img_np, (2, 0, 1))
img_np = np.expand_dims(img_np, axis=0)
gray_img = 0.299 * img_np[:, :, 0] + 0.587 * img_np[:, :, 1] + 0.114 * img_np[:, :, 2]
# Add the channel and batch dimensions
gray_img = np.expand_dims(gray_img, axis=0) # Add channel dimension
img_np = np.expand_dims(gray_img, axis=0) # Add batch dimension
# img_np = np.transpose(img_np, (2, 0, 1))
# img_np = np.expand_dims(img_np, axis=0)
ort_inputs = {session.get_inputs()[0].name: img_np}
pre_landmark = session.run(None, ort_inputs)
pre_landmark = pre_landmark[1]
pre_landmark = np.reshape(pre_landmark, (12, 2))
# pre_landmark = pre_landmark[1]
# pre_landmark = np.reshape(pre_landmark, (12, 2))
pre_landmark = np.reshape(pre_landmark, (-1, 2))
output_queue.put((frame, pre_landmark))
@ -72,7 +78,7 @@ class LEAP_C(object):
# Config variables
self.num_threads = 4 # Number of python threads to use (using ~1 more than needed to achieve wanted fps yields lower cpu usage)
self.queue_max_size = 1 # Optimize for best CPU usage, Memory, and Latency. A maxsize is needed to not create a potential memory leak.
self.model_path = resource_path(models / 'leap123023.onnx')
self.model_path = resource_path(models / 'LEAP053024.onnx')
self.low_priority = (
False # set process priority to low (may cause issues when unfocusing? reported by one, not reproducable)
@ -171,26 +177,16 @@ class LEAP_C(object):
if not self.output_queue.empty():
frame, pre_landmark = self.output_queue.get()
pre_landmark = self.one_euro_filter(pre_landmark)
# pre_landmark = np.reshape(pre_landmark, (-1, 2))
# pre_landmark = self.one_euro_filter(pre_landmark)
for point in pre_landmark:
x, y = point
cv2.circle(imgvis, (int(x * img_width), int(y * img_height)), 2, (0, 0, 50), -1)
cv2.circle(
imgvis,
tuple(int(x * img_width) for x in pre_landmark[2]),
1,
(255, 255, 0),
-1,
)
x, y = (point*112).astype(int)
x, y = int(x), int(y) # Ensure x and y are integers
cv2.circle(imgvis, (int(x), int(y)), 2, (255, 255, 0), -1)
cv2.circle(
imgvis,
tuple(int(x * img_width) for x in pre_landmark[4]),
1,
(255, 255, 255),
-1,
)
x1, y1 = pre_landmark[1]
x2, y2 = pre_landmark[3]

View File

@ -250,7 +250,7 @@ class cal:
self.grab_3d_point = False
self.config.calibration_points.append((cx, cy, angle))
# print(self.config.calibration_points)
print(self.config.calibration_points)
# print("calib")

View File

@ -1,7 +1,7 @@
import numpy as np
import socket
import threading
import os
class TimeoutError(RuntimeError):
pass

View File

@ -37,8 +37,8 @@ Name: "english"; MessagesFile: "compiler:Default.isl"
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}";
[Files]
Source: "C:\Users\Prohurtz\PycharmProjects\EyeTrackVR\EyeTrackApp\dist\EyeTrackApp\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\Prohurtz\PycharmProjects\EyeTrackVR\EyeTrackApp\dist\EyeTrackApp\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "C:\Users\Prohurtz\PycharmProjects\EyeTrackVR\EyeTrackApp\dist\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\Prohurtz\PycharmProjects\EyeTrackVR\EyeTrackApp\dist\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Dirs]