diff --git a/README.md b/README.md index bfde164..57ac9c7 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,29 @@ ## Intro -This project provides scripts inspired by [DeepFaceLab_Linux](https://github.com/lbfs/DeepFaceLab_Linux) to setup and run [DeepFaceLab](https://github.com/iperov/DeepFaceLab) on MacOS. +This project provides scripts inspired by [DeepFaceLab_Linux](https://github.com/nagadit/DeepFaceLab_Linux) to setup and run [DeepFaceLab](https://github.com/Smiril/DeepFaceLab_Apple-Silicon) on MacOS. You'll need `git`, `ffmpeg`, `python3` and python module `virtualenv` available to be able to execute these scripts. The scripts will create a virtual env sandbox and will install all necessary dependencies there, so your main installation of `python3` will be left intact. ## NOTE: Apple M1 chip -Currently there's limited support for Apple M1 laptops. You can do model training, but the XSeg editor currently does not work (the DeepFaceLab codebase is not compatible with PyQt6). +Currently there's limited support for Apple M1 laptops. You can do model training, and the XSeg editor currently does work (the DeepFaceLab codebase is not compatible with PyQt6 but with PyQt5). + +## NOTE: FULL RUN M1 + +``` + +cd scripts +./0_setup.sh +./0_patch.sh +./2_extract_images_from_video_data_src.sh +./3_extract_images_from_video_data_dst.sh +./4.1_data_src_extract_faces_S3FD.sh +./5.1_data_dst_extract_faces_S3FD.sh +./6_train_Quick96.sh +./7_convert_Quick96.sh +./8_converted_to_avi.sh + +``` ## Setup @@ -23,8 +40,8 @@ Check if you have it with `brew ls --versions hdf5`. Install it with `brew insta **Clone and setup** -1. Clone this repository (`git clone https://github.com/chychkan/DeepFaceLab_MacOS.git`) -2. Run script `./scripts/0_setup.sh` to get [DeepFaceLab](https://github.com/iperov/DeepFaceLab), create virtual env and install necessary Python dependencies. This may take several minutes to run. +1. Clone this repository (`git clone https://github.com/Smiril/DeepFaceLab_MacOS.git`) +2. Run script `./scripts/0_setup.sh` to get [DeepFaceLab](https://github.com/Smiril/DeepFaceLab_apple-Silicon.git), create virtual env and install necessary Python dependencies. This may take several minutes to run. Now you can put your `data_src.mp4` and `data_dst.mp4` files into the `workspace/` dir and start running scripts from the `scripts/` dir. diff --git a/requirements.txt b/requirements.txt index a06a1e0..4c4e71b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ numpy==1.21.4 opencv-contrib-python-headless==4.1.2.30 scipy==1.7.2 -tensorflow==2.7.0 +tensorflow==2.7.4 colorama==0.4.4 tqdm==4.62.3 ffmpeg-python==0.2.0 diff --git a/requirements_3.10.txt b/requirements_3.10.txt index bea7808..a0bc4a7 100644 --- a/requirements_3.10.txt +++ b/requirements_3.10.txt @@ -2,11 +2,11 @@ numpy==1.22.2 numexpr==2.8.1 opencv-python==4.5.5.62 scipy==1.8.0 -tensorflow==2.8.0 +tensorflow==2.8.4 colorama==0.4.4 tqdm==4.62.3 ffmpeg-python==0.2.0 Pillow==8.4.0 scikit-image==0.19.2 h5py==3.6.0 -PyQt5==5.15.4 +PyQt5==5.15.4 \ No newline at end of file diff --git a/requirements_3.10_arm64.txt b/requirements_3.10_arm64.txt new file mode 100644 index 0000000..67ae852 --- /dev/null +++ b/requirements_3.10_arm64.txt @@ -0,0 +1,100 @@ +psutil>=5.8.0 +numpy==1.23.3 +numexpr<=2.8.1 +opencv-python<=4.6.0.66 +scikit-image<=0.19.3 +scikit-learn<=1.0.2 +scipy<=1.8.1 +tifffile<=2022.5.4 +pyparsing==3.0.9 +pillow +tqdm<=4.64.0 +colorama<=0.4.4 +cython<=0.29.26 +PyWavelets<=1.3.0 +imageio<=2.19.3 +networkx<=2.8.4 +packaging<=21.3 +image +timm +PlL +moviepy +absl-py<=1.1.0 +astunparse +cachetools<=5.2.0 +certifi<=2022.6.15 +charset-normalizer<=2.1.0 +flatbuffers<=1.12 +gast +google-auth +google-auth-oauthlib<=0.4.6 +google-pasta<=0.2.0 +grpcio +h5py<=3.7.0 +idna<=3.3 +keras<=2.9.0 +keras-preprocessing +libclang<=14.0.1 +markdown<=3.3.7 +oauthlib<=3.2.0 +opt-einsum<=3.3.0 +pyasn1==0.4.8 +pyasn1-modules<=0.2.8 +requests<=2.28.1 +requests-oauthlib<=1.3.1 +rsa<=4.8 +six +Flask<=2.1.3 +Jinja2<=3.1.2 +Mako<=1.2.1 +MarkupSafe<=2.1.1 +alembic<=1.8.1 +click<=8.1.3 +cloudpickle<=2.1.0 +databricks-cli +docker<=5.0.3 +entrypoints<=0.4 +gitdb<=4.0.9 +gitpython<=3.1.27 +gunicorn<=20.1.0 +importlib-metadata<=4.12.0 +itsdangerous<=2.1.2 +mlflow<=1.27.0 +pandas<=1.4.3 +prometheus-client<=0.14.1 +prometheus-flask-exporter<=0.20.2 +pyjwt<=2.4.0 +python-dateutil<=2.8.2 +pytz<=2022.1 +pyyaml<=6.0 +querystring-parser<=1.2.4 +smmap<=5.0.0 +sqlalchemy<=1.4.39 +sqlparse<=0.4.2 +tabulate<=0.8.10 +websocket-client<=1.3.3 +zipp<=3.8.1 +tensorboard<=2.9.1 +tensorboard-data-server<=0.6.1 +tensorboard-plugin-wit<=1.8.1 +tensorflow-estimator<=2.9.0 +tensorflow-macos<=2.9.0 +tensorflow-metal +termcolor<=1.1.0 +typing-extensions<=4.3.0 +urllib3<=1.26.10 +werkzeug<=2.1.2 +wrapt<=1.14.1 +fastcluster>=1.2.4 +matplotlib>=3.5.1 +ffmpeg-python==0.2.0 +imageio-ffmpeg>=0.4.7 +ffmpy +torch<=1.12.0 +torchvision<=0.13.0 +torchaudio<=0.12.0 +insightface<=0.2.1 +ipython<=7.21.0 +PyQt5 +PyQt6<=6.2.3 +git+https://www.github.com/keras-team/keras-contrib.git diff --git a/requirements_3.11.txt b/requirements_3.11.txt new file mode 100644 index 0000000..fabec7a --- /dev/null +++ b/requirements_3.11.txt @@ -0,0 +1,12 @@ +numpy==1.22.2 +numexpr==2.8.1 +opencv-python==4.5.5.62 +scipy==1.8.0 +tensorflow==2.9.0 +colorama==0.4.4 +tqdm==4.62.3 +ffmpeg-python==0.2.0 +Pillow==8.4.0 +scikit-image==0.19.2 +h5py==3.6.0 +PyQt5==5.15.4 \ No newline at end of file diff --git a/requirements_3.11_arm64.txt b/requirements_3.11_arm64.txt new file mode 100644 index 0000000..fd8c72f --- /dev/null +++ b/requirements_3.11_arm64.txt @@ -0,0 +1,100 @@ +psutil>=5.8.0 +numpy==1.23.3 +numexpr<=2.8.1 +opencv-python<=4.6.0.66 +scikit-image<=0.19.3 +scikit-learn==1.4.1.post1 +scipy<=1.8.1 +tifffile<=2022.5.4 +pyparsing==3.0.9 +pillow +future +tqdm<=4.64.0 +colorama<=0.4.4 +cython<=0.29.26 +PyWavelets<=1.3.0 +imageio<=2.19.3 +networkx<=2.8.4 +packaging<=21.3 +image +timm +moviepy +absl-py<=1.1.0 +astunparse +cachetools<=5.2.0 +certifi<=2022.6.15 +charset-normalizer<=2.1.0 +flatbuffers<=23.5.26 +gast +google-auth +google-auth-oauthlib>=0.5.0 +google-pasta<=0.2.0 +grpcio +h5py<=3.7.0 +idna<=3.3 +keras<=2.15.0 +keras-preprocessing +libclang<=14.0.1 +markdown<=3.3.7 +oauthlib<=3.2.0 +opt-einsum<=3.3.0 +pyasn1==0.4.8 +pyasn1-modules<=0.2.8 +requests<=2.28.1 +requests-oauthlib<=1.3.1 +rsa<=4.8 +six +Flask<=2.1.3 +Jinja2<=3.1.2 +Mako<=1.2.1 +MarkupSafe<=2.1.1 +alembic<=1.8.1 +click<=8.1.3 +cloudpickle<=2.1.0 +databricks-cli +docker<=5.0.3 +entrypoints<=0.4 +gitdb<=4.0.9 +gitpython<=3.1.27 +gunicorn<=20.1.0 +importlib-metadata<=4.12.0 +itsdangerous<=2.1.2 +mlflow<=1.27.0 +pandas>1.3.3<=1.5.3 +prometheus-client<=0.14.1 +prometheus-flask-exporter<=0.20.2 +pyjwt<=2.4.0 +python-dateutil<=2.8.2 +pytz<=2022.1 +pyyaml<=6.0 +querystring-parser<=1.2.4 +smmap<=5.0.0 +sqlalchemy<=1.4.39 +sqlparse<=0.4.2 +tabulate<=0.8.10 +websocket-client<=1.3.3 +zipp<=3.8.1 +tensorboard<=2.15.0 +tensorboard-data-server<=0.8.0 +tensorboard-plugin-wit<=1.8.1 +tensorflow-estimator<=2.15.0 +tensorflow-macos<=2.15.0 +tensorflow-metal +termcolor<=1.1.0 +typing-extensions<=4.3.0 +urllib3<=1.26.10 +werkzeug<=2.1.2 +wrapt<=1.14.1 +fastcluster>=1.2.4 +matplotlib>=3.5.1 +ffmpeg-python==0.2.0 +imageio-ffmpeg>=0.4.7 +ffmpy +torch<=2.2.1 +torchvision<=0.17.1 +torchaudio<=2.2.1 +insightface<=0.2.1 +ipython<=7.21.0 +PyQt5 +PyQt6<=6.2.3 +git+https://www.github.com/keras-team/keras-contrib.git diff --git a/requirements_3.6.txt b/requirements_3.6.txt index b911a9b..cfbeb07 100644 --- a/requirements_3.6.txt +++ b/requirements_3.6.txt @@ -1,7 +1,7 @@ numpy==1.19.2 opencv-contrib-python-headless==4.1.2.30 scipy==1.5.4 -tensorflow==2.6.1 +tensorflow==2.6.2 colorama==0.4.4 tqdm==4.62.3 ffmpeg-python==0.2.0 diff --git a/requirements_3.9.txt b/requirements_3.9.txt index e10d38f..9e9f6be 100644 --- a/requirements_3.9.txt +++ b/requirements_3.9.txt @@ -1,7 +1,7 @@ numpy==1.21.4 opencv-contrib-python-headless==4.5.1.48 scipy==1.7.2 -tensorflow==2.7.0 +tensorflow==2.8.4 colorama==0.4.4 tqdm==4.62.3 ffmpeg-python==0.2.0 diff --git a/requirements_3.9_arm64.txt b/requirements_3.9_arm64.txt index c63501c..0cf1321 100644 --- a/requirements_3.9_arm64.txt +++ b/requirements_3.9_arm64.txt @@ -9,5 +9,5 @@ ffmpeg-python==0.2.0 Pillow==8.4.0 scikit-image==0.19.1 scipy==1.8.0 -tensorflow-macos==2.7.0 +tensorflow-macos==2.8.4 PyQt6==6.2.3 diff --git a/scripts/0_patch.sh b/scripts/0_patch.sh new file mode 100644 index 0000000..fce6237 --- /dev/null +++ b/scripts/0_patch.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +cd "$(dirname $0)/.." +eval "$(/opt/homebrew/bin/brew shellenv)" + +set -e + +source .dfl/deep/bin/activate + +set -e + +python3.11 -m pip install --upgrade pip numpy==1.23.3 numexpr opencv-python colorama tqdm future tensorflow-macos scipy pillow PyQt5 + +source .dfl/env/bin/activate + +set -e + +python3.10 -m pip install --upgrade pip numpy==1.23.3 numexpr opencv-python colorama tqdm future tensorflow-macos scipy pillow PyQt5 onnx protobuf>=3.12.2 + +cp -R .dfl/ffmpeg/ffmpeg .dfl/deep/lib/python3.11/site-packages/ + +echo "Done." diff --git a/scripts/0_setup.sh b/scripts/0_setup.sh index dea6d70..2226505 100755 --- a/scripts/0_setup.sh +++ b/scripts/0_setup.sh @@ -1,5 +1,6 @@ #!/usr/bin/env bash cd "$(dirname $0)/.." +eval "$(/opt/homebrew/bin/brew shellenv)" set -e @@ -7,29 +8,39 @@ mkdir -p .dfl mkdir -p workspace is_arm64() { - [ "$(uname -m)" == "arm64" ] + [ "$(uname -sm)" == "Darwin arm64" ] } -is_arm64 && echo "Running on Apple M1 chip" - if [ ! -d .dfl/DeepFaceLab ]; then echo "Cloning DeepFaceLab" - git clone --no-single-branch --depth 1 "https://github.com/chychkan/DeepFaceLab.git" .dfl/DeepFaceLab + git clone --no-single-branch --depth 1 "https://github.com/Smiril/DeepFaceLab_Apple-Silicon.git" .dfl/DeepFaceLab - if is_arm64; then - (cd .dfl/DeepFaceLab; git checkout support-arm64) - fi + (cd .dfl/DeepFaceLab; git checkout main) fi if [ ! -d .dfl/env ]; then - virtualenv -p python3 .dfl/env + echo "Cloning env python3.10" + git clone --no-single-branch --depth 1 "https://github.com/Smiril/env.git" .dfl/env + + (cd .dfl/env; git checkout main) fi -source .dfl/env/bin/activate +if [ ! -d .dfl/ffmpeg ]; then + echo "Cloning ffmpeg for python3.X" + git clone --no-single-branch --depth 1 "https://github.com/kkroening/ffmpeg-python.git" .dfl/ffmpeg -python -m pip install --upgrade pip + (cd .dfl/ffmpeg; git checkout master) +fi -version=$(python -V | cut -f 2 -d ' ' | cut -f 1,2 -d .) +if [ ! -d .dfl/deep ]; then + virtualenv -p python3.11 .dfl/deep +fi + +source .dfl/deep/bin/activate + +python3 -m pip install --upgrade pip + +version=$(python3 -V | cut -f 2 -d ' ' | cut -f 1,2 -d .) reqs_file='requirements.txt' version_suffix='' @@ -44,9 +55,9 @@ fi reqs_file="requirements${version_suffix}${architecture_suffix}.txt" -echo "Using $reqs_file for $(python -V)" +echo "Using $reqs_file for $(python3 -V)" -if is_arm64; then +if [ is_arm64 ] ; then if [[ -z "$(brew ls --versions hdf5)" ]]; then echo "ERROR: HDF5 needs to be installed to run DeepFaceLab on M1 chip." echo "You can install it with 'brew install hdf5'. For more details, see https://formulae.brew.sh/formula/hdf5" @@ -71,4 +82,6 @@ fi pip --no-cache-dir install -r $reqs_file +cp -R .dfl/ffmpeg/ffmpeg .dfl/deep/lib/python$(version)/site-packages/ + echo "Done." diff --git a/scripts/1_clean_workspace.sh b/scripts/1_clean_workspace.sh index cfe32f7..b5143d3 100755 --- a/scripts/1_clean_workspace.sh +++ b/scripts/1_clean_workspace.sh @@ -4,4 +4,4 @@ source scripts/env.sh rm -fr $WORKSPACE/data_src/* rm -fr $WORKSPACE/data_dst/* -rm -fr $WORKSPACE/model/* + diff --git a/scripts/2_extract_PNG_from_video_data_src.sh b/scripts/2_extract_PNG_from_video_data_src.sh new file mode 100755 index 0000000..33f1d24 --- /dev/null +++ b/scripts/2_extract_PNG_from_video_data_src.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +cd "$(dirname $0)/.." +source scripts/env.sh + +$DFL_PYTHON "$DFL_MAIN" videoed extract-video \ + --input-file "$DFL_WORKSPACE/data_src.*" \ + --output-dir "$DFL_WORKSPACE/data_src" + diff --git a/scripts/2_extract_images_from_video_data_src.sh b/scripts/2_extract_images_from_video_data_src.sh index 77e7417..4193195 100755 --- a/scripts/2_extract_images_from_video_data_src.sh +++ b/scripts/2_extract_images_from_video_data_src.sh @@ -2,6 +2,6 @@ cd "$(dirname $0)/.." source scripts/env.sh -python "$DFL_MAIN" videoed extract-video \ +$DFL_PYTHON "$DFL_MAIN" videoed extract-video \ --input-file "$WORKSPACE/data_src.*" \ - --output-dir "$WORKSPACE/data_src" + --output-dir "$WORKSPACE/data_src" diff --git a/scripts/3_extract_PNG_from_video_data_dst.sh b/scripts/3_extract_PNG_from_video_data_dst.sh new file mode 100755 index 0000000..02271db --- /dev/null +++ b/scripts/3_extract_PNG_from_video_data_dst.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +cd "$(dirname $0)/.." +source scripts/env.sh + +$DFL_PYTHON "$DFL_MAIN" videoed extract-video \ + --input-file "$DFL_WORKSPACE/data_dst.*" \ + --output-dir "$DFL_WORKSPACE/data_dst" + diff --git a/scripts/3_extract_images_from_video_data_dst.sh b/scripts/3_extract_images_from_video_data_dst.sh index a3f0d2e..bc204ef 100755 --- a/scripts/3_extract_images_from_video_data_dst.sh +++ b/scripts/3_extract_images_from_video_data_dst.sh @@ -2,6 +2,6 @@ cd "$(dirname $0)/.." source scripts/env.sh -python "$DFL_MAIN" videoed extract-video \ +$DFL_PYTHON "$DFL_MAIN" videoed extract-video \ --input-file "$WORKSPACE/data_dst.*" \ --output-dir "$WORKSPACE/data_dst" diff --git a/scripts/3_other_denoise_extracted_data_dst.sh b/scripts/3_other_denoise_extracted_data_dst.sh new file mode 100755 index 0000000..3c1afb6 --- /dev/null +++ b/scripts/3_other_denoise_extracted_data_dst.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +cd "$(dirname $0)/.." +source scripts/env.sh + +$DFL_PYTHON "$DFL_MAIN" videoed denoise-image-sequence \ + --input-dir "$DFL_WORKSPACE/data_dst" + diff --git a/scripts/4.1_data_src_extract_faces_MANUAL.sh b/scripts/4.1_data_src_extract_faces_MANUAL.sh index 60dc5c7..a3bcff1 100755 --- a/scripts/4.1_data_src_extract_faces_MANUAL.sh +++ b/scripts/4.1_data_src_extract_faces_MANUAL.sh @@ -2,7 +2,7 @@ cd "$(dirname $0)/.." source scripts/env.sh -python "$DFL_MAIN" extract \ +$DFL_PYTHON "$DFL_MAIN" extract \ --input-dir "$WORKSPACE/data_src" \ --output-dir "$WORKSPACE/data_src/aligned" \ --detector manual diff --git a/scripts/4.1_data_src_extract_faces_S3FD.sh b/scripts/4.1_data_src_extract_faces_S3FD.sh index 52226d8..8a906fb 100755 --- a/scripts/4.1_data_src_extract_faces_S3FD.sh +++ b/scripts/4.1_data_src_extract_faces_S3FD.sh @@ -2,7 +2,7 @@ cd "$(dirname $0)/.." source scripts/env.sh -python "$DFL_MAIN" extract \ +$DFL_PYTHON "$DFL_MAIN" extract \ --input-dir "$WORKSPACE/data_src" \ --output-dir "$WORKSPACE/data_src/aligned" \ --detector s3fd diff --git a/scripts/4.1_data_src_extract_faces_S3FD_+_manual_fix.sh b/scripts/4.1_data_src_extract_faces_S3FD_+_manual_fix.sh index 4b4574e..e8a3747 100755 --- a/scripts/4.1_data_src_extract_faces_S3FD_+_manual_fix.sh +++ b/scripts/4.1_data_src_extract_faces_S3FD_+_manual_fix.sh @@ -2,7 +2,7 @@ cd "$(dirname $0)/.." source scripts/env.sh -python "$DFL_MAIN" extract \ +$DFL_PYTHON "$DFL_MAIN" extract \ --input-dir "$WORKSPACE/data_src" \ --output-dir "$WORKSPACE/data_src/aligned" \ --detector s3fd \ diff --git a/scripts/4.2.0_data_src_sort_by_black.sh b/scripts/4.2.0_data_src_sort_by_black.sh new file mode 100755 index 0000000..0c47eb3 --- /dev/null +++ b/scripts/4.2.0_data_src_sort_by_black.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +cd "$(dirname $0)/.." +source scripts/env.sh + +$DFL_PYTHON "$DFL_MAIN" sort \ + --input-dir "$DFL_WORKSPACE/data_src/aligned" \ + --by black + diff --git a/scripts/4.2.1_data_src_sort_by_blur.sh b/scripts/4.2.1_data_src_sort_by_blur.sh new file mode 100755 index 0000000..c70ec40 --- /dev/null +++ b/scripts/4.2.1_data_src_sort_by_blur.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +cd "$(dirname $0)/.." +source scripts/env.sh + +$DFL_PYTHON "$DFL_MAIN" sort \ + --input-dir "$DFL_WORKSPACE/data_src/aligned" \ + --by blur + diff --git a/scripts/4.2.2_data_src_sort_by_similar_histogram.sh b/scripts/4.2.2_data_src_sort_by_similar_histogram.sh new file mode 100755 index 0000000..4e5afa0 --- /dev/null +++ b/scripts/4.2.2_data_src_sort_by_similar_histogram.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +cd "$(dirname $0)/.." +source scripts/env.sh + +$DFL_PYTHON "$DFL_MAIN" sort \ + --input-dir "$DFL_WORKSPACE/data_src/aligned" \ + --by hist + diff --git a/scripts/4.2.3_data_src_sort_by_one_face.sh b/scripts/4.2.3_data_src_sort_by_one_face.sh new file mode 100755 index 0000000..a16ddf0 --- /dev/null +++ b/scripts/4.2.3_data_src_sort_by_one_face.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +cd "$(dirname $0)/.." +source scripts/env.sh + +$DFL_PYTHON "$DFL_MAIN" sort \ + --input-dir "$DFL_WORKSPACE/data_src/aligned" \ + --by oneface + diff --git a/scripts/4.2.4_data_src_sort_by_face_pitch.sh b/scripts/4.2.4_data_src_sort_by_face_pitch.sh new file mode 100755 index 0000000..72cba70 --- /dev/null +++ b/scripts/4.2.4_data_src_sort_by_face_pitch.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +cd "$(dirname $0)/.." +source scripts/env.sh + +$DFL_PYTHON "$DFL_MAIN" sort \ + --input-dir "$DFL_WORKSPACE/data_src/aligned" \ + --by face-pitch + diff --git a/scripts/4.2.4_data_src_sort_by_face_yaw.sh b/scripts/4.2.4_data_src_sort_by_face_yaw.sh new file mode 100755 index 0000000..ed02be4 --- /dev/null +++ b/scripts/4.2.4_data_src_sort_by_face_yaw.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +cd "$(dirname $0)/.." +source scripts/env.sh + +$DFL_PYTHON "$DFL_MAIN" sort \ + --input-dir "$DFL_WORKSPACE/data_src/aligned" \ + --by face-yaw + diff --git a/scripts/4.2_data_src_sort.sh b/scripts/4.2_data_src_sort.sh index 62ca31b..06ba635 100755 --- a/scripts/4.2_data_src_sort.sh +++ b/scripts/4.2_data_src_sort.sh @@ -2,5 +2,5 @@ cd "$(dirname $0)/.." source scripts/env.sh -python "$DFL_MAIN" sort \ +$DFL_PYTHON "$DFL_MAIN" sort \ --input-dir "$WORKSPACE/data_src/aligned" diff --git a/scripts/4.2_data_src_util_faceset_enhance.sh b/scripts/4.2_data_src_util_faceset_enhance.sh index 7b11da0..6cbd7f1 100755 --- a/scripts/4.2_data_src_util_faceset_enhance.sh +++ b/scripts/4.2_data_src_util_faceset_enhance.sh @@ -2,5 +2,5 @@ cd "$(dirname $0)/.." source scripts/env.sh -python "$DFL_MAIN" facesettool enhance \ +$DFL_PYTHON "$DFL_MAIN" facesettool enhance \ --input-dir "$WORKSPACE/data_src/aligned" diff --git a/scripts/4.2_other_data_src_sort_by_brightness.sh b/scripts/4.2_other_data_src_sort_by_brightness.sh new file mode 100755 index 0000000..473bb9d --- /dev/null +++ b/scripts/4.2_other_data_src_sort_by_brightness.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +cd "$(dirname $0)/.." +source scripts/env.sh + + +$DFL_PYTHON "$DFL_MAIN" sort \ + --input-dir "$DFL_WORKSPACE/data_src/aligned" \ + --by brightness + diff --git a/scripts/4.2_other_data_src_sort_by_hue.sh b/scripts/4.2_other_data_src_sort_by_hue.sh new file mode 100755 index 0000000..70866fe --- /dev/null +++ b/scripts/4.2_other_data_src_sort_by_hue.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +cd "$(dirname $0)/.." +source scripts/env.sh + + +$DFL_PYTHON "$DFL_MAIN" sort \ + --input-dir "$DFL_WORKSPACE/data_src/aligned" \ + --by hue + diff --git a/scripts/4.2_other_data_src_sort_by_original_filename.sh b/scripts/4.2_other_data_src_sort_by_original_filename.sh new file mode 100755 index 0000000..5069180 --- /dev/null +++ b/scripts/4.2_other_data_src_sort_by_original_filename.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +cd "$(dirname $0)/.." +source scripts/env.sh + + +$DFL_PYTHON "$DFL_MAIN" sort \ + --input-dir "$DFL_WORKSPACE/data_src/aligned" \ + --by origname + diff --git a/scripts/4.2_other_data_src_util_add_landmarks_debug_images.sh b/scripts/4.2_other_data_src_util_add_landmarks_debug_images.sh new file mode 100755 index 0000000..7f4e128 --- /dev/null +++ b/scripts/4.2_other_data_src_util_add_landmarks_debug_images.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +cd "$(dirname $0)/.." +source scripts/env.sh + + +$DFL_PYTHON "$DFL_MAIN" util \ + --input-dir "$DFL_WORKSPACE/data_src/aligned" \ + --add-landmarks-debug-images + diff --git a/scripts/4.2_other_data_src_util_recover_original_filename.sh b/scripts/4.2_other_data_src_util_recover_original_filename.sh new file mode 100755 index 0000000..29620b4 --- /dev/null +++ b/scripts/4.2_other_data_src_util_recover_original_filename.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +cd "$(dirname $0)/.." +source scripts/env.sh + +$DFL_PYTHON "$DFL_MAIN" util \ + --input-dir "$DFL_WORKSPACE/data_src/aligned" \ + --recover-original-aligned-filename diff --git a/scripts/4_data_src_extract_faces_MANUAL.sh b/scripts/4_data_src_extract_faces_MANUAL.sh new file mode 100755 index 0000000..d96e546 --- /dev/null +++ b/scripts/4_data_src_extract_faces_MANUAL.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +cd "$(dirname $0)/.." +source scripts/env.sh + +$DFL_PYTHON "$DFL_MAIN" extract \ + --input-dir "$DFL_WORKSPACE/data_src" \ + --output-dir "$DFL_WORKSPACE/data_src/aligned" \ + --detector manual \ + --debug-dir "$DFL_WORKSPACE/data_src/aligned_debug" + diff --git a/scripts/4_data_src_extract_faces_S3FD_all_GPU.sh b/scripts/4_data_src_extract_faces_S3FD_all_GPU.sh new file mode 100644 index 0000000..e3a70eb --- /dev/null +++ b/scripts/4_data_src_extract_faces_S3FD_all_GPU.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +cd "$(dirname $0)/.." +source scripts/env.sh + +$DFL_PYTHON "$DFL_MAIN" extract \ + --input-dir "$DFL_WORKSPACE/data_src" \ + --output-dir "$DFL_WORKSPACE/data_src/aligned" \ + --detector s3fd + diff --git a/scripts/4_data_src_extract_faces_S3FD_best_GPU.sh b/scripts/4_data_src_extract_faces_S3FD_best_GPU.sh new file mode 100644 index 0000000..e3a70eb --- /dev/null +++ b/scripts/4_data_src_extract_faces_S3FD_best_GPU.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +cd "$(dirname $0)/.." +source scripts/env.sh + +$DFL_PYTHON "$DFL_MAIN" extract \ + --input-dir "$DFL_WORKSPACE/data_src" \ + --output-dir "$DFL_WORKSPACE/data_src/aligned" \ + --detector s3fd + diff --git a/scripts/5.1_data_dst_extract_faces_MANUAL.sh b/scripts/5.1_data_dst_extract_faces_MANUAL.sh index 27ea6ae..2d8b038 100755 --- a/scripts/5.1_data_dst_extract_faces_MANUAL.sh +++ b/scripts/5.1_data_dst_extract_faces_MANUAL.sh @@ -2,7 +2,7 @@ cd "$(dirname $0)/.." source scripts/env.sh -python "$DFL_MAIN" extract \ +$DFL_PYTHON "$DFL_MAIN" extract \ --input-dir "$WORKSPACE/data_dst" \ --output-dir "$WORKSPACE/data_dst/aligned" \ --detector manual diff --git a/scripts/5.1_data_dst_extract_faces_S3FD.sh b/scripts/5.1_data_dst_extract_faces_S3FD.sh index dff6592..7f93281 100755 --- a/scripts/5.1_data_dst_extract_faces_S3FD.sh +++ b/scripts/5.1_data_dst_extract_faces_S3FD.sh @@ -2,7 +2,7 @@ cd "$(dirname $0)/.." source scripts/env.sh -python "$DFL_MAIN" extract \ +$DFL_PYTHON "$DFL_MAIN" extract \ --input-dir "$WORKSPACE/data_dst" \ --output-dir "$WORKSPACE/data_dst/aligned" \ --detector s3fd diff --git a/scripts/5.1_data_dst_extract_faces_S3FD_+_manual_fix.sh b/scripts/5.1_data_dst_extract_faces_S3FD_+_manual_fix.sh index 649ff16..1bcac5f 100755 --- a/scripts/5.1_data_dst_extract_faces_S3FD_+_manual_fix.sh +++ b/scripts/5.1_data_dst_extract_faces_S3FD_+_manual_fix.sh @@ -2,7 +2,7 @@ cd "$(dirname $0)/.." source scripts/env.sh -python "$DFL_MAIN" extract \ +$DFL_PYTHON "$DFL_MAIN" extract \ --input-dir "$WORKSPACE/data_dst" \ --output-dir "$WORKSPACE/data_dst/aligned" \ --detector s3fd \ diff --git a/scripts/5.2_data_dst_sort.sh b/scripts/5.2_data_dst_sort.sh index 25dfe4a..423c7fb 100755 --- a/scripts/5.2_data_dst_sort.sh +++ b/scripts/5.2_data_dst_sort.sh @@ -2,5 +2,5 @@ cd "$(dirname $0)/.." source scripts/env.sh -python "$DFL_MAIN" sort \ +$DFL_PYTHON "$DFL_MAIN" sort \ --input-dir "$WORKSPACE/data_dst/aligned" diff --git a/scripts/5.2_data_dst_sort_by_black.sh b/scripts/5.2_data_dst_sort_by_black.sh new file mode 100755 index 0000000..3e0c235 --- /dev/null +++ b/scripts/5.2_data_dst_sort_by_black.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +cd "$(dirname $0)/.." +source scripts/env.sh + +$DFL_PYTHON "$DFL_MAIN" sort \ + --input-dir "$DFL_WORKSPACE/data_dst/aligned" \ + --by black diff --git a/scripts/5.2_data_dst_sort_by_one_face.sh b/scripts/5.2_data_dst_sort_by_one_face.sh new file mode 100755 index 0000000..24aeca2 --- /dev/null +++ b/scripts/5.2_data_dst_sort_by_one_face.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +cd "$(dirname $0)/.." +source scripts/env.sh + +$DFL_PYTHON "$DFL_MAIN" sort \ + --input-dir "$DFL_WORKSPACE/data_dst/aligned" \ + --by oneface + diff --git a/scripts/5.2_data_dst_sort_by_similar_histogram.sh b/scripts/5.2_data_dst_sort_by_similar_histogram.sh new file mode 100755 index 0000000..9678bf5 --- /dev/null +++ b/scripts/5.2_data_dst_sort_by_similar_histogram.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +cd "$(dirname $0)/.." +source scripts/env.sh + +$DFL_PYTHON "$DFL_MAIN" sort \ + --input-dir "$DFL_WORKSPACE/data_dst/aligned" \ + --by hist + diff --git a/scripts/5.2_data_dst_util_faceset_enhance.sh b/scripts/5.2_data_dst_util_faceset_enhance.sh index ace4b43..13b488d 100755 --- a/scripts/5.2_data_dst_util_faceset_enhance.sh +++ b/scripts/5.2_data_dst_util_faceset_enhance.sh @@ -2,5 +2,5 @@ cd "$(dirname $0)/.." source scripts/env.sh -python "$DFL_MAIN" facesettool enhance \ +$DFL_PYTHON "$DFL_MAIN" facesettool enhance \ --input-dir "$WORKSPACE/data_dst/aligned" diff --git a/scripts/5.3_data_dst_sort_by_blur.sh b/scripts/5.3_data_dst_sort_by_blur.sh new file mode 100755 index 0000000..67edc80 --- /dev/null +++ b/scripts/5.3_data_dst_sort_by_blur.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +cd "$(dirname $0)/.." +source scripts/env.sh + +$DFL_PYTHON "$DFL_MAIN" sort \ + --input-dir "$DFL_WORKSPACE/data_dst/aligned" \ + --by blur + diff --git a/scripts/5.3_data_dst_sort_by_dissimilar_histogram.sh b/scripts/5.3_data_dst_sort_by_dissimilar_histogram.sh new file mode 100755 index 0000000..e0ccfc9 --- /dev/null +++ b/scripts/5.3_data_dst_sort_by_dissimilar_histogram.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +cd "$(dirname $0)/.." +source scripts/env.sh + +$DFL_PYTHON "$DFL_MAIN" sort \ + --input-dir "$DFL_WORKSPACE/data_dst/aligned" \ + --by hist-dissim + diff --git a/scripts/5.3_data_dst_sort_by_face_pitch.sh b/scripts/5.3_data_dst_sort_by_face_pitch.sh new file mode 100755 index 0000000..555bdc5 --- /dev/null +++ b/scripts/5.3_data_dst_sort_by_face_pitch.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +cd "$(dirname $0)/.." +source scripts/env.sh + +$DFL_PYTHON "$DFL_MAIN" sort \ + --input-dir "$DFL_WORKSPACE/data_dst/aligned" \ + --by face-pitch + diff --git a/scripts/5.3_data_dst_sort_by_face_yaw.sh b/scripts/5.3_data_dst_sort_by_face_yaw.sh new file mode 100755 index 0000000..483a17b --- /dev/null +++ b/scripts/5.3_data_dst_sort_by_face_yaw.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +cd "$(dirname $0)/.." +source scripts/env.sh + +$DFL_PYTHON "$DFL_MAIN" sort \ + --input-dir "$DFL_WORKSPACE/data_dst/aligned" \ + --by face-yaw + diff --git a/scripts/5.3_data_dst_sort_by_original_filename.sh b/scripts/5.3_data_dst_sort_by_original_filename.sh new file mode 100755 index 0000000..1c3dc52 --- /dev/null +++ b/scripts/5.3_data_dst_sort_by_original_filename.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +cd "$(dirname $0)/.." +source scripts/env.sh + +$DFL_PYTHON "$DFL_MAIN" sort \ + --input-dir "$DFL_WORKSPACE/data_dst/aligned" \ + --by origname + diff --git a/scripts/5.3_other_data_dst_util_recover_original_filename.sh b/scripts/5.3_other_data_dst_util_recover_original_filename.sh new file mode 100755 index 0000000..57584c9 --- /dev/null +++ b/scripts/5.3_other_data_dst_util_recover_original_filename.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +cd "$(dirname $0)/.." +source scripts/env.sh + +$DFL_PYTHON "$DFL_MAIN" util \ + --input-dir "$DFL_WORKSPACE/data_dst/aligned" \ + --recover-original-aligned-filename diff --git a/scripts/5.4_data_dst_facesettool.sh b/scripts/5.4_data_dst_facesettool.sh new file mode 100755 index 0000000..1c82711 --- /dev/null +++ b/scripts/5.4_data_dst_facesettool.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +cd "$(dirname $0)/.." +source scripts/env.sh + +$DFL_PYTHON "$DFL_MAIN" facesettool enhance \ + --input-dir "$DFL_WORKSPACE/data_dst/aligned" diff --git a/scripts/5_XSeg_data_dst_mask_edit.sh b/scripts/5_XSeg_data_dst_mask_edit.sh index 72d3e14..75c59f6 100755 --- a/scripts/5_XSeg_data_dst_mask_edit.sh +++ b/scripts/5_XSeg_data_dst_mask_edit.sh @@ -2,5 +2,5 @@ cd "$(dirname $0)/.." source scripts/env.sh -python "$DFL_MAIN" xseg editor \ +$DFL_PYTHON "$DFL_MAIN" xseg editor \ --input-dir "$WORKSPACE/data_dst/aligned" diff --git a/scripts/5_XSeg_data_dst_mask_fetch.sh b/scripts/5_XSeg_data_dst_mask_fetch.sh index c26697f..f70688b 100755 --- a/scripts/5_XSeg_data_dst_mask_fetch.sh +++ b/scripts/5_XSeg_data_dst_mask_fetch.sh @@ -2,5 +2,5 @@ cd "$(dirname $0)/.." source scripts/env.sh -python "$DFL_MAIN" xseg fetch \ +$DFL_PYTHON "$DFL_MAIN" xseg fetch \ --input-dir "$WORKSPACE/data_dst/aligned" diff --git a/scripts/5_XSeg_data_dst_mask_remove.sh b/scripts/5_XSeg_data_dst_mask_remove.sh index e6321bb..f46869e 100755 --- a/scripts/5_XSeg_data_dst_mask_remove.sh +++ b/scripts/5_XSeg_data_dst_mask_remove.sh @@ -2,5 +2,5 @@ cd "$(dirname $0)/.." source scripts/env.sh -python "$DFL_MAIN" xseg remove_labels \ +$DFL_PYTHON "$DFL_MAIN" xseg remove_labels \ --input-dir "$WORKSPACE/data_dst/aligned" diff --git a/scripts/5_XSeg_data_dst_trained_mask_apply.sh b/scripts/5_XSeg_data_dst_trained_mask_apply.sh index 7743b48..1a19c7b 100755 --- a/scripts/5_XSeg_data_dst_trained_mask_apply.sh +++ b/scripts/5_XSeg_data_dst_trained_mask_apply.sh @@ -2,6 +2,6 @@ cd "$(dirname $0)/.." source scripts/env.sh -python "$DFL_MAIN" xseg apply \ +$DFL_PYTHON "$DFL_MAIN" xseg apply \ --input-dir "$WORKSPACE/data_dst/aligned" \ --model-dir "$WORKSPACE/model" diff --git a/scripts/5_XSeg_data_dst_trained_mask_remove.sh b/scripts/5_XSeg_data_dst_trained_mask_remove.sh index 4ec0b35..705d93d 100755 --- a/scripts/5_XSeg_data_dst_trained_mask_remove.sh +++ b/scripts/5_XSeg_data_dst_trained_mask_remove.sh @@ -2,5 +2,5 @@ cd "$(dirname $0)/.." source scripts/env.sh -python "$DFL_MAIN" xseg remove \ +$DFL_PYTHON "$DFL_MAIN" xseg remove \ --input-dir "$WORKSPACE/data_dst/aligned" diff --git a/scripts/5_XSeg_data_src_mask_edit.sh b/scripts/5_XSeg_data_src_mask_edit.sh index bc5b6a8..c7330cd 100755 --- a/scripts/5_XSeg_data_src_mask_edit.sh +++ b/scripts/5_XSeg_data_src_mask_edit.sh @@ -2,5 +2,5 @@ cd "$(dirname $0)/.." source scripts/env.sh -python "$DFL_MAIN" xseg editor \ +$DFL_PYTHON "$DFL_MAIN" xseg editor \ --input-dir "$WORKSPACE/data_src/aligned" diff --git a/scripts/5_XSeg_data_src_mask_fetch.sh b/scripts/5_XSeg_data_src_mask_fetch.sh index 2b973b0..cd2b43b 100755 --- a/scripts/5_XSeg_data_src_mask_fetch.sh +++ b/scripts/5_XSeg_data_src_mask_fetch.sh @@ -2,5 +2,5 @@ cd "$(dirname $0)/.." source scripts/env.sh -python "$DFL_MAIN" xseg fetch \ +$DFL_PYTHON "$DFL_MAIN" xseg fetch \ --input-dir "$WORKSPACE/data_src/aligned" diff --git a/scripts/5_XSeg_data_src_mask_remove.sh b/scripts/5_XSeg_data_src_mask_remove.sh index d467576..1d5e526 100755 --- a/scripts/5_XSeg_data_src_mask_remove.sh +++ b/scripts/5_XSeg_data_src_mask_remove.sh @@ -2,5 +2,5 @@ cd "$(dirname $0)/.." source scripts/env.sh -python "$DFL_MAIN" xseg remove_labels \ +$DFL_PYTHON "$DFL_MAIN" xseg remove_labels \ --input-dir "$WORKSPACE/data_src/aligned" diff --git a/scripts/5_XSeg_data_src_trained_mask_apply.sh b/scripts/5_XSeg_data_src_trained_mask_apply.sh index 9e1bc22..82d75e8 100755 --- a/scripts/5_XSeg_data_src_trained_mask_apply.sh +++ b/scripts/5_XSeg_data_src_trained_mask_apply.sh @@ -2,6 +2,6 @@ cd "$(dirname $0)/.." source scripts/env.sh -python "$DFL_MAIN" xseg apply \ +$DFL_PYTHON "$DFL_MAIN" xseg apply \ --input-dir "$WORKSPACE/data_src/aligned" \ --model-dir "$WORKSPACE/model" diff --git a/scripts/5_XSeg_data_src_trained_mask_remove.sh b/scripts/5_XSeg_data_src_trained_mask_remove.sh index 14b9a98..36f1994 100755 --- a/scripts/5_XSeg_data_src_trained_mask_remove.sh +++ b/scripts/5_XSeg_data_src_trained_mask_remove.sh @@ -2,5 +2,5 @@ cd "$(dirname $0)/.." source scripts/env.sh -python "$DFL_MAIN" xseg remove \ +$DFL_PYTHON "$DFL_MAIN" xseg remove \ --input-dir "$WORKSPACE/data_src/aligned" diff --git a/scripts/5_XSeg_train.sh b/scripts/5_XSeg_train.sh index 9965724..e2ae0b5 100755 --- a/scripts/5_XSeg_train.sh +++ b/scripts/5_XSeg_train.sh @@ -2,7 +2,7 @@ cd "$(dirname $0)/.." source scripts/env.sh -python "$DFL_MAIN" train \ +$DFL_PYTHON "$DFL_MAIN" train \ --training-data-src-dir "$WORKSPACE/data_src/aligned" \ --training-data-dst-dir "$WORKSPACE/data_dst/aligned" \ --model-dir "$WORKSPACE/model" \ diff --git a/scripts/5_data_dst_extract_faces_MANUAL.sh b/scripts/5_data_dst_extract_faces_MANUAL.sh new file mode 100755 index 0000000..681358b --- /dev/null +++ b/scripts/5_data_dst_extract_faces_MANUAL.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +cd "$(dirname $0)/.." +source scripts/env.sh + +$DFL_PYTHON "$DFL_MAIN" extract \ + --input-dir "$DFL_WORKSPACE/data_dst" \ + --output-dir "$DFL_WORKSPACE/data_dst/aligned" \ + --detector manual \ + --debug-dir "$DFL_WORKSPACE/data_dst/aligned_debug" diff --git a/scripts/5_data_dst_extract_faces_MANUAL_RE-EXTRACT_DELETED_RESULTS_DEBUG.sh b/scripts/5_data_dst_extract_faces_MANUAL_RE-EXTRACT_DELETED_RESULTS_DEBUG.sh new file mode 100755 index 0000000..9eb9d74 --- /dev/null +++ b/scripts/5_data_dst_extract_faces_MANUAL_RE-EXTRACT_DELETED_RESULTS_DEBUG.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +cd "$(dirname $0)/.." +source scripts/env.sh + +$DFL_PYTHON "$DFL_MAIN" extract \ + --input-dir "$DFL_WORKSPACE/data_dst" \ + --output-dir "$DFL_WORKSPACE/data_dst/aligned" \ + --detector manual \ + --manual-output-debug-fix \ + --debug-dir "$DFL_WORKSPACE/data_dst/aligned_debug" + diff --git a/scripts/5_data_dst_extract_faces_MT_all_GPU+manual_fix.sh b/scripts/5_data_dst_extract_faces_MT_all_GPU+manual_fix.sh new file mode 100644 index 0000000..90e9be8 --- /dev/null +++ b/scripts/5_data_dst_extract_faces_MT_all_GPU+manual_fix.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +cd "$(dirname $0)/.." +source scripts/env.sh + +$DFL_PYTHON "$DFL_MAIN" extract \ + --input-dir "$DFL_WORKSPACE/data_dst" \ + --output-dir "$DFL_WORKSPACE/data_dst/aligned" \ + --detector mt \ + --manual-fix \ + --debug-dir "$DFL_WORKSPACE/data_dst/aligned_debug" + diff --git a/scripts/5_data_dst_extract_faces_MT_all_GPU.sh b/scripts/5_data_dst_extract_faces_MT_all_GPU.sh new file mode 100644 index 0000000..0f9ca01 --- /dev/null +++ b/scripts/5_data_dst_extract_faces_MT_all_GPU.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +cd "$(dirname $0)/.." +source scripts/env.sh + +$DFL_PYTHON "$DFL_MAIN" extract \ + --input-dir "$DFL_WORKSPACE/data_dst" \ + --output-dir "$DFL_WORKSPACE/data_dst/aligned" \ + --detector mt \ + --debug-dir "$DFL_WORKSPACE/data_dst/aligned_debug" diff --git a/scripts/5_data_dst_extract_faces_MT_best_GPU.sh b/scripts/5_data_dst_extract_faces_MT_best_GPU.sh new file mode 100644 index 0000000..d9c01d5 --- /dev/null +++ b/scripts/5_data_dst_extract_faces_MT_best_GPU.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +cd "$(dirname $0)/.." +source scripts/env.sh + +$DFL_PYTHON "$DFL_MAIN" extract \ + --input-dir "$DFL_WORKSPACE/data_dst" \ + --detector mt \ + --debug-dir "$DFL_WORKSPACE/data_dst/aligned_debug" diff --git a/scripts/5_data_dst_extract_faces_S3FD_all_GPU+manual_fix.sh b/scripts/5_data_dst_extract_faces_S3FD_all_GPU+manual_fix.sh new file mode 100644 index 0000000..9780b86 --- /dev/null +++ b/scripts/5_data_dst_extract_faces_S3FD_all_GPU+manual_fix.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +cd "$(dirname $0)/.." +source scripts/env.sh + +$DFL_PYTHON "$DFL_MAIN" extract \ + --input-dir "$DFL_WORKSPACE/data_dst" \ + --output-dir "$DFL_WORKSPACE/data_dst/aligned" \ + --detector s3fd \ + --manual-fix + diff --git a/scripts/5_data_dst_extract_faces_S3FD_all_GPU.sh b/scripts/5_data_dst_extract_faces_S3FD_all_GPU.sh new file mode 100644 index 0000000..4e9bdcd --- /dev/null +++ b/scripts/5_data_dst_extract_faces_S3FD_all_GPU.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +cd "$(dirname $0)/.." +source scripts/env.sh + +$DFL_PYTHON "$DFL_MAIN" extract \ + --input-dir "$DFL_WORKSPACE/data_dst" \ + --output-dir "$DFL_WORKSPACE/data_dst/aligned" \ + --detector s3fd + diff --git a/scripts/5_data_dst_extract_faces_S3FD_best_GPU.sh b/scripts/5_data_dst_extract_faces_S3FD_best_GPU.sh new file mode 100644 index 0000000..4e9bdcd --- /dev/null +++ b/scripts/5_data_dst_extract_faces_S3FD_best_GPU.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +cd "$(dirname $0)/.." +source scripts/env.sh + +$DFL_PYTHON "$DFL_MAIN" extract \ + --input-dir "$DFL_WORKSPACE/data_dst" \ + --output-dir "$DFL_WORKSPACE/data_dst/aligned" \ + --detector s3fd + diff --git a/scripts/6_train_AMP.sh b/scripts/6_train_AMP.sh new file mode 100755 index 0000000..28462c0 --- /dev/null +++ b/scripts/6_train_AMP.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +cd "$(dirname $0)/.." +source scripts/env.sh + +$DFL_PYTHON "$DFL_MAIN" train \ + --training-data-src-dir "$DFL_WORKSPACE/data_src" \ + --training-data-dst-dir "$DFL_WORKSPACE/data_dst" \ + --model-dir "$DFL_WORKSPACE/model" \ + --model AMP \ + --cpu-only + diff --git a/scripts/6_train_DF.sh b/scripts/6_train_DF.sh new file mode 100755 index 0000000..e9e7992 --- /dev/null +++ b/scripts/6_train_DF.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +cd "$(dirname $0)/.." +source scripts/env.sh + +$DFL_PYTHON "$DFL_MAIN" train \ + --training-data-src-dir "$DFL_WORKSPACE/data_src" \ + --training-data-dst-dir "$DFL_WORKSPACE/data_dst" \ + --model-dir "$DFL_WORKSPACE/model" \ + --model DF \ + --cpu-only diff --git a/scripts/6_train_FANSegmentator.sh b/scripts/6_train_FANSegmentator.sh new file mode 100755 index 0000000..bdf057e --- /dev/null +++ b/scripts/6_train_FANSegmentator.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +cd "$(dirname $0)/.." +source scripts/env.sh + +$DFL_PYTHON "$DFL_MAIN" train \ + --training-data-src-dir "$DFL_WORKSPACE/data_src" \ + --training-data-dst-dir "$DFL_WORKSPACE/data_dst" \ + --model-dir "$DFL_WORKSPACE/model" \ + --model DEV_FANSEG + diff --git a/scripts/6_train_H128.sh b/scripts/6_train_H128.sh new file mode 100755 index 0000000..b9ea54e --- /dev/null +++ b/scripts/6_train_H128.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +cd "$(dirname $0)/.." +source scripts/env.sh + +$DFL_PYTHON "$DFL_MAIN" train \ + --training-data-src-dir "$DFL_WORKSPACE/data_src" \ + --training-data-dst-dir "$DFL_WORKSPACE/data_dst" \ + --model-dir "$DFL_WORKSPACE/model" \ + --model H128 + diff --git a/scripts/6_train_H64.sh b/scripts/6_train_H64.sh new file mode 100755 index 0000000..3e32837 --- /dev/null +++ b/scripts/6_train_H64.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +cd "$(dirname $0)/.." +source scripts/env.sh + +$DFL_PYTHON "$DFL_MAIN" train \ + --training-data-src-dir "$DFL_WORKSPACE/data_src" \ + --training-data-dst-dir "$DFL_WORKSPACE/data_dst" \ + --model-dir "$DFL_WORKSPACE/model" \ + --model H64 + diff --git a/scripts/6_train_LIAEF128.sh b/scripts/6_train_LIAEF128.sh new file mode 100755 index 0000000..5738e89 --- /dev/null +++ b/scripts/6_train_LIAEF128.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +cd "$(dirname $0)/.." +source scripts/env.sh + +$DFL_PYTHON "$DFL_MAIN" train \ + --training-data-src-dir "$DFL_WORKSPACE/data_src" \ + --training-data-dst-dir "$DFL_WORKSPACE/data_dst" \ + --model-dir "$DFL_WORKSPACE/model" \ + --model LIAEF128 + diff --git a/scripts/6_train_Quick96.sh b/scripts/6_train_Quick96.sh index ca8e9c8..bb48cd4 100755 --- a/scripts/6_train_Quick96.sh +++ b/scripts/6_train_Quick96.sh @@ -2,7 +2,7 @@ cd "$(dirname $0)/.." source scripts/env.sh -python "$DFL_MAIN" train \ +$DFL_PYTHON "$DFL_MAIN" train \ --training-data-src-dir "$WORKSPACE/data_src/aligned" \ --training-data-dst-dir "$WORKSPACE/data_dst/aligned" \ --model-dir "$WORKSPACE/model" \ diff --git a/scripts/6_train_SAE.sh b/scripts/6_train_SAE.sh new file mode 100755 index 0000000..fd0dd8a --- /dev/null +++ b/scripts/6_train_SAE.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +cd "$(dirname $0)/.." +source scripts/env.sh + +$DFL_PYTHON "$DFL_MAIN" train \ + --training-data-src-dir "$DFL_WORKSPACE/data_src" \ + --training-data-dst-dir "$DFL_WORKSPACE/data_dst" \ + --model-dir "$DFL_WORKSPACE/model" \ + --model SAE diff --git a/scripts/6_train_SAEHD.sh b/scripts/6_train_SAEHD.sh index 2be58f0..e7adf2c 100755 --- a/scripts/6_train_SAEHD.sh +++ b/scripts/6_train_SAEHD.sh @@ -2,7 +2,7 @@ cd "$(dirname $0)/.." source scripts/env.sh -python "$DFL_MAIN" train \ +$DFL_PYTHON "$DFL_MAIN" train \ --training-data-src-dir "$WORKSPACE/data_src/aligned" \ --training-data-dst-dir "$WORKSPACE/data_dst/aligned" \ --model-dir "$WORKSPACE/model" \ diff --git a/scripts/6_train_XSeg.sh b/scripts/6_train_XSeg.sh new file mode 100755 index 0000000..318f129 --- /dev/null +++ b/scripts/6_train_XSeg.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +cd "$(dirname $0)/.." +source scripts/env.sh + +$DFL_PYTHON "$DFL_MAIN" train \ + --training-data-src-dir "$DFL_WORKSPACE/data_src" \ + --training-data-dst-dir "$DFL_WORKSPACE/data_dst" \ + --model-dir "$DFL_WORKSPACE/model" \ + --model XSeg + diff --git a/scripts/7_convert_AMP.sh b/scripts/7_convert_AMP.sh new file mode 100755 index 0000000..692a00b --- /dev/null +++ b/scripts/7_convert_AMP.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +cd "$(dirname $0)/.." +source scripts/env.sh + +$DFL_PYTHON "$DFL_MAIN" merge \ + --input-dir "$DFL_WORKSPACE/data_dst" \ + --output-dir "$DFL_WORKSPACE/data_dst/merged" \ + --output-mask-dir "$DFL_WORKSPACE/data_dst/masked" \ + --aligned-dir "$DFL_WORKSPACE/data_dst/aligned" \ + --model-dir "$DFL_WORKSPACE/model" \ + --model AMP + diff --git a/scripts/7_convert_DF.sh b/scripts/7_convert_DF.sh new file mode 100755 index 0000000..4737542 --- /dev/null +++ b/scripts/7_convert_DF.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +cd "$(dirname $0)/.." +source scripts/env.sh + +$DFL_PYTHON "$DFL_MAIN" convert \ + --input-dir "$DFL_WORKSPACE/data_dst" \ + --output-dir "$DFL_WORKSPACE/data_dst/merged" \ + --aligned-dir "$DFL_WORKSPACE/data_dst/aligned" \ + --model-dir "$DFL_WORKSPACE/model" \ + --model DF + diff --git a/scripts/7_convert_H128.sh b/scripts/7_convert_H128.sh new file mode 100755 index 0000000..638139f --- /dev/null +++ b/scripts/7_convert_H128.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +cd "$(dirname $0)/.." +source scripts/env.sh + +$DFL_PYTHON "$DFL_MAIN" convert \ + --input-dir "$DFL_WORKSPACE/data_dst" \ + --output-dir "$DFL_WORKSPACE/data_dst/merged" \ + --aligned-dir "$DFL_WORKSPACE/data_dst/aligned" \ + --model-dir "$DFL_WORKSPACE/model" \ + --model H128 + diff --git a/scripts/7_convert_H64.sh b/scripts/7_convert_H64.sh new file mode 100755 index 0000000..ce41ad8 --- /dev/null +++ b/scripts/7_convert_H64.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +cd "$(dirname $0)/.." +source scripts/env.sh + +$DFL_PYTHON "$DFL_MAIN" convert \ + --input-dir "$DFL_WORKSPACE/data_dst" \ + --output-dir "$DFL_WORKSPACE/data_dst/merged" \ + --aligned-dir "$DFL_WORKSPACE/data_dst/aligned" \ + --model-dir "$DFL_WORKSPACE/model" \ + --model H64 \ + diff --git a/scripts/7_convert_LIAEF128.sh b/scripts/7_convert_LIAEF128.sh new file mode 100755 index 0000000..67d2ace --- /dev/null +++ b/scripts/7_convert_LIAEF128.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +cd "$(dirname $0)/.." +source scripts/env.sh + +$DFL_PYTHON "$DFL_MAIN" convert \ + --input-dir "$DFL_WORKSPACE/data_dst" \ + --output-dir "$DFL_WORKSPACE/data_dst/merged" \ + --aligned-dir "$DFL_WORKSPACE/data_dst/aligned" \ + --model-dir "$DFL_WORKSPACE/model" \ + --model LIAEF128 + diff --git a/scripts/7_convert_Quick96.sh b/scripts/7_convert_Quick96.sh new file mode 100755 index 0000000..9ef21d8 --- /dev/null +++ b/scripts/7_convert_Quick96.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +cd "$(dirname $0)/.." +source scripts/env.sh + +$DFL_PYTHON "$DFL_MAIN" merge \ + --input-dir "$DFL_WORKSPACE/data_src" \ + --output-dir "$DFL_WORKSPACE/data_dst/merged" \ + --output-mask-dir "$DFL_WORKSPACE/data_dst/masked" \ + --aligned-dir "$DFL_WORKSPACE/data_dst/aligned" \ + --model-dir "$DFL_WORKSPACE/model" \ + --model Quick96 + diff --git a/scripts/7_convert_SAE.sh b/scripts/7_convert_SAE.sh new file mode 100755 index 0000000..fbfe410 --- /dev/null +++ b/scripts/7_convert_SAE.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +cd "$(dirname $0)/.." +source scripts/env.sh + +$DFL_PYTHON "$DFL_MAIN" convert \ + --input-dir "$DFL_WORKSPACE/data_dst" \ + --output-dir "$DFL_WORKSPACE/data_dst/merged" \ + --aligned-dir "$DFL_WORKSPACE/data_dst/aligned" \ + --model-dir "$DFL_WORKSPACE/model" \ + --model SAE + diff --git a/scripts/7_convert_SAEHD.sh b/scripts/7_convert_SAEHD.sh new file mode 100755 index 0000000..68b0e6c --- /dev/null +++ b/scripts/7_convert_SAEHD.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +cd "$(dirname $0)/.." +source scripts/env.sh + +$DFL_PYTHON "$DFL_MAIN" convert \ + --input-dir "$DFL_WORKSPACE/data_dst" \ + --output-dir "$DFL_WORKSPACE/data_dst/merged" \ + --aligned-dir "$DFL_WORKSPACE/data_dst/aligned" \ + --model-dir "$DFL_WORKSPACE/model" \ + --model SAEHD + diff --git a/scripts/7_convert_XSeg.sh b/scripts/7_convert_XSeg.sh new file mode 100755 index 0000000..d17d5ad --- /dev/null +++ b/scripts/7_convert_XSeg.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +cd "$(dirname $0)/.." +source scripts/env.sh + +$DFL_PYTHON "$DFL_MAIN" convert \ + --input-dir "$DFL_WORKSPACE/data_dst" \ + --output-dir "$DFL_WORKSPACE/data_dst/merged" \ + --aligned-dir "$DFL_WORKSPACE/data_dst/aligned" \ + --model-dir "$DFL_WORKSPACE/model" \ + --model XSeg + diff --git a/scripts/7_merge_Quick96.sh b/scripts/7_merge_Quick96.sh deleted file mode 100755 index f59aa53..0000000 --- a/scripts/7_merge_Quick96.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash -cd "$(dirname $0)/.." -source scripts/env.sh - -python "$DFL_MAIN" merge \ - --input-dir "$WORKSPACE/data_dst" \ - --output-dir "$WORKSPACE/data_dst/merged" \ - --output-mask-dir "$WORKSPACE/data_dst/merged_mask" \ - --aligned-dir "$WORKSPACE/data_dst/aligned" \ - --model-dir "$WORKSPACE/model" \ - --model Quick96 diff --git a/scripts/7_merge_SAEHD.sh b/scripts/7_merge_SAEHD.sh deleted file mode 100755 index f7d91df..0000000 --- a/scripts/7_merge_SAEHD.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash -cd "$(dirname $0)/.." -source scripts/env.sh - -python "$DFL_MAIN" merge \ - --input-dir "$WORKSPACE/data_dst" \ - --output-dir "$WORKSPACE/data_dst/merged" \ - --output-mask-dir "$WORKSPACE/data_dst/merged_mask" \ - --aligned-dir "$WORKSPACE/data_dst/aligned" \ - --model-dir "$WORKSPACE/model" \ - --model SAEHD diff --git a/scripts/8_converted_to_avi.sh b/scripts/8_converted_to_avi.sh new file mode 100755 index 0000000..051c142 --- /dev/null +++ b/scripts/8_converted_to_avi.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +cd "$(dirname $0)/.." +source scripts/env.sh + +$DFL_PYTHON "$DFL_MAIN" videoed video-from-sequence \ + --input-dir "$DFL_WORKSPACE/data_dst/merged" \ + --output-file "$DFL_WORKSPACE/result.avi" \ + --include-audio \ + --reference-file "$DFL_WORKSPACE/data_dst.*" + diff --git a/scripts/8_converted_to_mov_lossless+alpha.sh b/scripts/8_converted_to_mov_lossless+alpha.sh new file mode 100755 index 0000000..be8e664 --- /dev/null +++ b/scripts/8_converted_to_mov_lossless+alpha.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +cd "$(dirname $0)/.." +source scripts/env.sh + +$DFL_PYTHON "$DFL_MAIN" videoed video-from-sequence \ + --input-dir "$DFL_WORKSPACE/data_dst/merged" \ + --output-file "$DFL_WORKSPACE/result.mov" \ + --reference-file "$DFL_WORKSPACE/data_dst.*" \ + --include-audio \ + --lossless + diff --git a/scripts/8_converted_to_mp4.sh b/scripts/8_converted_to_mp4.sh new file mode 100755 index 0000000..f698372 --- /dev/null +++ b/scripts/8_converted_to_mp4.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +cd "$(dirname $0)/.." +source scripts/env.sh + +$DFL_PYTHON "$DFL_MAIN" videoed video-from-sequence \ + --input-dir "$DFL_WORKSPACE/data_dst/merged" \ + --output-file "$DFL_WORKSPACE/result.mp4" \ + --include-audio \ + --reference-file "$DFL_WORKSPACE/data_dst.*" + diff --git a/scripts/8_converted_to_mp4_lossless+alpha.sh b/scripts/8_converted_to_mp4_lossless+alpha.sh new file mode 100755 index 0000000..d03d57b --- /dev/null +++ b/scripts/8_converted_to_mp4_lossless+alpha.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +cd "$(dirname $0)/.." +source scripts/env.sh + +$DFL_PYTHON "$DFL_MAIN" videoed video-from-sequence \ + --input-dir "$DFL_WORKSPACE/data_dst/merged" \ + --output-file "$DFL_WORKSPACE/result.mp4" \ + --reference-file "$DFL_WORKSPACE/data_dst.*" \ + --include-audio \ + --lossless + diff --git a/scripts/8_merged_to_mov_lossless.sh b/scripts/8_merged_to_mov_lossless.sh deleted file mode 100755 index 2d304de..0000000 --- a/scripts/8_merged_to_mov_lossless.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash -cd "$(dirname $0)/.." -source scripts/env.sh - -python "$DFL_MAIN" videoed video-from-sequence \ - --input-dir "$WORKSPACE/data_dst/merged" \ - --output-file "$WORKSPACE/result.mov" \ - --reference-file "$WORKSPACE/data_dst.*" \ - --include-audio \ - --lossless diff --git a/scripts/8_merged_to_mp4.sh b/scripts/8_merged_to_mp4.sh deleted file mode 100755 index f048453..0000000 --- a/scripts/8_merged_to_mp4.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash -cd "$(dirname $0)/.." -source scripts/env.sh - -python "$DFL_MAIN" videoed video-from-sequence \ - --input-dir "$WORKSPACE/data_dst/merged" \ - --output-file "$WORKSPACE/result.mp4" \ - --reference-file "$WORKSPACE/data_dst.*" \ - --include-audio diff --git a/scripts/8_merged_to_mp4_lossless.sh b/scripts/8_merged_to_mp4_lossless.sh deleted file mode 100755 index a7c5492..0000000 --- a/scripts/8_merged_to_mp4_lossless.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash -cd "$(dirname $0)/.." -source scripts/env.sh - -python "$DFL_MAIN" videoed video-from-sequence \ - --input-dir "$WORKSPACE/data_dst/merged" \ - --output-file "$WORKSPACE/result.mp4" \ - --reference-file "$WORKSPACE/data_dst.*" \ - --include-audio \ - --lossless diff --git a/scripts/env.sh b/scripts/env.sh index e4d31d6..caf2534 100644 --- a/scripts/env.sh +++ b/scripts/env.sh @@ -1,6 +1,32 @@ +#!/usr/bin/env bash +cd "$(dirname $0)/.." +eval "$(/opt/homebrew/bin/brew shellenv)" + +set -e + +DFL_PYTHON=python DFL_MAIN=.dfl/DeepFaceLab/main.py WORKSPACE=workspace +DFL_WORKSPACE=workspace -source .dfl/env/bin/activate +newpy () { echo "Will run in python3.11 mode"; } -set -e +oldpy () { echo "Will run in python3.10 mode"; } + +echo "Would you like to run script in python3.11 mode? (yes or no)" + +read yesorno + +if [ "$yesorno" = yes ]; then + newpy + source .dfl/deep/bin/activate + +elif [ "$yesorno" = no ]; then + oldpy + source .dfl/env/bin/activate +else + echo "Not a valid answer." + exit 1 +fi + +set -e diff --git a/scripts/xseg.sh b/scripts/xseg.sh index bc5b6a8..c7330cd 100755 --- a/scripts/xseg.sh +++ b/scripts/xseg.sh @@ -2,5 +2,5 @@ cd "$(dirname $0)/.." source scripts/env.sh -python "$DFL_MAIN" xseg editor \ +$DFL_PYTHON "$DFL_MAIN" xseg editor \ --input-dir "$WORKSPACE/data_src/aligned"