For yolov4, you should follow the steps given here:
https://forums.developer.nvidia.com/t/deepstream-sdk-faq/80236/8. Convert your yolov4 to onnx and then use the onnx file to generate the trt model. Also update the cpp files as mentioned in the given steps. I’ve tested it to work well.