Container Automatic Image Conversion

The request header x-convert-images can be used to instruct the container to examine the format of input images and convert them as necessary. The JPEG format is supported by default.

The ONNX models used with the Private AI Services Container include operations, such as resizing and channel reordering, that process images. This processing enables the subsequent nodes of the model graph to produce embeddings or probabilities for image classification. However, these operations are intended to work only with the JPEG image format and will produce errors when the ONNX model is supplied with other formats.

When the request header x-convert-images is set to true, the container will examine the format of the images sent in the request and, if the input image format is supported, will convert them to JPEG. The following input formats are supported:

  • .bmp
  • .gif
  • .odd
  • .png
  • .tiff

The x-convert-images header is mapped to a boolean variable and when not included, defaults to false. The following is an example of a request that includes the image conversion header:

curl -X POST -H "Content-Type: application/json" -H "x-convert-images: true" -d "{\"model\": \"image_model\", \"input\":\"$IMAGE_TXT\"}" http://localhost:9091/v1/embeddings