From f6460d8900384ab15b3c38c860452c9ac50d8cee Mon Sep 17 00:00:00 2001 From: P-Light <20nss11@gmail.com> Date: Mon, 6 Sep 2021 23:14:08 +0300 Subject: [PATCH 1/4] parsing_model/checkpoint/79999_iter.pth added --- download-weights.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/download-weights.sh b/download-weights.sh index 54e6ea5c..9aba1396 100755 --- a/download-weights.sh +++ b/download-weights.sh @@ -7,3 +7,5 @@ wget --no-check-certificate "https://sh23tw.dm.files.1drv.com/y4mmGiIkNVigkSwOKD mkdir -p insightface_func/models unzip ./antelope.zip -d ./insightface_func/models/ rm antelope.zip +wget -P ./parsing_model/checkpoint https://github.com/neuralchen/SimSwap/releases/download/1.0/79999_iter.pth + From b00d3e3588641322f08d67756263e48639bfb6e6 Mon Sep 17 00:00:00 2001 From: P-Light <20nss11@gmail.com> Date: Mon, 6 Sep 2021 23:28:48 +0300 Subject: [PATCH 2/4] Dockerfile added --- Dockerfile | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..8eba9f05 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,78 @@ +ARG CUDA_VERSION=11.1 + +# onnxruntime-gpu requires cudnn +ARG CUDNN_VER=8 + +# See possible types: https://hub.docker.com/r/nvidia/cuda/tags?page=1&ordering=last_updated +ARG IMAGE_TYPE=runtime + +FROM nvidia/cuda:${CUDA_VERSION}-${IMAGE_TYPE}-ubuntu20.04 AS builder + +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt update && \ + apt install -y wget \ + && \ + apt autoremove -y && \ + apt clean -y + +# Install Miniconda See possible versions: https://repo.anaconda.com/miniconda/ +ARG CONDA_VERSION=3-py38_4.9.2 + +ARG CONDA_DIR=/opt/conda + +ENV PATH=$CONDA_DIR/bin:$PATH + +RUN wget -q -O ./miniconda.sh http://repo.continuum.io/miniconda/Miniconda${CONDA_VERSION}-Linux-x86_64.sh \ + && sh ./miniconda.sh -bfp $CONDA_DIR \ + && rm ./miniconda.sh + +WORKDIR /home + +COPY ./environment.yml ./environment.yml + +RUN conda env update -n base --prune --file ./environment.yml && \ + conda clean -ay && rm ./environment.yml + +FROM nvidia/cuda:${CUDA_VERSION}-cudnn${CUDNN_VER}-${IMAGE_TYPE}-ubuntu20.04 + +ARG CONDA_DIR=/opt/conda + +# Copy conda installation +COPY --from=builder /opt/conda $CONDA_DIR + +ENV PATH=$CONDA_DIR/bin:$PATH + +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt update && \ + apt install -y software-properties-common && \ + # the latest version of Git + add-apt-repository ppa:git-core/ppa && \ + apt update && \ + apt install -y --no-install-recommends \ + git ca-certificates wget unzip \ + libgl1-mesa-glx \ + && \ + apt autoremove -y && \ + apt clean -y + +WORKDIR /home + +ARG PROJECT_COMMIT_HASH=186a57aa96f6422a3043021602d3586641711186 + +RUN git clone --single-branch https://github.com/neuralchen/SimSwap.git && \ + cd ./SimSwap && \ + git checkout ${PROJECT_COMMIT_HASH} && \ + rm -rf .git && \ + ./download-weights.sh && \ + python test_video_swapsingle.py \ + --isTrain false --use_mask --name people \ + --Arc_path arcface_model/arcface_checkpoint.tar \ + --pic_a_path ./demo_file/Iron_man.jpg \ + --video_path ./demo_file/multi_people_1080p.mp4 \ + --output_path ./output/multi_test_swapsingle.mp4 \ + --temp_path ./temp_results + +WORKDIR /home/SimSwap + From 50cb1f1940c37e53041f3a6bc83c6b9f1576b0d4 Mon Sep 17 00:00:00 2001 From: P-Light <20nss11@gmail.com> Date: Mon, 6 Sep 2021 23:33:24 +0300 Subject: [PATCH 3/4] Dockerfile updated --- Dockerfile | 3 --- 1 file changed, 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8eba9f05..df316c44 100644 --- a/Dockerfile +++ b/Dockerfile @@ -59,11 +59,8 @@ RUN apt update && \ WORKDIR /home -ARG PROJECT_COMMIT_HASH=186a57aa96f6422a3043021602d3586641711186 - RUN git clone --single-branch https://github.com/neuralchen/SimSwap.git && \ cd ./SimSwap && \ - git checkout ${PROJECT_COMMIT_HASH} && \ rm -rf .git && \ ./download-weights.sh && \ python test_video_swapsingle.py \ From a9dceb94c7d54442885253c50524fcc21cd87fa6 Mon Sep 17 00:00:00 2001 From: P-Light <20nss11@gmail.com> Date: Wed, 8 Sep 2021 00:07:41 +0300 Subject: [PATCH 4/4] Dockerfile refactored, conda env added --- Dockerfile | 42 +++++++++++++++++------------------------- environment.yml | 16 ++++++++++++++++ 2 files changed, 33 insertions(+), 25 deletions(-) create mode 100644 environment.yml diff --git a/Dockerfile b/Dockerfile index df316c44..bcfeef5b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,12 +6,17 @@ ARG CUDNN_VER=8 # See possible types: https://hub.docker.com/r/nvidia/cuda/tags?page=1&ordering=last_updated ARG IMAGE_TYPE=runtime -FROM nvidia/cuda:${CUDA_VERSION}-${IMAGE_TYPE}-ubuntu20.04 AS builder +FROM nvidia/cuda:${CUDA_VERSION}-cudnn${CUDNN_VER}-${IMAGE_TYPE}-ubuntu20.04 AS builder ENV DEBIAN_FRONTEND=noninteractive RUN apt update && \ - apt install -y wget \ + apt install -y software-properties-common && \ + # the latest version of Git + add-apt-repository ppa:git-core/ppa && \ + apt update && \ + apt install -y --no-install-recommends \ + git ca-certificates wget unzip libgl1-mesa-glx \ && \ apt autoremove -y && \ apt clean -y @@ -32,7 +37,14 @@ WORKDIR /home COPY ./environment.yml ./environment.yml RUN conda env update -n base --prune --file ./environment.yml && \ - conda clean -ay && rm ./environment.yml + conda clean -ayf && rm ./environment.yml + +RUN git clone --single-branch https://github.com/neuralchen/SimSwap.git && \ + cd ./SimSwap && \ + rm -rf .git && \ + ./download-weights.sh && \ + wget -P ./parsing_model/checkpoint https://github.com/neuralchen/SimSwap/releases/download/1.0/79999_iter.pth + FROM nvidia/cuda:${CUDA_VERSION}-cudnn${CUDNN_VER}-${IMAGE_TYPE}-ubuntu20.04 @@ -46,30 +58,10 @@ ENV PATH=$CONDA_DIR/bin:$PATH ENV DEBIAN_FRONTEND=noninteractive RUN apt update && \ - apt install -y software-properties-common && \ - # the latest version of Git - add-apt-repository ppa:git-core/ppa && \ - apt update && \ - apt install -y --no-install-recommends \ - git ca-certificates wget unzip \ - libgl1-mesa-glx \ - && \ + apt install -y --no-install-recommends libgl1-mesa-glx && \ apt autoremove -y && \ apt clean -y -WORKDIR /home - -RUN git clone --single-branch https://github.com/neuralchen/SimSwap.git && \ - cd ./SimSwap && \ - rm -rf .git && \ - ./download-weights.sh && \ - python test_video_swapsingle.py \ - --isTrain false --use_mask --name people \ - --Arc_path arcface_model/arcface_checkpoint.tar \ - --pic_a_path ./demo_file/Iron_man.jpg \ - --video_path ./demo_file/multi_people_1080p.mp4 \ - --output_path ./output/multi_test_swapsingle.mp4 \ - --temp_path ./temp_results +COPY --from=builder /home/SimSwap /home/SimSwap WORKDIR /home/SimSwap - diff --git a/environment.yml b/environment.yml new file mode 100644 index 00000000..f0a7f9fe --- /dev/null +++ b/environment.yml @@ -0,0 +1,16 @@ +channels: + - defaults + - conda-forge + - pytorch +dependencies: + - numpy=1.20.2 + - opencv=4.5.0 + - pillow=8.2.0 + - moviepy + - pip=21.2.2 + - pip: + - insightface==0.2.1 + - onnxruntime-gpu==1.8.1 + - -f https://download.pytorch.org/whl/torch_stable.html + - torch==1.9.0+cu111 + - torchvision==0.10.0+cu111