This commit is contained in:
YaoFANGUK
2023-10-25 16:38:16 +08:00
commit 2b9360c299
602 changed files with 152490 additions and 0 deletions

View 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 $@

View 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 \
$@

View 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 \
$@

View 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" ]

View 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" ]

View File

@@ -0,0 +1,5 @@
#!/bin/bash
BASEDIR="$(dirname $0)"
docker build -t windj007/lama:cuda111 -f "$BASEDIR/Dockerfile-cuda111" "$BASEDIR"

View File

@@ -0,0 +1,5 @@
#!/bin/bash
BASEDIR="$(dirname $0)"
docker build -t windj007/lama -f "$BASEDIR/Dockerfile" "$BASEDIR"

View File

@@ -0,0 +1,3 @@
#!/bin/bash
exec $@