Add DeepStream 5.1 support
This commit is contained in:
@@ -33,6 +33,11 @@ ifeq ($(OPENCV),)
|
||||
OPENCV=0
|
||||
endif
|
||||
|
||||
LEGACY?=
|
||||
ifeq ($(LEGACY),)
|
||||
LEGACY=0
|
||||
endif
|
||||
|
||||
CC:= g++
|
||||
NVCC:=/usr/local/cuda-$(CUDA_VER)/bin/nvcc
|
||||
|
||||
@@ -40,11 +45,15 @@ CFLAGS:= -Wall -std=c++11 -shared -fPIC -Wno-error=deprecated-declarations
|
||||
CFLAGS+= -I/opt/nvidia/deepstream/deepstream/sources/includes -I/usr/local/cuda-$(CUDA_VER)/include
|
||||
|
||||
ifeq ($(OPENCV), 1)
|
||||
COMMON= -DOPENCV
|
||||
COMMON+= -DOPENCV
|
||||
CFLAGS+= $(shell pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv)
|
||||
LIBS+= $(shell pkg-config --libs opencv4 2> /dev/null || pkg-config --libs opencv)
|
||||
endif
|
||||
|
||||
ifeq ($(LEGACY), 1)
|
||||
COMMON+= -DLEGACY
|
||||
endif
|
||||
|
||||
CUFLAGS:= -I/opt/nvidia/deepstream/deepstream/sources/includes -I/usr/local/cuda-$(CUDA_VER)/include
|
||||
|
||||
LIBS+= -lnvinfer_plugin -lnvinfer -lnvparsers -L/usr/local/cuda-$(CUDA_VER)/lib64 -lcudart -lcublas -lstdc++fs
|
||||
|
||||
@@ -54,7 +54,13 @@ Yolo::createEngine(nvinfer1::IBuilder* builder, nvinfer1::IBuilderConfig* config
|
||||
|
||||
nvinfer1::INetworkDefinition *network = builder->createNetworkV2(0);
|
||||
if (parseModel(*network) != NVDSINFER_SUCCESS) {
|
||||
|
||||
#ifdef LEGACY
|
||||
network->destroy();
|
||||
#else
|
||||
delete network;
|
||||
#endif
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -105,7 +111,12 @@ Yolo::createEngine(nvinfer1::IBuilder* builder, nvinfer1::IBuilderConfig* config
|
||||
else
|
||||
std::cerr << "Building engine failed\n" << std::endl;
|
||||
|
||||
delete network;
|
||||
#ifdef LEGACY
|
||||
network->destroy();
|
||||
#else
|
||||
delete network;
|
||||
#endif
|
||||
|
||||
return engine;
|
||||
}
|
||||
|
||||
|
||||
@@ -120,9 +120,14 @@ YoloLayer::configureWithFormat(const nvinfer1::Dims* inputDims, int nbInputs, co
|
||||
assert(inputDims != nullptr);
|
||||
}
|
||||
|
||||
#ifdef LEGACY
|
||||
int
|
||||
YoloLayer::enqueue(int batchSize, const void* const* inputs, void** outputs, void* workspace, cudaStream_t stream)
|
||||
#else
|
||||
int32_t
|
||||
YoloLayer::enqueue(int batchSize, void const* const* inputs, void* const* outputs, void* workspace, cudaStream_t stream)
|
||||
noexcept
|
||||
#endif
|
||||
{
|
||||
void* output = outputs[0];
|
||||
CUDA_CHECK(cudaMemsetAsync((float*) output, 0, sizeof(float) * m_OutputSize * 6 * batchSize, stream));
|
||||
|
||||
@@ -71,8 +71,12 @@ class YoloLayer : public nvinfer1::IPluginV2 {
|
||||
return maxBatchSize * sizeof(int);
|
||||
}
|
||||
|
||||
#ifdef LEGACY
|
||||
int enqueue(int batchSize, const void* const* inputs, void** outputs, void* workspace, cudaStream_t stream) override;
|
||||
#else
|
||||
int32_t enqueue(int batchSize, void const* const* inputs, void* const* outputs, void* workspace, cudaStream_t stream)
|
||||
noexcept override;
|
||||
#endif
|
||||
|
||||
size_t getSerializationSize() const noexcept override;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user