ONE - On-device Neural Engine
Loading...
Searching...
No Matches
onert::backend::cpu::ops::DetectionPostProcessLayer Class Reference

#include <DetectionPostProcessLayer.h>

Collaboration diagram for onert::backend::cpu::ops::DetectionPostProcessLayer:

Data Structures

struct  Allocations
 
struct  CenterSizeBox
 
struct  CornerBox
 
struct  DetectionPostProcessParameters
 

Public Types

enum  SelectionFormat { BOX_INDEX = 1 , CLASS_INDEX = 0 }
 

Public Member Functions

 DetectionPostProcessLayer ()
 
virtual ~DetectionPostProcessLayer ()
 
void configure (DetectionPostProcessParameters parameters)
 
void run () override
 
- Public Member Functions inherited from onert::exec::IFunction
virtual ~IFunction ()=default
 
virtual void prepare ()
 

Detailed Description

Definition at line 33 of file DetectionPostProcessLayer.h.

Member Enumeration Documentation

◆ SelectionFormat

Constructor & Destructor Documentation

◆ DetectionPostProcessLayer()

onert::backend::cpu::ops::DetectionPostProcessLayer::DetectionPostProcessLayer ( )
inline

Definition at line 82 of file DetectionPostProcessLayer.h.

82 : _parameters{}
83 {
84 // DO NOTHING
85 }

◆ ~DetectionPostProcessLayer()

onert::backend::cpu::ops::DetectionPostProcessLayer::~DetectionPostProcessLayer ( )
virtual

Member Function Documentation

◆ configure()

◆ run()

void onert::backend::cpu::ops::DetectionPostProcessLayer::run ( )
overridevirtual

Implements onert::exec::IFunction.

Definition at line 281 of file DetectionPostProcessLayer.cc.

282{
283 auto nbatches = (unsigned int)_parameters.boxes_descr[0];
284 // no suport for batch other than 1( it's fine since tflite does not support
285 // batch for postprocess either )
286 assert(nbatches == 1);
287
288 auto boxes_a = toArray<float>(_parameters.boxes_input->buffer(), _parameters.boxes_descr);
289 auto scores_a = toArray<float>(_parameters.scores_input->buffer(), _parameters.scrores_descr);
290
291 auto num_selected_a = ndarray::Array<float>(
292 reinterpret_cast<float *>(_parameters.num_selections_output->buffer()), {nbatches});
293
294 OutputArrays outputArrays(reinterpret_cast<CornerBox *>(_parameters.box_coords_output->buffer()),
295 reinterpret_cast<float *>(_parameters.box_scores_output->buffer()),
296 reinterpret_cast<float *>(_parameters.box_classes_output->buffer()),
297 reinterpret_cast<int *>(_parameters.num_selections_output->buffer()),
298 _parameters.max_detections);
299
300 DetectionPostProcess(boxes_a, scores_a, num_selected_a, _parameters, _allocations, outputArrays);
301}
virtual uint8_t * buffer() const =0
const IPortableTensor * scores_input
IPortableTensor * num_selections_output
std::vector< int32_t > scrores_descr
IPortableTensor * box_scores_output
std::vector< int32_t > boxes_descr
const IPortableTensor * boxes_input
IPortableTensor * box_coords_output
IPortableTensor * box_classes_output

References onert::backend::cpu::ops::DetectionPostProcessLayer::DetectionPostProcessParameters::box_classes_output, onert::backend::cpu::ops::DetectionPostProcessLayer::DetectionPostProcessParameters::box_coords_output, onert::backend::cpu::ops::DetectionPostProcessLayer::DetectionPostProcessParameters::box_scores_output, onert::backend::cpu::ops::DetectionPostProcessLayer::DetectionPostProcessParameters::boxes_descr, onert::backend::cpu::ops::DetectionPostProcessLayer::DetectionPostProcessParameters::boxes_input, onert::backend::ITensor::buffer(), onert::backend::cpu::ops::DetectionPostProcessLayer::DetectionPostProcessParameters::max_detections, onert::backend::cpu::ops::DetectionPostProcessLayer::DetectionPostProcessParameters::num_selections_output, onert::backend::cpu::ops::DetectionPostProcessLayer::DetectionPostProcessParameters::scores_input, and onert::backend::cpu::ops::DetectionPostProcessLayer::DetectionPostProcessParameters::scrores_descr.

Referenced by package.infer.session::inference().


The documentation for this class was generated from the following files: