Bug fix with processing really short sequences with FeatureExtraction executable

This commit is contained in:
Tadas Baltrusaitis
2018-06-28 16:18:55 +02:00
parent a127ec69b4
commit 3c9ee1ce3b
3 changed files with 38 additions and 20 deletions

View File

@@ -19,7 +19,7 @@ before_install:
# OpenCV dependencies, dlib and boost
- if [ ${TRAVIS_OS_NAME} = linux ]; then
sudo apt-get update;
sudo apt-get install libopenblas-dev libopenblas-base;
sudo apt-get install libopenblas-dev;
sudo apt-get install git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev;
sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libdc1394-22-dev;
sudo apt-get install cmake;

View File

@@ -4,7 +4,7 @@
# Description: Install everything necessary for OpenFace to compile.
# Author: Daniyal Shahrokhian <daniyal@kth.se>
# Date: 20170428
# Version : 1.01
# Version : 1.02
# Usage: bash install.sh
# NOTES: There are certain steps to be taken in the system before installing
# via this script (refer to README): Run
@@ -27,12 +27,10 @@ fi
echo "Installing Essential dependencies..."
sudo apt-get -y update
sudo apt-get -y install build-essential
sudo apt-get -y install llvm
sudo apt-get -y install clang-3.7 libc++-dev libc++abi-dev
sudo apt-get -y install cmake
sudo apt-get -y install libopenblas-dev liblapack-dev
sudo apt-get -y install git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
sudo apt-get -y install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev checkinstall
sudo apt-get -y install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libdc1394-22-dev
echo "Essential dependencies installed."
# OpenCV Dependency
@@ -51,6 +49,22 @@ rm 3.4.0.zip
sudo rm -r opencv-3.4.0
echo "OpenCV installed."
# dlib dependecy
echo "Downloading dlib"
wget http://dlib.net/files/dlib-19.13.tar.bz2;
tar xf dlib-19.13.tar.bz2;
cd dlib-19.13;
mkdir -p build;
cd build;
echo "Installing dlib"
cmake ..;
cmake --build . --config Release;
sudo make install;
sudo ldconfig;
cd ../..;
rm -r dlib-19.13.tar.bz2
echo "dlib installed"
# Boost C++ Dependency
echo "Installing Boost..."
sudo apt-get install libboost-all-dev

View File

@@ -526,7 +526,7 @@ void FaceAnalyser::PostprocessPredictions()
{
int success_ind = 0;
int all_ind = 0;
int all_frames_size = timestamps.size();
int all_frames_size = (int)timestamps.size();
while(all_ind < all_frames_size && success_ind < max_init_frames)
{
@@ -616,14 +616,14 @@ void FaceAnalyser::ExtractAllPredictionsOfflineReg(vector<std::pair<std::string,
{
if (au_name.compare(dyn_au_names[a]) == 0)
{
au_id = a;
au_id = (int)a;
}
}
if (au_id != -1 && AU_SVR_dynamic_appearance_lin_regressors.GetCutoffs()[au_id] != -1)
{
double cutoff = AU_SVR_dynamic_appearance_lin_regressors.GetCutoffs()[au_id];
offsets.push_back(au_good.at((double)au_good.size() * cutoff));
offsets.push_back(au_good.at((int)((double)au_good.size() * cutoff)));
}
else
{
@@ -703,22 +703,26 @@ void FaceAnalyser::ExtractAllPredictionsOfflineClass(vector<std::pair<std::strin
// Perform a moving average of 7 frames on classifications
int window_size = 7;
vector<double> au_vals_tmp = au_vals;
for (size_t i = (window_size - 1)/2; i < au_vals.size() - (window_size - 1) / 2; ++i)
if(au_vals.size() > (window_size - 1) / 2)
{
double sum = 0;
for (int w = -(window_size - 1) / 2; w <= (window_size - 1) / 2; ++w)
for (size_t i = (window_size - 1)/2; i < au_vals.size() - (window_size - 1) / 2; ++i)
{
sum += au_vals_tmp[i + w];
double sum = 0;
int div_by = 0;
for (int w = -(window_size - 1) / 2; w <= (window_size - 1) / 2 && (i+w < au_vals_tmp.size()); ++w)
{
sum += au_vals_tmp[i + w];
div_by++;
}
sum = sum / div_by;
if (sum < 0.5)
sum = 0;
else
sum = 1;
au_vals[i] = sum;
}
sum = sum / window_size;
if (sum < 0.5)
sum = 0;
else
sum = 1;
au_vals[i] = sum;
}
au_predictions.push_back(std::pair<string,vector<double>>(au_name, au_vals));
}