Scaling in nvinfer

Please provide complete information as applicable to your setup.
I am working on A10 GPU and using deepstream 6.3 for my work.
I saw the gstreamer plugin gst-nvinfer and want to check if NvBufSurfTransformAsync function with transform params is responsible for scaling the frame.If not then which function ?
if yes then how to get source code for NvBufSurfTransformAsync as it doesn’t have any source code inside deepstream sdk?

NvBufSurfTransformAsync is currently not open source.

It is some code related to cuda and vic drivers

Thanks for the reply. Is there an alternative open source function to the NvBufSurfTransformAsync which can be used for scaling and cropping purpose as is done by this function?

I don’t know if there is an open source alternative.

What is your goal?might be able to give you some other suggestions.

If you just want scaling and cropping, you can refer to the NvBufSurfTransform API documentation.

Or implement the CUDA kernel function yourself

Thanks for the reply. Actually while training we are using custom pre-processing where we implement opencv bilinear filter for scaling but it looks like the nvinfer output and our output don’t match.

Do you have problems with model accuracy?

Can you share sample code and model for us to analyze?

Yes, we have problems with model accuracy. We use a YOLOv4 based model trained with samples resized using OpenCV INTER_AREA and are seeing upto a 20% deviation in accuracy with the resize functions (Both [NvBufSurfTransformInter_Nearest] and [NvBufSurfTransformInter_Bilinear]). We are looking for solutions that can avoid model retraining for this problem.

Do you mean that after the model is deployed, regardless of whether the scaling-filter is set to NvBufSurfTransformInter_Nearest or NvBufSurfTransformInter_Bilinear, the accuracy of the model will decrease significantly?

Can you share the configuration files and models?

There is no update from you for a period, assuming this is not an issue anymore.
Hence we are closing this topic. If need further support, please open a new one.

As a suggestion, you can use the nvdspreprocess plugin and add a cuda kernel compatible with OpenCV INTER_AREA in This avoids the difference caused by nvinfer scaling

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.