Skip to content

Commit

Permalink
Refactor for publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
fcdl94 authored and fcdl94 committed Nov 22, 2021
1 parent ef8db9e commit b049338
Show file tree
Hide file tree
Showing 2 changed files with 139 additions and 0 deletions.
98 changes: 98 additions & 0 deletions run/coco-ms.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
#!/bin/bash

export CUDA_VISIBLE_DEVICES=$1
port=$(python get_free_port.py)
echo ${port}
alias exp="python -m torch.distributed.launch --master_port ${port} --nproc_per_node=1 run.py --num_workers 4"
shopt -s expand_aliases

ds=coco
task=$2 # 20-0, 20-1, 20-2, 20-3
# if you performed them for the SS experiment, comment the following!
exp --method FT --name FT --epochs 20 --lr 0.01 --batch_size 24
exp --method COS --name COS --epochs 20 --lr 0.01 --batch_size 24
exp --method SPN --name SPN --epochs 20 --lr 0.01 --batch_size 24
exp --method DWI --name DWI --epochs 20 --lr 0.01 --batch_size 24 --ckpt checkpoints/step/${task}-voc/COS_0.pth
exp --method RT --name RT --epochs 40 --lr 0.01 --batch_size 24 --ckpt checkpoints/step/${task}-voc/FT_0.pth --born_again

gen_par="--task ${task} --dataset ${ds} --batch_size 10"
lr=0.001
iter=1000
path=checkpoints/step/${task}-${ds}


# for 1 shot, disable the batch norm pooling on the deeplab head (or it'll throw errors) (--no_pooling)
for is in 0 1 2; do
inc_par="--ishot ${is} --input_mix novel --val_interval 1000 --ckpt_interval 5 --no_pooling"
ns=1

exp --method FT --name FT --iter ${iter} --lr ${lr} ${gen_par} ${inc_par} --step 1 --nshot ${ns} --step_ckpt ${path}/FT_0.pth

exp --method WI --name WI --iter 0 --lr ${lr} ${gen_par} ${inc_par} --step 1 --nshot ${ns} --step_ckpt ${path}/COS_0.pth
exp --method DWI --name DWI --iter 0 --lr ${lr} ${gen_par} ${inc_par} --step 1 --nshot ${ns} --step_ckpt ${path}/DWI_0.pth
exp --method RT --name RT --iter ${iter} --lr ${lr} ${gen_par} ${inc_par} --step 1 --nshot ${ns} --step_ckpt ${path}/RT_0.pth

exp --method SPN --name SPN --iter ${iter} --lr ${lr} ${gen_par} ${inc_par} --step 1 --nshot ${ns} --step_ckpt ${path}/SPN_0.pth
exp --method AMP --name AMP --iter 0 --lr ${lr} ${gen_par} ${inc_par} --step 1 --nshot ${ns} --step_ckpt ${path}/FT_0.pth

exp --method LWF --name LWF --iter ${iter} --lr ${lr} ${gen_par} ${inc_par} --step 1 --nshot ${ns} --step_ckpt ${path}/FT_0.pth
exp --method ILT --name ILT --iter ${iter} --lr ${lr} ${gen_par} ${inc_par} --step 1 --nshot ${ns} --step_ckpt ${path}/FT_0.pth
exp --method MIB --name MIB --iter ${iter} --lr ${lr} ${gen_par} ${inc_par} --step 1 --nshot ${ns} --step_ckpt ${path}/FT_0.pth

exp --method PIFS --name PIFS --iter ${iter} --lr ${lr} ${gen_par} ${inc_par} --step 1 --nshot ${ns} --step_ckpt ${path}/COS_0.pth

for s in 2 3 4 5; do
exp --method FT --name FT --iter ${iter} --lr ${lr} ${gen_par} ${inc_par} --step $s --nshot ${ns}

exp --method WI --name WI --iter 0 --lr ${lr} ${gen_par} ${inc_par} --step $s --nshot ${ns}
exp --method DWI --name DWI --iter 0 --lr ${lr} ${gen_par} ${inc_par} --step $s --nshot ${ns}
exp --method RT --name RT --iter ${iter} --lr ${lr} ${gen_par} ${inc_par} --step $s --nshot ${ns}

exp --method SPN --name SPN --iter ${iter} --lr ${lr} ${gen_par} ${inc_par} --step $s --nshot ${ns}
exp --method AMP --name AMP --iter 0 --lr ${lr} ${gen_par} ${inc_par} --step $s --nshot ${ns}

exp --method LWF --name LWF --iter ${iter} --lr ${lr} ${gen_par} ${inc_par} --step $s --nshot ${ns}
exp --method ILT --name ILT --iter ${iter} --lr ${lr} ${gen_par} ${inc_par} --step $s --nshot ${ns}
exp --method MIB --name MIB --iter ${iter} --lr ${lr} ${gen_par} ${inc_par} --step $s --nshot ${ns}

exp --method PIFS --name PIFS --iter ${iter} --lr ${lr} ${gen_par} ${inc_par} --step $s --nshot ${ns}
done
done

for ns in 2 5; do
for is in 0 1 2; do
inc_par="--ishot ${is} --input_mix novel --val_interval 1000 --ckpt_interval 5"

exp --method FT --name FT --iter ${iter} --lr ${lr} ${gen_par} ${inc_par} --step 1 --nshot ${ns} --step_ckpt ${path}/FT_0.pth

exp --method WI --name WI --iter 0 --lr ${lr} ${gen_par} ${inc_par} --step 1 --nshot ${ns} --step_ckpt ${path}/COS_0.pth
exp --method DWI --name DWI --iter 0 --lr ${lr} ${gen_par} ${inc_par} --step 1 --nshot ${ns} --step_ckpt ${path}/DWI_0.pth
exp --method RT --name RT --iter ${iter} --lr ${lr} ${gen_par} ${inc_par} --step 1 --nshot ${ns} --step_ckpt ${path}/RT_0.pth

exp --method SPN --name SPN --iter ${iter} --lr ${lr} ${gen_par} ${inc_par} --step 1 --nshot ${ns} --step_ckpt ${path}/SPN_0.pth
exp --method AMP --name AMP --iter 0 --lr ${lr} ${gen_par} ${inc_par} --step 1 --nshot ${ns} --step_ckpt ${path}/FT_0.pth

exp --method LWF --name LWF --iter ${iter} --lr ${lr} ${gen_par} ${inc_par} --step 1 --nshot ${ns} --step_ckpt ${path}/FT_0.pth
exp --method ILT --name ILT --iter ${iter} --lr ${lr} ${gen_par} ${inc_par} --step 1 --nshot ${ns} --step_ckpt ${path}/FT_0.pth
exp --method MIB --name MIB --iter ${iter} --lr ${lr} ${gen_par} ${inc_par} --step 1 --nshot ${ns} --step_ckpt ${path}/FT_0.pth

exp --method PIFS --name PIFS --iter ${iter} --lr ${lr} ${gen_par} ${inc_par} --step 1 --nshot ${ns} --step_ckpt ${path}/COS_0.pth

for s in 2 3 4 5; do
exp --method FT --name FT --iter ${iter} --lr ${lr} ${gen_par} ${inc_par} --step $s --nshot ${ns}

exp --method WI --name WI --iter 0 --lr ${lr} ${gen_par} ${inc_par} --step $s --nshot ${ns}
exp --method DWI --name DWI --iter 0 --lr ${lr} ${gen_par} ${inc_par} --step $s --nshot ${ns}
exp --method RT --name RT --iter ${iter} --lr ${lr} ${gen_par} ${inc_par} --step $s --nshot ${ns}

exp --method SPN --name SPN --iter ${iter} --lr ${lr} ${gen_par} ${inc_par} --step $s --nshot ${ns}
exp --method AMP --name AMP --iter 0 --lr ${lr} ${gen_par} ${inc_par} --step $s --nshot ${ns}

exp --method LWF --name LWF --iter ${iter} --lr ${lr} ${gen_par} ${inc_par} --step $s --nshot ${ns}
exp --method ILT --name ILT --iter ${iter} --lr ${lr} ${gen_par} ${inc_par} --step $s --nshot ${ns}
exp --method MIB --name MIB --iter ${iter} --lr ${lr} ${gen_par} ${inc_par} --step $s --nshot ${ns}

exp --method PIFS --name PIFS --iter ${iter} --lr ${lr} ${gen_par} ${inc_par} --step $s --nshot ${ns}
done
done
done
41 changes: 41 additions & 0 deletions run/coco-ss.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash

export CUDA_VISIBLE_DEVICES=$1
port=$(python get_free_port.py)
echo ${port}
alias exp="python -m torch.distributed.launch --master_port ${port} --nproc_per_node=1 run.py --num_workers 4"
shopt -s expand_aliases

ds=coco
task=$2

exp --method FT --name FT --epochs 20 --lr 0.01 --batch_size 24
exp --method COS --name COS --epochs 20 --lr 0.01 --batch_size 24
exp --method SPN --name SPN --epochs 20 --lr 0.01 --batch_size 24
exp --method DWI --name DWI --epochs 20 --lr 0.01 --batch_size 24 --ckpt checkpoints/step/${task}-voc/COS_0.pth
exp --method RT --name RT --epochs 40 --lr 0.01 --batch_size 24 --ckpt checkpoints/step/${task}-voc/FT_0.pth --born_again

gen_par="--task ${task} --dataset ${ds} --batch_size 10"
lr=0.001
iter=2000
path=checkpoints/step/${task}-${ds}
for ns in 1 2 5; do # shot 1/2/5 images
for is in 0 1 2; do # image samples
inc_par="--ishot ${is} --input_mix novel --val_interval 1000 --ckpt_interval 5"

exp --method FT --name FT --iter ${iter} --lr ${lr} ${gen_par} ${inc_par} --step 1 --nshot ${ns} --step_ckpt ${path}/FT_0.pth

exp --method WI --name WI --iter 0 --lr ${lr} ${gen_par} ${inc_par} --step 1 --nshot ${ns} --step_ckpt ${path}/COS_0.pth
exp --method DWI --name DWI --iter 0 --lr ${lr} ${gen_par} ${inc_par} --step 1 --nshot ${ns} --step_ckpt ${path}/DWI_0.pth
exp --method RT --name RT --iter ${iter} --lr ${lr} ${gen_par} ${inc_par} --step 1 --nshot ${ns} --step_ckpt ${path}/RT_0.pth

exp --method SPN --name SPN --iter ${iter} --lr ${lr} ${gen_par} ${inc_par} --step 1 --nshot ${ns} --step_ckpt ${path}/SPN_0.pth
exp --method AMP --name AMP --iter 0 --lr ${lr} ${gen_par} ${inc_par} --step 1 --nshot ${ns} --step_ckpt ${path}/FT_0.pth

exp --method LWF --name LWF --iter ${iter} --lr ${lr} ${gen_par} ${inc_par} --step 1 --nshot ${ns} --step_ckpt ${path}/FT_0.pth
exp --method ILT --name ILT --iter ${iter} --lr ${lr} ${gen_par} ${inc_par} --step 1 --nshot ${ns} --step_ckpt ${path}/FT_0.pth
exp --method MIB --name MIB --iter ${iter} --lr ${lr} ${gen_par} ${inc_par} --step 1 --nshot ${ns} --step_ckpt ${path}/FT_0.pth

exp --method PIFS --name PIFS --iter ${iter} --lr ${lr} ${gen_par} ${inc_par} --step 1 --nshot ${ns} --step_ckpt ${path}/COS_0.pth
done
done

0 comments on commit b049338

Please sign in to comment.