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

Adjust Roboflow models to primarily use base64 payloads #798

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def run_remotely(
tasks = [
partial(
client.clip_compare,
subject=single_image.numpy_image,
subject=single_image.base64_image,
prompt=classes,
clip_version=version,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def run_remotely(
max_concurrent_requests=WORKFLOWS_REMOTE_EXECUTION_MAX_STEP_CONCURRENT_REQUESTS,
)
client.configure(configuration)
non_empty_inference_images = [i.numpy_image for i in images]
non_empty_inference_images = [i.base64_image for i in images]
predictions = client.ocr_image(
inference_input=non_empty_inference_images,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def run_remotely(
client.configure(inference_configuration=configuration)
if WORKFLOWS_REMOTE_API_TARGET == "hosted":
client.select_api_v0()
inference_images = [i.to_inference_format(numpy_preferred=True) for i in images]
inference_images = [i.to_inference_format() for i in images]
image_sub_batches = list(
make_batches(
iterable=inference_images,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ def run_remotely(
source="workflow-execution",
)
client.configure(inference_configuration=client_config)
inference_images = [i.numpy_image for i in images]
inference_images = [i.base64_image for i in images]
predictions = client.infer(
inference_input=inference_images,
model_id=model_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ def run_remotely(
source="workflow-execution",
)
client.configure(inference_configuration=client_config)
inference_images = [i.numpy_image for i in images]
inference_images = [i.base64_image for i in images]
predictions = client.infer(
inference_input=inference_images,
model_id=model_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def run_remotely(
source="workflow-execution",
)
client.configure(inference_configuration=client_config)
non_empty_inference_images = [i.numpy_image for i in images]
non_empty_inference_images = [i.base64_image for i in images]
predictions = client.infer(
inference_input=non_empty_inference_images,
model_id=model_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def run_remotely(
source="workflow-execution",
)
client.configure(inference_configuration=client_config)
non_empty_inference_images = [i.numpy_image for i in images]
non_empty_inference_images = [i.base64_image for i in images]
predictions = client.infer(
inference_input=non_empty_inference_images,
model_id=model_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ def run_remotely(
source="workflow-execution",
)
client.configure(inference_configuration=client_config)
non_empty_inference_images = [i.numpy_image for i in images]
non_empty_inference_images = [i.base64_image for i in images]
predictions = client.infer(
inference_input=non_empty_inference_images,
model_id=model_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ def base64_image(self) -> str:
return self._base64_image
numpy_image = self.numpy_image
self._base64_image = base64.b64encode(
encode_image_to_jpeg_bytes(numpy_image)
encode_image_to_jpeg_bytes(numpy_image, jpeg_quality=95)
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably want to do whatever we do during the export process for training. I think it’s quality 70

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd vote to keep default compression used by opencv, if we introduce higher compression we will have users complaining that inference works differently when they run it locally vs when they make request to our platform..

).decode("ascii")
return self._base64_image

Expand Down