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

Accept numpy image in batch as base64 encoded string #187

Merged
merged 2 commits into from
Dec 13, 2023

Conversation

sberan
Copy link
Contributor

@sberan sberan commented Dec 12, 2023

Description

This PR allows numpy image entries to be sent as numpy arrays which have been pickled, and then the byte sequence encoded as base64. The previous numpy images only worked when the image was sent as the full body of the HTTP request, and thus could be processed as a byte stream.

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?

Tested locally using a script and unit tests.

Any specific deployment considerations

n/a

Docs

  • Docs updated?

Copy link
Collaborator

@PawelPeczek-Roboflow PawelPeczek-Roboflow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but I would like to ask about reasoning for accepting bitmaps in general.

This is the size of the same image (random noise) of size 1920x1080 using different strategies:
image

ofc, JPEG is lossy, but from the perspective of data transfer maybe this is not a good price to pay.

Beyond that, for common use-cases we can simply encourage usage of our HTTP client library: https://inference.roboflow.com/inference_sdk/http_client/

@sberan
Copy link
Contributor Author

sberan commented Dec 13, 2023

I am working with a team who is using inference to process video frames from an array of cameras.

  • They are processing batches of video frames from cv2 and would like to introduce Roboflow into their video processing loop.
  • They already have a lot of python dependencies and have trouble adding more dependencies to the project.
  • They are running the docker container locally and therefore data transfer is less likely to be as much overhead as jpeg encoding/decoding.

@paulguerrie paulguerrie merged commit 94ec78b into main Dec 13, 2023
5 checks passed
@paulguerrie paulguerrie deleted the numpy-image-batches branch December 13, 2023 15:19
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.

3 participants