Deepstream 4.0 + custom yolo - building engine failed!

I trained custom yolov3 tiny and ran it with the calibration table that I created, and the following error.
I’m asking because it seems difficult to figure out exactly where the problem is.

Building the TensorRT Engine…
0:00:01.535917475 13324 0x7f1c002240 ERROR nvinfer gstnvinfer.cpp:511:gst_nvinfer_logger:<primary_gie_classifier> NvDsInferContext[UID 1]:log(): …/builder/cudnnBuilder2.cpp (1791) - Misc Error in createRegionScalesFromTensorScales: -1 (Could not find scales for tensor data.)
0:00:01.537343394 13324 0x7f1c002240 ERROR nvinfer gstnvinfer.cpp:511:gst_nvinfer_logger:<primary_gie_classifier> NvDsInferContext[UID 1]:log(): …/builder/cudnnBuilder2.cpp (1791) - Misc Error in createRegionScalesFromTensorScales: -1 (Could not find scales for tensor data.)
Building engine failed!
Failed to build cuda engine on yolov3-pelee-6cluster.cfg
0:00:01.538960170 13324 0x7f1c002240 ERROR nvinfer gstnvinfer.cpp:511:gst_nvinfer_logger:<primary_gie_classifier> NvDsInferContext[UID 1]:generateTRTModel(): Failed to create network using custom network creation function
0:00:01.539000940 13324 0x7f1c002240 ERROR nvinfer gstnvinfer.cpp:511:gst_nvinfer_logger:<primary_gie_classifier> NvDsInferContext[UID 1]:initialize(): Failed to create engine from model files
0:00:01.539308505 13324 0x7f1c002240 WARN nvinfer gstnvinfer.cpp:692:gst_nvinfer_start:<primary_gie_classifier> error: Failed to create NvDsInferContext instance
0:00:01.539357756 13324 0x7f1c002240 WARN nvinfer gstnvinfer.cpp:692:gst_nvinfer_start:<primary_gie_classifier> error: Config file path: /home/nota/Downloads/deepstream_sdk_v4.0.1_jetson/sources/objectDetector_Yolo/config_infer_primary_yoloV3_tiny.txt, NvDsInfer Error: NVDSINFER_CUSTOM_LIB_FAILED
** ERROR: main:651: Failed to set pipeline to PAUSED
Quitting
ERROR from primary_gie_classifier: Failed to create NvDsInferContext instance
Debug info: /dvs/git/dirty/git-master_linux/deepstream/sdk/src/gst-plugins/gst-nvinfer/gstnvinfer.cpp(692): gst_nvinfer_start (): /GstPipeline:pipeline/GstBin:primary_gie_bin/GstNvInfer:primary_gie_classifier:
Config file path: /home/nota/Downloads/deepstream_sdk_v4.0.1_jetson/sources/objectDetector_Yolo/config_infer_primary_yoloV3_tiny.txt, NvDsInfer Error: NVDSINFER_CUSTOM_LIB_FAILED
App run failed

could you export NVDSINFER_LOG_LEVEL=10 and share more logs?

/builder/cudnnBuilder2.cpp (1791) - Misc Error in createRegionScalesFromTensorScales: -1 (Could not find scales for tensor data.)

From above failure log, seems the calibration table does not match with your network, some layers failed to find the corresponding scale from the calibration table.
Could you elabrate how the calibration table was craeted ?

0:00:01.537343394 13324 0x7f1c002240 ERROR nvinfer gstnvinfer.cpp:511:gst_nvinfer_logger:<primary_gie_classifier> NvDsInferContext[UID 1]:log(): …/builder/cudnnBuilder2.cpp (1791) - Misc Error in createRegionScalesFromTensorScales: -1 (Could not find scales for tensor data.)
As the error message indicates, there are some missing scales in the calibration table. Since we are not providing a calibration tool with the SDK yet, so you need to make sure -
The network definition used for calibrating should be the exact same as the one we are using to build the yolo engine
The TRT version used to calibrate the model should be the same as the TRT version used for inference with DS.
To avoid these errors you need to implement these interfaces in the nvinfer plugin -

 int
    getBatchSize() const override
    {
        return 0;
    }
    bool
    getBatch(void* bindings[], const char* names[], int nbBindings) override
    {
        return false;
    }

And then calibration procedure can be done as a part of engine building process.