diff --git a/exe/FaceLandmarkImg/FaceLandmarkImg.cpp b/exe/FaceLandmarkImg/FaceLandmarkImg.cpp index 4b6121db..a2083819 100644 --- a/exe/FaceLandmarkImg/FaceLandmarkImg.cpp +++ b/exe/FaceLandmarkImg/FaceLandmarkImg.cpp @@ -297,7 +297,7 @@ int main(int argc, char **argv) cout << "Model loaded" << endl; cv::CascadeClassifier classifier(det_parameters.haar_face_detector_location); - dlib::frontal_face_detector face_detector_hog = dlib::get_frontal_face_detector(); + dlib::frontal_face_detector face_detector_hog; LandmarkDetector::FaceDetectorMTCNN face_detector_mtcnn(det_parameters.mtcnn_face_detector_location); // Load facial feature extractor and AU analyser (make sure it is static) diff --git a/lib/local/LandmarkDetector/src/LandmarkDetectorModel.cpp b/lib/local/LandmarkDetector/src/LandmarkDetectorModel.cpp index c72d3e6e..c0c16cbd 100644 --- a/lib/local/LandmarkDetector/src/LandmarkDetectorModel.cpp +++ b/lib/local/LandmarkDetector/src/LandmarkDetectorModel.cpp @@ -97,8 +97,6 @@ CLNF::CLNF(const CLNF& other): pdm(other.pdm), params_local(other.params_local.c this->kde_resp_precalc.insert(std::pair>(it->first, it->second.clone())); } - this->face_detector_HOG = dlib::get_frontal_face_detector(); - } // Assignment operator for lvalues (makes a deep copy of CLNF) @@ -155,8 +153,6 @@ CLNF & CLNF::operator= (const CLNF& other) face_detector_MTCNN = other.face_detector_MTCNN; } - face_detector_HOG = dlib::get_frontal_face_detector(); - return *this; } @@ -184,8 +180,6 @@ CLNF::CLNF(const CLNF&& other) triangulations = other.triangulations; kde_resp_precalc = other.kde_resp_precalc; - face_detector_HOG = dlib::get_frontal_face_detector(); - face_detector_MTCNN = other.face_detector_MTCNN; // Copy over the hierarchical models @@ -222,8 +216,6 @@ CLNF & CLNF::operator= (const CLNF&& other) triangulations = other.triangulations; kde_resp_precalc = other.kde_resp_precalc; - face_detector_HOG = dlib::get_frontal_face_detector(); - face_detector_MTCNN = other.face_detector_MTCNN; // Copy over the hierarchical models @@ -336,9 +328,6 @@ void CLNF::Read_CLNF(string clnf_location) // Initialise the patch experts patch_experts.Read(intensity_expert_locations, ccnf_expert_locations, cen_expert_locations, early_term_loc); - // Read in a face detector - face_detector_HOG = dlib::get_frontal_face_detector(); - } void CLNF::Read(string main_location) diff --git a/lib/local/LandmarkDetector/src/LandmarkDetectorUtils.cpp b/lib/local/LandmarkDetector/src/LandmarkDetectorUtils.cpp index e9637531..edae2638 100644 --- a/lib/local/LandmarkDetector/src/LandmarkDetectorUtils.cpp +++ b/lib/local/LandmarkDetector/src/LandmarkDetectorUtils.cpp @@ -1436,6 +1436,10 @@ namespace LandmarkDetector bool DetectFacesHOG(vector >& o_regions, const cv::Mat_& intensity, dlib::frontal_face_detector& detector, std::vector& o_confidences, double min_width, cv::Rect_ roi) { + if (detector.num_detectors() == 0) + { + detector = dlib::get_frontal_face_detector(); + } cv::Mat_ upsampled_intensity; @@ -1485,6 +1489,12 @@ namespace LandmarkDetector bool DetectSingleFaceHOG(cv::Rect_& o_region, const cv::Mat_& intensity_img, dlib::frontal_face_detector& detector, double& confidence, cv::Point preference, double min_width, cv::Rect_ roi) { + + if (detector.num_detectors() == 0) + { + detector = dlib::get_frontal_face_detector(); + } + // The tracker can return multiple faces vector > face_detections; vector confidences; diff --git a/lib/local/LandmarkDetector/src/Patch_experts.cpp b/lib/local/LandmarkDetector/src/Patch_experts.cpp index 0a7319bd..a0b59e1d 100644 --- a/lib/local/LandmarkDetector/src/Patch_experts.cpp +++ b/lib/local/LandmarkDetector/src/Patch_experts.cpp @@ -59,7 +59,8 @@ using namespace LandmarkDetector; Patch_experts::Patch_experts(const Patch_experts& other) : patch_scaling(other.patch_scaling), centers(other.centers), svr_expert_intensity(other.svr_expert_intensity), ccnf_expert_intensity(other.ccnf_expert_intensity), cen_expert_intensity(other.cen_expert_intensity), - early_term_weights(other.early_term_weights), early_term_biases(other.early_term_biases), early_term_cutoffs(other.early_term_cutoffs) + early_term_weights(other.early_term_weights), early_term_biases(other.early_term_biases), early_term_cutoffs(other.early_term_cutoffs), + mirror_inds(other.mirror_inds),mirror_views(other.mirror_views) { // Make sure the matrices are allocated properly