Object Detection

The parameters are the following:

type

object

properties

  • image_input

../common/image_input.yml

  • classes

Path to the file with detected classes

type

string

  • landmarks

Path to a file with landmarks names

type

string

additionalProperties

False

The OpenAPI definition of the HTTP interface is the following:

swagger: "2.0"
info:
  description: "Object detection aiapp."
  version: "0.0.1"
  title: "Object detection"
paths:
  /inference:
    post:
      summary: "Perform inference on image"
      description: ""
      consumes:
      - "image/jpeg"
      - "image/png"
      produces:
      - "application/json"
      parameters:
      - in: "body"
        name: "body"
        description: "Image 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 for object detection
///
/// \copyright 2018 NVISO SA. All rights reserved.
/// \license This project is released under the XXXXXX License.
///

#pragma once

#include "image_based.hpp"

namespace lpdnn {
namespace ai_app {

/// Object detection AiApp
class Object_detection : virtual public Image_based {
 public:
  struct Result {
    struct Item {
      float confidence;
      int class_index;
      Rect bounding_box;
      Landmarks landmarks;
      Landmarks3d landmarks3d;
      float orientation_confidence{};
      Orientation orientation{};
    };

    bool success{};
    std::vector<Item> items;
  };

  /// Set minimum detectable object size
  /// @return true if success
  virtual bool set_min_size(Dim2d minSize) = 0;

  /// Set maximum detectable object size
  /// @return true if success
  virtual bool set_max_size(Dim2d maxSize) = 0;

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

  /// @return Names of 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#object_detection";
  using Ai_interface_class = Object_detection;
};

}  // namespace ai_app
}  // namespace lpdnn

The default JSON ground truth schema is the following:

Object Detection AI App ground truth

type

array

items

type

object

properties

  • class_index

Index of the class the object belongs to

type

integer

  • bounding_box

#/definitions/Rect

  • landmarks

type

array

items

#/definitions/Dim2d

  • landmarks3d

type

array

items

#/definitions/Dim3d

  • orientation

type

object

properties

  • roll

type

number

  • pitch

type

number

  • yaw

type

number

  • orientation_confidence

type

number

additionalProperties

False

definitions

  • Dim2d

type

object

properties

  • x

type

integer

  • y

type

integer

  • Dim3d

type

object

properties

  • x

type

integer

  • y

type

integer

  • z

type

integer

  • Rect

type

object

properties

  • origin

#/definitions/Dim2d

  • size

#/definitions/Dim2d

The default JSON result serialization is the following:

Object Detection AI App Result

type

object

properties

  • success

type

boolean

  • items

type

array

items

type

object

properties

  • confidence

type

number

  • class_index

type

integer

  • bounding_box

#/definitions/Rect

  • landmarks

type

array

items

oneOf

type

object

properties

  • position

#/definitions/Dim2d

  • confidence

type

integer

additionalProperties

False

#/definitions/Dim2d

  • landmarks3d

type

array

items

oneOf

type

object

properties

  • position

#/definitions/Dim3d

  • confidence

type

integer

additionalProperties

False

#/definitions/Dim3d

  • orientation

type

object

properties

  • roll

type

number

  • pitch

type

number

  • yaw

type

number

  • orientation_confidence

type

number

additionalProperties

False

additionalProperties

False

definitions

  • Dim2d

type

object

properties

  • x

type

integer

  • y

type

integer

  • Dim3d

type

object

properties

  • x

type

integer

  • y

type

integer

  • z

type

integer

  • Rect

type

object

properties

  • origin

#/definitions/Dim2d

  • size

#/definitions/Dim2d