-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsave_features.sh
executable file
·61 lines (53 loc) · 2.66 KB
/
save_features.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/bash
PROJPATH="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
source .env.sh
cd $PROJPATH
################################################################################
###################### Checking the existence of filelists #####################
################################################################################
REQDS=("miniImagenet" "tieredImagenet" "CUB")
REQSPLITS=("base" "val" "novel")
MISSINGFSJSON=""
for DS in "${REQDS[@]}"; do
for SPLITNAME in "${REQSPLITS[@]}"; do
if [[ ! -f "./filelists/${DS}/${SPLITNAME}.json" ]]; then
MISSINGFSJSON="./filelists/${DS}/${SPLITNAME}.json"
fi
done
done
if [[ ${MISSINGFSJSON} != "" ]]; then
echo "Filelist ${MISSINGFSJSON} is missing. Running make filelists"
make filelists || exit 0
fi
################################################################################
######################### Running the configs in a loop ########################
################################################################################
MODEL="WideResNet28_10"
METHOD="S2M2_R"
SOURCE_TARGET_SPLIT=("miniImagenet" "miniImagenet" "base" \
"miniImagenet" "miniImagenet" "val" \
"miniImagenet" "miniImagenet" "novel" \
"tieredImagenet" "tieredImagenet" "base" \
"tieredImagenet" "tieredImagenet" "val" \
"tieredImagenet" "tieredImagenet" "novel" \
"CUB" "CUB" "base" \
"CUB" "CUB" "val" \
"CUB" "CUB" "novel" \
"miniImagenet" "CUB" "val" \
"tieredImagenet" "CUB" "val" \
"miniImagenet" "CUB" "novel" \
"tieredImagenet" "CUB" "novel" )
for (( i=0; i<${#SOURCE_TARGET_SPLIT[*]}; i+=3)); do
SOURCEDS=${SOURCE_TARGET_SPLIT[$i]}
TARGETDS=${SOURCE_TARGET_SPLIT[$((i+1))]}
SPLIT=${SOURCE_TARGET_SPLIT[$((i+2))]}
echo "Running configuration $((i/3))"
echo " ==> Source Dataset == ${SOURCEDS}"
echo " ==> Target Dataset == ${TARGETDS}"
echo " ==> Target Split == ${SPLIT}"
echo " + python save_features.py --source_dataset ${SOURCEDS} --target_dataset ${TARGETDS} \\"
echo " --split ${SPLIT} --model ${MODEL} --method ${METHOD} --device cuda:0"
python save_features.py --source_dataset ${SOURCEDS} --target_dataset ${TARGETDS} \
--split ${SPLIT} --model ${MODEL} --method ${METHOD} --device cuda:0
echo "----------------------------------------"
done