Compute Library
 19.08
Types.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016-2019 ARM Limited.
3  *
4  * SPDX-License-Identifier: MIT
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy
7  * of this software and associated documentation files (the "Software"), to
8  * deal in the Software without restriction, including without limitation the
9  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10  * sell copies of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in all
14  * copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22  * SOFTWARE.
23  */
24 #ifndef __ARM_COMPUTE_TYPES_H__
25 #define __ARM_COMPUTE_TYPES_H__
26 
32 #include "support/Half.h"
33 
34 #include <cmath>
35 #include <cstddef>
36 #include <cstdint>
37 #include <map>
38 #include <string>
39 #include <utility>
40 
41 namespace arm_compute
42 {
45 
50 
52 enum class Format
53 {
54  UNKNOWN,
55  U8,
56  S16,
57  U16,
58  S32,
59  U32,
60  F16,
61  F32,
62  UV88,
63  RGB888,
64  RGBA8888,
65  YUV444,
66  YUYV422,
67  NV12,
68  NV21,
69  IYUV,
70  UYVY422
71 };
72 
74 enum class DataType
75 {
76  UNKNOWN,
77  U8,
78  S8,
79  QSYMM8,
80  QASYMM8,
82  U16,
83  S16,
84  QSYMM16,
85  U32,
86  S32,
87  U64,
88  S64,
89  F16,
90  F32,
91  F64,
92  SIZET
93 };
94 
96 enum class SamplingPolicy
97 {
98  CENTER,
99  TOP_LEFT
100 };
101 
103 constexpr uint8_t CONSTANT_BORDER_VALUE = 199;
104 
106 constexpr float SCALE_PYRAMID_HALF = 0.5f;
107 
109 constexpr float SCALE_PYRAMID_ORB = 8.408964152537146130583778358414e-01;
110 
114 enum class DataLayout
115 {
116  UNKNOWN,
117  NCHW,
118  NHWC
119 };
124 {
125  CHANNEL,
126  HEIGHT,
127  WIDTH,
128  BATCHES
129 };
130 
133 {
134  GEMM,
135  DIRECT,
136  WINOGRAD,
137  FFT
138 };
139 
142 {
143  GEMM,
144  DIRECT,
145 };
146 
149 {
150  CONVOLUTION,
152 };
153 
155 enum class PaddingMode
156 {
157  CONSTANT,
158  REFLECT,
159  SYMMETRIC
160 };
161 
164 {
165  Equal,
166  NotEqual,
167  Greater,
168  GreaterEqual,
169  Less,
170  LessEqual
171 };
172 
175 {
178  : anchor{}, shape{}
179  {
180  }
181 
183  ValidRegion(const ValidRegion &) = default;
185  ValidRegion(ValidRegion &&) = default;
187  ValidRegion &operator=(const ValidRegion &) = default;
189  ValidRegion &operator=(ValidRegion &&) = default;
191  ~ValidRegion() = default;
192 
199  ValidRegion(const Coordinates &an_anchor, const TensorShape &a_shape)
200  : anchor{ an_anchor }, shape{ a_shape }
201  {
203  }
204 
212  ValidRegion(const Coordinates &an_anchor, const TensorShape &a_shape, size_t num_dimensions)
213  : anchor{ an_anchor }, shape{ a_shape }
214  {
215  ARM_COMPUTE_ERROR_ON(num_dimensions < std::max(anchor.num_dimensions(), shape.num_dimensions()));
216  anchor.set_num_dimensions(num_dimensions);
217  }
218 
220  int start(unsigned int d) const
221  {
222  return anchor[d];
223  }
224 
226  int end(unsigned int d) const
227  {
228  return anchor[d] + shape[d];
229  }
230 
239  ValidRegion &set(size_t dimension, int start, size_t size)
240  {
241  anchor.set(dimension, start);
242  shape.set(dimension, size);
243  return *this;
244  }
245 
248 };
249 
251 enum class BorderMode
252 {
253  UNDEFINED,
254  CONSTANT,
255  REPLICATE
256 };
257 
260 {
262  constexpr BorderSize()
263  : top{ 0 }, right{ 0 }, bottom{ 0 }, left{ 0 }
264  {
265  }
266 
268  explicit constexpr BorderSize(unsigned int size)
269  : top{ size }, right{ size }, bottom{ size }, left{ size }
270  {
271  }
272 
274  constexpr BorderSize(unsigned int top_bottom, unsigned int left_right)
275  : top{ top_bottom }, right{ left_right }, bottom{ top_bottom }, left{ left_right }
276  {
277  }
278 
280  constexpr BorderSize(unsigned int top, unsigned int right, unsigned int bottom, unsigned int left)
281  : top{ top }, right{ right }, bottom{ bottom }, left{ left }
282  {
283  }
284 
286  constexpr bool empty() const
287  {
288  return top == 0 && right == 0 && bottom == 0 && left == 0;
289  }
290 
292  constexpr bool uniform() const
293  {
294  return top == right && top == bottom && top == left;
295  }
296 
304  {
305  top *= scale;
306  right *= scale;
307  bottom *= scale;
308  left *= scale;
309 
310  return *this;
311  }
312 
320  {
321  BorderSize size = *this;
322  size *= scale;
323 
324  return size;
325  }
326 
331  void limit(const BorderSize &limit)
332  {
333  top = std::min(top, limit.top);
334  right = std::min(right, limit.right);
335  bottom = std::min(bottom, limit.bottom);
336  left = std::min(left, limit.left);
337  }
338 
339  unsigned int top;
340  unsigned int right;
341  unsigned int bottom;
342  unsigned int left;
343 };
344 
347 
349 enum class ConvertPolicy
350 {
351  WRAP,
352  SATURATE
353 };
354 
357 {
359  BILINEAR,
360  AREA,
361 };
362 
365 {
368 };
369 
371 enum class ThresholdType
372 {
373  BINARY,
374  RANGE
375 };
376 
378 enum class Termination
379 {
383 };
384 
386 enum class MagnitudeType
387 {
388  L1NORM,
389  L2NORM
390 };
391 
396 enum class PhaseType
397 {
398  SIGNED,
399  UNSIGNED
400 };
401 
403 struct KeyPoint
404 {
405  int32_t x{ 0 };
406  int32_t y{ 0 };
407  float strength{ 0.f };
408  float scale{ 0.f };
409  float orientation{ 0.f };
410  int32_t tracking_status{ 0 };
411  float error{ 0.f };
412 };
413 
415 using InternalKeypoint = std::tuple<float, float, float>; /* x,y,strength */
416 
418 struct Rectangle
419 {
420  uint16_t x;
421  uint16_t y;
422  uint16_t width;
423  uint16_t height;
424 };
425 
428 {
429  int32_t x;
430  int32_t y;
431 };
432 
435 {
436  uint32_t x;
437  uint32_t y;
438  uint32_t z;
439 };
440 
442 using PaddingInfo = std::pair<uint32_t, uint32_t>;
443 
445 using PaddingList = std::vector<PaddingInfo>;
446 
448 using Multiples = std::vector<uint32_t>;
449 
451 enum class Channel
452 {
453  UNKNOWN,
454  C0,
455  C1,
456  C2,
457  C3,
458  R,
459  G,
460  B,
461  A,
462  Y,
463  U,
464  V
465 };
466 
468 enum class MatrixPattern
469 {
470  BOX,
471  CROSS,
472  DISK,
473  OTHER
474 };
475 
477 enum class NonLinearFilterFunction : unsigned
478 {
479  MEDIAN = 0,
480  MIN = 1,
481  MAX = 2,
482 };
483 
486 {
487  ARG_IDX_MAX,
488  ARG_IDX_MIN,
489  MEAN_SUM,
490  PROD,
491  SUM_SQUARE,
492  SUM,
493  MIN,
494  MAX,
495 };
496 
499 {
500  ADD,
501  SUB,
502  DIV,
503  MIN,
504  MAX,
505  SQUARED_DIFF,
506  POWER,
507  PRELU,
508 };
509 
512 {
513  RSQRT,
514  EXP,
515  NEG,
516  LOG,
517  ABS,
518  SIN,
519  ROUND,
520 };
521 
523 enum class NormType
524 {
525  IN_MAP_1D,
526  IN_MAP_2D,
527  CROSS_MAP
528 };
529 
531 enum class HOGNormType
532 {
533  L2_NORM = 1,
534  L2HYS_NORM = 2,
535  L1_NORM = 3
536 };
537 
545 {
546  uint16_t x{ 0 };
547  uint16_t y{ 0 };
548  uint16_t width{ 0 };
549  uint16_t height{ 0 };
550  uint16_t idx_class{ 0 };
551  float score{ 0.f };
552 };
553 
558 {
559  FLOOR,
560  CEIL
561 };
562 
564 enum class PoolingType
565 {
566  MAX,
567  AVG,
568  L2
569 };
570 
572 enum class NMSType
573 {
574  LINEAR,
575  GAUSSIAN,
576  ORIGINAL
577 };
578 
580 class BoxNMSLimitInfo final
581 {
582 public:
597  BoxNMSLimitInfo(float score_thresh = 0.05f, float nms = 0.3f,
598  int detections = 100, bool soft_nms_enabled = false,
600  float soft_nms_sigma = 0.5f, float soft_nms_min_score_thres = 0.001f, bool suppress_size = false, float min_size = 1.0f, float im_width = 1.0f, float im_height = 1.0f)
601  : _score_thresh(score_thresh), _nms(nms), _detections_per_im(detections), _soft_nms_enabled(soft_nms_enabled), _soft_nms_method(soft_nms_method), _soft_nms_sigma(soft_nms_sigma),
602  _soft_nms_min_score_thres(soft_nms_min_score_thres), _suppress_size(suppress_size), _min_size(min_size), _im_width(im_width), _im_height(im_height)
603  {
604  }
606  float score_thresh() const
607  {
608  return _score_thresh;
609  }
611  float nms() const
612  {
613  return _nms;
614  }
616  int detections_per_im() const
617  {
618  return _detections_per_im;
619  }
621  bool soft_nms_enabled() const
622  {
623  return _soft_nms_enabled;
624  }
627  {
628  return _soft_nms_method;
629  }
631  float soft_nms_sigma() const
632  {
633  return _soft_nms_sigma;
634  }
637  {
638  return _soft_nms_min_score_thres;
639  }
641  bool suppress_size() const
642  {
643  return _suppress_size;
644  }
646  float min_size() const
647  {
648  return _min_size;
649  }
651  float im_width() const
652  {
653  return _im_width;
654  }
656  float im_height() const
657  {
658  return _im_height;
659  }
660 
661 private:
662  float _score_thresh;
663  float _nms;
664  int _detections_per_im;
665  bool _soft_nms_enabled;
666  NMSType _soft_nms_method;
667  float _soft_nms_sigma;
668  float _soft_nms_min_score_thres;
669  bool _suppress_size;
670  float _min_size;
671  float _im_width;
672  float _im_height;
673 };
674 
677 {
678 public:
687  PadStrideInfo(unsigned int stride_x = 1, unsigned int stride_y = 1,
688  unsigned int pad_x = 0, unsigned int pad_y = 0,
690  : _stride(std::make_pair(stride_x, stride_y)),
691  _pad_left(pad_x),
692  _pad_top(pad_y),
693  _pad_right(pad_x),
694  _pad_bottom(pad_y),
695  _round_type(round)
696  {
697  }
708  PadStrideInfo(unsigned int stride_x, unsigned int stride_y,
709  unsigned int pad_left, unsigned int pad_right,
710  unsigned int pad_top, unsigned int pad_bottom,
712  : _stride(std::make_pair(stride_x, stride_y)),
713  _pad_left(pad_left),
714  _pad_top(pad_top),
715  _pad_right(pad_right),
716  _pad_bottom(pad_bottom),
717  _round_type(round)
718  {
719  }
724  std::pair<unsigned int, unsigned int> stride() const
725  {
726  return _stride;
727  }
732  bool padding_is_symmetric() const
733  {
734  return (_pad_left == _pad_right) && (_pad_top == _pad_bottom);
735  }
742  std::pair<unsigned int, unsigned int> pad() const
743  {
744  //this accessor should be used only when padding is symmetric
746  return std::make_pair(_pad_left, _pad_top);
747  }
748 
750  unsigned int pad_left() const
751  {
752  return _pad_left;
753  }
755  unsigned int pad_right() const
756  {
757  return _pad_right;
758  }
760  unsigned int pad_top() const
761  {
762  return _pad_top;
763  }
765  unsigned int pad_bottom() const
766  {
767  return _pad_bottom;
768  }
769 
772  {
773  return _round_type;
774  }
775 
777  bool has_padding() const
778  {
779  return (_pad_left != 0 || _pad_top != 0 || _pad_right != 0 || _pad_bottom != 0);
780  }
781 
782 private:
783  std::pair<unsigned int, unsigned int> _stride;
784  unsigned int _pad_left;
785  unsigned int _pad_top;
786  unsigned int _pad_right;
787  unsigned int _pad_bottom;
788 
789  DimensionRoundingType _round_type;
790 };
791 
794 {
796  bool transpose_weights{ true };
797  bool are_weights_reshaped{ false };
798  bool retain_internal_weights{ false };
807  {
808  weights_trained_layout = layout;
809  return *this;
810  }
817  FullyConnectedLayerInfo &set_transpose_weights(bool should_transpose_weights)
818  {
819  transpose_weights = should_transpose_weights;
820  return *this;
821  }
822 };
823 
825 class PriorBoxLayerInfo final
826 {
827 public:
830  : _min_sizes(),
831  _variances(),
832  _offset(),
833  _flip(true),
834  _clip(false),
835  _max_sizes(),
836  _aspect_ratios(),
837  _img_size(),
838  _steps()
839  {
840  }
853  PriorBoxLayerInfo(const std::vector<float> &min_sizes, const std::vector<float> &variances, float offset, bool flip = true, bool clip = false,
854  const std::vector<float> &max_sizes = {}, const std::vector<float> &aspect_ratios = {},
855  const Coordinates2D &img_size = Coordinates2D{ 0, 0 }, const std::array<float, 2> &steps = { { 0.f, 0.f } })
856  : _min_sizes(min_sizes),
857  _variances(variances),
858  _offset(offset),
859  _flip(flip),
860  _clip(clip),
861  _max_sizes(max_sizes),
862  _aspect_ratios(),
863  _img_size(img_size),
864  _steps(steps)
865  {
866  _aspect_ratios.push_back(1.);
867  for(unsigned int i = 0; i < aspect_ratios.size(); ++i)
868  {
869  float ar = aspect_ratios[i];
870  bool already_exist = false;
871  for(auto ar_new : _aspect_ratios)
872  {
873  if(fabs(ar - ar_new) < 1e-6)
874  {
875  already_exist = true;
876  break;
877  }
878  }
879  if(!already_exist)
880  {
881  _aspect_ratios.push_back(ar);
882  if(flip)
883  {
884  _aspect_ratios.push_back(1.f / ar);
885  }
886  }
887  }
888  }
890  std::vector<float> min_sizes() const
891  {
892  return _min_sizes;
893  }
895  std::vector<float> variances() const
896  {
897  return _variances;
898  }
900  std::array<float, 2> steps() const
901  {
902  return _steps;
903  }
906  {
907  return _img_size;
908  }
910  float offset() const
911  {
912  return _offset;
913  }
915  bool flip() const
916  {
917  return _flip;
918  }
920  bool clip() const
921  {
922  return _clip;
923  }
925  std::vector<float> max_sizes() const
926  {
927  return _max_sizes;
928  }
930  std::vector<float> aspect_ratios() const
931  {
932  return _aspect_ratios;
933  }
934 
935 private:
936  std::vector<float> _min_sizes;
937  std::vector<float> _variances;
938  float _offset;
939  bool _flip;
940  bool _clip;
941  std::vector<float> _max_sizes;
942  std::vector<float> _aspect_ratios;
943  Coordinates2D _img_size;
944  std::array<float, 2> _steps;
945 };
946 
947 // Bounding Box [xmin, ymin, xmax, ymax]
948 using BBox = std::array<float, 4>;
949 // LabelBBox used for map label and bounding box
950 using LabelBBox = std::map<int, std::vector<BBox>>;
951 
954 {
955  CORNER,
956  CENTER_SIZE,
957  CORNER_SIZE,
958  TF_CENTER
959 };
960 
963 {
964 public:
967  : _num_classes(),
968  _share_location(),
970  _keep_top_k(),
971  _nms_threshold(),
972  _top_k(),
973  _background_label_id(),
974  _confidence_threshold(),
975  _variance_encoded_in_target(false),
976  _eta(),
977  _num_loc_classes()
978  {
979  _num_loc_classes = _share_location ? 1 : _num_classes;
980  }
996  : _num_classes(num_classes),
997  _share_location(share_location),
998  _code_type(code_type),
999  _keep_top_k(keep_top_k),
1000  _nms_threshold(nms_threshold),
1001  _top_k(top_k),
1002  _background_label_id(background_label_id),
1003  _confidence_threshold(confidence_threshold),
1004  _variance_encoded_in_target(variance_encoded_in_target),
1005  _eta(eta),
1006  _num_loc_classes()
1007  {
1008  _num_loc_classes = _share_location ? 1 : _num_classes;
1009  }
1011  int num_classes() const
1012  {
1013  return _num_classes;
1014  }
1016  bool share_location() const
1017  {
1018  return _share_location;
1019  }
1022  {
1023  return _code_type;
1024  }
1027  {
1028  return _variance_encoded_in_target;
1029  }
1031  int keep_top_k() const
1032  {
1033  return _keep_top_k;
1034  }
1036  float nms_threshold() const
1037  {
1038  return _nms_threshold;
1039  }
1041  float eta() const
1042  {
1043  return _eta;
1044  }
1047  {
1048  return _background_label_id;
1049  }
1051  float confidence_threshold() const
1052  {
1053  return _confidence_threshold;
1054  }
1056  int top_k() const
1057  {
1058  return _top_k;
1059  }
1061  int num_loc_classes() const
1062  {
1063  return _num_loc_classes;
1064  }
1065 
1066 private:
1067  int _num_classes;
1068  bool _share_location;
1069  DetectionOutputLayerCodeType _code_type;
1070  int _keep_top_k;
1071  float _nms_threshold;
1072  int _top_k;
1073  int _background_label_id;
1074  float _confidence_threshold;
1075  bool _variance_encoded_in_target;
1076  float _eta;
1077  int _num_loc_classes;
1078 };
1079 
1082 {
1083 public:
1086  : _max_detections(),
1087  _max_classes_per_detection(),
1088  _nms_score_threshold(),
1089  _iou_threshold(),
1090  _num_classes(),
1091  _scales_values(),
1092  _use_regular_nms(),
1093  _detection_per_class()
1094  {
1095  }
1108  std::array<float, 4> scales_values, bool use_regular_nms = false, unsigned int detection_per_class = 100)
1109  : _max_detections(max_detections),
1110  _max_classes_per_detection(max_classes_per_detection),
1111  _nms_score_threshold(nms_score_threshold),
1112  _iou_threshold(iou_threshold),
1113  _num_classes(num_classes),
1114  _scales_values(scales_values),
1115  _use_regular_nms(use_regular_nms),
1116  _detection_per_class(detection_per_class)
1117  {
1118  }
1120  unsigned int max_detections() const
1121  {
1122  return _max_detections;
1123  }
1125  unsigned int max_classes_per_detection() const
1126  {
1127  return _max_classes_per_detection;
1128  }
1130  unsigned int detection_per_class() const
1131  {
1132  return _detection_per_class;
1133  }
1135  float nms_score_threshold() const
1136  {
1137  return _nms_score_threshold;
1138  }
1140  float iou_threshold() const
1141  {
1142  return _iou_threshold;
1143  }
1145  unsigned int num_classes() const
1146  {
1147  return _num_classes;
1148  }
1150  bool use_regular_nms() const
1151  {
1152  return _use_regular_nms;
1153  }
1155  float scale_value_y() const
1156  {
1157  // Saved as [y,x,h,w]
1158  return _scales_values[0];
1159  }
1161  float scale_value_x() const
1162  {
1163  // Saved as [y,x,h,w]
1164  return _scales_values[1];
1165  }
1167  float scale_value_h() const
1168  {
1169  // Saved as [y,x,h,w]
1170  return _scales_values[2];
1171  }
1173  float scale_value_w() const
1174  {
1175  // Saved as [y,x,h,w]
1176  return _scales_values[3];
1177  }
1178 
1179 private:
1180  unsigned int _max_detections;
1181  unsigned int _max_classes_per_detection;
1182  float _nms_score_threshold;
1183  float _iou_threshold;
1184  unsigned int _num_classes;
1185  std::array<float, 4> _scales_values;
1186  bool _use_regular_nms;
1187  unsigned int _detection_per_class;
1188 };
1189 
1192 {
1193 public:
1196  : _pool_type(PoolingType::MAX), _pool_size(Size2D()), _pad_stride_info(PadStrideInfo()), _exclude_padding(false), _is_global_pooling(false)
1197  {
1198  }
1209  unsigned int pool_size,
1211  bool exclude_padding = false)
1212  : _pool_type(pool_type), _pool_size(Size2D(pool_size, pool_size)), _pad_stride_info(pad_stride_info), _exclude_padding(exclude_padding), _is_global_pooling(false)
1213  {
1214  }
1225  Size2D pool_size,
1227  bool exclude_padding = false)
1228  : _pool_type(pool_type), _pool_size(pool_size), _pad_stride_info(pad_stride_info), _exclude_padding(exclude_padding), _is_global_pooling(false)
1229  {
1230  }
1238  : _pool_type(pool_type), _pool_size(Size2D()), _pad_stride_info(PadStrideInfo(1, 1, 0, 0)), _exclude_padding(false), _is_global_pooling(true)
1239  {
1240  }
1243  {
1244  return _pool_type;
1245  }
1247  const Size2D &pool_size() const
1248  {
1249  return _pool_size;
1250  }
1253  {
1254  return _pad_stride_info;
1255  }
1257  bool exclude_padding() const
1258  {
1259  return _exclude_padding;
1260  }
1262  bool is_global_pooling() const
1263  {
1264  return _is_global_pooling;
1265  }
1266 
1267 private:
1268  PoolingType _pool_type;
1269  Size2D _pool_size;
1270  PadStrideInfo _pad_stride_info;
1271  bool _exclude_padding;
1272  bool _is_global_pooling;
1273 };
1274 
1277 {
1278 public:
1286  ROIPoolingLayerInfo(unsigned int pooled_width, unsigned int pooled_height, float spatial_scale, unsigned int sampling_ratio = 0)
1287  : _pooled_width(pooled_width), _pooled_height(pooled_height), _spatial_scale(spatial_scale), _sampling_ratio(sampling_ratio)
1288  {
1289  }
1291  unsigned int pooled_width() const
1292  {
1293  return _pooled_width;
1294  }
1296  unsigned int pooled_height() const
1297  {
1298  return _pooled_height;
1299  }
1301  float spatial_scale() const
1302  {
1303  return _spatial_scale;
1304  }
1306  unsigned int sampling_ratio() const
1307  {
1308  return _sampling_ratio;
1309  }
1310 
1311 private:
1312  unsigned int _pooled_width;
1313  unsigned int _pooled_height;
1314  float _spatial_scale;
1315  unsigned int _sampling_ratio;
1316 };
1317 
1320 {
1321 public:
1334  GenerateProposalsInfo(float im_width, float im_height, float im_scale, float spatial_scale = 1.0, int pre_nms_topN = 6000, int post_nms_topN = 300, float nms_thres = 0.7, float min_size = 16.0,
1335  size_t values_per_roi = 4)
1336  : _im_height(im_height), _im_width(im_width), _im_scale(im_scale), _spatial_scale(spatial_scale), _pre_nms_topN(pre_nms_topN), _post_nms_topN(post_nms_topN), _nms_thres(nms_thres),
1337  _min_size(min_size), _values_per_roi(values_per_roi)
1338  {
1339  }
1340 
1341  /* Get the original height */
1342  float im_height() const
1343  {
1344  return _im_height;
1345  }
1346  /* Get the original width */
1347  float im_width() const
1348  {
1349  return _im_width;
1350  }
1351  /* Get the image scale */
1352  float im_scale() const
1353  {
1354  return _im_scale;
1355  }
1356  /* Get the value of how many best scores to select (before NMS) */
1357  int pre_nms_topN() const
1358  {
1359  return _pre_nms_topN;
1360  }
1361  /* Get the value of how many best scores to select (after NMS) */
1362  int post_nms_topN() const
1363  {
1364  return _post_nms_topN;
1365  }
1366  /* Get the NMS overlap threshold */
1367  float nms_thres() const
1368  {
1369  return _nms_thres;
1370  }
1371  /* Get the minimal size */
1372  float min_size() const
1373  {
1374  return _min_size;
1375  }
1376  /* Get the spatial scale to be applied to the feature maps */
1377  float spatial_scale() const
1378  {
1379  return _spatial_scale;
1380  }
1381  /* Get the values used to represent a ROI(Region of interest)*/
1382  size_t values_per_roi() const
1383  {
1384  return _values_per_roi;
1385  }
1386 
1387 private:
1388  float _im_height;
1389  float _im_width;
1390  float _im_scale;
1391  float _spatial_scale;
1392  int _pre_nms_topN;
1393  int _post_nms_topN;
1394  float _nms_thres;
1395  float _min_size;
1396  size_t _values_per_roi;
1397 };
1398 
1401 {
1402 public:
1411  : _feat_height(feat_height),
1412  _feat_width(feat_width),
1413  _spatial_scale(spatial_scale),
1414  _values_per_roi(values_per_roi)
1415  {
1416  }
1417 
1418  /* Get the height of the feature map */
1419  float feat_height() const
1420  {
1421  return _feat_height;
1422  }
1423 
1424  /* Get the width of the feature map */
1425  float feat_width() const
1426  {
1427  return _feat_width;
1428  }
1429 
1430  /* Get the scale of the feature map */
1431  float spatial_scale() const
1432  {
1433  return _spatial_scale;
1434  }
1435 
1436  /* Get the values used to represent a ROI(Region Of Interest)*/
1437  size_t values_per_roi() const
1438  {
1439  return _values_per_roi;
1440  }
1441 
1442 private:
1443  float _feat_height;
1444  float _feat_width;
1445  float _spatial_scale;
1446  size_t _values_per_roi;
1447 };
1448 
1451 {
1452 public:
1463  BoundingBoxTransformInfo(float img_width, float img_height, float scale, bool apply_scale = false, const std::array<float, 4> weights = { { 1.f, 1.f, 1.f, 1.f } }, bool correct_transform_coords =
1464  false,
1465  float bbox_xform_clip =
1466  4.135166556742356f)
1467  : _img_width(img_width), _img_height(img_height), _scale(scale), _apply_scale(apply_scale), _correct_transform_coords(correct_transform_coords), _weights(weights), _bbox_xform_clip(bbox_xform_clip)
1468  {
1469  }
1470 
1471  std::array<float, 4> weights() const
1472  {
1473  return _weights;
1474  }
1475 
1476  float bbox_xform_clip() const
1477  {
1478  return _bbox_xform_clip;
1479  }
1480 
1481  float img_height() const
1482  {
1483  return _img_height;
1484  }
1485 
1486  float img_width() const
1487  {
1488  return _img_width;
1489  }
1490 
1491  float scale() const
1492  {
1493  return _scale;
1494  }
1495 
1496  bool apply_scale() const
1497  {
1498  return _apply_scale;
1499  }
1500 
1502  {
1503  return _correct_transform_coords;
1504  }
1505 
1506 private:
1507  float _img_width;
1508  float _img_height;
1509  float _scale;
1510  bool _apply_scale;
1511  bool _correct_transform_coords;
1512  std::array<float, 4> _weights;
1513  float _bbox_xform_clip;
1514 };
1515 
1518 {
1519 public:
1522  {
1523  LOGISTIC,
1524  TANH,
1525  RELU,
1526  BOUNDED_RELU,
1527  LU_BOUNDED_RELU,
1528  LEAKY_RELU,
1529  SOFT_RELU,
1530  ABS,
1531  SQUARE,
1532  SQRT,
1533  LINEAR,
1534  IDENTITY
1535  };
1536 
1537  ActivationLayerInfo() = default;
1545  ActivationLayerInfo(ActivationFunction f, float a = 0.0f, float b = 0.0f)
1546  : _act(f), _a(a), _b(b), _enabled(true)
1547  {
1548  }
1551  {
1552  return _act;
1553  }
1555  float a() const
1556  {
1557  return _a;
1558  }
1560  float b() const
1561  {
1562  return _b;
1563  }
1565  bool enabled() const
1566  {
1567  return _enabled;
1568  }
1569 
1570 private:
1572  float _a = {};
1573  float _b = {};
1574  bool _enabled = { false };
1575 };
1576 
1579 {
1580 public:
1591  NormalizationLayerInfo(NormType type, uint32_t norm_size = 5, float alpha = 0.0001f, float beta = 0.5f, float kappa = 1.f, bool is_scaled = true)
1592  : _type(type), _norm_size(norm_size), _alpha(alpha), _beta(beta), _kappa(kappa), _is_scaled(is_scaled)
1593  {
1594  }
1596  NormType type() const
1597  {
1598  return _type;
1599  }
1601  uint32_t norm_size() const
1602  {
1603  return _norm_size;
1604  }
1606  float alpha() const
1607  {
1608  return _alpha;
1609  }
1611  float beta() const
1612  {
1613  return _beta;
1614  }
1616  float kappa() const
1617  {
1618  return _kappa;
1619  }
1621  bool is_scaled() const
1622  {
1623  return _is_scaled;
1624  }
1626  bool is_cross_map() const
1627  {
1628  return _type == NormType::CROSS_MAP;
1629  }
1631  bool is_in_map() const
1632  {
1633  return !is_cross_map();
1634  }
1642  float scale_coeff() const
1643  {
1644  const uint32_t size = (_type == NormType::IN_MAP_2D) ? _norm_size * _norm_size : _norm_size;
1645  return (_is_scaled) ? (_alpha / size) : _alpha;
1646  }
1647 
1648 private:
1649  NormType _type;
1650  uint32_t _norm_size;
1651  float _alpha;
1652  float _beta;
1653  float _kappa;
1654  bool _is_scaled;
1655 };
1656 
1659 {
1660 public:
1663  : _are_reshaped(false), _kernel_width(0), _kernel_height(0), _num_kernels(0), _retain_internal_weights(false)
1664  {
1665  }
1674  WeightsInfo(bool are_reshaped, unsigned int kernel_width, unsigned int kernel_height, unsigned int num_kernels, bool retain_internal_weights = false)
1675  : _are_reshaped(are_reshaped), _kernel_width(kernel_width), _kernel_height(kernel_height), _num_kernels(num_kernels), _retain_internal_weights(retain_internal_weights)
1676  {
1677  }
1682  bool are_reshaped() const
1683  {
1684  return _are_reshaped;
1685  };
1690  unsigned int num_kernels() const
1691  {
1692  return _num_kernels;
1693  };
1698  std::pair<unsigned int, unsigned int> kernel_size() const
1699  {
1700  return std::make_pair(_kernel_width, _kernel_height);
1701  }
1703  {
1704  return _retain_internal_weights;
1705  }
1706 
1707 private:
1708  const bool _are_reshaped;
1709  const unsigned int _kernel_width;
1710  const unsigned int _kernel_height;
1711  const unsigned int _num_kernels;
1712  const bool _retain_internal_weights;
1713 };
1714 
1724 class GEMMReshapeInfo final
1725 {
1726 public:
1729  : _m(1), _n(1), _k(1), _mult_transpose1xW_width(1), _mult_interleave4x4_height(1), _depth_output_gemm3d(0), _reinterpret_input_as_3d(false), _broadcast_bias(false)
1730  {
1731  }
1746  : _m(m), _n(n), _k(k), _mult_transpose1xW_width(mult_transpose1xW_width), _mult_interleave4x4_height(mult_interleave4x4_height), _depth_output_gemm3d(depth_output_gemm3d),
1747  _reinterpret_input_as_3d(reinterpret_input_as_3d), _broadcast_bias(broadcast_bias)
1748  {
1749  }
1754  int m() const
1755  {
1756  return _m;
1757  }
1762  int n() const
1763  {
1764  return _n;
1765  }
1770  int k() const
1771  {
1772  return _k;
1773  }
1779  {
1780  return _mult_transpose1xW_width;
1781  }
1787  {
1788  return _mult_interleave4x4_height;
1789  }
1798  {
1799  return _depth_output_gemm3d;
1800  }
1806  {
1807  return _reinterpret_input_as_3d;
1808  };
1813  bool broadcast_bias() const
1814  {
1815  return _broadcast_bias;
1816  };
1817 
1818 private:
1819  const int _m;
1820  const int _n;
1821  const int _k;
1822  const int _mult_transpose1xW_width;
1823  const int _mult_interleave4x4_height;
1824  const int _depth_output_gemm3d;
1825  const bool _reinterpret_input_as_3d;
1826  const bool _broadcast_bias;
1827 };
1828 
1830 {
1831  unsigned int c0{ 1 };
1832  bool transpose{ false };
1833 };
1834 
1837 {
1838  NONE,
1839  QUANTIZE_DOWN,
1842 };
1843 
1846 {
1848  int gemmlowp_offset{ 0 };
1850  int gemmlowp_shift{ 0 };
1853 };
1854 
1857 {
1858  unsigned int m0{ 1 };
1859  unsigned int k0{ 1 };
1860  unsigned int v0{ 1 };
1861  bool transpose{ true };
1862  bool interleave{ true };
1863 };
1864 
1867 {
1868  unsigned int n0{ 1 };
1869  unsigned int k0{ 1 };
1870  unsigned int h0{ 1 };
1871  bool transpose{ true };
1872  bool interleave{ true };
1873 };
1874 
1881 {
1882 public:
1884  GEMMInfo() noexcept
1885  : _is_a_reshaped(false),
1886  _is_b_reshaped(false),
1887  _reshape_b_only_on_first_run(true),
1888  _depth_output_gemm3d(0),
1889  _reinterpret_input_as_3d(false),
1890  _retain_internal_weights(false),
1891  _gemmlowp_output_stage(),
1892  _fp_mixed_precision(false),
1893  _broadcast_bias(false),
1894  _pretranpose_B(true),
1895  _activation_info()
1896  {
1897  }
1916  : _is_a_reshaped(is_a_reshaped),
1917  _is_b_reshaped(is_b_reshaped),
1918  _reshape_b_only_on_first_run(reshape_b_only_on_first_run),
1919  _depth_output_gemm3d(depth_output_gemm3d),
1920  _reinterpret_input_as_3d(reinterpret_input_as_3d),
1921  _retain_internal_weights(retain_internal_weights),
1922  _gemmlowp_output_stage(gemmlowp_output_stage),
1923  _fp_mixed_precision(fp_mixed_precision),
1924  _broadcast_bias(broadcast_bias),
1925  _pretranpose_B(reshape_b_only_on_first_run),
1926  _activation_info(activation_info)
1927  {
1928  }
1933  bool is_a_reshaped() const
1934  {
1935  return _is_a_reshaped;
1936  };
1941  bool is_b_reshaped() const
1942  {
1943  return _is_b_reshaped;
1944  };
1952  {
1953  return _reshape_b_only_on_first_run;
1954  };
1960  {
1961  return _depth_output_gemm3d;
1962  };
1968  {
1969  return _reinterpret_input_as_3d;
1970  };
1976  {
1977  return _retain_internal_weights;
1978  };
1984  {
1985  return _gemmlowp_output_stage;
1986  };
1991  bool fp_mixed_precision() const
1992  {
1993  return _fp_mixed_precision;
1994  };
1999  bool broadcast_bias() const
2000  {
2001  return _broadcast_bias;
2002  };
2007  bool pretranpose_B() const
2008  {
2009  return _pretranpose_B;
2010  };
2015  void set_pretranpose_B(bool flag)
2016  {
2017  _pretranpose_B = flag;
2018  }
2024  {
2025  return _activation_info;
2026  }
2027 
2028 private:
2029  bool _is_a_reshaped;
2030  bool _is_b_reshaped;
2031  bool _reshape_b_only_on_first_run;
2032  int _depth_output_gemm3d;
2033  bool _reinterpret_input_as_3d;
2034  bool _retain_internal_weights;
2035  GEMMLowpOutputStageInfo _gemmlowp_output_stage;
2036  bool _fp_mixed_precision;
2037  bool _broadcast_bias;
2038  bool _pretranpose_B;
2039  ActivationLayerInfo _activation_info;
2040 };
2041 
2044 {
2055  {
2056  }
2057 
2063 };
2064 
2067 {
2069  enum class PrecisionType
2070  {
2071  Default,
2072  Custom,
2073  Full
2074  };
2075 
2077  enum class PrintRegion
2078  {
2079  ValidRegion,
2080  NoPadding,
2081  Full
2082  };
2083 
2095  unsigned int precision = 10,
2096  bool align_columns = true,
2097  std::string element_delim = " ",
2098  std::string row_delim = "\n")
2105  {
2106  }
2107 
2113  unsigned int precision;
2115  std::string element_delim;
2117  std::string row_delim;
2120 };
2121 } // namespace arm_compute
2122 #endif /* __ARM_COMPUTE_TYPES_H__ */
float scale_coeff() const
Return the scaling factor of the normalization function.
Definition: Types.h:1642
BorderMode
Methods available to handle borders.
Definition: Types.h:251
ValidRegion(const Coordinates &an_anchor, const TensorShape &a_shape, size_t num_dimensions)
Constructor for a valid region with specified number of dimensions.
Definition: Types.h:212
Rectangle type.
Definition: Types.h:418
PrecisionType precision_type
Floating point precision type.
Definition: Types.h:2111
void set_pretranpose_B(bool flag)
Set pre-transpose b flag.
Definition: Types.h:2015
bool exclude_padding() const
Check if padding is excluded in calculations.
Definition: Types.h:1257
constexpr float SCALE_PYRAMID_ORB
Constant value used to indicate a ORB scaled pyramid.
Definition: Types.h:109
Coordinate type.
Definition: Types.h:434
DeconvolutionMethod
Available DeconvolutionMethod.
Definition: Types.h:141
ValidRegion & set(size_t dimension, int start, size_t size)
Accessor to set the value of anchor and shape for one of the dimensions.
Definition: Types.h:239
ValidRegion & operator=(const ValidRegion &)=default
Allow instances of this class to be copied.
constexpr float SCALE_PYRAMID_HALF
Constant value used to indicate a half-scale pyramid.
Definition: Types.h:106
unsigned int top
top of the border
Definition: Types.h:339
L2-norm followed by clipping.
A single plane of 32-bit macro pixel of U0, Y0, V0, Y1 byte.
ArithmeticOperation
Available element-wise operations.
Definition: Types.h:498
InterpolationPolicy
Interpolation method.
Definition: Types.h:356
int num_classes() const
Get num classes.
Definition: Types.h:1011
int mult_interleave4x4_height() const
Multiplication factor for the height of the 4x4 interleaved block.
Definition: Types.h:1786
float scale
Scale initialized to 0 by the corner detector.
Definition: Types.h:408
Generate Proposals Information class.
Definition: Types.h:1319
Second channel (used by formats with unknown channel types).
Shape of a tensor.
Definition: TensorShape.h:39
const DataLayout data_layout
Definition: Im2Col.cpp:146
float kappa() const
Get the kappa value.
Definition: Types.h:1616
Quantize to uint8 using a fixed point multiplication.
int gemmlowp_max_bound
GEMMLowp max value used to saturate down the output result before converting back to QASYMM8.
Definition: Types.h:1852
uint32_t x
X coordinates.
Definition: Types.h:436
bool share_location() const
Get share location.
Definition: Types.h:1016
float im_width() const
Get image width (NMS may suppress boxes whose center sits beyond the image width)
Definition: Types.h:651
FullyConnectedLayerInfo & set_weights_trained_layout(DataLayout layout)
Sets the weights trained data layout.
Definition: Types.h:806
float scale_value_x() const
Get x scale value.
Definition: Types.h:1161
float score_thresh() const
Get the score threshold.
Definition: Types.h:606
DataLayout output_data_layout
Data layout to use for the output tensor once the convolution has been applied (NCHW or NHWC)
Definition: Types.h:2062
DimensionRoundingType round() const
Get the rounding type.
Definition: Types.h:771
PoolingLayerInfo(PoolingType pool_type, Size2D pool_size, PadStrideInfo pad_stride_info=PadStrideInfo(), bool exclude_padding=false)
Default Constructor.
Definition: Types.h:1224
quantized, symmetric fixed-point 16-bit number
BorderSize operator *(float scale)
Scale a copy of this border size.
Definition: Types.h:319
~ValidRegion()=default
Default destructor.
ROIPoolingLayerInfo(unsigned int pooled_width, unsigned int pooled_height, float spatial_scale, unsigned int sampling_ratio=0)
Constructor.
Definition: Types.h:1286
uint16_t x
Top-left x coordinate.
Definition: Types.h:546
TensorShape shape
Shape of the valid region.
Definition: Types.h:247
WinogradInfo(Size2D output_tile_sz, Size2D kernel_sz, Size2D input_dims, PadStrideInfo conv_info, DataLayout data_layout)
Default constructor.
Definition: Types.h:2053
float score
Confidence value for the detection window.
Definition: Types.h:551
Angle range: [0, 180].
bool is_in_map() const
Check if normalization is not cross map.
Definition: Types.h:1631
bool enabled() const
Check if initialised.
Definition: Types.h:1565
std::vector< PaddingInfo > PaddingList
List of padding information.
Definition: Types.h:445
ReductionOperation
Available reduction operations.
Definition: Types.h:485
Container for 2D border size.
Definition: Types.h:259
bool retain_internal_weights
Retain internal reshaped weights.
Definition: Types.h:798
size_t values_per_roi() const
Definition: Types.h:1437
ActivationLayerInfo(ActivationFunction f, float a=0.0f, float b=0.0f)
Default Constructor.
Definition: Types.h:1545
int32_t x
X coordinates.
Definition: Types.h:405
Angle range: [0, 360].
std::map< int, std::vector< BBox > > LabelBBox
Definition: Types.h:950
PhaseType
Phase calculation type.
Definition: Types.h:396
unsigned int max_detections() const
Get max detections.
Definition: Types.h:1120
float orientation
Orientation initialized to 0 by the corner detector.
Definition: Types.h:409
Cr/V/Value channel.
unsigned int v0
Number of vertical blocks of size (m0xk0) stored on the same output row.
Definition: Types.h:1860
Prints the Tensor object without the padding.
DataLayoutDimension
[DataLayout enum definition]
Definition: Types.h:123
BoxWithNonMaximaSuppressionLimit Information class.
Definition: Types.h:580
Winograd information.
Definition: Types.h:2043
uint32_t norm_size() const
Get the normalization size.
Definition: Types.h:1601
1 channel, 1 U8 per channel
NormType type() const
Get the normalization type.
Definition: Types.h:1596
int mult_transpose1xW_width() const
Multiplication factor for the width of the 1xW transposed block.
Definition: Types.h:1778
int32_t tracking_status
Status initialized to 1 by the corner detector, set to 0 when the point is lost.
Definition: Types.h:410
Terminate when within epsilon of a threshold.
float a() const
Get the alpha value.
Definition: Types.h:1555
GEMM reshape information class.
Definition: Types.h:1724
PadStrideInfo convolution_info
Convolution info (Pads, strides,...)
Definition: Types.h:2061
2D Coordinates structure
Definition: types.h:28
std::vector< float > aspect_ratios() const
Get aspect ratios.
Definition: Types.h:930
PriorBoxLayerInfo(const std::vector< float > &min_sizes, const std::vector< float > &variances, float offset, bool flip=true, bool clip=false, const std::vector< float > &max_sizes={}, const std::vector< float > &aspect_ratios={}, const Coordinates2D &img_size=Coordinates2D{ 0, 0 }, const std::array< float, 2 > &steps={ { 0.f, 0.f } })
Constructor.
Definition: Types.h:853
FullyConnectedLayerInfo & set_transpose_weights(bool should_transpose_weights)
Sets the transpose weights flag.
Definition: Types.h:817
GEMMLowpOutputStageInfo gemmlowp_output_stage() const
GEMMLowp output stage.
Definition: Types.h:1983
bool are_reshaped() const
Flag which specifies if the weights tensor has been reshaped.
Definition: Types.h:1682
half_float::half half
16-bit floating point type
Definition: Types.h:44
1 channel, 1 F32 per channel
Custom precision specified by the user using the precision parameter.
DimensionRoundingType
Dimension rounding type when down-scaling on CNNs.
Definition: Types.h:557
Normalization Layer Information class.
Definition: Types.h:1578
Unknown channel format.
Output values are defined by bilinear interpolation between the pixels.
unsigned int h0
Number of horizontal blocks of size (k0xn0) stored on the same output row.
Definition: Types.h:1870
unsigned int precision
Floating point precision.
Definition: Types.h:2113
bool is_cross_map() const
Check if normalization is cross map.
Definition: Types.h:1626
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
Definition: Error.h:337
Fully connected layer info.
Definition: Types.h:793
bool fp_mixed_precision() const
Flag which specifies if a wider accumulator should be used.
Definition: Types.h:1991
BilinearInterpolation
Bilinear Interpolation method used by LKTracker.
Definition: Types.h:364
GEMM LHS (Left Hand Side) matrix information.
Definition: Types.h:1856
bool pretranpose_B() const
Flag which specifies whether b should be pre-transposed if supported.
Definition: Types.h:2007
A 2 plane YUV format of Luma (Y) and interleaved UV data at 4:2:0 sampling.
Terminate after a maximum number of iterations.
constexpr uint8_t CONSTANT_BORDER_VALUE
Constant value of the border pixels when using BorderMode::CONSTANT.
Definition: Types.h:103
GEMMReshapeInfo(int m, int n, int k, int mult_transpose1xW_width=1, int mult_interleave4x4_height=1, int depth_output_gemm3d=0, bool reinterpret_input_as_3d=false, bool broadcast_bias=false)
Constructor.
Definition: Types.h:1745
ThresholdType
Threshold mode.
Definition: Types.h:371
1 channel, 1 U16 per channel
unsigned int bottom
bottom of the border
Definition: Types.h:341
float eta() const
Get eta.
Definition: Types.h:1041
int depth_output_gemm3d() const
Depth of the output when GEMM output is reinterpreted as 3D tensor.
Definition: Types.h:1959
PrintRegion print_region
Area to be printed by Tensor objects.
Definition: Types.h:2109
unsigned int pooled_width() const
Get the pooled width of the layer.
Definition: Types.h:1291
unsigned int pad_top() const
Get the top padding.
Definition: Types.h:760
Output values are defined to match the source pixel whose center is nearest to the sample position.
BorderSize & operator *=(float scale)
Scale this border size.
Definition: Types.h:303
DetectionPostProcessLayerInfo()
Default Constructor.
Definition: Types.h:1085
bool retain_internal_weights() const
Flag which specifies if the weights tensor has to be retained from previous run.
Definition: Types.h:1975
DetectionOutputLayerCodeType
Available Detection Output code types.
Definition: Types.h:953
void set(size_t dimension, T value)
Accessor to set the value of one of the dimensions.
Definition: Dimensions.h:74
ConvolutionMethod
Available ConvolutionMethod.
Definition: Types.h:132
Activation Layer Information class.
Definition: Types.h:1517
GEMMLowpOutputStageType type
GEMMLowp output stage type.
Definition: Types.h:1847
float spatial_scale() const
Definition: Types.h:1431
Terminate on whichever of the other conditions occurs first.
A 2 plane YUV format of Luma (Y) and interleaved VU data at 4:2:0 sampling.
bool use_regular_nms() const
Get if use regular nms.
Definition: Types.h:1150
bool transpose
True if the (k0xn0) block has to be transposed before been stored.
Definition: Types.h:1871
bool interleave
True if the v0 (m0xk0) blocks have to be interleaved in the output row.
Definition: Types.h:1862
int top_k() const
Get top K.
Definition: Types.h:1056
constexpr BorderSize(unsigned int top_bottom, unsigned int left_right)
Border with same size for top/bottom and left/right.
Definition: Types.h:274
Copyright (c) 2017-2018 ARM Limited.
WeightsInfo()
Default constructor.
Definition: Types.h:1662
bool suppress_size() const
Get if NMS will suppress boxes based on their size/position.
Definition: Types.h:641
bool is_b_reshaped() const
Flag which specifies if the matrix B has been reshaped.
Definition: Types.h:1941
int32_t x
X coordinates.
Definition: Types.h:429
ActivationFunction
Available activation functions.
Definition: Types.h:1521
1 channel, 1 F16 per channel
Samples are taken at pixel center.
float iou_threshold() const
Get intersection over union threshold.
Definition: Types.h:1140
BoxNMSLimitInfo(float score_thresh=0.05f, float nms=0.3f, int detections=100, bool soft_nms_enabled=false, NMSType soft_nms_method=NMSType::LINEAR, float soft_nms_sigma=0.5f, float soft_nms_min_score_thres=0.001f, bool suppress_size=false, float min_size=1.0f, float im_width=1.0f, float im_height=1.0f)
Constructor.
Definition: Types.h:597
Keypoint type.
Definition: Types.h:403
uint32_t z
Z coordinates.
Definition: Types.h:438
GenerateProposalsInfo(float im_width, float im_height, float im_scale, float spatial_scale=1.0, int pre_nms_topN=6000, int post_nms_topN=300, float nms_thres=0.7, float min_size=16.0, size_t values_per_roi=4)
Constructor.
Definition: Types.h:1334
float strength
Strength of the point.
Definition: Types.h:407
NMSType
Available non maxima suppression types.
Definition: Types.h:572
Convolution Layer Weights Information class.
Definition: Types.h:1658
DetectionOutputLayerInfo()
Default Constructor.
Definition: Types.h:966
1 channel, 1 S32 per channel
bool variance_encoded_in_target() const
Get if variance encoded in target.
Definition: Types.h:1026
bool transpose
True if the (m0xk0) block has to be transposed before been stored.
Definition: Types.h:1861
signed 64-bit number
int gemmlowp_multiplier
GEMMLowp output stage multiplier used for quantizing to QASYMM8.
Definition: Types.h:1849
int n() const
Number of matrix B columns.
Definition: Types.h:1762
3 channels, 1 U8 per channel
NormalizationLayerInfo(NormType type, uint32_t norm_size=5, float alpha=0.0001f, float beta=0.5f, float kappa=1.f, bool is_scaled=true)
Default Constructor.
Definition: Types.h:1591
FuseBatchNormalizationType
Available FuseBatchNormalizationType.
Definition: Types.h:148
unsigned int k0
Number of partial accumulations performed by the matrix multiplication.
Definition: Types.h:1869
IOFormatInfo(PrintRegion print_region=PrintRegion::ValidRegion, PrecisionType precision_type=PrecisionType::Default, unsigned int precision=10, bool align_columns=true, std::string element_delim=" ", std::string row_delim="\n")
Construct a set of IO formatting information.
Definition: Types.h:2093
float error
Tracking error initialized to 0 by the corner detector.
Definition: Types.h:411
int32_t y
Y coordinates.
Definition: Types.h:430
std::array< float, 2 > steps() const
Get the step coordinates.
Definition: Types.h:900
float nms() const
Get the NMS.
Definition: Types.h:611
float nms_threshold() const
Get nms threshold.
Definition: Types.h:1036
int gemmlowp_shift
GEMMLowp output stage shift used for quantizing to uint8.
Definition: Types.h:1850
Third channel (used by formats with unknown channel types).
PoolingLayerInfo(PoolingType pool_type)
Default Constructor.
Definition: Types.h:1237
bool padding_is_symmetric() const
Check whether the padding is symmetric.
Definition: Types.h:732
bool is_scaled() const
Get the is_scaled value.
Definition: Types.h:1621
1 channel, 1 U32 per channel
GEMM RHS (Right Hand Side) matrix information.
Definition: Types.h:1866
Normalization applied within the same map in 1D region.
Size2D output_tile_size
Width and height of the output tile.
Definition: Types.h:2058
Channel
Available channels.
Definition: Types.h:451
Format
Image colour formats.
Definition: Types.h:52
std::string row_delim
Row delimeter.
Definition: Types.h:2117
PaddingMode
Padding mode to use for PadLayer.
Definition: Types.h:155
Print the tensor object including padding.
IO formatting information class.
Definition: Types.h:2066
uint16_t width
Width of the detection window.
Definition: Types.h:548
unsigned int n0
Number of columns processed by the matrix multiplication.
Definition: Types.h:1868
quantized, asymmetric fixed-point 8-bit number
bool are_weights_reshaped
Reshape the weights tensor if false.
Definition: Types.h:797
int start(unsigned int d) const
Return the start of the valid region for the given dimension d.
Definition: Types.h:220
Coordinates of an item.
Definition: Coordinates.h:37
float scale_value_h() const
Get h scale value.
Definition: Types.h:1167
std::pair< unsigned int, unsigned int > stride() const
Get the stride.
Definition: Types.h:724
float scale_value_w() const
Get w scale value.
Definition: Types.h:1173
float nms_score_threshold() const
Get nms threshold.
Definition: Types.h:1135
float soft_nms_min_score_thres() const
Get soft nms min score threshold.
Definition: Types.h:636
WeightsInfo(bool are_reshaped, unsigned int kernel_width, unsigned int kernel_height, unsigned int num_kernels, bool retain_internal_weights=false)
Constructor.
Definition: Types.h:1674
std::array< float, 4 > BBox
Definition: Types.h:948
GEMMLowp output stage info.
Definition: Types.h:1845
A 3 plane of 8 bit 4:4:4 sampled Y, U, V planes.
Samples are taken at pixel top left corner.
PriorBox layer info.
Definition: Types.h:825
float offset() const
Get the offset.
Definition: Types.h:910
Fourth channel (used by formats with unknown channel types).
DetectionOutputLayerCodeType code_type() const
Get detection output code type.
Definition: Types.h:1021
unsigned int pad_right() const
Get the right padding.
Definition: Types.h:755
float beta() const
Get the beta value.
Definition: Types.h:1611
int k() const
Number of matrix A columns or matrix B rows.
Definition: Types.h:1770
Quantize to uint8 using a floating point multiplication.
Padding and stride information class.
Definition: Types.h:676
ComparisonOperation
Supported comparison operations.
Definition: Types.h:163
int gemmlowp_offset
GEMMLowp output stage offset used for quantizing to QASYMM8.
Definition: Types.h:1848
GEMMLowpOutputStageType
GEMMLowp output stage type.
Definition: Types.h:1836
Termination
Termination criteria.
Definition: Types.h:378
Coordinates2D img_size() const
Get the image size coordinates.
Definition: Types.h:905
unsigned int c0
Number of channels processed by the depth-wise convolution.
Definition: Types.h:1831
constexpr BorderSize(unsigned int size)
Border with equal size around the 2D plane.
Definition: Types.h:268
bool align_columns
Align columns.
Definition: Types.h:2119
unsigned int num_kernels() const
Return the number of convolution kernels.
Definition: Types.h:1690
bool reinterpret_input_as_3d() const
Flag which specifies if the input tensor has to be reinterpreted as 3D.
Definition: Types.h:1967
Bounding Box Transform information class.
Definition: Types.h:1450
unsigned int left
left of the border
Definition: Types.h:342
GEMMInfo() noexcept
Default constructor.
Definition: Types.h:1884
PriorBoxLayerInfo()
Default Constructor.
Definition: Types.h:829
unsigned int right
right of the border
Definition: Types.h:340
Quantize to uint8 using an integer multiplication.
BoundingBoxTransformInfo(float img_width, float img_height, float scale, bool apply_scale=false, const std::array< float, 4 > weights={ { 1.f, 1.f, 1.f, 1.f } }, bool correct_transform_coords=false, float bbox_xform_clip=4.135166556742356f)
Constructor.
Definition: Types.h:1463
1 channel, 1 S16 per channel
bool broadcast_bias() const
Flag which specifies whether to broadcast the shape of the bias tensor.
Definition: Types.h:1999
uint16_t idx_class
Index of the class.
Definition: Types.h:550
PoolingLayerInfo()
Default Constructor.
Definition: Types.h:1195
int keep_top_k() const
Get the number of total bounding boxes to be kept per image.
Definition: Types.h:1031
Output values are determined by averaging the source pixels whose areas fall under the area of the de...
quantized, symmetric fixed-point 8-bit number
unsigned int sampling_ratio() const
Get sampling ratio.
Definition: Types.h:1306
Num samples, channels, height, width.
PrecisionType
Precision type used when printing floating point numbers.
Definition: Types.h:2069
PadStrideInfo pad_stride_info() const
Get the padding and stride.
Definition: Types.h:1252
unsigned int max_classes_per_detection() const
Get max_classes per detection.
Definition: Types.h:1125
int32_t y
Y coordinates.
Definition: Types.h:406
bool broadcast_bias() const
Flag which specifies whether to broadcast the shape of the bias tensor.
Definition: Types.h:1813
bool is_a_reshaped() const
Flag which specifies if the matrix A has been reshaped.
Definition: Types.h:1933
DetectionPostProcessLayerInfo(unsigned int max_detections, unsigned int max_classes_per_detection, float nms_score_threshold, float iou_threshold, unsigned int num_classes, std::array< float, 4 > scales_values, bool use_regular_nms=false, unsigned int detection_per_class=100)
Constructor.
Definition: Types.h:1107
float scale_value_y() const
Get y scale value.
Definition: Types.h:1155
uint16_t height
Height of the detection window.
Definition: Types.h:549
PadStrideInfo(unsigned int stride_x, unsigned int stride_y, unsigned int pad_left, unsigned int pad_right, unsigned int pad_top, unsigned int pad_bottom, DimensionRoundingType round)
Constructor.
Definition: Types.h:708
Strides of an item in bytes.
Definition: Strides.h:37
quantized, symmetric per channel fixed-point 8-bit number
Convolution using Winograd.
A 3 plane of 8-bit 4:2:0 sampled Y, U, V planes.
float min_size() const
Get size suppression threshold.
Definition: Types.h:646
const Size2D & pool_size() const
Get the pooling size.
Definition: Types.h:1247
PoolingLayerInfo(PoolingType pool_type, unsigned int pool_size, PadStrideInfo pad_stride_info=PadStrideInfo(), bool exclude_padding=false)
Default Constructor.
Definition: Types.h:1208
PadStrideInfo(unsigned int stride_x=1, unsigned int stride_y=1, unsigned int pad_x=0, unsigned int pad_y=0, DimensionRoundingType round=DimensionRoundingType::FLOOR)
Constructor.
Definition: Types.h:687
Detection Output layer info.
Definition: Types.h:962
4 channels, 1 U8 per channel
uint32_t y
Y coordinates.
Definition: Types.h:437
ValidRegion(const Coordinates &an_anchor, const TensorShape &a_shape)
Constructor for a valid region with default number of dimensions.
Definition: Types.h:199
PoolingType
Available pooling types.
Definition: Types.h:564
GEMMReshapeInfo()
Default constructor.
Definition: Types.h:1728
constexpr bool empty() const
Check if the entire border is zero.
Definition: Types.h:286
HOGNormType
Normalization type for Histogram of Oriented Gradients (HOG)
Definition: Types.h:531
std::pair< uint32_t, uint32_t > PaddingInfo
Padding information as a pair of unsigned int start/end.
Definition: Types.h:442
Coordinate type.
Definition: Types.h:427
int end(unsigned int d) const
Return the end of the valid region for the given dimension d.
Definition: Types.h:226
unsigned int pooled_height() const
Get the pooled height of the layer.
Definition: Types.h:1296
int m() const
Number of matrix A rows.
Definition: Types.h:1754
Borders are left undefined.
ROI Pooling Layer Information class.
Definition: Types.h:1276
Pixels outside the image are assumed to have the same value as the closest image pixel.
PoolingType pool_type() const
Get the pooling type.
Definition: Types.h:1242
constexpr BorderSize()
Empty border, i.e.
Definition: Types.h:262
Class for specifying the size of an image or rectangle.
Definition: Size2D.h:34
Detection window used for the object detection.
Definition: Types.h:544
DataLayout weights_trained_layout
Layout that the weights have been trained with.
Definition: Types.h:795
unsigned int num_dimensions() const
Returns the effective dimensionality of the tensor.
Definition: Dimensions.h:122
std::vector< float > max_sizes() const
Get max sizes.
Definition: Types.h:925
ComputeAnchors information class.
Definition: Types.h:1400
uint16_t width
Width of the rectangle.
Definition: Types.h:422
Num samples, height, width, channels.
unsigned int detection_per_class() const
Get detection per class.
Definition: Types.h:1130
bool flip() const
Get the flip value.
Definition: Types.h:915
2 channel, 1 U8 per channel
uint16_t y
Top-left y coordinate.
Definition: Types.h:547
float spatial_scale() const
Get the spatial scale.
Definition: Types.h:1301
Threshold with two values.
uint16_t y
Top-left y coordinate.
Definition: Types.h:421
Detection Output layer info.
Definition: Types.h:1081
int depth_output_gemm3d() const
Depth (third dimension) of the output tensor to be used with the GEMM3D kernel.
Definition: Types.h:1797
constexpr bool uniform() const
Check if the border is the same size on all sides.
Definition: Types.h:292
bool interleave
True if the h0 (k0xn0) blocks have to be interleaved in the output row.
Definition: Types.h:1872
unsigned int num_classes() const
Get num classes.
Definition: Types.h:1145
Use box centers and size but flip x and y co-ordinates.
PrintRegion
Specifies the area to be printed, used by Tensor objects.
Definition: Types.h:2077
std::vector< float > variances() const
Get min variances.
Definition: Types.h:895
bool transpose_weights
Transpose weights if true.
Definition: Types.h:796
Size2D kernel_size
Width and height of the kernel.
Definition: Types.h:2059
TensorShape & set(size_t dimension, size_t value, bool apply_dim_correction=true)
Accessor to set the value of one of the dimensions.
Definition: TensorShape.h:78
std::array< float, 4 > weights() const
Definition: Types.h:1471
bool reshape_b_only_on_first_run() const
Flag which specifies if the reshape of matrix B should executed only for the first.
Definition: Types.h:1951
constexpr BorderSize(unsigned int top, unsigned int right, unsigned int bottom, unsigned int left)
Border with different sizes.
Definition: Types.h:280
unsigned int k0
Number of partial accumulations performed by the matrix multiplication.
Definition: Types.h:1859
uint16_t x
Top-left x coordinate.
Definition: Types.h:420
float alpha() const
Get the alpha value.
Definition: Types.h:1606
GEMM information class.
Definition: Types.h:1880
unsigned int m0
Number of rows processed by the matrix multiplication.
Definition: Types.h:1858
std::pair< unsigned int, unsigned int > pad() const
Get the padding.
Definition: Types.h:742
DetectionOutputLayerInfo(int num_classes, bool share_location, DetectionOutputLayerCodeType code_type, int keep_top_k, float nms_threshold, int top_k=-1, int background_label_id=-1, float confidence_threshold=std::numeric_limits< float >::lowest(), bool variance_encoded_in_target=false, float eta=1)
Constructor.
Definition: Types.h:994
void set_num_dimensions(size_t num_dimensions)
Set number of dimensions.
Definition: Dimensions.h:128
ActivationFunction activation() const
Get the type of activation function.
Definition: Types.h:1550
float b() const
Get the beta value.
Definition: Types.h:1560
Prints the valid region of the Tensor object.
64-bit floating-point number
Container for valid region of a window.
Definition: Types.h:174
Threshold with one value.
MagnitudeType
Magnitude calculation type.
Definition: Types.h:386
uint16_t height
Height of the rectangle.
Definition: Types.h:423
unsigned int pad_bottom() const
Get the bottom padding.
Definition: Types.h:765
A single plane of 32-bit macro pixel of Y0, U0, Y1, V0 bytes.
bool clip() const
Get the clip value.
Definition: Types.h:920
Default precision to the one that the current stream has.
GEMMInfo(bool is_a_reshaped, bool is_b_reshaped, bool reshape_b_only_on_first_run, int depth_output_gemm3d=0, bool reinterpret_input_as_3d=false, bool retain_internal_weights=false, GEMMLowpOutputStageInfo gemmlowp_output_stage=GEMMLowpOutputStageInfo(), bool fp_mixed_precision=false, bool broadcast_bias=false, const ActivationLayerInfo &activation_info=ActivationLayerInfo()) noexcept
Constructor.
Definition: Types.h:1913
unsigned 64-bit number
Size2D input_dimensions
Width and height of the input tensor before the convolution is applied.
Definition: Types.h:2060
DataType
Available data types.
Definition: Types.h:74
bool reinterpret_input_as_3d() const
Flag which specifies if the input tensor has to be reinterpreted as 3D.
Definition: Types.h:1805
The maximum precision of the floating point representation.
ActivationLayerInfo activation_info() const
Activation layer to apply after the matrix multiplication.
Definition: Types.h:2023
unsigned int pad_left() const
Get the left padding.
Definition: Types.h:750
ElementWiseUnary
Available element wise unary operations.
Definition: Types.h:511
Pooling Layer Information class.
Definition: Types.h:1191
DataLayout
[DataLayout enum definition]
Definition: Types.h:114
std::vector< uint32_t > Multiples
Information to produce a tiled version of a Tensor.
Definition: Types.h:448
NormType
The normalization type used for the normalization layer.
Definition: Types.h:523
signed 8-bit number
MatrixPattern
Available matrix patterns.
Definition: Types.h:468
Normalization applied cross maps.
Any other matrix pattern.
ConvertPolicy
Policy to handle overflow.
Definition: Types.h:349
NMSType soft_nms_method() const
Get soft NMS method.
Definition: Types.h:626
void limit(const BorderSize &limit)
Limit this border size.
Definition: Types.h:331
int background_label_id() const
Get background label ID.
Definition: Types.h:1046
float im_height() const
Get image height (NMS may suppress boxes whose center sits beyond the image height)
Definition: Types.h:656
NonLinearFilterFunction
Available non linear functions.
Definition: Types.h:477
Coordinates anchor
Anchor for the start of the valid region.
Definition: Types.h:246
bool transpose
True if the block MxC0 (where M is the area of the filter i.e.
Definition: Types.h:1832
ValidRegion()
Default constructor.
Definition: Types.h:177
float confidence_threshold() const
Get confidence threshold.
Definition: Types.h:1051
Normalization applied within the same map in 2D region.
bool retain_internal_weights() const
Definition: Types.h:1702
bool is_global_pooling() const
Check if is global pooling.
Definition: Types.h:1262
SamplingPolicy
Available Sampling Policies.
Definition: Types.h:96
float soft_nms_sigma() const
Get soft NMS sigma.
Definition: Types.h:631
std::pair< unsigned int, unsigned int > kernel_size() const
Return the width and height of the kernel.
Definition: Types.h:1698
int num_loc_classes() const
Get number of location classes.
Definition: Types.h:1061
int gemmlowp_min_bound
GEMMLowp min value used to saturate down the output result before converting back to QASYMM8.
Definition: Types.h:1851
bool soft_nms_enabled() const
Check if soft NMS is enabled.
Definition: Types.h:621
int detections_per_im() const
Get the number of detections.
Definition: Types.h:616
std::string element_delim
Element delimeter.
Definition: Types.h:2115
std::vector< float > min_sizes() const
Get min sizes.
Definition: Types.h:890
bool has_padding() const
Check whether this has any padding.
Definition: Types.h:777
ComputeAnchorsInfo(float feat_width, float feat_height, float spatial_scale, size_t values_per_roi=4)
Constructor.
Definition: Types.h:1410