Skip to content

Commit

Permalink
Update GenericRecognizer.cs
Browse files Browse the repository at this point in the history
Issue #370 Change Log.Debug to Log.Info in order to get information included in log file.
  • Loading branch information
towsey authored and atruskie committed Oct 14, 2020
1 parent 9575f90 commit abc0199
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/AnalysisPrograms/Recognizers/GenericRecognizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ public override RecognizerResults Recognize(

// effectively keeps only the *last* sonogram produced
allResults.Sonogram = spectrogram;
Log.Debug($"{profileName} event count = {spectralEvents.Count}");
Log.Info($"{profileName} event count = {spectralEvents.Count}");

// DEBUG PURPOSES COMMENT NEXT LINE
//SaveDebugSpectrogram(allResults, genericConfig, outputDirectory, "name");
Expand All @@ -342,14 +342,14 @@ public override RecognizerResults Recognize(
// Step 3: Remove events whose bandwidth is too small or large.
// Step 4: Remove events that have excessive noise in their side-bands.

Log.Debug($"Total event count = {allResults.NewEvents.Count}");
Log.Info($"Total event count = {allResults.NewEvents.Count}");

// 1: Combine overlapping events.
// This will be necessary where many small events have been found - possibly because the dB threshold is set low.
if (configuration.CombineOverlappingEvents)
{
allResults.NewEvents = CompositeEvent.CombineOverlappingEvents(allResults.NewEvents.Cast<EventCommon>().ToList());
Log.Debug($"Event count after combining overlapped events = {allResults.NewEvents.Count}");
Log.Info($"Event count after combining overlapped events = {allResults.NewEvents.Count}");
}

// 2: Combine proximal events, that is, events that may be a sequence of syllables in the same strophe.
Expand All @@ -364,29 +364,29 @@ public override RecognizerResults Recognize(
var startDiff = sequenceConfig.SyllableStartDifference;
var hertzDiff = sequenceConfig.SyllableHertzGap;
allResults.NewEvents = CompositeEvent.CombineProximalEvents(spectralEvents1, TimeSpan.FromSeconds(startDiff), (int)hertzDiff);
Log.Debug($"Event count after combining proximal events = {allResults.NewEvents.Count}");
Log.Info($"Event count after combining proximal events = {allResults.NewEvents.Count}");

// Now filter on properties of the sequences which are treated as Composite events.
if (sequenceConfig.FilterSyllableSequence)
{
// filter on number of components
var maxComponentCount = sequenceConfig.SyllableMaxCount;
allResults.NewEvents = EventExtentions.FilterEventsOnCompositeContent(allResults.NewEvents, maxComponentCount);
Log.Debug($"Event count after filtering on component count = {allResults.NewEvents.Count}");
Log.Info($"Event count after filtering on component count = {allResults.NewEvents.Count}");

// filter on syllable periodicity
var period = sequenceConfig.ExpectedPeriod;
var periodSd = sequenceConfig.PeriodStdDev;
allResults.NewEvents = EventExtentions.FilterEventsOnSyllablePeriodicity(allResults.NewEvents, period, periodSd);
Log.Debug($"Event count after filtering on component count = {allResults.NewEvents.Count}");
Log.Info($"Event count after filtering on component count = {allResults.NewEvents.Count}");
}
}

// 3: Filter the events for bandwidth in Hertz
var expectedEventBandwidth = configuration.ExpectedBandwidth;
var sd = configuration.BandwidthStandardDeviation;
allResults.NewEvents = EventExtentions.FilterOnBandwidth(allResults.NewEvents, expectedEventBandwidth, sd, sigmaThreshold: 3.0);
Log.Debug($"Event count after filtering on bandwidth = {allResults.NewEvents.Count}");
Log.Info($"Event count after filtering on bandwidth = {allResults.NewEvents.Count}");

// 4: Filter events on the amount of acoustic activity in their upper and lower neighbourhoods - their buffer zone.
// The idea is that an unambiguous event should have some acoustic space above and below.
Expand All @@ -402,7 +402,7 @@ public override RecognizerResults Recognize(
segmentStartOffset,
configuration.NeighbourhoodDecibelBuffer);

Log.Debug($"Event count after filtering on acoustic activity in upper/lower neighbourhood = {allResults.NewEvents.Count}");
Log.Info($"Event count after filtering on acoustic activity in upper/lower neighbourhood = {allResults.NewEvents.Count}");
}

return allResults;
Expand Down

0 comments on commit abc0199

Please sign in to comment.