Feat : error messages for detections rejections #138 (#190)

* Error messages for detections rejections

https://github.com/Nachtzuster/BirdNET-Pi/issues/138

* Update server.py

* Use log.warning
This commit is contained in:
Alexandre
2024-09-30 20:42:17 +02:00
committed by GitHub
parent 3d99530ee5
commit a264eb9f8d
+10 -6
View File
@@ -330,10 +330,14 @@ def run_analysis(file):
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)
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)):
d = Detection(time_slot.split(';')[0], time_slot.split(';')[1], entry[0], entry[1])
confident_detections.append(d)
if entry[1] >= conf.getfloat('CONFIDENCE'):
if entry[0] not in INCLUDE_LIST and len(INCLUDE_LIST) != 0:
log.warning("Excluded as INCLUDE_LIST is active but this species is not in it: %s", entry[0])
elif entry[0] in EXCLUDE_LIST and len(EXCLUDE_LIST) != 0:
log.warning("Excluded as species in EXCLUDE_LIST: %s", entry[0])
elif entry[0] not in PREDICTED_SPECIES_LIST and len(PREDICTED_SPECIES_LIST) != 0:
log.warning("Excluded as below Species Occurrence Frequency Threshold: %s", entry[0])
else:
d = Detection(time_slot.split(';')[0], time_slot.split(';')[1], entry[0], entry[1])
confident_detections.append(d)
return confident_detections