Skip to content

Adapt for raspberry #1635

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 101 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
5a31edc
Docker file fix for opencv stable version
AndreaCalabro-AYES May 23, 2024
070a323
Change to have a dummy print
AndreaCalabro-AYES May 23, 2024
1ff6d0e
corrected docker compose file to call recognize_faces_in_pictures script
AndreaCalabro-AYES May 23, 2024
b7b80bb
Removing the command in the dockerfile, changing the recognize_faces_…
AndreaCalabro-AYES May 23, 2024
ebe6e38
Added debugging echoes
AndreaCalabro-AYES May 27, 2024
32305e2
WIP: improved dockerfile.gpu to get an existing nvidia dockerfile
AndreaCalabro-AYES May 30, 2024
e36c9a0
WIP: new functions to play around with docker and the model
AndreaCalabro-AYES May 30, 2024
01a5c78
WIP: deleted results, make your own discovery!
AndreaCalabro-AYES May 30, 2024
91bf100
WIP: git ignore the train and test folders
AndreaCalabro-AYES Jun 12, 2024
940f8ae
WIP: offline model creation
AndreaCalabro-AYES Jun 12, 2024
912c47b
remove the images, we should learn how to use gitignore files
AndreaCalabro-AYES Jun 12, 2024
fe23b49
WIP: remove the images, we should learn how to use gitignore files
AndreaCalabro-AYES Jun 12, 2024
8a0ef10
WIP: working on the test with a video and boxes around of it
AndreaCalabro-AYES Jun 13, 2024
4210d89
WIP: working script to test on x11 server host
AndreaCalabro-AYES Jun 13, 2024
476eb0c
Removing the test video, we need to learn about gitignoring quite qui…
AndreaCalabro-AYES Jun 13, 2024
8827e15
README file and docker compose cleaning
AndreaCalabro-AYES Jun 13, 2024
47fe5b1
Update README.md
AndreaCalabro-AYES Jun 14, 2024
3f4d4b6
Added python file to mock the behvaiour of the facerec on raspberry pi
AndreaCalabro-AYES Jun 23, 2024
6d99d0c
Added a Numpy downgrade for v2.0 issue
AndreaCalabro-AYES Jun 23, 2024
5132d70
Different command to be run
AndreaCalabro-AYES Jun 23, 2024
8778eb0
Merge branch 'master' of https://github.com/AndreaCalabro-AYES/face_r…
AndreaCalabro-AYES Jun 23, 2024
e71e061
Added funtionality to only capture each FRAMES_JUMP frames, and not o…
AndreaCalabro-AYES Jun 24, 2024
32c3d6c
First implementation of the face recognition
AndreaCalabro-AYES Jun 25, 2024
734c2f2
Docker compose and dockerfile for raspberry pi
AndreaCalabro-AYES Jun 26, 2024
a094754
corrected dockerfile name in docker compose file
AndreaCalabro-AYES Jun 26, 2024
54c745e
New dockerfile for the raspberry pi: added explicit openBLAS commands…
AndreaCalabro-AYES Jun 26, 2024
3bfabae
Raspberry 4b dockerfile for arm 64 v 8
AndreaCalabro-AYES Jun 27, 2024
265d47d
Fix openSSL problem
AndreaCalabro-AYES Jun 27, 2024
7644fac
Remove entrypoint
AndreaCalabro-AYES Jun 28, 2024
82ca721
Corrected python script to run - wrong camera opening
AndreaCalabro-AYES Jun 28, 2024
7b8d9bd
Added higher priviledges for the container
AndreaCalabro-AYES Jun 28, 2024
3143867
Correction for .grab() function which only returns a boolean
AndreaCalabro-AYES Jun 28, 2024
dd48310
First official push to try the complete standalone build on the raspb…
AndreaCalabro-AYES Jun 28, 2024
5dc94c7
Raspberry dockerfile with explicit install of face_recognition library
AndreaCalabro-AYES Jun 28, 2024
b64862c
Communicate with the magic mirror
MerlinGuillaume Jul 1, 2024
ddeae3d
Development utilities added: no need to re-build the dev image each t…
AndreaCalabro-AYES Jul 2, 2024
256508f
Docker compose dev cleanup
AndreaCalabro-AYES Jul 2, 2024
436bb9b
Merge pull request #1 from AndreaCalabro-AYES/master
AndreaCalabro-AYES Jul 2, 2024
360e6f7
docker-compose file for target
AndreaCalabro-AYES Jul 2, 2024
5fff97d
WIP: mock up of the communication with the broker
AndreaCalabro-AYES Jul 2, 2024
4538ab0
FAce recognition README intro
AndreaCalabro-AYES Jul 3, 2024
a780b4e
README v 0.1
AndreaCalabro-AYES Jul 3, 2024
010619c
face recognition algorithm refined to add and remove faces, need to p…
AndreaCalabro-AYES Jul 10, 2024
1afb304
Changed path for the encodings, I hope soon we'll get to aws
AndreaCalabro-AYES Jul 10, 2024
455aa9d
Encodings in the ayes model volume as well, makes it faster to develop
AndreaCalabro-AYES Jul 10, 2024
004702d
Removed pictures used to train old algo
AndreaCalabro-AYES Jul 10, 2024
f9684c5
Working instance of ayes mqtt class, yet to try with the raspberry!
AndreaCalabro-AYES Jul 10, 2024
5d2e643
Managing people moving around using the remove topic
AndreaCalabro-AYES Jul 10, 2024
4637002
First try to a volume-based solution for the raspberry pi
AndreaCalabro-AYES Jul 13, 2024
34dadcb
Move to common functions in both target and dev environment
AndreaCalabro-AYES Jul 13, 2024
e4f0802
Merge pull request #2 from AndreaCalabro-AYES/development
AndreaCalabro-AYES Jul 13, 2024
f1eca66
Reverted dockerfile
AndreaCalabro-AYES Jul 13, 2024
6b0de3d
Merge pull request #3 from AndreaCalabro-AYES/development
AndreaCalabro-AYES Jul 13, 2024
5371164
corrected docker compose version to use volumes on target
AndreaCalabro-AYES Jul 14, 2024
943cdd9
Adding the network and the connection
AndreaCalabro-AYES Jul 14, 2024
c6105a1
By default, don't print logs on target
AndreaCalabro-AYES Jul 14, 2024
b400735
Reverted to use the host network - ok for POC
AndreaCalabro-AYES Jul 14, 2024
02328d5
Merge pull request #4 from AndreaCalabro-AYES/development
AndreaCalabro-AYES Jul 14, 2024
3976162
Fix to communicate on target with bridge network
AndreaCalabro-AYES Jul 14, 2024
2490b87
Merge pull request #5 from AndreaCalabro-AYES/development
AndreaCalabro-AYES Jul 14, 2024
79798af
Bugfix for multiple recognized people in the same frame
AndreaCalabro-AYES Jul 17, 2024
1f187fd
Merge pull request #6 from AndreaCalabro-AYES/development
AndreaCalabro-AYES Jul 17, 2024
9fa08e9
Bugfix for retry next frame
AndreaCalabro-AYES Jul 18, 2024
8ac331c
Merge pull request #7 from AndreaCalabro-AYES/development
AndreaCalabro-AYES Jul 18, 2024
478c105
Increased logging for usb camera - bug on target
AndreaCalabro-AYES Jul 18, 2024
8a8cf5a
Increased logging for raspberry camera - bug on target
AndreaCalabro-AYES Jul 18, 2024
a393fad
Increased logging on target PR
AndreaCalabro-AYES Jul 18, 2024
f41782a
Bugfix for target - pt2
AndreaCalabro-AYES Jul 18, 2024
74f6e6a
Update facerec_on_rasp_usb_camera.py
AndreaCalabro-AYES Jul 18, 2024
1cfaa00
Update facerec_on_rasp_usb_camera.py
AndreaCalabro-AYES Jul 18, 2024
4a0e00e
Update facerec_on_rasp_usb_camera.py
AndreaCalabro-AYES Jul 18, 2024
4548d1a
Update facerec_on_rasp_usb_camera.py
AndreaCalabro-AYES Jul 18, 2024
2d47ce0
Update facerec_on_rasp_usb_camera.py
AndreaCalabro-AYES Jul 18, 2024
446d2eb
We'll go down
AndreaCalabro-AYES Jul 18, 2024
5eba900
I hope noone will ever see this
AndreaCalabro-AYES Jul 18, 2024
fba7150
WTF?
AndreaCalabro-AYES Jul 18, 2024
a1bde6d
Working script?
AndreaCalabro-AYES Jul 18, 2024
eb347f8
If I write the image it works?
AndreaCalabro-AYES Jul 18, 2024
90ab3a6
Merge pull request #9 from AndreaCalabro-AYES/master
AndreaCalabro-AYES Jul 18, 2024
a4a2619
Merge pull request #10 from AndreaCalabro-AYES/development
AndreaCalabro-AYES Jul 18, 2024
ce99ebb
Try to add new encoding - last test before D
AndreaCalabro-AYES Aug 2, 2024
96be225
New encoding for target - last test before D
AndreaCalabro-AYES Aug 2, 2024
05e9d21
Merge pull request #11 from AndreaCalabro-AYES/development
AndreaCalabro-AYES Aug 2, 2024
e4e1e87
Removed last encoding, increased strictness of the algorithm to find …
AndreaCalabro-AYES Aug 7, 2024
4bd1d48
Merge pull request #12 from AndreaCalabro-AYES/development
AndreaCalabro-AYES Aug 7, 2024
a63ec23
Complete encodigns removal
AndreaCalabro-AYES Aug 7, 2024
b0d0a08
updated tolerances in the whole algorithm
AndreaCalabro-AYES Aug 7, 2024
e7e295d
Merge pull request #13 from AndreaCalabro-AYES/development
AndreaCalabro-AYES Aug 7, 2024
23e7855
Update README.md
AndreaCalabro-AYES Aug 26, 2024
6246f3e
New face encodings
ErwinCornetAyes Jan 10, 2025
67b5a25
Rework face recognition
ErwinCornetAyes Jan 22, 2025
c2d0586
Added Xander, Julien, Roberto, Bert, Sara and Erwin encodings
ErwinCornetAyes Feb 4, 2025
8253e82
Increase number of pictures per person to 10
ErwinCornetAyes Feb 4, 2025
7704470
Lower tolerance
ErwinCornetAyes Feb 14, 2025
d0136de
Update setup
ErwinCornetAyes Mar 10, 2025
03ca8bf
Fine tuning
ErwinCornetAyes Mar 28, 2025
6668d8d
enable autostart
ErwinCornetAyes Mar 28, 2025
94196ba
Wait until mqtt handler is running
ErwinCornetAyes Mar 28, 2025
3f66fa8
refactory
ErwinCornetAyes Mar 28, 2025
60bc1f3
Restart policy
ErwinCornetAyes Apr 2, 2025
a342334
Fix
ErwinCornetAyes Apr 2, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,9 @@ target/
.python-version

