36 : _memory_group(memory_manager),
41 _compute_anchors(nullptr),
44 _dequantize_anchors(),
46 _quantize_all_proposals(),
47 _cpp_nms(memory_manager),
52 _deltas_flattened_f32(),
58 _all_proposals_quantized(),
60 _classes_nms_unused(),
61 _proposals_4_roi_values(),
62 _all_proposals_to_use(nullptr),
63 _num_valid_proposals(nullptr),
82 const int total_num_anchors = num_anchors * feat_width * feat_height;
92 _memory_group.
manage(&_all_anchors);
93 _compute_anchors = std::make_unique<NEComputeAllAnchorsKernel>();
96 const TensorShape flatten_shape_deltas(values_per_roi, total_num_anchors);
100 _memory_group.
manage(&_deltas_flattened);
103 _memory_group.
manage(&_deltas_permuted);
105 _flatten_deltas.
configure(&_deltas_permuted, &_deltas_flattened);
110 _flatten_deltas.
configure(deltas, &_deltas_flattened);
113 const TensorShape flatten_shape_scores(1, total_num_anchors);
117 _memory_group.
manage(&_scores_flattened);
120 _memory_group.
manage(&_scores_permuted);
122 _flatten_scores.
configure(&_scores_permuted, &_scores_flattened);
127 _flatten_scores.
configure(scores, &_scores_flattened);
130 Tensor *anchors_to_use = &_all_anchors;
131 Tensor *deltas_to_use = &_deltas_flattened;
136 _memory_group.
manage(&_all_anchors_f32);
137 _memory_group.
manage(&_deltas_flattened_f32);
139 _dequantize_anchors.
configure(&_all_anchors, &_all_anchors_f32);
141 anchors_to_use = &_all_anchors_f32;
143 _dequantize_deltas.
configure(&_deltas_flattened, &_deltas_flattened_f32);
145 deltas_to_use = &_deltas_flattened_f32;
148 _memory_group.
manage(&_all_proposals);
150 _bounding_box.
configure(anchors_to_use, &_all_proposals, deltas_to_use, bbox_info);
154 _all_proposals_to_use = &_all_proposals;
157 _memory_group.
manage(&_all_proposals_quantized);
160 _quantize_all_proposals.
configure(&_all_proposals, &_all_proposals_quantized);
162 _all_proposals_to_use = &_all_proposals_quantized;
168 const int scores_nms_size = std::min<int>(std::min<int>(post_nms_topN, pre_nms_topN), total_num_anchors);
170 _memory_group.
manage(&_classes_nms_unused);
171 _memory_group.
manage(&_keeps_nms_unused);
183 _scores_out = scores_out;
184 _num_valid_proposals = num_valid_proposals;
186 _memory_group.
manage(&_proposals_4_roi_values);
188 const BoxNMSLimitInfo box_nms_info(0.0f, info.
nms_thres(), scores_nms_size,
false,
NMSType::LINEAR, 0.5f, 0.001f,
true, min_size_scaled, info.
im_width(), info.
im_height());
190 _all_proposals_to_use ,
193 &_proposals_4_roi_values ,
194 &_classes_nms_unused ,
197 num_valid_proposals ,
222 const int num_images = scores->
dimension(3);
223 const int total_num_anchors = num_anchors * feat_width * feat_height;
237 TensorInfo all_anchors_info(anchors->
clone()->set_tensor_shape(
TensorShape(values_per_roi, total_num_anchors)).set_is_resizable(
true));
240 TensorInfo deltas_permuted_info = deltas->
clone()->set_tensor_shape(
TensorShape(values_per_roi * num_anchors, feat_width, feat_height)).set_is_resizable(
true);
241 TensorInfo scores_permuted_info = scores->
clone()->set_tensor_shape(
TensorShape(num_anchors, feat_width, feat_height)).set_is_resizable(
true);
253 TensorInfo deltas_flattened_info(deltas->
clone()->set_tensor_shape(
TensorShape(values_per_roi, total_num_anchors)).set_is_resizable(
true));
256 TensorInfo scores_flattened_info(scores->
clone()->set_tensor_shape(
TensorShape(1, total_num_anchors)).set_is_resizable(
true));
257 TensorInfo proposals_4_roi_values(deltas->
clone()->set_tensor_shape(
TensorShape(values_per_roi, total_num_anchors)).set_is_resizable(
true));
261 TensorInfo *proposals_4_roi_values_to_use = &proposals_4_roi_values;
262 TensorInfo proposals_4_roi_values_quantized(deltas->
clone()->set_tensor_shape(
TensorShape(values_per_roi, total_num_anchors)).set_is_resizable(
true));
277 proposals_4_roi_values_to_use = &proposals_4_roi_values_quantized;
333 _permute_deltas.
run();
334 _permute_scores.
run();
337 _flatten_deltas.
run();
338 _flatten_scores.
run();
342 _dequantize_anchors.
run();
343 _dequantize_deltas.
run();
351 _quantize_all_proposals.
run();
virtual size_t num_dimensions() const =0
The number of dimensions of the tensor (rank)
Generate Proposals Information class.
#define ARM_COMPUTE_RETURN_ERROR_ON_DATA_LAYOUT_NOT_IN(t,...)
~NEGenerateProposalsLayer()
Default destructor.
void run() override final
Run the kernels contained in the function.
quantized, symmetric fixed-point 16-bit number
#define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_LAYOUT(...)
void init(const TensorAllocator &allocator, const Coordinates &coords, TensorInfo &sub_info)
Shares the same backing memory with another tensor allocator, while the tensor info might be differen...
virtual size_t dimension(size_t index) const =0
Return the size of the requested dimension.
std::vector< PaddingInfo > PaddingList
List of padding information.
static Status validate(const ITensorInfo *input, const ITensorInfo *output)
Static function to check if given info will lead to a valid configuration of NEReshapeLayer.
BoxWithNonMaximaSuppressionLimit Information class.
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
virtual DataType data_type() const =0
Data type used for each element of the tensor.
void run() override
Run the kernels contained in the function.
void configure(const ITensor *input, ITensor *output)
Configure the kernel.
1 channel, 1 F32 per channel
ITensorInfo & set_data_type(DataType data_type) override
Set the data type to the specified value.
void run() override
Run the kernels contained in the function.
Store the tensor's metadata.
static Status validate(const ITensorInfo *input, const ITensorInfo *output, const PermutationVector &perm)
Static function to check if given info will lead to a valid configuration of NEPermute.
#define ARM_COMPUTE_ERROR_THROW_ON(status)
quantized, asymmetric fixed-point 16-bit number
static Status validate(const ITensorInfo *anchors, const ITensorInfo *all_anchors, const ComputeAnchorsInfo &info)
Static function to check if given info will lead to a valid configuration of NEComputeAllAnchorsKerne...
#define ARM_COMPUTE_RETURN_ERROR_ON(cond)
If the condition is true, an error is returned.
Interface for Neon tensor.
static Status validate(const ITensorInfo *scores, const ITensorInfo *deltas, const ITensorInfo *anchors, const ITensorInfo *proposals, const ITensorInfo *scores_out, const ITensorInfo *num_valid_proposals, const GenerateProposalsInfo &info)
Static function to check if given info will lead to a valid configuration of NEGenerateProposalsLayer...
Copyright (c) 2017-2021 Arm Limited.
1 channel, 1 F16 per channel
TensorAllocator * allocator()
Return a pointer to the tensor's allocator.
ITensorInfo * info() const override
Interface to be implemented by the child class to return the tensor's metadata.
#define ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(...)
void manage(IMemoryManageable *obj) override
Sets a object to be managed by the given memory group.
Quantization information.
static Status validate(const ITensorInfo *input, const ITensorInfo *output)
Static function to check if given info will lead to a valid configuration of NEDequantizationLayer.
1 channel, 1 U32 per channel
virtual const TensorShape & tensor_shape() const =0
Size for each dimension of the tensor.
void configure(const ITensor *scores, const ITensor *deltas, const ITensor *anchors, ITensor *proposals, ITensor *scores_out, ITensor *num_valid_proposals, const GenerateProposalsInfo &info)
Set the input and output tensors.
static Status validate(const ITensorInfo *input, const ITensorInfo *output, const PaddingList &padding, const PixelValue constant_value=PixelValue(), const PaddingMode mode=PaddingMode::CONSTANT)
Static function to check if given info will lead to a valid configuration of NEPadLayer.
quantized, asymmetric fixed-point 8-bit number unsigned
size_t values_per_roi() const
void allocate() override
Allocate size specified by TensorInfo of CPU memory.
UniformQuantizationInfo uniform() const
Return per layer quantization info.
bool auto_init_if_empty(ITensorInfo &info, const TensorShape &shape, int num_channels, DataType data_type, QuantizationInfo quantization_info=QuantizationInfo())
Auto initialize the tensor info (shape, number of channels and data type) if the current assignment i...
virtual std::unique_ptr< T > clone() const =0
Provide a clone of the current object of class T.
virtual ITensorInfo * info() const =0
Interface to be implemented by the child class to return the tensor's metadata.
Basic implementation of the tensor interface.
virtual ITensorInfo & set_quantization_info(const QuantizationInfo &quantization_info)=0
Set the quantization settings (scale and offset) of the tensor.
float spatial_scale() const
void configure(const ITensor *input, ITensor *output)
Set the input and output tensors.
virtual QuantizationInfo quantization_info() const =0
Get the quantization settings (scale and offset) of the tensor.
Num samples, channels, height, width.
NEGenerateProposalsLayer(std::shared_ptr< IMemoryManager > memory_manager=nullptr)
Default constructor.
Strides of an item in bytes.
static constexpr size_t DimY
Alias for dimension 1 also known as Y dimension.
void run() override
Run the kernels contained in the function.
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
Memory group resources scope handling class.
virtual size_t total_size() const =0
Returns the total size of the tensor in bytes.
virtual void schedule(ICPPKernel *kernel, const Hints &hints)=0
Runs the kernel in the same thread as the caller synchronously.
#define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_SHAPES(...)
#define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(...)
ComputeAnchors information class.
Num samples, height, width, channels.
#define ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(t, c,...)
void run() override
Run the kernels contained in the function.
void configure(ITensor *input, ITensor *output, const PaddingList &padding, const PixelValue constant_value=PixelValue(), const PaddingMode mode=PaddingMode::CONSTANT)
Initialize the function.
void configure(const ITensor *input, ITensor *output)
Initialise the kernel's inputs and outputs.
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
Store the tensor's metadata.
size_t get_data_layout_dimension_index(const DataLayout data_layout, const DataLayoutDimension data_layout_dimension)
Get the index of the given dimension.
static Status validate(const ITensorInfo *input, const ITensorInfo *output)
Static function to check if given info will lead to a valid configuration of NEQuantizationLayer.
int post_nms_topN() const
void configure(const ITensor *input, ITensor *output, const PermutationVector &perm)
Configure the permute Neon kernel.
DataType
Available data types.
void run() override
Run the kernels contained in the function.
virtual DataLayout data_layout() const =0
Get the data layout of the tensor.
static IScheduler & get()
Access the scheduler singleton.
void configure(const ITensor *scores_in, const ITensor *boxes_in, const ITensor *batch_splits_in, ITensor *scores_out, ITensor *boxes_out, ITensor *classes, ITensor *batch_splits_out=nullptr, ITensor *keeps=nullptr, ITensor *keeps_size=nullptr, const BoxNMSLimitInfo info=BoxNMSLimitInfo())
Configure the BoxWithNonMaximaSuppressionLimit CPP kernel.