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

Feature/batched inference slicer #1108

Closed

Conversation

LinasKo
Copy link
Contributor

@LinasKo LinasKo commented Apr 10, 2024

Description

PR for inference slicer with batching. If max_batch_size is set, collections of slices are passed to the model.

Still using threads if worker_threads>=2 (both batches and threads can be used simultaneously)

Type of change

  • New feature (non-breaking change which adds functionality)

How has this change been tested, please provide a testcase or example of how you tested the change?

https://colab.research.google.com/drive/1j85QErM74VCSLADoGliM296q4GFUdnGM?usp=sharing

Any specific deployment considerations

  • Docs updated? What were the changes:

@LinasKo
Copy link
Contributor Author

LinasKo commented Apr 10, 2024

As you can see, in these tests it only helped the Ultralytics case.

Known insufficiencies:

  • Inference 1 model is fit for vehicle detection but is tested on an image with people.
  • No image to check how well it performed.
  • No tests for auto-batch case (when max_batch_size=-1).
  • Missing examples in dosctring: normal vs batch callback

@LinasKo LinasKo marked this pull request as ready for review April 11, 2024 17:46
@LinasKo
Copy link
Contributor Author

LinasKo commented Apr 11, 2024

Ready for review.

Tests in aforementioned Colab: https://colab.research.google.com/drive/1j85QErM74VCSLADoGliM296q4GFUdnGM?usp=sharing
It's safe to do 'Run All', though it will ask for Roboflow auth midway and HF token at the end.

The main outcome is the time printed underneath.
You may uncomment visualizers to plot the images.

Caveats:

  • Inference examples run on the CPU - I'm speaking with Pawel to check what I missed
  • The first Ultralytics run is slower due to memory allocation. Run the cell again and the ultralytics threads=1 batch=1 case will run slightly faster.

@SkalskiP SkalskiP mentioned this pull request May 8, 2024
4 tasks
@LinasKo LinasKo marked this pull request as draft May 17, 2024 13:14
@LinasKo LinasKo closed this May 28, 2024
@LinasKo LinasKo force-pushed the feature/batched-inference-slicer branch from 0d1d309 to 9bc2907 Compare May 28, 2024 21:49
@LinasKo LinasKo mentioned this pull request May 28, 2024
2 tasks
@LinasKo
Copy link
Contributor Author

LinasKo commented May 28, 2024

Ah, force-pushing a revert to develop closes the PR.

Makes sense, and is fine. New changes: #1239

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.

1 participant