diff --git a/analyze.py b/analyze.py index 45f2aebb..3b6eef26 100644 --- a/analyze.py +++ b/analyze.py @@ -299,9 +299,15 @@ def analyzeFile(item): # Sort by score p_sorted = sorted(p_labels, key=operator.itemgetter(1), reverse=True) p_sorted_ = list(p_sorted) + # human_cutoff = max(10, int(len(p_sorted) * priv_thresh / 100.0)) + # for i in range(min(10, len(p_sorted))): + # if p_sorted[i][0] == 'Human_Human': for i in range(len(p_sorted_)): p_sorted_[i] = list(p_sorted_[i]) p_sorted_[i][1] = str(p_sorted_[i][1]) + # check for privacy pot.here: if a human is present in top %, then + # set first entry to human_voclization. Filter that out with the + # excluded species list in the Pi system # for i in len(p_sorted): # p_sorted[i][1] = str(p_sorted[i][1]) # print(p_sorted[i][1]) diff --git a/checkpoints/bats/v1.0/CUSTOM-BAT-256kHz.tflite b/checkpoints/bats/v1.0/CUSTOM-BAT-256kHz.tflite new file mode 100644 index 00000000..6c0eeba8 Binary files /dev/null and b/checkpoints/bats/v1.0/CUSTOM-BAT-256kHz.tflite differ diff --git a/checkpoints/bats/v1.0/CUSTOM-BAT-256kHz_Labels.txt b/checkpoints/bats/v1.0/CUSTOM-BAT-256kHz_Labels.txt new file mode 100644 index 00000000..f5ddd314 --- /dev/null +++ b/checkpoints/bats/v1.0/CUSTOM-BAT-256kHz_Labels.txt @@ -0,0 +1,31 @@ +Barbastella barbastellus_Western barbastelle +Eptesicus nilssonii_Northern bat +Eptesicus serotinus_Serotine bat +Hypsugo savii_Savis pipistrelle +Myotis bechsteinii_Bechsteins bat +Myotis dasycneme_Pond bat +Myotis daubentonii_Daubentons or Whiskered bat +Myotis emarginatus_Geoffroys bat +Myotis myotis_Greater mouse-eared bat +Myotis mystacinus_Whiskered or Daubentons bat +Myotis nattereri_Natterers bat +Nyctalus leisleri_Lesser noctule +Nyctalus noctula_Common noctule +Pipistrellus kuhlii_Kuhls or Nathusius pipistrelle +Pipistrellus nathusii_Nathusius or Kuhls pipistrelle +Pipistrellus pipistrellus_Common pipistrelle +Pipistrellus pygmaeus_Soprano pipistrelle +Plecotus auritus_Brown or Grey long eared bat +Rhinolophus ferrumequinum_Greater horseshoe bat +Rhinolophus hipposideros_Lesser horseshoe bat +Vespertilio murinus_Parti-coloured bat +audiomoth +background +bird +collected +electrical +insect +mechanical +other +pro +rain diff --git a/checkpoints/bats/v1.0/CUSTOM-BIRD-48kHz.tflite b/checkpoints/bats/v1.0/CUSTOM-BIRD-48kHz.tflite new file mode 100644 index 00000000..6c0eeba8 Binary files /dev/null and b/checkpoints/bats/v1.0/CUSTOM-BIRD-48kHz.tflite differ diff --git a/checkpoints/bats/v1.0/CUSTOM-BIRD-48kHz_Labels.txt b/checkpoints/bats/v1.0/CUSTOM-BIRD-48kHz_Labels.txt new file mode 100644 index 00000000..f5ddd314 --- /dev/null +++ b/checkpoints/bats/v1.0/CUSTOM-BIRD-48kHz_Labels.txt @@ -0,0 +1,31 @@ +Barbastella barbastellus_Western barbastelle +Eptesicus nilssonii_Northern bat +Eptesicus serotinus_Serotine bat +Hypsugo savii_Savis pipistrelle +Myotis bechsteinii_Bechsteins bat +Myotis dasycneme_Pond bat +Myotis daubentonii_Daubentons or Whiskered bat +Myotis emarginatus_Geoffroys bat +Myotis myotis_Greater mouse-eared bat +Myotis mystacinus_Whiskered or Daubentons bat +Myotis nattereri_Natterers bat +Nyctalus leisleri_Lesser noctule +Nyctalus noctula_Common noctule +Pipistrellus kuhlii_Kuhls or Nathusius pipistrelle +Pipistrellus nathusii_Nathusius or Kuhls pipistrelle +Pipistrellus pipistrellus_Common pipistrelle +Pipistrellus pygmaeus_Soprano pipistrelle +Plecotus auritus_Brown or Grey long eared bat +Rhinolophus ferrumequinum_Greater horseshoe bat +Rhinolophus hipposideros_Lesser horseshoe bat +Vespertilio murinus_Parti-coloured bat +audiomoth +background +bird +collected +electrical +insect +mechanical +other +pro +rain diff --git a/server.py b/server.py index c3719471..22c0a657 100644 --- a/server.py +++ b/server.py @@ -193,7 +193,7 @@ def handleRequest(): os.unlink(file_path_tmp.name) def set_analysis_location(): - if args.area not in ["Bavaria", "South-Wales", "UK", "USA","USA-EAST","USA-WEST","BIRDS"]: + if args.area not in ["Bavaria", "South-Wales", "UK", "USA","USA-EAST","USA-WEST","BIRDS","CUSTOM_BIRD","CUSTOM_BAT"]: exit(code="Unknown location option.") else: args.lat = -1 @@ -249,6 +249,18 @@ def set_analysis_location(): cfg.SIG_OVERLAP = cfg.SIG_LENGTH / 4.0 cfg.SIG_MINLEN = cfg.SIG_LENGTH / 3.0 + elif args.area == "CUSTOM_BIRD": + cfg.CUSTOM_CLASSIFIER = cfg.BAT_CLASSIFIER_LOCATION + "/CUSTOM-BIRD-48kHz.tflite" + cfg.LABELS_FILE = cfg.BAT_CLASSIFIER_LOCATION + "/CUSTOM-BIRD-48kHz_Labels.txt" + cfg.SAMPLE_RATE = 48000 + cfg.SIG_LENGTH = 3 + cfg.SIG_OVERLAP = cfg.SIG_LENGTH / 4.0 + cfg.SIG_MINLEN = cfg.SIG_LENGTH / 3.0 + + elif args.area == "CUSTOM_BAT": + cfg.CUSTOM_CLASSIFIER = cfg.BAT_CLASSIFIER_LOCATION + "/CUSTOM-BAT-256kHz.tflite" + cfg.LABELS_FILE = cfg.BAT_CLASSIFIER_LOCATION + "/CUSTOM-BAT-256kHz_Labels.txt" + cfg.LABELS = utils.readLines(cfg.LABELS_FILE) else: cfg.CUSTOM_CLASSIFIER = None