How should i preprocess images for inference with a efficientnetv2-b0 network?

  Kiến thức lập trình

I have trained a efficientnetv2-b0 model for image classification using openmmlab. Furthermore i used mmdeploy to create and infer the corresponding onnx model (on cpu), which gives the correct results. However, i am now trying to implement the model in C++ using TensorRT but i do not understand how i must preprocess the images before loading them into gpu memory for model inference.

  1. I’m currently using linear interpolation to scale the images from their original size 256×256 to the models expected format of 224×224. During training, bicubic interpolation is used to scale the images but i assume the difference is negligible.
  2. As i understand it, the pixels need to be converted to floating-point values in the range of [1.0, -1.0] (model info by keras) by subtracting the mean and dividing by the standard deviation. I am using the mean and std that are given in the config_file of the model i used during training with openmmlab (config_file).

mean[103.53, 116.28, 123.675], std[57.375, 57.12, 58.395]

How do i correctly process the rgb values of the images(which are in the range of [255,0]) to convert them to the required [1.0,-1.0] range?

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT