forked from aimuch/AITools
-
Notifications
You must be signed in to change notification settings - Fork 1
/
creat_caffe_filelist.sh
40 lines (33 loc) · 2 KB
/
creat_caffe_filelist.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
#!/usr/bin/env sh
DATA=/home/andy/caffe/examples/mydata/slot_classifier/data
echo "Create train.txt..."
rm -rf $DATA/train.txt
find $DATA/train/error -name *.png | cut -d '/' -f 10- | sed "s/$/ 0/" >> $DATA/train.txt
find $DATA/train/half -name *.png | cut -d '/' -f 10- | sed "s/$/ 1/" >> $DATA/train.txt
find $DATA/train/invlb -name *.png | cut -d '/' -f 10- | sed "s/$/ 2/" >> $DATA/train.txt
find $DATA/train/invls -name *.png | cut -d '/' -f 10- | sed "s/$/ 3/" >> $DATA/train.txt
find $DATA/train/valid -name *.png | cut -d '/' -f 10- | sed "s/$/ 4/" >> $DATA/train.txt
# find $DATA/train/corner -name *.png | cut -d '/' -f 10- | sed "s/$/ 5/" >> $DATA/train.txt
echo "\n"
echo "Create val.txt..."
rm -rf $DATA/val.txt
find $DATA/val/error -name *.png | cut -d '/' -f 10- | sed "s/$/ 0/" >> $DATA/val.txt
find $DATA/val/half -name *.png | cut -d '/' -f 10- | sed "s/$/ 1/" >> $DATA/val.txt
find $DATA/val/invlb -name *.png | cut -d '/' -f 10- | sed "s/$/ 2/" >> $DATA/val.txt
find $DATA/val/invls -name *.png | cut -d '/' -f 10- | sed "s/$/ 3/" >> $DATA/val.txt
find $DATA/val/valid -name *.png | cut -d '/' -f 10- | sed "s/$/ 4/" >> $DATA/val.txt
# find $DATA/val/corner -name *.png | cut -d '/' -f 10- | sed "s/$/ 5/" >> $DATA/val.txt
echo "\n"
echo "Create test.txt..."
rm -rf $DATA/test.txt
find $DATA/test/error -name *.png | cut -d '/' -f 10- | sed "s/$/ 0/" >> $DATA/test.txt
find $DATA/test/half -name *.png | cut -d '/' -f 10- | sed "s/$/ 1/" >> $DATA/test.txt
find $DATA/test/invlb -name *.png | cut -d '/' -f 10- | sed "s/$/ 2/" >> $DATA/test.txt
find $DATA/test/invls -name *.png | cut -d '/' -f 10- | sed "s/$/ 3/" >> $DATA/test.txt
find $DATA/test/valid -name *.png | cut -d '/' -f 10- | sed "s/$/ 4/" >> $DATA/test.txt
# find $DATA/test/corner -name *.png | cut -d '/' -f 10- | sed "s/$/ 5/" >> $DATA/test.txt
echo "\n"
echo "All done!"
echo "train text file path = $(readlink -f "$DATA/train.txt")"
echo "val text file path = $(readlink -f "$DATA/val.txt")"
echo "test text file path = $(readlink -f "$DATA/test.txt")"