JeVois
1.17
JeVois Smart Embedded Machine Vision Toolkit
|
Share this page: |
|
|
|
 |
 |
|
Go to the documentation of this file.
22 #include <opencv2/core/core.hpp>
23 #include <tensorflow/lite/c/common.h>
24 #include <ovxlib/vsi_nn_pub.h>
42 std::map<int, std::string>
readLabelsFile(std::string
const & fname);
46 std::string
getLabel(std::map<int, std::string>
const & labels,
int id);
49 int stringToRGBA(std::string
const & label,
unsigned char alpha = 128);
52 void topK(
float const * pfProb,
float * pfMaxProb, uint32_t * pMaxClass, uint32_t outputCount, uint32_t topNum);
55 std::string
shapestr(cv::Mat
const & m);
58 std::string
shapestr(TfLiteTensor
const * t);
61 std::string
shapestr(vsi_nn_tensor_attr_t
const & attr);
64 std::vector<size_t>
strshape(std::string
const & str);
67 int tf2cv(TfLiteType t);
70 vsi_nn_type_e
tf2vsi(TfLiteType t);
73 int vsi2cv(vsi_nn_type_e t);
76 void clamp(cv::Rect & r,
int width,
int height);
80 std::vector<vsi_nn_tensor_attr_t>
parseTensorSpecs(std::string
const & specs);
83 cv::Size
attrsize(vsi_nn_tensor_attr_t
const & attr);
86 std::string
attrstr(vsi_nn_tensor_attr_t
const & attr);
89 vsi_nn_tensor_attr_t
tensorattr(TfLiteTensor
const * t);
92 void softmax(
float const * input,
size_t n,
float fac,
float * output);
void clamp(cv::Rect &r, int width, int height)
Clamp a rectangle to within given image width and height.
int tf2cv(TfLiteType t)
Convert from TensorFlow data type to OpenCV.
int vsi2cv(vsi_nn_type_e t)
Convert from NPU data type to OpenCV.
vsi_nn_tensor_attr_t tensorattr(TfLiteTensor const *t)
Get tensor shape and type attributes for a TensorFlow Lite tensor.
int stringToRGBA(std::string const &label, unsigned char alpha=128)
Compute a color from a label name.
std::map< int, std::string > readLabelsFile(std::string const &fname)
Read a label file.
std::vector< vsi_nn_tensor_attr_t > parseTensorSpecs(std::string const &specs)
Parse tensor specification.
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 getLabel(std::map< int, std::string > const &labels, int id)
Get a label from an id.
std::vector< size_t > strshape(std::string const &str)
Get a vector of size_t from a string containing AxBxC...
cv::Size attrsize(vsi_nn_tensor_attr_t const &attr)
Get a tensor's size in cv::Size format.
void softmax(float const *input, size_t n, float fac, float *output)
Apply softmax to a float vector.
std::string attrstr(vsi_nn_tensor_attr_t const &attr)
Get a string describing the specs of a tensor.
vsi_nn_type_e tf2vsi(TfLiteType t)
Convert from TensorFlow data type to vsi_nn.
void topK(float const *pfProb, float *pfMaxProb, uint32_t *pMaxClass, uint32_t outputCount, uint32_t topNum)
Get top-k entries and their indices.