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

How to run inference with image that is not square-shaped? #45

Open
yankee624 opened this issue Jun 6, 2021 · 2 comments
Open

How to run inference with image that is not square-shaped? #45

yankee624 opened this issue Jun 6, 2021 · 2 comments

Comments

@yankee624
Copy link

In yolov4-inference-demo.py, it assumes the height and width of the image are equal.
How should I change the code to perform inference on image that is not square?

The figure below shows the part that throws error when doing inference with rectangular image.
It defines idx based on int(resized_image_w/out_blob_w) and int(resized_image_h/out_blob_h), which are equal.
How should I change this part when, for example image size is 1080x1920?

image

@yankee624 yankee624 changed the title How to run with image that is not square-shaped? How to run inference with image that is not square-shaped? Jun 6, 2021
@TNTWEN
Copy link
Owner

TNTWEN commented Jun 7, 2021

@yankee624
Your screenshot is the inference program of scaled-yolov4.
see FAQ #10 num 4
Just change the input size of tfmodel ,test with inference demo to see if the demo could Identify model‘s input size

@yankee624
Copy link
Author

yankee624 commented Jun 7, 2021

@TNTWEN
Yes I am actually talking about the inference program.
I checked the FAQ and changed the input size of the model.
But, when doing the inference with the changed model, the postprocessing part (in the above screenshot) becomes the problem.
It seems to modify the width and height somehow (maybe because the original width and height output from the model aren't the real width and height), but I can't understand what it's doing.
So I don't know how to change that postprocessing part if I use non-square input images

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