Incorporating MTCNN face detection with CE-CLM.

Merge remote-tracking branch 'origin/feature/mtcnn_face_det' into feature/CE-CLM

# Conflicts:
#	exe/FaceLandmarkImg/FaceLandmarkImg.cpp
#	exe/FaceLandmarkVid/FaceLandmarkVid.cpp
#	exe/FaceLandmarkVidMulti/FaceLandmarkVidMulti.cpp
#	exe/FeatureExtraction/FeatureExtraction.cpp
#	lib/local/LandmarkDetector/LandmarkDetector.vcxproj
#	lib/local/LandmarkDetector/LandmarkDetector.vcxproj.filters
#	lib/local/LandmarkDetector/src/LandmarkDetectorFunc.cpp
#	lib/local/LandmarkDetector/src/LandmarkDetectorParameters.cpp
#	lib/local/LandmarkDetector/src/LandmarkDetectorUtils.cpp
This commit is contained in:
Tadas Baltrusaitis
2017-08-26 13:23:16 +01:00
52 changed files with 3135 additions and 202 deletions

View File

@@ -86,7 +86,7 @@ FaceModelParameters::FaceModelParameters(vector<string> &arguments)
if (arguments[i].compare("-fdloc") ==0)
{
string face_detector_loc = arguments[i + 1];
face_detector_location = face_detector_loc;
haar_face_detector_location = face_detector_loc;
curr_face_detector = HAAR_DETECTOR;
valid[i] = false;
valid[i + 1] = false;
@@ -176,8 +176,10 @@ FaceModelParameters::FaceModelParameters(vector<string> &arguments)
valid[i] = false;
// For in-the-wild images use an in-the wild detector
curr_face_detector = HOG_SVM_DETECTOR;
curr_face_detector = MTCNN_DETECTOR;
// Use multi-view hypotheses if in-the-wild setting
multi_view = true;
}
}
@@ -216,6 +218,46 @@ FaceModelParameters::FaceModelParameters(vector<string> &arguments)
sigma = 1.5 * sigma;
reg_factor = 0.9 * reg_factor;
}
// Make sure face detector location is valid
// First check working directory, then the executable's directory, then the config path set by the build process.
model_path = boost::filesystem::path(haar_face_detector_location);
if (boost::filesystem::exists(model_path))
{
haar_face_detector_location = model_path.string();
}
else if (boost::filesystem::exists(root / model_path))
{
haar_face_detector_location = (root / model_path).string();
}
else if (boost::filesystem::exists(config_path / model_path))
{
haar_face_detector_location = (config_path / model_path).string();
}
else
{
std::cout << "Could not find the HAAR face detector location" << std::endl;
}
// Make sure face detector location is valid
// First check working directory, then the executable's directory, then the config path set by the build process.
model_path = boost::filesystem::path(mtcnn_face_detector_location);
if (boost::filesystem::exists(model_path))
{
mtcnn_face_detector_location = model_path.string();
}
else if (boost::filesystem::exists(root / model_path))
{
mtcnn_face_detector_location = (root / model_path).string();
}
else if (boost::filesystem::exists(config_path / model_path))
{
mtcnn_face_detector_location = (config_path / model_path).string();
}
else
{
std::cout << "Could not find the MTCNN face detector location" << std::endl;
}
}
void FaceModelParameters::init()
@@ -269,11 +311,12 @@ void FaceModelParameters::init()
reinit_video_every = 4;
// Face detection
face_detector_location = "classifiers/haarcascade_frontalface_alt.xml";
haar_face_detector_location = "classifiers/haarcascade_frontalface_alt.xml";
mtcnn_face_detector_location = "model/mtcnn_detector/MTCNN_detector.txt";
quiet_mode = false;
// By default use HOG SVM
curr_face_detector = HOG_SVM_DETECTOR;
// By default use MTCNN
curr_face_detector = MTCNN_DETECTOR;
// The gaze tracking has to be explicitly initialised
track_gaze = false;