Add PP-YOLOE support

This commit is contained in:
Marcos Luciano
2022-07-24 18:00:47 -03:00
parent d09879d557
commit a3782ed65e
51 changed files with 1812 additions and 600 deletions

View File

@@ -5,27 +5,32 @@
#include "channels_layer.h"
nvinfer1::ILayer* channelsLayer(
std::string type,
nvinfer1::ITensor* channelsLayer(
int layerIdx,
std::map<std::string, std::string>& block,
nvinfer1::ITensor* input,
nvinfer1::ITensor* implicitTensor,
nvinfer1::INetworkDefinition* network)
{
nvinfer1::ILayer* output;
nvinfer1::ITensor* output;
if (type == "shift") {
nvinfer1::IElementWiseLayer* ew = network->addElementWise(
*input, *implicitTensor,
nvinfer1::ElementWiseOperation::kSUM);
assert(ew != nullptr);
output = ew;
assert(block.at("type") == "shift_channels" || block.at("type") == "control_channels");
if (block.at("type") == "shift_channels") {
nvinfer1::IElementWiseLayer* shift
= network->addElementWise(*input, *implicitTensor, nvinfer1::ElementWiseOperation::kSUM);
assert(shift != nullptr);
std::string shiftLayerName = "shift_channels_" + std::to_string(layerIdx);
shift->setName(shiftLayerName.c_str());
output = shift->getOutput(0);
}
else if (type == "control") {
nvinfer1::IElementWiseLayer* ew = network->addElementWise(
*input, *implicitTensor,
nvinfer1::ElementWiseOperation::kPROD);
assert(ew != nullptr);
output = ew;
else if (block.at("type") == "control_channels") {
nvinfer1::IElementWiseLayer* control
= network->addElementWise(*input, *implicitTensor, nvinfer1::ElementWiseOperation::kPROD);
assert(control != nullptr);
std::string controlLayerName = "control_channels_" + std::to_string(layerIdx);
control->setName(controlLayerName.c_str());
output = control->getOutput(0);
}
return output;