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

Optimization of _create_object_prediction_list_from_original_predictions for Detectron2 model. Significant speed improvement. #865

Merged
merged 4 commits into from
May 15, 2023

Conversation

MyosQ
Copy link
Contributor

@MyosQ MyosQ commented Apr 19, 2023

I found the function _create_object_prediction_list_from_original_predictions for the Detectron2 model to be quite slow, particularly when working with large images (5400x2700).

To improve performance, I have rewritten the function using list comprehension and have only moved necessary objects to the CPU, avoiding early use of tolist().

I managed to get inference time down from ~30sec/it to ~10sec/it
Performance comparison:

  • Before optimization
    before

  • After optimization
    after

@fcakyon fcakyon enabled auto-merge May 15, 2023 18:30
@fcakyon fcakyon added this pull request to the merge queue May 15, 2023
@fcakyon
Copy link
Collaborator

fcakyon commented May 15, 2023

@MyosQ amazing PR, thank you for the efforts!

Merged via the queue into obss:main with commit 5df5072 May 15, 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

Successfully merging this pull request may close these issues.

2 participants