-
Notifications
You must be signed in to change notification settings - Fork 23
/
fps.sh
26 lines (23 loc) · 881 Bytes
/
fps.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
#!/bin/bash
DEPLOY_CONFIG_FILE=$1
CONFIG_FILE=$2
WORK_DIR=$3
DEVICE='cuda'
DATASET='data/coco/val2017'
PROFILER_MODEL="${WORK_DIR}/end2end.engine"
#test fps
total_latency=0
for i in {1..5}; do
latency=$(python mmdeploy/tools/profiler.py ${DEPLOY_CONFIG_FILE} \
${CONFIG_FILE} \
${DATASET} \
--model ${PROFILER_MODEL} \
--device ${DEVICE} | awk 'NR==28{print $4}')
echo "Latency $i in ms: $latency"
total_latency=$(echo "$total_latency+$latency" | bc -l)
echo "total_latency in ms: $total_latency"
done
avg_latency=$(echo "$total_latency / 5" | bc -l)
MODEL=`basename ${CONFIG_FILE}.py`
echo "$MODEL:" >> deploy_test.txt
printf "%.3f\n" "$avg_latency" >> deploy_test.txt