Script fixes, and confidence correction where it should be (not in the executable scripts), starting work on capture in utilities
This commit is contained in:
parent
815cb58b30
commit
9c1fc21da1
17 changed files with 129 additions and 34 deletions
|
@ -25,7 +25,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FaceLandmarkImg", "exe\Face
|
|||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GazeAnalyser", "lib\local\GazeAnalyser\GazeAnalyser.vcxproj", "{5F915541-F531-434F-9C81-79F5DB58012B}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Recorder", "lib\local\Recorder\Recorder.vcxproj", "{8E741EA2-9386-4CF2-815E-6F9B08991EAC}"
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Utilities", "lib\local\Utilities\Utilities.vcxproj", "{8E741EA2-9386-4CF2-815E-6F9B08991EAC}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
|
|
|
@ -111,7 +111,7 @@
|
|||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\lib\local\FaceAnalyser\include;$(SolutionDir)\lib\local\LandmarkDetector\include;$(SolutionDir)\lib\local\GazeAnalyser\include;$(SolutionDir)\lib\local\Recorder\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\lib\local\FaceAnalyser\include;$(SolutionDir)\lib\local\LandmarkDetector\include;$(SolutionDir)\lib\local\GazeAnalyser\include;$(SolutionDir)\lib\local\Utilities\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<OpenMPSupport>false</OpenMPSupport>
|
||||
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
|
@ -127,7 +127,7 @@
|
|||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN64;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\lib\local\FaceAnalyser\include;$(SolutionDir)\lib\local\LandmarkDetector\include;$(SolutionDir)\lib\local\GazeAnalyser\include;$(SolutionDir)\lib\local\Recorder\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\lib\local\FaceAnalyser\include;$(SolutionDir)\lib\local\LandmarkDetector\include;$(SolutionDir)\lib\local\GazeAnalyser\include;$(SolutionDir)\lib\local\Utilities\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<OpenMPSupport>false</OpenMPSupport>
|
||||
<EnableEnhancedInstructionSet>AdvancedVectorExtensions</EnableEnhancedInstructionSet>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
|
@ -145,7 +145,7 @@
|
|||
<FunctionLevelLinking>false</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\lib\local\FaceAnalyser\include;$(SolutionDir)\lib\local\LandmarkDetector\include;$(SolutionDir)\lib\local\GazeAnalyser\include;$(SolutionDir)\lib\local\Recorder\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\lib\local\FaceAnalyser\include;$(SolutionDir)\lib\local\LandmarkDetector\include;$(SolutionDir)\lib\local\GazeAnalyser\include;$(SolutionDir)\lib\local\Utilities\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<OpenMPSupport>false</OpenMPSupport>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
|
||||
|
@ -167,7 +167,7 @@
|
|||
<FunctionLevelLinking>false</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\lib\local\FaceAnalyser\include;$(SolutionDir)\lib\local\LandmarkDetector\include;$(SolutionDir)\lib\local\GazeAnalyser\include;$(SolutionDir)\lib\local\Recorder\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\lib\local\FaceAnalyser\include;$(SolutionDir)\lib\local\LandmarkDetector\include;$(SolutionDir)\lib\local\GazeAnalyser\include;$(SolutionDir)\lib\local\Utilities\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<OpenMPSupport>false</OpenMPSupport>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<EnableEnhancedInstructionSet>AdvancedVectorExtensions</EnableEnhancedInstructionSet>
|
||||
|
@ -194,7 +194,7 @@
|
|||
<ProjectReference Include="..\..\lib\local\LandmarkDetector\LandmarkDetector.vcxproj">
|
||||
<Project>{bdc1d107-de17-4705-8e7b-cdde8bfb2bf8}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\lib\local\Recorder\Recorder.vcxproj">
|
||||
<ProjectReference Include="..\..\lib\local\Utilities\Utilities.vcxproj">
|
||||
<Project>{8e741ea2-9386-4cf2-815e-6f9b08991eac}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
|
|
|
@ -488,6 +488,10 @@ double DetectionValidator::Check(const cv::Vec3d& orientation, const cv::Mat_<uc
|
|||
//dec = CheckCNN(warped, id);
|
||||
dec = CheckCNN_tbb(warped, id);
|
||||
}
|
||||
|
||||
// Convert it to a more interpretable signal (0 low confidence, 1 high confidence)
|
||||
dec = 0.5 * (1 - dec);
|
||||
|
||||
return dec;
|
||||
}
|
||||
|
||||
|
|
|
@ -650,7 +650,7 @@ bool CLNF::DetectLandmarks(const cv::Mat_<uchar> &image, FaceModelParameters& pa
|
|||
|
||||
detection_certainty = landmark_validator.Check(orientation, image, detected_landmarks);
|
||||
|
||||
detection_success = detection_certainty < params.validation_boundary;
|
||||
detection_success = detection_certainty > params.validation_boundary;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -253,7 +253,7 @@ void FaceModelParameters::init()
|
|||
reg_factor = 25;
|
||||
weight_factor = 0; // By default do not use NU-RLMS for videos as it does not work as well for them
|
||||
|
||||
validation_boundary = -0.45;
|
||||
validation_boundary = 0.725;
|
||||
|
||||
limit_pose = true;
|
||||
multi_view = false;
|
||||
|
|
|
@ -21,8 +21,9 @@
|
|||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{8E741EA2-9386-4CF2-815E-6F9B08991EAC}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>Recorder</RootNamespace>
|
||||
<RootNamespace>Utilities</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
||||
<ProjectName>Utilities</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
|
@ -42,7 +42,7 @@
|
|||
// OpenCV includes
|
||||
#include <opencv2/core/core.hpp>
|
||||
|
||||
namespace Recorder
|
||||
namespace Utilities
|
||||
{
|
||||
|
||||
//===========================================================================
|
|
@ -43,7 +43,7 @@
|
|||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
namespace Recorder
|
||||
namespace Utilities
|
||||
{
|
||||
|
||||
//===========================================================================
|
|
@ -45,7 +45,7 @@
|
|||
#include <opencv2/core/core.hpp>
|
||||
#include <opencv2/highgui/highgui.hpp>
|
||||
|
||||
namespace Recorder
|
||||
namespace Utilities
|
||||
{
|
||||
|
||||
//===========================================================================
|
|
@ -44,7 +44,7 @@
|
|||
|
||||
using namespace std;
|
||||
|
||||
namespace Recorder
|
||||
namespace Utilities
|
||||
{
|
||||
|
||||
class RecorderOpenFaceParameters
|
100
lib/local/Utilities/include/SequenceCapture.h
Normal file
100
lib/local/Utilities/include/SequenceCapture.h
Normal file
|
@ -0,0 +1,100 @@
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2017, Tadas Baltrusaitis all rights reserved.
|
||||
//
|
||||
// ACADEMIC OR NON-PROFIT ORGANIZATION NONCOMMERCIAL RESEARCH USE ONLY
|
||||
//
|
||||
// BY USING OR DOWNLOADING THE SOFTWARE, YOU ARE AGREEING TO THE TERMS OF THIS LICENSE AGREEMENT.
|
||||
// IF YOU DO NOT AGREE WITH THESE TERMS, YOU MAY NOT USE OR DOWNLOAD THE SOFTWARE.
|
||||
//
|
||||
// License can be found in OpenFace-license.txt
|
||||
//
|
||||
// * Any publications arising from the use of this software, including but
|
||||
// not limited to academic journal and conference publications, technical
|
||||
// reports and manuals, must cite at least one of the following works:
|
||||
//
|
||||
// OpenFace: an open source facial behavior analysis toolkit
|
||||
// Tadas Baltrušaitis, Peter Robinson, and Louis-Philippe Morency
|
||||
// in IEEE Winter Conference on Applications of Computer Vision, 2016
|
||||
//
|
||||
// Rendering of Eyes for Eye-Shape Registration and Gaze Estimation
|
||||
// Erroll Wood, Tadas Baltrušaitis, Xucong Zhang, Yusuke Sugano, Peter Robinson, and Andreas Bulling
|
||||
// in IEEE International. Conference on Computer Vision (ICCV), 2015
|
||||
//
|
||||
// Cross-dataset learning and person-speci?c normalisation for automatic Action Unit detection
|
||||
// Tadas Baltrušaitis, Marwa Mahmoud, and Peter Robinson
|
||||
// in Facial Expression Recognition and Analysis Challenge,
|
||||
// IEEE International Conference on Automatic Face and Gesture Recognition, 2015
|
||||
//
|
||||
// Constrained Local Neural Fields for robust facial landmark detection in the wild.
|
||||
// Tadas Baltrušaitis, Peter Robinson, and Louis-Philippe Morency.
|
||||
// in IEEE Int. Conference on Computer Vision Workshops, 300 Faces in-the-Wild Challenge, 2013.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __SEQUENCE_CAPTURE_h_
|
||||
#define __SEQUENCE_CAPTURE_h_
|
||||
|
||||
// System includes
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
|
||||
// OpenCV includes
|
||||
#include <opencv2/core/core.hpp>
|
||||
#include <opencv2/highgui/highgui.hpp>
|
||||
|
||||
namespace Utilities
|
||||
{
|
||||
|
||||
//===========================================================================
|
||||
/**
|
||||
A class for capturing sequences from video, webcam, and image directories
|
||||
*/
|
||||
class SequenceCapture {
|
||||
|
||||
public:
|
||||
|
||||
// Default constructor
|
||||
SequenceCapture();
|
||||
|
||||
// Opening based on command line arguments
|
||||
void Open(std::vector<std::string> arguments);
|
||||
|
||||
// Direct opening
|
||||
|
||||
// Webcam
|
||||
void OpenWebcam(int device_id);
|
||||
|
||||
// Image sequence in the directory
|
||||
void OpenImageSequence(std::string directory);
|
||||
|
||||
// Video file
|
||||
void OpenVideoFile(std::string video_file);
|
||||
|
||||
private:
|
||||
|
||||
// Used for capturing webcam and video
|
||||
cv::VideoCapture capture;
|
||||
|
||||
// Storing the latest captures
|
||||
cv::Mat latest_frame;
|
||||
cv::Mat latest_gray_frame;
|
||||
|
||||
double fps;
|
||||
|
||||
// Keeping track if we are opening a video, webcam or image sequence
|
||||
bool is_webcam;
|
||||
bool is_image_seq;
|
||||
|
||||
// Keeping track of frame number and the files in the image sequence
|
||||
int frame_num;
|
||||
std::vector<std::string> image_files;
|
||||
|
||||
// Length of video allowing to assess progress
|
||||
int vid_length;
|
||||
|
||||
// TODO fx and fy should be here
|
||||
|
||||
};
|
||||
}
|
||||
#endif
|
|
@ -39,7 +39,7 @@
|
|||
// For standard out
|
||||
#include <iostream>
|
||||
|
||||
using namespace Recorder;
|
||||
using namespace Utilities;
|
||||
|
||||
// Default constructor initializes the variables
|
||||
RecorderCSV::RecorderCSV():output_file(){};
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
#include <fstream>
|
||||
|
||||
using namespace Recorder;
|
||||
using namespace Utilities;
|
||||
|
||||
// Default constructor initializes the variables
|
||||
RecorderHOG::RecorderHOG() :hog_file() {};
|
|
@ -48,7 +48,7 @@
|
|||
|
||||
using namespace boost::filesystem;
|
||||
|
||||
using namespace Recorder;
|
||||
using namespace Utilities;
|
||||
|
||||
#define WARN_STREAM( stream ) \
|
||||
std::cout << "Warning: " << stream << std::endl
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
using namespace std;
|
||||
|
||||
using namespace Recorder;
|
||||
using namespace Utilities;
|
||||
|
||||
RecorderOpenFaceParameters::RecorderOpenFaceParameters(std::vector<std::string> &arguments, bool sequence, double fps_vid_out)
|
||||
{
|
|
@ -27,18 +27,14 @@ database_root = [database_root, '/ytceleb/'];
|
|||
in_vids = dir([database_root '/*.avi']);
|
||||
|
||||
command = executable;
|
||||
command = cat(2, command, ' -no3Dfp -noMparams -noPose -noGaze -noAUs ');
|
||||
command = cat(2, command, ' -2Dfp ');
|
||||
% add all videos to single argument list (so as not to load the model anew
|
||||
% for every video)
|
||||
for i=1:numel(in_vids)
|
||||
|
||||
[~, name, ~] = fileparts(in_vids(i).name);
|
||||
|
||||
% where to output tracking results
|
||||
outputFile_fp = [output name '_fp.txt'];
|
||||
in_file_name = [database_root, '/', in_vids(i).name];
|
||||
|
||||
command = cat(2, command, [' -f "' in_file_name '" -of "' outputFile_fp '"']);
|
||||
command = cat(2, command, [' -f "' in_file_name '" -of "' output '"']);
|
||||
end
|
||||
|
||||
if(isunix)
|
||||
|
@ -56,19 +52,13 @@ end
|
|||
|
||||
command = executable;
|
||||
command = cat(2, command, ' -mloc model/main_clm_general.txt ');
|
||||
command = cat(2, command, ' -no3Dfp -noMparams -noPose -noGaze -noAUs ');
|
||||
command = cat(2, command, ' -2Dfp ');
|
||||
|
||||
% add all videos to single argument list (so as not to load the model anew
|
||||
% for every video)
|
||||
for i=1:numel(in_vids)
|
||||
|
||||
[~, name, ~] = fileparts(in_vids(i).name);
|
||||
|
||||
% where to output tracking results
|
||||
outputFile_fp = [output name '_fp.txt'];
|
||||
in_file_name = [database_root, '/', in_vids(i).name];
|
||||
|
||||
command = cat(2, command, [' -f "' in_file_name '" -of "' outputFile_fp '"']);
|
||||
command = cat(2, command, [' -f "' in_file_name '" -of "' output '"']);
|
||||
end
|
||||
|
||||
if(isunix)
|
||||
|
@ -80,7 +70,7 @@ end
|
|||
d_loc = 'yt_features/';
|
||||
d_loc_clm = 'yt_features_clm/';
|
||||
|
||||
files_yt = dir([d_loc, '/*.txt']);
|
||||
files_yt = dir([d_loc, '/*.csv']);
|
||||
preds_all = [];
|
||||
preds_all_clm = [];
|
||||
gts_all = [];
|
||||
|
|
Loading…
Reference in a new issue