-
Notifications
You must be signed in to change notification settings - Fork 47
/
makeOptFlow_flownet.sh
64 lines (55 loc) · 1.55 KB
/
makeOptFlow_flownet.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
# Specify the path to the flownet script here.
flowCommandLine="bash run-flownet-multiple.sh"
if [ ! -f ./consistencyChecker/consistencyChecker ]; then
if [ ! -f ./consistencyChecker/Makefile ]; then
echo "Consistency checker makefile not found."
exit 1
fi
cd consistencyChecker/
make
cd ..
fi
filePattern=$1
folderName=$2
startFrame=${3:-1}
wait_for_file() {
local filename=$1
while [ ! -f "$filename" ]; do
sleep 1
done
}
if [ "$#" -le 1 ]; then
echo "Usage: ./makeOptFlow <filePattern> <outputFolder> [<startNumber>]"
echo -e "\tfilePattern:\tFilename pattern of the frames of the videos."
echo -e "\toutputFolder:\tOutput folder."
echo -e "\tstartNumber:\tThe index of the first frame. Default: 1"
exit 1
fi
i=$[$startFrame]
mkdir -p "${folderName}"
# First create the flow list
if [ -f ${folderName}/flow_list.txt ] ; then
rm ${folderName}/flow_list.txt
fi
while [ 1 ]; do
j=$[ $i - 1 ]
file1=$(printf "$filePattern" "$i")
file2=$(printf "$filePattern" "$j")
if [ -a $file2 ] && [ -a $file1 ]; then
if [ ! -f ${folderName}/forward_${j}_${i}.flo ]; then
echo "$file2" "$file1" "${folderName}/forward_${j}_${i}.flo" >> ${folderName}/flow_list.txt
fi
if [ ! -f ${folderName}/backward_${i}_${j}.flo ]; then
echo "$file1" "$file2" "${folderName}/backward_${i}_${j}.flo" >> ${folderName}/flow_list.txt
fi
fi
if [ ! -f $file1 ]; then
break
fi
i=$[$i + 1]
done
set -e
# Run flownet
if [ -f ${folderName}/flow_list.txt ] ; then
eval $flowCommandLine ${folderName}/flow_list.txt
fi