Skip to content

How to preprocess image before using model with onnxruntime? #116

@XantaKross

Description

@XantaKross

Hey,

I was succesful in trying to run the .onnx model through opencv and python with a input size of (3, 640, 480) which becomes (1, 3, 480, 640) after the

print(img.shape) # (3, 640, 480) blob = self.net.blobFromImage(...) self.net.setInput(blob) print(blob.shape) # (1,3,480,640)

But I wish instead to run the model with onnxruntime inference. Which instead requires a input of size (10, 3, 32, 32)? Am I supposed to

  1. Resize the image to 32x32 before as input? And add another dimension?
  2. Break the image into 32x32 small patches then stack them into 10 different layers?
  3. Do something else?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions