Add CenterNet based on Resnet101, TensorRT not implemented.
Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
This commit is contained in:
+32
-1
@@ -12,6 +12,7 @@ enum layerType_t {
|
||||
LAYER_DENSE,
|
||||
LAYER_CONV2D,
|
||||
LAYER_DECONV2D,
|
||||
LAYER_DEFORMCONV2D,
|
||||
LAYER_ACTIVATION,
|
||||
LAYER_FLATTEN,
|
||||
LAYER_MULADD,
|
||||
@@ -49,6 +50,7 @@ public:
|
||||
case LAYER_DENSE: return "Dense";
|
||||
case LAYER_CONV2D: return "Conv2d";
|
||||
case LAYER_DECONV2D: return "DeConv2d";
|
||||
case LAYER_DEFORMCONV2D:return "DeformConv2d";
|
||||
case LAYER_ACTIVATION: return "Activation";
|
||||
case LAYER_FLATTEN: return "Flatten";
|
||||
case LAYER_MULADD: return "MulAdd";
|
||||
@@ -78,7 +80,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);
|
||||
std::string fname_weights, bool batchnorm = false, bool additional_bias = false);
|
||||
virtual ~LayerWgs();
|
||||
|
||||
int inputs, outputs;
|
||||
@@ -87,6 +89,10 @@ public:
|
||||
dnnType *data_h, *data_d;
|
||||
dnnType *bias_h, *bias_d;
|
||||
|
||||
// additional bias for DCN
|
||||
bool additional_bias;
|
||||
dnnType *bias2_h, *bias2_d;
|
||||
|
||||
//batchnorm
|
||||
bool batchnorm;
|
||||
dnnType *power_h;
|
||||
@@ -194,6 +200,31 @@ public:
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
Deformable Convolutionl 2d layer
|
||||
*/
|
||||
class DeformConv2d : public LayerWgs {
|
||||
|
||||
public:
|
||||
DeformConv2d( Network *net, int out_ch, int deformable_group, int kernelH, int kernelW,
|
||||
int strideH, int strideW, int paddingH, int paddingW,
|
||||
std::string d_fname_weights, std::string fname_weights, bool batchnorm);
|
||||
virtual ~DeformConv2d();
|
||||
virtual layerType_t getLayerType() { return LAYER_DEFORMCONV2D; };
|
||||
|
||||
virtual dnnType* infer(dataDim_t &dim, dnnType* srcData);
|
||||
tk::dnn::Conv2d *preconv;
|
||||
int out_ch;
|
||||
int deformableGroup;
|
||||
int kernelH, kernelW, strideH, strideW, paddingH, paddingW;
|
||||
protected:
|
||||
|
||||
cudnnTensorDescriptor_t biasTensorDesc;
|
||||
|
||||
void initCUDNN();
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
Flatten layer
|
||||
is actually a matrix transposition
|
||||
|
||||
@@ -32,7 +32,7 @@ struct dataDim_t {
|
||||
};
|
||||
|
||||
class Layer;
|
||||
const int MAX_LAYERS = 256;
|
||||
const int MAX_LAYERS = 512;
|
||||
|
||||
class Network {
|
||||
|
||||
|
||||
@@ -33,4 +33,17 @@ void modulated_deformable_im2col_cuda(cudaStream_t stream,
|
||||
const int pad_h, const int pad_w, const int stride_h, const int stride_w,
|
||||
const int dilation_h, const int dilation_w,
|
||||
const int deformable_group, float *data_col);
|
||||
|
||||
void dcn_v2_cuda_forward(float *input, float *weight,
|
||||
float *bias, float *ones,
|
||||
float *offset, float *mask,
|
||||
float *output, float *columns,
|
||||
int kernel_h, int kernel_w,
|
||||
const int stride_h, const int stride_w,
|
||||
const int pad_h, const int pad_w,
|
||||
const int dilation_h, const int dilation_w,
|
||||
const int deformable_group,
|
||||
const int in_n, const int in_c, const int in_h, const int in_w,
|
||||
const int out_n, const int out_c, const int out_h, const int out_w,
|
||||
const int dst_dim, cudaStream_t stream = cudaStream_t(0));
|
||||
#endif //KERNELS_H
|
||||
|
||||
Reference in New Issue
Block a user