mirror of
https://github.com/iperov/DeepFaceLive
synced 2025-07-31 12:10:14 -07:00
Merge pull request #50 from CeeBeeEh/master
Linux compatibility changes
This commit is contained in:
commit
f2242f8ca3
3 changed files with 38 additions and 1 deletions
|
@ -55,12 +55,15 @@ class _DriverType(IntEnum):
|
||||||
DSHOW = 0
|
DSHOW = 0
|
||||||
MSMF = 1
|
MSMF = 1
|
||||||
GSTREAMER = 2
|
GSTREAMER = 2
|
||||||
|
OPENCV = 3
|
||||||
|
|
||||||
_DriverType_names = { _DriverType.DSHOW : 'DirectShow',
|
_DriverType_names = { _DriverType.DSHOW : 'DirectShow',
|
||||||
_DriverType.MSMF : 'Microsoft Media Foundation',
|
_DriverType.MSMF : 'Microsoft Media Foundation',
|
||||||
_DriverType.GSTREAMER : 'GStreamer',
|
_DriverType.GSTREAMER : 'GStreamer',
|
||||||
|
_DriverType.OPENCV : 'OpenCV',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class _RotationType(IntEnum):
|
class _RotationType(IntEnum):
|
||||||
ROTATION_0 = 0
|
ROTATION_0 = 0
|
||||||
ROTATION_90 = 1
|
ROTATION_90 = 1
|
||||||
|
@ -112,6 +115,7 @@ class CameraSourceWorker(BackendWorker):
|
||||||
cv_api = {_DriverType.DSHOW: cv2.CAP_DSHOW,
|
cv_api = {_DriverType.DSHOW: cv2.CAP_DSHOW,
|
||||||
_DriverType.MSMF: cv2.CAP_MSMF,
|
_DriverType.MSMF: cv2.CAP_MSMF,
|
||||||
_DriverType.GSTREAMER: cv2.CAP_GSTREAMER,
|
_DriverType.GSTREAMER: cv2.CAP_GSTREAMER,
|
||||||
|
_DriverType.OPENCV: 0,
|
||||||
}[state.driver]
|
}[state.driver]
|
||||||
|
|
||||||
vcap = cv2.VideoCapture(state.device_idx, cv_api)
|
vcap = cv2.VideoCapture(state.device_idx, cv_api)
|
||||||
|
|
|
@ -12,4 +12,9 @@ git clone DeepFaceLive
|
||||||
cd DeepFaceLive/build/linux/
|
cd DeepFaceLive/build/linux/
|
||||||
# start.sh builds and runs container with proper options, then example.sh will start DeepFaceLive with example options
|
# start.sh builds and runs container with proper options, then example.sh will start DeepFaceLive with example options
|
||||||
./start.sh
|
./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
|
||||||
```
|
```
|
||||||
|
|
|
@ -1,5 +1,33 @@
|
||||||
#!/bin/bash
|
#!/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"
|
||||||
|
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
|
||||||
|
echo $CAM0 $CAM1 $CAM2 $CAM3
|
||||||
|
;;
|
||||||
|
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
|
# Warning xhost + is overly permissive and will reduce system security. Edit as desired
|
||||||
docker build . -t deepfacelive
|
docker build . -t deepfacelive
|
||||||
xhost +
|
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/ $CAM0 $CAM1 $CAM2 $CAM3 --rm -it deepfacelive
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue