Dnn problem on px2

Hi everyone,

For a project I want to build an application for the PX 2 using my own neural network.
The network needs two inputs, for example, one input is 224x224x3 and the other is 227x227x3.

The sample in guide only provides the sample with one image or with a batch of images as input. The network still has only one input.

My problem is that how to initialize my network with two network inputs in one time.

Happy for any suggestions!Thanks~

Dear wh120355,
Could you confirm if you are able to get tensorrt engine file for your network using Tensorrt_optimization tool

Hi SivaRamaKrishna,

Yes, I can get the bin file using Tensorrt_optimization tool(2 inputs and 3 outputs in the network). I find the driveworks api provide the function to count the number of inputs, but there is no guide for using multiple inputs with different size.

Please let me know if you need any further information, thanks!

Dear wh120355,
I can see from DW 1.2 documentation, The dwDNN_infer function can accept multiple inputs. You need to allocate multi pointer input array and copy the corresponding data onto GPU input buffers similar to how output buffers are handled in the sample. I am giving a code snippet in sample_object_detector for your understanding

float32_t *m_dnnInputDevice[2]
dwBlobSize m_networkInputDimensions[2]
uint32_t m_totalSizeInput[2]

m_totalSizeInput[0] = getTotalSize(m_networkInputDimensions[0])
m_totalSizeInput[1] = getTotalSize(m_networkInputDimensions[1])

CHECK_CUDA_ERROR(cudaMalloc((void **)&m_dnnInputDevice[0],sizeof(float32_t) * m_totalSizeInput[0])
CHECK_CUDA_ERROR(cudaMalloc((void **)&m_dnnInputDevice[1],sizeof(float32_t) * m_totalSizeInput[1])

// fill the GPU buffers m_dnnInputDevice[0], m_dnnInputDevice[1] as per your network. You may use cudaMemcpy function

dwDNN_Infer(..,m_DNNInputDevice,m_dnn)

Dear SivaRamaKrishna,
Thanks for your code. I have tried to write a similar code before, and succeed to allocate the array. But it doesn’t work.

For DNN pipeline, the input data should be prepared by the data conditioner module. The sample only tells how to prepare the data when the network needs one input, using “dwDataConditioner_prepareData()”.

Can you help me with these part of code for preparing the data? In my project, two inputs have different sizes. I will get two dwDataConditioner and the data will be prepared twice. Is it right?

Yes.

Thanks!!