24.02.1
|
Function to perform cropping and resizing. More...
#include <CLCropResize.h>
Public Member Functions | |
CLCropResize () | |
Default constructor. More... | |
CLCropResize (const CLCropResize &)=delete | |
Prevent instances of this class from being copied (As this class contains pointers) More... | |
CLCropResize & | operator= (const CLCropResize &)=delete |
Prevent instances of this class from being copied (As this class contains pointers) More... | |
CLCropResize (CLCropResize &&)=default | |
Allow instances of this class to be moved. More... | |
CLCropResize & | operator= (CLCropResize &&)=default |
Allow instances of this class to be moved. More... | |
~CLCropResize () | |
Default destructor. More... | |
void | configure (const ICLTensor *input, ICLTensor *boxes, ICLTensor *box_ind, ICLTensor *output, Coordinates2D crop_size, InterpolationPolicy method=InterpolationPolicy::BILINEAR, float extrapolation_value=0) |
Configure kernel. More... | |
void | configure (const CLCompileContext &compile_context, const ICLTensor *input, ICLTensor *boxes, ICLTensor *box_ind, ICLTensor *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, ITensorInfo *boxes, 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 | |
const ICLTensor * | _input |
ICLTensor * | _boxes |
ICLTensor * | _box_ind |
ICLTensor * | _output |
size_t | _num_boxes |
InterpolationPolicy | _method |
float | _extrapolation_value |
std::vector< std::unique_ptr< CLScale > > | _scale |
std::vector< std::unique_ptr< CLCopy > > | _copy |
std::vector< std::unique_ptr< CLTensor > > | _crop_results |
std::vector< std::unique_ptr< CLTensor > > | _scaled_results |
std::vector< std::unique_ptr< IFunction > > | _internal_functions |
Function to perform cropping and resizing.
Definition at line 45 of file CLCropResize.h.
CLCropResize | ( | ) |
|
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 CLCompileContext & | compile_context, |
const ICLTensor * | input, | ||
ICLTensor * | boxes, | ||
ICLTensor * | box_ind, | ||
ICLTensor * | output, | ||
Coordinates2D | crop_size, | ||
InterpolationPolicy | method = InterpolationPolicy::BILINEAR , |
||
float | extrapolation_value = 0 |
||
) |
Configure kernel.
extrapolation_value
is used. [in] | compile_context | The compile context to be used. |
[in] | input | Source tensor containing N batches of 3D images to be cropped. Data type supported: All |
[in] | boxes | Tensor containing the boxes used to crop the images. It has to be known before configuration. 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. It has to be known before configuration. 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. |
The number of rows out of bounds at the start and end of _crop_results[num_box].get().
The number of columns out of bounds at the start and end of _crop_results[num_box].get().
Definition at line 123 of file CLCropResize.cpp.
References CLCropResize::_box_ind, CLCropResize::_boxes, CLCropResize::_copy, CLCropResize::_crop_results, CLCropResize::_extrapolation_value, CLCropResize::_input, CLCropResize::_internal_functions, CLCropResize::_method, CLCropResize::_num_boxes, CLCropResize::_output, CLCropResize::_scale, CLCropResize::_scaled_results, ARM_COMPUTE_ERROR_ON_NULLPTR, ARM_COMPUTE_ERROR_THROW_ON, ARM_COMPUTE_LOG_PARAMS, arm_compute::auto_init_if_empty(), arm_compute::calculate_max_window(), arm_compute::CONSTANT, ITensorInfo::dimension(), arm_compute::mlgo::parser::end(), arm_compute::F32, CLScheduler::get(), ITensor::info(), arm_compute::test::validation::info, arm_compute::test::validation::input, ICLTensor::map(), arm_compute::NHWC, arm_compute::test::validation::output_shape, Window::set(), TensorInfo::set_data_layout(), CLScheduler::sync(), ITensorInfo::tensor_shape(), arm_compute::TOP_LEFT, ICLTensor::unmap(), CLCropResize::validate(), Coordinates2D::x, and Coordinates2D::y.
void configure | ( | const ICLTensor * | input, |
ICLTensor * | boxes, | ||
ICLTensor * | box_ind, | ||
ICLTensor * | output, | ||
Coordinates2D | crop_size, | ||
InterpolationPolicy | method = InterpolationPolicy::BILINEAR , |
||
float | extrapolation_value = 0 |
||
) |
Configure kernel.
Valid data layouts:
Valid data type configurations:
src0 | src1 | src2 | dst |
---|---|---|---|
All | F32 | F32 | F32 |
extrapolation_value
is used. [in] | input | Source tensor containing N batches of 3D images to be cropped. Data type supported: All |
[in] | boxes | Tensor containing the boxes used to crop the images. It has to be known before configuration. 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. It has to be known before configuration. 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 111 of file CLCropResize.cpp.
References CLKernelLibrary::get(), and arm_compute::test::validation::input.
|
default |
Allow instances of this class to be moved.
|
delete |
Prevent instances of this class from being copied (As this class contains pointers)
|
overridevirtual |
Run the kernels contained in the function.
For CPU kernels:
For OpenCL kernels:
Implements IFunction.
Definition at line 356 of file CLCropResize.cpp.
References CLCropResize::_copy, CLCropResize::_internal_functions, CLCropResize::_output, CLCropResize::_scale, ARM_COMPUTE_ERROR_ON_MSG, CLScheduler::get(), and CLScheduler::sync().
|
static |
Static function to check if given info will lead to a valid configuration of NESlice.
extrapolation_value
is used. [in] | input | Source tensor info containing N batches of 3D images to be cropped. Data type supported: All |
[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 86 of file CLCropResize.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, arm_compute::F32, arm_compute::test::validation::input, ITensorInfo::tensor_shape(), ITensorInfo::total_size(), CLCrop::validate(), Coordinates2D::x, and Coordinates2D::y.
Referenced by CLCropResize::configure().
ICLTensor* _box_ind |
Definition at line 146 of file CLCropResize.h.
Referenced by CLCropResize::configure().
ICLTensor* _boxes |
Definition at line 145 of file CLCropResize.h.
Referenced by CLCropResize::configure().
std::vector<std::unique_ptr<CLCopy> > _copy |
Definition at line 153 of file CLCropResize.h.
Referenced by CLCropResize::configure(), and CLCropResize::run().
std::vector<std::unique_ptr<CLTensor> > _crop_results |
Definition at line 154 of file CLCropResize.h.
Referenced by CLCropResize::configure().
float _extrapolation_value |
Definition at line 150 of file CLCropResize.h.
Referenced by CLCropResize::configure().
const ICLTensor* _input |
Definition at line 144 of file CLCropResize.h.
Referenced by CLCropResize::configure().
std::vector<std::unique_ptr<IFunction> > _internal_functions |
Definition at line 157 of file CLCropResize.h.
Referenced by CLCropResize::configure(), and CLCropResize::run().
InterpolationPolicy _method |
Definition at line 149 of file CLCropResize.h.
Referenced by CLCropResize::configure().
size_t _num_boxes |
Definition at line 148 of file CLCropResize.h.
Referenced by CLCropResize::configure().
ICLTensor* _output |
Definition at line 147 of file CLCropResize.h.
Referenced by CLCropResize::configure(), and CLCropResize::run().
std::vector<std::unique_ptr<CLScale> > _scale |
Definition at line 152 of file CLCropResize.h.
Referenced by CLCropResize::configure(), and CLCropResize::run().
std::vector<std::unique_ptr<CLTensor> > _scaled_results |
Definition at line 155 of file CLCropResize.h.
Referenced by CLCropResize::configure().