mirror of
https://gitcode.com/gh_mirrors/ope/OpenFace.git
synced 2025-12-30 04:52:29 +00:00
Report in GUI if model not found. Bug fix with re-loading models in GUI if landmark detector changes.
This commit is contained in:
@@ -208,6 +208,14 @@ namespace OpenFaceOffline
|
||||
// Reload the face landmark detector if needed
|
||||
ReloadLandmarkDetector();
|
||||
|
||||
if(!landmark_detector.isLoaded())
|
||||
{
|
||||
DetectorNotFoundWarning();
|
||||
EndMode();
|
||||
thread_running = false;
|
||||
return;
|
||||
}
|
||||
|
||||
// Set the face detector
|
||||
face_model_params.SetFaceDetector(DetectorHaar, DetectorHOG, DetectorCNN);
|
||||
face_model_params.optimiseForVideo();
|
||||
@@ -302,10 +310,18 @@ namespace OpenFaceOffline
|
||||
|
||||
// Reload the face landmark detector if needed
|
||||
ReloadLandmarkDetector();
|
||||
|
||||
if (!landmark_detector.isLoaded())
|
||||
{
|
||||
DetectorNotFoundWarning();
|
||||
EndMode();
|
||||
thread_running = false;
|
||||
return;
|
||||
}
|
||||
|
||||
// Setup the parameters optimized for working on individual images rather than sequences
|
||||
face_model_params.optimiseForImages();
|
||||
|
||||
|
||||
// Setup the visualization
|
||||
Visualizer visualizer_of = new Visualizer(ShowTrackedVideo || RecordTracked, ShowAppearance, ShowAppearance, false);
|
||||
|
||||
@@ -425,7 +441,17 @@ namespace OpenFaceOffline
|
||||
}
|
||||
}
|
||||
|
||||
private void DetectorNotFoundWarning()
|
||||
{
|
||||
string messageBoxText = "Could not open the landmark detector model file. For instructions of how to download them, see https://github.com/TadasBaltrusaitis/OpenFace/wiki/Model-download";
|
||||
string caption = "Model file not found or corrupt";
|
||||
MessageBoxButton button = MessageBoxButton.OK;
|
||||
MessageBoxImage icon = MessageBoxImage.Warning;
|
||||
|
||||
// Display message box
|
||||
System.Windows.MessageBox.Show(messageBoxText, caption, button, icon);
|
||||
|
||||
}
|
||||
|
||||
private void RecordObservation(RecorderOpenFace recorder, RawImage vis_image, int face_id, bool success, float fx, float fy, float cx, float cy, double timestamp, int frame_number)
|
||||
{
|
||||
|
||||
@@ -152,17 +152,17 @@ namespace CppInterop {
|
||||
|
||||
bool IsCECLM()
|
||||
{
|
||||
return params->curr_face_detector == ::LandmarkDetector::FaceModelParameters::CECLM_DETECTOR;
|
||||
return params->curr_landmark_detector == ::LandmarkDetector::FaceModelParameters::CECLM_DETECTOR;
|
||||
}
|
||||
|
||||
bool IsCLNF()
|
||||
{
|
||||
return params->curr_face_detector == ::LandmarkDetector::FaceModelParameters::CLNF_DETECTOR;
|
||||
return params->curr_landmark_detector == ::LandmarkDetector::FaceModelParameters::CLNF_DETECTOR;
|
||||
}
|
||||
|
||||
bool IsCLM()
|
||||
{
|
||||
return params->curr_face_detector == ::LandmarkDetector::FaceModelParameters::CLM_DETECTOR;
|
||||
return params->curr_landmark_detector == ::LandmarkDetector::FaceModelParameters::CLM_DETECTOR;
|
||||
}
|
||||
|
||||
System::String^ GetMTCNNLocation()
|
||||
@@ -259,6 +259,11 @@ namespace CppInterop {
|
||||
this->!CLNF();
|
||||
}
|
||||
|
||||
bool isLoaded()
|
||||
{
|
||||
return clnf->loaded_successfully;
|
||||
}
|
||||
|
||||
|
||||
::LandmarkDetector::CLNF* getCLNF() {
|
||||
return clnf;
|
||||
|
||||
Reference in New Issue
Block a user