#ifndef _CLASSIFIERCAFFE_H_ #define _CLASSIFIERCAFFE_H_ #include #include #include #include #include #include #include #include #include #include #include #include #include #include "boost/make_shared.hpp" //using namespace caffe; // NOLINT(build/namespaces) using std::string; using namespace std; double cosine(const vector& v1, const vector& v2); /* Pair (label, confidence) representing a prediction. */ // change: 2 classify ¡ª (label1, confidence1) (label2, confidence2) typedef std::pair Prediction; class _declspec(dllexport) Classifier { public: Classifier(const string& model_file, const string& trained_file, const string& mean_file, const int& label_files); std::vector Classifier::Classify(const cv::Mat& img); cv::Size input_geometry_; private: void SetMean(const string& mean_file); std::vector Predict(const cv::Mat& img); void WrapInputLayer(std::vector* input_channels); void Preprocess(const cv::Mat& img, std::vector* input_channels); private: std::shared_ptr > net_; int num_channels_; cv::Mat mean_; std::vector> labels_; //multi }; #endif // _CLASSIFIERCAFFE_H_