mirror of
https://github.com/YaoFANGUK/video-subtitle-remover.git
synced 2026-05-17 19:03:28 +08:00
init
This commit is contained in:
31
backend/inpaint/lama/docker/1_generate_masks_from_raw_images.sh
Executable file
31
backend/inpaint/lama/docker/1_generate_masks_from_raw_images.sh
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
|
||||
if (( $# < 3 ))
|
||||
then
|
||||
echo "Usage: $0 config_name input_images_dir image_mask_dataset_out_dir [other args to gen_mask_dataset.py]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
CURDIR="$(dirname $0)"
|
||||
SRCDIR="$CURDIR/.."
|
||||
SRCDIR="$(realpath $SRCDIR)"
|
||||
|
||||
CONFIG_LOCAL_PATH="$(realpath $1)"
|
||||
INPUT_LOCAL_DIR="$(realpath $2)"
|
||||
OUTPUT_LOCAL_DIR="$(realpath $3)"
|
||||
shift 3
|
||||
|
||||
mkdir -p "$OUTPUT_LOCAL_DIR"
|
||||
|
||||
docker run \
|
||||
-v "$SRCDIR":/home/user/project \
|
||||
-v "$CONFIG_LOCAL_PATH":/data/config.yaml \
|
||||
-v "$INPUT_LOCAL_DIR":/data/input \
|
||||
-v "$OUTPUT_LOCAL_DIR":/data/output \
|
||||
-u $(id -u):$(id -g) \
|
||||
--name="lama-mask-gen" \
|
||||
--rm \
|
||||
windj007/lama \
|
||||
/home/user/project/bin/gen_mask_dataset.py \
|
||||
/data/config.yaml /data/input /data/output $@
|
||||
35
backend/inpaint/lama/docker/2_predict.sh
Executable file
35
backend/inpaint/lama/docker/2_predict.sh
Executable file
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
|
||||
if (( $# < 3 ))
|
||||
then
|
||||
echo "Usage: $0 model_dir input_dir output_dir [other arguments to predict.py]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
CURDIR="$(dirname $0)"
|
||||
SRCDIR="$CURDIR/.."
|
||||
SRCDIR="$(realpath $SRCDIR)"
|
||||
|
||||
MODEL_LOCAL_DIR="$(realpath $1)"
|
||||
INPUT_LOCAL_DIR="$(realpath $2)"
|
||||
OUTPUT_LOCAL_DIR="$(realpath $3)"
|
||||
shift 3
|
||||
|
||||
mkdir -p "$OUTPUT_LOCAL_DIR"
|
||||
|
||||
docker run \
|
||||
-v "$SRCDIR":/home/user/project \
|
||||
-v "$MODEL_LOCAL_DIR":/data/checkpoint \
|
||||
-v "$INPUT_LOCAL_DIR":/data/input \
|
||||
-v "$OUTPUT_LOCAL_DIR":/data/output \
|
||||
-u $(id -u):$(id -g) \
|
||||
--name="lama-predict" \
|
||||
--rm \
|
||||
windj007/lama \
|
||||
/home/user/project/bin/predict.py \
|
||||
model.path=/data/checkpoint \
|
||||
indir=/data/input \
|
||||
outdir=/data/output \
|
||||
dataset.img_suffix=.png \
|
||||
$@
|
||||
35
backend/inpaint/lama/docker/3_evaluate.sh
Executable file
35
backend/inpaint/lama/docker/3_evaluate.sh
Executable file
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
|
||||
if (( $# < 3 ))
|
||||
then
|
||||
echo "Usage: $0 original_dataset_dir predictions_dir output_dir [other arguments to evaluate_predicts.py]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
CURDIR="$(dirname $0)"
|
||||
SRCDIR="$CURDIR/.."
|
||||
SRCDIR="$(realpath $SRCDIR)"
|
||||
|
||||
ORIG_DATASET_LOCAL_DIR="$(realpath $1)"
|
||||
PREDICTIONS_LOCAL_DIR="$(realpath $2)"
|
||||
OUTPUT_LOCAL_DIR="$(realpath $3)"
|
||||
shift 3
|
||||
|
||||
mkdir -p "$OUTPUT_LOCAL_DIR"
|
||||
|
||||
docker run \
|
||||
-v "$SRCDIR":/home/user/project \
|
||||
-v "$ORIG_DATASET_LOCAL_DIR":/data/orig_dataset \
|
||||
-v "$PREDICTIONS_LOCAL_DIR":/data/predictions \
|
||||
-v "$OUTPUT_LOCAL_DIR":/data/output \
|
||||
-u $(id -u):$(id -g) \
|
||||
--name="lama-eval" \
|
||||
--rm \
|
||||
windj007/lama \
|
||||
/home/user/project/bin/evaluate_predicts.py \
|
||||
/home/user/project/configs/eval2_cpu.yaml \
|
||||
/data/orig_dataset \
|
||||
/data/predictions \
|
||||
/data/output/metrics.yaml \
|
||||
$@
|
||||
38
backend/inpaint/lama/docker/Dockerfile
Normal file
38
backend/inpaint/lama/docker/Dockerfile
Normal file
@@ -0,0 +1,38 @@
|
||||
FROM nvidia/cuda:10.2-runtime-ubuntu18.04
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get upgrade -y && \
|
||||
apt-get install -y wget mc tmux nano build-essential rsync libgl1
|
||||
|
||||
ARG USERNAME=user
|
||||
RUN apt-get install -y sudo && \
|
||||
addgroup --gid 1000 $USERNAME && \
|
||||
adduser --uid 1000 --gid 1000 --disabled-password --gecos '' $USERNAME && \
|
||||
adduser $USERNAME sudo && \
|
||||
echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers && \
|
||||
USER=$USERNAME && \
|
||||
GROUP=$USERNAME
|
||||
|
||||
USER $USERNAME:$USERNAME
|
||||
WORKDIR "/home/$USERNAME"
|
||||
ENV PATH="/home/$USERNAME/miniconda3/bin:/home/$USERNAME/.local/bin:${PATH}"
|
||||
ENV PYTHONPATH="/home/$USERNAME/project"
|
||||
|
||||
RUN wget -O /tmp/miniconda.sh https://repo.anaconda.com/miniconda/Miniconda3-py39_4.9.2-Linux-x86_64.sh && \
|
||||
echo "536817d1b14cb1ada88900f5be51ce0a5e042bae178b5550e62f61e223deae7c /tmp/miniconda.sh" > /tmp/miniconda.sh.sha256 && \
|
||||
sha256sum --check --status < /tmp/miniconda.sh.sha256 && \
|
||||
bash /tmp/miniconda.sh -bt -p "/home/$USERNAME/miniconda3" && \
|
||||
rm /tmp/miniconda.sh && \
|
||||
conda build purge && \
|
||||
conda init
|
||||
|
||||
RUN pip install -U pip
|
||||
RUN pip install numpy scipy torch==1.8.1 torchvision opencv-python tensorflow joblib matplotlib pandas \
|
||||
albumentations==0.5.2 pytorch-lightning==1.2.9 tabulate easydict==1.9.0 kornia==0.5.0 webdataset \
|
||||
packaging gpustat tqdm pyyaml hydra-core==1.1.0.dev6 scikit-learn==0.24.2 tabulate
|
||||
RUN pip install scikit-image==0.17.2
|
||||
|
||||
ENV TORCH_HOME="/home/$USERNAME/.torch"
|
||||
|
||||
ADD entrypoint.sh /home/$USERNAME/.local/bin/entrypoint.sh
|
||||
ENTRYPOINT [ "entrypoint.sh" ]
|
||||
39
backend/inpaint/lama/docker/Dockerfile-cuda111
Normal file
39
backend/inpaint/lama/docker/Dockerfile-cuda111
Normal file
@@ -0,0 +1,39 @@
|
||||
FROM nvidia/cuda:11.1-runtime-ubuntu18.04
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get upgrade -y && \
|
||||
apt-get install -y wget mc tmux nano build-essential rsync libgl1
|
||||
|
||||
ARG USERNAME=user
|
||||
RUN apt-get install -y sudo && \
|
||||
addgroup --gid 1000 $USERNAME && \
|
||||
adduser --uid 1000 --gid 1000 --disabled-password --gecos '' $USERNAME && \
|
||||
adduser $USERNAME sudo && \
|
||||
echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers && \
|
||||
USER=$USERNAME && \
|
||||
GROUP=$USERNAME
|
||||
|
||||
USER $USERNAME:$USERNAME
|
||||
WORKDIR "/home/$USERNAME"
|
||||
ENV PATH="/home/$USERNAME/miniconda3/bin:/home/$USERNAME/.local/bin:${PATH}"
|
||||
ENV PYTHONPATH="/home/$USERNAME/project"
|
||||
|
||||
RUN wget -O /tmp/miniconda.sh https://repo.anaconda.com/miniconda/Miniconda3-py39_4.9.2-Linux-x86_64.sh && \
|
||||
echo "536817d1b14cb1ada88900f5be51ce0a5e042bae178b5550e62f61e223deae7c /tmp/miniconda.sh" > /tmp/miniconda.sh.sha256 && \
|
||||
sha256sum --check --status < /tmp/miniconda.sh.sha256 && \
|
||||
bash /tmp/miniconda.sh -bt -p "/home/$USERNAME/miniconda3" && \
|
||||
rm /tmp/miniconda.sh && \
|
||||
conda build purge && \
|
||||
conda init
|
||||
|
||||
RUN pip install -U pip
|
||||
RUN pip install torch==1.8.2+cu111 torchvision==0.9.2+cu111 -f https://download.pytorch.org/whl/lts/1.8/torch_lts.html
|
||||
RUN pip install numpy scipy opencv-python tensorflow joblib matplotlib pandas \
|
||||
albumentations==0.5.2 pytorch-lightning==1.2.9 tabulate easydict==1.9.0 kornia==0.5.0 webdataset \
|
||||
packaging gpustat tqdm pyyaml hydra-core==1.1.0.dev6 scikit-learn==0.24.2 tabulate
|
||||
RUN pip install scikit-image==0.17.2
|
||||
|
||||
ENV TORCH_HOME="/home/$USERNAME/.torch"
|
||||
|
||||
ADD entrypoint.sh /home/$USERNAME/.local/bin/entrypoint.sh
|
||||
ENTRYPOINT [ "entrypoint.sh" ]
|
||||
5
backend/inpaint/lama/docker/build-cuda111.sh
Executable file
5
backend/inpaint/lama/docker/build-cuda111.sh
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
BASEDIR="$(dirname $0)"
|
||||
|
||||
docker build -t windj007/lama:cuda111 -f "$BASEDIR/Dockerfile-cuda111" "$BASEDIR"
|
||||
5
backend/inpaint/lama/docker/build.sh
Executable file
5
backend/inpaint/lama/docker/build.sh
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
BASEDIR="$(dirname $0)"
|
||||
|
||||
docker build -t windj007/lama -f "$BASEDIR/Dockerfile" "$BASEDIR"
|
||||
3
backend/inpaint/lama/docker/entrypoint.sh
Executable file
3
backend/inpaint/lama/docker/entrypoint.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
exec $@
|
||||
Reference in New Issue
Block a user