21.02
|
Function to perform cropping and resizing. More...
#include <NECropResize.h>
Public Member Functions | |
NECropResize () | |
Default constructor. More... | |
NECropResize (const NECropResize &)=delete | |
Prevent instances of this class from being copied (As this class contains pointers) More... | |
NECropResize & | operator= (const NECropResize &)=delete |
Prevent instances of this class from being copied (As this class contains pointers) More... | |
NECropResize (NECropResize &&)=default | |
Allow instances of this class to be moved. More... | |
NECropResize & | operator= (NECropResize &&)=default |
Allow instances of this class to be moved. More... | |
~NECropResize () | |
Default destructor. More... | |
void | configure (const ITensor *input, const ITensor *boxes, const ITensor *box_ind, ITensor *output, Coordinates2D crop_size, InterpolationPolicy method=InterpolationPolicy::BILINEAR, float extrapolation_value=0) |
Configure kernel. More... | |
void | run () override |
Run the kernels contained in the function. More... | |
Public Member Functions inherited from IFunction | |
virtual | ~IFunction ()=default |
Destructor. More... | |
virtual void | prepare () |
Prepare the function for executing. More... | |
Static Public Member Functions | |
static Status | validate (const ITensorInfo *input, const ITensorInfo *boxes, const ITensorInfo *box_ind, const ITensorInfo *output, Coordinates2D crop_size, InterpolationPolicy method, float extrapolation_value) |
Static function to check if given info will lead to a valid configuration of NESlice. More... | |
Data Fields | |
ITensor * | _output |
size_t | _num_boxes |
InterpolationPolicy | _method |
float | _extrapolation_value |
std::vector< std::unique_ptr< NECropKernel > > | _crop |
std::vector< std::unique_ptr< NEScale > > | _scale |
std::vector< std::unique_ptr< Tensor > > | _crop_results |
std::vector< std::unique_ptr< Tensor > > | _scaled_results |
Function to perform cropping and resizing.
Definition at line 38 of file NECropResize.h.
NECropResize | ( | ) |
Default constructor.
Definition at line 35 of file NECropResize.cpp.
|
delete |
Prevent instances of this class from being copied (As this class contains pointers)
|
default |
Allow instances of this class to be moved.
|
default |
Default destructor.
void configure | ( | const ITensor * | input, |
const ITensor * | boxes, | ||
const ITensor * | box_ind, | ||
ITensor * | output, | ||
Coordinates2D | crop_size, | ||
InterpolationPolicy | method = InterpolationPolicy::BILINEAR , |
||
float | extrapolation_value = 0 |
||
) |
Configure kernel.
extrapolation_value
is used. [in] | input | Source tensor containing N batches of 3D images to be cropped. Data type supported: U8/U16/S16/U32/S32/F16/F32 |
[in] | boxes | Tensor containing the boxes used to crop the images. Data type supported: F32 |
[in] | box_ind | One dimensional tensor containing the batch index of the 3D image in input that the corresponding box in boxes will be applied to. Data type supported: F32 |
[out] | output | Destination tensor containing a cropped and resized image for each box in boxes . Data type supported: F32 |
[in] | crop_size | The dimensions that each cropped image will be resized to. |
[in] | method | The policy to be used when resizing image. Default is bilinear. |
[in] | extrapolation_value | Value to be used for values outside of the image for cropping and resizing. Default is 0. |
Definition at line 57 of file NECropResize.cpp.
References NECropResize::_crop, NECropResize::_crop_results, NECropResize::_extrapolation_value, NECropResize::_method, NECropResize::_num_boxes, NECropResize::_output, NECropResize::_scale, NECropResize::_scaled_results, ARM_COMPUTE_ERROR_ON_NULLPTR, ARM_COMPUTE_ERROR_THROW_ON, arm_compute::F32, ITensor::info(), arm_compute::NHWC, ITensorInfo::tensor_shape(), NECropResize::validate(), Coordinates2D::x, and Coordinates2D::y.
|
delete |
Prevent instances of this class from being copied (As this class contains pointers)
|
default |
Allow instances of this class to be moved.
|
overridevirtual |
Run the kernels contained in the function.
For Neon kernels:
For OpenCL kernels:
Implements IFunction.
Definition at line 104 of file NECropResize.cpp.
References NECropResize::_crop, NECropResize::_crop_results, NECropResize::_extrapolation_value, NECropResize::_method, NECropResize::_num_boxes, NECropResize::_output, NECropResize::_scale, NECropResize::_scaled_results, ARM_COMPUTE_ERROR_ON_MSG, arm_compute::CONSTANT, Window::DimZ, Scheduler::get(), arm_compute::test::validation::info, ITensor::ptr_to_element(), IScheduler::schedule(), and arm_compute::TOP_LEFT.
|
static |
Static function to check if given info will lead to a valid configuration of NESlice.
extrapolation_value
is used. [in] | input | Source tensor containing N batches of 3D images to be cropped. Data type supported: U8/U16/S16/U32/S32/F16/F32 |
[in] | boxes | Tensor info for the tensor containing the boxes used to crop the images. Data type supported: F32 |
[in] | box_ind | Tensor info for the one dimensional tensor containing the batch index of the 3D image in input that the corresponding box in boxes will be applied to. Data type supported: F32 |
[in] | output | Tensor info for the destination tensor containing a cropped and resized image for each box in boxes . Data type supported: F32 |
[in] | crop_size | The dimensions that each cropped image will be resized to. |
[in] | method | The policy to be used when resizing image. Default is bilinear. |
[in] | extrapolation_value | Value to be used for values outside of the image for cropping and resizing. Default is 0. |
Definition at line 40 of file NECropResize.cpp.
References arm_compute::AREA, ARM_COMPUTE_RETURN_ERROR_ON, ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_NOT_IN, ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_LAYOUT, ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DIMENSIONS, ARM_COMPUTE_RETURN_ON_ERROR, ICloneable< T >::clone(), arm_compute::F32, ITensorInfo::tensor_shape(), ITensorInfo::total_size(), NECropKernel::validate(), Coordinates2D::x, and Coordinates2D::y.
Referenced by NECropResize::configure().
std::vector<std::unique_ptr<NECropKernel> > _crop |
Definition at line 100 of file NECropResize.h.
Referenced by NECropResize::configure(), and NECropResize::run().
std::vector<std::unique_ptr<Tensor> > _crop_results |
Definition at line 102 of file NECropResize.h.
Referenced by NECropResize::configure(), and NECropResize::run().
float _extrapolation_value |
Definition at line 98 of file NECropResize.h.
Referenced by NECropResize::configure(), and NECropResize::run().
InterpolationPolicy _method |
Definition at line 97 of file NECropResize.h.
Referenced by NECropResize::configure(), and NECropResize::run().
size_t _num_boxes |
Definition at line 96 of file NECropResize.h.
Referenced by NECropResize::configure(), and NECropResize::run().
ITensor* _output |
Definition at line 95 of file NECropResize.h.
Referenced by NECropResize::configure(), and NECropResize::run().
std::vector<std::unique_ptr<NEScale> > _scale |
Definition at line 101 of file NECropResize.h.
Referenced by NECropResize::configure(), and NECropResize::run().
std::vector<std::unique_ptr<Tensor> > _scaled_results |
Definition at line 103 of file NECropResize.h.
Referenced by NECropResize::configure(), and NECropResize::run().