Note:
- This tutorial requires access to Oracle Cloud. To sign up for a free account, see Get started with Oracle Cloud Infrastructure Free Tier.
- It uses example values for Oracle Cloud Infrastructure credentials, tenancy, and compartments. When completing your lab, substitute these values with ones specific to your cloud environment.
Install DeepFace on Ubuntu GPU HPC Instance in Oracle Cloud Infrastructure
Introduction
DeepFace is a software that uses Artificial intelligence (AI) for facial attribute recognition and analysis. This task requires a large processing capacity, in which Graphical Processor Unit (GPUs) are used. DeepFace can be used in several areas, such as: media, arts, education and so on without any threat to security and privacy.
Note: Oracle has no relationship with the DeepFace software. The purpose of this tutorial is to assist in the installation of the software based on successful tests carried out for an Oracle customer in the media sector.
Objective
- Install DeepFace on Ubuntu GPU HPC instance in Oracle Cloud Infrastructure.
Install DeepFace
-
Install Operating System (OS) dependencies.
$ sudo apt-get install libgl1-mesa-glx libegl1-mesa libxrandr2 libxrandr2 libxss1 libxcursor1 libxcomposite1 libasound2 libxi6 libxtst6 ffmpeg git libgtk2.0-dev '^ libxcb .\* -dev ' libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev xorg gnome
-
Install Miniconda.
$ rm - rf /home/ ubuntu /miniforge3 $ mkdir -P ~/miniconda3 $ wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda3/miniconda.sh $ bash ~/miniconda3/miniconda.sh -B -u -P ~/miniconda3 $ rm - rf ~/miniconda3/miniconda.sh $ ~/miniconda3/bin/conda init bash $ ~/miniconda3/bin/conda init zsh
-
Install DeepFace.
$ conda create -n deepfacelab -c main python=3.9 cudnn cudatoolkit $ conda activate deepfacelab $ git clone --depth 1 https://github.com/nagadit/DeepFaceLab_Linux.git $ cd DeepFaceLab_Linux $ git clone --depth 1 https://github.com/iperov/DeepFaceLab.git
-
Navigate to
/home/ubuntu/DeepFaceLab_Linux/DeepFaceLab/requirements-cuda.txt
and update therequirements-cuda.txt
file with the following content.tqdm numpy numexpr h5py ffmpeg-python scikit-image scipy colorama pyqt5 tf2onnx opencv-python-headless==4.5.1.48 opencv-python==4.5.1.48 flatbuffers pytest
-
Install the necessary packages for DeepFace to work.
$ pip install --upgrade pip $ python -m pip install -r requirements-cuda.txt $ pip install tensorflow[and-cuda]
-
Enable GPU support with TensorFlow.
$ pip install tensorflow-2.15.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Note: Download Tensorflow from here: Install TensorFlow with pip.
-
Test the GPU access.
$ python3 - c "import tensorflow as tf ; print( tf. config.list _physical_devices ('GPU'))"
-
Adjust the NumPy version for the DeepFace code to work correctly.
$ pip install numpy==1.23
-
Navigate to
/home/ubuntu/DeepFaceLab_Linux/scripts/env.sh
and edit theenv.sh
file. Change Python version to3.9
and delete the line referring to conda activation.export DFL_PYTHON="python3.9"
DeepFace is ready to run.
Acknowledgments
- Authors - Leandro Camargo (LAD A-Team), Douglas Silva (LAD A-Team)
More Learning Resources
Explore other labs on docs.oracle.com/learn or access more free learning content on the Oracle Learning YouTube channel. Additionally, visit education.oracle.com/learning-explorer to become an Oracle Learning Explorer.
For product documentation, visit Oracle Help Center.
Install DeepFace on Ubuntu GPU HPC Instance in Oracle Cloud Infrastructure
F98402-01
May 2024