Toybrick

标题: Could you let us know how to convert from YUV422 to YUV420 or RGB using NPU ? [打印本页]

作者: nvnn    时间: 2020-3-30 18:12
标题: Could you let us know how to convert from YUV422 to YUV420 or RGB using NPU ?
Hi,
We are looking for a solution to feed YUV422 images to RKNN model. If we use Software solution to convert the image to RGB, it is very slow. Therefore, we are thinking of a solution of using NPU to convert the YUV422 image to RGB or YUV420. Could you please let us know if it is possible or not?
Alternatively, Could you let us know if it is possible to feed YUV422 images directly to RKNN model?

Thank you very much.

作者: jefferyzhang    时间: 2020-3-30 20:50
本帖最后由 jefferyzhang 于 2020-3-30 20:51 编辑

Unsupported yet.
But you could reshape input from 4-channels to 3-channels or 1-channel and reshape to 4-channel in your model first layer.
And rknn config mean and std with '0 0 0 1'

作者: nvnn    时间: 2020-3-30 21:27
jefferyzhang 发表于 2020-3-30 20:50
Unsupported yet.
But you could reshape input from 4-channels to 3-channels or 1-channel and reshape  ...

Could you please elaborate more about this? what do you mean by reshape input from 4-channels to 3-channels or 1-channel? Does that mean I can feed YUV422 images directly to RKNN model (same accuracy as RGB)?
作者: jefferyzhang    时间: 2020-3-30 21:33
nvnn 发表于 2020-3-30 21:27
Could you please elaborate more about this? what do you mean by reshape input from 4-channels to 3 ...

More or less. For example, if you use tf.keras, input is yuyv422  100*100*2, you can design your net like:

model = keras.Sequential([
    keras.layers.Input(100*100*2),
    keras.layers.Reshape((100, 100, 2))
    ...
])

and feed model with flattened input.
作者: nvnn    时间: 2020-3-31 09:05
jefferyzhang 发表于 2020-3-30 21:33
More or less. For example, if you use tf.keras, input is yuyv422  100*100*2, you can design your n ...

Thanks for your suggestion




欢迎光临 Toybrick (https://t.rock-chips.com/) Powered by Discuz! X3.3