Skip to content

Commit

Permalink
Potential specific confidence for confirmed species
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbelgium authored Sep 6, 2024
1 parent 6005d03 commit 01a2b93
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion scripts/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ def run_analysis(file):
global INCLUDE_LIST, EXCLUDE_LIST
INCLUDE_LIST = loadCustomSpeciesList(os.path.expanduser("~/BirdNET-Pi/include_species_list.txt"))
EXCLUDE_LIST = loadCustomSpeciesList(os.path.expanduser("~/BirdNET-Pi/exclude_species_list.txt"))
CONFIRMED_LIST = loadCustomSpeciesList(os.path.expanduser("~/BirdNET-Pi/confirmed_species_list.txt"))

conf = get_settings()

Expand All @@ -327,10 +328,17 @@ def run_analysis(file):
raw_detections = analyzeAudioData(audio_data, conf.getfloat('LATITUDE'), conf.getfloat('LONGITUDE'), file.week,
conf.getfloat('SENSITIVITY'), conf.getfloat('OVERLAP'))
confident_detections = []
default_confidence = conf.getfloat('CONFIDENCE')
try:
confirmed_confidence = conf.getfloat('CONFIDENCE_CONFIRMED')
except KeyError:
confirmed_confidence = default_confidence

for time_slot, entries in raw_detections.items():
log.info('%s-%s', time_slot, entries[0])
for entry in entries:
if entry[1] >= conf.getfloat('CONFIDENCE') and ((entry[0] in INCLUDE_LIST or len(INCLUDE_LIST) == 0)
confidence = confirmed_confidence if entry[0] in CONFIRMED_LIST else default_confidence
if entry[1] >= confidence and ((entry[0] in INCLUDE_LIST or len(INCLUDE_LIST) == 0)
and (entry[0] not in EXCLUDE_LIST or len(EXCLUDE_LIST) == 0)
and (entry[0] in PREDICTED_SPECIES_LIST
or len(PREDICTED_SPECIES_LIST) == 0)):
Expand Down

0 comments on commit 01a2b93

Please sign in to comment.