SceneClassifier<T>
Models & Types · AiDotNet.Audio.Classification
Acoustic scene classification model for identifying recording environments.
Inheritance: NeuralNetworkBase<T> → AudioNeuralNetworkBase<T> → AudioClassifierBase<T> → SceneClassifier<T>
Implements: ISceneClassifier<T>
For Beginners
Scene classification answers “Where was this recorded?”:
- Indoor: office, home, shopping mall, restaurant, library
- Outdoor: street, park, beach, forest, construction site
- Transportation: bus, train, metro, airport, car
Usage with ONNX model:
Usage for training:
How It Works
Classifies audio recordings by their acoustic environment or scene context with the DCASE 2017 Task 1 baseline system (Mesaros et al. 2017, sections 2.2 and 3): log mel-band energies in 40 ms frames with 50% overlap over 40 bands from 0 to 22050 Hz, a 5-frame context (a 200-value vector), and a multilayer perceptron of two dense layers of 50 units with 20% dropout under a softmax over the 15 TUT Acoustic Scenes 2017 classes, trained with Adam at a learning rate of 0.001. A recording’s label is the majority vote of its frame decisions.
The baseline also standardizes features with training-set statistics; feed standardized context vectors to
Train and Predict when your recordings’ levels vary widely.
Constructors
| Constructor | Summary |
|---|---|
SceneClassifier(NeuralNetworkArchitecture<T> architecture, SceneClassifierOptions options, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer) |
Creates a SceneClassifier for native training mode. |
SceneClassifier(SceneClassifierOptions options) |
Creates a SceneClassifier with default options for basic classification. |
SceneClassifier(string modelPath, SceneClassifierOptions options) |
Creates a SceneClassifier for ONNX inference mode. |
Properties
| Property | Summary |
|---|---|
IReadOnlyList<string> Scenes { get; } |
Gets the scenes (alias for SupportedScenes for legacy API compatibility). |
IReadOnlyList<string> SupportedScenes { get; } |
Gets the list of scenes this model can classify. |
double MinimumDurationSeconds { get; } |
Gets the minimum audio duration required for reliable classification. |
Methods
| Method | Summary |
|---|---|
IReadOnlyDictionary<string, T> GetSceneProbabilities(Tensor<T> audio) |
Gets scene probabilities for all supported scenes. |
IReadOnlyList<ScenePrediction<T>> GetTopScenes(Tensor<T> audio, int k) |
Gets top-K scene predictions. |
ModelMetadata<T> GetModelMetadata() |
Gets model metadata for serialization. |
SceneClassificationResult<T> Classify(Tensor<T> audio) |
Classifies the acoustic scene of an audio recording. |
SceneTrackingResult<T> TrackSceneChanges(Tensor<T> audio, double segmentDuration) |
Tracks scene changes over time in longer audio. |
Task<SceneClassificationResult<T>> ClassifyAsync(Tensor<T> audio, CancellationToken cancellationToken) |
Classifies the acoustic scene asynchronously. |
Tensor<T> ContextFeatures(Tensor<T> audio) |
The classifier input of a recording, [frames, ContextFrames * NumMels]: per frame, the log mel-band energies of the ContextFrames frames centred on it (edges repeat the first and last frame). |
Tensor<T> ExtractAcousticFeatures(Tensor<T> audio) |
Extracts acoustic features used for scene classification. |
ValueTuple<string, T> ClassifyCategory(Tensor<T> audio) |
Classifies audio and returns category with confidence (legacy API compatibility). |
Fields
| Field | Summary |
|---|---|
string[] StandardScenes |
Standard acoustic scene labels (DCASE-style). |