.idea/

# The ayes training model image
ayes_model/train_files
ayes_model/test_files
ayes_model/venv
ayes_model/encodings.json
52 changes: 0 additions & 52 deletions Dockerfile

This file was deleted.

89 changes: 89 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# Use a multi-architecture base image
FROM python:3.10.3-slim

RUN echo "Face recognition app dependencies - need to be reduced"
# Set the architecture-specific dependencies
RUN apt-get update && apt-get install -y --fix-missing \
build-essential \
cmake \
gfortran \
git \
wget \
curl \
graphicsmagick \
libgraphicsmagick1-dev \
libatlas-base-dev \
libavcodec-dev \
libavformat-dev \
libgtk2.0-dev \
libjpeg-dev \
liblapack-dev \
libswscale-dev \
pkg-config \
python3-dev \
python3-numpy \
software-properties-common \
zip


RUN echo "x11 server forwarding dependencies - need to scale up the containers architecture"
RUN apt-get update && apt-get install -y --fix-missing \
libx11-dev \
libgtk-3-dev \
libboost-python-dev \
x11-apps \
xauth \
imagemagick

RUN echo "The specific CPU $(uname -m)"
# Additional dependencies for Raspberry Pi (ARM)
RUN if [ '$(uname -m)' = "armv7l" ]; then \
echo "Installing ARM-specific dependencies"; \
apt-get update && apt-get install -y --fix-missing \
libopenblas-dev; \
fi

# Additional dependencies for x86 (Windows/Mac)
RUN if [ '$(uname -m)' = "x86_64" ]; then \
echo "Installing x86_64-specific dependencies"; \
apt-get update && apt-get install -y --fix-missing \
libopenblas-dev; \
fi




# Install dlib
RUN cd ~ && \
mkdir -p dlib && \
git clone -b 'v19.9' --single-branch https://github.com/davisking/dlib.git dlib/ && \
cd dlib/ && \
# Downgrade NumPy and upgrade pybind11 https://github.com/pybind/pybind11/issues/5009
pip install numpy==1.26.4 && \
pip install pybind11==2.12.0 && \
python3 setup.py install --yes USE_AVX_INSTRUCTIONS


# Copy the face recognition app
COPY . /face_recognition
RUN cd face_recognition && \
pip3 install -r requirements.txt && \
python3 setup.py install


WORKDIR /face_recognition

RUN echo "Installing opencv"
RUN pip3 install opencv-python==4.9.0.80

RUN echo "Download the mqtt_client_ayes.py file"
# Download the mqtt_client_ayes.py file
RUN curl -o /face_recognition/ayes_model/mqtt_client_ayes.py https://raw.githubusercontent.com/AndreaCalabro-AYES/MQTT_Broker/main/mqtt_client_ayes.py

