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

Fix fit_to_window Python embed_preprocessing() #100

Merged
merged 2 commits into from
Jul 10, 2023

Conversation

Wovchena
Copy link
Collaborator

Close #99

The implementation was incorrect. It performed scales based interpolation instead if sizes. Padding was missing. Now it is aligned with C++.

Close #99

The implementation was incorrect. It performed scales based interpolation instead if sizes. Padding was missing. Now it is aligned with C++.
@Wovchena Wovchena requested a review from sungchul2 July 10, 2023 08:51
@Wovchena Wovchena linked an issue Jul 10, 2023 that may be closed by this pull request
@sungchul2
Copy link
Contributor

Thanks for quick fix.
Although I didn't check, some functions use metadata related to fit_to_window and used into postprocess might be affected, such as

def resize_detections_with_aspect_ratio(
detections, original_image_size, resized_image_size, model_input_size
):
scale_x = model_input_size[0] / resized_image_size[0] * original_image_size[0]
scale_y = model_input_size[1] / resized_image_size[1] * original_image_size[1]
for detection in detections:
detection.xmin *= scale_x
detection.xmax *= scale_x
detection.ymin *= scale_y
detection.ymax *= scale_y
return detections

What do you think?

This makes sure different `resize_type` values share same implementation so untested `resize_type` values are tested now indirectly with. This alos alighs with C++.

Change `new_size` shape. It seems old approach results in error for newer OpenVINO.
@Wovchena
Copy link
Collaborator Author

Updated

@Wovchena Wovchena merged commit 3b1c4a4 into master Jul 10, 2023
@Wovchena Wovchena deleted the 99-how-working-fit_to_window branch July 10, 2023 12:10
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

Successfully merging this pull request may close these issues.

How working fit_to_window?
2 participants