satisfy flake8 linter (this is ridiculus)
This commit is contained in:
@@ -48,7 +48,8 @@ readings = 10
|
||||
plt_top10_today = (df_plt_today['Com_Name'].value_counts()[:readings])
|
||||
df_plt_top10_today = df_plt_today[df_plt_today.Com_Name.isin(plt_top10_today.index)]
|
||||
|
||||
if df_plt_top10_today.empty: exit(0)
|
||||
if df_plt_top10_today.empty:
|
||||
exit(0)
|
||||
|
||||
# Set Palette for graphics
|
||||
pal = "Greens"
|
||||
|
||||
+12
-27
@@ -1,18 +1,5 @@
|
||||
from pathlib import Path
|
||||
from tzlocal import get_localzone
|
||||
import datetime
|
||||
import sqlite3
|
||||
import requests
|
||||
import json
|
||||
import time
|
||||
import math
|
||||
import numpy as np
|
||||
import librosa
|
||||
import operator
|
||||
import socket
|
||||
import threading
|
||||
import os
|
||||
import sys
|
||||
import argparse
|
||||
import datetime
|
||||
|
||||
@@ -22,7 +9,6 @@ except BaseException:
|
||||
from tensorflow import lite as tflite
|
||||
|
||||
|
||||
|
||||
def loadMetaModel():
|
||||
|
||||
global M_INTERPRETER
|
||||
@@ -51,15 +37,16 @@ def loadMetaModel():
|
||||
|
||||
print("loaded META model")
|
||||
|
||||
|
||||
def predictFilter(lat, lon, week):
|
||||
|
||||
global M_INTERPRETER
|
||||
|
||||
# Does interpreter exist?
|
||||
try:
|
||||
if M_INTERPRETER == None:
|
||||
if M_INTERPRETER is None:
|
||||
loadMetaModel()
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
loadMetaModel()
|
||||
|
||||
# Prepare mdata as sample
|
||||
@@ -71,6 +58,7 @@ def predictFilter(lat, lon, week):
|
||||
|
||||
return M_INTERPRETER.get_tensor(M_OUTPUT_LAYER_INDEX)[0]
|
||||
|
||||
|
||||
def explore(lat, lon, week, threshold):
|
||||
|
||||
# Make filter prediction
|
||||
@@ -87,6 +75,7 @@ def explore(lat, lon, week, threshold):
|
||||
|
||||
return l_filter
|
||||
|
||||
|
||||
def getSpeciesList(lat, lon, week, threshold=0.05, sort=False):
|
||||
|
||||
print('Getting species list for {}/{}, Week {}...'.format(lat, lon, week), end='', flush=True)
|
||||
@@ -115,13 +104,10 @@ weekofyear = datetime.datetime.today().isocalendar()[1]
|
||||
if __name__ == '__main__':
|
||||
|
||||
# Parse arguments
|
||||
parser = argparse.ArgumentParser(description='Get list of species for a given location with BirdNET. Sorted by occurrence frequency.')
|
||||
#parser.add_argument('--o', default='/home/pi/BirdNET-Pi/include_species_list.txt', help='Path to output file or folder. If this is a folder, file will be named \'species_list.txt\'.')
|
||||
#parser.add_argument('--lat', type=float, default=##, help='Recording location latitude. Set -1 to ignore.')
|
||||
#parser.add_argument('--lon', type=float, default=##, help='Recording location longitude. Set -1 to ignore.')
|
||||
#parser.add_argument('--week', type=int, default=dayofweek, help='Week of the year when the recording was made. Values in [1, 48] (4 weeks per month). Set -1 for year-round species list.')
|
||||
parser = argparse.ArgumentParser(
|
||||
description='Get list of species for a given location with BirdNET. Sorted by occurrence frequency.'
|
||||
)
|
||||
parser.add_argument('--threshold', type=float, default=0.05, help='Occurrence frequency threshold. Defaults to 0.05.')
|
||||
#parser.add_argument('--sortby', default='freq', help='Sort species by occurrence frequency or alphabetically. Values in [\'freq\', \'alpha\']. Defaults to \'freq\'.')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
@@ -132,8 +118,7 @@ if __name__ == '__main__':
|
||||
for x in range(len(species_list)):
|
||||
print(species_list[x][0] + " - " + str(species_list[x][1]))
|
||||
|
||||
print("\nThe above species list describes all the species that the model will attempt to detect. If you don't see a species you want detected on this list, decrease your threshold.")
|
||||
print("\nNOTE: no actual changes to your BirdNET-Pi species list were made by running this command. To set your desired frequency threshold, do it through the BirdNET-Pi web interface (Tools -> Settings -> Model)")
|
||||
|
||||
|
||||
|
||||
print("\nThe above species list describes all the species that the model will attempt to detect. \
|
||||
If you don't see a species you want detected on this list, decrease your threshold.")
|
||||
print("\nNOTE: no actual changes to your BirdNET-Pi species list were made by running this command. \
|
||||
To set your desired frequency threshold, do it through the BirdNET-Pi web interface (Tools -> Settings -> Model)")
|
||||
|
||||
Reference in New Issue
Block a user