Refactor tphakala model v2 handling in 81-modifications.sh

Updated model and label handling for tphakala model v2. Added checks for model files and improved error logging.
This commit is contained in:
Alexandre
2025-09-13 07:01:01 +02:00
committed by GitHub
parent eab6887c95
commit f674af3b8c

View File

@@ -45,17 +45,15 @@ fi
# Use tphakala model v2 if enabled
if bashio::config.true 'Use_tphakala_model_v2'; then
echo "... applying tphakala model v2"
if [ -d "$HOME/BirdNET-Pi/model/labels_nm" ]; then
if [[ -f "$HOME/BirdNET-Pi/model/BirdNET-Go_classifier.tflite" ]] && [[ -d "$HOME/BirdNET-Pi/model/labels_go" ]]; then
# Move labels
mv "$HOME/BirdNET-Pi/model/labels_nm" "$HOME/BirdNET-Pi/model/labels_nm2" || bashio::log.warning "Failed to move labels_nm"
fi
if [ -d "$HOME/BirdNET-Pi/model/labels_go" ]; then
mv "$HOME/BirdNET-Pi/model/labels_go" "$HOME/BirdNET-Pi/model/labels_nm" || bashio::log.warning "Failed to move labels_go"
fi
if [ -f "$HOME/BirdNET-Pi/model/BirdNET_GLOBAL_6K_V2.4_MData_Model_V2_FP16.tflite" ]; then
# Move model
mv "$HOME/BirdNET-Pi/model/BirdNET_GLOBAL_6K_V2.4_MData_Model_V2_FP16.tflite" "$HOME/BirdNET-Pi/model/BirdNET_GLOBAL_6K_V2.4_MData_Model_V2_FP16.tflite2" || bashio::log.warning "Failed to move base model"
fi
if [ -f "$HOME/BirdNET-Pi/model/BirdNET-Go_classifier.tflite" ]; then
mv "$HOME/BirdNET-Pi/model/BirdNET-Go_classifier.tflite" "$HOME/BirdNET-Pi/model/BirdNET_GLOBAL_6K_V2.4_MData_Model_V2_FP16.tflite" || bashio::log.warning "Failed to move Go classifier"
else
bashio::log.fatal "model or labels not found, skipping"
fi
fi