以下是我尝试在 Anaconda 上运行 deepfacelive 后得到的结果。我使用的是 Windows 电脑。
(tudazdeep) C:\Users\owner\Desktop\DeepFaceLive-master>python main.py run DeepFaceLive--userdata-dirC:\Users\owner\Desktop\DeepFaceLive-master
usage: main.py run [-h] {DeepFaceLive} ...
main.py run: error: argument {DeepFaceLive}: invalid choice: 'DeepFaceLive--userdata-dirC:\\Users\\owner\\Desktop\\DeepFaceLive-master' (choose from 'DeepFaceLive')
尝试在我的Python上运行deepfacelive
我可以帮助您使用 Linux/Docker。有总比什么都没有好。
简短回答
cd /root
python main.py run DeepFaceLive --userdata-dir /data/
长答案
cd /root
mkdir -p /root/deepface.04/build/linux
mkdir -p /root/deepface.04/build/linux/data
#create the files below: data; example.sh; start.cpu.02.sh ; Dockerfile ; README.md
#run
docker build -t deepfacelive-cpu .
# Allow access to the X server
xhost +
#run
start.cpu.02.sh
#run
docker start deepfacelive-container
sleep 4
docker exec -it deepfacelive-container bash
#inside docker deepfacelive-container run
root@ce902a8d05f8:/app/DeepFaceLive# python main.py run DeepFaceLive --userdata-dir /data/
#check files
ls /root/deepface.04/build/linux
data
example.sh
start.cpu.02.sh
Dockerfile
README.md
Docker 文件。
# Start with the base image
FROM ubuntu:20.04
# Set the working directory
WORKDIR /app
# Set the ARG for non-interactive installation
ARG DEBIAN_FRONTEND=noninteractive
# Set timezone environment variable (e.g., "Etc/UTC" or your local timezone)
ENV TZ=Etc/UTC
# Update package list and install dependencies
RUN apt update && apt install -y \
tzdata \
libgl1-mesa-glx \
libegl1-mesa \
libxrandr2 \
libxss1 \
libxcursor1 \
libxcomposite1 \
libasound2 \
libxi6 \
libxtst6 \
curl \
ffmpeg \
git \
nano \
gnupg2 \
libsm6 \
wget \
unzip \
libxcb-icccm4 \
libxkbcommon-x11-0 \
libxcb-keysyms1 \
libxcb-render0 \
libxcb-render-util0 \
libxcb-image0 \
python3 \
python3-pip
# Install required Qt and X11 libraries
RUN apt update && apt install -y \
libx11-xcb1 \
libxcb1 \
libxcomposite1 \
libxkbcommon-x11-0 \
libxkbcommon0 \
libxcb-cursor0 \
libxcb-shape0 \
libxcb-shm0 \
libxcb-sync1 \
libxcb-xfixes0 \
libxcb-xinerama0 \
libxcb-xinput0 \
libxcb-xkb1
# Configure timezone data
RUN ln -fs /usr/share/zoneinfo/$TZ /etc/localtime && \
echo $TZ > /etc/timezone && \
dpkg-reconfigure --frontend noninteractive tzdata
# Create a symlink for python3
RUN ln -s /usr/bin/python3 /usr/bin/python
# Clone the DeepFaceLive repository
RUN git clone https://github.com/iperov/DeepFaceLive.git
# Upgrade pip and install required Python packages
RUN python -m pip install --upgrade pip
RUN python -m pip install \
onnxruntime==1.15.1 \
numpy==1.21.6 \
h5py \
numexpr \
protobuf==3.20.2 \
opencv-python==4.8.0.74 \
opencv-contrib-python==4.8.0.74 \
pyqt6==6.5.1 \
onnx==1.14.0 \
torch==1.13.1 \
torchvision==0.14.1
# Set the working directory for DeepFaceLive
WORKDIR /app/DeepFaceLive
# Copy the example script
COPY example.sh example.sh
# Uncomment the CMD line if you want to run the script by default
# CMD ./example.sh
启动.cpu.02.sh
#!/bin/bash
# Define the data folder path
DATA_FOLDER=$(pwd)/data/
# Declare variables for camera device mappings
declare CAM0 CAM1 CAM2 CAM3
# Check for available camera devices and set them up
test -e /dev/video0 && CAM0="--device=/dev/video0:/dev/video0"
test -e /dev/video1 && CAM1="--device=/dev/video1:/dev/video1"
test -e /dev/video2 && CAM2="--device=/dev/video2:/dev/video2"
test -e /dev/video3 && CAM3="--device=/dev/video3:/dev/video3"
# Output the detected camera devices
echo "Detected camera devices:" $CAM0 $CAM1 $CAM2 $CAM3
# Run the Docker container without GPU support. Only CPU support
docker run --name deepfacelive-container --ipc host -e DISPLAY=$DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v $DATA_FOLDER:/data/ \
$CAM0 $CAM1 $CAM2 $CAM3 \
deepfacelive-cpu \
#bash -c "python main.py run DeepFaceLive --userdata-dir /data/ && tail -f /dev/null"