rename to dzgcoop
This commit is contained in:
22
scripts/dzgcoop/base2new_all.sh
Normal file
22
scripts/dzgcoop/base2new_all.sh
Normal file
@@ -0,0 +1,22 @@
|
||||
seeds=(1 2 3)
|
||||
datasets=(
|
||||
"ucf101"
|
||||
"eurosat"
|
||||
"oxford_pets"
|
||||
"food101"
|
||||
"oxford_flowers"
|
||||
"dtd"
|
||||
"caltech101"
|
||||
"fgvc_aircraft"
|
||||
"stanford_cars"
|
||||
# "sun397"
|
||||
# "imagenet"
|
||||
)
|
||||
|
||||
for dataset in "${datasets[@]}"; do
|
||||
for seed in "${seeds[@]}"; do
|
||||
bash scripts/dzgcoop/base2new_train.sh "$dataset" "$seed"
|
||||
bash scripts/dzgcoop/base2new_test.sh "$dataset" "$seed"
|
||||
done
|
||||
done
|
||||
|
||||
53
scripts/dzgcoop/base2new_test.sh
Normal file
53
scripts/dzgcoop/base2new_test.sh
Normal file
@@ -0,0 +1,53 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
# custom config
|
||||
DATA="~/Datasets/CoOp"
|
||||
TRAINER=DZGCoOp
|
||||
|
||||
DATASET=$1
|
||||
SEED=$2
|
||||
|
||||
CFG=vit_b16_c2_ep20_batch4_4+4ctx
|
||||
SHOTS=16
|
||||
LOADEP=20
|
||||
SUB=new
|
||||
|
||||
|
||||
COMMON_DIR=${DATASET}/shots_${SHOTS}/${TRAINER}/${CFG}/seed${SEED}
|
||||
MODEL_DIR=output/base2new/train_base/${COMMON_DIR}
|
||||
DIR=output/base2new/test_${SUB}/${COMMON_DIR}
|
||||
if [ -d "$DIR" ]; then
|
||||
echo "Evaluating model"
|
||||
echo "Results are available in ${DIR}. Resuming..."
|
||||
|
||||
python train.py \
|
||||
--root ${DATA} \
|
||||
--seed ${SEED} \
|
||||
--trainer ${TRAINER} \
|
||||
--dataset-config-file configs/datasets/${DATASET}.yaml \
|
||||
--config-file configs/trainers/${TRAINER}/${CFG}.yaml \
|
||||
--output-dir ${DIR} \
|
||||
--model-dir ${MODEL_DIR} \
|
||||
--load-epoch ${LOADEP} \
|
||||
--eval-only \
|
||||
DATASET.NUM_SHOTS ${SHOTS} \
|
||||
DATASET.SUBSAMPLE_CLASSES ${SUB}
|
||||
|
||||
else
|
||||
echo "Evaluating model"
|
||||
echo "Runing the first phase job and save the output to ${DIR}"
|
||||
|
||||
python train.py \
|
||||
--root ${DATA} \
|
||||
--seed ${SEED} \
|
||||
--trainer ${TRAINER} \
|
||||
--dataset-config-file configs/datasets/${DATASET}.yaml \
|
||||
--config-file configs/trainers/${TRAINER}/${CFG}.yaml \
|
||||
--output-dir ${DIR} \
|
||||
--model-dir ${MODEL_DIR} \
|
||||
--load-epoch ${LOADEP} \
|
||||
--eval-only \
|
||||
DATASET.NUM_SHOTS ${SHOTS} \
|
||||
DATASET.SUBSAMPLE_CLASSES ${SUB}
|
||||
fi
|
||||
37
scripts/dzgcoop/base2new_train.sh
Normal file
37
scripts/dzgcoop/base2new_train.sh
Normal file
@@ -0,0 +1,37 @@
|
||||
#!/bin/bash
|
||||
|
||||
# custom config
|
||||
DATA="~/Datasets/CoOp"
|
||||
TRAINER=DZGCoOp
|
||||
|
||||
DATASET=$1
|
||||
SEED=$2
|
||||
|
||||
CFG=vit_b16_c2_ep20_batch4_4+4ctx
|
||||
SHOTS=16
|
||||
|
||||
|
||||
DIR=output/base2new/train_base/${DATASET}/shots_${SHOTS}/${TRAINER}/${CFG}/seed${SEED}
|
||||
if [ -d "$DIR" ]; then
|
||||
echo "Results are available in ${DIR}. Resuming..."
|
||||
python train.py \
|
||||
--root ${DATA} \
|
||||
--seed ${SEED} \
|
||||
--trainer ${TRAINER} \
|
||||
--dataset-config-file configs/datasets/${DATASET}.yaml \
|
||||
--config-file configs/trainers/${TRAINER}/${CFG}.yaml \
|
||||
--output-dir ${DIR} \
|
||||
DATASET.NUM_SHOTS ${SHOTS} \
|
||||
DATASET.SUBSAMPLE_CLASSES base
|
||||
else
|
||||
echo "Run this job and save the output to ${DIR}"
|
||||
python train.py \
|
||||
--root ${DATA} \
|
||||
--seed ${SEED} \
|
||||
--trainer ${TRAINER} \
|
||||
--dataset-config-file configs/datasets/${DATASET}.yaml \
|
||||
--config-file configs/trainers/${TRAINER}/${CFG}.yaml \
|
||||
--output-dir ${DIR} \
|
||||
DATASET.NUM_SHOTS ${SHOTS} \
|
||||
DATASET.SUBSAMPLE_CLASSES base
|
||||
fi
|
||||
30
scripts/dzgcoop/xd_train.sh
Normal file
30
scripts/dzgcoop/xd_train.sh
Normal file
@@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
DATA=" ~/Datasets/CoOp"
|
||||
TRAINER=DZGCoOp
|
||||
SRC_DATASETS=imagenet
|
||||
SHOTS=16
|
||||
CFG=vit_b16_c2_ep20_batch4_4+4ctx_cross_datasets
|
||||
|
||||
|
||||
for SEED in 1 2 3
|
||||
do
|
||||
DIR=output_xd/base2new/train_base/${SRC_DATASETS}/shots_${SHOTS}/${TRAINER}/${CFG}/seed${SEED}
|
||||
|
||||
if [ -d "$DIR" ]; then
|
||||
echo "Results are available in ${DIR}. Skip this job"
|
||||
else
|
||||
echo "Run this job and save the output to ${DIR}"
|
||||
|
||||
CUDA_VISIBLE_DEVICES=0 python train.py \
|
||||
--root ${DATA} \
|
||||
--seed ${SEED} \
|
||||
--trainer ${TRAINER} \
|
||||
--dataset-config-file configs/datasets/${SRC_DATASETS}.yaml \
|
||||
--config-file configs/trainers/${TRAINER}/${CFG}.yaml \
|
||||
--output-dir ${DIR} \
|
||||
DATASET.NUM_SHOTS ${SHOTS}
|
||||
fi
|
||||
done
|
||||
|
||||
46
scripts/dzgcoop/xda_test.sh
Normal file
46
scripts/dzgcoop/xda_test.sh
Normal file
@@ -0,0 +1,46 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
# custom config
|
||||
DATA=" ~/Datasets/CoOp"
|
||||
TRAINER=DZGCoOp
|
||||
|
||||
|
||||
SRC_DATASETS=imagenet
|
||||
SHOTS=16
|
||||
CFG=vit_b16_c2_ep20_batch4_4+4ctx_cross_datasets
|
||||
LOADEP=20
|
||||
|
||||
|
||||
DATASETS=(dtd eurosat fgvc_aircraft food101 oxford_flowers oxford_pets stanford_cars ucf101 caltech101 sun397)
|
||||
SEEDS=(1 2 3)
|
||||
|
||||
|
||||
for DATASET in "${DATASETS[@]}"
|
||||
do
|
||||
for SEED in "${SEEDS[@]}"
|
||||
do
|
||||
MODEL_DIR=output_xd/base2new/train_base/${SRC_DATASETS}/shots_${SHOTS}/${TRAINER}/${CFG}/seed${SEED}
|
||||
|
||||
DIR=output_xd/base2new/test_new/${DATASET}/shots_${SHOTS}/${TRAINER}/${CFG}/seed${SEED}
|
||||
|
||||
if [ -d "$DIR" ]; then
|
||||
echo "Results are available in ${DIR}. Skip this job"
|
||||
else
|
||||
echo "Run this job and save the output to ${DIR}"
|
||||
echo "Loading model from ${MODEL_DIR}"
|
||||
|
||||
CUDA_VISIBLE_DEVICES=0 python train.py \
|
||||
--root ${DATA} \
|
||||
--seed ${SEED} \
|
||||
--trainer ${TRAINER} \
|
||||
--dataset-config-file configs/datasets/${DATASET}.yaml \
|
||||
--config-file configs/trainers/${TRAINER}/${CFG}.yaml \
|
||||
--output-dir ${DIR} \
|
||||
--model-dir ${MODEL_DIR} \
|
||||
--load-epoch ${LOADEP} \
|
||||
--eval-only
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
46
scripts/dzgcoop/xdo_test.sh
Normal file
46
scripts/dzgcoop/xdo_test.sh
Normal file
@@ -0,0 +1,46 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
# custom config
|
||||
DATA=" ~/Datasets/CoOp"
|
||||
TRAINER=DZGCoOp
|
||||
|
||||
|
||||
SRC_DATASETS=imagenet
|
||||
SHOTS=16
|
||||
CFG=vit_b16_c2_ep20_batch4_4+4ctx_cross_datasets
|
||||
LOADEP=20
|
||||
|
||||
|
||||
DATASETS=(imagenetv2 imagenet_sketch imagenet_a imagenet_r)
|
||||
SEEDS=(1 2 3)
|
||||
|
||||
|
||||
for DATASET in "${DATASETS[@]}"
|
||||
do
|
||||
for SEED in "${SEEDS[@]}"
|
||||
do
|
||||
MODEL_DIR=output_xd/base2new/train_base/${SRC_DATASETS}/shots_${SHOTS}/${TRAINER}/${CFG}/seed${SEED}
|
||||
|
||||
DIR=output_xd/base2new/test_new/${DATASET}/shots_${SHOTS}/${TRAINER}/${CFG}/seed${SEED}
|
||||
|
||||
if [ -d "$DIR" ]; then
|
||||
echo "Results are available in ${DIR}. Skip this job"
|
||||
else
|
||||
echo "Run this job and save the output to ${DIR}"
|
||||
echo "Loading model from ${MODEL_DIR}"
|
||||
|
||||
CUDA_VISIBLE_DEVICES=0 python train.py \
|
||||
--root ${DATA} \
|
||||
--seed ${SEED} \
|
||||
--trainer ${TRAINER} \
|
||||
--dataset-config-file configs/datasets/${DATASET}.yaml \
|
||||
--config-file configs/trainers/${TRAINER}/${CFG}.yaml \
|
||||
--output-dir ${DIR} \
|
||||
--model-dir ${MODEL_DIR} \
|
||||
--load-epoch ${LOADEP} \
|
||||
--eval-only
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user