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

Normalize image before inference #12

Closed
mihelich opened this issue Aug 1, 2023 · 3 comments
Closed

Normalize image before inference #12

mihelich opened this issue Aug 1, 2023 · 3 comments

Comments

@mihelich
Copy link

mihelich commented Aug 1, 2023

Thanks for the helpful repo!

When using the pretrained models, should I normalize the image tensor before feeding it to the model?

For training, COCODataset applies the usual Normalize transform (code) when loading images. The config files also include NormalizeTensor steps in train_pipeline and val_pipeline, though that part of the config doesn't appear to be used in this repo.

On the inference side, however, the inference.py script only scales the image input to [0, 1], without normalizing (code). Is that a bug, or am I missing something?

@JunkyByte
Copy link
Owner

Hello, thanks for your interest and for the bug report, I agree the preprocessing is different in inference, the original implementation I built on (https://github.com/jaehyunnn/ViTPose_pytorch) seems to contain this bug and I did not notice.

Should be fixed with c8a7a14, I inspected the inference results visually and they improve. I referenced this issue on the original implementation.

@JunkyByte
Copy link
Owner

Feel free to close once you verify this fix works correctly for you as well!

@mihelich
Copy link
Author

mihelich commented Aug 2, 2023

Great, thanks for the quick response! The fix looks correct to me. I'm using the ViTPose model directly, so I'm happy to have confirmation on what preprocessing I should do.

@mihelich mihelich closed this as completed Aug 2, 2023
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

2 participants