-
Notifications
You must be signed in to change notification settings - Fork 31
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
Error when executing Mixed operator decoders__Image when sending image binary to dali in triton #176
Comments
Hi @proevgenii ! Your code looks more-or-less OK. I believe there might be few reasons, that the image format is not recognized properly:
img_data = np.fromfile('test_img.png', dtype=np.uint8)
If none of these points help, please let us know, we'd try to figure something out. |
Hello, @szalpal! About 1. and 2.I have already tried approach with 3.
4.Removing
|
Got it. In that case, you're good with You can use a snippet from one of our examples: def load_image(img_path: str):
"""
Loads image as an encoded array of bytes.
This is a typical approach you want to use in DALI backend
"""
with open(img_path, "rb") as f:
img = f.read()
return np.array(list(img)).astype(np.uint8) This function will create a byte stream, that should be passed to input = grpc.InferInput(input_name, input_shape, "UINT8")
input.set_data_from_numpy([load_image("path_to_my_image")]) You can refer to the ensemble_client for an example, which reflects quite well what you want to do. Especially functions: |
Thanks again, @szalpal ! |
Then the pipeline you've pasted at the top is a good starting point: @dali.pipeline_def(batch_size=64, num_threads=4, device_id=0)
def pipe():
images = dali.fn.external_source(device="cpu", name="DALI_INPUT_0")
images = dali.fn.decoders.image(images, device="mixed", output_type=types.RGB)
images = dali.fn.resize(images, resize_x=224, resize_y=224, device='gpu')
return dali.fn.crop_mirror_normalize(images,
dtype=types.FLOAT16,
output_layout="CHW",
device='gpu',
mean=[0.485 * 255, 0.456 * 255, 0.406 * 255],
std=[0.229 * 255, 0.224 * 255, 0.225 * 255]) When working with images and requiring only resize and normalize, the best approach is to use |
Hello here again! 🖖🖖 But I get the same error
|
Hello @proevgenii np.frombuffer(img, dtype=np.uint8) where |
Hi @mzient But is there any way to send binary string to dali? Or dali can't perform decoding of byte strings? |
Hello, I'm trying to send image in binary format to triton server with Dali preprocessing
I'm trying to send JPEG or PNG images as bytes but getting error about
Unrecognized image format. Supported formats are: JPEG, PNG, BMP, TIFF, PNM, JPEG2000 and WebP.
That how dali pipeline looks:
Model repository for triton server:
Dali config.pbtxt:
Script to send request to triton:
Error Log here
It looks like the image format was not recognized correctly. Or am I doing something wrong
The text was updated successfully, but these errors were encountered: