Skip to content

Commit e21c321

Browse files
Bugfixes and version Increment
Loading an incorrect model path will cause the app to load the default model rather than crash on startup. Incremented the app version from 2.0.6 Alpha to 2.1.0 Beta.
1 parent 56b1528 commit e21c321

File tree

8 files changed

+27
-8
lines changed

8 files changed

+27
-8
lines changed

BabbleApp/Locale/English/locale.json

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"error.size": "Size of frames to display are of unequal sizes",
3838
"error.capture": "Frame capture issue detected",
3939
"error.winmm": "Failed to load winmm",
40+
"error.modelLoad": "Failed to load model:",
4041
"warn.frameDrop": "Frame drop. Corrupted JPEG",
4142
"warn.captureProblem": "Capture source problem, assuming camera disconnected, waiting for reconnect",
4243
"warn.serialCapture": "Serial capture source problem, assuming camera disconnected, waiting for reconnect",

BabbleApp/Locale/Español/locale.json

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"error.size": "Los tamaños de los fotogramas para mostrar son de dimensiones desiguales",
3838
"error.capture": "Detectado problema en la captura de fotogramas",
3939
"error.winmm": "Error al cargar winmm",
40+
"error.modelLoad": "Error al cargar Modelo:",
4041
"warn.frameDrop": "Pérdida de fotogramas. JPEG dañado",
4142
"warn.captureProblem": "Problema con la fuente de captura, se asume que la cámara está desconectada, esperando reconexión",
4243
"warn.serialCapture": "Problema con la fuente de captura en serie, se asume que la cámara está desconectada, esperando reconexión",

BabbleApp/Locale/OwO/locale.json

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"error.size": "Size of frames to display are of unequal sizes",
3838
"error.capture": "Frame capture issue detected",
3939
"error.winmmDll": "Failed to load winmm",
40+
"error.modelLoad": "Failed to load model:",
4041
"warn.frameDrop": "Frame drop. Corrupted JPEG",
4142
"warn.captureProblem": "Capture source problem, assuming camera disconnected, waiting for reconnect",
4243
"warn.serialCapture": "Serial capture source problem, assuming camera disconnected, waiting for reconnect",

BabbleApp/Locale/Pirate Speak/locale.json

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"error.size": "Size of frames to display are of unequal sizes",
3838
"error.capture": "Frame capture issue detected",
3939
"error.winmmDll": "Failed to load winmm",
40+
"error.modelLoad": "Failed to load mdoel:",
4041
"warn.frameDrop": "Frame drop. Corrupted JPEG",
4142
"warn.captureProblem": "Capture source problem, assuming camera disconnected, waiting for reconnect",
4243
"warn.serialCapture": "Serial capture source problem, assuming camera disconnected, waiting for reconnect",

BabbleApp/algo_settings_widget.py

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ def __init__(
4141
size=(32),
4242
tooltip=f'{lang._instance.get_string("algorithm.modelFileTooptip")}.',
4343
),
44+
sg.FolderBrowse(),
4445
sg.Text(
4546
f'{lang._instance.get_string("algorithm.inferenceThreads")}:',
4647
background_color=bg_color_highlight,

BabbleApp/babble_processor.py

+20-6
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ def __init__(
8686
self.runtime = self.settings.gui_runtime
8787
self.use_gpu = self.settings.gui_use_gpu
8888
self.gpu_index = self.settings.gui_gpu_index
89+
config_default: BabbleConfig = BabbleConfig()
90+
self.default_model = config_default.settings.gui_model_file
8991
self.output = []
9092
self.val_list = []
9193
self.calibrate_config = np.empty((1, 45))
@@ -103,12 +105,24 @@ def __init__(
103105
provider = "DmlExecutionProvider"
104106
else:
105107
provider = "CPUExecutionProvider" # Build onnxruntime to get both DML and OpenVINO
106-
self.sess = ort.InferenceSession(
107-
f"{self.model}onnx/model.onnx",
108-
self.opts,
109-
providers=[provider],
110-
provider_options=[{"device_id": self.gpu_index}],
111-
)
108+
try:
109+
self.sess = ort.InferenceSession(
110+
f"{self.model}/onnx/model.onnx",
111+
self.opts,
112+
providers=[provider],
113+
provider_options=[{"device_id": self.gpu_index}],
114+
)
115+
except: # Load default model if we can't find the specified model
116+
print(
117+
f'\033[91m[{lang._instance.get_string("log.error")}] {lang._instance.get_string("error.modelLoad")} {self.model}\033[0m'
118+
)
119+
print(f'\033[91mLoading Default model: {self.default_model}.\033[0m')
120+
self.sess = ort.InferenceSession(
121+
f"{self.default_model}/onnx/model.onnx",
122+
self.opts,
123+
providers=[provider],
124+
provider_options=[{"device_id": self.gpu_index}],
125+
)
112126
self.input_name = self.sess.get_inputs()[0].name
113127
self.output_name = self.sess.get_outputs()[0].name
114128
try:

BabbleApp/babbleapp.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
CALIB_SETTINGS_RADIO_NAME = "-CALIBSETTINGSRADIO-"
5959

6060
page_url = "https://github.com/SummerSigh/ProjectBabble/releases/latest"
61-
appversion = "Babble v2.0.6 Alpha"
61+
appversion = "Babble v2.1.0 Beta"
6262

6363
def timerResolution(toggle):
6464
if winmm != None:

BabbleApp/config.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class BabbleSettingsConfig(BaseModel):
3535
gui_ROSC: bool = False
3636
gui_osc_location: str = ""
3737
gui_multiply: float = 1
38-
gui_model_file: str = "Models/3MEFFB0E7MSE/"
38+
gui_model_file: str = "Models/3MEFFB0E7MSE"
3939
gui_runtime: str = "ONNX"
4040
gui_use_gpu: bool = False
4141
gui_gpu_index: int = 0

0 commit comments

Comments
 (0)