-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbenchmark.sh
executable file
·71 lines (64 loc) · 2.59 KB
/
benchmark.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
#!/usr/bin/env bash
set -e
if [ $# -lt 2 ]; then
echo Provide detectors and trackers names to benchmark
echo "Usage: $0 detectors trackers [--no-tracking] [--no-benchmark]"
echo "Example: $0 \"yolo ssd\" \"naive-tracker kalman-tracker\""
exit 1
fi
DETECTORS="$1"
TRACKERS="$2"
EXTRA_OPTIONS="--filter-class person"
METRICS="HOTA CLEAR Identity VACE"
BENCHMARK="MOT17" # MOT15, MO16, MOT17 or MOT20
PERFORM_TRACKING=true
PERFORM_BENCHMARK=true
for arg in "$@"; do
[ "$arg" = "--no-tracking" ] && PERFORM_TRACKING=false
[ "$arg" = "--no-benchmark" ] && PERFORM_BENCHMARK=false
done
OUTPUT_FOLDER="output/${BENCHMARK}"
if [ $PERFORM_TRACKING = true ]; then
[ -d data/ ] || mkdir data
if [ ! -d data/${BENCHMARK} ]; then
cd data
wget https://motchallenge.net/data/${BENCHMARK}.zip
unzip ${BENCHMARK}.zip
rm ${BENCHMARK}.zip
cd ..
fi
for detector in ${DETECTORS}; do
for tracker in ${TRACKERS}; do
output_folder="${OUTPUT_FOLDER}/${detector}_${tracker}"
[ -d "${output_folder}" ] || mkdir -p "${output_folder}"
for example in data/${BENCHMARK}/train/*; do
echo Performing tracking in ${example}...
./main.py track $detector $tracker --glob "${example}/img1/*" --output "$output_folder/$(basename $example).mp4" --export-csv "$output_folder/$(basename $example).txt" ${EXTRA_OPTIONS}
echo
done
wait
done
done
fi
if [ $PERFORM_BENCHMARK = true ]; then
[ -d TrackEval/ ] || git clone https://github.com/lilianmallardeau/TrackEval.git
if [ ! -d TrackEval/data ]; then
cd TrackEval
wget https://omnomnom.vision.rwth-aachen.de/data/TrackEval/data.zip
unzip data.zip
rm data.zip
cd ..
fi
for detector in ${DETECTORS}; do
for tracker in ${TRACKERS}; do
output_folder="${OUTPUT_FOLDER}/${detector}_${tracker}"
[ -d ${output_folder} ] || (echo \"${output_folder}\" not found; exit 2)
mkdir -p "TrackEval/data/trackers/mot_challenge/${BENCHMARK}-train/${detector}_${tracker}/data"
cp ${output_folder}/*.txt "TrackEval/data/trackers/mot_challenge/${BENCHMARK}-train/${detector}_${tracker}/data"
trackers_to_eval="${trackers_to_eval} ${detector}_${tracker}"
done
done
cd TrackEval
python3 scripts/run_mot_challenge.py --BENCHMARK ${BENCHMARK} --SPLIT_TO_EVAL train --TRACKERS_TO_EVAL ${trackers_to_eval} --METRICS ${METRICS} --USE_PARALLEL True
python3 scripts/comparison_plots.py ${trackers_to_eval}
fi