Remove the final parameter from the layers

Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
This commit is contained in:
Davide Sapienza
2020-04-09 18:48:03 +02:00
parent 3502c5b676
commit 4361d5fec0
14 changed files with 130 additions and 115 deletions
+1 -1
View File
@@ -72,7 +72,7 @@ class ImuOdom {
tk::dnn::Input *x0 = new tk::dnn::Input (net, dim0, i0_d);
tk::dnn::Conv2d *x0_0 = new tk::dnn::Conv2d (net, 128, 1, 11, 1, 1, 0, 0, c0_bin);
tk::dnn::Conv2d *x0_1 = new tk::dnn::Conv2d (net, 128, 1, 11, 1, 1, 0, 0, c1_bin);
tk::dnn::Pooling *x0_2 = new tk::dnn::Pooling(net, 1, 3, 1, 3 , 0, 0, tk::dnn::tkdnnPoolingMode_t::POOLING_MAX);
tk::dnn::Pooling *x0_2 = new tk::dnn::Pooling(net, 1, 3, 1, 3 ,0, 0, tk::dnn::tkdnnPoolingMode_t::POOLING_MAX);
tk::dnn::Input *x1 = new tk::dnn::Input (net, dim1, i1_d);
tk::dnn::Conv2d *x1_0 = new tk::dnn::Conv2d (net, 128, 1, 11, 1, 1, 0, 0, c2_bin);
+9 -9
View File
@@ -39,7 +39,7 @@ enum layerType_t {
class Layer {
public:
Layer(Network *net, bool final = false);
Layer(Network *net);
virtual ~Layer();
virtual layerType_t getLayerType() = 0;
@@ -47,7 +47,7 @@ public:
std::cout<<"No infer action for this layer\n";
return NULL;
}
void setFinal() { this->final = true; }
dataDim_t input_dim, output_dim;
dnnType *dstData; //where results will be putted
@@ -95,7 +95,7 @@ class LayerWgs : public Layer {
public:
LayerWgs(Network *net, int inputs, int outputs, int kh, int kw, int kt,
std::string fname_weights, bool batchnorm = false, bool additional_bias = false, bool final = false, bool deConv = false, int groups = 1);
std::string fname_weights, bool batchnorm = false, bool additional_bias = false, bool deConv = false, int groups = 1);
virtual ~LayerWgs();
int inputs, outputs;
@@ -214,7 +214,7 @@ class Conv2d : public LayerWgs {
public:
Conv2d( Network *net, int out_ch, int kernelH, int kernelW,
int strideH, int strideW, int paddingH, int paddingW,
std::string fname_weights, bool batchnorm = false, bool deConv = false, bool final = false, int groups = 1, bool additional_bias=false);
std::string fname_weights, bool batchnorm = false, bool deConv = false, int groups = 1, bool additional_bias=false);
virtual ~Conv2d();
virtual layerType_t getLayerType() { return LAYER_CONV2D; };
@@ -312,7 +312,7 @@ public:
DeConv2d( Network *net, int out_ch, int kernelH, int kernelW,
int strideH, int strideW, int paddingH, int paddingW,
std::string fname_weights, bool batchnorm = false, int groups = 1) :
Conv2d(net, out_ch, kernelH, kernelW, strideH, strideW, paddingH, paddingW, fname_weights, batchnorm, true, false, groups) {}
Conv2d(net, out_ch, kernelH, kernelW, strideH, strideW, paddingH, paddingW, fname_weights, batchnorm, true, groups) {}
virtual ~DeConv2d() {}
virtual layerType_t getLayerType() { return LAYER_DECONV2D; };
@@ -373,7 +373,7 @@ public:
class Reshape : public Layer {
public:
Reshape(Network *net, dataDim_t new_dim, bool final=false);
Reshape(Network *net, dataDim_t new_dim);
virtual ~Reshape();
virtual layerType_t getLayerType() { return LAYER_RESHAPE; };
@@ -428,7 +428,7 @@ public:
Pooling(Network *net, int winH, int winW,
int strideH, int strideW,
int paddingH = 0, int paddingW = 0,
tkdnnPoolingMode_t pool_mode = POOLING_MAX, bool final = false);
tkdnnPoolingMode_t pool_mode = POOLING_MAX);
virtual ~Pooling();
virtual layerType_t getLayerType() { return LAYER_POOLING; };
@@ -447,7 +447,7 @@ protected:
class Softmax : public Layer {
public:
Softmax(Network *net, const tk::dnn::dataDim_t* dim=nullptr, bool final=false, const cudnnSoftmaxMode_t mode=CUDNN_SOFTMAX_MODE_CHANNEL);
Softmax(Network *net, const tk::dnn::dataDim_t* dim=nullptr, const cudnnSoftmaxMode_t mode=CUDNN_SOFTMAX_MODE_CHANNEL);
virtual ~Softmax();
virtual layerType_t getLayerType() { return LAYER_SOFTMAX; };
@@ -463,7 +463,7 @@ public:
class Route : public Layer {
public:
Route(Network *net, Layer **layers, int layers_n, bool final=false);
Route(Network *net, Layer **layers, int layers_n);
virtual ~Route();
virtual layerType_t getLayerType() { return LAYER_ROUTE; };
+2 -2
View File
@@ -132,10 +132,10 @@ void Conv2d::inferCUDNN(dnnType* srcData, bool back) {
Conv2d::Conv2d( Network *net, int out_ch, int kernelH, int kernelW,
int strideH, int strideW, int paddingH, int paddingW,
std::string fname_weights, bool batchnorm, bool deConv, bool final, int groups, bool additional_bias) :
std::string fname_weights, bool batchnorm, bool deConv, int groups, bool additional_bias) :
LayerWgs(net, net->getOutputDim().c, out_ch, kernelH, kernelW, 1,
fname_weights, batchnorm, additional_bias, final, deConv, groups) {
fname_weights, batchnorm, additional_bias, deConv, groups) {
this->kernelH = kernelH;
this->kernelW = kernelW;
this->strideH = strideH;
+2 -2
View File
@@ -4,10 +4,10 @@
namespace tk { namespace dnn {
Layer::Layer(Network *net, bool final) {
Layer::Layer(Network *net) {
this->net = net;
this->final = final;
this->final = false;
if(net != nullptr) {
this->input_dim = net->getOutputDim();
this->output_dim = input_dim;
+1 -1
View File
@@ -8,7 +8,7 @@ namespace tk { namespace dnn {
LayerWgs::LayerWgs(Network *net, int inputs, int outputs,
int kh, int kw, int kl,
std::string fname_weights, bool batchnorm, bool additional_bias, bool final, bool deConv, int groups) : Layer(net, final) {
std::string fname_weights, bool batchnorm, bool additional_bias, bool deConv, int groups) : Layer(net) {
inputs = inputs/groups;
this->inputs = inputs;
+2 -2
View File
@@ -7,8 +7,8 @@ namespace tk { namespace dnn {
Pooling::Pooling( Network *net, int winH, int winW, int strideH, int strideW,
int paddingH, int paddingW,
tkdnnPoolingMode_t pool_mode, bool final) :
Layer(net, final) {
tkdnnPoolingMode_t pool_mode) :
Layer(net) {
this->winH = winH;
this->winW = winW;
+1 -1
View File
@@ -5,7 +5,7 @@
namespace tk { namespace dnn {
Reshape::Reshape(Network *net, dataDim_t new_dim, bool final) : Layer(net, final) {
Reshape::Reshape(Network *net, dataDim_t new_dim) : Layer(net) {
checkCuda( cudaMalloc(&dstData, input_dim.tot()*sizeof(dnnType)) );
+1 -1
View File
@@ -5,7 +5,7 @@
namespace tk { namespace dnn {
Route::Route(Network *net, Layer **layers, int layers_n, bool final) : Layer(net, final) {
Route::Route(Network *net, Layer **layers, int layers_n) : Layer(net) {
// copy input layers
if(layers_n > MAX_LAYERS) {
+1 -1
View File
@@ -5,7 +5,7 @@
namespace tk { namespace dnn {
Softmax::Softmax(Network *net, const tk::dnn::dataDim_t* dim, bool final, const cudnnSoftmaxMode_t mode) : Layer(net, final) {
Softmax::Softmax(Network *net, const tk::dnn::dataDim_t* dim, const cudnnSoftmaxMode_t mode) : Layer(net) {
checkCuda( cudaMalloc(&dstData, input_dim.tot()*sizeof(dnnType)) );
@@ -139,7 +139,7 @@ int main()
// //1-1
tk::dnn::Conv2d c5(&net, 128, 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, false, false, 32, false);
tk::dnn::Conv2d c6(&net, 128, 3, 3, 1, 1, 1, 1, c6_bin, true, false, 32, false);
tk::dnn::Activation a6(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c7(&net, 128, 1, 1, 1, 1, 0, 0, c7_bin, true);
@@ -149,7 +149,7 @@ int main()
//1-2
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, 128, 3, 3, 1, 1, 1, 1, c10_bin, true, false, false, 32);
tk::dnn::Conv2d c10(&net, 128, 3, 3, 1, 1, 1, 1, c10_bin, true, false, 32);
tk::dnn::Activation a10(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c11(&net, 128, 1, 1, 1, 1, 0, 0, c11_bin, true);
@@ -159,7 +159,7 @@ int main()
//1-3
tk::dnn::Conv2d c13(&net, 128, 1, 1, 1, 1, 0, 0, c13_bin, true);
tk::dnn::Activation a13(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c14(&net, 128, 3, 3, 1, 1, 1, 1, c14_bin, true, false, false, 32);
tk::dnn::Conv2d c14(&net, 128, 3, 3, 1, 1, 1, 1, c14_bin, true, false, 32);
tk::dnn::Activation a14(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c15(&net, 128, 1, 1, 1, 1, 0, 0, c15_bin, true);
@@ -175,7 +175,7 @@ int main()
tk::dnn::Conv2d c19(&net, 256, 1, 1, 1, 1, 0, 0, c19_bin, true);
tk::dnn::Activation a19(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c20(&net, 256, 3, 3, 2, 2, 1, 1, c20_bin, true, false, false, 32);
tk::dnn::Conv2d c20(&net, 256, 3, 3, 2, 2, 1, 1, c20_bin, true, false, 32);
tk::dnn::Activation a20(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c21(&net, 256, 1, 1, 1, 1, 0, 0, c21_bin, true);
@@ -187,7 +187,7 @@ int main()
//2-1
tk::dnn::Conv2d c24(&net, 256, 1, 1, 1, 1, 0, 0, c24_bin, true);
tk::dnn::Activation a24(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c25(&net, 256, 3, 3, 1, 1, 1, 1, c25_bin, true, false, false, 32);
tk::dnn::Conv2d c25(&net, 256, 3, 3, 1, 1, 1, 1, c25_bin, true, false, 32);
tk::dnn::Activation a25(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c26(&net, 256, 1, 1, 1, 1, 0, 0, c26_bin, true);
@@ -197,7 +197,7 @@ int main()
//2-2
tk::dnn::Conv2d c28(&net, 256, 1, 1, 1, 1, 0, 0, c28_bin, true);
tk::dnn::Activation a28(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c29(&net, 256, 3, 3, 1, 1, 1, 1, c29_bin, true, false, false, 32);
tk::dnn::Conv2d c29(&net, 256, 3, 3, 1, 1, 1, 1, c29_bin, true, false, 32);
tk::dnn::Activation a29(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c30(&net, 256, 1, 1, 1, 1, 0, 0, c30_bin, true);
@@ -207,7 +207,7 @@ int main()
//2-3
tk::dnn::Conv2d c32(&net, 256, 1, 1, 1, 1, 0, 0, c32_bin, true);
tk::dnn::Activation a32(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c33(&net, 256, 3, 3, 1, 1, 1, 1, c33_bin, true, false, false, 32);
tk::dnn::Conv2d c33(&net, 256, 3, 3, 1, 1, 1, 1, c33_bin, true, false, 32);
tk::dnn::Activation a33(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c34(&net, 256, 1, 1, 1, 1, 0, 0, c34_bin, true);
@@ -223,7 +223,7 @@ int main()
tk::dnn::Conv2d c38(&net, 512, 1, 1, 1, 1, 0, 0, c38_bin, true);
tk::dnn::Activation a38(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c39(&net, 512, 3, 3, 2, 2, 1, 1, c39_bin, true, false, false, 32);
tk::dnn::Conv2d c39(&net, 512, 3, 3, 2, 2, 1, 1, c39_bin, true, false, 32);
tk::dnn::Activation a39(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c40(&net, 512, 1, 1, 1, 1, 0, 0, c40_bin, true);
@@ -235,7 +235,7 @@ int main()
//3-1
tk::dnn::Conv2d c43(&net, 512, 1, 1, 1, 1, 0, 0, c43_bin, true);
tk::dnn::Activation a43(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c44(&net, 512, 3, 3, 1, 1, 1, 1, c44_bin, true, false, false, 32);
tk::dnn::Conv2d c44(&net, 512, 3, 3, 1, 1, 1, 1, c44_bin, true, false, 32);
tk::dnn::Activation a44(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c45(&net, 512, 1, 1, 1, 1, 0, 0, c45_bin, true);
@@ -245,7 +245,7 @@ int main()
//3-2
tk::dnn::Conv2d c47(&net, 512, 1, 1, 1, 1, 0, 0, c47_bin, true);
tk::dnn::Activation a47(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c48(&net, 512, 3, 3, 1, 1, 1, 1, c48_bin, true, false, false, 32);
tk::dnn::Conv2d c48(&net, 512, 3, 3, 1, 1, 1, 1, c48_bin, true, false, 32);
tk::dnn::Activation a48(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c49(&net, 512, 1, 1, 1, 1, 0, 0, c49_bin, true);
@@ -255,7 +255,7 @@ int main()
//3-3
tk::dnn::Conv2d c51(&net, 512, 1, 1, 1, 1, 0, 0, c51_bin, true);
tk::dnn::Activation a51(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c52(&net, 512, 3, 3, 1, 1, 1, 1, c52_bin, true, false, false, 32);
tk::dnn::Conv2d c52(&net, 512, 3, 3, 1, 1, 1, 1, c52_bin, true, false, 32);
tk::dnn::Activation a52(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c53(&net, 512, 1, 1, 1, 1, 0, 0, c53_bin, true);
@@ -265,7 +265,7 @@ int main()
//3-4
tk::dnn::Conv2d c55(&net, 512, 1, 1, 1, 1, 0, 0, c55_bin, true);
tk::dnn::Activation a55(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c56(&net, 512, 3, 3, 1, 1, 1, 1, c56_bin, true, false, false, 32);
tk::dnn::Conv2d c56(&net, 512, 3, 3, 1, 1, 1, 1, c56_bin, true, false, 32);
tk::dnn::Activation a56(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c57(&net, 512, 1, 1, 1, 1, 0, 0, c57_bin, true);
@@ -275,7 +275,7 @@ int main()
//3-5
tk::dnn::Conv2d c59(&net, 512, 1, 1, 1, 1, 0, 0, c59_bin, true);
tk::dnn::Activation a59(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c60(&net, 512, 3, 3, 1, 1, 1, 1, c60_bin, true, false, false, 32);
tk::dnn::Conv2d c60(&net, 512, 3, 3, 1, 1, 1, 1, c60_bin, true, false, 32);
tk::dnn::Activation a60(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c61(&net, 512, 1, 1, 1, 1, 0, 0, c61_bin, true);
@@ -291,7 +291,7 @@ int main()
tk::dnn::Conv2d c65(&net, 1024, 1, 1, 1, 1, 0, 0, c65_bin, true);
tk::dnn::Activation a65(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c66(&net, 1024, 3, 3, 2, 2, 1, 1, c66_bin, true, false, false, 32);
tk::dnn::Conv2d c66(&net, 1024, 3, 3, 2, 2, 1, 1, c66_bin, true, false, 32);
tk::dnn::Activation a66(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c67(&net, 1024, 1, 1, 1, 1, 0, 0, c67_bin, true);
tk::dnn::Activation a67(&net, tk::dnn::ACTIVATION_LEAKY);
@@ -305,7 +305,7 @@ int main()
//4-1
tk::dnn::Conv2d c70(&net, 1024, 1, 1, 1, 1, 0, 0, c70_bin, true);
tk::dnn::Activation a70(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c71(&net, 1024, 3, 3, 1, 1, 1, 1, c71_bin, true, false, false, 32);
tk::dnn::Conv2d c71(&net, 1024, 3, 3, 1, 1, 1, 1, c71_bin, true, false, 32);
tk::dnn::Activation a71(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c72(&net, 1024, 1, 1, 1, 1, 0, 0, c72_bin, true);
@@ -315,7 +315,7 @@ int main()
//4-2
tk::dnn::Conv2d c74(&net, 1024, 1, 1, 1, 1, 0, 0, c74_bin, true);
tk::dnn::Activation a74(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c75(&net, 1024, 3, 3, 1, 1, 1, 1, c75_bin, true, false, false, 32);
tk::dnn::Conv2d c75(&net, 1024, 3, 3, 1, 1, 1, 1, c75_bin, true, false, 32);
tk::dnn::Activation a75(&net, tk::dnn::ACTIVATION_LEAKY);
tk::dnn::Conv2d c76(&net, 1024, 1, 1, 1, 1, 0, 0, c76_bin, true);
+8 -5
View File
@@ -448,24 +448,27 @@ int main()
// hm
tk::dnn::Conv2d *hm_conv1 = new tk::dnn::Conv2d(&net, 256, 3, 3, 1, 1, 1, 1, hm_conv1_bin, false);
tk::dnn::Activation *hm_relu1 = new tk::dnn::Activation(&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Conv2d *hm = new tk::dnn::Conv2d(&net, 80, 1, 1, 1, 1, 0, 0, hm_conv2_bin, false, false, true);
tk::dnn::Conv2d *hm = new tk::dnn::Conv2d(&net, 80, 1, 1, 1, 1, 0, 0, hm_conv2_bin, false);
hm->setFinal();
int kernel = 3;
int pad = (kernel - 1)/2;
tk::dnn::Activation *hm_sig = new tk::dnn::Activation(&net, CUDNN_ACTIVATION_SIGMOID);
tk::dnn::Pooling *hmax = new tk::dnn::Pooling(&net, kernel, kernel, 1, 1, pad, pad, tk::dnn::POOLING_MAX, true);
tk::dnn::Pooling *hmax = new tk::dnn::Pooling(&net, kernel, kernel, 1, 1, pad, pad, tk::dnn::POOLING_MAX);
hmax->setFinal();
// // wh
tk::dnn::Route *route_1_0 = new tk::dnn::Route(&net, route_1_0_layers, 1);
tk::dnn::Conv2d *wh_conv1 = new tk::dnn::Conv2d(&net, 256, 3, 3, 1, 1, 1, 1, wh_conv1_bin, false);
tk::dnn::Activation *wh_relu1 = new tk::dnn::Activation(&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Conv2d *wh = new tk::dnn::Conv2d(&net, 2, 1, 1, 1, 1, 0, 0, wh_conv2_bin, false, false, true);
tk::dnn::Conv2d *wh = new tk::dnn::Conv2d(&net, 2, 1, 1, 1, 1, 0, 0, wh_conv2_bin, false);
wh->setFinal();
// // reg
tk::dnn::Route *route_2_0 = new tk::dnn::Route(&net, route_1_0_layers, 1);
tk::dnn::Conv2d *reg_conv1 = new tk::dnn::Conv2d(&net, 256, 3, 3, 1, 1, 1, 1, reg_conv1_bin, false);
tk::dnn::Activation *reg_relu1 = new tk::dnn::Activation(&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Conv2d *reg = new tk::dnn::Conv2d(&net, 2, 1, 1, 1, 1, 0, 0, reg_conv2_bin, false, false, true);
tk::dnn::Conv2d *reg = new tk::dnn::Conv2d(&net, 2, 1, 1, 1, 1, 0, 0, reg_conv2_bin, false);
reg->setFinal();
// Load input
dnnType *data;
+39 -35
View File
@@ -147,14 +147,14 @@ int main()
//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, 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);
tk::dnn::Activation relu_2_1(&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Conv2d ir_2_conv2(&net, 96, 3, 3, 2, 2, 1, 1, inverted_residual2[1], true, false, false, 96);
tk::dnn::Conv2d ir_2_conv2(&net, 96, 3, 3, 2, 2, 1, 1, inverted_residual2[1], true, false, 96);
tk::dnn::Activation relu_2_2(&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Conv2d ir_2_conv3(&net, 24, 1, 1, 1, 1, 0, 0, inverted_residual2[2], true);
@@ -162,7 +162,7 @@ int main()
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::Conv2d ir_3_conv2(&net, 144, 3, 3, 1, 1, 1, 1, inverted_residual3[1], true, 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);
@@ -170,7 +170,7 @@ int main()
// //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);
tk::dnn::Conv2d ir_4_conv2(&net, 144, 3, 3, 2, 2, 1, 1, inverted_residual4[1], true, false, false, 144);
tk::dnn::Conv2d ir_4_conv2(&net, 144, 3, 3, 2, 2, 1, 1, inverted_residual4[1], true, false, 144);
tk::dnn::Activation relu_4_2(&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Conv2d ir_4_conv3(&net, 32, 1, 1, 1, 1, 0, 0, inverted_residual4[2], true);
@@ -178,7 +178,7 @@ int main()
last = &ir_4_conv3;
tk::dnn::Conv2d ir_5_conv1(&net, 192, 1, 1, 1, 1, 0, 0, inverted_residual5[0], true);
tk::dnn::Activation relu_5_1(&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Conv2d ir_5_conv2(&net, 192, 3, 3, 1, 1, 1, 1, inverted_residual5[1], true, false, false, 192);
tk::dnn::Conv2d ir_5_conv2(&net, 192, 3, 3, 1, 1, 1, 1, inverted_residual5[1], true, 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);
@@ -187,7 +187,7 @@ int main()
last = &s5_0;
tk::dnn::Conv2d ir_6_conv1(&net, 192, 1, 1, 1, 1, 0, 0, inverted_residual6[0], true);
tk::dnn::Activation relu_6_1(&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Conv2d ir_6_conv2(&net, 192, 3, 3, 1, 1, 1, 1, inverted_residual6[1], true, false, false, 192);
tk::dnn::Conv2d ir_6_conv2(&net, 192, 3, 3, 1, 1, 1, 1, inverted_residual6[1], true, false, 192);
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);
@@ -195,7 +195,7 @@ int main()
//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);
tk::dnn::Conv2d ir_7_conv2(&net, 192, 3, 3, 2, 2, 1, 1, inverted_residual7[1], true, false, false, 192);
tk::dnn::Conv2d ir_7_conv2(&net, 192, 3, 3, 2, 2, 1, 1, inverted_residual7[1], true, false, 192);
tk::dnn::Activation relu_7_2(&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Conv2d ir_7_conv3(&net, 64, 1, 1, 1, 1, 0, 0, inverted_residual7[2], true);
@@ -203,7 +203,7 @@ int main()
last = &ir_7_conv3;
tk::dnn::Conv2d ir_8_conv1(&net, 384, 1, 1, 1, 1, 0, 0, inverted_residual8[0], true);
tk::dnn::Activation relu_8_1(&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Conv2d ir_8_conv2(&net, 384, 3, 3, 1, 1, 1, 1, inverted_residual8[1], true, false, false, 384);
tk::dnn::Conv2d ir_8_conv2(&net, 384, 3, 3, 1, 1, 1, 1, inverted_residual8[1], true, 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);
@@ -212,7 +212,7 @@ int main()
last = &s8_0;
tk::dnn::Conv2d ir_9_conv1(&net, 384, 1, 1, 1, 1, 0, 0, inverted_residual9[0], true);
tk::dnn::Activation relu_9_1(&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Conv2d ir_9_conv2(&net, 384, 3, 3, 1, 1, 1, 1, inverted_residual9[1], true, false, false, 384);
tk::dnn::Conv2d ir_9_conv2(&net, 384, 3, 3, 1, 1, 1, 1, inverted_residual9[1], true, false, 384);
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);
@@ -221,7 +221,7 @@ int main()
last = &s9_0;
tk::dnn::Conv2d ir_10_conv1(&net, 384, 1, 1, 1, 1, 0, 0, inverted_residual10[0], true);
tk::dnn::Activation relu_10_1(&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Conv2d ir_10_conv2(&net, 384, 3, 3, 1, 1, 1, 1, inverted_residual10[1], true, false, false, 384);
tk::dnn::Conv2d ir_10_conv2(&net, 384, 3, 3, 1, 1, 1, 1, inverted_residual10[1], true, false, 384);
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);
@@ -229,7 +229,7 @@ int main()
//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);
tk::dnn::Conv2d ir_11_conv2(&net, 384, 3, 3, 1, 1, 1, 1, inverted_residual11[1], true, false, false, 384);
tk::dnn::Conv2d ir_11_conv2(&net, 384, 3, 3, 1, 1, 1, 1, inverted_residual11[1], true, false, 384);
tk::dnn::Activation relu_11_2(&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Conv2d ir_11_conv3(&net, 96, 1, 1, 1, 1, 0, 0, inverted_residual11[2], true);
@@ -237,7 +237,7 @@ int main()
//Inverted Residual 12
tk::dnn::Conv2d ir_12_conv1(&net, 576, 1, 1, 1, 1, 0, 0, inverted_residual12[0], true);
tk::dnn::Activation relu_12_1(&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Conv2d ir_12_conv2(&net, 576, 3, 3, 1, 1, 1, 1, inverted_residual12[1], true, false, false, 576);
tk::dnn::Conv2d ir_12_conv2(&net, 576, 3, 3, 1, 1, 1, 1, inverted_residual12[1], true, false, 576);
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);
@@ -246,7 +246,7 @@ int main()
//Inverted Residual 13
tk::dnn::Conv2d ir_13_conv1(&net, 576, 1, 1, 1, 1, 0, 0, inverted_residual13[0], true);
tk::dnn::Activation relu_13_1(&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Conv2d ir_13_conv2(&net, 576, 3, 3, 1, 1, 1, 1, inverted_residual13[1], true, false, false, 576);
tk::dnn::Conv2d ir_13_conv2(&net, 576, 3, 3, 1, 1, 1, 1, inverted_residual13[1], true, false, 576);
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);
@@ -254,7 +254,7 @@ int main()
// //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::Conv2d ir_14_conv2(&net, 576, 3, 3, 2, 2, 1, 1, inverted_residual14[1], true, false, false, 576);
tk::dnn::Conv2d ir_14_conv2(&net, 576, 3, 3, 2, 2, 1, 1, inverted_residual14[1], true, 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);
@@ -262,7 +262,7 @@ int main()
last = &ir_14_conv3;
tk::dnn::Conv2d ir_15_conv1(&net, 960, 1, 1, 1, 1, 0, 0, inverted_residual15[0], true);
tk::dnn::Activation relu_15_1(&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Conv2d ir_15_conv2(&net, 960, 3, 3, 1, 1, 1, 1, inverted_residual15[1], true, false, false, 960);
tk::dnn::Conv2d ir_15_conv2(&net, 960, 3, 3, 1, 1, 1, 1, inverted_residual15[1], true, false, 960);
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);
@@ -271,7 +271,7 @@ int main()
last = &s15_0;
tk::dnn::Conv2d ir_16_conv1(&net, 960, 1, 1, 1, 1, 0, 0, inverted_residual16[0], true);
tk::dnn::Activation relu_16_1(&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Conv2d ir_16_conv2(&net, 960, 3, 3, 1, 1, 1, 1, inverted_residual16[1], true, false, false, 960);
tk::dnn::Conv2d ir_16_conv2(&net, 960, 3, 3, 1, 1, 1, 1, inverted_residual16[1], true, false, 960);
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);
@@ -279,7 +279,7 @@ int main()
//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);
tk::dnn::Conv2d ir_17_conv2(&net, 960, 3, 3, 1, 1, 1, 1, inverted_residual17[1], true, false, false, 960);
tk::dnn::Conv2d ir_17_conv2(&net, 960, 3, 3, 1, 1, 1, 1, inverted_residual17[1], true, false, 960);
tk::dnn::Activation relu_17_2(&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Conv2d ir_17_conv3(&net, 320, 1, 1, 1, 1, 0, 0, inverted_residual17[2], true);
@@ -291,7 +291,7 @@ int main()
// //extras Inverted Residual 0
tk::dnn::Conv2d e_0_conv1(&net, 256, 1, 1, 1, 1, 0, 0, extras0[0], true);
tk::dnn::Activation e_relu_0_1(&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Conv2d e_0_conv2(&net, 256, 3, 3, 2, 2, 1, 1, extras0[1], true, false, false, 256);
tk::dnn::Conv2d e_0_conv2(&net, 256, 3, 3, 2, 2, 1, 1, extras0[1], true, 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};
@@ -299,7 +299,7 @@ int main()
// //extras Inverted Residual 1
tk::dnn::Conv2d e_1_conv1(&net, 128, 1, 1, 1, 1, 0, 0, extras1[0], true);
tk::dnn::Activation e_relu_1_1(&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Conv2d e_1_conv2(&net, 128, 3, 3, 2, 2, 1, 1, extras1[1], true, false, false, 128);
tk::dnn::Conv2d e_1_conv2(&net, 128, 3, 3, 2, 2, 1, 1, extras1[1], true, 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};
@@ -307,7 +307,7 @@ int main()
//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::Conv2d e_2_conv2(&net, 128, 3, 3, 2, 2, 1, 1, extras2[1], true, 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};
@@ -315,7 +315,7 @@ int main()
//extras Inverted Residual 3
tk::dnn::Conv2d e_3_conv1(&net, 64, 1, 1, 1, 1, 0, 0, extras3[0], true);
tk::dnn::Activation e_relu_3_1(&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Conv2d e_3_conv2(&net, 64, 3, 3, 2, 2, 1, 1, extras3[1], true, false, false, 64);
tk::dnn::Conv2d e_3_conv2(&net, 64, 3, 3, 2, 2, 1, 1, extras3[1], true, 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};
@@ -323,68 +323,69 @@ int main()
// 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::Conv2d ch_0_conv1(&net, 576, 3, 3, 1, 1, 1, 1, classification_header0[0], true, 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::Conv2d ch_1_conv1(&net, 1280, 3, 3, 1, 1, 1, 1, classification_header1[0], true, 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::Conv2d ch_2_conv1(&net, 512, 3, 3, 1, 1, 1, 1, classification_header2[0], true, false, false, 512, true);
tk::dnn::Conv2d ch_2_conv1(&net, 512, 3, 3, 1, 1, 1, 1, classification_header2[0], true, false, 512, true);
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::Conv2d ch_3_conv1(&net, 256, 3, 3, 1, 1, 1, 1, classification_header3[0], true, false, false, 256, true);
tk::dnn::Conv2d ch_3_conv1(&net, 256, 3, 3, 1, 1, 1, 1, classification_header3[0], true, false, 256, true);
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::Conv2d ch_4_conv1(&net, 256, 3, 3, 1, 1, 1, 1, classification_header4[0], true, false, false, 256, true);
tk::dnn::Conv2d ch_4_conv1(&net, 256, 3, 3, 1, 1, 1, 1, classification_header4[0], true, false, 256, true);
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, false, true);
tk::dnn::Conv2d ch_5_conv(&net, 126, 1, 1, 1, 1, 0, 0, classification_header5, false);
ch_5_conv.setFinal();
tk::dnn::Layer *conf5[1] = {&ch_5_conv};
//regression header 0
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::Conv2d rh_0_conv1(&net, 576, 3, 3, 1, 1, 1, 1, regression_header0[0], true, false, 576, true);
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::Conv2d rh_1_conv1(&net, 1280, 3, 3, 1, 1, 1, 1, regression_header1[0], true, false, false, 1280, true);
tk::dnn::Conv2d rh_1_conv1(&net, 1280, 3, 3, 1, 1, 1, 1, regression_header1[0], true, false, 1280, true);
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::Conv2d rh_2_conv1(&net, 512, 3, 3, 1, 1, 1, 1, regression_header2[0], true, false, false, 512, true);
tk::dnn::Conv2d rh_2_conv1(&net, 512, 3, 3, 1, 1, 1, 1, regression_header2[0], true, false, 512, true);
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::Conv2d rh_3_conv1(&net, 256, 3, 3, 1, 1, 1, 1, regression_header3[0], true, false, false, 256, true);
tk::dnn::Conv2d rh_3_conv1(&net, 256, 3, 3, 1, 1, 1, 1, regression_header3[0], true, false, 256, true);
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};
@@ -392,14 +393,15 @@ int main()
//regression header 4
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::Conv2d rh_4_conv1(&net, 256, 3, 3, 1, 1, 1, 1, regression_header4[0], true, false, 256, true);
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, false, true);
tk::dnn::Conv2d rh_5_conv(&net, 24, 1, 1, 1, 1, 0, 0, regression_header5, false);
rh_5_conv.setFinal();
tk::dnn::Layer *loc5[1] = {&rh_5_conv};
last = &rh_5_conv;
@@ -444,7 +446,8 @@ int main()
tk::dnn::Reshape reshape_conf2(&net, newdim_c);
tk::dnn::Softmax sm_1(&net, &newdim_c, true);
tk::dnn::Softmax sm_1(&net, &newdim_c);
sm_1.setFinal();
// tk::dnn::Flatten fl_l_7(&net);
// tk::dnn::Reshape reshape_conf3(&net,dim_resh, true);
tk::dnn::Layer *conf = &sm_1;
@@ -454,7 +457,8 @@ int main()
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::Reshape reshape_loc(&net, newdim_l);
reshape_loc.setFinal();
tk::dnn::Layer *loc = &reshape_loc;
// Load input
+39 -35
View File
@@ -148,14 +148,14 @@ int main()
//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, 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);
tk::dnn::Activation relu_2_1(&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Conv2d ir_2_conv2(&net, 96, 3, 3, 2, 2, 1, 1, inverted_residual2[1], true, false, false, 96);
tk::dnn::Conv2d ir_2_conv2(&net, 96, 3, 3, 2, 2, 1, 1, inverted_residual2[1], true, false, 96);
tk::dnn::Activation relu_2_2(&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Conv2d ir_2_conv3(&net, 24, 1, 1, 1, 1, 0, 0, inverted_residual2[2], true);
@@ -163,7 +163,7 @@ int main()
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::Conv2d ir_3_conv2(&net, 144, 3, 3, 1, 1, 1, 1, inverted_residual3[1], true, 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);
@@ -171,7 +171,7 @@ int main()
// //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);
tk::dnn::Conv2d ir_4_conv2(&net, 144, 3, 3, 2, 2, 1, 1, inverted_residual4[1], true, false, false, 144);
tk::dnn::Conv2d ir_4_conv2(&net, 144, 3, 3, 2, 2, 1, 1, inverted_residual4[1], true, false, 144);
tk::dnn::Activation relu_4_2(&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Conv2d ir_4_conv3(&net, 32, 1, 1, 1, 1, 0, 0, inverted_residual4[2], true);
@@ -179,7 +179,7 @@ int main()
last = &ir_4_conv3;
tk::dnn::Conv2d ir_5_conv1(&net, 192, 1, 1, 1, 1, 0, 0, inverted_residual5[0], true);
tk::dnn::Activation relu_5_1(&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Conv2d ir_5_conv2(&net, 192, 3, 3, 1, 1, 1, 1, inverted_residual5[1], true, false, false, 192);
tk::dnn::Conv2d ir_5_conv2(&net, 192, 3, 3, 1, 1, 1, 1, inverted_residual5[1], true, 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);
@@ -188,7 +188,7 @@ int main()
last = &s5_0;
tk::dnn::Conv2d ir_6_conv1(&net, 192, 1, 1, 1, 1, 0, 0, inverted_residual6[0], true);
tk::dnn::Activation relu_6_1(&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Conv2d ir_6_conv2(&net, 192, 3, 3, 1, 1, 1, 1, inverted_residual6[1], true, false, false, 192);
tk::dnn::Conv2d ir_6_conv2(&net, 192, 3, 3, 1, 1, 1, 1, inverted_residual6[1], true, false, 192);
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);
@@ -196,7 +196,7 @@ int main()
//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);
tk::dnn::Conv2d ir_7_conv2(&net, 192, 3, 3, 2, 2, 1, 1, inverted_residual7[1], true, false, false, 192);
tk::dnn::Conv2d ir_7_conv2(&net, 192, 3, 3, 2, 2, 1, 1, inverted_residual7[1], true, false, 192);
tk::dnn::Activation relu_7_2(&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Conv2d ir_7_conv3(&net, 64, 1, 1, 1, 1, 0, 0, inverted_residual7[2], true);
@@ -204,7 +204,7 @@ int main()
last = &ir_7_conv3;
tk::dnn::Conv2d ir_8_conv1(&net, 384, 1, 1, 1, 1, 0, 0, inverted_residual8[0], true);
tk::dnn::Activation relu_8_1(&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Conv2d ir_8_conv2(&net, 384, 3, 3, 1, 1, 1, 1, inverted_residual8[1], true, false, false, 384);
tk::dnn::Conv2d ir_8_conv2(&net, 384, 3, 3, 1, 1, 1, 1, inverted_residual8[1], true, 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);
@@ -213,7 +213,7 @@ int main()
last = &s8_0;
tk::dnn::Conv2d ir_9_conv1(&net, 384, 1, 1, 1, 1, 0, 0, inverted_residual9[0], true);
tk::dnn::Activation relu_9_1(&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Conv2d ir_9_conv2(&net, 384, 3, 3, 1, 1, 1, 1, inverted_residual9[1], true, false, false, 384);
tk::dnn::Conv2d ir_9_conv2(&net, 384, 3, 3, 1, 1, 1, 1, inverted_residual9[1], true, false, 384);
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);
@@ -222,7 +222,7 @@ int main()
last = &s9_0;
tk::dnn::Conv2d ir_10_conv1(&net, 384, 1, 1, 1, 1, 0, 0, inverted_residual10[0], true);
tk::dnn::Activation relu_10_1(&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Conv2d ir_10_conv2(&net, 384, 3, 3, 1, 1, 1, 1, inverted_residual10[1], true, false, false, 384);
tk::dnn::Conv2d ir_10_conv2(&net, 384, 3, 3, 1, 1, 1, 1, inverted_residual10[1], true, false, 384);
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);
@@ -230,7 +230,7 @@ int main()
//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);
tk::dnn::Conv2d ir_11_conv2(&net, 384, 3, 3, 1, 1, 1, 1, inverted_residual11[1], true, false, false, 384);
tk::dnn::Conv2d ir_11_conv2(&net, 384, 3, 3, 1, 1, 1, 1, inverted_residual11[1], true, false, 384);
tk::dnn::Activation relu_11_2(&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Conv2d ir_11_conv3(&net, 96, 1, 1, 1, 1, 0, 0, inverted_residual11[2], true);
@@ -238,7 +238,7 @@ int main()
//Inverted Residual 12
tk::dnn::Conv2d ir_12_conv1(&net, 576, 1, 1, 1, 1, 0, 0, inverted_residual12[0], true);
tk::dnn::Activation relu_12_1(&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Conv2d ir_12_conv2(&net, 576, 3, 3, 1, 1, 1, 1, inverted_residual12[1], true, false, false, 576);
tk::dnn::Conv2d ir_12_conv2(&net, 576, 3, 3, 1, 1, 1, 1, inverted_residual12[1], true, false, 576);
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);
@@ -247,7 +247,7 @@ int main()
//Inverted Residual 13
tk::dnn::Conv2d ir_13_conv1(&net, 576, 1, 1, 1, 1, 0, 0, inverted_residual13[0], true);
tk::dnn::Activation relu_13_1(&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Conv2d ir_13_conv2(&net, 576, 3, 3, 1, 1, 1, 1, inverted_residual13[1], true, false, false, 576);
tk::dnn::Conv2d ir_13_conv2(&net, 576, 3, 3, 1, 1, 1, 1, inverted_residual13[1], true, false, 576);
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);
@@ -255,7 +255,7 @@ int main()
// //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::Conv2d ir_14_conv2(&net, 576, 3, 3, 2, 2, 1, 1, inverted_residual14[1], true, false, false, 576);
tk::dnn::Conv2d ir_14_conv2(&net, 576, 3, 3, 2, 2, 1, 1, inverted_residual14[1], true, 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);
@@ -263,7 +263,7 @@ int main()
last = &ir_14_conv3;
tk::dnn::Conv2d ir_15_conv1(&net, 960, 1, 1, 1, 1, 0, 0, inverted_residual15[0], true);
tk::dnn::Activation relu_15_1(&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Conv2d ir_15_conv2(&net, 960, 3, 3, 1, 1, 1, 1, inverted_residual15[1], true, false, false, 960);
tk::dnn::Conv2d ir_15_conv2(&net, 960, 3, 3, 1, 1, 1, 1, inverted_residual15[1], true, false, 960);
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);
@@ -272,7 +272,7 @@ int main()
last = &s15_0;
tk::dnn::Conv2d ir_16_conv1(&net, 960, 1, 1, 1, 1, 0, 0, inverted_residual16[0], true);
tk::dnn::Activation relu_16_1(&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Conv2d ir_16_conv2(&net, 960, 3, 3, 1, 1, 1, 1, inverted_residual16[1], true, false, false, 960);
tk::dnn::Conv2d ir_16_conv2(&net, 960, 3, 3, 1, 1, 1, 1, inverted_residual16[1], true, false, 960);
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);
@@ -280,7 +280,7 @@ int main()
//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);
tk::dnn::Conv2d ir_17_conv2(&net, 960, 3, 3, 1, 1, 1, 1, inverted_residual17[1], true, false, false, 960);
tk::dnn::Conv2d ir_17_conv2(&net, 960, 3, 3, 1, 1, 1, 1, inverted_residual17[1], true, false, 960);
tk::dnn::Activation relu_17_2(&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Conv2d ir_17_conv3(&net, 320, 1, 1, 1, 1, 0, 0, inverted_residual17[2], true);
@@ -292,7 +292,7 @@ int main()
// //extras Inverted Residual 0
tk::dnn::Conv2d e_0_conv1(&net, 256, 1, 1, 1, 1, 0, 0, extras0[0], true);
tk::dnn::Activation e_relu_0_1(&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Conv2d e_0_conv2(&net, 256, 3, 3, 2, 2, 1, 1, extras0[1], true, false, false, 256);
tk::dnn::Conv2d e_0_conv2(&net, 256, 3, 3, 2, 2, 1, 1, extras0[1], true, 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};
@@ -300,7 +300,7 @@ int main()
// //extras Inverted Residual 1
tk::dnn::Conv2d e_1_conv1(&net, 128, 1, 1, 1, 1, 0, 0, extras1[0], true);
tk::dnn::Activation e_relu_1_1(&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Conv2d e_1_conv2(&net, 128, 3, 3, 2, 2, 1, 1, extras1[1], true, false, false, 128);
tk::dnn::Conv2d e_1_conv2(&net, 128, 3, 3, 2, 2, 1, 1, extras1[1], true, 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};
@@ -308,7 +308,7 @@ int main()
//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::Conv2d e_2_conv2(&net, 128, 3, 3, 2, 2, 1, 1, extras2[1], true, 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};
@@ -316,7 +316,7 @@ int main()
//extras Inverted Residual 3
tk::dnn::Conv2d e_3_conv1(&net, 64, 1, 1, 1, 1, 0, 0, extras3[0], true);
tk::dnn::Activation e_relu_3_1(&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Conv2d e_3_conv2(&net, 64, 3, 3, 2, 2, 1, 1, extras3[1], true, false, false, 64);
tk::dnn::Conv2d e_3_conv2(&net, 64, 3, 3, 2, 2, 1, 1, extras3[1], true, 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};
@@ -324,68 +324,69 @@ int main()
// 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::Conv2d ch_0_conv1(&net, 576, 3, 3, 1, 1, 1, 1, classification_header0[0], true, false, 576, true);
tk::dnn::Activation ch_relu_0_1(&net, CUDNN_ACTIVATION_CLIPPED_RELU, 6);
tk::dnn::Conv2d ch_0_conv2(&net, 486, 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::Conv2d ch_1_conv1(&net, 1280, 3, 3, 1, 1, 1, 1, classification_header1[0], true, false, 1280, true);
tk::dnn::Activation ch_relu_1_1(&net, CUDNN_ACTIVATION_CLIPPED_RELU, 6);
tk::dnn::Conv2d ch_1_conv2(&net, 486, 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::Conv2d ch_2_conv1(&net, 512, 3, 3, 1, 1, 1, 1, classification_header2[0], true, false, false, 512, true);
tk::dnn::Conv2d ch_2_conv1(&net, 512, 3, 3, 1, 1, 1, 1, classification_header2[0], true, false, 512, true);
tk::dnn::Activation ch_relu_2_1(&net, CUDNN_ACTIVATION_CLIPPED_RELU, 6);
tk::dnn::Conv2d ch_2_conv2(&net, 486, 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::Conv2d ch_3_conv1(&net, 256, 3, 3, 1, 1, 1, 1, classification_header3[0], true, false, false, 256, true);
tk::dnn::Conv2d ch_3_conv1(&net, 256, 3, 3, 1, 1, 1, 1, classification_header3[0], true, false, 256, true);
tk::dnn::Activation ch_relu_3_1(&net, CUDNN_ACTIVATION_CLIPPED_RELU, 6);
tk::dnn::Conv2d ch_3_conv2(&net, 486, 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::Conv2d ch_4_conv1(&net, 256, 3, 3, 1, 1, 1, 1, classification_header4[0], true, false, false, 256, true);
tk::dnn::Conv2d ch_4_conv1(&net, 256, 3, 3, 1, 1, 1, 1, classification_header4[0], true, false, 256, true);
tk::dnn::Activation ch_relu_4_1(&net, CUDNN_ACTIVATION_CLIPPED_RELU, 6);
tk::dnn::Conv2d ch_4_conv2(&net, 486, 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, 486, 1, 1, 1, 1, 0, 0, classification_header5, false, false, true);
tk::dnn::Conv2d ch_5_conv(&net, 486, 1, 1, 1, 1, 0, 0, classification_header5, false);
ch_5_conv.setFinal();
tk::dnn::Layer *conf5[1] = {&ch_5_conv};
//regression header 0
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::Conv2d rh_0_conv1(&net, 576, 3, 3, 1, 1, 1, 1, regression_header0[0], true, false, 576, true);
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::Conv2d rh_1_conv1(&net, 1280, 3, 3, 1, 1, 1, 1, regression_header1[0], true, false, false, 1280, true);
tk::dnn::Conv2d rh_1_conv1(&net, 1280, 3, 3, 1, 1, 1, 1, regression_header1[0], true, false, 1280, true);
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::Conv2d rh_2_conv1(&net, 512, 3, 3, 1, 1, 1, 1, regression_header2[0], true, false, false, 512, true);
tk::dnn::Conv2d rh_2_conv1(&net, 512, 3, 3, 1, 1, 1, 1, regression_header2[0], true, false, 512, true);
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::Conv2d rh_3_conv1(&net, 256, 3, 3, 1, 1, 1, 1, regression_header3[0], true, false, false, 256, true);
tk::dnn::Conv2d rh_3_conv1(&net, 256, 3, 3, 1, 1, 1, 1, regression_header3[0], true, false, 256, true);
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};
@@ -393,14 +394,15 @@ int main()
//regression header 4
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::Conv2d rh_4_conv1(&net, 256, 3, 3, 1, 1, 1, 1, regression_header4[0], true, false, 256, true);
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, false, true);
tk::dnn::Conv2d rh_5_conv(&net, 24, 1, 1, 1, 1, 0, 0, regression_header5, false);
rh_5_conv.setFinal();
tk::dnn::Layer *loc5[1] = {&rh_5_conv};
last = &rh_5_conv;
@@ -445,7 +447,8 @@ int main()
tk::dnn::Reshape reshape_conf2(&net, newdim_c);
tk::dnn::Softmax sm_1(&net, &newdim_c, true);
tk::dnn::Softmax sm_1(&net, &newdim_c);
sm_1.setFinal();
tk::dnn::Layer *conf = &sm_1;
//concat locations
@@ -453,7 +456,8 @@ int main()
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::Reshape reshape_loc(&net, newdim_l);
reshape_loc.setFinal();
tk::dnn::Layer *loc = &reshape_loc;
// Load input
+8 -4
View File
@@ -324,21 +324,25 @@ int main()
tk::dnn::Layer *route_1_0_layers[1] = { layer2_deconv1_relu };
tk::dnn::Conv2d *hm_conv1 = new tk::dnn::Conv2d(&net, 64, 3, 3, 1, 1, 1, 1, hm_conv1_bin, false);
tk::dnn::Activation *hm_relu1 = new tk::dnn::Activation(&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Conv2d *hm = new tk::dnn::Conv2d(&net, 80, 1, 1, 1, 1, 0, 0, hm_conv2_bin, false, false, true);
tk::dnn::Conv2d *hm = new tk::dnn::Conv2d(&net, 80, 1, 1, 1, 1, 0, 0, hm_conv2_bin, false);
hm->setFinal();
int kernel = 3;
int pad = (kernel - 1)/2;
tk::dnn::Activation *hm_sig = new tk::dnn::Activation(&net, CUDNN_ACTIVATION_SIGMOID);
tk::dnn::Pooling *hmax = new tk::dnn::Pooling(&net, kernel, kernel, 1, 1, pad, pad, tk::dnn::POOLING_MAX, true);
tk::dnn::Pooling *hmax = new tk::dnn::Pooling(&net, kernel, kernel, 1, 1, pad, pad, tk::dnn::POOLING_MAX);
hmax->setFinal();
tk::dnn::Route *route_1_0 = new tk::dnn::Route(&net, route_1_0_layers, 1);
tk::dnn::Conv2d *wh_conv1 = new tk::dnn::Conv2d(&net, 64, 3, 3, 1, 1, 1, 1, wh_conv1_bin, false);
tk::dnn::Activation *wh_relu1 = new tk::dnn::Activation(&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Conv2d *wh = new tk::dnn::Conv2d(&net, 2, 1, 1, 1, 1, 0, 0, wh_conv2_bin, false, false, true);
tk::dnn::Conv2d *wh = new tk::dnn::Conv2d(&net, 2, 1, 1, 1, 1, 0, 0, wh_conv2_bin, false);
wh->setFinal();
tk::dnn::Route *route_2_0 = new tk::dnn::Route(&net, route_1_0_layers, 1);
tk::dnn::Conv2d *reg_conv1 = new tk::dnn::Conv2d(&net, 64, 3, 3, 1, 1, 1, 1, reg_conv1_bin, false);
tk::dnn::Activation *reg_relu1 = new tk::dnn::Activation(&net, CUDNN_ACTIVATION_RELU);
tk::dnn::Conv2d *reg = new tk::dnn::Conv2d(&net, 2, 1, 1, 1, 1, 0, 0, reg_conv2_bin, false, false, true);
tk::dnn::Conv2d *reg = new tk::dnn::Conv2d(&net, 2, 1, 1, 1, 1, 0, 0, reg_conv2_bin, false);
reg->setFinal();
// Load input
dnnType *data;