From 9c185d49a27c624d84840b2ad38a78df6ace2d45 Mon Sep 17 00:00:00 2001 From: Patrick McGuire Date: Wed, 29 Sep 2021 17:23:35 -0400 Subject: [PATCH] added support for a custom_species_list.txt file Added confidence score to extraction file --- scripts/birdnet_analysis.sh | 15 +++++++++++++-- scripts/extract_new_birdsounds.sh | 6 +++++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/scripts/birdnet_analysis.sh b/scripts/birdnet_analysis.sh index 04001ca..eedae8b 100755 --- a/scripts/birdnet_analysis.sh +++ b/scripts/birdnet_analysis.sh @@ -2,6 +2,7 @@ # Runs BirdNET in virtual environment #set -x source /etc/birdnet/birdnet.conf +CUSTOM_LIST="/home/pi/BirdNET-Lite/custom_species_list.txt" DAYS=( "2 days ago" "yesterday" @@ -47,7 +48,7 @@ run_analysis() { WEEK=$(date --date="${2}" +"%U") cd ${HOME}/BirdNET-Lite || exit 1 for i in "${files[@]}";do - if [ -f ${1}/${i} ];then + if [ -f ${1}/${i} ] && [ ! -f ${CUSTOM_LIST} ];then python3 analyze.py \ --i "${1}/${i}" \ --o "${1}/${i}.csv" \ @@ -56,7 +57,17 @@ run_analysis() { --week "${WEEK}" \ --overlap "${OVERLAP}" \ --min_conf "${CONFIDENCE}" - fi + elif [ -f ${1}/${i} ] && [ -f ${CUSTOM_LIST} ];then + python3 analyze.py \ + --i "${1}/${i}" \ + --o "${1}/${i}.csv" \ + --lat "${LATITUDE}" \ + --lon "${LONGITUDE}" \ + --week "${WEEK}" \ + --overlap "${OVERLAP}" \ + --min_conf "${CONFIDENCE}" \ + --custom_list "${CUSTOM_LIST}" + fi done } diff --git a/scripts/extract_new_birdsounds.sh b/scripts/extract_new_birdsounds.sh index c018d8e..d9644ca 100755 --- a/scripts/extract_new_birdsounds.sh +++ b/scripts/extract_new_birdsounds.sh @@ -69,7 +69,11 @@ for h in "${SCAN_DIRS[@]}";do | awk -F\; '!/birdnet/{print $4}')"" SCIENTIFIC_NAME=""$(echo ${line} \ | awk -F\; '!/birdnet/{print $3}')"" - NEWFILE="${COMMON_NAME// /_}-${OLDFILE}" + CONFIDENCE=""$(echo ${line} \ + | awk -F\; '{print $5}' \ + | cut -d'.' -f2)"" + CONFIDENCE_SCORE="${CONFIDENCE:0:2}%" + NEWFILE="${COMMON_NAME// /_}-${CONFIDENCE_SCORE}-${OLDFILE}" NEWSPECIES_BYDATE="${EXTRACTED}/By_Date/${DATE}/${COMMON_NAME// /_}" NEWSPECIES_BY_COMMON="${EXTRACTED}/By_Common_Name/${COMMON_NAME// /_}" NEWSPECIES_BY_SCIENCE="${EXTRACTED}/By_Scientific_Name/${SCIENTIFIC_NAME// /_}"