diff --git a/src/AnalysisConfigFiles/RecognizerConfigFiles/Towsey.NinoxStrenua.yml b/src/AnalysisConfigFiles/RecognizerConfigFiles/Towsey.NinoxStrenua.yml index 524d46c3b..55191e0c9 100644 --- a/src/AnalysisConfigFiles/RecognizerConfigFiles/Towsey.NinoxStrenua.yml +++ b/src/AnalysisConfigFiles/RecognizerConfigFiles/Towsey.NinoxStrenua.yml @@ -19,19 +19,58 @@ SegmentOverlap: 0 # Each of these profiles will be analyzed # This profile is required for the species-specific recogniser and must have the current name. Profiles: - StrenuaSyllable: !ForwardTrackParameters + StrenuaSyllable6db: !ForwardTrackParameters ComponentName: RidgeTrack SpeciesName: NinoxStrenua FrameSize: 1024 FrameStep: 256 WindowFunction: HANNING + DecibelThreshold: 6.0 # min and max of the freq band to search MinHertz: 300 MaxHertz: 600 - MinDuration: 0.2 - MaxDuration: 2.5 - DecibelThreshold: 6.0 + MinDuration: 0.25 + MaxDuration: 0.7 + StrenuaSyllable12db: !ForwardTrackParameters + ComponentName: RidgeTrack + SpeciesName: NinoxStrenua + FrameSize: 1024 + FrameStep: 256 + WindowFunction: HANNING + DecibelThreshold: 12.0 + # min and max of the freq band to search + MinHertz: 300 + MaxHertz: 600 + MinDuration: 0.25 + MaxDuration: 0.7 + + StrenuaSyllable24db: !ForwardTrackParameters + ComponentName: RidgeTrack + SpeciesName: NinoxStrenua + FrameSize: 1024 + FrameStep: 256 + WindowFunction: HANNING + DecibelThreshold: 24.0 + # min and max of the freq band to search + MinHertz: 300 + MaxHertz: 600 + MinDuration: 0.25 + MaxDuration: 0.7 + + StrenuaSyllable24db: !ForwardTrackParameters + ComponentName: RidgeTrack + SpeciesName: NinoxStrenua + FrameSize: 1024 + FrameStep: 256 + WindowFunction: HANNING + DecibelThreshold: 30.0 + # min and max of the freq band to search + MinHertz: 300 + MaxHertz: 600 + MinDuration: 0.25 + MaxDuration: 0.7 + #################### POST-PROCESSING of EVENTS ################### # The first two post-processing steps are to combine overlapping/proximal/sequential events @@ -48,8 +87,8 @@ SyllableSequence: ExpectedPeriod: 0.92 # this figure derived from measure of 12 syllable periods. # 3: Remove events whose bandwidth lies outside 3 SDs of an expected value. -ExpectedBandwidth: 200 -BandwidthStandardDeviation: 40 +ExpectedBandwidth: 150 +BandwidthStandardDeviation: 20 # 4: Filter the events for excess activity in their sidebands, i.e. upper and lower buffer zones NeighbourhoodLowerHertzBuffer: 0 diff --git a/src/AnalysisPrograms/Recognizers/Birds/NinoxStrenua.cs b/src/AnalysisPrograms/Recognizers/Birds/NinoxStrenua.cs index 670a9bbed..61f396ef9 100644 --- a/src/AnalysisPrograms/Recognizers/Birds/NinoxStrenua.cs +++ b/src/AnalysisPrograms/Recognizers/Birds/NinoxStrenua.cs @@ -42,16 +42,7 @@ public override AnalyzerConfig ParseConfig(FileInfo file) // validation of configs can be done here GenericRecognizer.ValidateProfileTagsMatchAlgorithms(config.Profiles, file); - - // This call sets a restriction so that only one generic algorithm is used. - // CHANGE this to accept multiple generic algorithms as required. - //if (result.Profiles.SingleOrDefault() is ForwardTrackParameters) - if (config.Profiles?.Count == 1 && config.Profiles.First().Value is ForwardTrackParameters) - { - return config; - } - - throw new ConfigFileException("NinoxStrenua expects one and only one ForwardTrack algorithm.", file); + return config; } /// @@ -76,6 +67,7 @@ public override RecognizerResults Recognize( var genericConfig = (NinoxStrenuaConfig)config; var recognizer = new GenericRecognizer(); + // Use the generic recognizers to find all generic events. RecognizerResults combinedResults = recognizer.Recognize( audioRecording, genericConfig, @@ -97,14 +89,15 @@ public override RecognizerResults Recognize( //var spectralEvents = events.Select(x => (SpectralEvent)x).ToList(); //NOTE: - // The generic recognizer does some post-processing of events prior to returning the list of combined events. - // Its post-processing steps are determined by config settings. + // The generic recognizer has already done the following post-processing of events prior to returning a combined list of events. // Generic post processing step 1: Combine overlapping events. // Generic post processing step 2: Combine possible syllable sequences and filter on excess syllable count. // Generic post processing step 3: Remove events whose bandwidth is too small or large. // Generic post processing step 4: Remove events that have excessive noise in their side-bands. - // Post-processing steps are put here: + // Additional post-processing steps are put here. + // NOTE: THE POST-PROCESSING STEPS BETWEEN HERE AND OF METHOD ARE THE ONLY STEPS THAT MAKE THIS A DIFFERENT RECOGNIZER FROM THE GENERIC. + // TYPICALLY YOU WOULD PROCESS THE INDIVIDUAL TRACKS IN EACH METHOD LOOKING FOR A SPECIFIC SHAPE. if (combinedResults.NewEvents.Count == 0) { @@ -117,22 +110,22 @@ public override RecognizerResults Recognize( return combinedResults; } -/* -/// -/// Summarize your results. This method is invoked exactly once per original file. -/// -public override void SummariseResults( - AnalysisSettings settings, - FileSegment inputFileSegment, - EventBase[] events, - SummaryIndexBase[] indices, - SpectralIndexBase[] spectralIndices, - AnalysisResult2[] results) -{ - // No operation - do nothing. Feel free to add your own logic. - base.SummariseResults(settings, inputFileSegment, events, indices, spectralIndices, results); -} -*/ + /* + /// + /// Summarize your results. This method is invoked exactly once per original file. + /// + public override void SummariseResults( + AnalysisSettings settings, + FileSegment inputFileSegment, + EventBase[] events, + SummaryIndexBase[] indices, + SpectralIndexBase[] spectralIndices, + AnalysisResult2[] results) + { + // No operation - do nothing. Feel free to add your own logic. + base.SummariseResults(settings, inputFileSegment, events, indices, spectralIndices, results); + } + */ public class NinoxStrenuaConfig : GenericRecognizerConfig, INamedProfiles { diff --git a/src/AnalysisPrograms/Recognizers/GenericRecognizer.cs b/src/AnalysisPrograms/Recognizers/GenericRecognizer.cs index a9808cbc2..22c88aa8a 100644 --- a/src/AnalysisPrograms/Recognizers/GenericRecognizer.cs +++ b/src/AnalysisPrograms/Recognizers/GenericRecognizer.cs @@ -335,7 +335,12 @@ public override RecognizerResults Recognize( //SaveDebugSpectrogram(allResults, genericConfig, outputDirectory, "name"); } - // ######################################################## POST-PROCESSING OF GENERIC EVENTS + // ############################### POST-PROCESSING OF GENERIC EVENTS + // The following generic post-processing steps are determined by config settings. + // Step 1: Combine overlapping events - events derived from all profiles. + // Step 2: Combine possible syllable sequences and filter on excess syllable count. + // 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}"); @@ -517,6 +522,9 @@ public class GenericRecognizerConfig : RecognizerConfig, INamedProfiles public double NeighbourhoodDecibelBuffer { get; set; } } + /// + /// The properties in this config class are required to combine a sequence of similar syllables into a single event. + /// public class SyllableSequenceConfig { // ################ The first three properties concern the combining of syllables into a sequence or stroph.