RUN echo "Ensure the current directory is in the PYTHONPATH"
# Ensure the current directory is in the PYTHONPATH
ENV PYTHONPATH "${PYTHONPATH}:/face_recognition/ayes_model"




2 changes: 1 addition & 1 deletion Dockerfile.gpu
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This is a sample Dockerfile you can modify to deploy your own app based on face_recognition on the GPU
# In order to run Docker in the GPU you will need to install Nvidia-Docker: https://github.com/NVIDIA/nvidia-docker

FROM nvidia/cuda:9.0-cudnn7-devel
FROM nvidia/cuda:12.4.1-runtime-rockylinux9

# Install face recognition dependencies

Expand Down
79 changes: 79 additions & 0 deletions Dockerfile.rasp
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Use the official Python image for ARM
FROM arm32v7/python:3.10-slim-bullseye

# Install build essentials and tools
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
cmake \
gfortran \
gcc \
python3 \
python3-dev \
musl-dev \
git \
wget \
curl \
software-properties-common \
zip \
graphicsmagick \
libgraphicsmagick1-dev \
libatlas-base-dev \
libavcodec-dev \
libavformat-dev \
libgtk2.0-dev \
libjpeg-dev \
liblapack-dev \
libswscale-dev \
pkg-config \
v4l-utils \
ffmpeg \
&& rm -rf /var/lib/apt/lists/*

# Install OpenBLAS
RUN apt-get update && apt-get install -y libopenblas-dev && rm -rf /var/lib/apt/lists/*

# Install OpenSSL development package
RUN apt-get update && apt-get install -y libssl-dev && rm -rf /var/lib/apt/lists/*

# Set environment variables for OpenBLAS
ENV LD_LIBRARY_PATH=/usr/lib/openblas:$LD_LIBRARY_PATH
ENV OPENBLAS_NUM_THREADS=1

# Install numpy and pybind11
RUN pip install numpy==1.26.4 pybind11==2.12.0

# Clone dlib repository
RUN cd /root && git clone -b 'v19.22' --single-branch https://github.com/davisking/dlib.git dlib

# Install dlib dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
python3-dev \
&& rm -rf /var/lib/apt/lists/*

# Build and install dlib
RUN cd /root/dlib && python3 setup.py install

# Set working directory
WORKDIR /root/face_recognition

COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY setup.py .
COPY setup.cfg .
COPY pyproject.toml .
COPY README.rst .
COPY HISTORY.rst .
COPY face_recognition/ .
COPY . .
RUN pip install --no-cache-dir .

RUN pip install --no-cache-dir opencv-python==4.9.0.80

# Import files
COPY mm_application/ ./mm_application/
RUN curl -o /root/face_recognition/mm_application/mqtt_client_ayes.py https://raw.githubusercontent.com/AndreaCalabro-AYES/MQTT_Broker/main/mqtt_client_ayes.py

# Ensure the current directory is in the PYTHONPATH
ENV PYTHONPATH "${PYTHONPATH}:/root/face_recognition/mm_application"

Loading