From 8c8f0bfcc987f1eb54d52dc2a95215c73e342a9d Mon Sep 17 00:00:00 2001 From: chris Date: Thu, 17 Mar 2022 09:41:14 -0400 Subject: [PATCH 1/5] added "plain" OpenCV option --- apps/DeepFaceLive/backend/CameraSource.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/apps/DeepFaceLive/backend/CameraSource.py b/apps/DeepFaceLive/backend/CameraSource.py index 13c7471..aed94e8 100644 --- a/apps/DeepFaceLive/backend/CameraSource.py +++ b/apps/DeepFaceLive/backend/CameraSource.py @@ -55,12 +55,15 @@ class _DriverType(IntEnum): DSHOW = 0 MSMF = 1 GSTREAMER = 2 + OPENCV = 3 _DriverType_names = { _DriverType.DSHOW : 'DirectShow', _DriverType.MSMF : 'Microsoft Media Foundation', _DriverType.GSTREAMER : 'GStreamer', + _DriverType.OPENCV : 'OpenCV', } + class _RotationType(IntEnum): ROTATION_0 = 0 ROTATION_90 = 1 From e4da5697aebba9aab7e336f0c61ee2d6ba10253c Mon Sep 17 00:00:00 2001 From: chris Date: Thu, 17 Mar 2022 10:14:08 -0400 Subject: [PATCH 2/5] added options start script to specify data folder and to use camera devices --- build/linux/start.sh | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/build/linux/start.sh b/build/linux/start.sh index 159983f..eade46c 100755 --- a/build/linux/start.sh +++ b/build/linux/start.sh @@ -1,5 +1,32 @@ #!/bin/bash + +DATA_FOLDER=$(pwd)/data/ + +printf "\n" +while getopts 'cd:h' opt; do + case "$opt" in + c) + printf "Starting with camera devices\n" + CAMERA0=--device=/dev/video0:/dev/video0 + CAMERA1=--device=/dev/video1:/dev/video1 + CAMERA2=--device=/dev/video2:/dev/video2 + CAMERA3=--device=/dev/video3:/dev/video3 + ;; + d) + DATA_FOLDER="$OPTARG" + printf "Starting with data folder: %s\n" "$DATA_FOLDER" + ;; + + ?|h) + printf "Usage:\n$(basename $0) [-d] /path/to/your/data/folder\n" + exit 1 + ;; + esac +done +shift "$(($OPTIND -1))" +printf "\n" + # Warning xhost + is overly permissive and will reduce system security. Edit as desired docker build . -t deepfacelive xhost + -docker run --ipc host --gpus all -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix -v $(pwd)/data/:/data/ --rm -it deepfacelive +docker run --ipc host --gpus all -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix -v $DATA_FOLDER:/data/ $CAMERA0 $CAMERA1 $CAMERA2 $CAMERA3 --rm -it deepfacelive From 433e1ffaa6eda50b38272b6d62f098a0e6f24435 Mon Sep 17 00:00:00 2001 From: chris Date: Thu, 17 Mar 2022 10:27:11 -0400 Subject: [PATCH 3/5] added test to ensure video device exists --- build/linux/start.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/build/linux/start.sh b/build/linux/start.sh index eade46c..94b5fcb 100755 --- a/build/linux/start.sh +++ b/build/linux/start.sh @@ -1,16 +1,16 @@ #!/bin/bash DATA_FOLDER=$(pwd)/data/ - +declare CAM0 CAM1 CAM2 CAM3 printf "\n" while getopts 'cd:h' opt; do case "$opt" in c) printf "Starting with camera devices\n" - CAMERA0=--device=/dev/video0:/dev/video0 - CAMERA1=--device=/dev/video1:/dev/video1 - CAMERA2=--device=/dev/video2:/dev/video2 - CAMERA3=--device=/dev/video3:/dev/video3 + test -f /dev/video0 && CAM0=--device=/dev/video0:/dev/video0 + test -f /dev/video1 && CAM1=--device=/dev/video1:/dev/video1 + test -f /dev/video2 && CAM2=--device=/dev/video2:/dev/video2 + test -f /dev/video3 && CAM3=--device=/dev/video3:/dev/video3 ;; d) DATA_FOLDER="$OPTARG" @@ -29,4 +29,4 @@ printf "\n" # Warning xhost + is overly permissive and will reduce system security. Edit as desired docker build . -t deepfacelive xhost + -docker run --ipc host --gpus all -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix -v $DATA_FOLDER:/data/ $CAMERA0 $CAMERA1 $CAMERA2 $CAMERA3 --rm -it deepfacelive +docker run --ipc host --gpus all -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix -v $DATA_FOLDER:/data/ $CAM0 $CAM1 $CAM2 $CAM3 --rm -it deepfacelive From b17b79f4f4902bdb4c99eac3f3a681665c5c0b9f Mon Sep 17 00:00:00 2001 From: chris Date: Thu, 17 Mar 2022 10:30:43 -0400 Subject: [PATCH 4/5] updated Linux README --- build/linux/README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build/linux/README.md b/build/linux/README.md index a47de96..ff368cb 100644 --- a/build/linux/README.md +++ b/build/linux/README.md @@ -12,4 +12,9 @@ git clone DeepFaceLive cd DeepFaceLive/build/linux/ # start.sh builds and runs container with proper options, then example.sh will start DeepFaceLive with example options ./start.sh + +Usage of ./start.sh +# -d specify a folder for DeepFaceLive data (videos, models, etc) +-d /home/user/DeepFaceLive_data +# -c will pass through existing video devices such as /dev/video0 and /dev/video1, etc ``` From 86cb1320b67f027120d39b635c4561463e7edd3c Mon Sep 17 00:00:00 2001 From: chris Date: Thu, 17 Mar 2022 10:33:52 -0400 Subject: [PATCH 5/5] changed Dockerfile git address to CeeBeeEh, will need to be reverted for pull request --- build/linux/Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build/linux/Dockerfile b/build/linux/Dockerfile index 96c016d..10a5522 100644 --- a/build/linux/Dockerfile +++ b/build/linux/Dockerfile @@ -6,7 +6,8 @@ RUN apt -y install libgl1-mesa-glx libegl1-mesa libxrandr2 libxrandr2 libxss1 li RUN apt install -y python3 python3-pip RUN ln -s /usr/bin/python3 /usr/bin/python -RUN git clone https://github.com/iperov/DeepFaceLive.git +#RUN git clone https://github.com/iperov/DeepFaceLive.git +RUN git clone https://github.com/CeeBeeEh/DeepFaceLive.git RUN python -m pip install --upgrade pip RUN python -m pip install onnxruntime-gpu==1.10.0 numpy==1.21.5 h5py numexpr opencv-python==4.5.5.62 opencv-contrib-python==4.5.5.62 pyqt6==6.2.3 onnx==1.11.0 torch==1.8.1 torchvision==0.9.1