diff --git a/README.md b/README.md index ffbb343..8f5cc6e 100644 --- a/README.md +++ b/README.md @@ -63,10 +63,10 @@ Currently listening in these countries . . . that I know of . . . ## Features * **24/7 recording and automatic identification** of bird songs, chirps, and peeps using BirdNET machine learning -* **Automatic extraction and cataloguing** of bird sounds +* **Automatic extraction and cataloguing** of bird clips from full-length recordings * **Tools to visualize your recorded bird data** and analyze trends * **Live audio stream and spectrogram** -* **Automatic disk space management** that periodically purges old audio files to manage disk space +* **Automatic disk space management** that periodically purges old audio files * [BirdWeather](https://app.birdweather.com) integration -- you can request a BirdWeather ID from BirdNET-Pi's "Tools" > "Settings" page * Web interface access to all data and logs provided by [Caddy](https://caddyserver.com) * [GoTTY](https://github.com/yudai/gotty) Web Terminal diff --git a/birdnet.conf-defaults b/birdnet.conf-defaults index 03ca9f5..58a30fd 100644 --- a/birdnet.conf-defaults +++ b/birdnet.conf-defaults @@ -78,6 +78,7 @@ APPRISE_WEEKLY_REPORT=1 APPRISE_NOTIFY_NEW_SPECIES_EACH_DAY=0 APPRISE_MINIMUM_SECONDS_BETWEEN_NOTIFICATIONS_PER_SPECIES=0 APPRISE_ONLY_NOTIFY_SPECIES_NAMES="" +APPRISE_ONLY_NOTIFY_SPECIES_NAMES_2="" #---------------------- Flickr Images API Configuration -----------------------# ## If FLICKR_API_KEY is set, the web interface will try and display bird images diff --git a/model/BirdNET_GLOBAL_3K_V2.2_MData_Model_FP16.tflite b/model/BirdNET_GLOBAL_3K_V2.2_MData_Model_FP16.tflite deleted file mode 100644 index 6dc8b26..0000000 Binary files a/model/BirdNET_GLOBAL_3K_V2.2_MData_Model_FP16.tflite and /dev/null differ diff --git a/model/BirdNET_GLOBAL_3K_V2.2_Model_FP16.tflite b/model/BirdNET_GLOBAL_3K_V2.2_Model_FP16.tflite deleted file mode 100644 index c9b6ac4..0000000 Binary files a/model/BirdNET_GLOBAL_3K_V2.2_Model_FP16.tflite and /dev/null differ diff --git a/model/BirdNET_GLOBAL_3K_V2.3_MData_Model_FP16.tflite b/model/BirdNET_GLOBAL_3K_V2.3_MData_Model_FP16.tflite new file mode 100644 index 0000000..097e181 Binary files /dev/null and b/model/BirdNET_GLOBAL_3K_V2.3_MData_Model_FP16.tflite differ diff --git a/model/BirdNET_GLOBAL_3K_V2.3_Model_FP16.tflite b/model/BirdNET_GLOBAL_3K_V2.3_Model_FP16.tflite new file mode 100644 index 0000000..4b0b022 Binary files /dev/null and b/model/BirdNET_GLOBAL_3K_V2.3_Model_FP16.tflite differ diff --git a/model/labels_nm.zip b/model/labels_nm.zip index 72570ea..d528775 100644 Binary files a/model/labels_nm.zip and b/model/labels_nm.zip differ diff --git a/scripts/config.php b/scripts/config.php index 042a866..5c56c05 100644 --- a/scripts/config.php +++ b/scripts/config.php @@ -54,6 +54,7 @@ if(isset($_GET["latitude"])){ $model = $_GET["model"]; $sf_thresh = $_GET["sf_thresh"]; $only_notify_species_names = $_GET['only_notify_species_names']; + $only_notify_species_names_2 = $_GET['only_notify_species_names_2']; if(isset($_GET['apprise_notify_each_detection'])) { $apprise_notify_each_detection = 1; @@ -120,9 +121,9 @@ if(isset($_GET["latitude"])){ // Archive old language file syslog_shell_exec("cp -f $home/BirdNET-Pi/model/labels.txt $home/BirdNET-Pi/model/labels.txt.old", $user); - if($model == "BirdNET_GLOBAL_3K_V2.2_Model_FP16"){ + if($model == "BirdNET_GLOBAL_3K_V2.3_Model_FP16"){ // Install new language label file - syslog_shell_exec("sudo chmod +x $home/BirdNET-Pi/scripts/install_language_label_nm.sh && $home/BirdNET-Pi/scripts/install_language_label_nm.sh -l $language", $user); + syslog_shell_exec("chmod +x $home/BirdNET-Pi/scripts/install_language_label_nm.sh && $home/BirdNET-Pi/scripts/install_language_label_nm.sh -l $language", $user); } else { syslog_shell_exec("$home/BirdNET-Pi/scripts/install_language_label.sh -l $language", $user); } @@ -150,6 +151,7 @@ if(isset($_GET["latitude"])){ $contents = preg_replace("/MODEL=.*/", "MODEL=$model", $contents); $contents = preg_replace("/SF_THRESH=.*/", "SF_THRESH=$sf_thresh", $contents); $contents = preg_replace("/APPRISE_ONLY_NOTIFY_SPECIES_NAMES=.*/", "APPRISE_ONLY_NOTIFY_SPECIES_NAMES=\"$only_notify_species_names\"", $contents); + $contents = preg_replace("/APPRISE_ONLY_NOTIFY_SPECIES_NAMES_2=.*/", "APPRISE_ONLY_NOTIFY_SPECIES_NAMES_2=\"$only_notify_species_names_2\"", $contents); $contents2 = file_get_contents("./scripts/thisrun.txt"); $contents2 = preg_replace("/SITE_NAME=.*/", "SITE_NAME=\"$site_name\"", $contents2); @@ -169,6 +171,7 @@ if(isset($_GET["latitude"])){ $contents2 = preg_replace("/MODEL=.*/", "MODEL=$model", $contents2); $contents2 = preg_replace("/SF_THRESH=.*/", "SF_THRESH=$sf_thresh", $contents2); $contents2 = preg_replace("/APPRISE_ONLY_NOTIFY_SPECIES_NAMES=.*/", "APPRISE_ONLY_NOTIFY_SPECIES_NAMES=\"$only_notify_species_names\"", $contents2); + $contents2 = preg_replace("/APPRISE_ONLY_NOTIFY_SPECIES_NAMES_2=.*/", "APPRISE_ONLY_NOTIFY_SPECIES_NAMES_2=\"$only_notify_species_names_2\"", $contents2); @@ -325,7 +328,7 @@ if (!isset($_SERVER['PHP_AUTH_USER'])) { diff --git a/scripts/update_birdnet_snippets.sh b/scripts/update_birdnet_snippets.sh index 2681ef3..1e88eb9 100755 --- a/scripts/update_birdnet_snippets.sh +++ b/scripts/update_birdnet_snippets.sh @@ -190,6 +190,9 @@ fi if ! grep APPRISE_ONLY_NOTIFY_SPECIES_NAMES /etc/birdnet/birdnet.conf &>/dev/null;then sudo -u$USER echo "APPRISE_ONLY_NOTIFY_SPECIES_NAMES=\"\"" >> /etc/birdnet/birdnet.conf fi +if ! grep APPRISE_ONLY_NOTIFY_SPECIES_NAMES_2 /etc/birdnet/birdnet.conf &>/dev/null;then + sudo -u$USER echo "APPRISE_ONLY_NOTIFY_SPECIES_NAMES_2=\"\"" >> /etc/birdnet/birdnet.conf +fi if ! grep RTSP_STREAM_TO_LIVESTREAM /etc/birdnet/birdnet.conf &>/dev/null;then sudo -u$USER echo "RTSP_STREAM_TO_LIVESTREAM=\"0\"" >> /etc/birdnet/birdnet.conf @@ -214,5 +217,15 @@ if ! grep LogLevel_SpectrogramViewerService /etc/birdnet/birdnet.conf &>/dev/nul sudo -u$USER echo "LogLevel_SpectrogramViewerService=\"error\"" >> /etc/birdnet/birdnet.conf fi +if grep -q '^MODEL=BirdNET_GLOBAL_3K_V2.2_Model_FP16$' /etc/birdnet/birdnet.conf;then + language=$(grep "^DATABASE_LANG=" /etc/birdnet/birdnet.conf | cut -d= -f2) + sed -i 's/BirdNET_GLOBAL_3K_V2.2_Model_FP16/BirdNET_GLOBAL_3K_V2.3_Model_FP16/' /etc/birdnet/birdnet.conf + sed -i 's/BirdNET_GLOBAL_3K_V2.2_Model_FP16/BirdNET_GLOBAL_3K_V2.3_Model_FP16/' $HOME/BirdNET-Pi/scripts/thisrun.txt + sed -i 's/BirdNET_GLOBAL_3K_V2.2_Model_FP16/BirdNET_GLOBAL_3K_V2.3_Model_FP16/' $HOME/BirdNET-Pi/birdnet.conf + cp -f $HOME/BirdNET-Pi/model/labels.txt $HOME/BirdNET-Pi/model/labels.txt.old + sudo chmod +x $HOME/BirdNET-Pi/scripts/install_language_label_nm.sh && $HOME/BirdNET-Pi/scripts/install_language_label_nm.sh -l "$language" +fi + + sudo systemctl daemon-reload restart_services.sh diff --git a/scripts/utils/notifications.py b/scripts/utils/notifications.py index eaee216..99265a5 100644 --- a/scripts/utils/notifications.py +++ b/scripts/utils/notifications.py @@ -51,6 +51,11 @@ def sendAppriseNotifications(species, confidence, path, date, time, week, latitu if APPRISE_ONLY_NOTIFY_SPECIES_NAMES is not None and APPRISE_ONLY_NOTIFY_SPECIES_NAMES.strip() != "": if any(bird.lower().replace(" ", "") in comName.lower().replace(" ", "") for bird in APPRISE_ONLY_NOTIFY_SPECIES_NAMES.split(",")): return + + APPRISE_ONLY_NOTIFY_SPECIES_NAMES_2 = settings_dict.get('APPRISE_ONLY_NOTIFY_SPECIES_NAMES_2') + if APPRISE_ONLY_NOTIFY_SPECIES_NAMES_2 is not None and APPRISE_ONLY_NOTIFY_SPECIES_NAMES_2.strip() != "": + if not any(bird.lower().replace(" ", "") in comName.lower().replace(" ", "") for bird in APPRISE_ONLY_NOTIFY_SPECIES_NAMES_2.split(",")): + return APPRISE_MINIMUM_SECONDS_BETWEEN_NOTIFICATIONS_PER_SPECIES = settings_dict.get('APPRISE_MINIMUM_SECONDS_BETWEEN_NOTIFICATIONS_PER_SPECIES') if APPRISE_MINIMUM_SECONDS_BETWEEN_NOTIFICATIONS_PER_SPECIES != "0": diff --git a/scripts/weekly_report.php b/scripts/weekly_report.php index b28ef2e..e625d3a 100644 --- a/scripts/weekly_report.php +++ b/scripts/weekly_report.php @@ -210,7 +210,11 @@ while($detection=$result1->fetchArray(SQLITE3_ASSOC)) $totalcount = $result2->fetchArray(SQLITE3_ASSOC); $priorweekcount = $totalcount['COUNT(*)']; - $percentagediff = round( (($scount - $priorweekcount) / $priorweekcount) * 100 ); + if ($priorweekcount > 0) { + $percentagediff = round( (($scount - $priorweekcount) / $priorweekcount) * 100 ); + } else { + $percentagediff = 0; + } if($percentagediff > 0) { $percentagediff = "+".$percentagediff."%";