-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathprep_lmdbs.sh
executable file
·50 lines (43 loc) · 1.13 KB
/
prep_lmdbs.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
#!/usr/bin/env bash
DB=$1
IMG_DIR=$2
if [ -z ${DB} ]; then
echo 'usage:'
echo ' ./prep_lmdbs.sh <DB> [<IMG_DIR>]'
echo ' <DB> must be either AwA, CUB or IFCB.'
exit 0
fi
if [ -z ${IMG_DIR} ]; then
IMG_DIR='/PATH/TO/IMAGE/FOLDER'
fi
if [ ! -d LMDBs ]; then
mkdir LMDBs
fi
if [ ! -d LMDBs/${DB} ]; then
mkdir LMDBs/${DB}
fi
# Image
SUBSETS=( 'train' 'testRecg' 'testZS' )
for subset in "${SUBSETS[@]}"; do
if [ ! -d 'LMDBs/'${DB}'/'${subset}'.image_lmdb' ]; then
python tools/create_lmdb.py ${DB} Image ${subset} --image_dir ${IMG_DIR}
fi
done
# Attributes
for subset in "${SUBSETS[@]}"; do
if [ ! -d 'LMDBs/'${DB}'/'${subset}'.attributes_lmdb' ]; then
python tools/create_lmdb.py ${DB} Attributes ${subset}
fi
done
# Hierarchy
for subset in "${SUBSETS[@]}"; do
if [ ! -d 'LMDBs/'${DB}'/'${subset}'.hierarchy_lmdb' ]; then
python tools/create_lmdb.py ${DB} Hierarchy ${subset}
fi
done
# Word2Vec
for subset in "${SUBSETS[@]}"; do
if [ ! -d 'LMDBs/'${DB}'/'${subset}'.word2vec_lmdb' ]; then
python tools/create_lmdb.py ${DB} Word2Vec ${subset}
fi
done