Add Mobilenetv2 SSD Lite post and preprocessing, add mobilenet demo

Signed-off-by: xavier <micaelaverucchi@gmail.com>
This commit is contained in:
xavier
2020-02-26 17:42:20 +01:00
parent 110bf56dc4
commit 3eb079dd13
16 changed files with 1156 additions and 202 deletions
+26 -8
View File
@@ -5,22 +5,40 @@
namespace tk { namespace dnn {
Softmax::Softmax(Network *net) : Layer(net) {
Softmax::Softmax(Network *net, const tk::dnn::dataDim_t* dim, bool final, const cudnnSoftmaxMode_t mode) : Layer(net, final) {
checkCuda( cudaMalloc(&dstData, input_dim.tot()*sizeof(dnnType)) );
this->mode = mode;
if(dim == nullptr)
{
this->dim.n= input_dim.n;
this->dim.c= input_dim.c;
this->dim.h= input_dim.h;
this->dim.w= input_dim.w;
this->dim.l= input_dim.l;
}
else
{
this->dim.n= dim->n;
this->dim.c= dim->c;
this->dim.h= dim->h;
this->dim.w= dim->w;
this->dim.l= dim->l;
}
checkCUDNN( cudnnSetTensor4dDescriptor(srcTensorDesc,
net->tensorFormat,
net->dataType,
input_dim.n*input_dim.l,
input_dim.c,
input_dim.h, input_dim.w) );
this->dim.n*this->dim.l,
this->dim.c,
this->dim.h, this->dim.w) );
checkCUDNN( cudnnSetTensor4dDescriptor(dstTensorDesc,
net->tensorFormat,
net->dataType,
input_dim.n*input_dim.l,
input_dim.c,
input_dim.h, input_dim.w) );
this->dim.n*this->dim.l,
this->dim.c,
this->dim.h, this->dim.w) );
}
Softmax::~Softmax() {
@@ -34,7 +52,7 @@ dnnType* Softmax::infer(dataDim_t &dim, dnnType* srcData) {
dnnType beta = dnnType(0);
checkCUDNN( cudnnSoftmaxForward(net->cudnnHandle,
CUDNN_SOFTMAX_ACCURATE ,
CUDNN_SOFTMAX_MODE_CHANNEL,
this->mode,
&alpha,
srcTensorDesc,
srcData,