From 4259cee934fab7373fa90c94fed2d9e03dcf6863 Mon Sep 17 00:00:00 2001 From: chappie74 Date: Tue, 5 Dec 2023 16:44:48 -0400 Subject: [PATCH] updated requirements to be close to latest; up dated dockerfile --- Dockerfile | 107 +++++++++++++++++++++++++++-------------------- requirements.txt | 24 ++++++----- 2 files changed, 75 insertions(+), 56 deletions(-) diff --git a/Dockerfile b/Dockerfile index d85d5bc..3fe271f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,58 +1,75 @@ -# base image -FROM python:3.8.12 -LABEL org.opencontainers.image.source https://github.com/serengil/deepface +FROM nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu22.04 -# ----------------------------------- -# create required folder -RUN mkdir /app -RUN mkdir /app/deepface +RUN groupadd -r default && useradd -r -g default chappie -# ----------------------------------- -# switch to application directory -WORKDIR /app +ENV HOME=/home/chappie/app +ENV LANG C.UTF-8 +ENV LC_ALL C.UTF-8 +ENV PYTHONDONTWRITEBYTECODE=1 +ENV PYTHONUNBUFFERED=1 +ENV TZ=Asia/Kolkata +ENV DEBIAN_FRONTEND=noninteractive -# ----------------------------------- -# update image os + +WORKDIR $HOME + +RUN apt-get update && apt-get install -y \ + python3.11 python3-pip \ + nano gunicorn git + + +RUN ln -s /usr/bin/python3 /usr/bin/python + + +# # ----------------------------------- +# # create required folder +RUN mkdir $HOME/deepface + +# # ----------------------------------- +# # Copy required files from repo into image +COPY ./deepface $HOME/deepface +COPY ./api/app.py $HOME +COPY ./api/api.py $HOME +COPY ./api/routes.py $HOME +COPY ./api/service.py $HOME +COPY ./requirements.txt $HOME +COPY ./setup.py $HOME +COPY ./README.md $HOME + + +RUN python -m pip install --upgrade pip + +# # update image os RUN apt-get update -RUN apt-get install ffmpeg libsm6 libxext6 -y +RUN apt-get install ffmpeg libsm6 libxext6 libgl1 -y -# ----------------------------------- -# Copy required files from repo into image -COPY ./deepface /app/deepface -# even though we will use local requirements, this one is required to perform install deepface from source code -COPY ./requirements.txt /app/requirements.txt -COPY ./requirements_local /app/requirements_local.txt -COPY ./package_info.json /app/ -COPY ./setup.py /app/ -COPY ./README.md /app/ -# ----------------------------------- -# if you plan to use a GPU, you should install the 'tensorflow-gpu' package -# RUN pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host=files.pythonhosted.org tensorflow-gpu +# RUN chown -R chappie:default $HOME +# USER chappie + + +# # ----------------------------------- +# # if you plan to use a GPU, you should install the 'tensorflow-gpu' package +# RUN pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host=files.pythonhosted.org tensorflow + +# # ----------------------------------- +# # install deepface from pypi release (might be out-of-date) +# # RUN pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host=files.pythonhosted.org deepface +# # ----------------------------------- +# # install deepface from source code (always up-to-date) + -# if you plan to use face anti-spoofing, then activate this line -# RUN pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host=files.pythonhosted.org torch==2.1.2 -# ----------------------------------- -# install deepface from pypi release (might be out-of-date) -# RUN pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host=files.pythonhosted.org deepface -# ----------------------------------- -# install dependencies - deepface with these dependency versions is working -RUN pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host=files.pythonhosted.org -r /app/requirements_local.txt -# install deepface from source code (always up-to-date) RUN pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host=files.pythonhosted.org -e . -# ----------------------------------- -# some packages are optional in deepface. activate if your task depends on one. -# RUN pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host=files.pythonhosted.org cmake==3.24.1.1 -# RUN pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host=files.pythonhosted.org dlib==19.20.0 -# RUN pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host=files.pythonhosted.org lightgbm==2.3.1 +# # ----------------------------------- +# # some packages are optional in deepface. activate if your task depends on one. +# # RUN pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host=files.pythonhosted.org cmake==3.24.1.1 +# # RUN pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host=files.pythonhosted.org dlib==19.20.0 +# # RUN pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host=files.pythonhosted.org lightgbm==2.3.1 -# ----------------------------------- -# environment variables -ENV PYTHONUNBUFFERED=1 +# # RUN pip cache purge && rm $(basename $TF_URL) -# ----------------------------------- -# run the app (re-configure port if necessary) -WORKDIR /app/deepface/api/src +# # ----------------------------------- +# # run the app (re-configure port if necessary) EXPOSE 5000 CMD ["gunicorn", "--workers=1", "--timeout=3600", "--bind=0.0.0.0:5000", "app:create_app()"] diff --git a/requirements.txt b/requirements.txt index 8f40c82..f0d35d3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,15 +1,17 @@ -requests>=2.27.1 -numpy>=1.14.0 -pandas>=0.23.4 +numpy>=1.26.2 +pandas>=2.1.3 gdown>=3.10.1 tqdm>=4.30.0 -Pillow>=5.2.0 -opencv-python>=4.5.5.64 -tensorflow>=1.9.0 -keras>=2.2.0 -Flask>=1.1.2 -flask_cors>=4.0.1 -mtcnn>=0.1.0 -retina-face>=0.0.1 +Pillow==10.1.0 +opencv-python>=4.8.1.78 +tensorflow==2.14.0 +keras==2.14.0 +Flask>=3.0.0 +mtcnn>=0.1.1 +retina-face>=0.0.13 fire>=0.4.0 gunicorn>=20.1.0 +Deprecated>=1.2.13 +matplotlib~=3.8.2 +requests~=2.31.0 +setuptools~=68.0.0 \ No newline at end of file