mirror of
https://github.com/Project-Babble/ProjectBabble.git
synced 2026-11-20 17:11:16 -08:00
Add thread settings
This commit is contained in:
1 parent
9c62fd32b6
commit
d7bcf8a4da
6 files changed
+22
-22
No files matched your search
@@ -15,6 +15,7 @@ class AlgoSettingsWidget:
|
||||
self.gui_use_gpu = f"USEGPU{widget_id}"
|
||||
self.gui_speed_coefficient = f"-SPEEDCOEFFICIENT{widget_id}-"
|
||||
self.gui_min_cutoff = f"-MINCUTOFF{widget_id}-"
|
||||
self.gui_inference_threads = f"-THREADS{widget_id}-"
|
||||
self.main_config = main_config
|
||||
self.config = main_config.settings
|
||||
self.osc_queue = osc_queue
|
||||
@@ -37,6 +38,13 @@ class AlgoSettingsWidget:
|
||||
background_color='#424042',
|
||||
tooltip="Toggle GPU execution.",
|
||||
),
|
||||
sg.Text("Inference Threads:", background_color='#424042'),
|
||||
sg.InputText(
|
||||
self.config.gui_inference_threads,
|
||||
key=self.gui_inference_threads,
|
||||
size=(4),
|
||||
tooltip = "How many threads to use for processing the model.",
|
||||
),
|
||||
],
|
||||
[sg.Text("Model output multiplier:", background_color='#424042'),
|
||||
sg.InputText(
|
||||
@@ -115,6 +123,10 @@ class AlgoSettingsWidget:
|
||||
if self.config.gui_use_gpu != values[self.gui_use_gpu]:
|
||||
self.config.gui_use_gpu = values[self.gui_use_gpu]
|
||||
changed = True
|
||||
|
||||
if self.config.gui_inference_threads != int(values[self.gui_inference_threads]):
|
||||
self.config.gui_inference_threads = int(values[self.gui_inference_threads])
|
||||
changed = True
|
||||
|
||||
if self.config.gui_min_cutoff != values[self.gui_min_cutoff]:
|
||||
self.config.gui_min_cutoff = values[self.gui_min_cutoff]
|
||||
|
||||
@@ -85,8 +85,8 @@ class BabbleProcessor:
|
||||
self.min_max_array = np.empty((2, 45))
|
||||
|
||||
self.opts = ort.SessionOptions()
|
||||
self.opts.intra_op_num_threads = 1
|
||||
self.opts.inter_op_num_threads = 1
|
||||
self.opts.intra_op_num_threads = settings.gui_inference_threads
|
||||
self.opts.inter_op_num_threads = settings.gui_inference_threads
|
||||
self.opts.graph_optimization_level = ort.GraphOptimizationLevel.ORT_ENABLE_ALL
|
||||
if not self.use_gpu:
|
||||
self.sess = ort.InferenceSession(self.model, self.opts, providers=['CPUExecutionProvider'])
|
||||
|
||||
@@ -34,6 +34,7 @@ class BabbleSettingsConfig(BaseModel):
|
||||
gui_multiply: int = 1
|
||||
gui_model_file: str = 'Models/EFV2300K45E100P2.onnx'
|
||||
gui_use_gpu: bool = False
|
||||
gui_inference_threads: int = 1
|
||||
calib_array: str = None
|
||||
gui_cam_resolution_x: int = 0
|
||||
gui_cam_resolution_y: int = 0
|
||||
|
||||
@@ -98,7 +98,7 @@ class SettingsWidget:
|
||||
),
|
||||
],
|
||||
[
|
||||
sg.Text("Camera Settings:", background_color='#242224'),
|
||||
sg.Text("UVC Camera Settings:", background_color='#242224'),
|
||||
],
|
||||
[
|
||||
sg.Text("X Resolution:", background_color='#424042'),
|
||||
@@ -214,16 +214,16 @@ class SettingsWidget:
|
||||
self.config.gui_osc_location = values[self.gui_osc_location]
|
||||
changed = True
|
||||
|
||||
if self.config.gui_cam_resolution_x != values[self.gui_cam_resolution_x]:
|
||||
self.config.gui_cam_resolution_x = values[self.gui_cam_resolution_x]
|
||||
if self.config.gui_cam_resolution_x != int(values[self.gui_cam_resolution_x]):
|
||||
self.config.gui_cam_resolution_x = int(values[self.gui_cam_resolution_x])
|
||||
changed = True
|
||||
|
||||
if self.config.gui_cam_resolution_y != values[self.gui_cam_resolution_y]:
|
||||
self.config.gui_cam_resolution_y = values[self.gui_cam_resolution_y]
|
||||
if self.config.gui_cam_resolution_y != int(values[self.gui_cam_resolution_y]):
|
||||
self.config.gui_cam_resolution_y = int(values[self.gui_cam_resolution_y])
|
||||
changed = True
|
||||
|
||||
if self.config.gui_cam_framerate != values[self.gui_cam_framerate]:
|
||||
self.config.gui_cam_framerate = values[self.gui_cam_framerate]
|
||||
if self.config.gui_cam_framerate != int(values[self.gui_cam_framerate]):
|
||||
self.config.gui_cam_framerate = int(values[self.gui_cam_framerate])
|
||||
changed = True
|
||||
|
||||
if changed:
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
{"version": 1, "cam": {"rotation_angle": 0, "roi_window_x": 0, "roi_window_y": 0, "roi_window_w": 0, "roi_window_h": 0, "capture_source": null, "use_calibration": false, "use_n_calibration": true, "gui_vertical_flip": false, "gui_horizontal_flip": false}, "settings": {"gui_min_cutoff": "15.5004", "gui_speed_coefficient": "0.62", "gui_osc_address": "127.0.0.1", "gui_osc_port": 8888, "gui_osc_receiver_port": 9001, "gui_osc_recalibrate_address": "/avatar/parameters/babble_recalibrate", "gui_update_check": true, "gui_ROSC": false, "gui_osc_location": "", "gui_multiply": 1, "gui_model_file": "Models/EFV2300K45E100P2.onnx", "gui_use_gpu": false, "calib_array": null, "gui_cam_resolution_x": 0, "gui_cam_resolution_y": 0, "gui_cam_framerate": 0}, "cam_display_id": 0}
|
||||
@@ -1,12 +0,0 @@
|
||||
import cv2
|
||||
|
||||
cap = cv2.VideoCapture(0)
|
||||
#cap.set(cv2.CAP_PROP_FRAME_WIDTH, 0)
|
||||
#cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 0)
|
||||
cap.set(cv2.CAP_PROP_FPS, 120)
|
||||
|
||||
while cap.isOpened():
|
||||
yeah, img = cap.read()
|
||||
cv2.imshow('win', img)
|
||||
if cv2.waitKey(1) & 0xFF == ord('q'):
|
||||
break
|
||||
Reference in new issue
Block a user