From 242ce8d13001ffe4e1e67731d5605c805ce39f6b Mon Sep 17 00:00:00 2001 From: Tadas Baltrusaitis Date: Fri, 29 Jul 2016 13:04:25 -0400 Subject: [PATCH 01/10] Making sure failure returns 1 and success 0, adding an initial attempt at AppVeyor CI for Windows. --- .travis.yml | 3 ++- appveyor.yml | 15 +++++++++++++++ exe/FaceLandmarkImg/FaceLandmarkImg.cpp | 4 ++-- exe/FaceLandmarkVid/FaceLandmarkVid.cpp | 7 ++++++- exe/FaceLandmarkVidMulti/FaceLandmarkVidMulti.cpp | 6 +++++- exe/FeatureExtraction/FeatureExtraction.cpp | 4 ++-- exe/Recording/Record.cpp | 5 ++++- tests/tests.sh | 4 ++++ 8 files changed, 40 insertions(+), 8 deletions(-) create mode 100644 appveyor.yml create mode 100644 tests/tests.sh diff --git a/.travis.yml b/.travis.yml index 8bf4d12..de72154 100644 --- a/.travis.yml +++ b/.travis.yml @@ -64,4 +64,5 @@ script: - cd build - cmake -D CMAKE_BUILD_TYPE=RELEASE .. - make -j2 - - ./bin/FaceLandmarkImg -fdir "../videos/" -ofdir "./demo_img/" -oidir "./demo_img/" -wild -q \ No newline at end of file + - cd ../tests + - ./tests.sh \ No newline at end of file diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..12dc828 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,15 @@ +version: 1.0.{build} +branches: + only: + - develop + - master + - feature-travis +configuration: +- Debug +- Release +platform: +- x64 +- x86 +build: + project: OpenFace.sln + verbosity: minimal \ No newline at end of file diff --git a/exe/FaceLandmarkImg/FaceLandmarkImg.cpp b/exe/FaceLandmarkImg/FaceLandmarkImg.cpp index ac9ec43..39e2759 100644 --- a/exe/FaceLandmarkImg/FaceLandmarkImg.cpp +++ b/exe/FaceLandmarkImg/FaceLandmarkImg.cpp @@ -367,7 +367,7 @@ int main (int argc, char **argv) else { cout << "Can't find AU prediction files, exiting" << endl; - return 0; + return 1; } } @@ -386,7 +386,7 @@ int main (int argc, char **argv) if (!exists(loc)) { cout << "Can't find triangulation files, exiting" << endl; - return 0; + return 1; } } diff --git a/exe/FaceLandmarkVid/FaceLandmarkVid.cpp b/exe/FaceLandmarkVid/FaceLandmarkVid.cpp index c2fc023..8e194f1 100644 --- a/exe/FaceLandmarkVid/FaceLandmarkVid.cpp +++ b/exe/FaceLandmarkVid/FaceLandmarkVid.cpp @@ -247,6 +247,7 @@ int main (int argc, char **argv) if (!boost::filesystem::exists(current_file)) { FATAL_STREAM("File does not exist"); + return 1; } current_file = boost::filesystem::path(current_file).generic_string(); @@ -264,7 +265,11 @@ int main (int argc, char **argv) video_capture >> captured_image; } - if( !video_capture.isOpened() ) FATAL_STREAM( "Failed to open video source" ); + if (!video_capture.isOpened()) + { + FATAL_STREAM("Failed to open video source"); + return 1; + } else INFO_STREAM( "Device or file opened"); cv::Mat captured_image; diff --git a/exe/FaceLandmarkVidMulti/FaceLandmarkVidMulti.cpp b/exe/FaceLandmarkVidMulti/FaceLandmarkVidMulti.cpp index 063f89b..a490cb1 100644 --- a/exe/FaceLandmarkVidMulti/FaceLandmarkVidMulti.cpp +++ b/exe/FaceLandmarkVidMulti/FaceLandmarkVidMulti.cpp @@ -219,7 +219,11 @@ int main (int argc, char **argv) video_capture >> captured_image; } - if( !video_capture.isOpened() ) FATAL_STREAM( "Failed to open video source" ); + if (!video_capture.isOpened()) + { + FATAL_STREAM("Failed to open video source"); + return 1; + } else INFO_STREAM( "Device or file opened"); cv::Mat captured_image; diff --git a/exe/FeatureExtraction/FeatureExtraction.cpp b/exe/FeatureExtraction/FeatureExtraction.cpp index f327c21..b7ae968 100644 --- a/exe/FeatureExtraction/FeatureExtraction.cpp +++ b/exe/FeatureExtraction/FeatureExtraction.cpp @@ -337,7 +337,7 @@ int main (int argc, char **argv) if(!exists(loc)) { cout << "Can't find triangulation files, exiting" << endl; - return 0; + return 1; } } @@ -378,7 +378,7 @@ int main (int argc, char **argv) else { cout << "Can't find AU prediction files, exiting" << endl; - return 0; + return 1; } } diff --git a/exe/Recording/Record.cpp b/exe/Recording/Record.cpp index dd19ddf..ff4cc4c 100644 --- a/exe/Recording/Record.cpp +++ b/exe/Recording/Record.cpp @@ -168,7 +168,10 @@ int main (int argc, char **argv) INFO_STREAM( "Attempting to capture from device: " << device ); vCap = cv::VideoCapture( device ); - if( !vCap.isOpened() ) FATAL_STREAM( "Failed to open video source" ); + if (!vCap.isOpened()) { + FATAL_STREAM("Failed to open video source"); + return 1; + } cv::Mat img; vCap >> img; diff --git a/tests/tests.sh b/tests/tests.sh new file mode 100644 index 0000000..82950ab --- /dev/null +++ b/tests/tests.sh @@ -0,0 +1,4 @@ +../build/bin/FaceLandmarkImg -fdir "../videos/" -ofdir "./demo_img/" -oidir "./demo_img/" -wild -q +../build/bin/FaceLandmarkVidMulti -f ../videos/multi_face.avi +../build/bin/FeatureExtraction -rigid -verbose -f "../videos/default.wmv" -of "output_features/default.txt" -simalign output_features/aligned +../build/bin/FaceLandmarkVid -f "../videos/changeLighting.wmv" -f "../videos/0188_03_021_al_pacino.avi" -f "../videos/0217_03_006_alanis_morissette.avi" -f "../videos/0244_03_004_anderson_cooper.avi" \ No newline at end of file From 63a9adf13b39671e35559f88e40a33e7fb860a94 Mon Sep 17 00:00:00 2001 From: Tadas Baltrusaitis Date: Fri, 29 Jul 2016 13:26:03 -0400 Subject: [PATCH 02/10] Small fixes to windows and linux/osx CIs. --- .travis.yml | 2 +- appveyor.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index de72154..840f80b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -65,4 +65,4 @@ script: - cmake -D CMAKE_BUILD_TYPE=RELEASE .. - make -j2 - cd ../tests - - ./tests.sh \ No newline at end of file + - sudo ./tests.sh \ No newline at end of file diff --git a/appveyor.yml b/appveyor.yml index 12dc828..059f976 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -9,7 +9,7 @@ configuration: - Release platform: - x64 -- x86 +- Win32 build: project: OpenFace.sln verbosity: minimal \ No newline at end of file From 6eb3cd8c88851e7e9bff2a8640726cfbcb74ac7a Mon Sep 17 00:00:00 2001 From: Tadas Baltrusaitis Date: Fri, 29 Jul 2016 14:03:03 -0400 Subject: [PATCH 03/10] Fix travis testing. --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 840f80b..e430d6c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -65,4 +65,5 @@ script: - cmake -D CMAKE_BUILD_TYPE=RELEASE .. - make -j2 - cd ../tests + - sudo chmod +x tests.sh - sudo ./tests.sh \ No newline at end of file From 38450d3383337294188e664608d8705922158d02 Mon Sep 17 00:00:00 2001 From: Tadas Baltrusaitis Date: Fri, 29 Jul 2016 15:29:42 -0400 Subject: [PATCH 04/10] A fix to travis tests. --- tests/tests.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/tests.sh b/tests/tests.sh index 82950ab..c1be6d2 100644 --- a/tests/tests.sh +++ b/tests/tests.sh @@ -1,4 +1,4 @@ ../build/bin/FaceLandmarkImg -fdir "../videos/" -ofdir "./demo_img/" -oidir "./demo_img/" -wild -q -../build/bin/FaceLandmarkVidMulti -f ../videos/multi_face.avi -../build/bin/FeatureExtraction -rigid -verbose -f "../videos/default.wmv" -of "output_features/default.txt" -simalign output_features/aligned -../build/bin/FaceLandmarkVid -f "../videos/changeLighting.wmv" -f "../videos/0188_03_021_al_pacino.avi" -f "../videos/0217_03_006_alanis_morissette.avi" -f "../videos/0244_03_004_anderson_cooper.avi" \ No newline at end of file +../build/bin/FaceLandmarkVidMulti -f ../videos/multi_face.avi -q +../build/bin/FeatureExtraction -rigid -verbose -f "../videos/1815_01_008_tony_blair.avi" -of "output_features/1815_01_008_tony_blair.txt" -simalign output_features/aligned -q +../build/bin/FaceLandmarkVid -f "../videos/1815_01_008_tony_blair.avi" -f "../videos/0188_03_021_al_pacino.avi" -f "../videos/0217_03_006_alanis_morissette.avi" -f "../videos/0244_03_004_anderson_cooper.avi" -q \ No newline at end of file From 5f9d06a9f48983d7904bc3ea09661cfb80d9c4ef Mon Sep 17 00:00:00 2001 From: Tadas Baltrusaitis Date: Sat, 30 Jul 2016 15:51:07 -0400 Subject: [PATCH 05/10] Better travis ci testing. --- .travis.yml | 7 ++++--- tests/tests.sh | 4 ---- 2 files changed, 4 insertions(+), 7 deletions(-) delete mode 100644 tests/tests.sh diff --git a/.travis.yml b/.travis.yml index e430d6c..c8f2edc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -64,6 +64,7 @@ script: - cd build - cmake -D CMAKE_BUILD_TYPE=RELEASE .. - make -j2 - - cd ../tests - - sudo chmod +x tests.sh - - sudo ./tests.sh \ No newline at end of file + - ../build/bin/FaceLandmarkImg -fdir "../videos/" -ofdir "./demo_img/" -oidir "./demo_img/" -wild -q + - ../build/bin/FaceLandmarkVidMulti -f ../videos/multi_face.avi -q + - ../build/bin/FeatureExtraction -rigid -verbose -f "../videos/1815_01_008_tony_blair.avi" -of "output_features/1815_01_008_tony_blair.txt" -simalign output_features/aligned -q + - ../build/bin/FaceLandmarkVid -f "../videos/1815_01_008_tony_blair.avi" -f "../videos/0188_03_021_al_pacino.avi" -f "../videos/0217_03_006_alanis_morissette.avi" -f "../videos/0244_03_004_anderson_cooper.avi" -q \ No newline at end of file diff --git a/tests/tests.sh b/tests/tests.sh deleted file mode 100644 index c1be6d2..0000000 --- a/tests/tests.sh +++ /dev/null @@ -1,4 +0,0 @@ -../build/bin/FaceLandmarkImg -fdir "../videos/" -ofdir "./demo_img/" -oidir "./demo_img/" -wild -q -../build/bin/FaceLandmarkVidMulti -f ../videos/multi_face.avi -q -../build/bin/FeatureExtraction -rigid -verbose -f "../videos/1815_01_008_tony_blair.avi" -of "output_features/1815_01_008_tony_blair.txt" -simalign output_features/aligned -q -../build/bin/FaceLandmarkVid -f "../videos/1815_01_008_tony_blair.avi" -f "../videos/0188_03_021_al_pacino.avi" -f "../videos/0217_03_006_alanis_morissette.avi" -f "../videos/0244_03_004_anderson_cooper.avi" -q \ No newline at end of file From 818ec6463efbf7e5d907e8a39cb672e8384e0fa9 Mon Sep 17 00:00:00 2001 From: Tadas Baltrusaitis Date: Sat, 30 Jul 2016 16:17:45 -0400 Subject: [PATCH 06/10] Adding appveyor testing. --- README.md | 6 ++++++ appveyor.yml | 13 ++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3ff88d9..ad9105e 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,10 @@ # OpenFace: an open source facial behavior analysis toolkit +Travis +[![Build Status](https://travis-ci.org/TadasBaltrusaitis/OpenFace.svg?branch=master)](https://travis-ci.org/TadasBaltrusaitis/OpenFace) +AppVeyor +[![Build status](https://ci.appveyor.com/api/projects/status/8msiklxfbhlnsmxp/branch/master?svg=true)](https://ci.appveyor.com/project/TadasBaltrusaitis/openface/branch/master) + Over the past few years, there has been an increased interest in automatic facial behavior analysis and understanding. We present OpenFace – an open source tool intended for computer vision and machine learning researchers, affective computing community and people interested in building interactive applications based on facial behavior analysis. OpenFace is the first open source tool capable of facial landmark detection, head pose estimation, facial action unit recognition, and eye-gaze estimation. The computer vision algorithms which represent the core of OpenFace demonstrate state-of-the-art results in all of the above mentioned tasks. Furthermore, our tool is capable of real-time performance and is able to run from a simple webcam without any specialist hardware. The code was written mainly by Tadas Baltrusaitis during his time at the Language Technologies Institute at the Carnegie Mellon University; Computer Laboratory, University of Cambridge; and Institute for Creative Technologies, University of Southern California. @@ -73,3 +78,4 @@ I did my best to make sure that the code runs out of the box but there are alway Copyright can be found in the Copyright.txt You have to respect boost, TBB, dlib, and OpenCV licenses. + diff --git a/appveyor.yml b/appveyor.yml index 059f976..a78514b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -12,4 +12,15 @@ platform: - Win32 build: project: OpenFace.sln - verbosity: minimal \ No newline at end of file + verbosity: minimal + + test_script: +# C++ + - cmd: dir + - cmd: if exist x64 (cd x64) + - cmd: if exist Debug (cd Debug) + - cmd: if exist Release (cd Release) + - cmd: if exist "../videos" (FaceLandmarkImg.exe -fdir "../videos/" -ofdir "./demo_img/" -oidir "./demo_img/" -wild -q) else (FaceLandmarkImg.exe -fdir "../../videos/" -ofdir "./demo_img/" -oidir "./demo_img/" -wild -q) + - cmd: if exist "../videos" (FaceLandmarkVidMulti.exe -f ../videos/multi_face.avi -q) else (FaceLandmarkVidMulti.exe -f ../../videos/multi_face.avi -q) + - cmd: if exist "../videos" (FeatureExtraction.exe -rigid -verbose -f "../videos/1815_01_008_tony_blair.avi" -of "output_features/1815_01_008_tony_blair.txt" -simalign output_features/aligned -q) else (FeatureExtraction.exe -rigid -verbose -f "../../videos/1815_01_008_tony_blair.avi" -of "output_features/1815_01_008_tony_blair.txt" -simalign output_features/aligned -q) + - cmd: if exist "../videos" (FaceLandmarkVid.exe -f "../videos/1815_01_008_tony_blair.avi" -q) else (FaceLandmarkVid.exe -f "../../videos/1815_01_008_tony_blair.avi" -q) From fdf9973c594d8586ada290192384014bd2812e1e Mon Sep 17 00:00:00 2001 From: Tadas Baltrusaitis Date: Sat, 30 Jul 2016 16:19:56 -0400 Subject: [PATCH 07/10] appveyor yml fix. --- appveyor.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index a78514b..529fe0c 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -13,8 +13,7 @@ platform: build: project: OpenFace.sln verbosity: minimal - - test_script: +test_script: # C++ - cmd: dir - cmd: if exist x64 (cd x64) From 808a18952526cf21bda1d251a29850fa8c04adea Mon Sep 17 00:00:00 2001 From: Tadas Baltrusaitis Date: Sat, 30 Jul 2016 21:14:38 -0400 Subject: [PATCH 08/10] Fixing the project configurations to create consistently named executables. --- appveyor.yml | 1 + exe/FaceLandmarkVid/FaceLandmarkVid.vcxproj | 4 ++-- exe/FaceLandmarkVidMulti/FaceLandmarkVidMulti.vcxproj | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 529fe0c..1a5050b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -19,6 +19,7 @@ test_script: - cmd: if exist x64 (cd x64) - cmd: if exist Debug (cd Debug) - cmd: if exist Release (cd Release) + - cmd: dir - cmd: if exist "../videos" (FaceLandmarkImg.exe -fdir "../videos/" -ofdir "./demo_img/" -oidir "./demo_img/" -wild -q) else (FaceLandmarkImg.exe -fdir "../../videos/" -ofdir "./demo_img/" -oidir "./demo_img/" -wild -q) - cmd: if exist "../videos" (FaceLandmarkVidMulti.exe -f ../videos/multi_face.avi -q) else (FaceLandmarkVidMulti.exe -f ../../videos/multi_face.avi -q) - cmd: if exist "../videos" (FeatureExtraction.exe -rigid -verbose -f "../videos/1815_01_008_tony_blair.avi" -of "output_features/1815_01_008_tony_blair.txt" -simalign output_features/aligned -q) else (FeatureExtraction.exe -rigid -verbose -f "../../videos/1815_01_008_tony_blair.avi" -of "output_features/1815_01_008_tony_blair.txt" -simalign output_features/aligned -q) diff --git a/exe/FaceLandmarkVid/FaceLandmarkVid.vcxproj b/exe/FaceLandmarkVid/FaceLandmarkVid.vcxproj index 50848d0..6acff0a 100644 --- a/exe/FaceLandmarkVid/FaceLandmarkVid.vcxproj +++ b/exe/FaceLandmarkVid/FaceLandmarkVid.vcxproj @@ -86,7 +86,7 @@ true - FaceTrackingVid + FaceLandmarkVid $(ProjectDir)$(Configuration)\ @@ -95,7 +95,7 @@ false - FaceTrackingVid + FaceLandmarkVid $(ProjectDir)$(Configuration)\ diff --git a/exe/FaceLandmarkVidMulti/FaceLandmarkVidMulti.vcxproj b/exe/FaceLandmarkVidMulti/FaceLandmarkVidMulti.vcxproj index e2ab430..5b659a7 100644 --- a/exe/FaceLandmarkVidMulti/FaceLandmarkVidMulti.vcxproj +++ b/exe/FaceLandmarkVidMulti/FaceLandmarkVidMulti.vcxproj @@ -84,14 +84,14 @@ - FaceTrackingVidMulti + FaceLandmarkVidMulti $(ProjectDir)$(Configuration)\ FaceLandmarkVidMulti - FaceTrackingVidMulti + FaceLandmarkVidMulti $(ProjectDir)$(Configuration)\ From a62de100e4604ae1d1f0ace1e7a759576fa173d8 Mon Sep 17 00:00:00 2001 From: Tadas Baltrusaitis Date: Sun, 31 Jul 2016 09:31:47 -0400 Subject: [PATCH 09/10] A fix to deal with OpenCV not liking to output png in Debug mode. Feature extraction now saves jpg instead of png for aligned face images. --- exe/FeatureExtraction/FeatureExtraction.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/exe/FeatureExtraction/FeatureExtraction.cpp b/exe/FeatureExtraction/FeatureExtraction.cpp index b7ae968..eabeaae 100644 --- a/exe/FeatureExtraction/FeatureExtraction.cpp +++ b/exe/FeatureExtraction/FeatureExtraction.cpp @@ -615,15 +615,19 @@ int main (int argc, char **argv) char name[100]; // output the frame number - std::sprintf(name, "frame_det_%06d.png", frame_count); + std::sprintf(name, "frame_det_%06d.jpg", frame_count); // Construct the output filename boost::filesystem::path slash("/"); std::string preferredSlash = slash.make_preferred().string(); + vector compression_params; + compression_params.push_back(CV_IMWRITE_JPEG_QUALITY); + compression_params.push_back(100); + string out_file = output_similarity_align[f_n] + preferredSlash + string(name); - imwrite(out_file, sim_warped_img); + imwrite(out_file, sim_warped_img, compression_params); } From bb7ba5ba60a6eb901c4f080f03227d22bc4703d9 Mon Sep 17 00:00:00 2001 From: Tadas Baltrusaitis Date: Sun, 31 Jul 2016 10:09:35 -0400 Subject: [PATCH 10/10] A fix to a previous fix - OpenCV does not handle Debug/Release mixing with writing out ,jpeg and .png files, so use .bmp instead --- exe/FeatureExtraction/FeatureExtraction.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/exe/FeatureExtraction/FeatureExtraction.cpp b/exe/FeatureExtraction/FeatureExtraction.cpp index eabeaae..76829c6 100644 --- a/exe/FeatureExtraction/FeatureExtraction.cpp +++ b/exe/FeatureExtraction/FeatureExtraction.cpp @@ -615,19 +615,15 @@ int main (int argc, char **argv) char name[100]; // output the frame number - std::sprintf(name, "frame_det_%06d.jpg", frame_count); + std::sprintf(name, "frame_det_%06d.bmp", frame_count); // Construct the output filename boost::filesystem::path slash("/"); std::string preferredSlash = slash.make_preferred().string(); - vector compression_params; - compression_params.push_back(CV_IMWRITE_JPEG_QUALITY); - compression_params.push_back(100); - string out_file = output_similarity_align[f_n] + preferredSlash + string(name); - imwrite(out_file, sim_warped_img, compression_params); + imwrite(out_file, sim_warped_img); }