Add models benchmarks

Add models benchmarks
Minor fixes
This commit is contained in:
unknown
2022-02-10 00:52:40 -03:00
parent 5b9b1f77c8
commit ff785458dd
5 changed files with 68 additions and 26 deletions

View File

@@ -81,7 +81,7 @@ nvinfer1::ILayer* activationLayer(
mish->setName(mishLayerName.c_str());
output = mish;
}
else if (activation == "silu")
else if (activation == "silu" || activation == "swish")
{
nvinfer1::IActivationLayer* sigmoid = network->addActivation(
*input, nvinfer1::ActivationType::kSIGMOID);

View File

@@ -14,6 +14,7 @@ nvinfer1::ILayer* convolutionalLayer(
int& weightPtr,
std::string weightsType,
int& inputChannels,
float eps,
nvinfer1::ITensor* input,
nvinfer1::INetworkDefinition* network)
{
@@ -156,7 +157,7 @@ nvinfer1::ILayer* convolutionalLayer(
}
for (int i = 0; i < filters; ++i)
{
bnRunningVar.push_back(sqrt(weights[weightPtr] + 1.0e-3));
bnRunningVar.push_back(sqrt(weights[weightPtr] + eps));
weightPtr++;
}
trtWeights.push_back(convWt);

View File

@@ -21,6 +21,7 @@ nvinfer1::ILayer* convolutionalLayer(
int& weightPtr,
std::string weightsType,
int& inputChannels,
float eps,
nvinfer1::ITensor* input,
nvinfer1::INetworkDefinition* network);

View File

@@ -173,8 +173,12 @@ NvDsInferStatus Yolo::buildYoloNetwork(
}
else if (m_ConfigBlocks.at(i).at("type") == "convolutional") {
float eps = 1.0e-5;
if (m_NetworkType.find("yolov5") != std::string::npos) {
eps = 1.0e-3;
}
std::string inputVol = dimsToString(previous->getDimensions());
nvinfer1::ILayer* out = convolutionalLayer(i, m_ConfigBlocks.at(i), weights, m_TrtWeights, weightPtr, weightsType, channels, previous, &network);
nvinfer1::ILayer* out = convolutionalLayer(i, m_ConfigBlocks.at(i), weights, m_TrtWeights, weightPtr, weightsType, channels, eps, previous, &network);
previous = out->getOutput(0);
assert(previous != nullptr);
channels = getNumChannels(previous);
@@ -442,6 +446,7 @@ Yolo::parseConfigFile (const std::string cfgFilePath)
while (getline(file, line))
{
if (line.size() == 0) continue;
if (line.front() == ' ') continue;
if (line.front() == '#') continue;
line = trim(line);
if (line.front() == '[')