43 : _input_magnitude(nullptr), _input_phase(nullptr), _output(nullptr), _cell_size()
61 _input_magnitude = input_magnitude;
62 _input_phase = input_phase;
69 std::stringstream args_str;
72 args_str <<
"-DNUM_BINS=" << hog_info->
num_bins() <<
" ";
73 args_str <<
"-DPHASE_SCALE=" << phase_scale <<
" ";
76 std::set<std::string> build_opts = {};
77 build_opts.insert(args_str.str());
80 const std::string
kernel_name = std::string(
"hog_orientation_binning");
81 _kernel =
create_kernel(compile_context, kernel_name, build_opts);
84 constexpr
unsigned int num_elems_read_per_iteration = 1;
85 const unsigned int num_rows_read_per_iteration = hog_info->
cell_size().
height;
86 constexpr
unsigned int num_elems_written_per_iteration = 1;
99 ICLKernel::configure_internal(win);
128 unsigned int idx = 0;
139 : _input(nullptr), _output(nullptr), _num_cells_per_block_stride()
166 _num_cells_per_block_stride = num_cells_per_block_stride;
168 std::stringstream args_str;
170 args_str <<
"-DNUM_CELLS_PER_BLOCK_HEIGHT=" << num_cells_per_block.height <<
" ";
171 args_str <<
"-DNUM_BINS_PER_BLOCK_X=" << num_cells_per_block.width *hog_info->
num_bins() <<
" ";
172 args_str <<
"-DNUM_BINS_PER_BLOCK=" << _output->
info()->
num_channels() <<
" ";
176 args_str <<
"-DHOG_NORM_TYPE=" <<
static_cast<int>(hog_info->
normalization_type()) <<
" ";
179 std::set<std::string> build_opts = {};
180 build_opts.insert(args_str.str());
182 const std::string
kernel_name = std::string(
"hog_block_normalization");
183 _kernel =
create_kernel(compile_context, kernel_name, build_opts);
186 constexpr
unsigned int num_elems_read_per_iteration = 1;
187 const unsigned int num_rows_read_per_iteration = num_cells_per_block.height;
188 constexpr
unsigned int num_elems_written_per_iteration = 1;
189 const unsigned int num_rows_written_per_iteration = num_cells_per_block.height;
193 AccessWindowRectangle output_access(output->
info(), 0, 0, num_elems_written_per_iteration, num_rows_written_per_iteration);
201 ICLKernel::configure_internal(win);
230 unsigned int idx = 0;
Window first_slice_window_2D() const
First 2D slice of the window.
L2-norm followed by clipping.
size_t num_bins() const
The number of histogram bins for each cell.
Window calculate_max_window(const ValidRegion &valid_region, const Steps &steps, bool skip_border, BorderSize border_size)
const Window & window() const
The maximum window the kernel can be executed on.
void enqueue(IGCKernel &kernel, const Window &window, const gles::NDRange &lws=gles::NDRange(1U, 1U, 1U))
Add the kernel to the command queue with the given window.
virtual size_t dimension(size_t index) const =0
Return the size of the requested dimension.
const Size2D & cell_size() const
The cell size in pixels.
CLHOGOrientationBinningKernel()
Default constructor.
cl::NDRange lws_hint() const
Return the Local-Workgroup-Size hint.
1 channel, 1 U8 per channel
std::string to_string(T &&value)
Convert integer and float values to string.
virtual DataType data_type() const =0
Data type used for each element of the tensor.
Store the HOG's metadata.
1 channel, 1 F32 per channel
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
static CLKernelLibrary & get()
Access the KernelLibrary singleton.
Describe one of the image's dimensions with a start, end and step.
std::string lower_string(const std::string &val)
Lower a given string.
PhaseType phase_type() const
The type of PhaseType.
const Size2D & block_stride() const
The block stride in pixels.
HOGNormType normalization_type() const
The normalization type.
bool slide_window_slice_2D(Window &slice) const
Slide the passed 2D window slice.
Copyright (c) 2017-2021 Arm Limited.
virtual void set_valid_region(const ValidRegion &valid_region)=0
Set the valid region of the tensor.
size_t height
Height of the image region or rectangle.
void run(const Window &window, cl::CommandQueue &queue) override
Enqueue the OpenCL kernel to process the given window on the passed OpenCL command queue...
Implementation of a rectangular access pattern.
cl::Kernel create_kernel(const CLCompileContext &ctx, const std::string &kernel_name, const std::set< std::string > &build_opts=std::set< std::string >())
Creates an opencl kernel using a compile context.
const std::string & string_from_data_type(DataType dt)
Convert a data type identity into a string.
#define ARM_COMPUTE_ERROR_ON_DATA_TYPE_NOT_IN(t,...)
static constexpr size_t DimX
Alias for dimension 0 also known as X dimension.
bool update_window_and_padding(Window &win, Ts &&... patterns)
Update window and padding size for each of the access patterns.
void run(const Window &window, cl::CommandQueue &queue) override
Enqueue the OpenCL kernel to process the given window on the passed OpenCL command queue...
virtual const TensorShape & tensor_shape() const =0
Size for each dimension of the tensor.
Class to describe a number of elements in each dimension.
const Size2D & block_size() const
The block size in pixels.
Implementation of a row access pattern.
void configure(const ICLTensor *input_magnitude, const ICLTensor *input_phase, ICLTensor *output, const HOGInfo *hog_info)
Initialise the kernel's inputs, output and HOG's metadata.
virtual ITensorInfo * info() const =0
Interface to be implemented by the child class to return the tensor's metadata.
float l2_hyst_threshold() const
Threshold used for L2HYS_NORM normalization type.
void set(size_t dimension, const Dimension &dim)
Set the values of a given dimension.
#define ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(k)
1 channel, 1 S16 per channel
#define ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(t, c,...)
static constexpr size_t DimY
Alias for dimension 1 also known as Y dimension.
void set_dimension_step(size_t dimension, int step)
Set the step of a given dimension.
void add_2D_tensor_argument(unsigned int &idx, const ICLTensor *tensor, const Window &window)
Add the passed 2D tensor's parameters to the object's kernel's arguments starting from the index idx...
Interface for OpenCL tensor.
size_t width
Width of the image region or rectangle.
CLHOGBlockNormalizationKernel()
Default constructor.
Manages all the OpenCL kernels compilation and caching, provides accessors for the OpenCL Context...
Class for specifying the size of an image or rectangle.
constexpr const Dimension & y() const
Alias to access the second dimension of the window.
Wrapper to configure the Khronos OpenCL C++ header.
unsigned int num_elems_processed_per_iteration
void configure(const ICLTensor *input, ICLTensor *output, const HOGInfo *hog_info)
Initialise the kernel's input, output and HOG's metadata.
Container for valid region of a window.
constexpr int start() const
Return the start of the dimension.
Describe a multidimensional execution window.
virtual size_t num_channels() const =0
The number of channels for each tensor element.
#define ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(f, s)
SimpleTensor< T > slice(const SimpleTensor< T > &src, Coordinates starts, Coordinates ends)
constexpr const Dimension & x() const
Alias to access the first dimension of the window.