-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathCLIP.h
29 lines (24 loc) · 871 Bytes
/
CLIP.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <vector>
#include <string>
#include <memory>
#include<iostream>
#include "opencv2/core.hpp"
#include "common.h"
#include <onnxruntime_cxx_api.h>
#include "SimpleTokenizer.h"
using namespace std;
using namespace cv;
class SAM_EXPORTS CLIP
{
public:
CLIP();
void ImgEncoder(cv::Mat img,std::vector<float>&embedding, std::vector<int64_t>& embeddingshape);
void TxtEncoder(std::wstring txt, vector<int64_t>txttokenShape, std::vector<float>& embedding, std::vector<int64_t>& embeddingshape);
protected:
void LoadONNXModel(std::wstring visualpath, std::wstring textualpath);
std::unique_ptr<Ort::Session> m_ImgEncoder;//Image Encoder
std::unique_ptr<Ort::Session> m_TxtEncoder;//Image Decoder
std::unique_ptr<Ort::Env>m_env;
std::unique_ptr<Ort::SessionOptions>m_sessionOption;
std::unique_ptr<SimpleTokenizer> mTokenlizer;
};