Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What are the operations to perform on input images in inference? #60

Open
cppntn opened this issue Nov 19, 2018 · 2 comments
Open

What are the operations to perform on input images in inference? #60

cppntn opened this issue Nov 19, 2018 · 2 comments

Comments

@cppntn
Copy link

cppntn commented Nov 19, 2018

I want to perform inference with pretrained models to a custom dataset, to obtain global and local features. What are the operations that have to be done on the image? Like mean subtraction, scale multiplication, resize, and RGB or BGR input channels.
Thanks

@huanghoujing
Copy link
Owner

Hi, the inference pre-process looks like following

  • Read the image using PIL.Image, np.asarray(Image.open(im_path)). The output is with shape [H, W, 3], in RGB order.
  • Scale the image by 1./255
  • Normalize it using im_mean = [0.486, 0.459, 0.408] and im_std = [0.229, 0.224, 0.225]
  • Transpose the image to shape [3, H, W], and then add a new axis to have shape [1, 3, H, W].
  • Transform from numpy to pytorch Variable for network input.

@MichaelWU0726
Copy link

I want to perform inference with pretrained models to a custom dataset, to obtain global and local features. What are the operations that have to be done on the image? Like mean subtraction, scale multiplication, resize, and RGB or BGR input channels.
Thanks

Hi, have you implemented the inference you said ? hope you can tell me how to infer images,thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants