namespace change

This commit is contained in:
Francesco Gatti
2018-12-14 21:55:16 +01:00
parent 443179359d
commit 6249956469
32 changed files with 374 additions and 374 deletions
+9 -9
View File
@@ -10,8 +10,8 @@
const char *reg_bias = "../tests/yolo/layers/g31.bin";
int prob_sort(const void *pa, const void *pb) {
tkDNN::box a = *(tkDNN::box *)pa;
tkDNN::box b = *(tkDNN::box *)pb;
tk::dnn::box a = *(tk::dnn::box *)pa;
tk::dnn::box b = *(tk::dnn::box *)pb;
float diff = a.prob - b.prob;
if(diff < 0) return 1;
else if(diff > 0) return -1;
@@ -48,7 +48,7 @@ cv::Mat GetSquareImage(const cv::Mat& img, int target_width) {
//return inference time
double compute_image( cv::Mat imageORIG,
tkDNN::NetworkRT *netRT, tkDNN::RegionInterpret *rI,
tk::dnn::NetworkRT *netRT, tk::dnn::RegionInterpret *rI,
dnnType *input, dnnType *output) {
//Resize with padding and convert to float
@@ -136,8 +136,8 @@ int main(int argc, char *argv[]) {
if(!fileExist(tensor_path))
FatalError("unable to read serialRT file");
//convert network to tensorRT
tkDNN::NetworkRT netRT(NULL, tensor_path);
tkDNN::RegionInterpret rI(netRT.input_dim, netRT.output_dim, 80, 4, 5, thresh, reg_bias);
tk::dnn::NetworkRT netRT(NULL, tensor_path);
tk::dnn::RegionInterpret rI(netRT.input_dim, netRT.output_dim, 80, 4, 5, thresh, reg_bias);
dnnType *input = new float[netRT.input_dim.tot()];
dnnType *output = new float[netRT.output_dim.tot()];
@@ -172,9 +172,9 @@ int main(int argc, char *argv[]) {
FatalError("could not read labels");
qsort(rI.res_boxes, rI.res_boxes_n, sizeof(tkDNN::box), prob_sort);
qsort(rI.res_boxes, rI.res_boxes_n, sizeof(tk::dnn::box), prob_sort);
for(int i=0; i<rI.res_boxes_n; i++) {
tkDNN::box bx = rI.res_boxes[i];
tk::dnn::box bx = rI.res_boxes[i];
std::cout<<" ("<<int(bx.prob*100)<<"%) "<<bx.cl
<<": "<<bx.x<<" "<<bx.y<<" "<<bx.w<<" "<<bx.h<<"\n";
@@ -184,7 +184,7 @@ int main(int argc, char *argv[]) {
}
std::cout<<"GROUND TRUTH\n";
tkDNN::box gt[256];
tk::dnn::box gt[256];
int gt_n = 0;
int cl;
float x, y, w, h;
@@ -212,7 +212,7 @@ int main(int argc, char *argv[]) {
int prec = 0;
for(int j=0; j<i; j++) { //for each detected in sub group
for(int z=0; z<gt_n; z++) { //control each ground truth
float iou = tkDNN::RegionInterpret::box_iou(rI.res_boxes[j], gt[z]);
float iou = tk::dnn::RegionInterpret::box_iou(rI.res_boxes[j], gt[z]);
if(iou > 0.6f && rI.res_boxes[j].cl == gt[z].cl) {
prec++;
break;