1 #ifndef GIEFEATEXTRACTOR_H_
2 #define GIEFEATEXTRACTOR_H_
8 #include <opencv2/opencv.hpp>
12 #include <cuda_runtime.h>
16 #include "NvCaffeParser.h"
17 #include "cudaUtility.h"
22 class Logger :
public nvinfer1::ILogger
24 void log( Severity severity,
const char* msg )
override
26 if( severity != Severity::kINFO )
27 std::cout << msg << std::endl;
31 class GIEFeatExtractor {
35 bool cudaFreeMapped(
void *cpuPtr);
37 bool cudaAllocMapped(
void** cpuPtr,
void** gpuPtr,
size_t size );
39 bool caffeToGIEModel(
const std::string& deployFile,
40 const std::string& modelFile,
41 const std::string& binaryprotoFile,
42 const std::vector<std::string>& outputs,
43 unsigned int maxBatchSize,
44 std::ostream& gieModelStream);
46 bool init(
string _caffemodel_file,
47 string _binaryproto_meanfile,
float meanR,
float meanG,
float meanB,
48 string _prototxt_file,
int _resizeWidth,
int _resizeHeight,
51 nvinfer1::IRuntime* mInfer;
52 nvinfer1::ICudaEngine* mEngine;
53 nvinfer1::IExecutionContext* mContext;
57 vector<float> mean_values;
59 nvinfer1::Dims4 resizeDims;
77 string caffemodel_file;
79 string binaryproto_meanfile;
83 GIEFeatExtractor(
string _caffemodel_file,
84 string _binaryproto_meanfile,
float _meanR,
float _meanG,
float _meanB,
85 string _prototxt_file,
int _resizeWidth,
int _resizeHeight,
91 bool extract_singleFeat_1D(cv::Mat &image, vector<float> &features,
float (×)[2]);