Skip to content

Commit

Permalink
Finish work on Australasian Pipit recognizer
Browse files Browse the repository at this point in the history
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
  • Loading branch information
towsey committed Jun 9, 2020
1 parent adbf1d5 commit c0a5326
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 22 deletions.
17 changes: 14 additions & 3 deletions src/AnalysisPrograms/Recognizers/Birds/AnthusNovaeseelandiae.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,18 @@ public override RecognizerResults Recognize(
/// <returns>A list of composite events.</returns>
public static List<EventCommon> FilterEventsOnFrequencyProfile(List<EventCommon> 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<CompositeEvent, EventCommon>();

if (compositeEvents == null)
if (compositeEvents == null || compositeEvents.Count == 0)
{
return null;
return events;
}

// get the composite track for each composite event.
Expand All @@ -165,7 +170,13 @@ public static List<EventCommon> FilterEventsOnFrequencyProfile(List<EventCommon>
{
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);

Expand Down
20 changes: 1 addition & 19 deletions src/AudioAnalysisTools/Events/EventExtentions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,6 @@ public static List<EventCommon> FilterOnBandwidth(List<EventCommon> events, doub
public static List<EventCommon> FilterOnBandwidth(List<EventCommon> events, double minBandwidth, double maxBandwidth)
{
var outputEvents = events.Where(ev => ((SpectralEvent)ev).BandWidthHertz > minBandwidth && ((SpectralEvent)ev).BandWidthHertz < maxBandwidth).ToList();

//var outputEvents = new List<EventCommon>();
//foreach (var ev in events)
//{
// if (((SpectralEvent)ev).BandWidthHertz > minBandwidth && ((SpectralEvent)ev).BandWidthHertz < maxBandwidth)
// {
// outputEvents.Add(ev);
// }
//}

return outputEvents;
}

Expand Down Expand Up @@ -101,15 +91,6 @@ public static List<SpectralEvent> FilterLongEvents(List<SpectralEvent> events, d
public static List<EventCommon> FilterOnDuration(List<EventCommon> 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;
}

Expand Down Expand Up @@ -366,6 +347,7 @@ public static List<EventCommon> 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.
/// </summary>
/// <param name="events">List of spectral events.</param>
public static IEnumerable<ISpectralPoint> GetCompositeTrack(List<EventCommon> events)
Expand Down

0 comments on commit c0a5326

Please sign in to comment.