Skip to content

Commit cbc2dae

Browse files
committed
fix filter/ model output
1 parent eaadd07 commit cbc2dae

File tree

2 files changed

+9
-17
lines changed

2 files changed

+9
-17
lines changed

BabbleApp/babble_model_loader.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,6 @@
1515

1616
def run_model(self):
1717

18-
19-
20-
min_cutoff = float(self.settings.gui_min_cutoff) #15.5004
21-
beta = float(self.settings.gui_speed_coefficient) #0.62
22-
noisy_point = np.array([45])
23-
filter = OneEuroFilter(
24-
noisy_point,
25-
min_cutoff=min_cutoff,
26-
beta=beta
27-
)
28-
2918
frame = cv2.resize(self.current_image_gray, (256, 256))
3019
# make it pil
3120
frame = Image.fromarray(frame)
@@ -42,7 +31,8 @@ def run_model(self):
4231
#end = time.time()
4332
output = out[0]
4433
output = output[0]
45-
output = filter(output)
34+
output = self.one_euro_filter(output)
4635
for i in range(len(output)): # Clip values between 0 - 1
4736
output[i] = max(min(output[i], 1), 0)
37+
print(output)
4838
self.output = output

BabbleApp/babble_processor.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
from babble_model_loader import *
2020
import os
2121
os.environ["OMP_NUM_THREADS"] = "1"
22+
import onnxruntime as ort
23+
2224
def run_once(f):
2325
def wrapper(*args, **kwargs):
2426
if not wrapper.has_run:
@@ -95,13 +97,13 @@ def __init__(
9597

9698

9799
try:
98-
min_cutoff = float(self.settings.gui_min_cutoff) # 0.0004
99-
beta = float(self.settings.gui_speed_coefficient) # 0.9
100+
min_cutoff = float(self.settings.gui_min_cutoff) # 15.5004
101+
beta = float(self.settings.gui_speed_coefficient) # 0.62
100102
except:
101103
print('\033[93m[WARN] OneEuroFilter values must be a legal number.\033[0m')
102-
min_cutoff = 0.0004
103-
beta = 0.9
104-
noisy_point = np.array([1, 1])
104+
min_cutoff = 15.0004
105+
beta = 0.62
106+
noisy_point = np.array([45])
105107
self.one_euro_filter = OneEuroFilter(
106108
noisy_point,
107109
min_cutoff=min_cutoff,

0 commit comments

Comments
 (0)