forked from lksshw/SRNet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
data_script.sh
62 lines (37 loc) · 1.34 KB
/
data_script.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
60
61
62
#!/bin/bash
#Data setup script for SRNet
#Author: Niwhskal
#https://github.com/Niwhskal/
echo "setting up dirs ($(date))"
main_dir=$(pwd)'/'
echo "This is $main_dir"
cd "$main_dir"
mkdir "datasets/"
cd "datasets"
mkdir "srnet_data/"
mkdir -p "fonts/english_ttf/"
mkdir "bg_data"
echo "Downloading background image names ($(date))"
wget https://thor.robots.ox.ac.uk/~vgg/data/scenetext/preproc/imnames.cp
echo "----------"
echo "Downloading background images ($(date))"
cd "bg_data"
wget https://thor.robots.ox.ac.uk/~vgg/data/scenetext/preproc/bg_img.tar.gz
tar -xzf bg_img.tar.gz
echo "Changing Paths $(date)"
copy_path="${main_dir}datasets/"
code_path="${main_dir}SRNet-Datagen/"
cd "${code_path}"
sed -i "s|^data_dir.*$|data_dir = '${copy_path}srnet_data/'|" cfg.py
cd "Synthtext"
sed -i "s|^font_dir.*$|font_dir = '${copy_path}fonts/english_ttf/'|" data_cfg.py
sed -i "s|^standard_font_path.*$|standard_font_path = '${copy_path}fonts/english_ttf/arial.ttf'|" data_cfg.py
sed -i "s|^bg_filepath.*$|bg_filepath = '${copy_path}imnames.cp'|" data_cfg.py
sed -i "s|^temp_bg_path.*$|temp_bg_path = '${copy_path}bg_data/bg_img/'|" data_cfg.py
echo "Moving fonts ($(date))"
cd ${main_dir}datasets/fonts/english_ttf
mv ${code_path}arial.ttf ./
mv ${code_path}OpenSans-Regular.ttf ./
cd "${code_path}"
python3 datagen.py
echo "COMPLETED AT $(date)"