Fix YOLO kernels

- Fix YOLO kernels
- Update deprecated functions
This commit is contained in:
unknown
2021-12-12 09:58:23 -03:00
parent ce35e17334
commit 9565254551
11 changed files with 316 additions and 153 deletions

View File

@@ -164,13 +164,13 @@ nvinfer1::ILayer* convolutionalLayer(
}
}
nvinfer1::IConvolutionLayer* conv = network->addConvolution(
nvinfer1::IConvolutionLayer* conv = network->addConvolutionNd(
*input, filters, nvinfer1::DimsHW{kernelSize, kernelSize}, convWt, convBias);
assert(conv != nullptr);
std::string convLayerName = "conv_" + std::to_string(layerIdx);
conv->setName(convLayerName.c_str());
conv->setStride(nvinfer1::DimsHW{stride, stride});
conv->setPadding(nvinfer1::DimsHW{pad, pad});
conv->setStrideNd(nvinfer1::DimsHW{stride, stride});
conv->setPaddingNd(nvinfer1::DimsHW{pad, pad});
if (block.find("groups") != block.end())
{

View File

@@ -19,10 +19,10 @@ nvinfer1::ILayer* maxpoolLayer(
int stride = std::stoi(block.at("stride"));
nvinfer1::IPoolingLayer* pool
= network->addPooling(*input, nvinfer1::PoolingType::kMAX, nvinfer1::DimsHW{size, size});
= network->addPoolingNd(*input, nvinfer1::PoolingType::kMAX, nvinfer1::DimsHW{size, size});
assert(pool);
std::string maxpoolLayerName = "maxpool_" + std::to_string(layerIdx);
pool->setStride(nvinfer1::DimsHW{stride, stride});
pool->setStrideNd(nvinfer1::DimsHW{stride, stride});
pool->setPaddingMode(nvinfer1::PaddingMode::kSAME_UPPER);
pool->setName(maxpoolLayerName.c_str());

View File

@@ -16,7 +16,7 @@ nvinfer1::ILayer* upsampleLayer(
nvinfer1::IResizeLayer* resize_layer = network->addResize(*input);
resize_layer->setResizeMode(nvinfer1::ResizeMode::kNEAREST);
float scale[3] = {1, stride, stride};
float scale[3] = {1, static_cast<float>(stride), static_cast<float>(stride)};
resize_layer->setScales(scale, 3);
std::string layer_name = "upsample_" + std::to_string(layerIdx);
resize_layer->setName(layer_name.c_str());