Audio Classification

The parameters are the following:

type

object

properties

  • audio_input

../common/audio_input.yml

  • classes

Path to the file with detected classes

type

string

additionalProperties

False

The OpenAPI definition of the HTTP interface is the following:

swagger: "2.0"
info:
  description: "Audio classification aiapp."
  version: "0.0.1"
  title: "Audio Classification"
paths:
  /inference:
    post:
      summary: "Perform inference on Audio chunk"
      description: ""
      consumes:
      - "audio/wav"
      produces:
      - "application/json"
      parameters:
      - in: "body"
        name: "body"
        description: "Audio chunk to analyze"
        required: true
        schema:
          type: string
          format: binary
      responses:
        200:
          description: "Success"
          schema:
            "$ref": 'results.yml'

The C++ interface definition is the following:

///
/// Ai-app interface and types for audio-classification ai-app
///
/// \copyright 2019 NVISO SA. All rights reserved.
/// \license This project is released under the XXXXXX License.
///

#pragma once

#include "audio_based.hpp"

namespace lpdnn {
namespace ai_app {

/// Audio Classification AiApp
class Audio_classification : virtual public Audio_based {
 public:
  struct Result {
    bool success{};
    std::vector<float> confidence;
  };

  /// Perform inference.
  virtual Result execute(const Audio_chunk& input, const std::vector<ai_app::Blob>& additional_inputs) = 0;
  virtual Result execute(const Audio_chunk& input) = 0;

  /// @return Names of audio classes
  virtual std::vector<std::string> classes() = 0;

  /// @return our aiapp class id
  const char* interface_name() const override { return ai_interface_name; }
  static constexpr char const* ai_interface_name = "com_bonseyes/interfaces#audio_classification";
  using Ai_interface_class = Audio_classification;
};

}  // namespace ai_app
}  // namespace lpdnn

The default JSON ground truth schema is the following:

Audio Classification AI App ground truth

Index of the class to which the audio belongs to

type

integer

The default JSON result serialization is the following:

Audio Classification AI App Result

type

object

properties

  • success

type

boolean

  • confidence

type

array

items

type

number

additionalProperties

False