Skip to content

Commit

Permalink
Merge pull request #20 from youansheng/dev
Browse files Browse the repository at this point in the history
add seg scripts.
  • Loading branch information
donnyyou committed Jan 18, 2019
2 parents fc963d1 + 67f8aec commit 3a51b2f
Show file tree
Hide file tree
Showing 8 changed files with 388 additions and 46 deletions.
23 changes: 0 additions & 23 deletions scripts/seg/ade20k/run_fs_pspnet_ade20k_seg.sh

This file was deleted.

65 changes: 65 additions & 0 deletions scripts/seg/ade20k/run_fs_res101_deeplabv3_ade20k_seg.sh
@@ -0,0 +1,65 @@
#!/usr/bin/env bash

# check the enviroment info
nvidia-smi
PYTHON="python"

export PYTHONPATH="/home/donny/Projects/PyTorchCV":${PYTHONPATH}

cd ../../../

DATA_DIR="/home/donny/DataSet/ADE20K"

BACKBONE="deepbase_resnet101_dilated8"
MODEL_NAME="deeplabv3"
CHECKPOINTS_NAME="fs_res101_deeplabv3_ade20k_seg"$2
PRETRAINED_MODEL="./pretrained_model/resnet101-imagenet.pth"

HYPES_FILE='hypes/seg/ade20k/fs_deeplabv3_ade20k_seg.json'
MAX_ITERS=40000
LOSS_TYPE="fs_auxce_loss"

LOG_DIR="./log/seg/ade20k/"
LOG_FILE="${LOG_DIR}${CHECKPOINTS_NAME}.log"

if [ ! -d ${LOG_DIR} ]; then
echo ${LOG_DIR}" not exists!!!"
make -p ${LOG_DIR}
fi


if [ "$1"x == "train"x ]; then
${PYTHON} -u main.py --hypes ${HYPES_FILE} --drop_last y --phase train --gathered n --loss_balance y \
--backbone ${BACKBONE} --model_name ${MODEL_NAME} --gpu 0 1 2 3 --log_to_file n \
--data_dir ${DATA_DIR} --loss_type ${LOSS_TYPE} --max_iters ${MAX_ITERS} \
--checkpoints_name ${CHECKPOINTS_NAME} --pretrained ${PRETRAINED_MODEL} > ${LOG_FILE} 2>&1

elif [ "$1"x == "resume"x ]; then
${PYTHON} -u main.py --hypes ${HYPES_FILE} --drop_last y --phase train --gathered n --loss_balance y \
--backbone ${BACKBONE} --model_name ${MODEL_NAME} --gpu 0 1 2 3 --log_to_file n\
--data_dir ${DATA_DIR} --loss_type ${LOSS_TYPE} --max_iters ${MAX_ITERS} \
--resume_continue y --resume ./checkpoints/seg/cityscapes/${CHECKPOINTS_NAME}_latest.pth \
--checkpoints_name ${CHECKPOINTS_NAME} --pretrained ${PRETRAINED_MODEL} >> ${LOG_FILE} 2>&1

elif [ "$1"x == "debug"x ]; then
${PYTHON} -u main.py --hypes ${HYPES_FILE}--phase debug --gpu 0 --log_to_file n > ${LOG_FILE} 2>&1

elif [ "$1"x == "val"x ]; then
${PYTHON} -u main.py --hypes ${HYPES_FILE} --phase test --gpu 0 --log_to_file n \
--backbone ${BACKBONE} --model_name ${MODEL_NAME} --checkpoints_name ${CHECKPOINTS_NAME} \
--resume ./checkpoints/seg/cityscapes/${CHECKPOINTS_NAME}_latest.pth \
--test_dir ${DATA_DIR}/val/image --out_dir val >> ${LOG_FILE} 2>&1
cd metrics/seg/
${PYTHON} -u ade20k_evaluator.py --hypes "../../"${HYPES_FILE} \
--pred_dir ../../results/cityscapes/test_dir/${CHECKPOINTS_NAME}/val/label \
--gt_dir ${DATA_DIR}/val/label >> "../../"${LOG_FILE} 2>&1

elif [ "$1"x == "test"x ]; then
${PYTHON} -u main.py --hypes ${HYPES_FILE} --phase test --gpu 0 --log_to_file n \
--backbone ${BACKBONE} --model_name ${MODEL_NAME} --checkpoints_name ${CHECKPOINTS_NAME} \
--resume ./checkpoints/seg/cityscapes/${CHECKPOINTS_NAME}_latest.pth \
--test_dir ${DATA_DIR}/test --out_dir test >> ${LOG_FILE} 2>&1

else
echo "$1"x" is invalid..."
fi
65 changes: 65 additions & 0 deletions scripts/seg/ade20k/run_fs_res101_pspnet_ade20k_seg.sh
@@ -0,0 +1,65 @@
#!/usr/bin/env bash

# check the enviroment info
nvidia-smi
PYTHON="python"

export PYTHONPATH="/home/donny/Projects/PyTorchCV":${PYTHONPATH}

cd ../../../

DATA_DIR="/home/donny/DataSet/ADE20K"

BACKBONE="deepbase_resnet101_dilated8"
MODEL_NAME="deeplabv3"
CHECKPOINTS_NAME="fs_res101_deeplabv3_ade20k_seg"$2
PRETRAINED_MODEL="./pretrained_model/resnet101-imagenet.pth"

HYPES_FILE='hypes/seg/ade20k/fs_deeplabv3_ade20k_seg.json'
MAX_ITERS=40000
LOSS_TYPE="fs_auxce_loss"

LOG_DIR="./log/seg/ade20k/"
LOG_FILE="${LOG_DIR}${CHECKPOINTS_NAME}.log"

if [ ! -d ${LOG_DIR} ]; then
echo ${LOG_DIR}" not exists!!!"
make -p ${LOG_DIR}
fi


if [ "$1"x == "train"x ]; then
${PYTHON} -u main.py --hypes ${HYPES_FILE} --drop_last y --phase train --gathered n --loss_balance y \
--backbone ${BACKBONE} --model_name ${MODEL_NAME} --gpu 0 1 2 3 --log_to_file n \
--data_dir ${DATA_DIR} --loss_type ${LOSS_TYPE} --max_iters ${MAX_ITERS} \
--checkpoints_name ${CHECKPOINTS_NAME} --pretrained ${PRETRAINED_MODEL} > ${LOG_FILE} 2>&1

elif [ "$1"x == "resume"x ]; then
${PYTHON} -u main.py --hypes ${HYPES_FILE} --drop_last y --phase train --gathered n --loss_balance y \
--backbone ${BACKBONE} --model_name ${MODEL_NAME} --gpu 0 1 2 3 --log_to_file n\
--data_dir ${DATA_DIR} --loss_type ${LOSS_TYPE} --max_iters ${MAX_ITERS} \
--resume_continue y --resume ./checkpoints/seg/cityscapes/${CHECKPOINTS_NAME}_latest.pth \
--checkpoints_name ${CHECKPOINTS_NAME} --pretrained ${PRETRAINED_MODEL} >> ${LOG_FILE} 2>&1

elif [ "$1"x == "debug"x ]; then
${PYTHON} -u main.py --hypes ${HYPES_FILE}--phase debug --gpu 0 --log_to_file n > ${LOG_FILE} 2>&1

elif [ "$1"x == "val"x ]; then
${PYTHON} -u main.py --hypes ${HYPES_FILE} --phase test --gpu 0 --log_to_file n \
--backbone ${BACKBONE} --model_name ${MODEL_NAME} --checkpoints_name ${CHECKPOINTS_NAME} \
--resume ./checkpoints/seg/cityscapes/${CHECKPOINTS_NAME}_latest.pth \
--test_dir ${DATA_DIR}/val/image --out_dir val >> ${LOG_FILE} 2>&1
cd metrics/seg/
${PYTHON} -u ade20k_evaluator.py --hypes "../../"${HYPES_FILE} \
--pred_dir ../../results/cityscapes/test_dir/${CHECKPOINTS_NAME}/val/label \
--gt_dir ${DATA_DIR}/val/label >> "../../"${LOG_FILE} 2>&1

elif [ "$1"x == "test"x ]; then
${PYTHON} -u main.py --hypes ${HYPES_FILE} --phase test --gpu 0 --log_to_file n \
--backbone ${BACKBONE} --model_name ${MODEL_NAME} --checkpoints_name ${CHECKPOINTS_NAME} \
--resume ./checkpoints/seg/cityscapes/${CHECKPOINTS_NAME}_latest.pth \
--test_dir ${DATA_DIR}/test --out_dir test >> ${LOG_FILE} 2>&1

else
echo "$1"x" is invalid..."
fi
65 changes: 65 additions & 0 deletions scripts/seg/ade20k/run_fs_res50_deeplabv3_ade20k_seg.sh
@@ -0,0 +1,65 @@
#!/usr/bin/env bash

# check the enviroment info
nvidia-smi
PYTHON="python"

export PYTHONPATH="/home/donny/Projects/PyTorchCV":${PYTHONPATH}

cd ../../../

DATA_DIR="/home/donny/DataSet/ADE20K"

BACKBONE="deepbase_resnet50_dilated8"
MODEL_NAME="deeplabv3"
CHECKPOINTS_NAME="fs_res50_deeplabv3_ade20k_seg"$2
PRETRAINED_MODEL="./pretrained_model/resnet50-imagenet.pth"

HYPES_FILE='hypes/seg/ade20k/fs_deeplabv3_ade20k_seg.json'
MAX_ITERS=40000
LOSS_TYPE="fs_auxce_loss"

LOG_DIR="./log/seg/ade20k/"
LOG_FILE="${LOG_DIR}${CHECKPOINTS_NAME}.log"

if [ ! -d ${LOG_DIR} ]; then
echo ${LOG_DIR}" not exists!!!"
make -p ${LOG_DIR}
fi


if [ "$1"x == "train"x ]; then
${PYTHON} -u main.py --hypes ${HYPES_FILE} --drop_last y --phase train --gathered n --loss_balance y \
--backbone ${BACKBONE} --model_name ${MODEL_NAME} --gpu 0 1 2 3 --log_to_file n \
--data_dir ${DATA_DIR} --loss_type ${LOSS_TYPE} --max_iters ${MAX_ITERS} \
--checkpoints_name ${CHECKPOINTS_NAME} --pretrained ${PRETRAINED_MODEL} > ${LOG_FILE} 2>&1

elif [ "$1"x == "resume"x ]; then
${PYTHON} -u main.py --hypes ${HYPES_FILE} --drop_last y --phase train --gathered n --loss_balance y \
--backbone ${BACKBONE} --model_name ${MODEL_NAME} --gpu 0 1 2 3 --log_to_file n\
--data_dir ${DATA_DIR} --loss_type ${LOSS_TYPE} --max_iters ${MAX_ITERS} \
--resume_continue y --resume ./checkpoints/seg/cityscapes/${CHECKPOINTS_NAME}_latest.pth \
--checkpoints_name ${CHECKPOINTS_NAME} --pretrained ${PRETRAINED_MODEL} >> ${LOG_FILE} 2>&1

elif [ "$1"x == "debug"x ]; then
${PYTHON} -u main.py --hypes ${HYPES_FILE}--phase debug --gpu 0 --log_to_file n > ${LOG_FILE} 2>&1

elif [ "$1"x == "val"x ]; then
${PYTHON} -u main.py --hypes ${HYPES_FILE} --phase test --gpu 0 --log_to_file n \
--backbone ${BACKBONE} --model_name ${MODEL_NAME} --checkpoints_name ${CHECKPOINTS_NAME} \
--resume ./checkpoints/seg/cityscapes/${CHECKPOINTS_NAME}_latest.pth \
--test_dir ${DATA_DIR}/val/image --out_dir val >> ${LOG_FILE} 2>&1
cd metrics/seg/
${PYTHON} -u ade20k_evaluator.py --hypes "../../"${HYPES_FILE} \
--pred_dir ../../results/cityscapes/test_dir/${CHECKPOINTS_NAME}/val/label \
--gt_dir ${DATA_DIR}/val/label >> "../../"${LOG_FILE} 2>&1

elif [ "$1"x == "test"x ]; then
${PYTHON} -u main.py --hypes ${HYPES_FILE} --phase test --gpu 0 --log_to_file n \
--backbone ${BACKBONE} --model_name ${MODEL_NAME} --checkpoints_name ${CHECKPOINTS_NAME} \
--resume ./checkpoints/seg/cityscapes/${CHECKPOINTS_NAME}_latest.pth \
--test_dir ${DATA_DIR}/test --out_dir test >> ${LOG_FILE} 2>&1

else
echo "$1"x" is invalid..."
fi
65 changes: 65 additions & 0 deletions scripts/seg/ade20k/run_fs_res50_pspnet_ade20k_seg.sh
@@ -0,0 +1,65 @@
#!/usr/bin/env bash

# check the enviroment info
nvidia-smi
PYTHON="python"

export PYTHONPATH="/home/donny/Projects/PyTorchCV":${PYTHONPATH}

cd ../../../

DATA_DIR="/home/donny/DataSet/ADE20K"

BACKBONE="deepbase_resnet50_dilated8"
MODEL_NAME="deeplabv3"
CHECKPOINTS_NAME="fs_res50_deeplabv3_ade20k_seg"$2
PRETRAINED_MODEL="./pretrained_model/resnet50-imagenet.pth"

HYPES_FILE='hypes/seg/ade20k/fs_deeplabv3_ade20k_seg.json'
MAX_ITERS=40000
LOSS_TYPE="fs_auxce_loss"

LOG_DIR="./log/seg/ade20k/"
LOG_FILE="${LOG_DIR}${CHECKPOINTS_NAME}.log"

if [ ! -d ${LOG_DIR} ]; then
echo ${LOG_DIR}" not exists!!!"
make -p ${LOG_DIR}
fi


if [ "$1"x == "train"x ]; then
${PYTHON} -u main.py --hypes ${HYPES_FILE} --drop_last y --phase train --gathered n --loss_balance y \
--backbone ${BACKBONE} --model_name ${MODEL_NAME} --gpu 0 1 2 3 --log_to_file n \
--data_dir ${DATA_DIR} --loss_type ${LOSS_TYPE} --max_iters ${MAX_ITERS} \
--checkpoints_name ${CHECKPOINTS_NAME} --pretrained ${PRETRAINED_MODEL} > ${LOG_FILE} 2>&1

elif [ "$1"x == "resume"x ]; then
${PYTHON} -u main.py --hypes ${HYPES_FILE} --drop_last y --phase train --gathered n --loss_balance y \
--backbone ${BACKBONE} --model_name ${MODEL_NAME} --gpu 0 1 2 3 --log_to_file n\
--data_dir ${DATA_DIR} --loss_type ${LOSS_TYPE} --max_iters ${MAX_ITERS} \
--resume_continue y --resume ./checkpoints/seg/cityscapes/${CHECKPOINTS_NAME}_latest.pth \
--checkpoints_name ${CHECKPOINTS_NAME} --pretrained ${PRETRAINED_MODEL} >> ${LOG_FILE} 2>&1

elif [ "$1"x == "debug"x ]; then
${PYTHON} -u main.py --hypes ${HYPES_FILE}--phase debug --gpu 0 --log_to_file n > ${LOG_FILE} 2>&1

elif [ "$1"x == "val"x ]; then
${PYTHON} -u main.py --hypes ${HYPES_FILE} --phase test --gpu 0 --log_to_file n \
--backbone ${BACKBONE} --model_name ${MODEL_NAME} --checkpoints_name ${CHECKPOINTS_NAME} \
--resume ./checkpoints/seg/cityscapes/${CHECKPOINTS_NAME}_latest.pth \
--test_dir ${DATA_DIR}/val/image --out_dir val >> ${LOG_FILE} 2>&1
cd metrics/seg/
${PYTHON} -u ade20k_evaluator.py --hypes "../../"${HYPES_FILE} \
--pred_dir ../../results/cityscapes/test_dir/${CHECKPOINTS_NAME}/val/label \
--gt_dir ${DATA_DIR}/val/label >> "../../"${LOG_FILE} 2>&1

elif [ "$1"x == "test"x ]; then
${PYTHON} -u main.py --hypes ${HYPES_FILE} --phase test --gpu 0 --log_to_file n \
--backbone ${BACKBONE} --model_name ${MODEL_NAME} --checkpoints_name ${CHECKPOINTS_NAME} \
--resume ./checkpoints/seg/cityscapes/${CHECKPOINTS_NAME}_latest.pth \
--test_dir ${DATA_DIR}/test --out_dir test >> ${LOG_FILE} 2>&1

