Nirkin Face Segmentation  0.9.0
Deep face segmentation based on fully connected convolutional neural network.
face_seg::FaceSeg Class Reference

This class provided deep face segmentation using Caffe with a fully connected convolutional neural network. More...

#include <face_seg.h>

Public Member Functions

 FaceSeg (const std::string &deploy_file, const std::string &model_file, bool with_gpu=true, int gpu_device_id=0)
 Construct FaceSeg instance. More...
 
cv::Mat process (const cv::Mat &img)
 Do face segmentation. More...
 

Protected Attributes

std::shared_ptr< caffe::Net< float > > m_net
 
int m_num_channels
 
cv::Size m_input_size
 
bool m_with_gpu
 
const float MB = 104.00699f
 
const float MG = 116.66877f
 
const float MR = 122.67892f
 

Detailed Description

This class provided deep face segmentation using Caffe with a fully connected convolutional neural network.

Constructor & Destructor Documentation

face_seg::FaceSeg::FaceSeg ( const std::string &  deploy_file,
const std::string &  model_file,
bool  with_gpu = true,
int  gpu_device_id = 0 
)

Construct FaceSeg instance.

Parameters
deploy_fileNetwork definition file for deployment (.prototxt).
model_fileNetwork weights model file (.caffemodel).
with_gpuToggle GPU.
gpu_device_idSet the GPU's device id.

Member Function Documentation

cv::Mat face_seg::FaceSeg::process ( const cv::Mat &  img)

Do face segmentation.

Parameters
imgBGR color image.
Returns
8-bit segmentation mask, 255 for face pixels and 0 for background pixels.

The documentation for this class was generated from the following file: