The days click by at an alarmingly fast rate, up at 8 o’clock bed at midnight.
My aim is to use the modified intercoms I have already prepared, incorporating facial recognition to produce a new exhibit, using the familiar Raspberry Pi concealed inside the phone in conjunction with asmall concealed camera using Python Face recognition.
Installing face recognition (using pip) is not as straightforward as online advice would have it. Having spent the last two days with failed attempts I finally achieved success.
I triedrunning Rasbian directly from an external hard drive connected to the Pi to overcome problems in installing software. This did not solve any problems as finally concluded that it was necessary to compile dlib in advance. I reverted back to using an SD card in the Pi.
First, upgrade pip3 to pip3.6
pip install --upgrade pip
In preparation for this, I pre installed dblib which is required to run Face recognition:
mkdir -p dlib
git clone -b 'v19.6' --single-branch https://github.com/davisking/dlib.git dlib/
cd ./dlib
sudo python3 setup.py install --compiler-flags "-mfpu=neon"
Also, it was absolutely necessary to temporarily expand the swap file size to 1024 from the 100; N.B. use dblin v19.7 (not 19.6)
mkdir -p dlibgit clone -b 'v19.7' --single-branch https://github.com/davisking/dlib.git dlib/cd ./dlibsudo python3 setup.py install --compiler-flags "-mfpu=neon"
Then in a separate step;
git clone --single-branch https://github.com/ageitgey/face_recognition.gitcd ./face_recognition/examplespython3 facerec_on_raspberry_pi.py
This following step took the longest and I anxiously waited for this to finish;
sudo pip3 install face_recognition
Reverting back swap size again;
sudo nano /etc/dphys-swapfile < change CONF_SWAPSIZE=1024 to CONF_SWAPSIZE=100 and save / exit nano > sudo /etc/init.d/dphys-swapfile restart
All this was carried out using SSH from my laptop.
I will now continue to use face recognition and details will follow on how I did this.
The difference between theory and practice prove to be a lot harder then I had anticipated. Simply installing opencv was not enough for my needs. Opencv can be compiled on the machine directly however on the raspberry pi this again proved to be too difficult and it only worked on my Mac. To circumvent this fortunately, PyPy has an easy install available via pip!
I am grateful to the instructions I used at
https://gist.github.com/ageitgey/1ac8dbe8572f3f533df6269dab35df65