This repository has been archived by the owner on Jan 17, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 42
/
run.sh
executable file
·56 lines (51 loc) · 1.47 KB
/
run.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
#!/bin/bash
#--- corpus will be available soon.
mkdir -p data/orig_data/
[ -d data/orig_data/b001/ ] || {
wget https://zenodo.org/record/1322666/files/OHG.tar.gz -O data/orig_data/OHG.tar.gz
tar -xf data/orig_data/OHG.tar.gz -C data/orig_data
rm data/orig_data/OHG.tar.gz
}
data_path=$(realpath ./data/orig_data)
c_dir=$PWD
#--- build test data structure
mkdir -p data/test/page
cd data/test
for f in $(<${c_dir}/test.lst); do
ln -s $data_path/$f .
cd page
dir=$(dirname $f)
name=$(basename $f .tif)
ln -s $data_path/${dir}/page/${name}.xml .
cd ..
done
cd $c_dir
#--- build train data structure and train models
for b in {16,32,64,128,256,300}; do
echo "working on ${b} ..."
rm -rf data/${b}/train/*
mkdir -p data/${b}/train/page
cd data/${b}/train
for f in $(head -n $b ${c_dir}/train.lst); do
ln -s $data_path/$f .
cd page
dir=$(dirname $f)
name=$(basename $f .tif)
ln -s $data_path/${dir}/page/${name}.xml .
cd ..
done
cd $c_dir
#--- do the actual train
#--- ZS + BL model
python ../../P2PaLA.py --config config_ZS_BL.txt \
--tr_data data/${b}/train \
--te_data data/test \
--work_dir work_${b} \
--log_comment "_OHG_${b}"
#--- Baselines only model
python ../../P2PaLA.py --config config_BL_only.txt \
--tr_data data/${b}/train \
--te_data data/test \
--work_dir work_BL_${b} \
--log_comment "_OHG_BL_${b}"
done