moved analyze.py into scripts directory
This commit is contained in:
@@ -34,7 +34,7 @@ def loadModel():
|
|||||||
print('LOADING TF LITE MODEL...', end=' ')
|
print('LOADING TF LITE MODEL...', end=' ')
|
||||||
|
|
||||||
# Load TFLite model and allocate tensors.
|
# Load TFLite model and allocate tensors.
|
||||||
interpreter = tflite.Interpreter(model_path='model/BirdNET_6K_GLOBAL_MODEL.tflite',num_threads=2)
|
interpreter = tflite.Interpreter(model_path='../model/BirdNET_6K_GLOBAL_MODEL.tflite',num_threads=2)
|
||||||
interpreter.allocate_tensors()
|
interpreter.allocate_tensors()
|
||||||
|
|
||||||
# Get input and output tensors.
|
# Get input and output tensors.
|
||||||
@@ -48,7 +48,7 @@ def loadModel():
|
|||||||
|
|
||||||
# Load labels
|
# Load labels
|
||||||
CLASSES = []
|
CLASSES = []
|
||||||
with open('model/labels.txt', 'r') as lfile:
|
with open('../model/labels.txt', 'r') as lfile:
|
||||||
for line in lfile.readlines():
|
for line in lfile.readlines():
|
||||||
CLASSES.append(line.replace('\n', ''))
|
CLASSES.append(line.replace('\n', ''))
|
||||||
|
|
||||||
@@ -29,6 +29,8 @@ fi
|
|||||||
|
|
||||||
INCLUDE_LIST="/home/pi/BirdNET-Pi/include_species_list.txt"
|
INCLUDE_LIST="/home/pi/BirdNET-Pi/include_species_list.txt"
|
||||||
EXCLUDE_LIST="/home/pi/BirdNET-Pi/exclude_species_list.txt"
|
EXCLUDE_LIST="/home/pi/BirdNET-Pi/exclude_species_list.txt"
|
||||||
|
[ -f ${INCLUDE_LIST} ] || touch ${INCLUDE_LIST}
|
||||||
|
[ -f ${EXCLUDE_LIST} ] || touch ${EXCLUDE_LIST}
|
||||||
if [ "$(du ${INCLUDE_LIST} | awk '{print $1}')" -lt 4 ];then
|
if [ "$(du ${INCLUDE_LIST} | awk '{print $1}')" -lt 4 ];then
|
||||||
INCLUDE_LIST=null
|
INCLUDE_LIST=null
|
||||||
fi
|
fi
|
||||||
@@ -87,9 +89,9 @@ run_analysis() {
|
|||||||
WEEK="$(echo "${WEEK_OF_YEAR} + 4" |bc -l)"
|
WEEK="$(echo "${WEEK_OF_YEAR} + 4" |bc -l)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd ${HOME}/BirdNET-Pi || exit 1
|
cd ${HOME}/BirdNET-Pi/scripts || exit 1
|
||||||
for i in "${files[@]}";do
|
for i in "${files[@]}";do
|
||||||
echo "${1}/${i}" > ./analyzing_now.txt
|
echo "${1}/${i}" > ../analyzing_now.txt
|
||||||
[ -z ${RECORDING_LENGTH} ] && RECORDING_LENGTH=15
|
[ -z ${RECORDING_LENGTH} ] && RECORDING_LENGTH=15
|
||||||
[ ${RECORDING_LENGTH} == "60" ] && RECORDING_LENGTH=01:00
|
[ ${RECORDING_LENGTH} == "60" ] && RECORDING_LENGTH=01:00
|
||||||
FILE_LENGTH="$(ffmpeg -i ${1}/${i} 2>&1 | awk -F. '/Duration/ {print $1}' | cut -d':' -f3-4)"
|
FILE_LENGTH="$(ffmpeg -i ${1}/${i} 2>&1 | awk -F. '/Duration/ {print $1}' | cut -d':' -f3-4)"
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ GRANT ALL ON birds.* TO 'birder'@'localhost' IDENTIFIED BY '${DB_PWD}' WITH GRAN
|
|||||||
FLUSH PRIVILEGES;
|
FLUSH PRIVILEGES;
|
||||||
exit
|
exit
|
||||||
EOF
|
EOF
|
||||||
sudo -u${USER} sed -i "s/databasepassword/${DB_PWD}/g" /home/pi/BirdNET-Pi/analyze.py
|
sudo -u${USER} sed -i "s/databasepassword/${DB_PWD}/g" /home/pi/BirdNET-Pi/scripts/analyze.py
|
||||||
sed -i "s/mysqli.default_host =.*/mysqli.default_host = localhost/g" /etc/php/7.4/fpm/php.ini
|
sed -i "s/mysqli.default_host =.*/mysqli.default_host = localhost/g" /etc/php/7.4/fpm/php.ini
|
||||||
sed -i "s/mysqli.default_user =.*/mysqli.default_user = birder/g" /etc/php/7.4/fpm/php.ini
|
sed -i "s/mysqli.default_user =.*/mysqli.default_user = birder/g" /etc/php/7.4/fpm/php.ini
|
||||||
sed -i "s/mysqli.default_pw =.*/mysqli.default_pw = ${DB_PWD}/g" /etc/php/7.4/fpm/php.ini
|
sed -i "s/mysqli.default_pw =.*/mysqli.default_pw = ${DB_PWD}/g" /etc/php/7.4/fpm/php.ini
|
||||||
|
|||||||
@@ -1,46 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
# This script performs the mysql_secure_installation
|
|
||||||
# Creates the birds database
|
|
||||||
# Creates the detections table
|
|
||||||
# Creates the birder user and grants them appropriate
|
|
||||||
# permissions
|
|
||||||
# If using this script to re-initialize (DROP then CREATE)
|
|
||||||
# the DB, be sure to run this as root or with sudo
|
|
||||||
source /etc/birdnet/birdnet.conf
|
|
||||||
DB_ROOT_PWD=staggerwontonpurporting
|
|
||||||
mysql_secure_installation << EOF
|
|
||||||
|
|
||||||
y
|
|
||||||
${DB_ROOT_PWD}
|
|
||||||
${DB_ROOT_PWD}
|
|
||||||
y
|
|
||||||
y
|
|
||||||
y
|
|
||||||
EOF
|
|
||||||
|
|
||||||
mysql << EOF
|
|
||||||
DROP DATABASE IF EXISTS birds;
|
|
||||||
CREATE DATABASE IF NOT EXISTS birds;
|
|
||||||
|
|
||||||
USE birds;
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS detections (
|
|
||||||
Date DATE,
|
|
||||||
Time TIME,
|
|
||||||
Sci_Name VARCHAR(100) NOT NULL,
|
|
||||||
Com_Name VARCHAR(100) NOT NULL,
|
|
||||||
Confidence FLOAT,
|
|
||||||
Lat FLOAT,
|
|
||||||
Lon FLOAT,
|
|
||||||
Cutoff FLOAT,
|
|
||||||
Week INT,
|
|
||||||
Sens FLOAT,
|
|
||||||
Overlap FLOAT);
|
|
||||||
GRANT ALL ON birds.* TO 'birder'@'localhost' IDENTIFIED BY '${DB_PWD}' WITH GRANT OPTION;
|
|
||||||
FLUSH PRIVILEGES;
|
|
||||||
exit
|
|
||||||
EOF
|
|
||||||
sudo -u${USER} sed -i "s/databasepassword/${DB_PWD}/g" /home/pi/BirdNET-Pi/analyze.py
|
|
||||||
sudo -u${USER} sed -i "s/databasepassword/${DB_PWD}/g" /home/pi/BirdNET-Pi/scripts/viewdb.php
|
|
||||||
sudo -u${USER} sed -i "s/databasepassword/${DB_PWD}/g" /home/pi/BirdNET-Pi/scripts/viewday.php
|
|
||||||
sudo -u${USER} sed -i "s/databasepassword/${DB_PWD}/g" /home/pi/BirdNET-Pi/scripts/overview.php
|
|
||||||
@@ -5,7 +5,7 @@ source /etc/birdnet/birdnet.conf
|
|||||||
sudo mysql -e "
|
sudo mysql -e "
|
||||||
SET PASSWORD FOR 'birder'@'localhost' = PASSWORD('${DB_PWD}');
|
SET PASSWORD FOR 'birder'@'localhost' = PASSWORD('${DB_PWD}');
|
||||||
FLUSH PRIVILEGES";
|
FLUSH PRIVILEGES";
|
||||||
git -C /home/pi/BirdNET-Pi checkout -f analyze.py
|
git -C /home/pi/BirdNET-Pi checkout -f scripts/analyze.py
|
||||||
git -C /home/pi/BirdNET-Pi checkout -f scripts/viewdb.php
|
git -C /home/pi/BirdNET-Pi checkout -f scripts/viewdb.php
|
||||||
sed -i "s/databasepassword/${DB_PWD}/g" /home/pi/BirdNET-Pi/analyze.py
|
sed -i "s/databasepassword/${DB_PWD}/g" /home/pi/BirdNET-Pi/scripts/analyze.py
|
||||||
sed -i "s/databasepassword/${DB_PWD}/g" /home/pi/BirdNET-Pi/scripts/viewdb.php
|
sed -i "s/databasepassword/${DB_PWD}/g" /home/pi/BirdNET-Pi/scripts/viewdb.php
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ source /etc/birdnet/birdnet.conf
|
|||||||
mysql -e "
|
mysql -e "
|
||||||
SET PASSWORD FOR 'birder'@'localhost' = PASSWORD('${DB_PWD}');
|
SET PASSWORD FOR 'birder'@'localhost' = PASSWORD('${DB_PWD}');
|
||||||
FLUSH PRIVILEGES";
|
FLUSH PRIVILEGES";
|
||||||
sudo -u ${USER} git -C /home/pi/BirdNET-Pi checkout -f analyze.py
|
sudo -u ${USER} git -C /home/pi/BirdNET-Pi checkout -f scripts/analyze.py
|
||||||
sudo -u ${USER} git -C /home/pi/BirdNET-Pi checkout -f scripts/viewdb.php
|
sudo -u ${USER} git -C /home/pi/BirdNET-Pi checkout -f scripts/viewdb.php
|
||||||
sudo -u ${USER} sed -i "s/databasepassword/${DB_PWD}/g" /home/pi/BirdNET-Pi/analyze.py
|
sudo -u ${USER} sed -i "s/databasepassword/${DB_PWD}/g" /home/pi/BirdNET-Pi/scripts/analyze.py
|
||||||
sed -i "s/mysqli.default_host =.*/mysqli.default_host = localhost/g" /etc/php/7.4/fpm/php.ini
|
sed -i "s/mysqli.default_host =.*/mysqli.default_host = localhost/g" /etc/php/7.4/fpm/php.ini
|
||||||
sed -i "s/mysqli.default_user =.*/mysqli.default_user = birder/g" /etc/php/7.4/fpm/php.ini
|
sed -i "s/mysqli.default_user =.*/mysqli.default_user = birder/g" /etc/php/7.4/fpm/php.ini
|
||||||
sed -i "s/mysqli.default_pw =.*/mysqli.default_pw = ${DB_PWD}/g" /etc/php/7.4/fpm/php.ini
|
sed -i "s/mysqli.default_pw =.*/mysqli.default_pw = ${DB_PWD}/g" /etc/php/7.4/fpm/php.ini
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
# Update database password
|
|
||||||
source /etc/birdnet/birdnet.conf
|
|
||||||
|
|
||||||
sudo mysql -e "
|
|
||||||
UPDATE mysql.user
|
|
||||||
SET Password=PASSWORD('${DB_PWD}')
|
|
||||||
WHERE USER='birder'
|
|
||||||
AND Host='localhost';
|
|
||||||
FLUSH PRIVILEGES";
|
|
||||||
git -C /home/pi/BirdNET-Pi checkout -f analyze.py
|
|
||||||
git -C /home/pi/BirdNET-Pi checkout -f scripts/viewdb.php
|
|
||||||
sed -i "s/databasepassword/${DB_PWD}/g" /home/pi/BirdNET-Pi/analyze.py
|
|
||||||
sed -i "s/databasepassword/${DB_PWD}/g" /home/pi/BirdNET-Pi/scripts/viewdb.php
|
|
||||||
sed -i "s/databasepassword/${DB_PWD}/g" /home/pi/BirdNET-Pi/scripts/overview.php
|
|
||||||
sed -i "s/databasepassword/${DB_PWD}/g" /home/pi/BirdNET-Pi/scripts/viewday.php
|
|
||||||
Reference in New Issue
Block a user