fix algo priority, placement

This commit is contained in:
RedHawk989 2023-08-10 20:42:19 -05:00
parent 5198cddd8f
commit abf7f88ae5

View File

@ -5,6 +5,7 @@ from osc import EyeId
from queue import Queue from queue import Queue
from threading import Event from threading import Event
class AlgoSettingsWidget: class AlgoSettingsWidget:
def __init__(self, widget_id: EyeId, main_config: EyeTrackSettingsConfig, osc_queue: Queue): def __init__(self, widget_id: EyeId, main_config: EyeTrackSettingsConfig, osc_queue: Queue):
@ -59,22 +60,21 @@ class AlgoSettingsWidget:
# Define the window's contents # Define the window's contents
self.general_settings_layout = [ self.general_settings_layout = [
[sg.Checkbox( [sg.Checkbox(
"", "",
default=self.config.gui_HSRAC, default=self.config.gui_HSRAC,
key=self.gui_HSRAC, key=self.gui_HSRAC,
background_color='#424042', background_color='#424042',
tooltip = "Our flagship algoritim, utilizing both HSF and RANSAC for best tracking quality and lighting resistance.", tooltip="Our flagship algoritim, utilizing both HSF and RANSAC for best tracking quality and lighting resistance.",
), ),
sg.Combo(['1','2','3','4'], sg.Combo(['1', '2', '3', '4', '5', '6'],
default_value=self.config.gui_HSRACP, default_value=self.config.gui_HSRACP,
key=self.gui_HSRACP, key=self.gui_HSRACP,
background_color='#424042', background_color='#424042',
text_color='white', text_color='white',
button_arrow_color= "black", button_arrow_color="black",
button_background_color = "#6f4ca1", button_background_color="#6f4ca1",
tooltip = "Select the priority of eyetracking algorithims.", tooltip="Select the priority of eyetracking algorithims.",
), ),
sg.Text("HSRAC", background_color='#424042'), sg.Text("HSRAC", background_color='#424042'),
# ], # ],
@ -84,16 +84,16 @@ class AlgoSettingsWidget:
default=self.config.gui_HSF, default=self.config.gui_HSF,
key=self.gui_HSF, key=self.gui_HSF,
background_color='#424042', background_color='#424042',
tooltip = "HSF Is a new, lower resolution tracking algorithim that provides excelent resilancy to lighting conditions and great speed.", tooltip="HSF Is a new, lower resolution tracking algorithim that provides excelent resilancy to lighting conditions and great speed.",
), ),
sg.Combo(['1','2','3','4','5'], sg.Combo(['1', '2', '3', '4', '5', '6'],
default_value=self.config.gui_HSFP, default_value=self.config.gui_HSFP,
key=self.gui_HSFP, key=self.gui_HSFP,
background_color='#424042', background_color='#424042',
text_color='white', text_color='white',
button_arrow_color= "black", button_arrow_color="black",
button_background_color = "#6f4ca1", button_background_color="#6f4ca1",
tooltip = "Select the priority of eyetracking algorithims.", tooltip="Select the priority of eyetracking algorithims.",
), ),
sg.Text("Haar Surround Feature", background_color='#424042'), sg.Text("Haar Surround Feature", background_color='#424042'),
], ],
@ -102,16 +102,16 @@ class AlgoSettingsWidget:
default=self.config.gui_DADDY, default=self.config.gui_DADDY,
key=self.gui_DADDY, key=self.gui_DADDY,
background_color='#424042', background_color='#424042',
tooltip = "DADDY Uses a Deep learning algorithm. This has a big CPU usage impact.", tooltip="DADDY Uses a Deep learning algorithm. This has a big CPU usage impact.",
), ),
sg.Combo(['1','2','3','4','5'], sg.Combo(['1', '2', '3', '4', '5', '6'],
default_value=self.config.gui_DADDYP, default_value=self.config.gui_DADDYP,
key=self.gui_DADDYP, key=self.gui_DADDYP,
background_color='#424042', background_color='#424042',
text_color='white', text_color='white',
button_arrow_color= "black", button_arrow_color="black",
button_background_color = "#6f4ca1", button_background_color="#6f4ca1",
tooltip = "Select the priority of eyetracking algorithims.", tooltip="Select the priority of eyetracking algorithims.",
), ),
sg.Text("DADDY", background_color='#424042'), sg.Text("DADDY", background_color='#424042'),
# ], # ],
@ -121,16 +121,16 @@ class AlgoSettingsWidget:
default=self.config.gui_RANSAC3D, default=self.config.gui_RANSAC3D,
key=self.gui_RANSAC3D, key=self.gui_RANSAC3D,
background_color='#424042', background_color='#424042',
tooltip = "RANSAC3D provides good tracking quality, however does not do well in bad lighting conditions.", tooltip="RANSAC3D provides good tracking quality, however does not do well in bad lighting conditions.",
), ),
sg.Combo(['1','2','3','4','5'], sg.Combo(['1', '2', '3', '4', '5', '6'],
default_value=self.config.gui_RANSAC3DP, default_value=self.config.gui_RANSAC3DP,
key=self.gui_RANSAC3DP, key=self.gui_RANSAC3DP,
background_color='#424042', background_color='#424042',
text_color='white', text_color='white',
button_arrow_color= "black", button_arrow_color="black",
button_background_color = "#6f4ca1", button_background_color="#6f4ca1",
tooltip = "Select the priority of eyetracking algorithims.", tooltip="Select the priority of eyetracking algorithims.",
), ),
sg.Text("RANSAC 3D", background_color='#424042'), sg.Text("RANSAC 3D", background_color='#424042'),
], ],
@ -142,7 +142,7 @@ class AlgoSettingsWidget:
background_color='#424042', background_color='#424042',
tooltip="LEAP Uses a lightweight deep learning algorithm.", tooltip="LEAP Uses a lightweight deep learning algorithm.",
), ),
sg.Combo(['1', '2', '3', '4', '5'], sg.Combo(['1', '2', '3', '4', '5', '6'],
default_value=self.config.gui_LEAPP, default_value=self.config.gui_LEAPP,
key=self.gui_LEAPP, key=self.gui_LEAPP,
background_color='#424042', background_color='#424042',
@ -158,16 +158,16 @@ class AlgoSettingsWidget:
default=self.config.gui_BLOB, default=self.config.gui_BLOB,
key=self.gui_BLOB, key=self.gui_BLOB,
background_color='#424042', background_color='#424042',
tooltip = "Blob tracking is the oldest and worst tracking algorithm, it provides fast, though sometimes innaccurate tracking.", tooltip="Blob tracking is the oldest and worst tracking algorithm, it provides fast, though sometimes innaccurate tracking.",
), ),
sg.Combo(['1','2','3','4','5'], sg.Combo(['1', '2', '3', '4', '5', '6'],
default_value=self.config.gui_BLOBP, default_value=self.config.gui_BLOBP,
key=self.gui_BLOBP, key=self.gui_BLOBP,
background_color='#424042', background_color='#424042',
text_color='white', text_color='white',
button_arrow_color= "black", button_arrow_color="black",
button_background_color = "#6f4ca1", button_background_color="#6f4ca1",
tooltip = "Select the priority of eyetracking algorithims.", tooltip="Select the priority of eyetracking algorithims.",
), ),
sg.Text("Blob", background_color='#424042'), sg.Text("Blob", background_color='#424042'),
], ],
@ -194,27 +194,26 @@ class AlgoSettingsWidget:
background_color='#424042', background_color='#424042',
), ),
], ],
[ [
sg.Text("IBO Filter Sample Size", background_color='#424042'), sg.Text("IBO Filter Sample Size", background_color='#424042'),
sg.InputText( sg.InputText(
self.config.ibo_filter_samples, self.config.ibo_filter_samples,
key=self.ibo_filter_samples, key=self.ibo_filter_samples,
size=(0,10), size=(0, 10),
), ),
sg.Text("Calibration Samples", background_color='#424042'), sg.Text("Calibration Samples", background_color='#424042'),
sg.InputText( sg.InputText(
self.config.calibration_samples, self.config.calibration_samples,
key=self.calibration_samples, key=self.calibration_samples,
size=(0,10), size=(0, 10),
), ),
sg.Text("IBO Close Threshold", background_color='#424042'), sg.Text("IBO Close Threshold", background_color='#424042'),
sg.InputText( sg.InputText(
self.config.ibo_fully_close_eye_threshold, self.config.ibo_fully_close_eye_threshold,
key=self.ibo_fully_close_eye_threshold, key=self.ibo_fully_close_eye_threshold,
size=(0,10), size=(0, 10),
), ),
], ],
[ [
@ -239,7 +238,7 @@ class AlgoSettingsWidget:
default=self.config.gui_skip_autoradius, default=self.config.gui_skip_autoradius,
key=self.gui_skip_autoradius, key=self.gui_skip_autoradius,
background_color='#424042', background_color='#424042',
tooltip = "To gain more control and possibly better tracking quality of HSF, please disable auto radius to enable manual adjustment.", tooltip="To gain more control and possibly better tracking quality of HSF, please disable auto radius to enable manual adjustment.",
), ),
], ],
[ [
@ -250,10 +249,8 @@ class AlgoSettingsWidget:
orientation="h", orientation="h",
key=self.gui_HSF_radius_left, key=self.gui_HSF_radius_left,
background_color='#424042', background_color='#424042',
tooltip = "Adjusts the radius paramater for HSF. Only adjust if you are having tracking issues.", tooltip="Adjusts the radius paramater for HSF. Only adjust if you are having tracking issues.",
), ),
],
[
sg.Text("Right HSF Radius:", background_color='#424042'), sg.Text("Right HSF Radius:", background_color='#424042'),
sg.Slider( sg.Slider(
range=(1, 50), range=(1, 50),
@ -272,18 +269,17 @@ class AlgoSettingsWidget:
orientation="h", orientation="h",
key=self.gui_thresh_add, key=self.gui_thresh_add,
background_color='#424042', background_color='#424042',
tooltip = "Adjusts the ammount of threshold to add to RANSAC. Usefull for fine tuning your setup.", tooltip="Adjusts the ammount of threshold to add to RANSAC. Usefull for fine tuning your setup.",
), ),
# ], sg.Text("Blob Threshold", background_color='#424042'),
# [ # TODO make this for right and left eyes? I dont know how vital that is..
sg.Text("Blob Threshold", background_color='#424042'), #TODO make this for right and left eyes? I dont know how vital that is..
sg.Slider( sg.Slider(
range=(0, 110), range=(0, 110),
default_value=self.config.gui_threshold, default_value=self.config.gui_threshold,
orientation="h", orientation="h",
key=self.gui_threshold_slider, key=self.gui_threshold_slider,
background_color='#424042', background_color='#424042',
tooltip = "Adjusts the threshold for blob tracking.", tooltip="Adjusts the threshold for blob tracking.",
), ),
], ],
[sg.Text("Min Blob Size:", background_color='#424042'), [sg.Text("Min Blob Size:", background_color='#424042'),
@ -293,7 +289,7 @@ class AlgoSettingsWidget:
orientation="h", orientation="h",
key=self.gui_blob_minsize, key=self.gui_blob_minsize,
background_color='#424042', background_color='#424042',
tooltip = "Minimun size a blob has to be for blob tracking.", tooltip="Minimun size a blob has to be for blob tracking.",
), ),
sg.Text("Max Blob Size:", background_color='#424042'), sg.Text("Max Blob Size:", background_color='#424042'),
@ -303,21 +299,20 @@ class AlgoSettingsWidget:
orientation="h", orientation="h",
key=self.gui_blob_maxsize, key=self.gui_blob_maxsize,
background_color='#424042', background_color='#424042',
tooltip = "Maximum size a blob can be for blob tracking.", tooltip="Maximum size a blob can be for blob tracking.",
), ),
], ],
] ]
self.widget_layout = [ self.widget_layout = [
[ [
sg.Text("Tracking Algorithm Order Settings:", background_color='#242224'), sg.Text("Tracking Algorithm Order Settings:", background_color='#242224'),
], ],
[ [
sg.Column(self.general_settings_layout, key=self.gui_general_settings_layout, background_color='#424042' ), sg.Column(self.general_settings_layout, key=self.gui_general_settings_layout,
background_color='#424042'),
], ],
] ]
@ -325,7 +320,6 @@ class AlgoSettingsWidget:
self.cancellation_event.set() self.cancellation_event.set()
self.image_queue = Queue() self.image_queue = Queue()
def started(self): def started(self):
return not self.cancellation_event.is_set() return not self.cancellation_event.is_set()
@ -361,7 +355,8 @@ class AlgoSettingsWidget:
self.config.gui_DADDY = values[self.gui_DADDY] self.config.gui_DADDY = values[self.gui_DADDY]
changed = True changed = True
if self.config.gui_RANSAC3DP != int(values[self.gui_RANSAC3DP]): #TODO check that priority order is unique/auto fix it. if self.config.gui_RANSAC3DP != int(
values[self.gui_RANSAC3DP]): # TODO check that priority order is unique/auto fix it.
self.config.gui_RANSAC3DP = int(values[self.gui_RANSAC3DP]) self.config.gui_RANSAC3DP = int(values[self.gui_RANSAC3DP])
changed = True changed = True
@ -385,7 +380,6 @@ class AlgoSettingsWidget:
self.config.gui_LEAP = values[self.gui_LEAP] self.config.gui_LEAP = values[self.gui_LEAP]
changed = True changed = True
if self.config.gui_skip_autoradius != values[self.gui_skip_autoradius]: if self.config.gui_skip_autoradius != values[self.gui_skip_autoradius]:
self.config.gui_skip_autoradius = values[self.gui_skip_autoradius] self.config.gui_skip_autoradius = values[self.gui_skip_autoradius]
changed = True changed = True
@ -452,5 +446,5 @@ class AlgoSettingsWidget:
if changed: if changed:
self.main_config.save() self.main_config.save()
#print(self.main_config) # print(self.main_config)
self.osc_queue.put(EyeId.ALGOSETTINGS) self.osc_queue.put(EyeId.ALGOSETTINGS)