Skip to content

Commit

Permalink
Finished debugging Cisticola and tests
Browse files Browse the repository at this point in the history
Issue #321
  • Loading branch information
towsey committed Jun 12, 2020
1 parent 5ffd6a5 commit 83d0ce3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 ###################
Expand All @@ -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
Expand All @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/// <summary>
Expand All @@ -25,11 +20,9 @@ namespace Acoustics.Test.AnalysisPrograms.Recognizers
public class CisticolaTests : OutputDirectoryTest
{
/// <summary>
/// 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.
/// </summary>
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();

Expand Down Expand Up @@ -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);
}
}
}

0 comments on commit 83d0ce3

Please sign in to comment.