diff --git a/demo/detection/detection.cpp b/demo/detection/detection.cpp index 838cf88..216ec31 100644 --- a/demo/detection/detection.cpp +++ b/demo/detection/detection.cpp @@ -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 0.6f && rI.res_boxes[j].cl == gt[z].cl) { prec++; break; diff --git a/demo/live/live.cpp b/demo/live/live.cpp index b502081..e04d605 100644 --- a/demo/live/live.cpp +++ b/demo/live/live.cpp @@ -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 T readBUF(const char*& buffer) return val; } -} +}} #endif //NETWORKRT_H diff --git a/src/Activation.cpp b/src/Activation.cpp index cc91a82..5ef62d5 100644 --- a/src/Activation.cpp +++ b/src/Activation.cpp @@ -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; } -} +}} diff --git a/src/Conv2d.cpp b/src/Conv2d.cpp index f1d9a5d..bfb8316 100644 --- a/src/Conv2d.cpp +++ b/src/Conv2d.cpp @@ -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; } -} +}} diff --git a/src/Dense.cpp b/src/Dense.cpp index 237dfc8..f86aa4a 100644 --- a/src/Dense.cpp +++ b/src/Dense.cpp @@ -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; } -} +}} diff --git a/src/Flatten.cpp b/src/Flatten.cpp index 732d941..8906c88 100644 --- a/src/Flatten.cpp +++ b/src/Flatten.cpp @@ -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; } -} \ No newline at end of file +}} \ No newline at end of file diff --git a/src/Layer.cpp b/src/Layer.cpp index 4f585f7..2d49f77 100644 --- a/src/Layer.cpp +++ b/src/Layer.cpp @@ -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) ); } -} \ No newline at end of file +}} \ No newline at end of file diff --git a/src/LayerWgs.cpp b/src/LayerWgs.cpp index d6469a0..d8bb881 100644 --- a/src/LayerWgs.cpp +++ b/src/LayerWgs.cpp @@ -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() { } } -} +}} diff --git a/src/MulAdd.cpp b/src/MulAdd.cpp index 2e4a824..0c2a962 100644 --- a/src/MulAdd.cpp +++ b/src/MulAdd.cpp @@ -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; } -} \ No newline at end of file +}} \ No newline at end of file diff --git a/src/Network.cpp b/src/Network.cpp index 3cc342d..cade05f 100644 --- a/src/Network.cpp +++ b/src/Network.cpp @@ -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() { } -} +}} diff --git a/src/NetworkRT.cpp b/src/NetworkRT.cpp index ebc2206..d35a230 100644 --- a/src/NetworkRT.cpp +++ b/src/NetworkRT.cpp @@ -25,7 +25,7 @@ class Logger : public ILogger { } } loggerRT; -namespace tkDNN { +namespace tk { namespace dnn { std::maptensors; @@ -399,4 +399,4 @@ bool NetworkRT::deserialize(const char *filename) { return true; } -} +}} diff --git a/src/Pooling.cpp b/src/Pooling.cpp index c66829e..6c2afc8 100644 --- a/src/Pooling.cpp +++ b/src/Pooling.cpp @@ -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; } -} +}} diff --git a/src/Region.cpp b/src/Region.cpp index 8a4a2fa..6407eba 100644 --- a/src/Region.cpp +++ b/src/Region.cpp @@ -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 } -} +}} diff --git a/src/Reorg.cpp b/src/Reorg.cpp index c13c37d..52862b0 100644 --- a/src/Reorg.cpp +++ b/src/Reorg.cpp @@ -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; } -} +}} diff --git a/src/Route.cpp b/src/Route.cpp index 8e7d456..77a5f24 100644 --- a/src/Route.cpp +++ b/src/Route.cpp @@ -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; } -} \ No newline at end of file +}} \ No newline at end of file diff --git a/src/Softmax.cpp b/src/Softmax.cpp index 076b723..af08f7f 100644 --- a/src/Softmax.cpp +++ b/src/Softmax.cpp @@ -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; } -} +}} diff --git a/src/pluginsRT/ActivationLeakyRT.cpp b/src/pluginsRT/ActivationLeakyRT.cpp index 7376857..4609158 100644 --- a/src/pluginsRT/ActivationLeakyRT.cpp +++ b/src/pluginsRT/ActivationLeakyRT.cpp @@ -53,7 +53,7 @@ public: virtual void serialize(void* buffer) override { char *buf = reinterpret_cast(buffer); - tkDNN::writeBUF(buf, size); + tk::dnn::writeBUF(buf, size); } int size; diff --git a/src/pluginsRT/Int8Calibrator.cpp b/src/pluginsRT/Int8Calibrator.cpp index e33d7db..ad759bf 100644 --- a/src/pluginsRT/Int8Calibrator.cpp +++ b/src/pluginsRT/Int8Calibrator.cpp @@ -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; diff --git a/src/pluginsRT/RegionRT.cpp b/src/pluginsRT/RegionRT.cpp index f1e7e9e..bcfb4c7 100644 --- a/src/pluginsRT/RegionRT.cpp +++ b/src/pluginsRT/RegionRT.cpp @@ -74,12 +74,12 @@ public: virtual void serialize(void* buffer) override { char *buf = reinterpret_cast(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; diff --git a/src/pluginsRT/ReorgRT.cpp b/src/pluginsRT/ReorgRT.cpp index d85b366..25bfbde 100644 --- a/src/pluginsRT/ReorgRT.cpp +++ b/src/pluginsRT/ReorgRT.cpp @@ -53,10 +53,10 @@ public: virtual void serialize(void* buffer) override { char *buf = reinterpret_cast(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; diff --git a/tests/mnist/test_mnist.cpp b/tests/mnist/test_mnist.cpp index 49c74a4..e2d4dc0 100644 --- a/tests/mnist/test_mnist.cpp +++ b/tests/mnist/test_mnist.cpp @@ -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(); diff --git a/tests/mnist/test_mnistRT.cpp b/tests/mnist/test_mnistRT.cpp index a0814c6..c337097 100644 --- a/tests/mnist/test_mnistRT.cpp +++ b/tests/mnist/test_mnistRT.cpp @@ -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. diff --git a/tests/simple/test_simple.cpp b/tests/simple/test_simple.cpp index e0a47d6..a7628ea 100644 --- a/tests/simple/test_simple.cpp +++ b/tests/simple/test_simple.cpp @@ -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; diff --git a/tests/test_rtinference/rtinference.cpp b/tests/test_rtinference/rtinference.cpp index bd8e6ff..f99d003 100644 --- a/tests/test_rtinference/rtinference.cpp +++ b/tests/test_rtinference/rtinference.cpp @@ -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()]; diff --git a/tests/yolo/yolo.cpp b/tests/yolo/yolo.cpp index a485542..05404b0 100644 --- a/tests/yolo/yolo.cpp +++ b/tests/yolo/yolo.cpp @@ -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 diff --git a/tests/yolo_224/yolo_224.cpp b/tests/yolo_224/yolo_224.cpp index 16adb4c..9d6d28a 100644 --- a/tests/yolo_224/yolo_224.cpp +++ b/tests/yolo_224/yolo_224.cpp @@ -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 diff --git a/tests/yolo_relu/yolo_relu.cpp b/tests/yolo_relu/yolo_relu.cpp index be1294a..ddb0802 100644 --- a/tests/yolo_relu/yolo_relu.cpp +++ b/tests/yolo_relu/yolo_relu.cpp @@ -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 diff --git a/tests/yolo_tiny/yolo_tiny.cpp b/tests/yolo_tiny/yolo_tiny.cpp index fc2703d..0255108 100644 --- a/tests/yolo_tiny/yolo_tiny.cpp +++ b/tests/yolo_tiny/yolo_tiny.cpp @@ -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 diff --git a/tests/yolo_voc/yolo_voc.cpp b/tests/yolo_voc/yolo_voc.cpp index 843c981..d0b9456 100644 --- a/tests/yolo_voc/yolo_voc.cpp +++ b/tests/yolo_voc/yolo_voc.cpp @@ -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