ImageRecognitionOrtSessionHandlerBase¶
Copyright (c) organization
- Author
btran
-
namespace
Ort -
class
ImageRecognitionOrtSessionHandlerBase: public Ort::OrtSessionHandler¶ - #include <ImageRecognitionOrtSessionHandlerBase.hpp>
An ImageRecognitionOrtSessionHandlerBase class object. This class inherits from the base class, OrtSessionHandler and serves as the base class for MaskRCNN, TinyYolov2, Yolov3 and UltraLightFastGenericFaceDetector.
Subclassed by Ort::ImageClassificationOrtSessionHandler, Ort::MaskRCNN, Ort::ObjectDetectionOrtSessionHandler, Ort::TinyYolov2, Ort::UltraLightFastGenericFaceDetector, Ort::Yolov3
Public Functions
-
ImageRecognitionOrtSessionHandlerBase(const uint16_t numClasses, const std::string &modelPath, const std::optional<size_t> &gpuIdx = std::nullopt, const std::optional<std::vector<std::vector<int64_t>>> &inputShapes = std::nullopt)¶ This calls OrtSessionHandler’s constructor. It also:
Initializes m_numClasses with numClasses.
Initializes empty m_classNames.
Populates m_classNames with numeric text strings corresponding to numClasses.
-
~ImageRecognitionOrtSessionHandlerBase()¶ Calls standard destructor. Is empty destructor.
-
void
initClassNames(const std::vector<std::string> &classNames)¶ A mutator function.
Runs check on if input array of class names is equal to previously assigned number of classes in m_numClasses.
If true, assigns m_classNames with classNames.
Otherwise, report an error.
-
void
preprocess(float *dst, const unsigned char *src, const int64_t targetImgWidth, const int64_t targetImgHeight, const int numChanels, const std::vector<float> &meanVal = {}, const std::vector<float> &stdVal = {}) const¶ A mutator function.
Given a certain format of an image like cv::Mat, populate dst to used during inferencing. The only difference it has as compared to the overriding counterparts is that it considers input arguments, meanVal and stdVal when populating dst.
-
uint16_t
numClasses() const¶ A getter function. Returns the number of classes defined before.
-
const std::vector<std::string> &
classNames() const¶ A getter function. Returns the string of class names.
-
-
class