-
Notifications
You must be signed in to change notification settings - Fork 1
/
mpe
executable file
·60 lines (56 loc) · 1.34 KB
/
mpe
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
#!/usr/bin/env bash
set -e
command=$1
shift
compose_base() {
set -x
docker-compose "$@"
}
build() {
compose_base build
}
compile() {
compose_base run marker_pose_estimation compile
}
create_markers() {
compose_base run marker_pose_estimation execute marker_creation
}
estimate() {
input_path="$@"
file_path="$PWD/$@"
if [[ $file_path == *"//"* ]]; then
file_path=$input_path
fi
xbase=${file_path##*/}
xpref=${xbase%.*}
xfext=${xbase##*.}
if [ -z "$input_path" ]; then
echo Use default input path: input/images
compose_base run marker_pose_estimation execute pose_estimation
elif [ -d "$input_path" ]; then
echo "$input_path is a directory"
compose_base run -v "$file_path:/tmp/images" \
marker_pose_estimation execute pose_estimation /tmp/images
elif [ -f "$input_path" ]; then
echo "$input_path is a file"
compose_base run -v "$file_path:/tmp/images/${xbase%.*}.${xfext}" \
marker_pose_estimation execute pose_estimation /tmp/images
fi
}
case $command in
build)
build
;;
compile)
compile
;;
create_markers)
create_markers
;;
estimate)
estimate "$@"
;;
*)
echo "Error: command not found: $command"
exit 1
esac