DataConditioner Parameters values

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,

Could you please clarify on data conditioner parameters?

The mean and std values as per documentation is in range [0,255] .
Scale coefficient is 1.0 default. So if I want to normalize the input by (1/255), should I give the scaleCoefficient value as 1/255 ?
If yes what should be the mean and std values in that case, whether that values also should be normalized by 255?

regards,
Nithin

Dear @nithin.m1,
So if you want X` = X/255, just set scaleCoefficient parameter to 1/255. The conditioner modules uses default values of other parameters.

Hi @SivaRamaKrishnaNV ,

Yes. But if I have to use mean and standard deviation parameters at the same time, should I use the normalised mean /stdv parameters (mean/255, stdv/255) or normal values?

Regrads,
Nithin

Dear @nithin.m1,
Use normal values for mean and stddev params. Let us know if you see any issue.

Hi @SivaRamaKrishnaNV ,
Still facing some issue.
let me elaborate the scenario.
I am actually working on a lane detection model, I converted the onnx and trt bin files and able to load the files correctly in driveworks.

But inference output is not correct. It comes actually little shifted from the actual lanes also some random lane points also. I have double checked the post processing code and it seems to be correct.

I suppose there is some issue with the input preprocessing for which I used the dataconditoner functions. I am attaching the .josn.bin file I used. Could you please let me know how can I debug whether the input is preprocessed correctly.
lane_detect_new.bin.json (338 Bytes)

The preprocessing as per python code:

def prepare_input(self, image):
	img = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
	self.img_height, self.img_width, self.img_channels = img.shape

	# Input values should be from -1 to 1 with a size of 288 x 800 pixels
	img_input = cv2.resize(img, (self.input_width,self.input_height)).astype(np.float32)
	
	# Scale input pixel values to -1 to 1
	mean=[0.485, 0.456, 0.406]
	std=[0.229, 0.224, 0.225]
	
	img_input = ((img_input/ 255.0 - mean) / std)
	img_input = img_input.transpose(2, 0, 1)
	img_input = img_input[np.newaxis,:,:,:]        

	return img_input.astype(np.float32)

I have scaled the mean and stdev to (0,255) range by multiplying with 255 and kept the sclale coefficient as 1.0.
Note:
I have confirmed the onnx file inferring with onnx runtime and it gives correct result.
Thank you,
Nithin

Dear @nithin.m1,
I have scaled the mean and stdev to (0,255) range by multiplying with 255 and kept the sclale coefficient as 1.0.

Could you keep the scaling coefficient as 1/255 and check if it fixes?

No when I kept it as 1/255, results are even worse no where near look like lane points at all.

Dear @nithin.m1,
Assuming the network input size as 288 x 800, Could you compare input array values of network in both cases for confirmation?

Hi @SivaRamaKrishnaNV ,
I have attached two csv files, which are the input arrays for the same image, prepared by opencv in python and datacondtioner function.

I can see the changes in values.

Not sure if it is the reason for not getting the correct result in my driveworks code.

The input image processed by opencv gives correct result when it is given in to the onnx file used for generating tensorrt .bin file.

So could you please suggest how to proceed on this?

opencv_values.csv (11.6 MB)
dataconditioner_values.csv (11.2 MB)

Regards,
Nithin

Dear @nithin.m1,
The difference in input values cause difference in output as well. Make sure the input data before preprocessing matches.
I see the output of prepare_input is NCHW with RGB in pixel order.
The input seems to be HWC format and changed to CHW after the preprocessing. The mean and std arrays represents RGB order? Is the input to data conditioner is NCHW format?

Hi @SivaRamaKrishnaNV,

as per the above screenshot from documentation the mean stdev normalizations are working on R, G, B planes only.

As per my understanding the output of dataconditoner is in NCHW format. Because for YOLOv3, it was working for me. But in that case only normalizing with 255 was there (no mean, stdev normalization)

regards,
Nithin

Dear @nithin.m1,
The csv files are output after proprocessing?
Please confirm if the values to data processing module and output after below are same?

img_input = cv2.resize(img, (self.input_width,self.input_height)).astype(np.float32)

Please take a small image as example like 3 * 16 * 16 and verify the output after each step in the snippet and share values to understand the route cause.

Hi @SivaRamaKrishnaNV ,

CSV files are after preprocessing. Means its the input which we are giving to network.
Could you please confirm which interpolation filter dataconditioner module is using for resizing the image?
I am giving the original image to dataconditioner module. not the scaled version. There is one option called ROI which I gave as the full original image size.
The data conditioner module resizes the image to the network input size, do the preprocessing and gives the values as in output on csv file. I cannot compare the values just after resizing as dataconditioner module not exposing the resize and other preprocessing.

Thank you,
Nithin

Please see Incorrect output from dwDataConditioner API - #9 by SivaRamaKrishnaNV

Hi @SivaRamaKrishnaNV,

Sorry, I checked with the opencv preprocessed csv file in my code still I was getting same error.

So I reviewed code again and resolved the issue.

This thread can be closed. dataconditioner module is working as expected

Thank you,
Nithin

Dear @nithin.m1,
Thank you for update. I am glad the issue is resolved.
Could you share the used data conditioner params?

lane_detect_new.bin.json (338 Bytes)

1 Like