Intel® Distribution of OpenVINO™ Toolkit
Community support and discussions about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all things computer vision-related on Intel® platforms.

How does the REST API for OVMS work?

RalphW
Employee
198 Views

I have an OVMS running in a docker container and tried to use the KServe API via HTTP according to the following documentation: https://docs.openvino.ai/latest/ovms_docs_binary_input_kfs.html#doxid-ovms-docs-binary-input-kfs.

The container was started as follows: 

docker run -d --rm -u $(id -u):$(id -g) -v $(pwd)/model:/models/face-detection -p 9000:9000 -p 9001:9001 openvino/model_server:latest --model_path /models/face-detection --model_name face-detection --port 9000 --rest_port 9001 --plugin_config '{"CPU_THROUGHPUT_STREAMS": "1"}' --shape auto --log_level DEBUG /bin/bash --layout NHWC:NCHW

To launch the inference I called:

curl -H "Content-Type: application/octet-stream" -H "Inference-Header-Content-Length: 141" http://192.168.121.123:9001/v2/models/face-detection/infer -d '{"model_name":"face-detection", "inputs":[{"name":"model_input", "shape":[1],"datatype":"BYTES","parameters":{"binary_data_size":"210765"}}]}' --data-binary @images/people1.jpeg

 

and got {"error": "Missing input with specific name - Required input: data"} as the result, so it seems OVMS is expecting the "data" field to be present  in the inference header - but if I got the documentation right, that field is not required when the binary extensions is used, instead the image should simply be appended to the inference header. Any idea how the request should look like?

 

 

Labels (1)
0 Kudos
1 Solution
RalphW
Employee
161 Views

Hi Wan,

thanks again for the quick answer. In the mean time I found the issue. When using multiple -d (or --dataxxxx) options,  curl concatenates them, but with ampersands - so with my curl call the image was proceeded with & - thus, the encoding failed.

I found no solution that would send the correct request with just curl commandline options - but by appending the json header to the image and storing that to a file first I got a valid response from OVMS.

 

Thanks again,

Ralph

 

View solution in original post

5 Replies
Wan_Intel
Moderator
178 Views

Hi RalphW,

Thanks for reaching out to us.

 

Yes, you are right. The error you encountered: "error": "Missing input with specific name - Required input: data" was due to OpenVINO™ Model Server expecting the “data” field to be present.

 

On another note, are you using face-detection-adas-0001 from Intel’s Pre-Trained model? For your information, the input name for face-detection-adas-0001 is “data”.

 

Could you please change the input name to data instead of model_input and see if your issue was able to resolve?

 

 

Regards,

Wan

 

RalphW
Employee
167 Views

Hi Wan,

Thanks for your answer, I'm indeed a step further now!

I'm following the OVMS Quick Start Guide that uses model face-detection-retail-0004, that has indeed data as input name.

Now I'm getting the following error: {"error": "Image parsing failed"} with the image "people1.jpeg" that was used in the quick start guide.

I know that the shape of the image (1200x800) doesn't match the model's specification, but I thought that OVMS would resize the image accordingly. Would you have some suggestions?

 

Thanks,

Ralph

Wan_Intel
Moderator
164 Views

Hi RalphW,

Thanks for your information.

May I know which demo application are you using? Referring to sample code from KServe API usage samples, there is no --data-binary command but --binary_data command.

 

On another note, could you please follow the steps from Run the Client to perform inference with binary encoded image in KServe API usage samples and see if you still encounter the same issue?

 

 

Regards,

Wan


RalphW
Employee
162 Views

Hi Wan,

thanks again for the quick answer. In the mean time I found the issue. When using multiple -d (or --dataxxxx) options,  curl concatenates them, but with ampersands - so with my curl call the image was proceeded with & - thus, the encoding failed.

I found no solution that would send the correct request with just curl commandline options - but by appending the json header to the image and storing that to a file first I got a valid response from OVMS.

 

Thanks again,

Ralph

 

Wan_Intel
Moderator
133 Views

Hi RalphW,

Glad to know that you have solved your issue and thanks for sharing your answer in the community.

This thread will no longer be monitored since this issue has been resolved. If you need any additional information from Intel, please submit a new question.

 

 

Regards,

Wan


Reply