Understanding the population of input buffer and performing the inference

I am trying the use the imagenet-camera example from jetson inferece and modify it to work with my uff file. I was successfully able to load the model, parse it and created the engine and context object. The final task is to perform the inference.

The following is based on the script that I am attaching. My model have only two classes.

Things that I think i should do

  1. I need to convert (float*)imgRGBA to BGR format !! (not sure though how to do that because of mean subtraction or something like that I do not understand)
  2. I need to populate the buffer (which one and how ?) and then pass this buffer to
    context.enqueue(batch-size, buffer, stream, None) or context.execute(batch-size, buffer). What will the two return ?? The class of the classified object ( which i think it will ) or two numbers giving the probabilities of the two classes.

Can someone give a pseudo code or a sample code to do the following in 1,2.
camera.cpp (6.37 KB)


You can find some related resource in the jetson_inference directly:

  1. https://github.com/dusty-nv/jetson-utils/blob/2fb2b9dfd8323f99c22d3e2755b88345abd2f3a8/cuda/cudaRGB.cu
  2. This should not give too much difference. It only changes the output size.