1 #ifndef FACE_SEG_FACE_SEG_H 2 #define FACE_SEG_FACE_SEG_H 8 #include <opencv2/core.hpp> 11 #include <caffe/caffe.hpp> 27 FaceSeg(
const std::string& deploy_file,
const std::string& model_file,
28 bool with_gpu =
true,
int gpu_device_id = 0);
37 cv::Mat
process(
const cv::Mat& img);
47 void wrapInputLayer(std::vector<cv::Mat>& input_channels);
53 void preprocess(
const cv::Mat& img, std::vector<cv::Mat>& input_channels);
58 void subtractMean_c3(cv::Mat& img);
61 std::shared_ptr<caffe::Net<float>> m_net;
63 cv::Size m_input_size;
67 const float MB = 104.00699f, MG = 116.66877f, MR = 122.67892f;
72 #endif // FACE_SEG_FACE_SEG_H Definition: face_seg.h:13
This class provided deep face segmentation using Caffe with a fully connected convolutional neural ne...
Definition: face_seg.h:18
cv::Mat process(const cv::Mat &img)
Do face segmentation.
FaceSeg(const std::string &deploy_file, const std::string &model_file, bool with_gpu=true, int gpu_device_id=0)
Construct FaceSeg instance.