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;
+7 -7
View File
@@ -18,8 +18,8 @@ const char *reg_bias = "../tests/yolo/layers/g31.bin";
#endif
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;
@@ -56,7 +56,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) {
TIMER_START
@@ -148,8 +148,8 @@ int main(int argc, char *argv[]) {
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, CLASS, 4, 5, thresh, reg_bias);
tk::dnn::NetworkRT netRT(NULL, tensor_path);
tk::dnn::RegionInterpret rI(netRT.input_dim, netRT.output_dim, CLASS, 4, 5, thresh, reg_bias);
dnnType *input = new float[netRT.input_dim.tot()];
dnnType *output = new float[netRT.output_dim.tot()];
@@ -170,9 +170,9 @@ int main(int argc, char *argv[]) {
mTime += compute_image(img, &netRT, &rI, input, output);
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";
+2 -2
View File
@@ -5,7 +5,7 @@
#include "utils.h"
#include "Network.h"
namespace tkDNN {
namespace tk { namespace dnn {
enum layerType_t {
LAYER_DENSE,
@@ -340,5 +340,5 @@ public:
static float box_iou(box a, box b);
};
}
}}
#endif //LAYER_H
+2 -2
View File
@@ -3,7 +3,7 @@
#include "utils.h"
namespace tkDNN {
namespace tk { namespace dnn {
/**
Data rapresentation beetween layers
@@ -62,5 +62,5 @@ public:
bool fp16;
};
}
}}
#endif //NETWORK_H
+2 -2
View File
@@ -6,7 +6,7 @@
#include "Layer.h"
#include "NvInfer.h"
namespace tkDNN {
namespace tk { namespace dnn {
class NetworkRT {
@@ -62,5 +62,5 @@ template<typename T> T readBUF(const char*& buffer)
return val;
}
}
}}
#endif //NETWORKRT_H
+2 -2
View File
@@ -3,7 +3,7 @@
#include "Layer.h"
#include "kernels.h"
namespace tkDNN {
namespace tk { namespace dnn {
Activation::Activation(Network *net, int act_mode) :
Layer(net) {
@@ -63,4 +63,4 @@ dnnType* Activation::infer(dataDim_t &dim, dnnType* srcData) {
return dstData;
}
}
}}
+2 -2
View File
@@ -2,7 +2,7 @@
#include "Layer.h"
namespace tkDNN {
namespace tk { namespace dnn {
Conv2d::Conv2d( Network *net, int out_ch, int kernelH, int kernelW,
int strideH, int strideW, int paddingH, int paddingW,
@@ -125,4 +125,4 @@ dnnType* Conv2d::infer(dataDim_t &dim, dnnType* srcData) {
return dstData;
}
}
}}
+2 -2
View File
@@ -2,7 +2,7 @@
#include "Layer.h"
namespace tkDNN {
namespace tk { namespace dnn {
Dense::Dense(Network *net, int out_ch, const char* fname_weights) :
LayerWgs(net, net->getOutputDim().tot(), out_ch, 1, 1, 1, fname_weights) {
@@ -55,4 +55,4 @@ dnnType* Dense::infer(dataDim_t &dim, dnnType* srcData) {
return dstData;
}
}
}}
+2 -2
View File
@@ -3,7 +3,7 @@
#include "Layer.h"
#include "kernels.h"
namespace tkDNN {
namespace tk { namespace dnn {
Flatten::Flatten(Network *net) : Layer(net) {
@@ -33,4 +33,4 @@ dnnType* Flatten::infer(dataDim_t &dim, dnnType* srcData) {
return dstData;
}
}
}}
+2 -2
View File
@@ -2,7 +2,7 @@
#include "Layer.h"
namespace tkDNN {
namespace tk { namespace dnn {
Layer::Layer(Network *net) {
@@ -23,4 +23,4 @@ Layer::~Layer() {
checkCUDNN( cudnnDestroyTensorDescriptor(dstTensorDesc) );
}
}
}}
+2 -2
View File
@@ -4,7 +4,7 @@
#include "Layer.h"
#include "kernels.h"
namespace tkDNN {
namespace tk { namespace dnn {
LayerWgs::LayerWgs(Network *net, int inputs, int outputs,
int kh, int kw, int kl,
@@ -114,4 +114,4 @@ LayerWgs::~LayerWgs() {
}
}
}
}}
+2 -2
View File
@@ -3,7 +3,7 @@
#include "Layer.h"
#include "kernels.h"
namespace tkDNN {
namespace tk { namespace dnn {
MulAdd::MulAdd(Network *net, dnnType mul, dnnType add) : Layer(net) {
@@ -41,4 +41,4 @@ dnnType* MulAdd::infer(dataDim_t &dim, dnnType* srcData) {
return dstData;
}
}
}}
+2 -2
View File
@@ -5,7 +5,7 @@
#include "Network.h"
#include "Layer.h"
namespace tkDNN {
namespace tk { namespace dnn {
Network::Network(dataDim_t input_dim) {
this->input_dim = input_dim;
@@ -99,4 +99,4 @@ void Network::print() {
}
}
}}
+2 -2
View File
@@ -25,7 +25,7 @@ class Logger : public ILogger {
}
} loggerRT;
namespace tkDNN {
namespace tk { namespace dnn {
std::map<Layer*, nvinfer1::ITensor*>tensors;
@@ -399,4 +399,4 @@ bool NetworkRT::deserialize(const char *filename) {
return true;
}
}
}}
+2 -2
View File
@@ -3,7 +3,7 @@
#include "Layer.h"
#include "kernels.h"
namespace tkDNN {
namespace tk { namespace dnn {
Pooling::Pooling( Network *net, int winH, int winW, int strideH, int strideW,
tkdnnPoolingMode_t pool_mode) :
@@ -107,4 +107,4 @@ dnnType* Pooling::infer(dataDim_t &dim, dnnType* srcData) {
return dstData;
}
}
}}
+2 -2
View File
@@ -9,7 +9,7 @@
#include "Layer.h"
#include "kernels.h"
namespace tkDNN {
namespace tk { namespace dnn {
Region::Region(Network *net, int classes, int coords, int num) :
Layer(net) {
@@ -339,4 +339,4 @@ void RegionInterpret::showImageResult(dnnType *input_h) {
#endif
}
}
}}
+2 -2
View File
@@ -3,7 +3,7 @@
#include "Layer.h"
#include "kernels.h"
namespace tkDNN {
namespace tk { namespace dnn {
Reorg::Reorg(Network *net, int stride) : Layer(net) {
@@ -31,4 +31,4 @@ dnnType* Reorg::infer(dataDim_t &dim, dnnType* srcData) {
return dstData;
}
}
}}
+2 -2
View File
@@ -3,7 +3,7 @@
#include "Layer.h"
#include "kernels.h"
namespace tkDNN {
namespace tk { namespace dnn {
Route::Route(Network *net, Layer **layers, int layers_n) : Layer(net) {
@@ -53,4 +53,4 @@ dnnType* Route::infer(dataDim_t &dim, dnnType* srcData) {
return dstData;
}
}
}}
+2 -2
View File
@@ -3,7 +3,7 @@
#include "Layer.h"
#include "kernels.h"
namespace tkDNN {
namespace tk { namespace dnn {
Softmax::Softmax(Network *net) : Layer(net) {
@@ -44,4 +44,4 @@ dnnType* Softmax::infer(dataDim_t &dim, dnnType* srcData) {
return dstData;
}
}
}}
+1 -1
View File
@@ -53,7 +53,7 @@ public:
virtual void serialize(void* buffer) override {
char *buf = reinterpret_cast<char*>(buffer);
tkDNN::writeBUF(buf, size);
tk::dnn::writeBUF(buf, size);
}
int size;
+1 -1
View File
@@ -8,7 +8,7 @@
class BatchStream
{
public:
BatchStream(tkDNN::dataDim_t dim, int batchSize, int maxBatches)
BatchStream(tk::dnn::dataDim_t dim, int batchSize, int maxBatches)
{
mBatchSize = batchSize;
mMaxBatches = maxBatches;
+6 -6
View File
@@ -74,12 +74,12 @@ public:
virtual void serialize(void* buffer) override {
char *buf = reinterpret_cast<char*>(buffer);
tkDNN::writeBUF(buf, classes);
tkDNN::writeBUF(buf, coords);
tkDNN::writeBUF(buf, num);
tkDNN::writeBUF(buf, c);
tkDNN::writeBUF(buf, h);
tkDNN::writeBUF(buf, w);
tk::dnn::writeBUF(buf, classes);
tk::dnn::writeBUF(buf, coords);
tk::dnn::writeBUF(buf, num);
tk::dnn::writeBUF(buf, c);
tk::dnn::writeBUF(buf, h);
tk::dnn::writeBUF(buf, w);
}
int c, h, w;
+4 -4
View File
@@ -53,10 +53,10 @@ public:
virtual void serialize(void* buffer) override {
char *buf = reinterpret_cast<char*>(buffer);
tkDNN::writeBUF(buf, stride);
tkDNN::writeBUF(buf, c);
tkDNN::writeBUF(buf, h);
tkDNN::writeBUF(buf, w);
tk::dnn::writeBUF(buf, stride);
tk::dnn::writeBUF(buf, c);
tk::dnn::writeBUF(buf, h);
tk::dnn::writeBUF(buf, w);
}
int c, h, w, stride;
+12 -12
View File
@@ -11,18 +11,18 @@ const char *output_bin = "../tests/mnist/output.bin";
int main() {
// Network layout
tkDNN::dataDim_t dim(1, 1, 28, 28, 1);
tkDNN::Network net(dim);
tkDNN::Conv2d l0(&net, 20, 5, 5, 1, 1, 0, 0, c0_bin);
tkDNN::Pooling l1(&net, 2, 2, 2, 2, tkDNN::POOLING_MAX);
tkDNN::Conv2d l2(&net, 50, 5, 5, 1, 1, 0, 0, c1_bin);
tkDNN::Pooling l3(&net, 2, 2, 2, 2, tkDNN::POOLING_MAX);
tkDNN::Dense l4(&net, 500, d2_bin);
tkDNN::Activation l5(&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Dense l6(&net, 10, d3_bin);
tkDNN::Softmax l7(&net);
tk::dnn::dataDim_t dim(1, 1, 28, 28, 1);
tk::dnn::Network net(dim);
tk::dnn::Conv2d l0(&net, 20, 5, 5, 1, 1, 0, 0, c0_bin);
tk::dnn::Pooling l1(&net, 2, 2, 2, 2, tk::dnn::POOLING_MAX);
tk::dnn::Conv2d l2(&net, 50, 5, 5, 1, 1, 0, 0, c1_bin);
tk::dnn::Pooling l3(&net, 2, 2, 2, 2, tk::dnn::POOLING_MAX);
tk::dnn::Dense l4(&net, 500, d2_bin);
tk::dnn::Activation l5(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Dense l6(&net, 10, d3_bin);
tk::dnn::Softmax l7(&net);
tkDNN::NetworkRT netRT(&net, "mnist.rt");
tk::dnn::NetworkRT netRT(&net, "mnist.rt");
// Load input
dnnType *data;
@@ -43,7 +43,7 @@ int main() {
//std::cout<<"\n======= CUDNN RESULT =======\n";
//printDeviceVector(10, out_data);
tkDNN::dataDim_t dim2(1, 1, 28, 28, 1);
tk::dnn::dataDim_t dim2(1, 1, 28, 28, 1);
std::cout<<"TENSORRT inference:\n"; {
dim2.print();
+14 -14
View File
@@ -27,16 +27,16 @@ int main() {
std::cout<<"\n==== CUDNN ====\n";
// Network layout
tkDNN::dataDim_t dim(1, 1, 28, 28, 1);
tkDNN::Network net(dim);
tkDNN::Conv2d l0(&net, 20, 5, 5, 1, 1, 0, 0, c0_bin);
tkDNN::Pooling l1(&net, 2, 2, 2, 2, tkDNN::POOLING_MAX);
tkDNN::Conv2d l2(&net, 50, 5, 5, 1, 1, 0, 0, c1_bin);
tkDNN::Pooling l3(&net, 2, 2, 2, 2, tkDNN::POOLING_MAX);
tkDNN::Dense l4(&net, 500, d2_bin);
tkDNN::Activation l5(&net, CUDNN_ACTIVATION_RELU);
tkDNN::Dense l6(&net, 10, d3_bin);
tkDNN::Softmax l7(&net);
tk::dnn::dataDim_t dim(1, 1, 28, 28, 1);
tk::dnn::Network net(dim);
tk::dnn::Conv2d l0(&net, 20, 5, 5, 1, 1, 0, 0, c0_bin);
tk::dnn::Pooling l1(&net, 2, 2, 2, 2, tk::dnn::POOLING_MAX);
tk::dnn::Conv2d l2(&net, 50, 5, 5, 1, 1, 0, 0, c1_bin);
tk::dnn::Pooling l3(&net, 2, 2, 2, 2, tk::dnn::POOLING_MAX);
tk::dnn::Dense l4(&net, 500, d2_bin);
tk::dnn::Activation l5(&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Dense l6(&net, 10, d3_bin);
tk::dnn::Softmax l7(&net);
// Load input
dnnType *data;
@@ -71,7 +71,7 @@ int main() {
auto input = network->addInput("data", dt, DimsCHW{ 1, 28, 28});
assert(input != nullptr);
tkDNN::Conv2d *c0 = &l0;
tk::dnn::Conv2d *c0 = &l0;
Weights w { dt, c0->data_h, c0->inputs*c0->outputs*c0->kernelH*c0->kernelW};
Weights b { dt, c0->bias_h, c0->outputs};
// Add a convolution layer with 20 outputs and a 5x5 filter.
@@ -84,7 +84,7 @@ int main() {
assert(pool1 != nullptr);
pool1->setStride(DimsHW{2, 2});
tkDNN::Conv2d *c1 = &l2;
tk::dnn::Conv2d *c1 = &l2;
Weights w1 { dt, c1->data_h, c1->inputs*c1->outputs*c1->kernelH*c1->kernelW};
Weights b1 { dt, c1->bias_h, c1->outputs};
// Add a second convolution layer with 50 outputs and a 5x5 filter.
@@ -97,7 +97,7 @@ int main() {
assert(pool2 != nullptr);
pool2->setStride(DimsHW{2, 2});
tkDNN::Dense *d2 = &l4;
tk::dnn::Dense *d2 = &l4;
Weights w2 { dt, d2->data_h, d2->inputs*d2->outputs};
Weights b2 { dt, d2->bias_h, d2->outputs};
// Add a fully connected layer with 500 outputs.
@@ -108,7 +108,7 @@ int main() {
auto relu1 = network->addActivation(*ip1->getOutput(0), ActivationType::kRELU);
assert(relu1 != nullptr);
tkDNN::Dense *d3 = &l6;
tk::dnn::Dense *d3 = &l6;
Weights w3 { dt, d3->data_h, d3->inputs*d3->outputs};
Weights b3 { dt, d3->bias_h, d3->outputs};
// Add a second fully connected layer with 20 outputs.
+9 -9
View File
@@ -10,15 +10,15 @@ const char *output_bin = "../tests/simple/output.bin";
int main() {
// Network layout
tkDNN::dataDim_t dim(1, 1, 10, 10, 1);
tkDNN::Network net(dim);
tkDNN::Conv2d l0(&net, 2, 4, 4, 2, 2, 0, 0, c0_bin);
tkDNN::Activation l1(&net, CUDNN_ACTIVATION_RELU);
tkDNN::Conv2d l2(&net, 4, 2, 2, 1, 1, 0, 0, c1_bin);
tkDNN::Activation l3(&net, CUDNN_ACTIVATION_RELU);
tkDNN::Flatten l4(&net);
tkDNN::Dense l5(&net, 4, d2_bin);
tkDNN::Activation l6(&net, CUDNN_ACTIVATION_RELU);
tk::dnn::dataDim_t dim(1, 1, 10, 10, 1);
tk::dnn::Network net(dim);
tk::dnn::Conv2d l0(&net, 2, 4, 4, 2, 2, 0, 0, c0_bin);
tk::dnn::Activation l1(&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Conv2d l2(&net, 4, 2, 2, 1, 1, 0, 0, c1_bin);
tk::dnn::Activation l3(&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Flatten l4(&net);
tk::dnn::Dense l5(&net, 4, d2_bin);
tk::dnn::Activation l6(&net, CUDNN_ACTIVATION_RELU);
// Load input
dnnType *data;
+1 -1
View File
@@ -11,7 +11,7 @@ int main(int argc, char *argv[]) {
srand (0);
//convert network to tensorRT
tkDNN::NetworkRT netRT(NULL, argv[1]);
tk::dnn::NetworkRT netRT(NULL, argv[1]);
dnnType *input = new float[netRT.input_dim.tot()];
dnnType *output = new float[netRT.input_dim.tot()];
+62 -62
View File
@@ -31,75 +31,75 @@ const char *output_bin = "../tests/yolo/layers/output.bin";
int main() {
// Network layout
tkDNN::dataDim_t dim(1, 3, 608, 608, 1);
tkDNN::Network net(dim);
tk::dnn::dataDim_t dim(1, 3, 608, 608, 1);
tk::dnn::Network net(dim);
tkDNN::Conv2d c0 (&net, 32, 3, 3, 1, 1, 1, 1, c0_bin, true);
tkDNN::Activation a0 (&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Pooling p1 (&net, 2, 2, 2, 2, tkDNN::POOLING_MAX);
tk::dnn::Conv2d c0 (&net, 32, 3, 3, 1, 1, 1, 1, c0_bin, true);
tk::dnn::Activation a0 (&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Pooling p1 (&net, 2, 2, 2, 2, tk::dnn::POOLING_MAX);
tkDNN::Conv2d c2 (&net, 64, 3, 3, 1, 1, 1, 1, c2_bin, true);
tkDNN::Activation a2 (&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Pooling p3 (&net, 2, 2, 2, 2, tkDNN::POOLING_MAX);
tk::dnn::Conv2d c2 (&net, 64, 3, 3, 1, 1, 1, 1, c2_bin, true);
tk::dnn::Activation a2 (&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Pooling p3 (&net, 2, 2, 2, 2, tk::dnn::POOLING_MAX);
tkDNN::Conv2d c4 (&net, 128, 3, 3, 1, 1, 1, 1, c4_bin, true);
tkDNN::Activation a4 (&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Conv2d c5 (&net, 64, 1, 1, 1, 1, 0, 0, c5_bin, true);
tkDNN::Activation a5 (&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Conv2d c6 (&net, 128, 3, 3, 1, 1, 1, 1, c6_bin, true);
tkDNN::Activation a6 (&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Pooling p7 (&net, 2, 2, 2, 2, tkDNN::POOLING_MAX);
tk::dnn::Conv2d c4 (&net, 128, 3, 3, 1, 1, 1, 1, c4_bin, true);
tk::dnn::Activation a4 (&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c5 (&net, 64, 1, 1, 1, 1, 0, 0, c5_bin, true);
tk::dnn::Activation a5 (&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c6 (&net, 128, 3, 3, 1, 1, 1, 1, c6_bin, true);
tk::dnn::Activation a6 (&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Pooling p7 (&net, 2, 2, 2, 2, tk::dnn::POOLING_MAX);
tkDNN::Conv2d c8 (&net, 256, 3, 3, 1, 1, 1, 1, c8_bin, true);
tkDNN::Activation a8 (&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Conv2d c9 (&net, 128, 1, 1, 1, 1, 0, 0, c9_bin, true);
tkDNN::Activation a9 (&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Conv2d c10(&net, 256, 3, 3, 1, 1, 1, 1, c10_bin, true);
tkDNN::Activation a10(&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Pooling p11(&net, 2, 2, 2, 2, tkDNN::POOLING_MAX);
tk::dnn::Conv2d c8 (&net, 256, 3, 3, 1, 1, 1, 1, c8_bin, true);
tk::dnn::Activation a8 (&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c9 (&net, 128, 1, 1, 1, 1, 0, 0, c9_bin, true);
tk::dnn::Activation a9 (&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c10(&net, 256, 3, 3, 1, 1, 1, 1, c10_bin, true);
tk::dnn::Activation a10(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Pooling p11(&net, 2, 2, 2, 2, tk::dnn::POOLING_MAX);
tkDNN::Conv2d c12(&net, 512, 3, 3, 1, 1, 1, 1, c12_bin, true);
tkDNN::Activation a12(&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Conv2d c13(&net, 256, 1, 1, 1, 1, 0, 0, c13_bin, true);
tkDNN::Activation a13(&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Conv2d c14(&net, 512, 3, 3, 1, 1, 1, 1, c14_bin, true);
tkDNN::Activation a14(&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Conv2d c15(&net, 256, 1, 1, 1, 1, 0, 0, c15_bin, true);
tkDNN::Activation a15(&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Conv2d c16(&net, 512, 3, 3, 1, 1, 1, 1, c16_bin, true);
tkDNN::Activation a16(&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Pooling p17(&net, 2, 2, 2, 2, tkDNN::POOLING_MAX);
tk::dnn::Conv2d c12(&net, 512, 3, 3, 1, 1, 1, 1, c12_bin, true);
tk::dnn::Activation a12(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c13(&net, 256, 1, 1, 1, 1, 0, 0, c13_bin, true);
tk::dnn::Activation a13(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c14(&net, 512, 3, 3, 1, 1, 1, 1, c14_bin, true);
tk::dnn::Activation a14(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c15(&net, 256, 1, 1, 1, 1, 0, 0, c15_bin, true);
tk::dnn::Activation a15(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c16(&net, 512, 3, 3, 1, 1, 1, 1, c16_bin, true);
tk::dnn::Activation a16(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Pooling p17(&net, 2, 2, 2, 2, tk::dnn::POOLING_MAX);
tkDNN::Conv2d c18(&net, 1024, 3, 3, 1, 1, 1, 1, c18_bin, true);
tkDNN::Activation a18(&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Conv2d c19(&net, 512, 1, 1, 1, 1, 0, 0, c19_bin, true);
tkDNN::Activation a19(&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Conv2d c20(&net, 1024, 3, 3, 1, 1, 1, 1, c20_bin, true);
tkDNN::Activation a20(&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Conv2d c21(&net, 512, 1, 1, 1, 1, 0, 0, c21_bin, true);
tkDNN::Activation a21(&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Conv2d c22(&net, 1024, 3, 3, 1, 1, 1, 1, c22_bin, true);
tkDNN::Activation a22(&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Conv2d c23(&net, 1024, 3, 3, 1, 1, 1, 1, c23_bin, true);
tkDNN::Activation a23(&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Conv2d c24(&net, 1024, 3, 3, 1, 1, 1, 1, c24_bin, true);
tkDNN::Activation a24(&net, tkDNN::ACTIVATION_LEAKY);
tk::dnn::Conv2d c18(&net, 1024, 3, 3, 1, 1, 1, 1, c18_bin, true);
tk::dnn::Activation a18(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c19(&net, 512, 1, 1, 1, 1, 0, 0, c19_bin, true);
tk::dnn::Activation a19(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c20(&net, 1024, 3, 3, 1, 1, 1, 1, c20_bin, true);
tk::dnn::Activation a20(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c21(&net, 512, 1, 1, 1, 1, 0, 0, c21_bin, true);
tk::dnn::Activation a21(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c22(&net, 1024, 3, 3, 1, 1, 1, 1, c22_bin, true);
tk::dnn::Activation a22(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c23(&net, 1024, 3, 3, 1, 1, 1, 1, c23_bin, true);
tk::dnn::Activation a23(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c24(&net, 1024, 3, 3, 1, 1, 1, 1, c24_bin, true);
tk::dnn::Activation a24(&net, tk::dnn::ACTIVATION_LEAKY);
tkDNN::Layer *m25_layers[1] = { &a16 };
tkDNN::Route m25(&net, m25_layers, 1);
tkDNN::Conv2d c26(&net, 64, 1, 1, 1, 1, 0, 0, c26_bin, true);
tkDNN::Activation a26(&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Reorg r27(&net, 2);
tk::dnn::Layer *m25_layers[1] = { &a16 };
tk::dnn::Route m25(&net, m25_layers, 1);
tk::dnn::Conv2d c26(&net, 64, 1, 1, 1, 1, 0, 0, c26_bin, true);
tk::dnn::Activation a26(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Reorg r27(&net, 2);
tkDNN::Layer *m28_layers[2] = { &r27, &a24 };
tkDNN::Route m28(&net, m28_layers, 2);
tk::dnn::Layer *m28_layers[2] = { &r27, &a24 };
tk::dnn::Route m28(&net, m28_layers, 2);
tkDNN::Conv2d c29(&net, 1024, 3, 3, 1, 1, 1, 1, c29_bin, true);
tkDNN::Activation a29(&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Conv2d c30(&net, 425, 1, 1, 1, 1, 0, 0, c30_bin, false);
tkDNN::Region g31(&net, 80, 4, 5);
tk::dnn::Conv2d c29(&net, 1024, 3, 3, 1, 1, 1, 1, c29_bin, true);
tk::dnn::Activation a29(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c30(&net, 425, 1, 1, 1, 1, 0, 0, c30_bin, false);
tk::dnn::Region g31(&net, 80, 4, 5);
tkDNN::RegionInterpret rI(dim, g31.output_dim, 80, 4, 5, 0.6f, g31_bin);
tk::dnn::RegionInterpret rI(dim, g31.output_dim, 80, 4, 5, 0.6f, g31_bin);
// Load input
dnnType *data;
@@ -110,11 +110,11 @@ int main() {
net.print();
//convert network to tensorRT
tkDNN::NetworkRT netRT(&net, "yolo.rt");
tk::dnn::NetworkRT netRT(&net, "yolo.rt");
dnnType *out_data, *out_data2; // cudnn output, tensorRT output
tkDNN::dataDim_t dim1 = dim; //input dim
tk::dnn::dataDim_t dim1 = dim; //input dim
printCenteredTitle(" CUDNN inference ", '=', 30); {
dim1.print();
TIMER_START
@@ -123,7 +123,7 @@ int main() {
dim1.print();
}
tkDNN::dataDim_t dim2 = dim;
tk::dnn::dataDim_t dim2 = dim;
printCenteredTitle(" TENSORRT inference ", '=', 30); {
dim2.print();
TIMER_START
+62 -62
View File
@@ -31,75 +31,75 @@ const char *output_bin = "../tests/yolo_224/layers/output.bin";
int main() {
// Network layout
tkDNN::dataDim_t dim(1, 3, 224, 224, 1);
tkDNN::Network net(dim);
tk::dnn::dataDim_t dim(1, 3, 224, 224, 1);
tk::dnn::Network net(dim);
tkDNN::Conv2d c0 (&net, 32, 3, 3, 1, 1, 1, 1, c0_bin, true);
tkDNN::Activation a0 (&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Pooling p1 (&net, 2, 2, 2, 2, tkDNN::POOLING_MAX);
tk::dnn::Conv2d c0 (&net, 32, 3, 3, 1, 1, 1, 1, c0_bin, true);
tk::dnn::Activation a0 (&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Pooling p1 (&net, 2, 2, 2, 2, tk::dnn::POOLING_MAX);
tkDNN::Conv2d c2 (&net, 64, 3, 3, 1, 1, 1, 1, c2_bin, true);
tkDNN::Activation a2 (&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Pooling p3 (&net, 2, 2, 2, 2, tkDNN::POOLING_MAX);
tk::dnn::Conv2d c2 (&net, 64, 3, 3, 1, 1, 1, 1, c2_bin, true);
tk::dnn::Activation a2 (&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Pooling p3 (&net, 2, 2, 2, 2, tk::dnn::POOLING_MAX);
tkDNN::Conv2d c4 (&net, 128, 3, 3, 1, 1, 1, 1, c4_bin, true);
tkDNN::Activation a4 (&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Conv2d c5 (&net, 64, 1, 1, 1, 1, 0, 0, c5_bin, true);
tkDNN::Activation a5 (&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Conv2d c6 (&net, 128, 3, 3, 1, 1, 1, 1, c6_bin, true);
tkDNN::Activation a6 (&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Pooling p7 (&net, 2, 2, 2, 2, tkDNN::POOLING_MAX);
tk::dnn::Conv2d c4 (&net, 128, 3, 3, 1, 1, 1, 1, c4_bin, true);
tk::dnn::Activation a4 (&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c5 (&net, 64, 1, 1, 1, 1, 0, 0, c5_bin, true);
tk::dnn::Activation a5 (&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c6 (&net, 128, 3, 3, 1, 1, 1, 1, c6_bin, true);
tk::dnn::Activation a6 (&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Pooling p7 (&net, 2, 2, 2, 2, tk::dnn::POOLING_MAX);
tkDNN::Conv2d c8 (&net, 256, 3, 3, 1, 1, 1, 1, c8_bin, true);
tkDNN::Activation a8 (&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Conv2d c9 (&net, 128, 1, 1, 1, 1, 0, 0, c9_bin, true);
tkDNN::Activation a9 (&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Conv2d c10(&net, 256, 3, 3, 1, 1, 1, 1, c10_bin, true);
tkDNN::Activation a10(&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Pooling p11(&net, 2, 2, 2, 2, tkDNN::POOLING_MAX);
tk::dnn::Conv2d c8 (&net, 256, 3, 3, 1, 1, 1, 1, c8_bin, true);
tk::dnn::Activation a8 (&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c9 (&net, 128, 1, 1, 1, 1, 0, 0, c9_bin, true);
tk::dnn::Activation a9 (&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c10(&net, 256, 3, 3, 1, 1, 1, 1, c10_bin, true);
tk::dnn::Activation a10(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Pooling p11(&net, 2, 2, 2, 2, tk::dnn::POOLING_MAX);
tkDNN::Conv2d c12(&net, 512, 3, 3, 1, 1, 1, 1, c12_bin, true);
tkDNN::Activation a12(&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Conv2d c13(&net, 256, 1, 1, 1, 1, 0, 0, c13_bin, true);
tkDNN::Activation a13(&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Conv2d c14(&net, 512, 3, 3, 1, 1, 1, 1, c14_bin, true);
tkDNN::Activation a14(&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Conv2d c15(&net, 256, 1, 1, 1, 1, 0, 0, c15_bin, true);
tkDNN::Activation a15(&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Conv2d c16(&net, 512, 3, 3, 1, 1, 1, 1, c16_bin, true);
tkDNN::Activation a16(&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Pooling p17(&net, 2, 2, 2, 2, tkDNN::POOLING_MAX);
tk::dnn::Conv2d c12(&net, 512, 3, 3, 1, 1, 1, 1, c12_bin, true);
tk::dnn::Activation a12(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c13(&net, 256, 1, 1, 1, 1, 0, 0, c13_bin, true);
tk::dnn::Activation a13(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c14(&net, 512, 3, 3, 1, 1, 1, 1, c14_bin, true);
tk::dnn::Activation a14(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c15(&net, 256, 1, 1, 1, 1, 0, 0, c15_bin, true);
tk::dnn::Activation a15(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c16(&net, 512, 3, 3, 1, 1, 1, 1, c16_bin, true);
tk::dnn::Activation a16(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Pooling p17(&net, 2, 2, 2, 2, tk::dnn::POOLING_MAX);
tkDNN::Conv2d c18(&net, 1024, 3, 3, 1, 1, 1, 1, c18_bin, true);
tkDNN::Activation a18(&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Conv2d c19(&net, 512, 1, 1, 1, 1, 0, 0, c19_bin, true);
tkDNN::Activation a19(&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Conv2d c20(&net, 1024, 3, 3, 1, 1, 1, 1, c20_bin, true);
tkDNN::Activation a20(&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Conv2d c21(&net, 512, 1, 1, 1, 1, 0, 0, c21_bin, true);
tkDNN::Activation a21(&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Conv2d c22(&net, 1024, 3, 3, 1, 1, 1, 1, c22_bin, true);
tkDNN::Activation a22(&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Conv2d c23(&net, 1024, 3, 3, 1, 1, 1, 1, c23_bin, true);
tkDNN::Activation a23(&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Conv2d c24(&net, 1024, 3, 3, 1, 1, 1, 1, c24_bin, true);
tkDNN::Activation a24(&net, tkDNN::ACTIVATION_LEAKY);
tk::dnn::Conv2d c18(&net, 1024, 3, 3, 1, 1, 1, 1, c18_bin, true);
tk::dnn::Activation a18(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c19(&net, 512, 1, 1, 1, 1, 0, 0, c19_bin, true);
tk::dnn::Activation a19(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c20(&net, 1024, 3, 3, 1, 1, 1, 1, c20_bin, true);
tk::dnn::Activation a20(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c21(&net, 512, 1, 1, 1, 1, 0, 0, c21_bin, true);
tk::dnn::Activation a21(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c22(&net, 1024, 3, 3, 1, 1, 1, 1, c22_bin, true);
tk::dnn::Activation a22(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c23(&net, 1024, 3, 3, 1, 1, 1, 1, c23_bin, true);
tk::dnn::Activation a23(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c24(&net, 1024, 3, 3, 1, 1, 1, 1, c24_bin, true);
tk::dnn::Activation a24(&net, tk::dnn::ACTIVATION_LEAKY);
tkDNN::Layer *m25_layers[1] = { &a16 };
tkDNN::Route m25(&net, m25_layers, 1);
tkDNN::Conv2d c26(&net, 64, 1, 1, 1, 1, 0, 0, c26_bin, true);
tkDNN::Activation a26(&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Reorg r27(&net, 2);
tk::dnn::Layer *m25_layers[1] = { &a16 };
tk::dnn::Route m25(&net, m25_layers, 1);
tk::dnn::Conv2d c26(&net, 64, 1, 1, 1, 1, 0, 0, c26_bin, true);
tk::dnn::Activation a26(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Reorg r27(&net, 2);
tkDNN::Layer *m28_layers[2] = { &r27, &a24 };
tkDNN::Route m28(&net, m28_layers, 2);
tk::dnn::Layer *m28_layers[2] = { &r27, &a24 };
tk::dnn::Route m28(&net, m28_layers, 2);
tkDNN::Conv2d c29(&net, 1024, 3, 3, 1, 1, 1, 1, c29_bin, true);
tkDNN::Activation a29(&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Conv2d c30(&net, 425, 1, 1, 1, 1, 0, 0, c30_bin, false);
tkDNN::Region g31(&net, 80, 4, 5);
tk::dnn::Conv2d c29(&net, 1024, 3, 3, 1, 1, 1, 1, c29_bin, true);
tk::dnn::Activation a29(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c30(&net, 425, 1, 1, 1, 1, 0, 0, c30_bin, false);
tk::dnn::Region g31(&net, 80, 4, 5);
tkDNN::RegionInterpret rI(dim, g31.output_dim, 80, 4, 5, 0.6f, g31_bin);
tk::dnn::RegionInterpret rI(dim, g31.output_dim, 80, 4, 5, 0.6f, g31_bin);
// Load input
dnnType *data;
@@ -110,11 +110,11 @@ int main() {
net.print();
//convert network to tensorRT
tkDNN::NetworkRT netRT(&net, "yolo_224.rt");
tk::dnn::NetworkRT netRT(&net, "yolo_224.rt");
dnnType *out_data, *out_data2; // cudnn output, tensorRT output
tkDNN::dataDim_t dim1 = dim; //input dim
tk::dnn::dataDim_t dim1 = dim; //input dim
printCenteredTitle(" CUDNN inference ", '=', 30); {
dim1.print();
TIMER_START
@@ -123,7 +123,7 @@ int main() {
dim1.print();
}
tkDNN::dataDim_t dim2 = dim;
tk::dnn::dataDim_t dim2 = dim;
printCenteredTitle(" TENSORRT inference ", '=', 30); {
dim2.print();
TIMER_START
+62 -62
View File
@@ -31,75 +31,75 @@ const char *output_bin = "../tests/yolo_relu/layers/output.bin";
int main() {
// Network layout
tkDNN::dataDim_t dim(1, 3, 608, 608, 1);
tkDNN::Network net(dim);
tk::dnn::dataDim_t dim(1, 3, 608, 608, 1);
tk::dnn::Network net(dim);
tkDNN::Conv2d c0 (&net, 32, 3, 3, 1, 1, 1, 1, c0_bin, true);
tkDNN::Activation a0 (&net, CUDNN_ACTIVATION_RELU);
tkDNN::Pooling p1 (&net, 2, 2, 2, 2, tkDNN::POOLING_MAX);
tk::dnn::Conv2d c0 (&net, 32, 3, 3, 1, 1, 1, 1, c0_bin, true);
tk::dnn::Activation a0 (&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Pooling p1 (&net, 2, 2, 2, 2, tk::dnn::POOLING_MAX);
tkDNN::Conv2d c2 (&net, 64, 3, 3, 1, 1, 1, 1, c2_bin, true);
tkDNN::Activation a2 (&net, CUDNN_ACTIVATION_RELU);
tkDNN::Pooling p3 (&net, 2, 2, 2, 2, tkDNN::POOLING_MAX);
tk::dnn::Conv2d c2 (&net, 64, 3, 3, 1, 1, 1, 1, c2_bin, true);
tk::dnn::Activation a2 (&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Pooling p3 (&net, 2, 2, 2, 2, tk::dnn::POOLING_MAX);
tkDNN::Conv2d c4 (&net, 128, 3, 3, 1, 1, 1, 1, c4_bin, true);
tkDNN::Activation a4 (&net, CUDNN_ACTIVATION_RELU);
tkDNN::Conv2d c5 (&net, 64, 1, 1, 1, 1, 0, 0, c5_bin, true);
tkDNN::Activation a5 (&net, CUDNN_ACTIVATION_RELU);
tkDNN::Conv2d c6 (&net, 128, 3, 3, 1, 1, 1, 1, c6_bin, true);
tkDNN::Activation a6 (&net, CUDNN_ACTIVATION_RELU);
tkDNN::Pooling p7 (&net, 2, 2, 2, 2, tkDNN::POOLING_MAX);
tk::dnn::Conv2d c4 (&net, 128, 3, 3, 1, 1, 1, 1, c4_bin, true);
tk::dnn::Activation a4 (&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Conv2d c5 (&net, 64, 1, 1, 1, 1, 0, 0, c5_bin, true);
tk::dnn::Activation a5 (&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Conv2d c6 (&net, 128, 3, 3, 1, 1, 1, 1, c6_bin, true);
tk::dnn::Activation a6 (&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Pooling p7 (&net, 2, 2, 2, 2, tk::dnn::POOLING_MAX);
tkDNN::Conv2d c8 (&net, 256, 3, 3, 1, 1, 1, 1, c8_bin, true);
tkDNN::Activation a8 (&net, CUDNN_ACTIVATION_RELU);
tkDNN::Conv2d c9 (&net, 128, 1, 1, 1, 1, 0, 0, c9_bin, true);
tkDNN::Activation a9 (&net, CUDNN_ACTIVATION_RELU);
tkDNN::Conv2d c10(&net, 256, 3, 3, 1, 1, 1, 1, c10_bin, true);
tkDNN::Activation a10(&net, CUDNN_ACTIVATION_RELU);
tkDNN::Pooling p11(&net, 2, 2, 2, 2, tkDNN::POOLING_MAX);
tk::dnn::Conv2d c8 (&net, 256, 3, 3, 1, 1, 1, 1, c8_bin, true);
tk::dnn::Activation a8 (&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Conv2d c9 (&net, 128, 1, 1, 1, 1, 0, 0, c9_bin, true);
tk::dnn::Activation a9 (&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Conv2d c10(&net, 256, 3, 3, 1, 1, 1, 1, c10_bin, true);
tk::dnn::Activation a10(&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Pooling p11(&net, 2, 2, 2, 2, tk::dnn::POOLING_MAX);
tkDNN::Conv2d c12(&net, 512, 3, 3, 1, 1, 1, 1, c12_bin, true);
tkDNN::Activation a12(&net, CUDNN_ACTIVATION_RELU);
tkDNN::Conv2d c13(&net, 256, 1, 1, 1, 1, 0, 0, c13_bin, true);
tkDNN::Activation a13(&net, CUDNN_ACTIVATION_RELU);
tkDNN::Conv2d c14(&net, 512, 3, 3, 1, 1, 1, 1, c14_bin, true);
tkDNN::Activation a14(&net, CUDNN_ACTIVATION_RELU);
tkDNN::Conv2d c15(&net, 256, 1, 1, 1, 1, 0, 0, c15_bin, true);
tkDNN::Activation a15(&net, CUDNN_ACTIVATION_RELU);
tkDNN::Conv2d c16(&net, 512, 3, 3, 1, 1, 1, 1, c16_bin, true);
tkDNN::Activation a16(&net, CUDNN_ACTIVATION_RELU);
tkDNN::Pooling p17(&net, 2, 2, 2, 2, tkDNN::POOLING_MAX);
tk::dnn::Conv2d c12(&net, 512, 3, 3, 1, 1, 1, 1, c12_bin, true);
tk::dnn::Activation a12(&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Conv2d c13(&net, 256, 1, 1, 1, 1, 0, 0, c13_bin, true);
tk::dnn::Activation a13(&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Conv2d c14(&net, 512, 3, 3, 1, 1, 1, 1, c14_bin, true);
tk::dnn::Activation a14(&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Conv2d c15(&net, 256, 1, 1, 1, 1, 0, 0, c15_bin, true);
tk::dnn::Activation a15(&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Conv2d c16(&net, 512, 3, 3, 1, 1, 1, 1, c16_bin, true);
tk::dnn::Activation a16(&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Pooling p17(&net, 2, 2, 2, 2, tk::dnn::POOLING_MAX);
tkDNN::Conv2d c18(&net, 1024, 3, 3, 1, 1, 1, 1, c18_bin, true);
tkDNN::Activation a18(&net, CUDNN_ACTIVATION_RELU);
tkDNN::Conv2d c19(&net, 512, 1, 1, 1, 1, 0, 0, c19_bin, true);
tkDNN::Activation a19(&net, CUDNN_ACTIVATION_RELU);
tkDNN::Conv2d c20(&net, 1024, 3, 3, 1, 1, 1, 1, c20_bin, true);
tkDNN::Activation a20(&net, CUDNN_ACTIVATION_RELU);
tkDNN::Conv2d c21(&net, 512, 1, 1, 1, 1, 0, 0, c21_bin, true);
tkDNN::Activation a21(&net, CUDNN_ACTIVATION_RELU);
tkDNN::Conv2d c22(&net, 1024, 3, 3, 1, 1, 1, 1, c22_bin, true);
tkDNN::Activation a22(&net, CUDNN_ACTIVATION_RELU);
tkDNN::Conv2d c23(&net, 1024, 3, 3, 1, 1, 1, 1, c23_bin, true);
tkDNN::Activation a23(&net, CUDNN_ACTIVATION_RELU);
tkDNN::Conv2d c24(&net, 1024, 3, 3, 1, 1, 1, 1, c24_bin, true);
tkDNN::Activation a24(&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Conv2d c18(&net, 1024, 3, 3, 1, 1, 1, 1, c18_bin, true);
tk::dnn::Activation a18(&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Conv2d c19(&net, 512, 1, 1, 1, 1, 0, 0, c19_bin, true);
tk::dnn::Activation a19(&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Conv2d c20(&net, 1024, 3, 3, 1, 1, 1, 1, c20_bin, true);
tk::dnn::Activation a20(&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Conv2d c21(&net, 512, 1, 1, 1, 1, 0, 0, c21_bin, true);
tk::dnn::Activation a21(&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Conv2d c22(&net, 1024, 3, 3, 1, 1, 1, 1, c22_bin, true);
tk::dnn::Activation a22(&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Conv2d c23(&net, 1024, 3, 3, 1, 1, 1, 1, c23_bin, true);
tk::dnn::Activation a23(&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Conv2d c24(&net, 1024, 3, 3, 1, 1, 1, 1, c24_bin, true);
tk::dnn::Activation a24(&net, CUDNN_ACTIVATION_RELU);
tkDNN::Layer *m25_layers[1] = { &a16 };
tkDNN::Route m25(&net, m25_layers, 1);
tkDNN::Conv2d c26(&net, 64, 1, 1, 1, 1, 0, 0, c26_bin, true);
tkDNN::Activation a26(&net, CUDNN_ACTIVATION_RELU);
tkDNN::Reorg r27(&net, 2);
tk::dnn::Layer *m25_layers[1] = { &a16 };
tk::dnn::Route m25(&net, m25_layers, 1);
tk::dnn::Conv2d c26(&net, 64, 1, 1, 1, 1, 0, 0, c26_bin, true);
tk::dnn::Activation a26(&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Reorg r27(&net, 2);
tkDNN::Layer *m28_layers[2] = { &r27, &a24 };
tkDNN::Route m28(&net, m28_layers, 2);
tk::dnn::Layer *m28_layers[2] = { &r27, &a24 };
tk::dnn::Route m28(&net, m28_layers, 2);
tkDNN::Conv2d c29(&net, 1024, 3, 3, 1, 1, 1, 1, c29_bin, true);
tkDNN::Activation a29(&net, CUDNN_ACTIVATION_RELU);
tkDNN::Conv2d c30(&net, 425, 1, 1, 1, 1, 0, 0, c30_bin, false);
tkDNN::Region g31(&net, 80, 4, 5);
tk::dnn::Conv2d c29(&net, 1024, 3, 3, 1, 1, 1, 1, c29_bin, true);
tk::dnn::Activation a29(&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Conv2d c30(&net, 425, 1, 1, 1, 1, 0, 0, c30_bin, false);
tk::dnn::Region g31(&net, 80, 4, 5);
tkDNN::RegionInterpret rI(dim, g31.output_dim, 80, 4, 5, 0.3f, g31_bin);
tk::dnn::RegionInterpret rI(dim, g31.output_dim, 80, 4, 5, 0.3f, g31_bin);
// Load input
dnnType *data;
@@ -110,11 +110,11 @@ int main() {
net.print();
//convert network to tensorRT
tkDNN::NetworkRT netRT(&net, "yolo_relu.rt");
tk::dnn::NetworkRT netRT(&net, "yolo_relu.rt");
dnnType *out_data, *out_data2; // cudnn output, tensorRT output
tkDNN::dataDim_t dim1 = dim; //input dim
tk::dnn::dataDim_t dim1 = dim; //input dim
printCenteredTitle(" CUDNN inference ", '=', 30); {
dim1.print();
TIMER_START
@@ -123,7 +123,7 @@ int main() {
dim1.print();
}
tkDNN::dataDim_t dim2 = dim;
tk::dnn::dataDim_t dim2 = dim;
printCenteredTitle(" TENSORRT inference ", '=', 30); {
dim2.print();
TIMER_START
+28 -28
View File
@@ -18,38 +18,38 @@ const char *output_bin = "../tests/yolo_tiny/layers/output.bin";
int main() {
// Network layout
tkDNN::dataDim_t dim(1, 3, 416, 416, 1);
tkDNN::Network net(dim);
tk::dnn::dataDim_t dim(1, 3, 416, 416, 1);
tk::dnn::Network net(dim);
tkDNN::Conv2d c0 (&net, 16, 3, 3, 1, 1, 1, 1, c0_bin, true);
tkDNN::Activation a0 (&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Pooling p1 (&net, 2, 2, 2, 2, tkDNN::POOLING_MAX);
tk::dnn::Conv2d c0 (&net, 16, 3, 3, 1, 1, 1, 1, c0_bin, true);
tk::dnn::Activation a0 (&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Pooling p1 (&net, 2, 2, 2, 2, tk::dnn::POOLING_MAX);
tkDNN::Conv2d c2 (&net, 32, 3, 3, 1, 1, 1, 1, c2_bin, true);
tkDNN::Activation a2 (&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Pooling p3 (&net, 2, 2, 2, 2, tkDNN::POOLING_MAX);
tk::dnn::Conv2d c2 (&net, 32, 3, 3, 1, 1, 1, 1, c2_bin, true);
tk::dnn::Activation a2 (&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Pooling p3 (&net, 2, 2, 2, 2, tk::dnn::POOLING_MAX);
tkDNN::Conv2d c4 (&net, 64, 3, 3, 1, 1, 1, 1, c4_bin, true);
tkDNN::Activation a4 (&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Pooling p5 (&net, 2, 2, 2, 2, tkDNN::POOLING_MAX);
tk::dnn::Conv2d c4 (&net, 64, 3, 3, 1, 1, 1, 1, c4_bin, true);
tk::dnn::Activation a4 (&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Pooling p5 (&net, 2, 2, 2, 2, tk::dnn::POOLING_MAX);
tkDNN::Conv2d c6 (&net, 128, 3, 3, 1, 1, 1, 1, c6_bin, true);
tkDNN::Activation a6 (&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Pooling p7(&net, 2, 2, 2, 2, tkDNN::POOLING_MAX);
tk::dnn::Conv2d c6 (&net, 128, 3, 3, 1, 1, 1, 1, c6_bin, true);
tk::dnn::Activation a6 (&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Pooling p7(&net, 2, 2, 2, 2, tk::dnn::POOLING_MAX);
tkDNN::Conv2d c8(&net, 256, 3, 3, 1, 1, 1, 1, c8_bin, true);
tkDNN::Activation a8(&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Pooling p9(&net, 2, 2, 2, 2, tkDNN::POOLING_MAX);
tk::dnn::Conv2d c8(&net, 256, 3, 3, 1, 1, 1, 1, c8_bin, true);
tk::dnn::Activation a8(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Pooling p9(&net, 2, 2, 2, 2, tk::dnn::POOLING_MAX);
tkDNN::Conv2d c10(&net, 512, 3, 3, 1, 1, 1, 1, c10_bin, true);
tkDNN::Activation a10(&net, tkDNN::ACTIVATION_LEAKY);
tk::dnn::Conv2d c10(&net, 512, 3, 3, 1, 1, 1, 1, c10_bin, true);
tk::dnn::Activation a10(&net, tk::dnn::ACTIVATION_LEAKY);
tkDNN::Conv2d c11(&net, 1024, 3, 3, 1, 1, 1, 1, c11_bin, true);
tkDNN::Activation a11(&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Conv2d c12(&net, 512, 3, 3, 1, 1, 1, 1, c12_bin, true);
tkDNN::Activation a12(&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Conv2d c13(&net, 425, 1, 1, 1, 1, 0, 0, c13_bin, false);
tkDNN::Region g14(&net, 80, 4, 5);
tk::dnn::Conv2d c11(&net, 1024, 3, 3, 1, 1, 1, 1, c11_bin, true);
tk::dnn::Activation a11(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c12(&net, 512, 3, 3, 1, 1, 1, 1, c12_bin, true);
tk::dnn::Activation a12(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c13(&net, 425, 1, 1, 1, 1, 0, 0, c13_bin, false);
tk::dnn::Region g14(&net, 80, 4, 5);
// Load input
dnnType *data;
@@ -60,11 +60,11 @@ int main() {
net.print();
//convert network to tensorRT
tkDNN::NetworkRT netRT(&net, "yolo_tiny.rt");
tk::dnn::NetworkRT netRT(&net, "yolo_tiny.rt");
dnnType *out_data, *out_data2; // cudnn output, tensorRT output
tkDNN::dataDim_t dim1 = dim; //input dim
tk::dnn::dataDim_t dim1 = dim; //input dim
printCenteredTitle(" CUDNN inference ", '=', 30); {
dim1.print();
TIMER_START
@@ -73,7 +73,7 @@ int main() {
dim1.print();
}
tkDNN::dataDim_t dim2 = dim;
tk::dnn::dataDim_t dim2 = dim;
printCenteredTitle(" TENSORRT inference ", '=', 30); {
dim2.print();
TIMER_START
+62 -62
View File
@@ -31,75 +31,75 @@ const char *output_bin = "../tests/yolo_voc/layers/output.bin";
int main() {
// Network layout
tkDNN::dataDim_t dim(1, 3, 416, 416, 1);
tkDNN::Network net(dim);
tk::dnn::dataDim_t dim(1, 3, 416, 416, 1);
tk::dnn::Network net(dim);
tkDNN::Conv2d c0 (&net, 32, 3, 3, 1, 1, 1, 1, c0_bin, true);
tkDNN::Activation a0 (&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Pooling p1 (&net, 2, 2, 2, 2, tkDNN::POOLING_MAX);
tk::dnn::Conv2d c0 (&net, 32, 3, 3, 1, 1, 1, 1, c0_bin, true);
tk::dnn::Activation a0 (&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Pooling p1 (&net, 2, 2, 2, 2, tk::dnn::POOLING_MAX);
tkDNN::Conv2d c2 (&net, 64, 3, 3, 1, 1, 1, 1, c2_bin, true);
tkDNN::Activation a2 (&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Pooling p3 (&net, 2, 2, 2, 2, tkDNN::POOLING_MAX);
tk::dnn::Conv2d c2 (&net, 64, 3, 3, 1, 1, 1, 1, c2_bin, true);
tk::dnn::Activation a2 (&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Pooling p3 (&net, 2, 2, 2, 2, tk::dnn::POOLING_MAX);
tkDNN::Conv2d c4 (&net, 128, 3, 3, 1, 1, 1, 1, c4_bin, true);
tkDNN::Activation a4 (&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Conv2d c5 (&net, 64, 1, 1, 1, 1, 0, 0, c5_bin, true);
tkDNN::Activation a5 (&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Conv2d c6 (&net, 128, 3, 3, 1, 1, 1, 1, c6_bin, true);
tkDNN::Activation a6 (&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Pooling p7 (&net, 2, 2, 2, 2, tkDNN::POOLING_MAX);
tk::dnn::Conv2d c4 (&net, 128, 3, 3, 1, 1, 1, 1, c4_bin, true);
tk::dnn::Activation a4 (&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c5 (&net, 64, 1, 1, 1, 1, 0, 0, c5_bin, true);
tk::dnn::Activation a5 (&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c6 (&net, 128, 3, 3, 1, 1, 1, 1, c6_bin, true);
tk::dnn::Activation a6 (&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Pooling p7 (&net, 2, 2, 2, 2, tk::dnn::POOLING_MAX);
tkDNN::Conv2d c8 (&net, 256, 3, 3, 1, 1, 1, 1, c8_bin, true);
tkDNN::Activation a8 (&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Conv2d c9 (&net, 128, 1, 1, 1, 1, 0, 0, c9_bin, true);
tkDNN::Activation a9 (&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Conv2d c10(&net, 256, 3, 3, 1, 1, 1, 1, c10_bin, true);
tkDNN::Activation a10(&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Pooling p11(&net, 2, 2, 2, 2, tkDNN::POOLING_MAX);
tk::dnn::Conv2d c8 (&net, 256, 3, 3, 1, 1, 1, 1, c8_bin, true);
tk::dnn::Activation a8 (&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c9 (&net, 128, 1, 1, 1, 1, 0, 0, c9_bin, true);
tk::dnn::Activation a9 (&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c10(&net, 256, 3, 3, 1, 1, 1, 1, c10_bin, true);
tk::dnn::Activation a10(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Pooling p11(&net, 2, 2, 2, 2, tk::dnn::POOLING_MAX);
tkDNN::Conv2d c12(&net, 512, 3, 3, 1, 1, 1, 1, c12_bin, true);
tkDNN::Activation a12(&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Conv2d c13(&net, 256, 1, 1, 1, 1, 0, 0, c13_bin, true);
tkDNN::Activation a13(&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Conv2d c14(&net, 512, 3, 3, 1, 1, 1, 1, c14_bin, true);
tkDNN::Activation a14(&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Conv2d c15(&net, 256, 1, 1, 1, 1, 0, 0, c15_bin, true);
tkDNN::Activation a15(&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Conv2d c16(&net, 512, 3, 3, 1, 1, 1, 1, c16_bin, true);
tkDNN::Activation a16(&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Pooling p17(&net, 2, 2, 2, 2, tkDNN::POOLING_MAX);
tk::dnn::Conv2d c12(&net, 512, 3, 3, 1, 1, 1, 1, c12_bin, true);
tk::dnn::Activation a12(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c13(&net, 256, 1, 1, 1, 1, 0, 0, c13_bin, true);
tk::dnn::Activation a13(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c14(&net, 512, 3, 3, 1, 1, 1, 1, c14_bin, true);
tk::dnn::Activation a14(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c15(&net, 256, 1, 1, 1, 1, 0, 0, c15_bin, true);
tk::dnn::Activation a15(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c16(&net, 512, 3, 3, 1, 1, 1, 1, c16_bin, true);
tk::dnn::Activation a16(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Pooling p17(&net, 2, 2, 2, 2, tk::dnn::POOLING_MAX);
tkDNN::Conv2d c18(&net, 1024, 3, 3, 1, 1, 1, 1, c18_bin, true);
tkDNN::Activation a18(&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Conv2d c19(&net, 512, 1, 1, 1, 1, 0, 0, c19_bin, true);
tkDNN::Activation a19(&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Conv2d c20(&net, 1024, 3, 3, 1, 1, 1, 1, c20_bin, true);
tkDNN::Activation a20(&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Conv2d c21(&net, 512, 1, 1, 1, 1, 0, 0, c21_bin, true);
tkDNN::Activation a21(&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Conv2d c22(&net, 1024, 3, 3, 1, 1, 1, 1, c22_bin, true);
tkDNN::Activation a22(&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Conv2d c23(&net, 1024, 3, 3, 1, 1, 1, 1, c23_bin, true);
tkDNN::Activation a23(&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Conv2d c24(&net, 1024, 3, 3, 1, 1, 1, 1, c24_bin, true);
tkDNN::Activation a24(&net, tkDNN::ACTIVATION_LEAKY);
tk::dnn::Conv2d c18(&net, 1024, 3, 3, 1, 1, 1, 1, c18_bin, true);
tk::dnn::Activation a18(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c19(&net, 512, 1, 1, 1, 1, 0, 0, c19_bin, true);
tk::dnn::Activation a19(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c20(&net, 1024, 3, 3, 1, 1, 1, 1, c20_bin, true);
tk::dnn::Activation a20(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c21(&net, 512, 1, 1, 1, 1, 0, 0, c21_bin, true);
tk::dnn::Activation a21(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c22(&net, 1024, 3, 3, 1, 1, 1, 1, c22_bin, true);
tk::dnn::Activation a22(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c23(&net, 1024, 3, 3, 1, 1, 1, 1, c23_bin, true);
tk::dnn::Activation a23(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c24(&net, 1024, 3, 3, 1, 1, 1, 1, c24_bin, true);
tk::dnn::Activation a24(&net, tk::dnn::ACTIVATION_LEAKY);
tkDNN::Layer *m25_layers[1] = { &a16 };
tkDNN::Route m25(&net, m25_layers, 1);
tkDNN::Conv2d c26(&net, 64, 1, 1, 1, 1, 0, 0, c26_bin, true);
tkDNN::Activation a26(&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Reorg r27(&net, 2);
tk::dnn::Layer *m25_layers[1] = { &a16 };
tk::dnn::Route m25(&net, m25_layers, 1);
tk::dnn::Conv2d c26(&net, 64, 1, 1, 1, 1, 0, 0, c26_bin, true);
tk::dnn::Activation a26(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Reorg r27(&net, 2);
tkDNN::Layer *m28_layers[2] = { &r27, &a24 };
tkDNN::Route m28(&net, m28_layers, 2);
tk::dnn::Layer *m28_layers[2] = { &r27, &a24 };
tk::dnn::Route m28(&net, m28_layers, 2);
tkDNN::Conv2d c29(&net, 1024, 3, 3, 1, 1, 1, 1, c29_bin, true);
tkDNN::Activation a29(&net, tkDNN::ACTIVATION_LEAKY);
tkDNN::Conv2d c30(&net, 125, 1, 1, 1, 1, 0, 0, c30_bin, false);
tkDNN::Region g31(&net, 20, 4, 5);
tk::dnn::Conv2d c29(&net, 1024, 3, 3, 1, 1, 1, 1, c29_bin, true);
tk::dnn::Activation a29(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c30(&net, 125, 1, 1, 1, 1, 0, 0, c30_bin, false);
tk::dnn::Region g31(&net, 20, 4, 5);
tkDNN::RegionInterpret rI(dim, g31.output_dim, 20, 4, 5, 0.6f, g31_bin);
tk::dnn::RegionInterpret rI(dim, g31.output_dim, 20, 4, 5, 0.6f, g31_bin);
// Load input
dnnType *data;
@@ -110,11 +110,11 @@ int main() {
net.print();
//convert network to tensorRT
tkDNN::NetworkRT netRT(&net, "yolo_voc.rt");
tk::dnn::NetworkRT netRT(&net, "yolo_voc.rt");
dnnType *out_data, *out_data2; // cudnn output, tensorRT output
tkDNN::dataDim_t dim1 = dim; //input dim
tk::dnn::dataDim_t dim1 = dim; //input dim
printCenteredTitle(" CUDNN inference ", '=', 30); {
dim1.print();
TIMER_START
@@ -123,7 +123,7 @@ int main() {
dim1.print();
}
tkDNN::dataDim_t dim2 = dim;
tk::dnn::dataDim_t dim2 = dim;
printCenteredTitle(" TENSORRT inference ", '=', 30); {
dim2.print();
TIMER_START