From 80ccb194f3ea8ecaa8061505dd620630fca82d8d Mon Sep 17 00:00:00 2001 From: Mattk70 Date: Fri, 26 Jan 2024 20:58:11 +0000 Subject: [PATCH] Added additional BirdNET non-avian classes, as found here https://github.com/kahst/BirdNET-Analyzer/issues/67 --- js/BirdNet2.4.js | 60 +++++++++++++++++++++++++++++++++++++++++++++++- js/worker.js | 6 ++--- 2 files changed, 62 insertions(+), 4 deletions(-) diff --git a/js/BirdNet2.4.js b/js/BirdNet2.4.js index d019b399..bb8931ac 100644 --- a/js/BirdNet2.4.js +++ b/js/BirdNet2.4.js @@ -10,7 +10,65 @@ let myModel; const NOT_BIRDS = ['Dog_Dog', 'Environmental_Environmental', 'Engine_Engine', 'Fireworks_Fireworks', 'Gryllus assimilis_Gryllus assimilis', 'Gun_Gun', 'Human non-vocal_Human non-vocal', 'Human vocal_Human vocal', 'Human whistle_Human whistle', 'Miogryllus saussurei_Miogryllus saussurei', 'Noise_Noise', -'Power tools_Power tools', 'Siren_Siren']; +'Power tools_Power tools', 'Siren_Siren',"Canis latrans_Coyote", +"Canis lupus_Gray Wolf", +"Gastrophryne carolinensis_Eastern Narrow-mouthed Toad", +"Gastrophryne olivacea_Great Plains Narrow-mouthed Toad", +"Incilius valliceps_Gulf Coast Toad", +"Anaxyrus americanus_American Toad", +"Anaxyrus canorus_Yosemite Toad", +"Anaxyrus cognatus_Great Plains Toad", +"Anaxyrus fowleri_Fowler's Toad", +"Anaxyrus houstonensis_Houston Toad", +"Anaxyrus microscaphus_Arizona Toad", +"Anaxyrus quercicus_Oak Toad", +"Anaxyrus speciosus_Texas Toad", +"Anaxyrus terrestris_Southern Toad", +"Anaxyrus woodhousii_Woodhouse's Toad", +"Dryophytes andersonii_Pine Barrens Treefrog", +"Dryophytes arenicolor_Canyon Treefrog", +"Dryophytes avivoca_Bird-voiced Treefrog", +"Dryophytes chrysoscelis_Cope's Gray Treefrog", +"Dryophytes cinereus_Green Treefrog", +"Dryophytes femoralis_Pine Woods Treefrog", +"Dryophytes gratiosus_Barking Treefrog", +"Dryophytes squirellus_Squirrel Treefrog", +"Dryophytes versicolor_Gray Treefrog", +"Eleutherodactylus planirostris_Greenhouse Frog", +"Hyliola regilla_Pacific Chorus Frog", +"Lithobates catesbeianus_American Bullfrog", +"Lithobates clamitans_Green Frog", +"Lithobates palustris_Pickerel Frog", +"Lithobates sylvaticus_Wood Frog", +"Pseudacris brimleyi_Brimley's Chorus Frog", +"Pseudacris clarkii_Spotted Chorus Frog", +"Pseudacris crucifer_Spring Peeper", +"Pseudacris feriarum_Upland Chorus Frog", +"Pseudacris nigrita_Southern Chorus Frog", +"Pseudacris ocularis_Little Grass Frog", +"Pseudacris ornata_Ornate Chorus Frog", +"Pseudacris streckeri_Strecker's Chorus Frog", +"Pseudacris triseriata_Striped Chorus Frog", +"Acris crepitans_Northern Cricket Frog", +"Acris gryllus_Southern Cricket Frog", +"Eunemobius carolinus_Carolina Ground Cricket", +"Eunemobius confusus_Confused Ground Cricket", +"Gryllus assimilis_Gryllus assimilis", +"Gryllus fultoni_Southern Wood Cricket", +"Gryllus pennsylvanicus_Fall Field Cricket", +"Gryllus rubens_Southeastern Field Cricket", +"Neonemobius cubensis_Cuban Ground Cricket", +"Oecanthus celerinictus_Fast-calling Tree Cricket", +"Oecanthus exclamationis_Davis's Tree Cricket", +"Oecanthus fultoni_Snowy Tree Cricket", +"Oecanthus nigricornis_Blackhorned Tree Cricket", +"Oecanthus niveus_Narrow-winged Tree Cricket", +"Oecanthus pini_Pine Tree Cricket", +"Oecanthus quadripunctatus_Four-spotted Tree Cricket", +"Orocharis saltator_Jumping Bush Cricket", +"Alouatta pigra_Mexican Black Howler Monkey", +"Tamias striatus_Eastern Chipmunk", +"Tamiasciurus hudsonicus_Red Squirrel"]; const MYSTERIES = ['Unknown Sp._Unknown Sp.']; const GRAYLIST = []; const GOLDEN_LIST = [] diff --git a/js/worker.js b/js/worker.js index a21fb509..bf81b23f 100644 --- a/js/worker.js +++ b/js/worker.js @@ -740,7 +740,7 @@ const getDuration = async (src) => { const convertFileFormat = (file, destination, size, error) => { return new Promise(function (resolve) { - const sampleRate = 24_000, channels = 1; + const sampleRate = STATE.model === 'v2.4' ? 48_000 :24_000, channels = 1; let totalTime; ffmpeg(file) .audioChannels(channels) @@ -1143,7 +1143,7 @@ async function setupCtx(chunk, header) { const getPredictBuffers = async ({ file = '', start = 0, end = undefined, worker = undefined }) => { - let chunkLength = 72_000; + let chunkLength = STATE.model === 'v2.4' ? 144_000 : 72_000; // Ensure max and min are within range start = Math.max(0, start); end = Math.min(metadata[file].duration, end); @@ -1372,7 +1372,7 @@ const convertSpecsFromExistingSpecs = async (path) => { const saveResults2DataSet = ({species}) => { const rootDirectory = DATASET_SAVE_LOCATION; - sampleRate = 24_000; + sampleRate = STATE.model === 'v2.4' ? 48_000 : 24_000; const height = 256, width = 384; let t0 = Date.now() let promise = Promise.resolve();