Add Mobilenetv2 SSD Lite post and preprocessing, add mobilenet demo
Signed-off-by: xavier <micaelaverucchi@gmail.com>
This commit is contained in:
@@ -1,139 +1,143 @@
|
||||
#include <iostream>
|
||||
#include "tkdnn.h"
|
||||
|
||||
const char *output_bin = "../tests/mobilenetv2ssd/debug/regression_headers-5.bin";
|
||||
#include <opencv2/core/core.hpp>
|
||||
#include <opencv2/highgui/highgui.hpp>
|
||||
#include <opencv2/videoio.hpp>
|
||||
#include <opencv2/imgproc/imgproc.hpp>
|
||||
|
||||
const char *output_bin1 = "../tests/mobilenetv2ssd/debug/classification_headers-5.bin";
|
||||
const char *output_bin2 = "../tests/mobilenetv2ssd/debug/regression_headers-5.bin";
|
||||
const char *input_bin = "../tests/mobilenetv2ssd/debug/input.bin";
|
||||
|
||||
const char *conv0_bin = "../tests/mobilenetv2ssd/layers/base_net-0-0.bin";
|
||||
const char *inverted_residual1[]={
|
||||
"../tests/mobilenetv2ssd/layers/base_net-1-conv-0.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-1-conv-3.bin"};
|
||||
const char *inverted_residual2[]={
|
||||
"../tests/mobilenetv2ssd/layers/base_net-2-conv-0.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-2-conv-3.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-2-conv-6.bin"};
|
||||
const char *inverted_residual3[]={
|
||||
"../tests/mobilenetv2ssd/layers/base_net-3-conv-0.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-3-conv-3.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-3-conv-6.bin"};
|
||||
const char *inverted_residual4[]={
|
||||
"../tests/mobilenetv2ssd/layers/base_net-4-conv-0.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-4-conv-3.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-4-conv-6.bin"};
|
||||
const char *inverted_residual5[]={
|
||||
"../tests/mobilenetv2ssd/layers/base_net-5-conv-0.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-5-conv-3.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-5-conv-6.bin"};
|
||||
const char *inverted_residual6[]={
|
||||
"../tests/mobilenetv2ssd/layers/base_net-6-conv-0.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-6-conv-3.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-6-conv-6.bin"};
|
||||
const char *inverted_residual7[]={
|
||||
"../tests/mobilenetv2ssd/layers/base_net-7-conv-0.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-7-conv-3.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-7-conv-6.bin"};
|
||||
const char *inverted_residual8[]={
|
||||
"../tests/mobilenetv2ssd/layers/base_net-8-conv-0.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-8-conv-3.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-8-conv-6.bin"};
|
||||
const char *inverted_residual9[]={
|
||||
"../tests/mobilenetv2ssd/layers/base_net-9-conv-0.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-9-conv-3.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-9-conv-6.bin"};
|
||||
const char *inverted_residual10[]={
|
||||
"../tests/mobilenetv2ssd/layers/base_net-10-conv-0.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-10-conv-3.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-10-conv-6.bin"};
|
||||
const char *inverted_residual11[]={
|
||||
"../tests/mobilenetv2ssd/layers/base_net-11-conv-0.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-11-conv-3.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-11-conv-6.bin"};
|
||||
const char *inverted_residual12[]={
|
||||
"../tests/mobilenetv2ssd/layers/base_net-12-conv-0.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-12-conv-3.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-12-conv-6.bin"};
|
||||
const char *inverted_residual13[]={
|
||||
"../tests/mobilenetv2ssd/layers/base_net-13-conv-0.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-13-conv-3.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-13-conv-6.bin"};
|
||||
const char *inverted_residual14[]={
|
||||
"../tests/mobilenetv2ssd/layers/base_net-14-conv-0.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-14-conv-3.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-14-conv-6.bin"};
|
||||
const char *inverted_residual15[]={
|
||||
"../tests/mobilenetv2ssd/layers/base_net-15-conv-0.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-15-conv-3.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-15-conv-6.bin"};
|
||||
const char *inverted_residual16[]={
|
||||
"../tests/mobilenetv2ssd/layers/base_net-16-conv-0.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-16-conv-3.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-16-conv-6.bin"};
|
||||
const char *inverted_residual17[]={
|
||||
"../tests/mobilenetv2ssd/layers/base_net-17-conv-0.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-17-conv-3.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-17-conv-6.bin"};
|
||||
const char *inverted_residual1[] = {
|
||||
"../tests/mobilenetv2ssd/layers/base_net-1-conv-0.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-1-conv-3.bin"};
|
||||
const char *inverted_residual2[] = {
|
||||
"../tests/mobilenetv2ssd/layers/base_net-2-conv-0.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-2-conv-3.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-2-conv-6.bin"};
|
||||
const char *inverted_residual3[] = {
|
||||
"../tests/mobilenetv2ssd/layers/base_net-3-conv-0.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-3-conv-3.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-3-conv-6.bin"};
|
||||
const char *inverted_residual4[] = {
|
||||
"../tests/mobilenetv2ssd/layers/base_net-4-conv-0.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-4-conv-3.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-4-conv-6.bin"};
|
||||
const char *inverted_residual5[] = {
|
||||
"../tests/mobilenetv2ssd/layers/base_net-5-conv-0.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-5-conv-3.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-5-conv-6.bin"};
|
||||
const char *inverted_residual6[] = {
|
||||
"../tests/mobilenetv2ssd/layers/base_net-6-conv-0.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-6-conv-3.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-6-conv-6.bin"};
|
||||
const char *inverted_residual7[] = {
|
||||
"../tests/mobilenetv2ssd/layers/base_net-7-conv-0.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-7-conv-3.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-7-conv-6.bin"};
|
||||
const char *inverted_residual8[] = {
|
||||
"../tests/mobilenetv2ssd/layers/base_net-8-conv-0.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-8-conv-3.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-8-conv-6.bin"};
|
||||
const char *inverted_residual9[] = {
|
||||
"../tests/mobilenetv2ssd/layers/base_net-9-conv-0.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-9-conv-3.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-9-conv-6.bin"};
|
||||
const char *inverted_residual10[] = {
|
||||
"../tests/mobilenetv2ssd/layers/base_net-10-conv-0.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-10-conv-3.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-10-conv-6.bin"};
|
||||
const char *inverted_residual11[] = {
|
||||
"../tests/mobilenetv2ssd/layers/base_net-11-conv-0.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-11-conv-3.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-11-conv-6.bin"};
|
||||
const char *inverted_residual12[] = {
|
||||
"../tests/mobilenetv2ssd/layers/base_net-12-conv-0.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-12-conv-3.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-12-conv-6.bin"};
|
||||
const char *inverted_residual13[] = {
|
||||
"../tests/mobilenetv2ssd/layers/base_net-13-conv-0.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-13-conv-3.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-13-conv-6.bin"};
|
||||
const char *inverted_residual14[] = {
|
||||
"../tests/mobilenetv2ssd/layers/base_net-14-conv-0.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-14-conv-3.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-14-conv-6.bin"};
|
||||
const char *inverted_residual15[] = {
|
||||
"../tests/mobilenetv2ssd/layers/base_net-15-conv-0.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-15-conv-3.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-15-conv-6.bin"};
|
||||
const char *inverted_residual16[] = {
|
||||
"../tests/mobilenetv2ssd/layers/base_net-16-conv-0.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-16-conv-3.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-16-conv-6.bin"};
|
||||
const char *inverted_residual17[] = {
|
||||
"../tests/mobilenetv2ssd/layers/base_net-17-conv-0.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-17-conv-3.bin",
|
||||
"../tests/mobilenetv2ssd/layers/base_net-17-conv-6.bin"};
|
||||
|
||||
const char *conv18 = "../tests/mobilenetv2ssd/layers/base_net-18-0.bin";
|
||||
|
||||
const char *extras0[]={
|
||||
"../tests/mobilenetv2ssd/layers/extras-0-conv-0.bin",
|
||||
"../tests/mobilenetv2ssd/layers/extras-0-conv-3.bin",
|
||||
"../tests/mobilenetv2ssd/layers/extras-0-conv-6.bin"};
|
||||
const char *extras1[]={
|
||||
"../tests/mobilenetv2ssd/layers/extras-1-conv-0.bin",
|
||||
"../tests/mobilenetv2ssd/layers/extras-1-conv-3.bin",
|
||||
"../tests/mobilenetv2ssd/layers/extras-1-conv-6.bin"};
|
||||
const char *extras2[]={
|
||||
"../tests/mobilenetv2ssd/layers/extras-2-conv-0.bin",
|
||||
"../tests/mobilenetv2ssd/layers/extras-2-conv-3.bin",
|
||||
"../tests/mobilenetv2ssd/layers/extras-2-conv-6.bin"};
|
||||
const char *extras3[]={
|
||||
"../tests/mobilenetv2ssd/layers/extras-3-conv-0.bin",
|
||||
"../tests/mobilenetv2ssd/layers/extras-3-conv-3.bin",
|
||||
"../tests/mobilenetv2ssd/layers/extras-3-conv-6.bin"};
|
||||
const char *extras0[] = {
|
||||
"../tests/mobilenetv2ssd/layers/extras-0-conv-0.bin",
|
||||
"../tests/mobilenetv2ssd/layers/extras-0-conv-3.bin",
|
||||
"../tests/mobilenetv2ssd/layers/extras-0-conv-6.bin"};
|
||||
const char *extras1[] = {
|
||||
"../tests/mobilenetv2ssd/layers/extras-1-conv-0.bin",
|
||||
"../tests/mobilenetv2ssd/layers/extras-1-conv-3.bin",
|
||||
"../tests/mobilenetv2ssd/layers/extras-1-conv-6.bin"};
|
||||
const char *extras2[] = {
|
||||
"../tests/mobilenetv2ssd/layers/extras-2-conv-0.bin",
|
||||
"../tests/mobilenetv2ssd/layers/extras-2-conv-3.bin",
|
||||
"../tests/mobilenetv2ssd/layers/extras-2-conv-6.bin"};
|
||||
const char *extras3[] = {
|
||||
"../tests/mobilenetv2ssd/layers/extras-3-conv-0.bin",
|
||||
"../tests/mobilenetv2ssd/layers/extras-3-conv-3.bin",
|
||||
"../tests/mobilenetv2ssd/layers/extras-3-conv-6.bin"};
|
||||
|
||||
const char *classification_header0[]={
|
||||
"../tests/mobilenetv2ssd/layers/classification_headers-0-0.bin",
|
||||
"../tests/mobilenetv2ssd/layers/classification_headers-0-3.bin"};
|
||||
const char *classification_header1[]={
|
||||
"../tests/mobilenetv2ssd/layers/classification_headers-1-0.bin",
|
||||
"../tests/mobilenetv2ssd/layers/classification_headers-1-3.bin"};
|
||||
const char *classification_header2[]={
|
||||
"../tests/mobilenetv2ssd/layers/classification_headers-2-0.bin",
|
||||
"../tests/mobilenetv2ssd/layers/classification_headers-2-3.bin"};
|
||||
const char *classification_header3[]={
|
||||
"../tests/mobilenetv2ssd/layers/classification_headers-3-0.bin",
|
||||
"../tests/mobilenetv2ssd/layers/classification_headers-3-3.bin"};
|
||||
const char *classification_header4[]={
|
||||
"../tests/mobilenetv2ssd/layers/classification_headers-4-0.bin",
|
||||
"../tests/mobilenetv2ssd/layers/classification_headers-4-3.bin"};
|
||||
const char *classification_header0[] = {
|
||||
"../tests/mobilenetv2ssd/layers/classification_headers-0-0.bin",
|
||||
"../tests/mobilenetv2ssd/layers/classification_headers-0-3.bin"};
|
||||
const char *classification_header1[] = {
|
||||
"../tests/mobilenetv2ssd/layers/classification_headers-1-0.bin",
|
||||
"../tests/mobilenetv2ssd/layers/classification_headers-1-3.bin"};
|
||||
const char *classification_header2[] = {
|
||||
"../tests/mobilenetv2ssd/layers/classification_headers-2-0.bin",
|
||||
"../tests/mobilenetv2ssd/layers/classification_headers-2-3.bin"};
|
||||
const char *classification_header3[] = {
|
||||
"../tests/mobilenetv2ssd/layers/classification_headers-3-0.bin",
|
||||
"../tests/mobilenetv2ssd/layers/classification_headers-3-3.bin"};
|
||||
const char *classification_header4[] = {
|
||||
"../tests/mobilenetv2ssd/layers/classification_headers-4-0.bin",
|
||||
"../tests/mobilenetv2ssd/layers/classification_headers-4-3.bin"};
|
||||
|
||||
const char *classification_header5 = "../tests/mobilenetv2ssd/layers/classification_headers-5.bin";
|
||||
|
||||
const char *regression_header0[]={
|
||||
"../tests/mobilenetv2ssd/layers/regression_headers-0-0.bin",
|
||||
"../tests/mobilenetv2ssd/layers/regression_headers-0-3.bin"};
|
||||
const char *regression_header1[]={
|
||||
"../tests/mobilenetv2ssd/layers/regression_headers-1-0.bin",
|
||||
"../tests/mobilenetv2ssd/layers/regression_headers-1-3.bin"};
|
||||
const char *regression_header2[]={
|
||||
"../tests/mobilenetv2ssd/layers/regression_headers-2-0.bin",
|
||||
"../tests/mobilenetv2ssd/layers/regression_headers-2-3.bin"};
|
||||
const char *regression_header3[]={
|
||||
"../tests/mobilenetv2ssd/layers/regression_headers-3-0.bin",
|
||||
"../tests/mobilenetv2ssd/layers/regression_headers-3-3.bin"};
|
||||
const char *regression_header4[]={
|
||||
"../tests/mobilenetv2ssd/layers/regression_headers-4-0.bin",
|
||||
"../tests/mobilenetv2ssd/layers/regression_headers-4-3.bin"};
|
||||
const char *regression_header0[] = {
|
||||
"../tests/mobilenetv2ssd/layers/regression_headers-0-0.bin",
|
||||
"../tests/mobilenetv2ssd/layers/regression_headers-0-3.bin"};
|
||||
const char *regression_header1[] = {
|
||||
"../tests/mobilenetv2ssd/layers/regression_headers-1-0.bin",
|
||||
"../tests/mobilenetv2ssd/layers/regression_headers-1-3.bin"};
|
||||
const char *regression_header2[] = {
|
||||
"../tests/mobilenetv2ssd/layers/regression_headers-2-0.bin",
|
||||
"../tests/mobilenetv2ssd/layers/regression_headers-2-3.bin"};
|
||||
const char *regression_header3[] = {
|
||||
"../tests/mobilenetv2ssd/layers/regression_headers-3-0.bin",
|
||||
"../tests/mobilenetv2ssd/layers/regression_headers-3-3.bin"};
|
||||
const char *regression_header4[] = {
|
||||
"../tests/mobilenetv2ssd/layers/regression_headers-4-0.bin",
|
||||
"../tests/mobilenetv2ssd/layers/regression_headers-4-3.bin"};
|
||||
|
||||
const char *regression_header5 = "../tests/mobilenetv2ssd/layers/regression_headers-5.bin";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
int classes = 21;
|
||||
|
||||
// Network layout
|
||||
tk::dnn::dataDim_t dim(1, 3, 300, 300, 1);
|
||||
@@ -143,11 +147,10 @@ int main()
|
||||
tk::dnn::Activation relu3(&net, CUDNN_ACTIVATION_RELU);
|
||||
|
||||
//Inverted Residual 1
|
||||
|
||||
tk::dnn::Conv2d conv2(&net, 32, 3, 3, 1, 1, 1, 1, inverted_residual1[0], true,false, false,32);
|
||||
|
||||
tk::dnn::Conv2d conv2(&net, 32, 3, 3, 1, 1, 1, 1, inverted_residual1[0], true, false, false, 32);
|
||||
tk::dnn::Activation relu5(&net, CUDNN_ACTIVATION_RELU);
|
||||
tk::dnn::Conv2d conv3(&net, 16, 1, 1, 1, 1, 0, 0, inverted_residual1[1], true);
|
||||
|
||||
|
||||
//Inverted Residual 2
|
||||
tk::dnn::Conv2d ir_2_conv1(&net, 96, 1, 1, 1, 1, 0, 0, inverted_residual2[0], true);
|
||||
@@ -157,14 +160,14 @@ int main()
|
||||
tk::dnn::Conv2d ir_2_conv3(&net, 24, 1, 1, 1, 1, 0, 0, inverted_residual2[2], true);
|
||||
|
||||
//Inverted Residual 3
|
||||
tk::dnn::Layer *last = &ir_2_conv3;
|
||||
tk::dnn::Layer *last = &ir_2_conv3;
|
||||
tk::dnn::Conv2d ir_3_conv1(&net, 144, 1, 1, 1, 1, 0, 0, inverted_residual3[0], true);
|
||||
tk::dnn::Activation relu_3_1(&net, CUDNN_ACTIVATION_RELU);
|
||||
tk::dnn::Conv2d ir_3_conv2(&net, 144, 3, 3, 1, 1, 1, 1, inverted_residual3[1], true, false, false, 144);
|
||||
tk::dnn::Activation relu_3_2(&net, CUDNN_ACTIVATION_RELU);
|
||||
tk::dnn::Conv2d ir_3_conv3(&net, 24, 1, 1, 1, 1, 0, 0, inverted_residual3[2], true);
|
||||
|
||||
tk::dnn::Shortcut s3_0 (&net, last);
|
||||
|
||||
tk::dnn::Shortcut s3_0(&net, last);
|
||||
// //Inverted Residual 4
|
||||
tk::dnn::Conv2d ir_4_conv1(&net, 144, 1, 1, 1, 1, 0, 0, inverted_residual4[0], true);
|
||||
tk::dnn::Activation relu_4_1(&net, CUDNN_ACTIVATION_RELU);
|
||||
@@ -179,8 +182,8 @@ int main()
|
||||
tk::dnn::Conv2d ir_5_conv2(&net, 192, 3, 3, 1, 1, 1, 1, inverted_residual5[1], true, false, false, 192);
|
||||
tk::dnn::Activation relu_5_2(&net, CUDNN_ACTIVATION_RELU);
|
||||
tk::dnn::Conv2d ir_5_conv3(&net, 32, 1, 1, 1, 1, 0, 0, inverted_residual5[2], true);
|
||||
|
||||
tk::dnn::Shortcut s5_0 (&net, last);
|
||||
|
||||
tk::dnn::Shortcut s5_0(&net, last);
|
||||
// // // //Inverted Residual 6
|
||||
last = &s5_0;
|
||||
tk::dnn::Conv2d ir_6_conv1(&net, 192, 1, 1, 1, 1, 0, 0, inverted_residual6[0], true);
|
||||
@@ -189,7 +192,7 @@ int main()
|
||||
tk::dnn::Activation relu_6_2(&net, CUDNN_ACTIVATION_RELU);
|
||||
tk::dnn::Conv2d ir_6_conv3(&net, 32, 1, 1, 1, 1, 0, 0, inverted_residual6[2], true);
|
||||
|
||||
tk::dnn::Shortcut s6_0 (&net, last);
|
||||
tk::dnn::Shortcut s6_0(&net, last);
|
||||
//Inverted Residual 7
|
||||
tk::dnn::Conv2d ir_7_conv1(&net, 192, 1, 1, 1, 1, 0, 0, inverted_residual7[0], true);
|
||||
tk::dnn::Activation relu_7_1(&net, CUDNN_ACTIVATION_RELU);
|
||||
@@ -204,8 +207,8 @@ int main()
|
||||
tk::dnn::Conv2d ir_8_conv2(&net, 384, 3, 3, 1, 1, 1, 1, inverted_residual8[1], true, false, false, 384);
|
||||
tk::dnn::Activation relu_8_2(&net, CUDNN_ACTIVATION_RELU);
|
||||
tk::dnn::Conv2d ir_8_conv3(&net, 64, 1, 1, 1, 1, 0, 0, inverted_residual8[2], true);
|
||||
|
||||
tk::dnn::Shortcut s8_0 (&net, last);
|
||||
|
||||
tk::dnn::Shortcut s8_0(&net, last);
|
||||
//Inverted Residual 9
|
||||
last = &s8_0;
|
||||
tk::dnn::Conv2d ir_9_conv1(&net, 384, 1, 1, 1, 1, 0, 0, inverted_residual9[0], true);
|
||||
@@ -214,7 +217,7 @@ int main()
|
||||
tk::dnn::Activation relu_9_2(&net, CUDNN_ACTIVATION_RELU);
|
||||
tk::dnn::Conv2d ir_9_conv3(&net, 64, 1, 1, 1, 1, 0, 0, inverted_residual9[2], true);
|
||||
|
||||
tk::dnn::Shortcut s9_0 (&net, last);
|
||||
tk::dnn::Shortcut s9_0(&net, last);
|
||||
//Inverted Residual 10
|
||||
last = &s9_0;
|
||||
tk::dnn::Conv2d ir_10_conv1(&net, 384, 1, 1, 1, 1, 0, 0, inverted_residual10[0], true);
|
||||
@@ -223,7 +226,7 @@ int main()
|
||||
tk::dnn::Activation relu_10_2(&net, CUDNN_ACTIVATION_RELU);
|
||||
tk::dnn::Conv2d ir_10_conv3(&net, 64, 1, 1, 1, 1, 0, 0, inverted_residual10[2], true);
|
||||
|
||||
tk::dnn::Shortcut s10_0 (&net, last);
|
||||
tk::dnn::Shortcut s10_0(&net, last);
|
||||
//Inverted Residual 11
|
||||
tk::dnn::Conv2d ir_11_conv1(&net, 384, 1, 1, 1, 1, 0, 0, inverted_residual11[0], true);
|
||||
tk::dnn::Activation relu_11_1(&net, CUDNN_ACTIVATION_RELU);
|
||||
@@ -239,7 +242,7 @@ int main()
|
||||
tk::dnn::Activation relu_12_2(&net, CUDNN_ACTIVATION_RELU);
|
||||
tk::dnn::Conv2d ir_12_conv3(&net, 96, 1, 1, 1, 1, 0, 0, inverted_residual12[2], true);
|
||||
|
||||
tk::dnn::Shortcut s12_0 (&net, last);
|
||||
tk::dnn::Shortcut s12_0(&net, last);
|
||||
last = &s12_0;
|
||||
//Inverted Residual 13
|
||||
tk::dnn::Conv2d ir_13_conv1(&net, 576, 1, 1, 1, 1, 0, 0, inverted_residual13[0], true);
|
||||
@@ -248,10 +251,10 @@ int main()
|
||||
tk::dnn::Activation relu_13_2(&net, CUDNN_ACTIVATION_RELU);
|
||||
tk::dnn::Conv2d ir_13_conv3(&net, 96, 1, 1, 1, 1, 0, 0, inverted_residual13[2], true);
|
||||
|
||||
tk::dnn::Shortcut s13_0 (&net, last);
|
||||
tk::dnn::Shortcut s13_0(&net, last);
|
||||
// //Inverted Residual 14
|
||||
tk::dnn::Conv2d ir_14_conv1(&net, 576, 1, 1, 1, 1, 0, 0, inverted_residual14[0], true);
|
||||
tk::dnn::Activation relu_14_1(&net, CUDNN_ACTIVATION_RELU);
|
||||
tk::dnn::Activation relu_14_1(&net, CUDNN_ACTIVATION_RELU);
|
||||
tk::dnn::Conv2d ir_14_conv2(&net, 576, 3, 3, 2, 2, 1, 1, inverted_residual14[1], true, false, false, 576);
|
||||
tk::dnn::Activation relu_14_2(&net, CUDNN_ACTIVATION_RELU);
|
||||
tk::dnn::Conv2d ir_14_conv3(&net, 160, 1, 1, 1, 1, 0, 0, inverted_residual14[2], true);
|
||||
@@ -264,7 +267,7 @@ int main()
|
||||
tk::dnn::Activation relu_15_2(&net, CUDNN_ACTIVATION_RELU);
|
||||
tk::dnn::Conv2d ir_15_conv3(&net, 160, 1, 1, 1, 1, 0, 0, inverted_residual15[2], true);
|
||||
|
||||
tk::dnn::Shortcut s15_0 (&net, last);
|
||||
tk::dnn::Shortcut s15_0(&net, last);
|
||||
//Inverted Residual 16
|
||||
last = &s15_0;
|
||||
tk::dnn::Conv2d ir_16_conv1(&net, 960, 1, 1, 1, 1, 0, 0, inverted_residual16[0], true);
|
||||
@@ -273,7 +276,7 @@ int main()
|
||||
tk::dnn::Activation relu_16_2(&net, CUDNN_ACTIVATION_RELU);
|
||||
tk::dnn::Conv2d ir_16_conv3(&net, 160, 1, 1, 1, 1, 0, 0, inverted_residual16[2], true);
|
||||
|
||||
tk::dnn::Shortcut s16_0 (&net, last);
|
||||
tk::dnn::Shortcut s16_0(&net, last);
|
||||
//Inverted Residual 17
|
||||
tk::dnn::Conv2d ir_17_conv1(&net, 960, 1, 1, 1, 1, 0, 0, inverted_residual17[0], true);
|
||||
tk::dnn::Activation relu_17_1(&net, CUDNN_ACTIVATION_RELU);
|
||||
@@ -284,7 +287,7 @@ int main()
|
||||
//Conv 18
|
||||
tk::dnn::Conv2d ir_18_conv1(&net, 1280, 1, 1, 1, 1, 0, 0, conv18, true);
|
||||
tk::dnn::Activation relu_18_1(&net, CUDNN_ACTIVATION_RELU);
|
||||
tk::dnn::Layer * header_1[1] = {&relu_18_1};
|
||||
tk::dnn::Layer *header_1[1] = {&relu_18_1};
|
||||
|
||||
// //extras Inverted Residual 0
|
||||
tk::dnn::Conv2d e_0_conv1(&net, 256, 1, 1, 1, 1, 0, 0, extras0[0], true);
|
||||
@@ -292,7 +295,7 @@ int main()
|
||||
tk::dnn::Conv2d e_0_conv2(&net, 256, 3, 3, 2, 2, 1, 1, extras0[1], true, false, false, 256);
|
||||
tk::dnn::Activation e_relu_0_2(&net, CUDNN_ACTIVATION_RELU);
|
||||
tk::dnn::Conv2d e_0_conv3(&net, 512, 1, 1, 1, 1, 0, 0, extras0[2], true);
|
||||
tk::dnn::Layer * header_2[1] = {&e_0_conv3};
|
||||
tk::dnn::Layer *header_2[1] = {&e_0_conv3};
|
||||
|
||||
// //extras Inverted Residual 1
|
||||
tk::dnn::Conv2d e_1_conv1(&net, 128, 1, 1, 1, 1, 0, 0, extras1[0], true);
|
||||
@@ -300,15 +303,15 @@ int main()
|
||||
tk::dnn::Conv2d e_1_conv2(&net, 128, 3, 3, 2, 2, 1, 1, extras1[1], true, false, false, 128);
|
||||
tk::dnn::Activation e_relu_1_2(&net, CUDNN_ACTIVATION_RELU);
|
||||
tk::dnn::Conv2d e_1_conv3(&net, 256, 1, 1, 1, 1, 0, 0, extras1[2], true);
|
||||
tk::dnn::Layer * header_3[1] = {&e_1_conv3};
|
||||
|
||||
tk::dnn::Layer *header_3[1] = {&e_1_conv3};
|
||||
|
||||
//extras Inverted Residual 2
|
||||
tk::dnn::Conv2d e_2_conv1(&net, 128, 1, 1, 1, 1, 0, 0, extras2[0], true);
|
||||
tk::dnn::Activation e_relu_2_1(&net, CUDNN_ACTIVATION_RELU);
|
||||
tk::dnn::Conv2d e_2_conv2(&net, 128, 3, 3, 2, 2, 1, 1, extras2[1], true, false, false, 128);
|
||||
tk::dnn::Activation e_relu_2_2(&net, CUDNN_ACTIVATION_RELU);
|
||||
tk::dnn::Conv2d e_2_conv3(&net, 256, 1, 1, 1, 1, 0, 0, extras2[2], true);
|
||||
tk::dnn::Layer * header_4[1] = {&e_2_conv3};
|
||||
tk::dnn::Layer *header_4[1] = {&e_2_conv3};
|
||||
|
||||
//extras Inverted Residual 3
|
||||
tk::dnn::Conv2d e_3_conv1(&net, 64, 1, 1, 1, 1, 0, 0, extras3[0], true);
|
||||
@@ -316,79 +319,144 @@ int main()
|
||||
tk::dnn::Conv2d e_3_conv2(&net, 64, 3, 3, 2, 2, 1, 1, extras3[1], true, false, false, 64);
|
||||
tk::dnn::Activation e_relu_3_2(&net, CUDNN_ACTIVATION_RELU);
|
||||
tk::dnn::Conv2d e_3_conv3(&net, 64, 1, 1, 1, 1, 0, 0, extras3[2], true);
|
||||
tk::dnn::Layer * header_5[1] = {&e_3_conv3};
|
||||
tk::dnn::Layer *header_5[1] = {&e_3_conv3};
|
||||
|
||||
// classification header 0
|
||||
tk::dnn::Layer * header_0[1] = {&relu_14_1};
|
||||
tk::dnn::Route rout_ch_0(&net, header_0, 1);
|
||||
tk::dnn::Conv2d ch_0_conv1(&net, 576, 3, 3, 1, 1, 1, 1, classification_header0[0], true, false, false, 576,true);
|
||||
tk::dnn::Activation ch_relu_0_1(&net, CUDNN_ACTIVATION_CLIPPED_RELU,6);
|
||||
tk::dnn::Layer *header_0[1] = {&relu_14_1};
|
||||
tk::dnn::Route rout_ch_0(&net, header_0, 1);
|
||||
tk::dnn::Conv2d ch_0_conv1(&net, 576, 3, 3, 1, 1, 1, 1, classification_header0[0], true, false, false, 576, true);
|
||||
tk::dnn::Activation ch_relu_0_1(&net, CUDNN_ACTIVATION_CLIPPED_RELU, 6);
|
||||
tk::dnn::Conv2d ch_0_conv2(&net, 126, 1, 1, 1, 1, 0, 0, classification_header0[1], false);
|
||||
tk::dnn::Layer *conf0[1] = {&ch_0_conv2};
|
||||
|
||||
// // classification header 1
|
||||
tk::dnn::Route rout_ch_1(&net, header_1, 1);
|
||||
tk::dnn::Conv2d ch_1_conv1(&net, 1280, 3, 3, 1, 1, 1, 1, classification_header1[0], true, false, false, 1280,true);
|
||||
tk::dnn::Activation ch_relu_1_1(&net, CUDNN_ACTIVATION_CLIPPED_RELU,6);
|
||||
tk::dnn::Route rout_ch_1(&net, header_1, 1);
|
||||
tk::dnn::Conv2d ch_1_conv1(&net, 1280, 3, 3, 1, 1, 1, 1, classification_header1[0], true, false, false, 1280, true);
|
||||
tk::dnn::Activation ch_relu_1_1(&net, CUDNN_ACTIVATION_CLIPPED_RELU, 6);
|
||||
tk::dnn::Conv2d ch_1_conv2(&net, 126, 1, 1, 1, 1, 0, 0, classification_header1[1], false);
|
||||
tk::dnn::Layer *conf1[1] = {&ch_1_conv2};
|
||||
|
||||
// //classification header 2
|
||||
tk::dnn::Route rout_ch_2(&net, header_2, 1);
|
||||
tk::dnn::Route rout_ch_2(&net, header_2, 1);
|
||||
tk::dnn::Conv2d ch_2_conv1(&net, 512, 3, 3, 1, 1, 1, 1, classification_header2[0], true, false, false, 512, true);
|
||||
tk::dnn::Activation ch_relu_2_1(&net, CUDNN_ACTIVATION_CLIPPED_RELU,6);
|
||||
tk::dnn::Activation ch_relu_2_1(&net, CUDNN_ACTIVATION_CLIPPED_RELU, 6);
|
||||
tk::dnn::Conv2d ch_2_conv2(&net, 126, 1, 1, 1, 1, 0, 0, classification_header2[1], false);
|
||||
tk::dnn::Layer *conf2[1] = {&ch_2_conv2};
|
||||
|
||||
// //classification header 3
|
||||
tk::dnn::Route rout_ch_3(&net, header_3, 1);
|
||||
tk::dnn::Route rout_ch_3(&net, header_3, 1);
|
||||
tk::dnn::Conv2d ch_3_conv1(&net, 256, 3, 3, 1, 1, 1, 1, classification_header3[0], true, false, false, 256, true);
|
||||
tk::dnn::Activation ch_relu_3_1(&net, CUDNN_ACTIVATION_CLIPPED_RELU,6);
|
||||
tk::dnn::Activation ch_relu_3_1(&net, CUDNN_ACTIVATION_CLIPPED_RELU, 6);
|
||||
tk::dnn::Conv2d ch_3_conv2(&net, 126, 1, 1, 1, 1, 0, 0, classification_header3[1], false);
|
||||
tk::dnn::Layer *conf3[1] = {&ch_3_conv2};
|
||||
|
||||
// //classification header 4
|
||||
tk::dnn::Route rout_ch_4(&net, header_4, 1);
|
||||
tk::dnn::Route rout_ch_4(&net, header_4, 1);
|
||||
tk::dnn::Conv2d ch_4_conv1(&net, 256, 3, 3, 1, 1, 1, 1, classification_header4[0], true, false, false, 256, true);
|
||||
tk::dnn::Activation ch_relu_4_1(&net, CUDNN_ACTIVATION_CLIPPED_RELU,6);
|
||||
tk::dnn::Activation ch_relu_4_1(&net, CUDNN_ACTIVATION_CLIPPED_RELU, 6);
|
||||
tk::dnn::Conv2d ch_4_conv2(&net, 126, 1, 1, 1, 1, 0, 0, classification_header4[1], false);
|
||||
tk::dnn::Layer *conf4[1] = {&ch_4_conv2};
|
||||
|
||||
// //classification header 5
|
||||
tk::dnn::Route rout_ch_5(&net, header_5, 1);
|
||||
tk::dnn::Conv2d ch_5_conv(&net, 126, 1, 1, 1, 1, 0, 0, classification_header5, false);
|
||||
tk::dnn::Route rout_ch_5(&net, header_5, 1);
|
||||
tk::dnn::Conv2d ch_5_conv(&net, 126, 1, 1, 1, 1, 0, 0, classification_header5, false, false, true);
|
||||
tk::dnn::Layer *conf5[1] = {&ch_5_conv};
|
||||
|
||||
//regression header 0
|
||||
tk::dnn::Route rout_rh_0(&net, header_0, 1);
|
||||
tk::dnn::Route rout_rh_0(&net, header_0, 1);
|
||||
tk::dnn::Conv2d rh_0_conv1(&net, 576, 3, 3, 1, 1, 1, 1, regression_header0[0], true, false, false, 576, true);
|
||||
tk::dnn::Activation rh_relu_0_1(&net, CUDNN_ACTIVATION_CLIPPED_RELU,6);
|
||||
tk::dnn::Activation rh_relu_0_1(&net, CUDNN_ACTIVATION_CLIPPED_RELU, 6);
|
||||
tk::dnn::Conv2d rh_0_conv2(&net, 24, 1, 1, 1, 1, 0, 0, regression_header0[1], false);
|
||||
tk::dnn::Layer *loc0[1] = {&rh_0_conv2};
|
||||
|
||||
// //regression header 1
|
||||
tk::dnn::Route rout_rh_1(&net, header_1, 1);
|
||||
tk::dnn::Route rout_rh_1(&net, header_1, 1);
|
||||
tk::dnn::Conv2d rh_1_conv1(&net, 1280, 3, 3, 1, 1, 1, 1, regression_header1[0], true, false, false, 1280, true);
|
||||
tk::dnn::Activation rh_relu_1_1(&net, CUDNN_ACTIVATION_CLIPPED_RELU,6);
|
||||
tk::dnn::Activation rh_relu_1_1(&net, CUDNN_ACTIVATION_CLIPPED_RELU, 6);
|
||||
tk::dnn::Conv2d rh_1_conv2(&net, 24, 1, 1, 1, 1, 0, 0, regression_header1[1], false);
|
||||
tk::dnn::Layer *loc1[1] = {&rh_1_conv2};
|
||||
|
||||
//regression header 2
|
||||
tk::dnn::Route rout_rh_2(&net, header_2, 1);
|
||||
tk::dnn::Route rout_rh_2(&net, header_2, 1);
|
||||
tk::dnn::Conv2d rh_2_conv1(&net, 512, 3, 3, 1, 1, 1, 1, regression_header2[0], true, false, false, 512, true);
|
||||
tk::dnn::Activation rh_relu_2_1(&net, CUDNN_ACTIVATION_CLIPPED_RELU,6);
|
||||
tk::dnn::Activation rh_relu_2_1(&net, CUDNN_ACTIVATION_CLIPPED_RELU, 6);
|
||||
tk::dnn::Conv2d rh_2_conv2(&net, 24, 1, 1, 1, 1, 0, 0, regression_header2[1], false);
|
||||
tk::dnn::Layer *loc2[1] = {&rh_2_conv2};
|
||||
|
||||
//regression header 3
|
||||
tk::dnn::Route rout_rh_3(&net, header_3, 1);
|
||||
tk::dnn::Route rout_rh_3(&net, header_3, 1);
|
||||
tk::dnn::Conv2d rh_3_conv1(&net, 256, 3, 3, 1, 1, 1, 1, regression_header3[0], true, false, false, 256, true);
|
||||
tk::dnn::Activation rh_relu_3_1(&net, CUDNN_ACTIVATION_CLIPPED_RELU,6);
|
||||
tk::dnn::Activation rh_relu_3_1(&net, CUDNN_ACTIVATION_CLIPPED_RELU, 6);
|
||||
tk::dnn::Conv2d rh_3_conv2(&net, 24, 1, 1, 1, 1, 0, 0, regression_header3[1], false);
|
||||
tk::dnn::Layer *loc3[1] = {&rh_3_conv2};
|
||||
|
||||
//regression header 4
|
||||
|
||||
tk::dnn::Route rout_rh_4(&net, header_4, 1);
|
||||
tk::dnn::Route rout_rh_4(&net, header_4, 1);
|
||||
tk::dnn::Conv2d rh_4_conv1(&net, 256, 3, 3, 1, 1, 1, 1, regression_header4[0], true, false, false, 256, true);
|
||||
tk::dnn::Activation rh_relu_4_1(&net, CUDNN_ACTIVATION_CLIPPED_RELU,6);
|
||||
tk::dnn::Activation rh_relu_4_1(&net, CUDNN_ACTIVATION_CLIPPED_RELU, 6);
|
||||
tk::dnn::Conv2d rh_4_conv2(&net, 24, 1, 1, 1, 1, 0, 0, regression_header4[1], false);
|
||||
tk::dnn::Layer *loc4[1] = {&rh_4_conv2};
|
||||
|
||||
//regression header 5
|
||||
tk::dnn::Route rout_rh_5(&net, header_5, 1);
|
||||
tk::dnn::Conv2d rh_5_conv(&net, 24, 1, 1, 1, 1, 0, 0, regression_header5, false);
|
||||
tk::dnn::Route rout_rh_5(&net, header_5, 1);
|
||||
tk::dnn::Conv2d rh_5_conv(&net, 24, 1, 1, 1, 1, 0, 0, regression_header5, false, false, true);
|
||||
tk::dnn::Layer *loc5[1] = {&rh_5_conv};
|
||||
|
||||
//flatten confidence and flatten locations
|
||||
last = &rh_5_conv;
|
||||
|
||||
//flatten all confidence
|
||||
tk::dnn::Route r_conf_0(&net, conf0, 1);
|
||||
tk::dnn::Flatten fl_c_0(&net);
|
||||
tk::dnn::Route r_conf_1(&net, conf1, 1);
|
||||
tk::dnn::Flatten fl_c_1(&net);
|
||||
tk::dnn::Route r_conf_2(&net, conf2, 1);
|
||||
tk::dnn::Flatten fl_c_2(&net);
|
||||
tk::dnn::Route r_conf_3(&net, conf3, 1);
|
||||
tk::dnn::Flatten fl_c_3(&net);
|
||||
tk::dnn::Route r_conf_4(&net, conf4, 1);
|
||||
tk::dnn::Flatten fl_c_4(&net);
|
||||
tk::dnn::Route r_conf_5(&net, conf5, 1);
|
||||
tk::dnn::Flatten fl_c_5(&net);
|
||||
|
||||
// //flatten all locations
|
||||
tk::dnn::Route r_loc_0(&net, loc0, 1);
|
||||
tk::dnn::Flatten fl_l_0(&net);
|
||||
tk::dnn::Route r_loc_1(&net, loc1, 1);
|
||||
tk::dnn::Flatten fl_l_1(&net);
|
||||
tk::dnn::Route r_loc_2(&net, loc2, 1);
|
||||
tk::dnn::Flatten fl_l_2(&net);
|
||||
tk::dnn::Route r_loc_3(&net, loc3, 1);
|
||||
tk::dnn::Flatten fl_l_3(&net);
|
||||
tk::dnn::Route r_loc_4(&net, loc4, 1);
|
||||
tk::dnn::Flatten fl_l_4(&net);
|
||||
tk::dnn::Route r_loc_5(&net, loc5, 1);
|
||||
tk::dnn::Flatten fl_l_5(&net);
|
||||
|
||||
// //concat confidence + softmax
|
||||
tk::dnn::Layer *confidences[6] = {&fl_c_0, &fl_c_1, &fl_c_2, &fl_c_3, &fl_c_4, &fl_c_5};
|
||||
tk::dnn::Route rout_conf(&net, confidences, 6);
|
||||
tk::dnn::dataDim_t olddim_c = net.layers[net.num_layers - 1]->output_dim;
|
||||
tk::dnn::dataDim_t dim_resh(1, olddim_c.c * olddim_c.h * olddim_c.w / classes, classes, 1, 1);
|
||||
|
||||
tk::dnn::Reshape reshape_conf1(&net, dim_resh);
|
||||
tk::dnn::Flatten fl_l_6(&net);
|
||||
tk::dnn::dataDim_t newdim_c(1, classes, olddim_c.c * olddim_c.h * olddim_c.w / classes, 1, 1);
|
||||
|
||||
tk::dnn::Reshape reshape_conf2(&net, newdim_c);
|
||||
|
||||
tk::dnn::Softmax sm_1(&net, &newdim_c, true);
|
||||
// tk::dnn::Flatten fl_l_7(&net);
|
||||
// tk::dnn::Reshape reshape_conf3(&net,dim_resh, true);
|
||||
tk::dnn::Layer *conf = &sm_1;
|
||||
|
||||
//concat locations
|
||||
tk::dnn::Layer *locations[6] = {&fl_l_0, &fl_l_1, &fl_l_2, &fl_l_3, &fl_l_4, &fl_l_5};
|
||||
tk::dnn::Route rout_loc(&net, locations, 6);
|
||||
tk::dnn::dataDim_t olddim_l = net.layers[net.num_layers - 1]->output_dim;
|
||||
tk::dnn::dataDim_t newdim_l(1, olddim_l.c * olddim_l.h * olddim_l.w / 4, 1, 4, 1);
|
||||
tk::dnn::Reshape reshape_loc(&net, newdim_l, true);
|
||||
tk::dnn::Layer *loc = &reshape_loc;
|
||||
|
||||
// Load input
|
||||
dnnType *data;
|
||||
@@ -399,14 +467,9 @@ int main()
|
||||
//print network model
|
||||
net.print();
|
||||
|
||||
//convert network to tensorRT
|
||||
// convert network to tensorRT
|
||||
tk::dnn::NetworkRT netRT(&net, "mobilenetv2ssd.rt");
|
||||
|
||||
|
||||
tk::dnn::dataDim_t out_dim;
|
||||
out_dim = net.layers[net.num_layers-1]->output_dim;
|
||||
dnnType *cudnn_out, *rt_out;
|
||||
|
||||
tk::dnn::dataDim_t dim1 = dim; //input dim
|
||||
printCenteredTitle(" CUDNN inference ", '=', 30);
|
||||
{
|
||||
@@ -416,9 +479,11 @@ int main()
|
||||
TIMER_STOP
|
||||
dim1.print();
|
||||
}
|
||||
cudnn_out = net.layers[net.num_layers-1]->dstData;
|
||||
|
||||
printDeviceVector(64, cudnn_out, true);
|
||||
dnnType *cudnn_out1 = conf5[0]->dstData;
|
||||
tk::dnn::dataDim_t out_dim1 = conf5[0]->output_dim;
|
||||
dnnType *cudnn_out2 = loc5[0]->dstData;
|
||||
tk::dnn::dataDim_t out_dim2 = loc5[0]->output_dim;
|
||||
|
||||
tk::dnn::dataDim_t dim2 = dim;
|
||||
printCenteredTitle(" TENSORRT inference ", '=', 30);
|
||||
@@ -429,20 +494,48 @@ int main()
|
||||
TIMER_STOP
|
||||
dim2.print();
|
||||
}
|
||||
rt_out = (dnnType *)netRT.buffersRT[1];
|
||||
|
||||
dnnType *rt_out1 = (dnnType *)netRT.buffersRT[1];
|
||||
dnnType *rt_out2 = (dnnType *)netRT.buffersRT[2];
|
||||
dnnType *rt_out3 = (dnnType *)netRT.buffersRT[3];
|
||||
dnnType *rt_out4 = (dnnType *)netRT.buffersRT[4];
|
||||
|
||||
printCenteredTitle(std::string(" RESNET CHECK RESULTS ").c_str(), '=', 30);
|
||||
dnnType *out, *out_h;
|
||||
int odim = out_dim.tot();
|
||||
readBinaryFile(output_bin, odim, &out_h, &out);
|
||||
std::cout << "CUDNN vs correct";
|
||||
checkResult(odim, cudnn_out, out);
|
||||
dnnType *out1, *out1_h;
|
||||
int odim1 = out_dim1.tot();
|
||||
readBinaryFile(output_bin1, odim1, &out1_h, &out1);
|
||||
|
||||
std::cout << "TRT vs correct";
|
||||
checkResult(odim, rt_out, out);
|
||||
std::cout << "CUDNN vs TRT ";
|
||||
checkResult(odim, cudnn_out, rt_out);
|
||||
dnnType *out2, *out2_h;
|
||||
int odim2 = out_dim2.tot();
|
||||
readBinaryFile(output_bin2, odim2, &out2_h, &out2);
|
||||
std::cout << "CUDNN vs correct" << std::endl;
|
||||
checkResult(odim1, cudnn_out1, out1);
|
||||
checkResult(odim2, cudnn_out2, out2);
|
||||
|
||||
std::cout << "TRT vs correct" << std::endl;
|
||||
checkResult(odim1, rt_out1, out1);
|
||||
checkResult(odim2, rt_out2, out2);
|
||||
|
||||
std::cout << "CUDNN vs TRT " << std::endl;
|
||||
checkResult(odim1, cudnn_out1, rt_out1);
|
||||
checkResult(odim2, cudnn_out2, rt_out2);
|
||||
|
||||
std::cout << "---------------------------------------------------" << std::endl;
|
||||
std::cout << "Confidence CUDNN" << std::endl;
|
||||
printDeviceVector(64, conf->dstData, true);
|
||||
std::cout << "Locations CUDNN" << std::endl;
|
||||
printDeviceVector(64, loc->dstData, true);
|
||||
std::cout << "---------------------------------------------------" << std::endl;
|
||||
|
||||
std::cout << "Confidence tensorRT" << std::endl;
|
||||
printDeviceVector(64, rt_out3, true);
|
||||
std::cout << "Locations tensorRT" << std::endl;
|
||||
printDeviceVector(64, rt_out4, true);
|
||||
std::cout << "---------------------------------------------------" << std::endl;
|
||||
|
||||
std::cout << "CUDNN vs TRT " << std::endl;
|
||||
checkResult(conf->output_dim.tot(), conf->dstData, rt_out3);
|
||||
checkResult(loc->output_dim.tot(), loc->dstData, rt_out4);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user