HWC to CHW conversion of image in driveworks

Please provide the following info (check/uncheck the boxes after creating this topic):
Software Version
DRIVE OS Linux 5.2.6
[+] DRIVE OS Linux 5.2.6 and DriveWorks 4.0
DRIVE OS Linux 5.2.0
DRIVE OS Linux 5.2.0 and DriveWorks 3.5
NVIDIA DRIVE™ Software 10.0 (Linux)
NVIDIA DRIVE™ Software 9.0 (Linux)
other DRIVE OS version
other

Target Operating System
[+] Linux
QNX
other

Hardware Platform
[+] NVIDIA DRIVE™ AGX Xavier DevKit (E3550)
NVIDIA DRIVE™ AGX Pegasus DevKit (E3550)
other

SDK Manager Version
[+] 1.8.0.10363
other

Host Machine Version
[+] native Ubuntu 18.04
other

Hi team,

I am trying to implement yolov3 algorithm tensorrt sample in object detection and tracking sample.

Could you please let me know how to convert the image from HWC to CHW format? I have referred the below link

and upon referring DriveWorks SDK Reference: Image


Does that mean if image format PIXELORDER is PLANAR the output will be CHW ?
Is there any method by which I can convert the HWC image to CHW?

Dear @nithin.m1,
Planar means, each channel will have a seperate array buffer (like sepearte R,G,B buffers).
Is there any method by which I can convert the HWC image to CHW?

There are no DW APIs. BTW I see, the output blobs of yolov3 model lokks like NCHW. Am I missing anything?

Hi @SivaRamaKrishnaNV,

Thanks for the reply,

Yes yolov3 output is NCHW format. input to network also in NCHW (say 3x608x608) format. For that the input image to be converted from HWC to CHW format right? I was wondering if it can be done in driveworks by any means?

Dear @nithin.m1,
You have to preprocess the input image buffer. Data conditioner module can not change HWC <-> CHW.

Hi @SivaRamaKrishnaNV ,

can we access those R,G,B buffers in drvieworks?

thank you,
Nithin

Dear @nithin.m1,
Please see data, dptr variables dwImageCPU, dwImageCUDA structures at DriveWorks SDK Reference: Image Interface

Hi @SivaRamaKrishnaNV ,

Just to clarify, Now am able to get the output correctly even without conversion of HWC to CHW. But as per yolov3 model plotted in netron for onnx, the input shape is CHW. So I did not understand where actually the conversion from HWC to CHW is happening.
What I have done in preprocessing is, read the image and used the dataconditioner module to preprocess and gave the output array to inference function.
Could you please give some insight on this?

Thank you,
Nithin

Dear @nithin.m1,
So, does that mean, just before data conditioner processing, the input buffer values in HWC format and after using data conditioner preprocessing function, the input array values are in CHW?