22 #include "../C/prior_box.h" 23 #include "primitive.hpp" 62 const bool flip =
true,
63 const bool clip =
false,
64 const std::vector<float>&
variance = {},
80 this->aspect_ratios.push_back(1.f);
82 bool already_exist =
false;
83 for (
auto aspect_ratio : this->aspect_ratios) {
84 if (std::fabs(new_aspect_ratio - aspect_ratio) < 1e-6) {
90 this->aspect_ratios.push_back(new_aspect_ratio);
92 this->aspect_ratios.push_back(1.f / new_aspect_ratio);
97 for (
size_t i = 0; i <
variance.size(); ++i) {
98 this->variance.push_back(
variance[i]);
102 this->variance.push_back(
variance[0]);
106 this->variance.push_back(0.1f);
147 void update_dto(
dto&
dto)
const override 161 static cldnn_float_arr float_vector_to_arr(
const std::vector<float>& stor)
163 return{ stor.
data(), stor.size() };
166 static std::vector<float> float_arr_to_vector(
const cldnn_float_arr& arr)
168 std::vector<float> result(arr.
size);
169 for (
size_t i = 0; i < arr.
size; i++)
171 result[i] = arr.
data[i];
prior_box(const primitive_id &id, const primitive_id &input, const tensor &img_size, const std::vector< float > &min_sizes, const std::vector< float > &max_sizes={}, const std::vector< float > &aspect_ratios={}, const bool flip=true, const bool clip=false, const std::vector< float > &variance={}, const float step_width=0.f, const float step_height=0.f, const float offset=0.5f, const padding &output_padding=padding())
Constructs prior-box primitive.
cldnn_float_arr variance
Variance for adjusting the prior boxes.
Represents data padding information.
Generates a set of default bounding boxes with different sizes and aspect ratios. ...
const float * data
Pointer to float array.
cldnn_float_arr min_sizes
Minimum box sizes in pixels.
prior_box(const dto *dto)
Constructs a copy from C API cldnn_prior-box_desc.
std::vector< float > min_sizes
Minimum box sizes in pixels.
Represents reference to an array of floats.
std::vector< float > variance
Variance for adjusting the prior boxes.
N-dimensional vector. Mostly used to represent memory size.
uint32_t flip
If not 0, will flip each aspect ratio. For example, if there is aspect ratio "r", aspect ratio "1...
float step_width
Step width.
size_t size
Size (in floats) of the array.
std::vector< float > max_sizes
Maximum box sizes in pixels.
std::vector< float > aspect_ratios
Various of aspect ratios. Duplicate ratios will be ignored.
float step_height
Step height.
Generates a set of default bounding boxes with different sizes and aspect ratios. ...
bool clip
If true, will clip the prior so that it is within [0, 1].
cldnn_float_arr aspect_ratios
Various of aspect ratios. Duplicate ratios will be ignored.
float step_width
Step width.
cldnn_float_arr max_sizes
Maximum box sizes in pixels.
float offset
Offset to the top left corner of each cell.
std::string primitive_id
Unique id of a primitive within a topology.
float step_height
Step height.
fixed_size_vector_ref input
List of ids of input primitives.
uint32_t clip
If not 0, will clip the prior so that it is within [0, 1].
base class for all primitives implementations.
padding output_padding
Requested output padding.
bool flip
If true, will flip each aspect ratio. For example, if there is aspect ratio "r", aspect ratio "1...
cldnn_tensor img_size
Image width and height.
tensor img_size
Image width and height.
float offset
Offset to the top left corner of each cell.