Is the value of mean-values in RGB order?

I have two questions:

  1. In ksnn convert, the value of mean-values in the order of RGB channels?Is it related to reorder?
  2. In nn_inference, the reorder=‘0 1 2’ represents the order of RBG? the reorder=‘2 1 0’ represents the order of BGR?

Hello @googleearth

that is correct, it’s related to the mean value R, G, B channels across all the images of your image dataset.

@ Electr1
Thank you for your reply!
If the input of the model is RGB and the model file is onnx, should the order of --mean-values be in RGB when using KSNN conversion? But I see that the reorder in the nn_inference is “2 1 0”, should the order of --mean-values be in the order of BGR? I’m a bit unclear about this area…

if RGB:
--mean-values '123.7464 115.1224785 105.6563685 0.0171305' 

if BGR:
--mean-values '105.6563685 115.1224785 123.7464 0.0171305'

cv_img = []
img = cv.imread(picture, cv.IMREAD_COLOR)
model.nn_inference(cv_img, platform = 'ONNX', reorder='2 1 0', output_format=output_format.OUT_FORMAT_FLOAT32)

How should I choose?

@googleearth you need to have the mean values in the order the model expects the channel inputs.

If your model is using RGB channels, keep the order mean values in RGB order.

the purpose of reorder is the reorder the channels of the input image. if your input is also in RGB format, reorder should be '0 1 2', in other case your image input is BGR, you need to set reorder to '2 1 0', so that KSNN can use this information to reorder the channels from BGR to RGB.

@ Electr1
Thank you for your clear explanation. I am now clear about it

1 Like