Skip to content

Commit 8a9b82a

Browse files
committed
(feat) Big commit, read desc.
- Removed poetrty - Replaced PySimpleGUI with FreeSinmleGUI - Start of work incorporating L-GPL v4l lib - Make VFT not crash on MacOS - Incorporate GPU priority list - Refactor `is_nt` to be more cross platform friendly - Refactor `requirments.txt` to be more cross platform friendly Need to build and test VFT on Linux!
1 parent 2871e6d commit 8a9b82a

20 files changed

+118
-1093
lines changed

BabbleApp/algo_settings_widget.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import PySimpleGUI as sg
1+
import FreeSimpleGUI as sg
22
from config import BabbleSettingsConfig
33
from osc import Tab
44
from queue import Queue

BabbleApp/babble_model_loader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
os.environ["OMP_NUM_THREADS"] = "1"
55
import onnxruntime as ort
66
import time
7-
import PySimpleGUI as sg
7+
import FreeSimpleGUI as sg
88
import cv2
99
import numpy as np
1010
from pythonosc import udp_client

BabbleApp/babble_processor.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import cv2
1212
from enum import Enum
1313
from one_euro_filter import OneEuroFilter
14-
from utils.misc_utils import PlaySound, SND_FILENAME, SND_ASYNC
14+
from utils.misc_utils import playSound, SND_FILENAME, SND_ASYNC, onnx_providers
1515
import importlib
1616
from osc import Tab
1717
from osc_calibrate_filter import *
@@ -37,7 +37,7 @@ def wrapper(*args, **kwargs):
3737
async def delayed_setting_change(setting, value):
3838
await asyncio.sleep(5)
3939
setting = value
40-
PlaySound("Audio/completed.wav", SND_FILENAME | SND_ASYNC)
40+
playSound("Audio/completed.wav", SND_FILENAME | SND_ASYNC)
4141

4242

4343
class BabbleProcessor:
@@ -102,15 +102,14 @@ def __init__(
102102
self.opts.enable_mem_pattern = False
103103
if self.runtime in ("ONNX", "Default (ONNX)"): # ONNX
104104
if self.use_gpu:
105-
provider = "DmlExecutionProvider"
105+
provider = onnx_providers
106106
else:
107-
provider = "CPUExecutionProvider" # Build onnxruntime to get both DML and OpenVINO
107+
provider = [onnx_providers[-1]]
108108
try:
109109
self.sess = ort.InferenceSession(
110110
f"{self.model}/onnx/model.onnx",
111111
self.opts,
112-
providers=[provider],
113-
provider_options=[{"device_id": self.gpu_index}],
112+
providers=provider,
114113
)
115114
except: # Load default model if we can't find the specified model
116115
print(

BabbleApp/babbleapp.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"""
1818

1919
import os
20-
import PySimpleGUI as sg
20+
import FreeSimpleGUI as sg
2121
import queue
2222
import requests
2323
import threading
@@ -33,13 +33,13 @@
3333
from algo_settings_widget import AlgoSettingsWidget
3434
from calib_settings_widget import CalibSettingsWidget
3535
from notification_manager import NotificationManager
36-
from utils.misc_utils import EnsurePath, is_nt, bg_color_highlight, bg_color_clear
36+
from utils.misc_utils import ensurePath, os_type, bg_color_highlight, bg_color_clear
3737
from lang_manager import LocaleStringManager as lang
3838
from logger import setup_logging
3939

4040
winmm = None
4141

42-
if is_nt:
42+
if os_type == 'Windows':
4343
try:
4444
from ctypes import windll
4545
winmm = windll.winmm
@@ -99,7 +99,7 @@ async def check_for_updates(config, notification_manager):
9999
)
100100

101101
async def async_main():
102-
EnsurePath()
102+
ensurePath()
103103
setup_logging()
104104

105105
# Get Configuration

BabbleApp/calib_settings_widget.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import PySimpleGUI as sg
1+
import FreeSimpleGUI as sg
22

33
from config import BabbleSettingsConfig
44
from osc import Tab

BabbleApp/camera.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
from colorama import Fore
1515
from config import BabbleConfig, BabbleSettingsConfig
16-
from utils.misc_utils import get_camera_index_by_name, list_camera_names
16+
from utils.misc_utils import get_camera_index_by_name, list_camera_names, os_type
1717

1818
from vivefacialtracker.vivetracker import ViveTracker
1919
from vivefacialtracker.camera_controller import FTCameraController
@@ -324,7 +324,7 @@ def start_serial_connection(self, port):
324324
rate = 115200 if sys.platform == "darwin" else 3000000 # Higher baud rate not working on macOS
325325
conn = serial.Serial(baudrate=rate, port=port, xonxoff=False, dsrdtr=False, rtscts=False)
326326
# Set explicit buffer size for serial. This function is Windows only!
327-
if is_nt:
327+
if os_type == 'Windows':
328328
conn.set_buffer_size(rx_size=BUFFER_SIZE, tx_size=BUFFER_SIZE)
329329

330330
print(

BabbleApp/camera_widget.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
from collections import deque
22
from queue import Queue, Empty
33
from threading import Event, Thread
4-
import PySimpleGUI as sg
4+
import FreeSimpleGUI as sg
55
import cv2
66
from babble_processor import BabbleProcessor, CamInfoOrigin
77
from camera import Camera, CameraState, MAX_RESOLUTION
88
from config import BabbleConfig
99
from osc import Tab
1010
from utils.misc_utils import (
11-
PlaySound,
11+
playSound,
1212
SND_FILENAME,
1313
SND_ASYNC,
1414
list_camera_names,
@@ -441,7 +441,7 @@ def render(self, window, event, values):
441441
values[self.use_calibration] == True
442442
): # Don't start recording if the calibration filter is disabled.
443443
self.babble_cnn.calibration_frame_counter = 1500
444-
PlaySound("Audio/start.wav", SND_FILENAME | SND_ASYNC)
444+
playSound("Audio/start.wav", SND_FILENAME | SND_ASYNC)
445445

446446
if event == self.gui_stop_calibration:
447447
if (

BabbleApp/config.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import os.path
33
import shutil
44

5-
from utils.misc_utils import EnsurePath
5+
from utils.misc_utils import ensurePath
66
from tab import Tab
77
from pydantic import BaseModel
88
from typing import Union
@@ -64,7 +64,7 @@ class BabbleConfig(BaseModel):
6464

6565
@staticmethod
6666
def load():
67-
EnsurePath()
67+
ensurePath()
6868

6969
if not os.path.exists(CONFIG_FILE_NAME):
7070
return BabbleConfig()
@@ -84,7 +84,7 @@ def load():
8484
return load_config
8585

8686
def save(self):
87-
EnsurePath()
87+
ensurePath()
8888

8989
# make sure this is only called if there is a change
9090
if os.path.exists(CONFIG_FILE_NAME):

BabbleApp/general_settings_widget.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import PySimpleGUI as sg
1+
import FreeSimpleGUI as sg
22
from lang_manager import LocaleStringManager as lang
33
from config import BabbleSettingsConfig
44
from osc import Tab

BabbleApp/landmark_model_loader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
os.environ["OMP_NUM_THREADS"] = "1"
55
import onnxruntime as ort
66
import time
7-
import PySimpleGUI as sg
7+
import FreeSimpleGUI as sg
88
import cv2
99
import numpy as np
1010
from pythonosc import udp_client

0 commit comments

Comments
 (0)