24.02.1
|
Go to the documentation of this file.
38 : _memory_group(memory_manager),
43 _compute_anchors(nullptr),
46 _dequantize_anchors(),
48 _quantize_all_proposals(),
49 _cpp_nms(memory_manager),
54 _deltas_flattened_f32(),
60 _all_proposals_quantized(),
62 _classes_nms_unused(),
63 _proposals_4_roi_values(),
64 _all_proposals_to_use(nullptr),
65 _num_valid_proposals(nullptr),
82 proposals->
info(), scores_out->
info(),
95 const int total_num_anchors = num_anchors * feat_width * feat_height;
96 const int pre_nms_topN =
info.pre_nms_topN();
97 const int post_nms_topN =
info.post_nms_topN();
98 const size_t values_per_roi =
info.values_per_roi();
106 _memory_group.
manage(&_all_anchors);
107 _compute_anchors = std::make_unique<NEComputeAllAnchorsKernel>();
108 _compute_anchors->configure(anchors, &_all_anchors,
111 const TensorShape flatten_shape_deltas(values_per_roi, total_num_anchors);
116 _memory_group.
manage(&_deltas_flattened);
119 _memory_group.
manage(&_deltas_permuted);
121 _flatten_deltas.
configure(&_deltas_permuted, &_deltas_flattened);
126 _flatten_deltas.
configure(deltas, &_deltas_flattened);
129 const TensorShape flatten_shape_scores(1, total_num_anchors);
133 _memory_group.
manage(&_scores_flattened);
136 _memory_group.
manage(&_scores_permuted);
138 _flatten_scores.
configure(&_scores_permuted, &_scores_flattened);
143 _flatten_scores.
configure(scores, &_scores_flattened);
146 Tensor *anchors_to_use = &_all_anchors;
147 Tensor *deltas_to_use = &_deltas_flattened;
152 _memory_group.
manage(&_all_anchors_f32);
153 _memory_group.
manage(&_deltas_flattened_f32);
155 _dequantize_anchors.
configure(&_all_anchors, &_all_anchors_f32);
157 anchors_to_use = &_all_anchors_f32;
159 _dequantize_deltas.
configure(&_deltas_flattened, &_deltas_flattened_f32);
161 deltas_to_use = &_deltas_flattened_f32;
164 _memory_group.
manage(&_all_proposals);
166 _bounding_box.
configure(anchors_to_use, &_all_proposals, deltas_to_use, bbox_info);
170 _all_proposals_to_use = &_all_proposals;
173 _memory_group.
manage(&_all_proposals_quantized);
177 _quantize_all_proposals.
configure(&_all_proposals, &_all_proposals_quantized);
179 _all_proposals_to_use = &_all_proposals_quantized;
185 const int scores_nms_size = std::min<int>(std::min<int>(post_nms_topN, pre_nms_topN), total_num_anchors);
186 const float min_size_scaled =
info.min_size() *
info.im_scale();
187 _memory_group.
manage(&_classes_nms_unused);
188 _memory_group.
manage(&_keeps_nms_unused);
201 _scores_out = scores_out;
202 _num_valid_proposals = num_valid_proposals;
204 _memory_group.
manage(&_proposals_4_roi_values);
207 true, min_size_scaled,
info.im_width(),
info.im_height());
208 _cpp_nms.
configure(&_scores_flattened , _all_proposals_to_use ,
209 nullptr , scores_out , &_proposals_4_roi_values ,
210 &_classes_nms_unused ,
nullptr , &_keeps_nms_unused ,
211 num_valid_proposals , box_nms_info);
237 const int num_anchors =
239 const int feat_width =
241 const int feat_height =
243 const int num_images = scores->
dimension(3);
244 const int total_num_anchors = num_anchors * feat_width * feat_height;
245 const int values_per_roi =
info.values_per_roi();
259 anchors->
clone()->set_tensor_shape(
TensorShape(values_per_roi, total_num_anchors)).set_is_resizable(
true));
265 ->set_tensor_shape(
TensorShape(values_per_roi * num_anchors, feat_width, feat_height))
266 .set_is_resizable(
true);
268 scores->
clone()->set_tensor_shape(
TensorShape(num_anchors, feat_width, feat_height)).set_is_resizable(
true);
281 deltas->
clone()->set_tensor_shape(
TensorShape(values_per_roi, total_num_anchors)).set_is_resizable(
true));
285 scores->
clone()->set_tensor_shape(
TensorShape(1, total_num_anchors)).set_is_resizable(
true));
287 deltas->
clone()->set_tensor_shape(
TensorShape(values_per_roi, total_num_anchors)).set_is_resizable(
true));
291 TensorInfo *proposals_4_roi_values_to_use = &proposals_4_roi_values;
293 deltas->
clone()->set_tensor_shape(
TensorShape(values_per_roi, total_num_anchors)).set_is_resizable(
true));
299 ->set_tensor_shape(
TensorShape(values_per_roi, total_num_anchors))
300 .set_is_resizable(
true)
305 ->set_tensor_shape(
TensorShape(values_per_roi, total_num_anchors))
306 .set_is_resizable(
true)
312 ->set_tensor_shape(
TensorShape(values_per_roi, total_num_anchors))
313 .set_is_resizable(
true)
316 &all_anchors_f32_info, &proposals_4_roi_values_f32, &deltas_flattened_f32_info,
321 proposals_4_roi_values_to_use = &proposals_4_roi_values_quantized;
378 _permute_deltas.
run();
379 _permute_scores.
run();
382 _flatten_deltas.
run();
383 _flatten_scores.
run();
387 _dequantize_anchors.
run();
388 _dequantize_deltas.
run();
396 _quantize_all_proposals.
run();
@ NCHW
Num samples, channels, height, width.
@ QASYMM16
quantized, asymmetric fixed-point 16-bit number
virtual DataLayout data_layout() const =0
Get the data layout of the tensor.
void manage(IMemoryManageable *obj) override
Sets a object to be managed by the given memory group.
virtual const TensorShape & tensor_shape() const =0
Size for each dimension of the tensor.
Quantization information.
std::vector< PaddingInfo > PaddingList
List of padding information.
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...
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...
@ NHWC
Num samples, height, width, channels.
@ QASYMM8
quantized, asymmetric fixed-point 8-bit number unsigned
#define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_SHAPES(...)
~NEGenerateProposalsLayer()
Default destructor.
void run() override
Run the kernels contained in the function.
Interface for CPU tensor.
BoxWithNonMaximaSuppressionLimit Information class.
ITensorInfo & set_data_type(DataType data_type) override
Set the data type to the specified value.
ComputeAnchors information class.
#define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(...)
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.
#define ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(t, c,...)
void run() override
Run the kernels contained in the function.
@ QSYMM16
quantized, symmetric fixed-point 16-bit number
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
virtual size_t dimension(size_t index) const =0
Return the size of the requested dimension.
Strides of an item in bytes.
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
virtual ITensorInfo * info() const =0
Interface to be implemented by the child class to return the tensor's metadata.
TensorAllocator * allocator()
Return a pointer to the tensor's allocator.
#define ARM_COMPUTE_ERROR_THROW_ON(status)
@ U32
unsigned 32-bit number
#define ARM_COMPUTE_RETURN_ERROR_ON(cond)
If the condition is true, an error is returned.
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...
void configure(const ITensor *input, ITensor *output)
Configure the kernel.
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.
static IScheduler & get()
Access the scheduler singleton.
void configure(const ITensor *input, ITensor *output, const PermutationVector &perm)
Configure the permute function.
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.
virtual DataType data_type() const =0
Data type used for each element 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.
#define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_LAYOUT(...)
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...
UniformQuantizationInfo uniform() const
Return per layer quantization info.
void configure(ITensor *input, ITensor *output, const PaddingList &padding, const PixelValue constant_value=PixelValue(), const PaddingMode mode=PaddingMode::CONSTANT)
Initialize the function.
ITensorInfo * info() const override
Interface to be implemented by the child class to return the tensor's metadata.
#define ARM_COMPUTE_RETURN_ERROR_ON_DATA_LAYOUT_NOT_IN(t,...)
static constexpr size_t DimY
Alias for dimension 1 also known as Y dimension.
void run() override
Run the kernels contained in the function.
static Status validate(const ITensorInfo *input, const ITensorInfo *output)
Static function to check if given info will lead to a valid configuration of NEReshapeLayer.
virtual QuantizationInfo quantization_info() const =0
Get the quantization settings (scale and offset) of the tensor.
void run() override
Run the kernels contained in the function.
virtual void schedule(ICPPKernel *kernel, const Hints &hints)=0
Runs the kernel in the same thread as the caller synchronously.
NEGenerateProposalsLayer(std::shared_ptr< IMemoryManager > memory_manager=nullptr)
Default constructor.
void run() override
Run the kernels contained in the function.
virtual std::unique_ptr< T > clone() const =0
Provide a clone of the current object of class T.
size_t get_data_layout_dimension_index(const DataLayout &data_layout, const DataLayoutDimension &data_layout_dimension)
Get the index of the given dimension.
Store the tensor's metadata.
void allocate() override
Allocate size specified by TensorInfo of CPU memory.
Memory group resources scope handling class.
Copyright (c) 2017-2024 Arm Limited.
@ F16
16-bit floating-point number
void configure(const ITensor *input, ITensor *output)
Set the input and output tensors.
#define ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(...)
static Status validate(const ITensorInfo *input, const ITensorInfo *output)
Static function to check if given info will lead to a valid configuration of NEQuantizationLayer.
void run() override
Run the kernels contained in the function.
Store the tensor's metadata.
@ F32
32-bit floating-point number
Basic implementation of the tensor interface.
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
static Status validate(const ITensorInfo *input, const ITensorInfo *output)
Static function to check if given info will lead to a valid configuration of NEDequantizationLayer.
void configure(const ITensor *input, ITensor *output)
Initialise the kernel's inputs and outputs.
#define ARM_COMPUTE_LOG_PARAMS(...)
virtual size_t total_size() const =0
Returns the total size of the tensor in bytes.
DataType
Available data types.
void run() override final
Run the kernels contained in the function.
Generate Proposals Information class.
virtual ITensorInfo & set_quantization_info(const QuantizationInfo &quantization_info)=0
Set the quantization settings (scale and offset) of the tensor.
virtual size_t num_dimensions() const =0
The number of dimensions of the tensor (rank)
void run() override
Run the kernels contained in the function.