From 2548a5f04d72ff4943756786f4b82b7cb6ab16d1 Mon Sep 17 00:00:00 2001 From: Moreno Razzoli Date: Wed, 16 Jun 2021 17:14:47 +0200 Subject: [PATCH 1/5] export detections to file --- demo/demo/demo.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/demo/demo/demo.cpp b/demo/demo/demo.cpp index 317a574..46eee1b 100644 --- a/demo/demo/demo.cpp +++ b/demo/demo/demo.cpp @@ -10,6 +10,8 @@ bool gRun; bool SAVE_RESULT = false; +bool save_detections = true; +std::ofstream outfile; void sig_handler(int signo) { std::cout<<"request gateway stop\n"; @@ -101,6 +103,11 @@ int main(int argc, char *argv[]) { std::vector batch_frame; std::vector batch_dnn_input; + if(save_detections) + outfile.open("detections.txt", std::ofstream::out); + + int frame_num = -1; + while(gRun) { batch_dnn_input.clear(); batch_frame.clear(); @@ -122,6 +129,22 @@ int main(int argc, char *argv[]) { detNN->update(batch_dnn_input, n_batch); detNN->draw(batch_frame); + if(save_detections){ + frame_num++; + tk::dnn::box b; + for(int bi=0; bibatchDetected[bi].size(); i++) { + b = detNN->batchDetected[bi][i]; + int x0 = b.x; + int w = b.w; + int y0 = b.y; + int h = b.h; + std::string det_class = detNN->classesNames[b.cl]; + outfile< Date: Thu, 17 Jun 2021 10:55:06 +0200 Subject: [PATCH 2/5] export in csv format --- demo/demo/demo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demo/demo/demo.cpp b/demo/demo/demo.cpp index 46eee1b..75b33c3 100644 --- a/demo/demo/demo.cpp +++ b/demo/demo/demo.cpp @@ -140,7 +140,7 @@ int main(int argc, char *argv[]) { int y0 = b.y; int h = b.h; std::string det_class = detNN->classesNames[b.cl]; - outfile< Date: Thu, 17 Jun 2021 10:55:43 +0200 Subject: [PATCH 3/5] export: csv file extension --- demo/demo/demo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demo/demo/demo.cpp b/demo/demo/demo.cpp index 75b33c3..e912136 100644 --- a/demo/demo/demo.cpp +++ b/demo/demo/demo.cpp @@ -104,7 +104,7 @@ int main(int argc, char *argv[]) { std::vector batch_dnn_input; if(save_detections) - outfile.open("detections.txt", std::ofstream::out); + outfile.open("detections.csv", std::ofstream::out); int frame_num = -1; -- 2.52.0 From 2782f22155f29a91aeb3b29d852d02f806841f68 Mon Sep 17 00:00:00 2001 From: Moreno Razzoli Date: Thu, 17 Jun 2021 12:15:35 +0200 Subject: [PATCH 4/5] use kitti label format coordinates for 2d bounding box --- demo/demo/demo.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/demo/demo/demo.cpp b/demo/demo/demo.cpp index e912136..751a850 100644 --- a/demo/demo/demo.cpp +++ b/demo/demo/demo.cpp @@ -135,12 +135,8 @@ int main(int argc, char *argv[]) { for(int bi=0; bibatchDetected[bi].size(); i++) { b = detNN->batchDetected[bi][i]; - int x0 = b.x; - int w = b.w; - int y0 = b.y; - int h = b.h; std::string det_class = detNN->classesNames[b.cl]; - outfile< Date: Mon, 21 Jun 2021 09:20:19 +0200 Subject: [PATCH 5/5] fix formatting --- demo/demo/demo.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/demo/demo/demo.cpp b/demo/demo/demo.cpp index 751a850..d14ce66 100644 --- a/demo/demo/demo.cpp +++ b/demo/demo/demo.cpp @@ -104,7 +104,7 @@ int main(int argc, char *argv[]) { std::vector batch_dnn_input; if(save_detections) - outfile.open("detections.csv", std::ofstream::out); + outfile.open("detections.csv", std::ofstream::out); int frame_num = -1; @@ -129,17 +129,17 @@ int main(int argc, char *argv[]) { detNN->update(batch_dnn_input, n_batch); detNN->draw(batch_frame); - if(save_detections){ - frame_num++; - tk::dnn::box b; - for(int bi=0; bibatchDetected[bi].size(); i++) { - b = detNN->batchDetected[bi][i]; - std::string det_class = detNN->classesNames[b.cl]; - outfile<batchDetected[bi].size(); i++) { + b = detNN->batchDetected[bi][i]; + std::string det_class = detNN->classesNames[b.cl]; + outfile<