Object Detection
The parameters are the following:
type |
object |
|
properties |
||
|
../common/image_input.yml |
|
|
Path to the file with detected classes |
|
type |
string |
|
|
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 |
||||
|
Index of the class the object belongs to |
|||
type |
integer |
|||
|
#/definitions/Rect |
|||
|
type |
array |
||
items |
#/definitions/Dim2d |
|||
|
type |
array |
||
items |
#/definitions/Dim3d |
|||
|
type |
object |
||
properties |
||||
|
type |
number |
||
|
type |
number |
||
|
type |
number |
||
|
type |
number |
||
additionalProperties |
False |
|||
definitions |
||||
|
type |
object |
||
properties |
||||
|
type |
integer |
||
|
type |
integer |
||
|
type |
object |
||
properties |
||||
|
type |
integer |
||
|
type |
integer |
||
|
type |
integer |
||
|
type |
object |
||
properties |
||||
|
#/definitions/Dim2d |
|||
|
#/definitions/Dim2d |
The default JSON result serialization is the following:
Object Detection AI App Result
type |
object |
||||||
properties |
|||||||
|
type |
boolean |
|||||
|
type |
array |
|||||
items |
type |
object |
|||||
properties |
|||||||
|
type |
number |
|||||
|
type |
integer |
|||||
|
#/definitions/Rect |
||||||
|
type |
array |
|||||
items |
oneOf |
type |
object |
||||
properties |
|||||||
|
#/definitions/Dim2d |
||||||
|
type |
integer |
|||||
additionalProperties |
False |
||||||
#/definitions/Dim2d |
|||||||
|
type |
array |
|||||
items |
oneOf |
type |
object |
||||
properties |
|||||||
|
#/definitions/Dim3d |
||||||
|
type |
integer |
|||||
additionalProperties |
False |
||||||
#/definitions/Dim3d |
|||||||
|
type |
object |
|||||
properties |
|||||||
|
type |
number |
|||||
|
type |
number |
|||||
|
type |
number |
|||||
|
type |
number |
|||||
additionalProperties |
False |
||||||
additionalProperties |
False |
||||||
definitions |
|||||||
|
type |
object |
|||||
properties |
|||||||
|
type |
integer |
|||||
|
type |
integer |
|||||
|
type |
object |
|||||
properties |
|||||||
|
type |
integer |
|||||
|
type |
integer |
|||||
|
type |
integer |
|||||
|
type |
object |
|||||
properties |
|||||||
|
#/definitions/Dim2d |
||||||
|
#/definitions/Dim2d |