From 83d0ce35ade9e1a21360b10872eb12993bd2d124 Mon Sep 17 00:00:00 2001 From: towsey Date: Fri, 12 Jun 2020 14:45:44 +1000 Subject: [PATCH] Finished debugging Cisticola and tests Issue #321 --- .../Towsey.CisticolaExilis.yml | 6 +---- .../Recognizers/CisticolaTests.cs | 27 +++++++------------ 2 files changed, 10 insertions(+), 23 deletions(-) diff --git a/src/AnalysisConfigFiles/RecognizerConfigFiles/Towsey.CisticolaExilis.yml b/src/AnalysisConfigFiles/RecognizerConfigFiles/Towsey.CisticolaExilis.yml index 5fb05f960..14f300049 100644 --- a/src/AnalysisConfigFiles/RecognizerConfigFiles/Towsey.CisticolaExilis.yml +++ b/src/AnalysisConfigFiles/RecognizerConfigFiles/Towsey.CisticolaExilis.yml @@ -17,14 +17,11 @@ Profiles: FrameSize: 512 FrameStep: 128 WindowFunction: HANNING - #BgNoiseThreshold: 0.0 # min and max of the freq band to search MinHertz: 2100 MaxHertz: 3300 MinBandwidthHertz: 200 MaxBandwidthHertz: 900 - #MinDuration: 0.03 - #MaxDuration: 0.06 DecibelThreshold: 6.0 #################### POST-PROCESSING of EVENTS ################### @@ -33,7 +30,7 @@ Profiles: # 1: Combine overlapping events CombineOverlappingEvents: true -# 2: Combine each pair of Boobook syllables as one event +# 2: Combine syllables that possibly belong to the same strophe. # Can also use this to "mop up" events in neighbourhood - these can be removed later. CombinePossibleSyllableSequence: true SyllableStartDifference: 0.15 @@ -44,7 +41,6 @@ NeighbourhoodLowerHertzBuffer: 0 NeighbourhoodUpperHertzBuffer: 200 NeighbourhoodDbThreshold: 4.0 - # C: Options to save results files # 4: Available options for saving spectrograms (case-sensitive): [False/Never | True/Always | WhenEventsDetected] # "True" is useful when debugging but "WhenEventsDetected" is required for operational use. diff --git a/tests/Acoustics.Test/AnalysisPrograms/Recognizers/CisticolaTests.cs b/tests/Acoustics.Test/AnalysisPrograms/Recognizers/CisticolaTests.cs index 27fc61dd0..6a958229c 100644 --- a/tests/Acoustics.Test/AnalysisPrograms/Recognizers/CisticolaTests.cs +++ b/tests/Acoustics.Test/AnalysisPrograms/Recognizers/CisticolaTests.cs @@ -5,16 +5,11 @@ namespace Acoustics.Test.AnalysisPrograms.Recognizers { using System; - using System.Collections.Generic; using System.IO; using Acoustics.Test.TestHelpers; - using Acoustics.Tools.Wav; using global::AnalysisPrograms.Recognizers; - using global::AnalysisPrograms.SourcePreparers; - using global::AudioAnalysisTools.Events; using global::AudioAnalysisTools.Events.Types; using global::AudioAnalysisTools.WavTools; - using global::TowseyLibrary; using Microsoft.VisualStudio.TestTools.UnitTesting; /// @@ -25,11 +20,9 @@ namespace Acoustics.Test.AnalysisPrograms.Recognizers public class CisticolaTests : OutputDirectoryTest { /// - /// The canonical recording used for this recognizer is a 31 second recording . + /// The canonical recording used for this recognizer is a 30 second recording same as for Pipit. /// private static readonly FileInfo TestAsset = PathHelper.ResolveAsset("Recordings", "ms1_2559_630118_20170402_075841_30_0.wav"); - //private static readonly FileInfo TestAsset = new FileInfo(@"C:\Ecoacoustics\WavFiles\TestNoiseRecordings\Cisticola\ms1_2559_628362_20170408_074841_30_0.wav"); - private static readonly FileInfo ConfigFile = PathHelper.ResolveConfigFile("RecognizerConfigFiles", "Towsey.CisticolaExilis.yml"); private static readonly CisticolaExilis Recognizer = new CisticolaExilis(); @@ -58,23 +51,21 @@ public void TestRecognizer() this.SaveTestOutput( outputDirectory => GenericRecognizer.SaveDebugSpectrogram(results, null, outputDirectory, Recognizer.SpeciesName)); - // this test returns with two false-negatives. - // It is possible to get all positive events but creates excess FPs on test data. + // this test returns 17 events with one false-negative and possibly one false-positive. Assert.AreEqual(17, events.Count); Assert.IsNull(scoreTrack); Assert.AreEqual(1, plots.Count); Assert.AreEqual(3747, sonogram.FrameCount); Assert.IsInstanceOfType(events[3], typeof(CompositeEvent)); + var fourthEvent = (CompositeEvent)events[3]; - var secondEvent = (CompositeEvent)events[3]; - - Assert.AreEqual(7.28, secondEvent.EventStartSeconds); - Assert.AreEqual(7.432, secondEvent.EventEndSeconds); - Assert.AreEqual(2542, secondEvent.LowFrequencyHertz); - Assert.AreEqual(3100, secondEvent.HighFrequencyHertz); - Assert.AreEqual(17.91649081319, secondEvent.Score, TestHelper.AllowedDelta); - Assert.AreEqual(0.07765486486, secondEvent.ScoreNormalized, TestHelper.AllowedDelta); + Assert.AreEqual(7.28, fourthEvent.EventStartSeconds); + Assert.AreEqual(7.432, fourthEvent.EventEndSeconds); + Assert.AreEqual(2542, fourthEvent.LowFrequencyHertz); + Assert.AreEqual(3100, fourthEvent.HighFrequencyHertz); + Assert.AreEqual(17.91649081319, fourthEvent.Score, TestHelper.AllowedDelta); + Assert.AreEqual(0.07765486486, fourthEvent.ScoreNormalized, TestHelper.AllowedDelta); } } } \ No newline at end of file