Fix network-mode

Fix FP32, FP16 and INT8 modes
This commit is contained in:
unknown
2022-02-08 22:14:20 -03:00
parent 0fdaa1142a
commit d9c3cbf41d
3 changed files with 3 additions and 6 deletions

View File

@@ -107,7 +107,7 @@ bool NvDsInferYoloCudaEngineGet(nvinfer1::IBuilder * const builder,
}
Yolo yolo(networkInfo);
cudaEngine = yolo.createEngine (builder);
cudaEngine = yolo.createEngine (builder, builderConfig);
if (cudaEngine == nullptr)
{
std::cerr << "Failed to build CUDA engine on "

View File

@@ -65,7 +65,7 @@ Yolo::~Yolo()
destroyNetworkUtils();
}
nvinfer1::ICudaEngine *Yolo::createEngine (nvinfer1::IBuilder* builder)
nvinfer1::ICudaEngine *Yolo::createEngine (nvinfer1::IBuilder* builder, nvinfer1::IBuilderConfig* config)
{
assert (builder);
@@ -85,8 +85,6 @@ nvinfer1::ICudaEngine *Yolo::createEngine (nvinfer1::IBuilder* builder)
std::cout << "\nNOTE: letter_box is set in cfg file, make sure to set maintain-aspect-ratio=1 in config_infer file to get better accuracy\n" << std::endl;
}
nvinfer1::IBuilderConfig *config = builder->createBuilderConfig();
if (m_NetworkMode == "INT8" && !fileExists(m_Int8CalibPath)) {
assert(builder->platformHasFastInt8());
#ifdef OPENCV
@@ -123,7 +121,6 @@ nvinfer1::ICudaEngine *Yolo::createEngine (nvinfer1::IBuilder* builder)
}
delete network;
delete config;
return engine;
}

View File

@@ -74,7 +74,7 @@ public:
}
NvDsInferStatus parseModel(nvinfer1::INetworkDefinition& network) override;
nvinfer1::ICudaEngine *createEngine (nvinfer1::IBuilder* builder);
nvinfer1::ICudaEngine *createEngine (nvinfer1::IBuilder* builder, nvinfer1::IBuilderConfig* config);
protected:
const std::string m_NetworkType;