|
std::map< int, std::string > | readLabelsFile (std::string const &fname) |
| Read a label file.
|
|
std::string | getLabel (std::map< int, std::string > const &labels, int id, bool namedonly=false) |
| Get a label from an id.
|
|
int | stringToRGBA (std::string const &label, unsigned char alpha=128) |
| Compute a color from a label name.
|
|
void | topK (float const *pfProb, float *pfMaxProb, uint32_t *pMaxClass, uint32_t outputCount, uint32_t topNum) |
| Get top-k entries and their indices.
|
|
std::string | shapestr (cv::Mat const &m) |
| Get a string of the form: "nD AxBxC... TYPE" from an n-dimensional cv::Mat with data type TYPE.
|
|
std::string | shapestr (std::vector< size_t > dims, int typ) |
| Get a string of the form: "nD AxBxC... TYPE" from an n-dimensional size vector and OpenCV data type TYPE.
|
|
std::string | shapestr (std::vector< int > dims, int typ) |
| Get a string of the form: "nD AxBxC... TYPE" from an n-dimensional size vector and OpenCV data type TYPE.
|
|
std::string | shapestr (TfLiteTensor const *t) |
| Get a string of the form: "nD AxBxC... TYPE" from an n-dimensional TfLiteTensor with data type TYPE.
|
|
std::string | shapestr (vsi_nn_tensor_attr_t const &attr) |
| Get a string of the form: "nD AxBxC... TYPE" from an n-dimensional NPU tensor with data type TYPE.
|
|
std::vector< size_t > | strshape (std::string const &str) |
| Get a vector of size_t from a string containing AxBxC...
|
|
int | tf2cv (TfLiteType t) |
| Convert from TensorFlow data type to OpenCV.
|
|
vsi_nn_type_e | tf2vsi (TfLiteType t) |
| Convert from TensorFlow data type to vsi_nn.
|
|
int | vsi2cv (vsi_nn_type_e t) |
| Convert from NPU data type to OpenCV.
|
|
void | clamp (cv::Rect &r, int width, int height) |
| Clamp a rectangle to within given image width and height.
|
|
void | clamp (cv::Rect2f &r, float width, float height) |
| Clamp a rectangle to within given image width and height.
|
|
std::vector< vsi_nn_tensor_attr_t > | parseTensorSpecs (std::string const &specs) |
| Parse tensor specification.
|
|
cv::Mat | attrmat (vsi_nn_tensor_attr_t const &attr, void *dataptr=nullptr) |
| Construct a cv::Mat from attr and possibly data pointer.
|
|
std::vector< int > | attrdims (vsi_nn_tensor_attr_t const &attr) |
| Get a tensor dims as a vector of int, useful to construct a matching cv::Mat.
|
|
cv::Size | attrsize (vsi_nn_tensor_attr_t const &attr) |
| Get a tensor's (width, height) size in cv::Size format, skipping over other dimensions.
|
|
std::string | attrstr (vsi_nn_tensor_attr_t const &attr) |
| Get a string describing the specs of a tensor, including quantification specs (not provided by shapestr())
|
|
bool | attrmatch (vsi_nn_tensor_attr_t const &attr, cv::Mat const &blob) |
| Check that a cv::Mat blob matches exactly the spec of an attr.
|
|
vsi_nn_tensor_attr_t | tensorattr (TfLiteTensor const *t) |
| Get tensor shape and type attributes for a TensorFlow Lite tensor.
|
|
float | fastexp (float x) |
| Compute fast exponential using approximation formula.
|
|
float | sigmoid (float x) |
| Compute sigmoid using fastexp.
|
|
void | sigmoid (cv::Mat &m) |
| Compute sigmoid using fastexp on every pixel of a Mat of type CV_32F, in-place.
|
|
size_t | softmax (float const *input, size_t const n, size_t const stride, float const fac, float *output, bool maxonly) |
| Apply softmax to a float vector.
|
|
float | softmax_dfl (float const *src, float *dst, size_t const n, size_t const stride=1) |
| Compute softmax and return DFL distance.
|
|
cv::Mat | quantize (cv::Mat const &m, vsi_nn_tensor_attr_t const &attr) |
| Quantize from float32 to fixed-point according to the quantization spec in attr.
|
|
cv::Mat | dequantize (cv::Mat const &m, vsi_nn_tensor_attr_t const &attr) |
| Dequantize an output to float32 according to the quantization spec in attr.
|
|
size_t | effectiveDims (cv::Mat const &m) |
| Returns the number of non-unit dims in a cv::Mat.
|
|
cv::Mat | concatenate (std::vector< cv::Mat > const &tensors, int axis) |
| Concatenate several tensors into one.
|
|
std::vector< cv::Mat > | split (cv::Mat const &tensor, int axis, std::vector< int > const &sizes) |
| Split a tensor into several, along a given axis.
|
|
std::string | shapestr (hailo_vstream_info_t const &vi) |
| Get a string of the form: "nD AxBxC... TYPE" from an n-dimensional Hailo tensor with data type TYPE.
|
|
vsi_nn_tensor_attr_t | tensorattr (hailo_vstream_info_t const &vi) |
| Get tensor shape and type attributes for a Hailo tensor.
|
|
vsi_nn_type_e | hailo2vsi (hailo_format_type_t t) |
| Convert from Hailo data type to vsi_nn.
|
|
vsi_nn_type_e | onnx2vsi (ONNXTensorElementDataType t) |
| Convert from ONNX-Runtime data type to vsi_nn.
|
|
std::string | shapestr (Ort::ConstTensorTypeAndShapeInfo const &ti) |
| Get a string of the form: "nD AxBxC... TYPE" from an n-dimensional ONNX tensor with data type TYPE.
|
|
vsi_nn_tensor_attr_t | tensorattr (Ort::ConstTensorTypeAndShapeInfo const &ti) |
| Get tensor shape and type attributes for an ONNX-runtime tensor.
|
|