From 28ac9e172ccedb8ef4c5d5b96db04c980b85c73a Mon Sep 17 00:00:00 2001 From: ehpersonal38 <103586016+ehpersonal38@users.noreply.github.com> Date: Sun, 15 Jan 2023 13:55:36 -0500 Subject: [PATCH] moderately consequential bug that has henceforth been extinguished --- scripts/server.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/scripts/server.py b/scripts/server.py index 28d37eb..34a10ca 100755 --- a/scripts/server.py +++ b/scripts/server.py @@ -52,7 +52,12 @@ with open(userDir + '/BirdNET-Pi/scripts/thisrun.txt', 'r') as f: this_run = f.readlines() audiofmt = "." + str(str(str([i for i in this_run if i.startswith('AUDIOFMT')]).split('=')[1]).split('\\')[0]) priv_thresh = float("." + str(str(str([i for i in this_run if i.startswith('PRIVACY_THRESHOLD')]).split('=')[1]).split('\\')[0])) / 10 - model = str(str(str([i for i in this_run if i.startswith('MODEL')]).split('=')[1]).split('\\')[0]) + try: + model = str(str(str([i for i in this_run if i.startswith('MODEL')]).split('=')[1]).split('\\')[0]) + sf_thresh = str(str(str([i for i in this_run if i.startswith('SF_THRESH')]).split('=')[1]).split('\\')[0]) + except Exception as e: + model = "BirdNET_6K_GLOBAL_MODEL" + sf_thresh = 0.5 def loadModel(): @@ -136,7 +141,7 @@ def explore(lat, lon, week): l_filter = predictFilter(lat, lon, week) # Apply threshold - l_filter = np.where(l_filter >= 0.03, l_filter, 0) + l_filter = np.where(l_filter >= sf_thresh, l_filter, 0) # Zip with labels l_filter = list(zip(l_filter, CLASSES)) @@ -150,7 +155,7 @@ def predictSpeciesList(lat, lon, week): l_filter = explore(lat, lon, week) for s in l_filter: - if s[0] >= 0.03: + if s[0] >= sf_thresh: PREDICTED_SPECIES_LIST.append(s[1]) def loadCustomSpeciesList(path):