|
|
|
@@ -346,34 +346,6 @@ function Run_Converter() { |
|
|
|
fi |
|
|
|
done < ${models_multiple_inputs_fp16_config} |
|
|
|
|
|
|
|
# Run tf fp16 models |
|
|
|
while read line; do |
|
|
|
model_name_and_input_num=${line%;*} |
|
|
|
length=${#model_name_and_input_num} |
|
|
|
input_shapes=${line:length+1} |
|
|
|
tf_line_info=${model_name_and_input_num} |
|
|
|
if [[ $model_name == \#* ]]; then |
|
|
|
continue |
|
|
|
fi |
|
|
|
model_name=`echo ${tf_line_info}|awk -F ' ' '{print $1}'` |
|
|
|
input_num=`echo ${tf_line_info}|awk -F ' ' '{print $2}'` |
|
|
|
input_files='' |
|
|
|
for i in $(seq 1 $input_num) |
|
|
|
do |
|
|
|
input_files=$input_files'/data/local/tmp/input_output/input/'$model_name'.ms_'$i'.bin,' |
|
|
|
done |
|
|
|
echo ${model_name} >> "${run_arm64_fp16_log_file}" |
|
|
|
echo 'cd /data/local/tmp/benchmark_test' > adb_run_cmd.txt |
|
|
|
echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/local/tmp/benchmark_test;./benchmark --inputShapes='${input_shapes}' --modelFile='${model_name}'.ms --inDataFile='${input_files}' --benchmarkDataFile=/data/local/tmp/input_output/output/'${model_name}'.ms.out --enableFp16=true' >> "${run_arm64_fp16_log_file}" |
|
|
|
echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/local/tmp/benchmark_test;./benchmark --inputShapes='${input_shapes}' --modelFile='${model_name}'.ms --inDataFile='${input_files}' --benchmarkDataFile=/data/local/tmp/input_output/output/'${model_name}'.ms.out --enableFp16=true' >> adb_run_cmd.txt |
|
|
|
adb -s ${device_id} shell < adb_run_cmd.txt >> "${run_arm64_fp16_log_file}" |
|
|
|
if [ $? = 0 ]; then |
|
|
|
run_result='arm64_fp16: '${model_name}' pass'; echo ${run_result} >> ${run_benchmark_result_file} |
|
|
|
else |
|
|
|
run_result='arm64_fp16: '${model_name}' failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1 |
|
|
|
fi |
|
|
|
done < ${models_tf_fp16_config} |
|
|
|
|
|
|
|
# Convert models which does not need to be cared about the accuracy: |
|
|
|
while read line; do |
|
|
|
if [[ $line == \#* ]]; then |
|
|
|
@@ -1875,6 +1847,35 @@ function Run_arm64_fp16() { |
|
|
|
run_result='arm64_fp16: '${model_name}' failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1 |
|
|
|
fi |
|
|
|
done < ${models_multiple_inputs_fp16_config} |
|
|
|
|
|
|
|
# Run tf fp16 models |
|
|
|
while read line; do |
|
|
|
tf_line_info=${line} |
|
|
|
if [[ $tf_line_info == \#* ]]; then |
|
|
|
continue |
|
|
|
fi |
|
|
|
model_name=`echo ${tf_line_info}|awk -F ' ' '{print $1}'` |
|
|
|
model_info=`echo ${tf_line_info}|awk -F ' ' '{print $2}'` |
|
|
|
input_num=`echo ${model_info}|awk -F ';' '{print $1}'` |
|
|
|
input_shapes=`echo ${model_info}|awk -F ';' '{print $2}'` |
|
|
|
accuracy_limit=`echo ${model_info}|awk -F ';' '{print $3}'` |
|
|
|
input_files='' |
|
|
|
for i in $(seq 1 $input_num) |
|
|
|
do |
|
|
|
input_files=$input_files'/data/local/tmp/input_output/input/'$model_name'.ms_'$i'.bin,' |
|
|
|
done |
|
|
|
echo ${model_name} >> "${run_arm64_fp16_log_file}" |
|
|
|
echo 'cd /data/local/tmp/benchmark_test' > adb_run_cmd.txt |
|
|
|
echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/local/tmp/benchmark_test;./benchmark --inputShapes='${input_shapes}' --modelFile='${model_name}'.fp16.ms --inDataFile='${input_files}' --benchmarkDataFile=/data/local/tmp/input_output/output/'${model_name}'.ms.out --enableFp16=true --accuracyThreshold='${accuracy_limit} >> adb_run_cmd.txt |
|
|
|
echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/local/tmp/benchmark_test;./benchmark --inputShapes='${input_shapes}' --modelFile='${model_name}'.fp16.ms --inDataFile='${input_files}' --benchmarkDataFile=/data/local/tmp/input_output/output/'${model_name}'.ms.out --enableFp16=true --accuracyThreshold='${accuracy_limit} >> adb_run_cmd.txt |
|
|
|
cat adb_run_cmd.txt >> "${run_arm64_fp16_log_file}" |
|
|
|
adb -s ${device_id} shell < adb_run_cmd.txt >> "${run_arm64_fp16_log_file}" |
|
|
|
if [ $? = 0 ]; then |
|
|
|
run_result='arm64_fp16: '${model_name}' pass'; echo ${run_result} >> ${run_benchmark_result_file} |
|
|
|
else |
|
|
|
run_result='arm64_fp16: '${model_name}' failed'; echo ${run_result} >> ${run_benchmark_result_file}; return 1 |
|
|
|
fi |
|
|
|
done < ${models_tf_fp16_config} |
|
|
|
} |
|
|
|
# Run on gpu platform: |
|
|
|
function Run_gpu() { |
|
|
|
|