2 Commits

Author SHA1 Message Date
Francesco Gatti 7c0620e391 test_all_test script save results in separate files 2022-03-30 15:47:41 +02:00
Micaela Verucchi 3bcc32ffdc Fix nms thresh
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
2022-02-15 19:57:57 +01:00
3 changed files with 50 additions and 45 deletions
+41 -37
View File
@@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
cd build #cd build
RED='\033[1;31m' RED='\033[1;31m'
GREEN='\033[1;32m' GREEN='\033[1;32m'
@@ -29,24 +29,28 @@ function print_output {
} }
out_dir=results
out_file=results.log out_file=results.log
rm $out_file rm -rf $out_dir/
mkdir -p $out_dir
function test_net { function test_net {
./test_$1 &>> $out_file ./test_$1 &> $out_dir/$1_${TKDNN_MODE}_build_$out_file
print_output $? $1 print_output $? $1
./test_rtinference $1*.rt $TKDNN_BATCHSIZE &>> $out_file ./test_rtinference $1*.rt 1 &> $out_dir/$1_${TKDNN_MODE}_inference_batch1_$out_file
print_output $? "infer $1"
./test_rtinference $1*.rt $TKDNN_BATCHSIZE &> $out_dir/$1_${TKDNN_MODE}_inference_batch${TKDNN_BATCHSIZE}_$out_file
print_output $? "batched $1" print_output $? "batched $1"
} }
modes=( 1 ) # only FP32 # modes=( 1 ) # only FP32
# modes=( 1 2 ) # FP32 and FP16 modes=( 1 2 ) # FP32 and FP16
# modes=( 1 2 3 ) # FP32, FP16 and INT8 # modes=( 1 2 3 ) # FP32, FP16 and INT8
for i in "${modes[@]}" for i in "${modes[@]}"
do do
rm *rt rm -f *rt
if [ $i -eq 1 ] if [ $i -eq 1 ]
then then
export TKDNN_MODE=FP32 export TKDNN_MODE=FP32
@@ -73,37 +77,37 @@ do
# print_output $? imuodom # print_output $? imuodom
test_net yolo4 test_net yolo4
test_net yolo4_320 # test_net yolo4_320
test_net yolo4_320_coco2 # test_net yolo4_320_coco2
test_net yolo4_512 # test_net yolo4_512
test_net yolo4_608 # test_net yolo4_608
test_net yolo4-csp # test_net yolo4-csp
test_net yolo4x # test_net yolo4x
test_net yolo4_berkeley # test_net yolo4_berkeley
test_net yolo4_berkeley_f1 # test_net yolo4_berkeley_f1
test_net yolo4tiny # test_net yolo4tiny
test_net yolo4tiny_512 # test_net yolo4tiny_512
test_net yolo3 # test_net yolo3
test_net yolo3_berkeley # test_net yolo3_berkeley
test_net yolo3_coco4 # test_net yolo3_coco4
test_net yolo3_flir # test_net yolo3_flir
test_net yolo3_512 # test_net yolo3_512
test_net yolo3tiny # test_net yolo3tiny
test_net yolo3tiny_512 # test_net yolo3tiny_512
test_net yolo2 # test_net yolo2
test_net yolo2_voc # test_net yolo2_voc
# test_net yolo2tiny # test_net yolo2tiny
test_net csresnext50-panet-spp # test_net csresnext50-panet-spp
# test_net csresnext50-panet-spp_berkeley # test_net csresnext50-panet-spp_berkeley
test_net resnet101_cnet # test_net resnet101_cnet
test_net dla34_cnet # test_net dla34_cnet
test_net dla34_cnet3d # test_net dla34_cnet3d
test_net mobilenetv2ssd # test_net mobilenetv2ssd
test_net mobilenetv2ssd512 # test_net mobilenetv2ssd512
test_net bdd-mobilenetv2ssd # test_net bdd-mobilenetv2ssd
test_net dla34_ctrack # test_net dla34_ctrack
test_net shelfnet # test_net shelfnet
test_net shelfnet_berkeley # test_net shelfnet_berkeley
done done
echo "If errors occured, check logfile $out_file" echo "If errors occured, check logfiles in directory: $out_dir"
+3 -2
View File
@@ -278,6 +278,7 @@ void Yolo::mergeDetections(Yolo::detection *dets, int ndets, int classes, double
} }
total = k+1; total = k+1;
float thresh = 0.45f;
for(k = 0; k < classes; ++k){ for(k = 0; k < classes; ++k){
for(i = 0; i < total; ++i){ for(i = 0; i < total; ++i){
dets[i].sort_class = k; dets[i].sort_class = k;
@@ -288,9 +289,9 @@ void Yolo::mergeDetections(Yolo::detection *dets, int ndets, int classes, double
box a = dets[i].bbox; box a = dets[i].bbox;
for(j = i+1; j < total; ++j){ for(j = i+1; j < total; ++j){
box b = dets[j].bbox; box b = dets[j].bbox;
if (nsm_kind == GREEDY_NMS && yolo_box_iou(a, b) > nms_thresh) if (nsm_kind == GREEDY_NMS && yolo_box_iou(a, b) > thresh)
dets[j].prob[k] = 0; dets[j].prob[k] = 0;
else if (nsm_kind == DIOU_NMS && yolo_box_diou(a, b, nms_thresh) > nms_thresh) else if (nsm_kind == DIOU_NMS && yolo_box_diou(a, b, nms_thresh) > thresh)
dets[j].prob[k] = 0; dets[j].prob[k] = 0;
} }
} }
+4 -4
View File
@@ -1,6 +1,6 @@
#include<iostream> #include<iostream>
#include<algorithm> #include<algorithm>
#include "tkdnn.h" #include "tkDNN/tkdnn.h"
#include <stdlib.h> /* srand, rand */ #include <stdlib.h> /* srand, rand */
@@ -66,11 +66,11 @@ int main(int argc, char *argv[]) {
} }
} }
double min = *std::min_element(stats.begin(), stats.end())/BATCH_SIZE; double min = *std::min_element(stats.begin(), stats.end()); ///BATCH_SIZE;
double max = *std::max_element(stats.begin(), stats.end())/BATCH_SIZE; double max = *std::max_element(stats.begin(), stats.end()); ///BATCH_SIZE;
double mean =0; double mean =0;
for(int i=0; i<stats.size(); i++) mean += stats[i]; mean /= stats.size(); for(int i=0; i<stats.size(); i++) mean += stats[i]; mean /= stats.size();
mean /=BATCH_SIZE; //mean /=BATCH_SIZE;
std::cout<<"Min: "<<min<<" ms\n"; std::cout<<"Min: "<<min<<" ms\n";
std::cout<<"Max: "<<max<<" ms\n"; std::cout<<"Max: "<<max<<" ms\n";