From 79cc114d5620877ce83b24fde6220efbbaa97a45 Mon Sep 17 00:00:00 2001 From: Maneesh Date: Sun, 26 Jul 2020 17:15:29 -0400 Subject: [PATCH 1/4] Updated README with python read instructions Added instructions on how to modify the AFAR output mat files with tables to read in python. --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index 9bd3380..8f68075 100644 --- a/README.md +++ b/README.md @@ -171,5 +171,19 @@ each module's folder is. to check and manually change the locations of ZFace/FETA/AUDetector directory) +## Using .mat files with python +The mat files from AFAR summarize the results as tables. To the best of our knowledge, there is no python package that supports matlab tables. In order to read the files in python, convert the matlab table to array using `table2array()`. An example for reading a sample `sample.mat` is shown below +``` +occurrence = table2array('sample.mat') +save('output_filename.mat', occurrence) +``` + +Read this in python as +``` +import scipy.io as sio +mat_file = sio.loadmat('output_filename.mat'); +occurrence = mat_file['occurrence']; +``` + ## License AFAR is freely available for free non-commercial use, and may be redistributed under these conditions. Please, see the [license](LICENSE) for further details. Interested in a commercial license? Please contact [Jeffrey Cohn](http://www.jeffcohn.net/). From 6f6e3d62cce139b80879db649362fc7eee16d0b0 Mon Sep 17 00:00:00 2001 From: Maneesh Date: Tue, 17 Nov 2020 21:06:09 -0500 Subject: [PATCH 2/4] Update README.md Added prerequisite installation instructions --- README.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8f68075..d634514 100644 --- a/README.md +++ b/README.md @@ -6,10 +6,19 @@ Automated measurement of face and head dynamics, detection of facial action unit ![afar_pipeline](https://user-images.githubusercontent.com/12033328/61708950-15539700-ad1c-11e9-85a7-23d1db0475ac.png) ## Required -- [OpenCV](https://opencv.org/) +- [OpenCV](https://opencv.org/) 3.4.1 or lower - [mexopencv](https://github.com/kyamagu/mexopencv) - MATLAB add-on: - - Deep Learning Toolbox Converter for ONNX Model Format + - [Deep Learning Toolbox Converter for ONNX Model Format](https://www.mathworks.com/matlabcentral/fileexchange/67296-deep-learning-toolbox-converter-for-onnx-model-format) + +### Linux installation +- Installing using conda or pip are not recommended. +- If you are installing OpenCV on Linux, we recommend building from the source. Follow the instructions [here](https://docs.opencv.org/master/d7/d9f/tutorial_linux_install.html) and replace `master` with `3.4.1` or lower(check mexopencv compatibility). You might need to disable CUDA because 3.4.1 might not support latest CUDA version. +- When building the OpenCV source use the following command to make sure that you generate a `opencv.pc` file and customize the installation path `cmake -DWITH_CUDA=OFF -DPYTHON_DEFAULT_EXECUTABLE=$(which python) -DCMAKE_INSTALL_PREFIX=/home//local/ -DOPENCV_GENERATE_PKGCONFIG=YES -DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib-3.4.1/modules ../opencv-3.4.1/` +- Once you install OpenCV and opencv-contrib v3.4.1, run `make MATLABDIR="/usr/local/MATLAB/R2018a" all contrib` in the [mexopencv](https://github.com/kyamagu/mexopencv) dir to install mexopencv + +### Installing ONNX Add-On + ## Modules From 46654748955d6fc02c1dd2e9dc3cef211468a6f6 Mon Sep 17 00:00:00 2001 From: Maneesh Date: Thu, 19 Nov 2020 20:52:25 -0500 Subject: [PATCH 3/4] Update README.md --- README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d634514..ab68a79 100644 --- a/README.md +++ b/README.md @@ -14,11 +14,13 @@ Automated measurement of face and head dynamics, detection of facial action unit ### Linux installation - Installing using conda or pip are not recommended. - If you are installing OpenCV on Linux, we recommend building from the source. Follow the instructions [here](https://docs.opencv.org/master/d7/d9f/tutorial_linux_install.html) and replace `master` with `3.4.1` or lower(check mexopencv compatibility). You might need to disable CUDA because 3.4.1 might not support latest CUDA version. -- When building the OpenCV source use the following command to make sure that you generate a `opencv.pc` file and customize the installation path `cmake -DWITH_CUDA=OFF -DPYTHON_DEFAULT_EXECUTABLE=$(which python) -DCMAKE_INSTALL_PREFIX=/home//local/ -DOPENCV_GENERATE_PKGCONFIG=YES -DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib-3.4.1/modules ../opencv-3.4.1/` -- Once you install OpenCV and opencv-contrib v3.4.1, run `make MATLABDIR="/usr/local/MATLAB/R2018a" all contrib` in the [mexopencv](https://github.com/kyamagu/mexopencv) dir to install mexopencv - ### Installing ONNX Add-On +- We found that MATLAB R2018a version has some difficulties with installing the Deep learning toolbox converter using the Add-Ons option. So it is suggested to make sure that you are able to install it the link mentioned above and then compile mexopencv. +- The installation involves searching for the `Deep Learning Toolbox Converter for ONNX Model Format` in the Add-Ons and installing it(might require you to sign in with your the matlab account). We tested it on R2020b and it works on Ubuntu 18.04 LTS. +### Compiling mexopencv +- When building the OpenCV source use the following command to make sure that you generate a `opencv.pc` file and customize the installation path `cmake -DWITH_CUDA=OFF -DPYTHON_DEFAULT_EXECUTABLE=$(which python) -DCMAKE_INSTALL_PREFIX=/home//local/ -DOPENCV_GENERATE_PKGCONFIG=YES -DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib-3.4.1/modules ../opencv-3.4.1/` +- Once you install OpenCV and opencv-contrib v3.4.1, run `make MATLABDIR="/usr/local/MATLAB/R2018a" all contrib` in the [mexopencv](https://github.com/kyamagu/mexopencv) dir to install mexopencv. Note that the matlab installation location on your system might be different. ## Modules From ce52a4b4eeea5d6c13964d6fd717aa656df9acd2 Mon Sep 17 00:00:00 2001 From: Maneesh Date: Thu, 19 Nov 2020 21:00:18 -0500 Subject: [PATCH 4/4] Update README.md --- README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ab68a79..3990d55 100644 --- a/README.md +++ b/README.md @@ -11,15 +11,16 @@ Automated measurement of face and head dynamics, detection of facial action unit - MATLAB add-on: - [Deep Learning Toolbox Converter for ONNX Model Format](https://www.mathworks.com/matlabcentral/fileexchange/67296-deep-learning-toolbox-converter-for-onnx-model-format) -### Linux installation +#### Linux installation - Installing using conda or pip are not recommended. - If you are installing OpenCV on Linux, we recommend building from the source. Follow the instructions [here](https://docs.opencv.org/master/d7/d9f/tutorial_linux_install.html) and replace `master` with `3.4.1` or lower(check mexopencv compatibility). You might need to disable CUDA because 3.4.1 might not support latest CUDA version. -### Installing ONNX Add-On +- When building the OpenCV source use the following command to make sure that you generate a `opencv.pc` file and customize the installation path `cmake -DWITH_CUDA=OFF -DPYTHON_DEFAULT_EXECUTABLE=$(which python) -DCMAKE_INSTALL_PREFIX=/home//local/ -DOPENCV_GENERATE_PKGCONFIG=YES -DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib-3.4.1/modules ../opencv-3.4.1/` + +#### Installing ONNX Add-On - We found that MATLAB R2018a version has some difficulties with installing the Deep learning toolbox converter using the Add-Ons option. So it is suggested to make sure that you are able to install it the link mentioned above and then compile mexopencv. - The installation involves searching for the `Deep Learning Toolbox Converter for ONNX Model Format` in the Add-Ons and installing it(might require you to sign in with your the matlab account). We tested it on R2020b and it works on Ubuntu 18.04 LTS. -### Compiling mexopencv -- When building the OpenCV source use the following command to make sure that you generate a `opencv.pc` file and customize the installation path `cmake -DWITH_CUDA=OFF -DPYTHON_DEFAULT_EXECUTABLE=$(which python) -DCMAKE_INSTALL_PREFIX=/home//local/ -DOPENCV_GENERATE_PKGCONFIG=YES -DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib-3.4.1/modules ../opencv-3.4.1/` +#### Compiling mexopencv - Once you install OpenCV and opencv-contrib v3.4.1, run `make MATLABDIR="/usr/local/MATLAB/R2018a" all contrib` in the [mexopencv](https://github.com/kyamagu/mexopencv) dir to install mexopencv. Note that the matlab installation location on your system might be different. ## Modules