-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Stub out initial recogniser files for NSW DPI project
Also added a generic recogniser template snippet that helps generate the boiler plate.
- Loading branch information
Showing
23 changed files
with
783 additions
and
267 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// <copyright file="Citation.cs" company="QutEcoacoustics"> | ||
// All code in this file and all associated files are the copyright and property of the QUT Ecoacoustics Research Group (formerly MQUTeR, and formerly QUT Bioacoustics Research Group). | ||
// </copyright> | ||
|
||
namespace AnalysisBase | ||
{ | ||
using System; | ||
using System.Collections.Generic; | ||
using Acoustics.Shared; | ||
|
||
public record Citation(IReadOnlyCollection<Author> Authors, string Title, string Project, string Uri); | ||
|
||
public record Author(string FirstName, string LastName, string Affiliation, params string[] OtherNames); | ||
|
||
public interface ICiteable | ||
{ | ||
public IReadOnlyCollection<Citation> Citations => Array.Empty<Citation>(); | ||
} | ||
|
||
public static class Bibliography | ||
{ | ||
public static Author Anthony => new Author("Anthony", "Truskinger", "QUT Ecoacoustics"); | ||
|
||
public static Author Michael => new Author("Michael", "Towsey", "QUT Ecoacoustics"); | ||
|
||
public static Author Paul => new Author("Paul", "Roe", "QUT Ecoacoustics"); | ||
|
||
public static Author Kristen => new Author("Kristen", "Thompson", "NSW DPI"); | ||
|
||
public static Author Brad => new Author("Brad", "Law", "NSW DPI"); | ||
|
||
public static IReadOnlyCollection<Author> BuiltByAnthony => new[] { Anthony, Kristen, Michael, Paul, Brad }; | ||
|
||
public static IReadOnlyCollection<Author> BuiltByMichael => new[] { Michael, Kristen, Anthony, Paul, Brad }; | ||
|
||
public static Citation NswDpiRecognisersProject => new Citation( | ||
Array.Empty<Author>(), | ||
string.Empty, | ||
"Recogniser project with NSW DPI: grant xxxx", | ||
string.Empty); | ||
|
||
public static Citation QutEcoacousticsProject => new Citation( | ||
Array.Empty<Author>(), | ||
string.Empty, | ||
$"Recognizers devdeloped for various projects by {Meta.GroupName}", | ||
Meta.Website); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// -------------------------------------------------------------------------------------------------------------------- | ||
// <copyright file="IAnalyser2.cs" company="QutEcoacoustics"> | ||
// All code in this file and all associated files are the copyright and property of the QUT Ecoacoustics Research Group (formerly MQUTeR, and formerly QUT Bioacoustics Research Group). | ||
// </copyright> | ||
// <summary> | ||
// Interface a compatible analysis must implement. | ||
// This is a strong typed version of <c>IAnalyser</c> intentionally removed from the old inheritance tree. | ||
// DO NOT MODIFY THIS FILE UNLESS INSTRUCTED TO! | ||
// </summary> | ||
// -------------------------------------------------------------------------------------------------------------------- | ||
|
||
namespace AnalysisBase | ||
{ | ||
public interface IHasStatus | ||
{ | ||
public Status Status => Status.Unknown; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// -------------------------------------------------------------------------------------------------------------------- | ||
// <copyright file="IAnalyser2.cs" company="QutEcoacoustics"> | ||
// All code in this file and all associated files are the copyright and property of the QUT Ecoacoustics Research Group (formerly MQUTeR, and formerly QUT Bioacoustics Research Group). | ||
// </copyright> | ||
// <summary> | ||
// Interface a compatible analysis must implement. | ||
// This is a strong typed version of <c>IAnalyser</c> intentionally removed from the old inheritance tree. | ||
// DO NOT MODIFY THIS FILE UNLESS INSTRUCTED TO! | ||
// </summary> | ||
// -------------------------------------------------------------------------------------------------------------------- | ||
|
||
namespace AnalysisBase | ||
{ | ||
public enum Status | ||
{ | ||
Unknown = 0, | ||
InDevelopment, | ||
Alpha, | ||
Beta, | ||
Maintained, | ||
Unmaintained, | ||
Retired, | ||
} | ||
} |
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
// <copyright file="NinoxConnivens.cs" company="QutEcoacoustics"> | ||
// All code in this file and all associated files are the copyright and property of the QUT Ecoacoustics Research Group (formerly MQUTeR, and formerly QUT Bioacoustics Research Group). | ||
// </copyright> | ||
|
||
namespace AnalysisPrograms.Recognizers.Birds | ||
{ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Reflection; | ||
using System.Runtime.CompilerServices; | ||
using System.Text; | ||
using Acoustics.Shared.ConfigFile; | ||
using AnalysisBase; | ||
using AnalysisPrograms.Recognizers.Base; | ||
using AudioAnalysisTools.Indices; | ||
using AudioAnalysisTools.WavTools; | ||
using log4net; | ||
|
||
/// <summary> | ||
/// A recognizer for the Barking Owl, https://en.wikipedia.org/wiki/Barking_owl. | ||
/// The barking owl (Ninox connivens), also known as the winking owl, is a nocturnal bird species native to mainland Australia | ||
/// and partsof Papua New Guinea and the Moluccas. They are a medium-sized brown owl and have a characteristic voice with | ||
/// calls ranging from a barking dog noise to a shrill human-like howl of great intensity. | ||
/// This recognizer has been trained on good quality calls provided by NSW DPI by Brad Law and Kristen Thompson. | ||
/// </summary> | ||
public class NinoxConnivens : RecognizerBase | ||
{ | ||
private static readonly ILog Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
|
||
public override string Author => Bibliography.Anthony.LastName; | ||
|
||
public override string SpeciesName => "NinoxConnivens"; | ||
|
||
public override string CommonName => "Barking owl"; | ||
|
||
public Status Status => Status.InDevelopment; | ||
|
||
public override string Description => $"Acoustic event recognizer for the {this.CommonName}."; | ||
|
||
public IReadOnlyCollection<Citation> Citations => new[] { | ||
Bibliography.NswDpiRecognisersProject with { | ||
Authors = Bibliography.BuiltByAnthony, | ||
Title = this.Description, | ||
}, | ||
}; | ||
|
||
public override AnalyzerConfig ParseConfig(FileInfo file) | ||
{ | ||
RuntimeHelpers.RunClassConstructor(typeof(NinoxConnivensConfig).TypeHandle); | ||
var config = ConfigFile.Deserialize<NinoxConnivensConfig>(file); | ||
|
||
// validation of configs can be done here | ||
GenericRecognizer.ValidateProfileTagsMatchAlgorithms(config.Profiles, file); | ||
return config; | ||
} | ||
|
||
public override RecognizerResults Recognize( | ||
AudioRecording audioRecording, | ||
Config configuration, | ||
TimeSpan segmentStartOffset, | ||
Lazy<IndexCalculateResult[]> getSpectralIndexes, | ||
DirectoryInfo outputDirectory, | ||
int? imageWidth) | ||
{ | ||
var genericConfig = (NinoxConnivensConfig)configuration; | ||
var recognizer = new GenericRecognizer(); | ||
|
||
// Use the generic recognizers to find all generic events. | ||
RecognizerResults combinedResults = recognizer.Recognize( | ||
audioRecording, | ||
genericConfig, | ||
segmentStartOffset, | ||
getSpectralIndexes, | ||
outputDirectory, | ||
imageWidth); | ||
|
||
return combinedResults; | ||
} | ||
|
||
public class NinoxConnivensConfig : GenericRecognizer.GenericRecognizerConfig | ||
{ | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.