-
Notifications
You must be signed in to change notification settings - Fork 6
/
create_siamese_lmdb.sh
executable file
·77 lines (62 loc) · 1.99 KB
/
create_siamese_lmdb.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/usr/bin/env sh
# Create the data lmdb inputs
# N.B. set the path to the dataset train + val data dirs
set -e
EXAMPLE=/home/jedrzej/siamese_data
DATA=/media/jedrzej/SAMSUNG/DATA/ILSVRC2012
TOOLS=/home/jedrzej/work/caffe/tools
TRAIN_DATA_ROOT=/media/jedrzej/SAMSUNG/DATA/ILSVRC2012/TRAIN/
VAL_DATA_ROOT=/media/jedrzej/SAMSUNG/DATA/ILSVRC2012/TRAIN/
RESIZE=true
if $RESIZE; then
RESIZE_HEIGHT=224
RESIZE_WIDTH=224
else
RESIZE_HEIGHT=0
RESIZE_WIDTH=0
fi
if [ ! -d "$TRAIN_DATA_ROOT" ]; then
echo "Error: TRAIN_DATA_ROOT is not a path to a directory: $TRAIN_DATA_ROOT"
echo "Set the TRAIN_DATA_ROOT variable in create_imagenet.sh to the path" \
"where the ImageNet training data is stored."
exit 1
fi
if [ ! -d "$VAL_DATA_ROOT" ]; then
echo "Error: VAL_DATA_ROOT is not a path to a directory: $VAL_DATA_ROOT"
echo "Set the VAL_DATA_ROOT variable in create_imagenet.sh to the path" \
"where the ImageNet validation data is stored."
exit 1
fi
echo "Creating train lmdb right..."
GLOG_logtostderr=1 $TOOLS/convert_imageset \
--resize_height=$RESIZE_HEIGHT \
--resize_width=$RESIZE_WIDTH \
--shuffle=false \
$TRAIN_DATA_ROOT \
$DATA/train_right.txt \
$EXAMPLE/siamese_train_right_lmdb
echo "Creating val lmdb right..."
GLOG_logtostderr=1 $TOOLS/convert_imageset \
--resize_height=$RESIZE_HEIGHT \
--resize_width=$RESIZE_WIDTH \
--shuffle=false \
$VAL_DATA_ROOT \
$DATA/val_right.txt \
$EXAMPLE/siamese_val_right_lmdb
echo "Creating train lmdb left..."
GLOG_logtostderr=1 $TOOLS/convert_imageset \
--resize_height=$RESIZE_HEIGHT \
--resize_width=$RESIZE_WIDTH \
--shuffle=false \
$TRAIN_DATA_ROOT \
$DATA/train_left.txt \
$EXAMPLE/siamese_train_left_lmdb
echo "Creating val lmdb left..."
GLOG_logtostderr=1 $TOOLS/convert_imageset \
--resize_height=$RESIZE_HEIGHT \
--resize_width=$RESIZE_WIDTH \
--shuffle=false \
$VAL_DATA_ROOT \
$DATA/val_left.txt \
$EXAMPLE/siamese_val_left_lmdb
echo "Done."