12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- #define _CRT_SECURE_NO_WARNINGS
- #ifndef __InferNetOnnxPaddleOcrAngCls_H__
- #define __InferNetOnnxPaddleOcrAngCls_H__
- #include <iostream>
- #include <fstream>
- #include <numeric>
- #include <opencv2/imgproc.hpp>
- #include <opencv2/highgui.hpp>
- #include <onnxruntime_cxx_api.h>
- #include "../TextBlock.h"
- #include <locale>
- #include <codecvt>
- using namespace cv;
- using namespace std;
- using namespace Ort;
- class InferNetOnnxPaddleOcrAngCls
- {
- public:
- InferNetOnnxPaddleOcrAngCls();
- void LoadNetwork(const void* modelData, size_t modelDataLength);
- int Process(cv::Mat imageCv);
- int PostProcess(float* pdataIn);
- void Dispose();
- private:
- Mat preprocess(Mat srcimg);
- void normalize_(Mat img);
- int inpWidth = 192;
- int inpHeight = 48;
- int numOut;
- std::vector<float> input_image_;
- Env env = Env(ORT_LOGGING_LEVEL_ERROR, "Angle classify");
- Ort::Session* ort_session = nullptr;
- SessionOptions sessionOptions = SessionOptions();
- std::vector<char*> inputNames;
- std::vector<char*> outputNames;
- std::vector<std::vector<int64_t>> inputNodeDims; // >=1 outputs
- std::vector<std::vector<int64_t>> outputNodeDims; // >=1 outputs
- volatile bool _modelLoaded = false;
- };
- #endif
|