From c0a53262624fad63ad33f1c89fc63cb15d4f1753 Mon Sep 17 00:00:00 2001 From: towsey Date: Wed, 10 Jun 2020 09:16:52 +1000 Subject: [PATCH] Finish work on Australasian Pipit recognizer Issue #321 Finish work on Australasian Pipit recognizer. THis recognizer still has a FP rate of 60 on the noise data set. THis can be improved with better characterisation of the event content. NOTE WARNING @ line 350 in EventExtentions.cs --- .../Birds/AnthusNovaeseelandiae.cs | 17 +++++++++++++--- .../Events/EventExtentions.cs | 20 +------------------ 2 files changed, 15 insertions(+), 22 deletions(-) diff --git a/src/AnalysisPrograms/Recognizers/Birds/AnthusNovaeseelandiae.cs b/src/AnalysisPrograms/Recognizers/Birds/AnthusNovaeseelandiae.cs index 77fd1fcba..e6dafc7e0 100644 --- a/src/AnalysisPrograms/Recognizers/Birds/AnthusNovaeseelandiae.cs +++ b/src/AnalysisPrograms/Recognizers/Birds/AnthusNovaeseelandiae.cs @@ -150,13 +150,18 @@ public override RecognizerResults Recognize( /// A list of composite events. public static List FilterEventsOnFrequencyProfile(List events) { + if (events.Count == 0) + { + return events; + } + // select only the composite events. //var compositeEvents = events.Select(x => (CompositeEvent)x).ToList(); var (compositeEvents, others) = events.FilterForEventType(); - if (compositeEvents == null) + if (compositeEvents == null || compositeEvents.Count == 0) { - return null; + return events; } // get the composite track for each composite event. @@ -165,7 +170,13 @@ public static List FilterEventsOnFrequencyProfile(List { var componentEvents = ev.ComponentEvents; var points = EventExtentions.GetCompositeTrack(componentEvents).ToArray(); - var length = points.Length - 1; + + // For Pipit require minimum of four frames duration. + var length = points.Length; + if (length < 4) + { + continue; + } //WriteFrequencyProfile(points); diff --git a/src/AudioAnalysisTools/Events/EventExtentions.cs b/src/AudioAnalysisTools/Events/EventExtentions.cs index 5d6f63a25..ee7e0fc74 100644 --- a/src/AudioAnalysisTools/Events/EventExtentions.cs +++ b/src/AudioAnalysisTools/Events/EventExtentions.cs @@ -64,16 +64,6 @@ public static List FilterOnBandwidth(List events, doub public static List FilterOnBandwidth(List events, double minBandwidth, double maxBandwidth) { var outputEvents = events.Where(ev => ((SpectralEvent)ev).BandWidthHertz > minBandwidth && ((SpectralEvent)ev).BandWidthHertz < maxBandwidth).ToList(); - - //var outputEvents = new List(); - //foreach (var ev in events) - //{ - // if (((SpectralEvent)ev).BandWidthHertz > minBandwidth && ((SpectralEvent)ev).BandWidthHertz < maxBandwidth) - // { - // outputEvents.Add(ev); - // } - //} - return outputEvents; } @@ -101,15 +91,6 @@ public static List FilterLongEvents(List events, d public static List FilterOnDuration(List events, double minimumDurationSeconds, double maximumDurationSeconds) { var outputEvents = events.Where(ev => ((SpectralEvent)ev).EventDurationSeconds > minimumDurationSeconds && ((SpectralEvent)ev).EventDurationSeconds < maximumDurationSeconds).ToList(); - - //foreach (var ev in events) - //{ - // if (((SpectralEvent)ev).EventDurationSeconds > minimumDurationSeconds && ((SpectralEvent)ev).EventDurationSeconds < maximumDurationSeconds) - // { - // outputEvents.Add(ev); - // } - //} - return outputEvents; } @@ -366,6 +347,7 @@ public static List FilterEventsOnCompositeContent( /// Combines all the tracks in all the events in the passed list into a single track. /// Each frame in the composite event is assigned the spectral point having maximum amplitude. /// The points in the returned array are in temporal order. + /// TODO TODO WARNING! This method needs to be generalised from WhipEvent - see first line. /// /// List of spectral events. public static IEnumerable GetCompositeTrack(List events)