Initial setup for CLion
This commit is contained in:
46
ANSOCR/ANSPaddleOCR/include/ocr_rec.h
Normal file
46
ANSOCR/ANSPaddleOCR/include/ocr_rec.h
Normal file
@@ -0,0 +1,46 @@
|
||||
#include "opencv2/core.hpp"
|
||||
#include "opencv2/imgcodecs.hpp"
|
||||
#include "opencv2/imgproc.hpp"
|
||||
#include <chrono>
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <ostream>
|
||||
#include <vector>
|
||||
|
||||
#include <cstring>
|
||||
#include <fstream>
|
||||
#include <numeric>
|
||||
|
||||
#include <include/paddleocr_utility.h>
|
||||
#include <include/preprocess_op.h>
|
||||
#include <include/postprocess_op.h>
|
||||
#include <openvino/openvino.hpp>
|
||||
|
||||
namespace PaddleOCR {
|
||||
|
||||
class Recognizer
|
||||
{
|
||||
public:
|
||||
explicit Recognizer(std::string model_path, const std::string& label_path);
|
||||
void Run(const std::vector<cv::Mat>& img_list, std::vector<OCRPredictResult>& ocr_results);
|
||||
void SetParameters(int rec_batch_num);
|
||||
void GetParameters(int& rec_batch_num);
|
||||
private:
|
||||
ov::InferRequest infer_request;
|
||||
std::string model_path;
|
||||
std::shared_ptr<ov::Model> model;
|
||||
ov::CompiledModel compiled_model;
|
||||
std::recursive_mutex _mutex;
|
||||
std::vector<float> mean_ = { 0.5f, 0.5f, 0.5f };
|
||||
std::vector<float> scale_ = { 1 / 0.5f, 1 / 0.5f, 1 / 0.5f };
|
||||
bool is_scale_ = true;
|
||||
std::vector<std::string> label_list_;
|
||||
int rec_img_h_ = 48;
|
||||
int rec_img_w_ = 320;
|
||||
std::vector<int> rec_image_shape_ = { 3, rec_img_h_, rec_img_w_ };
|
||||
int rec_batch_num_ = 1;
|
||||
CrnnResizeImg resize_op_;
|
||||
Normalize normalize_op_;
|
||||
PermuteBatch permute_op_;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user