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<