-
Notifications
You must be signed in to change notification settings - Fork 0
/
generateTracking.sh
executable file
·63 lines (44 loc) · 1.75 KB
/
generateTracking.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
#!/bin/bash
# Generate the tracking files needed for the DIS extended abstract:
participants=$(find ./video/P??_front.mp4 -printf "%f\n" | cut -c1-3)
echo $participants
mkdir Tracking
# We run CppMT tracking on each part of the experiment separately,
# since there's a risk of the bounding box drifted. For each we run
# CppMT tracking until the very end of the video
# (This isn't efficient, TODO: extract the relavent frames from the video
# and only run on these)
for a in 1 2; do
mkdir cppMTPart${a}
# Generate frame skip times
for p in $participants; do
if [ ! -f cppMTPart${a}/${p}_front.skip ]; then
./abc-display-tool/abc-extractAttention.py --attentionfile Attention/${p}_attention.txt --participant $p --externaleventfile Attention/transitionAnnotations.csv --event start${a} --skipfile cppMTPart${a}/${p}_front.skip;
fi
done;
# Initalise tracking for these participants
#idi-init-tracking `pwd`/video/ `pwd`/cppMTPart${a}/
# Or copy pre-specified bounding boxes
echo "Copying pre-supplied bounding boxes"
for p in $participants; do
cp InitialBoundingBoxes/part${a}/${p}_front.bbox cppMTPart${a}/
done;
done;
for a in 1 2; do
idi-track `pwd`/video/ `pwd`/cppMTPart${a}/
done;
# Copy and rename the tracking files
for a in 1 2; do
for p in $participants; do
echo Copying participant: $p;
cp ./cppMTPart${a}/${p}_front.csv ./Tracking/${p}_part${a}_front_cppMT.csv;
gzip ./Tracking/${p}_part${a}_front_cppMT.csv;
done;
done;
# Run the Openface tracker
echo "Running openface"
docker run -it --rm --name=openface --user `id -u` --volume `pwd`/video/:/idinteraction/videos:ro --volume `pwd`/Tracking/:/idinteraction/output idinteraction/openface:2.1
echo "Compressing openface"
for o in ./Tracking/*.openface; do
gzip $o;
done;