From 112bab00ea0da9fd392f14a9a5c62a1c4fc40ea4 Mon Sep 17 00:00:00 2001 From: QUT Ecoacoustics Date: Wed, 20 Sep 2023 21:28:01 +1000 Subject: [PATCH] Improved some recognizers, ensured scores are emitted in results --- .../Truskinger.NinoxConnivens.yml | 75 +++--- .../Truskinger.PetaurusAustralis.yml | 40 ++-- .../Truskinger.TytoNovaehollandiae.yml | 86 ++++--- .../Truskinger.TytoTenebricosa.yml | 220 +++++++++--------- src/AnalysisPrograms/KoalaMale.cs | 5 - .../Recognizers/GenericRecognizer.cs | 1 + .../Events/EventConverters.cs | 2 + .../Events/Types/OscillationEvent.cs | 10 +- 8 files changed, 208 insertions(+), 231 deletions(-) diff --git a/src/AnalysisConfigFiles/RecognizerConfigFiles/Truskinger.NinoxConnivens.yml b/src/AnalysisConfigFiles/RecognizerConfigFiles/Truskinger.NinoxConnivens.yml index 9976d6585..a6b330a64 100644 --- a/src/AnalysisConfigFiles/RecognizerConfigFiles/Truskinger.NinoxConnivens.yml +++ b/src/AnalysisConfigFiles/RecognizerConfigFiles/Truskinger.NinoxConnivens.yml @@ -1,5 +1,4 @@ --- - # Barking Owl = Truskinger.NinoxConnivens # Resample rate must be 2 X the desired Nyquist #ResampleRate: 22050 @@ -11,48 +10,48 @@ SegmentOverlap: 0 # Each of these profiles will be analyzed # This profile is required for the species-specific recognizer and must have the current name. Profiles: - BarkingOwlSyllable: !ForwardTrackParameters - SpeciesName: Ninox connivens - FrameSize: 1024 - FrameStep: 256 - WindowFunction: HANNING + BarkingOwlSyllable: !ForwardTrackParameters + SpeciesName: Ninox connivens + FrameSize: 1024 + FrameStep: 256 + WindowFunction: HANNING - # min and max of the freq band to search - MinHertz: 220 - MaxHertz: 1150 - MinDuration: 0.15 - MaxDuration: 0.18 - # Scan the frequency band at these thresholds - DecibelThresholds: - - 6.0 - - 9.0 - - 12.0 + # min and max of the freq band to search + MinHertz: 220 + MaxHertz: 1150 + MinDuration: 0.15 + MaxDuration: 0.18 + # Scan the frequency band at these thresholds + DecibelThresholds: + - 6.0 + - 9.0 + - 12.0 #################### POST-PROCESSING of EVENTS ################### PostProcessing: -# # 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. + # # 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. -# # 1: Combine overlapping events -# CombineOverlappingEvents: true + # # 2: Combine possible syllable sequences + SyllableSequence: + CombinePossibleSyllableSequence: true + SyllableStartDifference: 0.6 + SyllableHertzGap: 350 + FilterSyllableSequence: true + SyllableMaxCount: 12 + ExpectedPeriod: 0.4 -# # 2: Combine possible syllable sequences -# SyllableSequence: -# CombinePossibleSyllableSequence: true -# SyllableStartDifference: 0.6 -# SyllableHertzGap: 350 -# FilterSyllableSequence: true -# SyllableMaxCount: 2 -# ExpectedPeriod: 0.4 + # # 1: Combine overlapping events + CombineOverlappingEvents: true -# # 3: Remove events whose duration lies outside 3 SDs of an expected value. -# #Duration: -# ExpectedDuration: 0.14 -# DurationStandardDeviation: 0.01 + # # 3: Remove events whose duration lies outside 3 SDs of an expected value. + Duration: + ExpectedDuration: 1.0 + DurationStandardDeviation: 0.2 # # 4: Remove events whose bandwidth lies outside 3 SDs of an expected value. # # Bandwidth: @@ -68,12 +67,8 @@ PostProcessing: # Options to save results files # Available options for saving spectrograms (case-sensitive): [False/Never | True/Always | WhenEventsDetected] # "True" is useful when debugging but "WhenEventsDetected" is required for operational use. -SaveSonogramImages: WhenEventsDetected +SaveSonogramImages: false # Available options for saving data files (case-sensitive): [False/Never | True/Always | WhenEventsDetected] SaveIntermediateWavFiles: Never SaveIntermediateCsvFiles: false - - - -... \ No newline at end of file diff --git a/src/AnalysisConfigFiles/RecognizerConfigFiles/Truskinger.PetaurusAustralis.yml b/src/AnalysisConfigFiles/RecognizerConfigFiles/Truskinger.PetaurusAustralis.yml index 1cdd7e7a2..7d98793c5 100644 --- a/src/AnalysisConfigFiles/RecognizerConfigFiles/Truskinger.PetaurusAustralis.yml +++ b/src/AnalysisConfigFiles/RecognizerConfigFiles/Truskinger.PetaurusAustralis.yml @@ -1,5 +1,4 @@ --- - # Yellow Bellied Glider = Truskinger.PetaurusAustralis.yml # Resample rate must be 2 X the desired Nyquist #ResampleRate: 22050 @@ -16,7 +15,6 @@ CommonParameters: &common_parameters NoiseReductionType: Modal BgNoiseThreshold: 0.0 - # Each of these profiles will be analyzed # This profile is required for the species-specific recognizer and must have the current name. Profiles: @@ -68,13 +66,13 @@ Profiles: PostProcessing: PostProcessInDecibelGroups: false -# # 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. + # # 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. -# # 1: Combine overlapping events + # # 1: Combine overlapping events CombineOverlappingEvents: false # 2: Combine possible syllable sequences @@ -85,32 +83,28 @@ PostProcessing: # SyllableMaxCount: 3 # ExpectedPeriod: 0.1 -# # # 3: Remove events whose duration lies outside 3 SDs of an expected value. + # # # 3: Remove events whose duration lies outside 3 SDs of an expected value. Duration: ExpectedDuration: 2.5 DurationStandardDeviation: 0.6 -# # 4: Remove events whose bandwidth lies outside 3 SDs of an expected value. -# # Bandwidth: -# ExpectedBandwidth: 280 -# BandwidthStandardDeviation: 40 + # # 4: Remove events whose bandwidth lies outside 3 SDs of an expected value. + # # Bandwidth: + # ExpectedBandwidth: 280 + # BandwidthStandardDeviation: 40 -# # 5: Filter the events for excess activity in their sidebands, i.e. upper and lower buffer zones -# SidebandActivity: -# LowerHertzBuffer: 150 -# UpperHertzBuffer: 400 -# MaxAverageSidebandDecibels: 3.0 + # # 5: Filter the events for excess activity in their sidebands, i.e. upper and lower buffer zones + # SidebandActivity: + # LowerHertzBuffer: 150 + # UpperHertzBuffer: 400 + # MaxAverageSidebandDecibels: 3.0 RemoveEnclosedEvents: false # Options to save results files # Available options for saving spectrograms (case-sensitive): [False/Never | True/Always | WhenEventsDetected] # "True" is useful when debugging but "WhenEventsDetected" is required for operational use. -SaveSonogramImages: Always +SaveSonogramImages: false # Available options for saving data files (case-sensitive): [False/Never | True/Always | WhenEventsDetected] SaveIntermediateWavFiles: Never SaveIntermediateCsvFiles: false - - - -... \ No newline at end of file diff --git a/src/AnalysisConfigFiles/RecognizerConfigFiles/Truskinger.TytoNovaehollandiae.yml b/src/AnalysisConfigFiles/RecognizerConfigFiles/Truskinger.TytoNovaehollandiae.yml index 5c1a3293a..d987c1713 100644 --- a/src/AnalysisConfigFiles/RecognizerConfigFiles/Truskinger.TytoNovaehollandiae.yml +++ b/src/AnalysisConfigFiles/RecognizerConfigFiles/Truskinger.TytoNovaehollandiae.yml @@ -1,5 +1,4 @@ --- - # Masked Owl = Truskinger.TytoNovaehollandiae.yml # Resample rate must be 2 X the desired Nyquist #ResampleRate: 22050 @@ -14,51 +13,48 @@ SpeciesName: Tyto novaehollandiae # Each of these profiles will be analyzed # This profile is required for the species-specific recognizer and must have the current name. Profiles: - MaskedOwlCall: !BlobParameters - SpeciesName: Tyto novaehollandiae - FrameSize: 256 - FrameStep: 128 - WindowFunction: HANNING - - # min and max of the freq band to search - MinHertz: 1050 - MaxHertz: 2900 - MinDuration: 1.5 - MaxDuration: 3.0 - BottomHertzBuffer: 300 - TopHertzBuffer: 300 - # Scan the frequency band at these thresholds - DecibelThresholds: - - 1.0 - - 9.0 - - 12.0 - MaskedOwlCallAed: !AedParameters - IntensityThreshold: 3 - SmallAreaThreshold: 1000 - BandpassMinimum: 1200 - BandpassMaximum: 2800 - + MaskedOwlCall: !BlobParameters + SpeciesName: Tyto novaehollandiae + FrameSize: 256 + FrameStep: 128 + WindowFunction: HAMMING + + # min and max of the freq band to search + MinHertz: 1050 + MaxHertz: 3500 + MinDuration: 0.1 + MaxDuration: 3.0 + BottomHertzBuffer: 300 + TopHertzBuffer: 300 + # Scan the frequency band at these thresholds + DecibelThresholds: + - 2.0 + # MaskedOwlCallAed: !AedParameters + # IntensityThreshold: 3 + # SmallAreaThreshold: 1000 + # BandpassMinimum: 1200 + # BandpassMaximum: 2800 #################### POST-PROCESSING of EVENTS ################### PostProcessing: -# # 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. - -# # 1: Combine overlapping events -# CombineOverlappingEvents: true - -# # 2: Combine possible syllable sequences - SyllableSequence: - CombinePossibleSyllableSequence: true - SyllableStartDifference: 2 - SyllableHertzGap: 300 - FilterSyllableSequence: true - SyllableMaxCount: 2 - ExpectedPeriod: 2 + # # 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. + + # # 1: Combine overlapping events + # CombineOverlappingEvents: true + + # # 2: Combine possible syllable sequences + SyllableSequence: + CombinePossibleSyllableSequence: true + SyllableStartDifference: 2 + SyllableHertzGap: 300 + FilterSyllableSequence: true + SyllableMaxCount: 3 + ExpectedPeriod: 1.2 # # 3: Remove events whose duration lies outside 3 SDs of an expected value. # #Duration: @@ -79,12 +75,8 @@ PostProcessing: # Options to save results files # Available options for saving spectrograms (case-sensitive): [False/Never | True/Always | WhenEventsDetected] # "True" is useful when debugging but "WhenEventsDetected" is required for operational use. -SaveSonogramImages: WhenEventsDetected +SaveSonogramImages: false # Available options for saving data files (case-sensitive): [False/Never | True/Always | WhenEventsDetected] SaveIntermediateWavFiles: Never SaveIntermediateCsvFiles: false - - - -... \ No newline at end of file diff --git a/src/AnalysisConfigFiles/RecognizerConfigFiles/Truskinger.TytoTenebricosa.yml b/src/AnalysisConfigFiles/RecognizerConfigFiles/Truskinger.TytoTenebricosa.yml index ade46d113..daf4b57e4 100644 --- a/src/AnalysisConfigFiles/RecognizerConfigFiles/Truskinger.TytoTenebricosa.yml +++ b/src/AnalysisConfigFiles/RecognizerConfigFiles/Truskinger.TytoTenebricosa.yml @@ -1,5 +1,4 @@ --- - # Sooty Owl = Truskinger.TytoTenebricosa.yml # Resample rate must be 2 X the desired Nyquist #ResampleRate: 22050 @@ -8,133 +7,128 @@ SegmentDuration: 60 # SegmentOverlap: units=seconds; SegmentOverlap: 0 - CommonParameters: &common_parameters - SpeciesName: Tyto tenebricosa - FrameSize: 2048 - FrameStep: 256 - WindowFunction: HANNING - NoiseReductionType: Standard - BgNoiseThreshold: 3 - # Scan the frequency band at these thresholds - DecibelThresholds: - #- 9.0 - - 12.0 - - 15 + SpeciesName: Tyto tenebricosa + FrameSize: 2048 + FrameStep: 256 + WindowFunction: HANNING + NoiseReductionType: Standard + BgNoiseThreshold: 3 + # Scan the frequency band at these thresholds + DecibelThresholds: + #- 9.0 + - 12.0 + - 15 TrillParameters: &tree_parameters - SpeciesName: Tyto tenebricosa - FrameSize: 2048 - FrameStep: 256 - WindowFunction: HANNING - NoiseReductionType: Standard - BgNoiseThreshold: 3 - # Scan the frequency band at these thresholds - DecibelThresholds: - - 9.0 - #- 12.0 - #- 15 + SpeciesName: Tyto tenebricosa + FrameSize: 2048 + FrameStep: 256 + WindowFunction: HANNING + NoiseReductionType: Standard + BgNoiseThreshold: 3 + # Scan the frequency band at these thresholds + DecibelThresholds: + - 9.0 + #- 12.0 + #- 15 # Each of these profiles will be analyzed # This profile is required for the species-specific recognizer and must have the current name. Profiles: - Screech: !HarmonicParameters - <<: *common_parameters - - # min and max of the freq band to search - MinHertz: 1200 - MaxHertz: 6500 - MinFormantGap: 400 - MaxFormantGap: 6500 - DctThreshold: 0.3 - MinDuration: 0.9 - MaxDuration: 3.0 - - TrillHighUp: !BlobParameters - <<: *tree_parameters - - # min and max of the freq band to search - MinHertz: 8000 - MaxHertz: 11025 - MinDuration: 0.7 - MaxDuration: 1.5 - BottomHertzBuffer: 0 - TopHertzBuffer: 0 - TrillHighDown: !BlobParameters - <<: *tree_parameters - - # min and max of the freq band to search - MinHertz: 5800 - MaxHertz: 10300 - MinDuration: 0.1 - MaxDuration: 0.3 - BottomHertzBuffer: 0 - TopHertzBuffer: 100 - TrillMidDown: !BlobParameters - <<: *tree_parameters - - # min and max of the freq band to search - MinHertz: 4500 - MaxHertz: 9400 - MinDuration: 0.7 - MaxDuration: 1.1 - BottomHertzBuffer: 0 - TopHertzBuffer: 0 - TrillMidUShape: !BlobParameters - <<: *tree_parameters - - # min and max of the freq band to search - MinHertz: 5800 - MaxHertz: 8200 - MinDuration: 0.3 - MaxDuration: 1.5 - BottomHertzBuffer: 0 - TopHertzBuffer: 0 + Screech: !HarmonicParameters + <<: *common_parameters + + # min and max of the freq band to search + MinHertz: 1200 + MaxHertz: 6500 + MinFormantGap: 400 + MaxFormantGap: 6500 + DctThreshold: 0.3 + MinDuration: 0.9 + MaxDuration: 3.0 + + TrillHighUp: !BlobParameters + <<: *tree_parameters + + # min and max of the freq band to search + MinHertz: 8000 + MaxHertz: 11025 + MinDuration: 0.7 + MaxDuration: 1.5 + BottomHertzBuffer: 0 + TopHertzBuffer: 0 + TrillHighDown: !BlobParameters + <<: *tree_parameters + + # min and max of the freq band to search + MinHertz: 5800 + MaxHertz: 10300 + MinDuration: 0.1 + MaxDuration: 0.3 + BottomHertzBuffer: 0 + TopHertzBuffer: 100 + TrillMidDown: !BlobParameters + <<: *tree_parameters + + # min and max of the freq band to search + MinHertz: 4500 + MaxHertz: 9400 + MinDuration: 0.7 + MaxDuration: 1.1 + BottomHertzBuffer: 0 + TopHertzBuffer: 0 + TrillMidUShape: !BlobParameters + <<: *tree_parameters + + # min and max of the freq band to search + MinHertz: 5800 + MaxHertz: 8200 + MinDuration: 0.3 + MaxDuration: 1.5 + BottomHertzBuffer: 0 + TopHertzBuffer: 0 #################### POST-PROCESSING of EVENTS ################### PostProcessing: - PostProcessInDecibelGroups: false -# # 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. - -# # 1: Combine overlapping events - # CombineOverlappingEvents: true - - # # 2: Combine possible syllable sequences - # SyllableSequence: - # CombinePossibleSyllableSequence: true - # SyllableStartDifference: 1.5 - # SyllableHertzGap: 3000 - -# # 3: Remove events whose duration lies outside 3 SDs of an expected value. -# #Duration: -# ExpectedDuration: 0.14 -# DurationStandardDeviation: 0.01 - -# # 4: Remove events whose bandwidth lies outside 3 SDs of an expected value. -# # Bandwidth: -# ExpectedBandwidth: 280 -# BandwidthStandardDeviation: 40 - -# # 5: Filter the events for excess activity in their sidebands, i.e. upper and lower buffer zones -# SidebandActivity: -# LowerHertzBuffer: 150 -# UpperHertzBuffer: 400 -# MaxAverageSidebandDecibels: 3.0 - RemoveEnclosedEvents: true + PostProcessInDecibelGroups: false + # # 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. + + # # 1: Combine overlapping events + # CombineOverlappingEvents: true + + # # 2: Combine possible syllable sequences + # SyllableSequence: + # CombinePossibleSyllableSequence: true + # SyllableStartDifference: 1.5 + # SyllableHertzGap: 3000 + + # # 3: Remove events whose duration lies outside 3 SDs of an expected value. + # #Duration: + # ExpectedDuration: 0.14 + # DurationStandardDeviation: 0.01 + + # # 4: Remove events whose bandwidth lies outside 3 SDs of an expected value. + # # Bandwidth: + # ExpectedBandwidth: 280 + # BandwidthStandardDeviation: 40 + + # # 5: Filter the events for excess activity in their sidebands, i.e. upper and lower buffer zones + # SidebandActivity: + # LowerHertzBuffer: 150 + # UpperHertzBuffer: 400 + # MaxAverageSidebandDecibels: 3.0 + RemoveEnclosedEvents: true # Options to save results files # Available options for saving spectrograms (case-sensitive): [False/Never | True/Always | WhenEventsDetected] # "True" is useful when debugging but "WhenEventsDetected" is required for operational use. -SaveSonogramImages: Always +SaveSonogramImages: false # Available options for saving data files (case-sensitive): [False/Never | True/Always | WhenEventsDetected] SaveIntermediateWavFiles: Never SaveIntermediateCsvFiles: false - - - -... \ No newline at end of file diff --git a/src/AnalysisPrograms/KoalaMale.cs b/src/AnalysisPrograms/KoalaMale.cs index d457d3f93..84b00368d 100644 --- a/src/AnalysisPrograms/KoalaMale.cs +++ b/src/AnalysisPrograms/KoalaMale.cs @@ -297,11 +297,6 @@ public override AnalysisResult2 Analyze(AnalysisSettings analysisSettings, Se analysisResults.EventsFile = segmentSettings.SegmentEventsFile; } - if (analysisSettings.AnalysisDataSaveBehavior) - { - // noop - } - if (analysisSettings.AnalysisImageSaveBehavior.ShouldSave(analysisResults.Events.Length)) { string imagePath = segmentSettings.SegmentImageFile.FullName; diff --git a/src/AnalysisPrograms/Recognizers/GenericRecognizer.cs b/src/AnalysisPrograms/Recognizers/GenericRecognizer.cs index f59e201e0..a0432897a 100644 --- a/src/AnalysisPrograms/Recognizers/GenericRecognizer.cs +++ b/src/AnalysisPrograms/Recognizers/GenericRecognizer.cs @@ -145,6 +145,7 @@ public override RecognizerResults Recognize( // ############################### PRE-PROCESSING ############################### // may at some future date do pre-processing + // ############################### PROCESSING: DETECTION OF GENERIC EVENTS ############################### var results = RunProfiles(audioRecording, configuration, segmentStartOffset); diff --git a/src/AudioAnalysisTools/Events/EventConverters.cs b/src/AudioAnalysisTools/Events/EventConverters.cs index 414ecfeda..e390ddbfd 100644 --- a/src/AudioAnalysisTools/Events/EventConverters.cs +++ b/src/AudioAnalysisTools/Events/EventConverters.cs @@ -22,6 +22,7 @@ public static SpectralEvent ConvertAcousticEventToSpectralEvent(this AcousticEve Name = ae.Name, //SegmentStartSeconds = ae.SegmentStartSeconds, SegmentDurationSeconds = ae.SegmentDurationSeconds, + Score = ae.Score, }; } @@ -36,6 +37,7 @@ public static AcousticEvent ConvertSpectralEventToAcousticEvent(this SpectralEve { Name = se.Name, SegmentDurationSeconds = se.SegmentDurationSeconds, + Score = se.Score, }; return ae; diff --git a/src/AudioAnalysisTools/Events/Types/OscillationEvent.cs b/src/AudioAnalysisTools/Events/Types/OscillationEvent.cs index a70a05f46..187e8be9e 100644 --- a/src/AudioAnalysisTools/Events/Types/OscillationEvent.cs +++ b/src/AudioAnalysisTools/Events/Types/OscillationEvent.cs @@ -44,7 +44,7 @@ public override void Draw(IImageProcessingContext graphics, EventRenderingOption /// /// Extracts an event from a spectrogram given its bounds. /// Then trims the event because oscillation events do not typically start where the DCT places them. - /// It a;sp returns the periodicity of the oscillation event. + /// It also returns the periodicity of the oscillation event. /// public static (int EventStart, int EventEnd, double FramePeriod) TrimEvent(SpectrogramStandard spectrogram, int startFrame, int minBin, int endFrame, int maxBin) { @@ -93,8 +93,12 @@ public static (int EventStart, int EventEnd, double FramePeriod) TrimEvent(Spect } // calculate the length of a whole number of complete periods. - int framePeriods = peakOnsets[peakOnsets.Count - 1] - peakOnsets[0]; - double framePeriod = framePeriods / (double)(stepCount - 1); + double framePeriod = 0; + if (stepCount > 0) + { + int framePeriods = peakOnsets[peakOnsets.Count - 1] - peakOnsets[0]; + framePeriod = framePeriods / (double)(stepCount - 1); + } return (trueStartFrame, trueEndFrame, framePeriod); }