2019-02-08 18:22:20 +00:00
|
|
|
|
# Specimens of Discriminatory Composite Portraiture - Gender Differentiation
|
|
|
|
|
|
|
|
|
|
hostname: specimensofgender
|
2019-02-03 16:43:32 +00:00
|
|
|
|
|
|
|
|
|
Uses a modified version of Affectivas [cpp-sdk-samples](https://github.com/Affectiva/cpp-sdk-samples/).
|
|
|
|
|
|
|
|
|
|
## Install
|
|
|
|
|
|
|
|
|
|
Install dependencies:
|
|
|
|
|
```bash
|
|
|
|
|
sudo apt libopencv-dev install libboost-system-dev libboost-filesystem-dev libboost-date-time-dev libboost-regex-dev libboost-thread-dev libboost-timer-dev libboost-chrono-dev libboost-serialization-dev libboost-log-dev libboost-program-options-dev
|
|
|
|
|
sudo apt install cmake build-essential git gzip
|
|
|
|
|
|
|
|
|
|
#rpi is ARM:
|
|
|
|
|
wget http://download.affectiva.com/linux/arm/affdex-cpp-sdk-3.1-40-linux-arm7.tar.gz
|
|
|
|
|
mkdir affdex-sdk
|
|
|
|
|
tar -xzvf affdex-cpp-sdk-*.tar.gz -C affdex-sdk
|
|
|
|
|
rm affdex-cpp-sdk-*.tar.gz
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Build:
|
|
|
|
|
```bash
|
|
|
|
|
mkdir build && cd build
|
|
|
|
|
cmake -DOpenCV_DIR=/usr/ -DBOOST_ROOT=/usr/ -DAFFDEX_DIR=~/gender_detection/affdex-sdk ~/gender_detection/sdk-samples
|
|
|
|
|
make
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
To avoid ruining the SD-card too soon, mount /tmp as tmpfs. This folder will also be used to store camera frames for analysis. So to `/etc/fstab` add:
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
# tmpfs for /tmp, so we save the sd-card a bit
|
|
|
|
|
tmpfs /tmp tmpfs defaults,noatime,nosuid 0 0
|
|
|
|
|
tmpfs /var/log tmpfs defaults,noatime,mode=1777,size=64m 0 0
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
`sudo ln -s supervisord.conf /etc/supervisor/conf.d/specimens.conf`
|
|
|
|
|
|
|
|
|
|
Install fonts:
|
|
|
|
|
` cp fonts/*/*.ttf ~/.fonts/`
|
|
|
|
|
|
|
|
|
|
## Test
|
|
|
|
|
|
|
|
|
|
Some quirks in either Rasbian or the video demo require two variables to be set before running. Not doing so results in a segfault.
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
export LC_ALL=$LANG
|
|
|
|
|
export LD_PRELOAD=/usr/lib/arm-linux-gnueabihf/libopencv_core.so.2.4
|
|
|
|
|
~/gender_detection/build/video-demo/video-demo --input ~/gender_detection/image_test.jpg --data ~/gender_detection/affdex-sdk/data --draw=0 --numFaces=20
|
|
|
|
|
```
|