else
echo "$1"x" is invalid..."
fi
64 changes: 64 additions & 0 deletions scripts/seg/cityscape/run_fs_deeplabv3_cityscapes_seg.sh
@@ -0,0 +1,64 @@
#!/usr/bin/env bash

# check the enviroment info
nvidia-smi
PYTHON="python"

export PYTHONPATH="/home/donny/Projects/PyTorchCV":${PYTHONPATH}

cd ../../../

DATA_DIR="/home/donny/DataSet/CityScape"

BACKBONE="deepbase_resnet101_dilated8"
MODEL_NAME="deeplabv3"
CHECKPOINTS_NAME="fs_deeplabv3_cityscapes_seg"$2
PRETRAINED_MODEL="./pretrained_model/resnet101-imagenet.pth"

HYPES_FILE='hypes/seg/cityscapes/fs_deeplabv3_cityscapes_seg.json'
MAX_ITERS=40000
LOSS_TYPE="fs_auxce_loss"

LOG_DIR="./log/seg/cityscapes/"
LOG_FILE="${LOG_DIR}${CHECKPOINTS_NAME}.log"

if [ ! -d ${LOG_DIR} ]; then
echo ${LOG_DIR}" not exists!!!"
make -p ${LOG_DIR}
fi


if [ "$1"x == "train"x ]; then
${PYTHON} -u main.py --hypes ${HYPES_FILE} --drop_last y --phase train --gathered n --loss_balance y \
--backbone ${BACKBONE} --model_name ${MODEL_NAME} --gpu 0 1 2 3 --log_to_file n \
--data_dir ${DATA_DIR} --loss_type ${LOSS_TYPE} --max_iters ${MAX_ITERS} \
--checkpoints_name ${CHECKPOINTS_NAME} --pretrained ${PRETRAINED_MODEL} > ${LOG_FILE} 2>&1

elif [ "$1"x == "resume"x ]; then
${PYTHON} -u main.py --hypes ${HYPES_FILE} --drop_last y --phase train --gathered n --loss_balance y \
--backbone ${BACKBONE} --model_name ${MODEL_NAME} --gpu 0 1 2 3 --log_to_file n\
--data_dir ${DATA_DIR} --loss_type ${LOSS_TYPE} --max_iters ${MAX_ITERS} \
--resume_continue y --resume ./checkpoints/seg/cityscapes/${CHECKPOINTS_NAME}_latest.pth \
--checkpoints_name ${CHECKPOINTS_NAME} --pretrained ${PRETRAINED_MODEL} >> ${LOG_FILE} 2>&1

elif [ "$1"x == "debug"x ]; then
${PYTHON} -u main.py --hypes ${HYPES_FILE}--phase debug --gpu 0 --log_to_file n > ${LOG_FILE} 2>&1

elif [ "$1"x == "val"x ]; then
${PYTHON} -u main.py --hypes ${HYPES_FILE} --phase test --gpu 0 --log_to_file n \
--backbone ${BACKBONE} --model_name ${MODEL_NAME} --checkpoints_name ${CHECKPOINTS_NAME} \
--resume ./checkpoints/seg/cityscapes/${CHECKPOINTS_NAME}_latest.pth \
--test_dir ${DATA_DIR}/val/image --out_dir val >> ${LOG_FILE} 2>&1
cd metrics/seg/
${PYTHON} -u cityscapes_evaluator.py --pred_dir ../../results/cityscapes/test_dir/${CHECKPOINTS_NAME}/val/label \
--gt_dir ${DATA_DIR}/val/label >> "../../"${LOG_FILE} 2>&1

elif [ "$1"x == "test"x ]; then
${PYTHON} -u main.py --hypes ${HYPES_FILE} --phase test --gpu 0 --log_to_file n \
--backbone ${BACKBONE} --model_name ${MODEL_NAME} --checkpoints_name ${CHECKPOINTS_NAME} \
--resume ./checkpoints/seg/cityscapes/${CHECKPOINTS_NAME}_latest.pth \
--test_dir ${DATA_DIR}/test --out_dir test >> ${LOG_FILE} 2>&1

else
echo "$1"x" is invalid..."
fi
23 changes: 0 additions & 23 deletions scripts/seg/cityscape/run_fs_pspnet_cityscape_seg.sh

This file was deleted.

0 comments on commit 3a51b2f

Please sign in to comment.