diff --git a/.gitignore b/.gitignore index 3d27eb8..ad93e9e 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ BabbleApp/dist scripts/example_build_app_and_installer.bat scripts/example_build_app_and_installer.bat scripts/installer.iss +Glia_cap.py diff --git a/BabbleApp/Models/ENEXTXXE100/onnx/model.onnx b/BabbleApp/Models/ENEXTXXE100/onnx/model.onnx new file mode 100644 index 0000000..407f2a8 Binary files /dev/null and b/BabbleApp/Models/ENEXTXXE100/onnx/model.onnx differ diff --git a/BabbleApp/algo_settings_widget.py b/BabbleApp/algo_settings_widget.py index d7bf686..a6e9ed3 100644 --- a/BabbleApp/algo_settings_widget.py +++ b/BabbleApp/algo_settings_widget.py @@ -5,6 +5,7 @@ from osc import Tab from queue import Queue from threading import Event + class AlgoSettingsWidget: def __init__(self, widget_id: Tab, main_config: BabbleSettingsConfig, osc_queue: Queue): @@ -21,6 +22,7 @@ class AlgoSettingsWidget: self.main_config = main_config self.config = main_config.settings self.osc_queue = osc_queue + self.backend_list = "OpenVino", "ONNX" # Define the window's contents self.general_settings_layout = [ @@ -41,12 +43,19 @@ class AlgoSettingsWidget: ), ], [sg.Text("Backend:", background_color='#424042'), # Replace with Dropdown once I have internet to view docs. - sg.InputText( + sg.OptionMenu( + self.backend_list, self.config.gui_backend, key=self.gui_backend, - size=(4), - tooltip = "Method to run the model.", - ), + ), + #sg.InputText( + # self.config.gui_backend, + # key=self.gui_backend, + # size=(4), + # tooltip = "Method to run the model.", + + #), + sg.Text("GPU Index:", background_color='#424042'), # Replace with Dropdown once I have internet to view docs. sg.InputText( self.config.gui_gpu_index, @@ -54,6 +63,7 @@ class AlgoSettingsWidget: size=(4), tooltip = "Select which device to run inference.", ), + sg.Checkbox( "Use GPU", default=self.config.gui_use_gpu, @@ -144,8 +154,8 @@ class AlgoSettingsWidget: self.config.gui_gpu_index = int(values[self.gui_gpu_index]) changed = True - if self.config.gui_backend != int(values[self.gui_backend]): - self.config.gui_backend = int(values[self.gui_backend]) + if self.config.gui_backend != str(values[self.gui_backend]): + self.config.gui_backend = str(values[self.gui_backend]) changed = True if self.config.gui_inference_threads != int(values[self.gui_inference_threads]): diff --git a/BabbleApp/babble_model_loader.py b/BabbleApp/babble_model_loader.py index 4f1225b..9017108 100644 --- a/BabbleApp/babble_model_loader.py +++ b/BabbleApp/babble_model_loader.py @@ -16,7 +16,7 @@ from one_euro_filter import OneEuroFilter def run_model(self): - if self.backend == 0: + if self.backend == "OpenVino": frame = cv2.resize(self.current_image_gray, (256, 256)) # make it pil frame = Image.fromarray(frame) @@ -38,7 +38,7 @@ def run_model(self): output[i] = max(min(output[i], 1), 0) self.output = output - if self.backend == 1: + if self.backend == "ONNX": frame = cv2.resize(self.current_image_gray, (256, 256)) # make it pil frame = Image.fromarray(frame) diff --git a/BabbleApp/babble_processor.py b/BabbleApp/babble_processor.py index 8ababcc..7a1658e 100644 --- a/BabbleApp/babble_processor.py +++ b/BabbleApp/babble_processor.py @@ -90,15 +90,15 @@ class BabbleProcessor: self.opts.intra_op_num_threads = settings.gui_inference_threads self.opts.inter_op_num_threads = settings.gui_inference_threads # Figure out how to set openvino threads self.opts.graph_optimization_level = ort.GraphOptimizationLevel.ORT_ENABLE_ALL - if self.backend == 0: # OpenVino - if self.use_gpu: provider = f'GPU{self.gpu_index}' + if self.backend == "OpenVino": # OpenVino + if self.use_gpu: provider = f'GPU.{self.gpu_index}' else: provider = 'CPU' ie = IECore() net = ie.read_network(model=f'{self.model}openvino/model.xml', weights=f'{self.model}openvino/model.bin') self.sess = ie.load_network(network=net, device_name=provider) self.input_name = next(iter(net.input_info)) self.output_name = next(iter(net.outputs)) - if self.backend == 1: # ONNX + if self.backend == "ONNX": # ONNX if self.use_gpu: provider = 'DmlExecutionProvider' # Figure out how to set ONNX gpu index else: provider = "CPUExecutionProvider" self.sess = ort.InferenceSession(f'{self.model}onnx/model.onnx', self.opts, providers=[provider]) diff --git a/BabbleApp/config.py b/BabbleApp/config.py index 57384e6..92f1452 100644 --- a/BabbleApp/config.py +++ b/BabbleApp/config.py @@ -33,12 +33,12 @@ class BabbleSettingsConfig(BaseModel): gui_osc_location: str = "" gui_multiply: int = 1 gui_model_file: str = 'Models/MOS3E26MCJPEG/' - gui_backend: int = 0 + gui_backend: str = "OpenVino" gui_use_gpu: bool = False gui_gpu_index: int = 0 gui_inference_threads: int = 1 gui_use_red_channel: bool = False - calib_array: str = "" + calib_array: str = "[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]]" gui_cam_resolution_x: int = 0 gui_cam_resolution_y: int = 0 gui_cam_framerate: int = 0 diff --git a/pyproject.toml b/pyproject.toml index 4a7b541..0a0231d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,6 +21,7 @@ winotify = [ onnxruntime = "^1.13.1" onnxruntime-directml = "^1.15.0" openvino = "^2023.0.1" + colorama = "^0.4.6" taskipy = "^1.10.4" torch = [