diff --git a/docs/DAMOYOLO.md b/docs/DAMOYOLO.md index 919672d..e4fa6a2 100644 --- a/docs/DAMOYOLO.md +++ b/docs/DAMOYOLO.md @@ -43,30 +43,6 @@ Generate the ONNX model file (example for DAMO-YOLO-S*) python3 export_damoyolo.py -w damoyolo_tinynasL25_S_477.pth -c configs/damoyolo_tinynasL25_S.py --dynamic ``` -**NOTE**: To simplify the ONNX model (DeepStream >= 6) - -``` ---simplify -``` - -**NOTE**: To use dynamic batch-size (DeepStream >= 6) - -``` ---dynamic -``` - -**NOTE**: To use implicit batch-size (example for batch-size = 4) - -``` ---batch 4 -``` - -**NOTE**: If you are using DeepStream 5.1, remove the `--dynamic` arg and use opset 11 or lower. The default opset is 11. - -``` ---opset 11 -``` - **NOTE**: To change the inference size (defaut: 640) ``` @@ -88,6 +64,30 @@ or -s 1280 1280 ``` +**NOTE**: To simplify the ONNX model (DeepStream >= 6.0) + +``` +--simplify +``` + +**NOTE**: To use dynamic batch-size (DeepStream >= 6.1) + +``` +--dynamic +``` + +**NOTE**: To use implicit batch-size (example for batch-size = 4) + +``` +--batch 4 +``` + +**NOTE**: If you are using DeepStream 5.1, remove the `--dynamic` arg and use opset 11 or lower. The default opset is 11. + +``` +--opset 11 +``` + #### 5. Copy generated files Copy the generated ONNX model file and labels.txt file (if generated) to the `DeepStream-Yolo` folder. diff --git a/docs/PPYOLOE.md b/docs/PPYOLOE.md index 141db02..ce67980 100644 --- a/docs/PPYOLOE.md +++ b/docs/PPYOLOE.md @@ -41,13 +41,13 @@ pip3 install onnx onnxsim onnxruntime python3 export_ppyoloe.py -w ppyoloe_plus_crn_s_80e_coco.pdparams -c configs/ppyoloe/ppyoloe_plus_crn_s_80e_coco.yml --dynamic ``` -**NOTE**: To simplify the ONNX model (DeepStream >= 6) +**NOTE**: To simplify the ONNX model (DeepStream >= 6.0) ``` --simplify ``` -**NOTE**: To use dynamic batch-size (DeepStream >= 6) +**NOTE**: To use dynamic batch-size (DeepStream >= 6.1) ``` --dynamic diff --git a/docs/YOLONAS.md b/docs/YOLONAS.md index 2590ef5..ee027ac 100644 --- a/docs/YOLONAS.md +++ b/docs/YOLONAS.md @@ -46,30 +46,6 @@ Generate the ONNX model file (example for YOLO-NAS S) python3 export_yolonas.py -m yolo_nas_s -w yolo_nas_s_coco.pth --dynamic ``` -**NOTE**: To simplify the ONNX model (DeepStream >= 6) - -``` ---simplify -``` - -**NOTE**: To use dynamic batch-size (DeepStream >= 6) - -``` ---dynamic -``` - -**NOTE**: To use implicit batch-size (example for batch-size = 4) - -``` ---batch 4 -``` - -**NOTE**: If you are using DeepStream 5.1, remove the `--dynamic` arg and use opset 12 or lower. The default opset is 14. - -``` ---opset 12 -``` - **NOTE**: Model names ``` @@ -88,6 +64,18 @@ or -m yolo_nas_l ``` +**NOTE**: Number of classes (example for 80 classes) + +``` +-n 80 +``` + +or + +``` +--classes 80 +``` + **NOTE**: To change the inference size (defaut: 640) ``` @@ -109,6 +97,30 @@ or -s 1280 1280 ``` +**NOTE**: To simplify the ONNX model (DeepStream >= 6.0) + +``` +--simplify +``` + +**NOTE**: To use dynamic batch-size (DeepStream >= 6.1) + +``` +--dynamic +``` + +**NOTE**: To use implicit batch-size (example for batch-size = 4) + +``` +--batch 4 +``` + +**NOTE**: If you are using DeepStream 5.1, remove the `--dynamic` arg and use opset 12 or lower. The default opset is 14. + +``` +--opset 12 +``` + #### 5. Copy generated file Copy the generated ONNX model file to the `DeepStream-Yolo` folder. diff --git a/docs/YOLOR.md b/docs/YOLOR.md index 7104a9e..c784f3b 100644 --- a/docs/YOLOR.md +++ b/docs/YOLOR.md @@ -55,37 +55,13 @@ Generate the ONNX model file python3 export_yolor.py -w yolor-p6.pt --dynamic ``` -**NOTE**: To simplify the ONNX model (DeepStream >= 6) - -``` ---simplify -``` - -**NOTE**: To use dynamic batch-size (DeepStream >= 6) - -``` ---dynamic -``` - -**NOTE**: To use implicit batch-size (example for batch-size = 4) - -``` ---batch 4 -``` - -**NOTE**: If you are using DeepStream 5.1, remove the `--dynamic` arg and use opset 12 or lower. The default opset is 12. - -``` ---opset 12 -``` - **NOTE**: To convert a P6 model ``` --p6 ``` -**NOTE**: To change the inference size (defaut: 640) +**NOTE**: To change the inference size (defaut: 640 / 1280 for `--p6` models) ``` -s SIZE @@ -106,6 +82,30 @@ or -s 1280 1280 ``` +**NOTE**: To simplify the ONNX model (DeepStream >= 6.0) + +``` +--simplify +``` + +**NOTE**: To use dynamic batch-size (DeepStream >= 6.1) + +``` +--dynamic +``` + +**NOTE**: To use implicit batch-size (example for batch-size = 4) + +``` +--batch 4 +``` + +**NOTE**: If you are using DeepStream 5.1, remove the `--dynamic` arg and use opset 12 or lower. The default opset is 12. + +``` +--opset 12 +``` + #### 5. Copy generated files Copy the generated ONNX model file and labels.txt file (if generated) to the `DeepStream-Yolo` folder diff --git a/docs/YOLOX.md b/docs/YOLOX.md index 477279b..bb7a819 100644 --- a/docs/YOLOX.md +++ b/docs/YOLOX.md @@ -46,13 +46,13 @@ Generate the ONNX model file (example for YOLOX-s) python3 export_yolox.py -w yolox_s.pth -c exps/default/yolox_s.py --dynamic ``` -**NOTE**: To simplify the ONNX model (DeepStream >= 6) +**NOTE**: To simplify the ONNX model (DeepStream >= 6.0) ``` --simplify ``` -**NOTE**: To use dynamic batch-size (DeepStream >= 6) +**NOTE**: To use dynamic batch-size (DeepStream >= 6.1) ``` --dynamic diff --git a/docs/YOLOv5.md b/docs/YOLOv5.md index f1034c8..e5e0171 100644 --- a/docs/YOLOv5.md +++ b/docs/YOLOv5.md @@ -47,37 +47,13 @@ Generate the ONNX model file (example for YOLOv5s) python3 export_yoloV5.py -w yolov5s.pt --dynamic ``` -**NOTE**: To simplify the ONNX model (DeepStream >= 6) - -``` ---simplify -``` - -**NOTE**: To use dynamic batch-size (DeepStream >= 6) - -``` ---dynamic -``` - -**NOTE**: To use implicit batch-size (example for batch-size = 4) - -``` ---batch 4 -``` - -**NOTE**: If you are using DeepStream 5.1, remove the `--dynamic` arg and use opset 12 or lower. The default opset is 17. - -``` ---opset 12 -``` - **NOTE**: To convert a P6 model ``` --p6 ``` -**NOTE**: To change the inference size (defaut: 640) +**NOTE**: To change the inference size (defaut: 640 / 1280 for `--p6` models) ``` -s SIZE @@ -98,6 +74,30 @@ or -s 1280 1280 ``` +**NOTE**: To simplify the ONNX model (DeepStream >= 6.0) + +``` +--simplify +``` + +**NOTE**: To use dynamic batch-size (DeepStream >= 6.1) + +``` +--dynamic +``` + +**NOTE**: To use implicit batch-size (example for batch-size = 4) + +``` +--batch 4 +``` + +**NOTE**: If you are using DeepStream 5.1, remove the `--dynamic` arg and use opset 12 or lower. The default opset is 17. + +``` +--opset 12 +``` + #### 5. Copy generated files Copy the generated ONNX model file and labels.txt file (if generated) to the `DeepStream-Yolo` folder. diff --git a/docs/YOLOv6.md b/docs/YOLOv6.md index a1b3cb4..3ea2e6a 100644 --- a/docs/YOLOv6.md +++ b/docs/YOLOv6.md @@ -47,37 +47,13 @@ Generate the ONNX model file (example for YOLOv6-S 4.0) python3 export_yoloV6.py -w yolov6s.pt --dynamic ``` -**NOTE**: To simplify the ONNX model (DeepStream >= 6) - -``` ---simplify -``` - -**NOTE**: To use dynamic batch-size (DeepStream >= 6) - -``` ---dynamic -``` - -**NOTE**: To use implicit batch-size (example for batch-size = 4) - -``` ---batch 4 -``` - -**NOTE**: If you are using DeepStream 5.1, remove the `--dynamic` arg and use opset 12 or lower. The default opset is 13. - -``` ---opset 12 -``` - **NOTE**: To convert a P6 model ``` --p6 ``` -**NOTE**: To change the inference size (defaut: 640) +**NOTE**: To change the inference size (defaut: 640 / 1280 for `--p6` models) ``` -s SIZE @@ -98,6 +74,30 @@ or -s 1280 1280 ``` +**NOTE**: To simplify the ONNX model (DeepStream >= 6.0) + +``` +--simplify +``` + +**NOTE**: To use dynamic batch-size (DeepStream >= 6.1) + +``` +--dynamic +``` + +**NOTE**: To use implicit batch-size (example for batch-size = 4) + +``` +--batch 4 +``` + +**NOTE**: If you are using DeepStream 5.1, remove the `--dynamic` arg and use opset 12 or lower. The default opset is 13. + +``` +--opset 12 +``` + #### 5. Copy generated file Copy the generated ONNX model file to the `DeepStream-Yolo` folder. diff --git a/docs/YOLOv7.md b/docs/YOLOv7.md index ad5b436..777e1f2 100644 --- a/docs/YOLOv7.md +++ b/docs/YOLOv7.md @@ -49,37 +49,13 @@ Generate the ONNX model file (example for YOLOv7) python3 export_yoloV7.py -w yolov7.pt --dynamic ``` -**NOTE**: To simplify the ONNX model (DeepStream >= 6) - -``` ---simplify -``` - -**NOTE**: To use dynamic batch-size (DeepStream >= 6) - -``` ---dynamic -``` - -**NOTE**: To use implicit batch-size (example for batch-size = 4) - -``` ---batch 4 -``` - -**NOTE**: If you are using DeepStream 5.1, remove the `--dynamic` arg and use opset 12 or lower. The default opset is 12. - -``` ---opset 12 -``` - **NOTE**: To convert a P6 model ``` --p6 ``` -**NOTE**: To change the inference size (defaut: 640) +**NOTE**: To change the inference size (defaut: 640 / 1280 for `--p6` models) ``` -s SIZE @@ -100,6 +76,30 @@ or -s 1280 1280 ``` +**NOTE**: To simplify the ONNX model (DeepStream >= 6.0) + +``` +--simplify +``` + +**NOTE**: To use dynamic batch-size (DeepStream >= 6.1) + +``` +--dynamic +``` + +**NOTE**: To use implicit batch-size (example for batch-size = 4) + +``` +--batch 4 +``` + +**NOTE**: If you are using DeepStream 5.1, remove the `--dynamic` arg and use opset 12 or lower. The default opset is 12. + +``` +--opset 12 +``` + #### 6. Copy generated files Copy the generated ONNX model file and labels.txt file (if generated) to the `DeepStream-Yolo` folder. diff --git a/docs/YOLOv8.md b/docs/YOLOv8.md index 5131a0c..0467fc0 100644 --- a/docs/YOLOv8.md +++ b/docs/YOLOv8.md @@ -46,30 +46,6 @@ Generate the ONNX model file (example for YOLOv8s) python3 export_yoloV8.py -w yolov8s.pt --dynamic ``` -**NOTE**: To simplify the ONNX model (DeepStream >= 6) - -``` ---simplify -``` - -**NOTE**: To use dynamic batch-size (DeepStream >= 6) - -``` ---dynamic -``` - -**NOTE**: To use implicit batch-size (example for batch-size = 4) - -``` ---batch 4 -``` - -**NOTE**: If you are using DeepStream 5.1, remove the `--dynamic` arg and use opset 12 or lower. The default opset is 16. - -``` ---opset 12 -``` - **NOTE**: To change the inference size (defaut: 640) ``` @@ -91,6 +67,30 @@ or -s 1280 1280 ``` +**NOTE**: To simplify the ONNX model (DeepStream >= 6.0) + +``` +--simplify +``` + +**NOTE**: To use dynamic batch-size (DeepStream >= 6.1) + +``` +--dynamic +``` + +**NOTE**: To use implicit batch-size (example for batch-size = 4) + +``` +--batch 4 +``` + +**NOTE**: If you are using DeepStream 5.1, remove the `--dynamic` arg and use opset 12 or lower. The default opset is 16. + +``` +--opset 12 +``` + #### 5. Copy generated files Copy the generated ONNX model file and labels.txt file (if generated) to the `DeepStream-Yolo` folder. diff --git a/nvdsinfer_custom_impl_Yolo/nvdsparsebbox_Yolo.cpp b/nvdsinfer_custom_impl_Yolo/nvdsparsebbox_Yolo.cpp index 21308b8..5fc548d 100644 --- a/nvdsinfer_custom_impl_Yolo/nvdsparsebbox_Yolo.cpp +++ b/nvdsinfer_custom_impl_Yolo/nvdsparsebbox_Yolo.cpp @@ -73,14 +73,14 @@ addBBoxProposal(const float bx1, const float by1, const float bx2, const float b } static std::vector -decodeTensorYolo(const float* boxes, const float* scores, const int* classes, const uint& outputSize, const uint& netW, +decodeTensorYolo(const float* boxes, const float* scores, const float* classes, const uint& outputSize, const uint& netW, const uint& netH, const std::vector& preclusterThreshold) { std::vector binfo; for (uint b = 0; b < outputSize; ++b) { float maxProb = scores[b]; - int maxIndex = classes[b]; + int maxIndex = (int) classes[b]; if (maxProb < preclusterThreshold[maxIndex]) continue; @@ -102,14 +102,14 @@ decodeTensorYolo(const float* boxes, const float* scores, const int* classes, co } static std::vector -decodeTensorYoloE(const float* boxes, const float* scores, const int* classes, const uint& outputSize, const uint& netW, +decodeTensorYoloE(const float* boxes, const float* scores, const float* classes, const uint& outputSize, const uint& netW, const uint& netH, const std::vector& preclusterThreshold) { std::vector binfo; for (uint b = 0; b < outputSize; ++b) { float maxProb = scores[b]; - int maxIndex = classes[b]; + int maxIndex = (int) classes[b]; if (maxProb < preclusterThreshold[maxIndex]) continue; @@ -136,26 +136,14 @@ NvDsInferParseCustomYolo(std::vector const& outputLayersInfo std::vector objects; - NvDsInferLayerInfo* boxes; - NvDsInferLayerInfo* scores; - NvDsInferLayerInfo* classes; + const NvDsInferLayerInfo& boxes = outputLayersInfo[0]; + const NvDsInferLayerInfo& scores = outputLayersInfo[1]; + const NvDsInferLayerInfo& classes = outputLayersInfo[2]; - for (uint i = 0; i < 3; ++i) { - if (outputLayersInfo[i].dataType == NvDsInferDataType::INT32) { - classes = (NvDsInferLayerInfo*) &outputLayersInfo[i]; - } - else if (outputLayersInfo[i].inferDims.d[1] == 4) { - boxes = (NvDsInferLayerInfo*) &outputLayersInfo[i]; - } - else { - scores = (NvDsInferLayerInfo*) &outputLayersInfo[i]; - } - } + const uint outputSize = boxes.inferDims.d[0]; - const uint outputSize = boxes->inferDims.d[0]; - - std::vector outObjs = decodeTensorYolo((const float*) (boxes->buffer), - (const float*) (scores->buffer), (const int*) (classes->buffer), outputSize, networkInfo.width, networkInfo.height, + std::vector outObjs = decodeTensorYolo((const float*) (boxes.buffer), + (const float*) (scores.buffer), (const float*) (classes.buffer), outputSize, networkInfo.width, networkInfo.height, detectionParams.perClassPreclusterThreshold); objects.insert(objects.end(), outObjs.begin(), outObjs.end()); @@ -176,26 +164,14 @@ NvDsInferParseCustomYoloE(std::vector const& outputLayersInf std::vector objects; - NvDsInferLayerInfo* boxes; - NvDsInferLayerInfo* scores; - NvDsInferLayerInfo* classes; + const NvDsInferLayerInfo& boxes = outputLayersInfo[0]; + const NvDsInferLayerInfo& scores = outputLayersInfo[1]; + const NvDsInferLayerInfo& classes = outputLayersInfo[2]; - for (uint i = 0; i < 3; ++i) { - if (outputLayersInfo[i].dataType == NvDsInferDataType::INT32) { - classes = (NvDsInferLayerInfo*) &outputLayersInfo[i]; - } - else if (outputLayersInfo[i].inferDims.d[1] == 4) { - boxes = (NvDsInferLayerInfo*) &outputLayersInfo[i]; - } - else { - scores = (NvDsInferLayerInfo*) &outputLayersInfo[i]; - } - } + const uint outputSize = boxes.inferDims.d[0]; - const uint outputSize = boxes->inferDims.d[0]; - - std::vector outObjs = decodeTensorYoloE((const float*) (boxes->buffer), - (const float*) (scores->buffer), (const int*) (classes->buffer), outputSize, networkInfo.width, networkInfo.height, + std::vector outObjs = decodeTensorYoloE((const float*) (boxes.buffer), + (const float*) (scores.buffer), (const float*) (classes.buffer), outputSize, networkInfo.width, networkInfo.height, detectionParams.perClassPreclusterThreshold); objects.insert(objects.end(), outObjs.begin(), outObjs.end()); diff --git a/nvdsinfer_custom_impl_Yolo/nvdsparsebbox_Yolo_cuda.cu b/nvdsinfer_custom_impl_Yolo/nvdsparsebbox_Yolo_cuda.cu index ab07d65..8414245 100644 --- a/nvdsinfer_custom_impl_Yolo/nvdsparsebbox_Yolo_cuda.cu +++ b/nvdsinfer_custom_impl_Yolo/nvdsparsebbox_Yolo_cuda.cu @@ -37,7 +37,7 @@ extern "C" bool NvDsInferParseYoloECuda(std::vector const& outputLayersInfo, NvDsInferNetworkInfo const& networkInfo, NvDsInferParseDetectionParams const& detectionParams, std::vector& objectList); -__global__ void decodeTensorYoloCuda(NvDsInferParseObjectInfo *binfo, float* boxes, float* scores, int* classes, +__global__ void decodeTensorYoloCuda(NvDsInferParseObjectInfo *binfo, float* boxes, float* scores, float* classes, int outputSize, int netW, int netH, float minPreclusterThreshold) { int x_id = blockIdx.x * blockDim.x + threadIdx.x; @@ -46,7 +46,7 @@ __global__ void decodeTensorYoloCuda(NvDsInferParseObjectInfo *binfo, float* box return; float maxProb = scores[x_id]; - int maxIndex = classes[x_id]; + int maxIndex = (int) classes[x_id]; if (maxProb < minPreclusterThreshold) { binfo[x_id].detectionConfidence = 0.0; @@ -76,7 +76,7 @@ __global__ void decodeTensorYoloCuda(NvDsInferParseObjectInfo *binfo, float* box binfo[x_id].classId = maxIndex; } -__global__ void decodeTensorYoloECuda(NvDsInferParseObjectInfo *binfo, float* boxes, float* scores, int* classes, +__global__ void decodeTensorYoloECuda(NvDsInferParseObjectInfo *binfo, float* boxes, float* scores, float* classes, int outputSize, int netW, int netH, float minPreclusterThreshold) { int x_id = blockIdx.x * blockDim.x + threadIdx.x; @@ -85,7 +85,7 @@ __global__ void decodeTensorYoloECuda(NvDsInferParseObjectInfo *binfo, float* bo return; float maxProb = scores[x_id]; - int maxIndex = classes[x_id]; + int maxIndex = (int) classes[x_id]; if (maxProb < minPreclusterThreshold) { binfo[x_id].detectionConfidence = 0.0; @@ -119,23 +119,11 @@ static bool NvDsInferParseCustomYoloCuda(std::vector const& return false; } - NvDsInferLayerInfo* boxes; - NvDsInferLayerInfo* scores; - NvDsInferLayerInfo* classes; + const NvDsInferLayerInfo& boxes = outputLayersInfo[0]; + const NvDsInferLayerInfo& scores = outputLayersInfo[1]; + const NvDsInferLayerInfo& classes = outputLayersInfo[2]; - for (uint i = 0; i < 3; ++i) { - if (outputLayersInfo[i].dataType == NvDsInferDataType::INT32) { - classes = (NvDsInferLayerInfo*) &outputLayersInfo[i]; - } - else if (outputLayersInfo[i].inferDims.d[1] == 4) { - boxes = (NvDsInferLayerInfo*) &outputLayersInfo[i]; - } - else { - scores = (NvDsInferLayerInfo*) &outputLayersInfo[i]; - } - } - - const int outputSize = boxes->inferDims.d[0]; + const int outputSize = boxes.inferDims.d[0]; thrust::device_vector objects(outputSize); @@ -146,8 +134,8 @@ static bool NvDsInferParseCustomYoloCuda(std::vector const& int number_of_blocks = ((outputSize - 1) / threads_per_block) + 1; decodeTensorYoloCuda<<>>( - thrust::raw_pointer_cast(objects.data()), (float*) (boxes->buffer), (float*) (scores->buffer), - (int*) (classes->buffer), outputSize, networkInfo.width, networkInfo.height, minPreclusterThreshold); + thrust::raw_pointer_cast(objects.data()), (float*) (boxes.buffer), (float*) (scores.buffer), + (float*) (classes.buffer), outputSize, networkInfo.width, networkInfo.height, minPreclusterThreshold); objectList.resize(outputSize); thrust::copy(objects.begin(), objects.end(), objectList.begin()); @@ -164,23 +152,11 @@ static bool NvDsInferParseCustomYoloECuda(std::vector const& return false; } - NvDsInferLayerInfo* boxes; - NvDsInferLayerInfo* scores; - NvDsInferLayerInfo* classes; + const NvDsInferLayerInfo& boxes = outputLayersInfo[0]; + const NvDsInferLayerInfo& scores = outputLayersInfo[1]; + const NvDsInferLayerInfo& classes = outputLayersInfo[2]; - for (uint i = 0; i < 3; ++i) { - if (outputLayersInfo[i].dataType == NvDsInferDataType::INT32) { - classes = (NvDsInferLayerInfo*) &outputLayersInfo[i]; - } - else if (outputLayersInfo[i].inferDims.d[1] == 4) { - boxes = (NvDsInferLayerInfo*) &outputLayersInfo[i]; - } - else { - scores = (NvDsInferLayerInfo*) &outputLayersInfo[i]; - } - } - - const int outputSize = boxes->inferDims.d[0]; + const int outputSize = boxes.inferDims.d[0]; thrust::device_vector objects(outputSize); @@ -191,8 +167,8 @@ static bool NvDsInferParseCustomYoloECuda(std::vector const& int number_of_blocks = ((outputSize - 1) / threads_per_block) + 1; decodeTensorYoloECuda<<>>( - thrust::raw_pointer_cast(objects.data()), (float*) (boxes->buffer), (float*) (scores->buffer), - (int*) (classes->buffer), outputSize, networkInfo.width, networkInfo.height, minPreclusterThreshold); + thrust::raw_pointer_cast(objects.data()), (float*) (boxes.buffer), (float*) (scores.buffer), + (float*) (classes.buffer), outputSize, networkInfo.width, networkInfo.height, minPreclusterThreshold); objectList.resize(outputSize); thrust::copy(objects.begin(), objects.end(), objectList.begin()); diff --git a/nvdsinfer_custom_impl_Yolo/yolo.cpp b/nvdsinfer_custom_impl_Yolo/yolo.cpp index eaded9f..f72c1ac 100644 --- a/nvdsinfer_custom_impl_Yolo/yolo.cpp +++ b/nvdsinfer_custom_impl_Yolo/yolo.cpp @@ -76,7 +76,7 @@ Yolo::createEngine(nvinfer1::IBuilder* builder) if (m_NetworkType == "onnx") { -#if NV_TENSORRT_MAJOR >= 8 +#if NV_TENSORRT_MAJOR >= 8 && NV_TENSORRT_MINOR > 0 parser = nvonnxparser::createParser(*network, *builder->getLogger()); #else parser = nvonnxparser::createParser(*network, logger); diff --git a/nvdsinfer_custom_impl_Yolo/yolo.h b/nvdsinfer_custom_impl_Yolo/yolo.h index b794015..e61484c 100644 --- a/nvdsinfer_custom_impl_Yolo/yolo.h +++ b/nvdsinfer_custom_impl_Yolo/yolo.h @@ -45,7 +45,9 @@ #define INT int32_t #else #define INT int +#endif +#if NV_TENSORRT_MAJOR < 8 || (NV_TENSORRT_MAJOR == 8 && NV_TENSORRT_MINOR == 0) static class Logger : public nvinfer1::ILogger { void log(nvinfer1::ILogger::Severity severity, const char* msg) noexcept override { if (severity <= nvinfer1::ILogger::Severity::kWARNING) diff --git a/utils/export_damoyolo.py b/utils/export_damoyolo.py index 1735df8..5bc26a6 100644 --- a/utils/export_damoyolo.py +++ b/utils/export_damoyolo.py @@ -18,6 +18,7 @@ class DeepStreamOutput(nn.Module): def forward(self, x): boxes = x[1] scores, classes = torch.max(x[0], 2, keepdim=True) + classes = classes.float() return boxes, scores, classes diff --git a/utils/export_ppyoloe.py b/utils/export_ppyoloe.py index eee6236..d8c065a 100644 --- a/utils/export_ppyoloe.py +++ b/utils/export_ppyoloe.py @@ -19,7 +19,7 @@ class DeepStreamOutput(nn.Layer): boxes = x['bbox'] x['bbox_num'] = x['bbox_num'].transpose([0, 2, 1]) scores = paddle.max(x['bbox_num'], 2, keepdim=True) - classes = paddle.argmax(x['bbox_num'], 2, keepdim=True) + classes = paddle.cast(paddle.argmax(x['bbox_num'], 2, keepdim=True), dtype='float32') return boxes, scores, classes diff --git a/utils/export_yoloV5.py b/utils/export_yoloV5.py index 6d1d345..f752b97 100644 --- a/utils/export_yoloV5.py +++ b/utils/export_yoloV5.py @@ -20,6 +20,7 @@ class DeepStreamOutput(nn.Module): objectness = x[:, :, 4:5] scores, classes = torch.max(x[:, :, 5:], 2, keepdim=True) scores *= objectness + classes = classes.float() return boxes, scores, classes diff --git a/utils/export_yoloV6.py b/utils/export_yoloV6.py index 22950f2..912a4fe 100644 --- a/utils/export_yoloV6.py +++ b/utils/export_yoloV6.py @@ -24,6 +24,7 @@ class DeepStreamOutput(nn.Module): objectness = x[:, :, 4:5] scores, classes = torch.max(x[:, :, 5:], 2, keepdim=True) scores *= objectness + classes = classes.float() return boxes, scores, classes diff --git a/utils/export_yoloV7.py b/utils/export_yoloV7.py index 24affb2..718c762 100644 --- a/utils/export_yoloV7.py +++ b/utils/export_yoloV7.py @@ -20,6 +20,7 @@ class DeepStreamOutput(nn.Module): objectness = x[:, :, 4:5] scores, classes = torch.max(x[:, :, 5:], 2, keepdim=True) scores *= objectness + classes = classes.float() return boxes, scores, classes diff --git a/utils/export_yoloV7_u6.py b/utils/export_yoloV7_u6.py index e8a4849..25f34ca 100644 --- a/utils/export_yoloV7_u6.py +++ b/utils/export_yoloV7_u6.py @@ -18,6 +18,7 @@ class DeepStreamOutput(nn.Module): x = x.transpose(1, 2) boxes = x[:, :, :4] scores, classes = torch.max(x[:, :, 4:], 2, keepdim=True) + classes = classes.float() return boxes, scores, classes diff --git a/utils/export_yoloV8.py b/utils/export_yoloV8.py index 757b524..006c24d 100644 --- a/utils/export_yoloV8.py +++ b/utils/export_yoloV8.py @@ -19,6 +19,7 @@ class DeepStreamOutput(nn.Module): x = x.transpose(1, 2) boxes = x[:, :, :4] scores, classes = torch.max(x[:, :, 4:], 2, keepdim=True) + classes = classes.float() return boxes, scores, classes diff --git a/utils/export_yolonas.py b/utils/export_yolonas.py index 327443a..71356f2 100644 --- a/utils/export_yolonas.py +++ b/utils/export_yolonas.py @@ -15,6 +15,7 @@ class DeepStreamOutput(nn.Module): def forward(self, x): boxes = x[0] scores, classes = torch.max(x[1], 2, keepdim=True) + classes = classes.float() return boxes, scores, classes diff --git a/utils/export_yolor.py b/utils/export_yolor.py index aa5785f..9a4fad2 100644 --- a/utils/export_yolor.py +++ b/utils/export_yolor.py @@ -17,6 +17,7 @@ class DeepStreamOutput(nn.Module): objectness = x[:, :, 4:5] scores, classes = torch.max(x[:, :, 5:], 2, keepdim=True) scores *= objectness + classes = classes.float() return boxes, scores, classes diff --git a/utils/export_yolox.py b/utils/export_yolox.py index 2f3d441..8426381 100644 --- a/utils/export_yolox.py +++ b/utils/export_yolox.py @@ -19,6 +19,7 @@ class DeepStreamOutput(nn.Module): objectness = x[:, :, 4:5] scores, classes = torch.max(x[:, :, 5:], 2, keepdim=True) scores *= objectness + classes = classes.float() return boxes, scores, classes