This is a step-by-step guide on how to deploy OpenVINO™ Model Server on Linux, using Docker.
Before you start, make sure you have:
- Docker Engine installed
- Intel® Core™ processor (6-13th gen.) or Intel® Xeon® processor (1st to 4th gen.)
- Linux, macOS or Windows via WSL
- (optional) AI accelerators supported by OpenVINO. Accelerators are tested only on bare-metal Linux hosts.
This example shows how to launch the model server with a ResNet50 image classification model from a cloud storage:
Pull an image from Docker:
docker pull openvino/model_server:latest
docker pull registry.connect.redhat.com/intel/openvino-model-server:latest
wget https://storage.openvinotoolkit.org/repositories/open_model_zoo/2022.1/models_bin/2/resnet50-binary-0001/FP32-INT1/resnet50-binary-0001.{xml,bin} -P models/resnet50/1
docker run -u $(id -u) -v $(pwd)/models:/models -p 9000:9000 openvino/model_server:latest \
--model_name resnet --model_path /models/resnet50 \
--layout NHWC:NCHW --port 9000
wget https://raw.githubusercontent.com/openvinotoolkit/model_server/main/demos/common/static/images/zebra.jpeg
wget https://raw.githubusercontent.com/openvinotoolkit/model_server/main/demos/common/python/classes.py
pip3 install ovmsclient
echo 'import numpy as np
from classes import imagenet_classes
from ovmsclient import make_grpc_client
client = make_grpc_client("localhost:9000")
with open("zebra.jpeg", "rb") as f:
img = f.read()
output = client.predict({"0": img}, "resnet")
result_index = np.argmax(output[0])
print(imagenet_classes[result_index])' >> predict.py
python predict.py
zebra
If everything is set up correctly, you will see 'zebra' prediction in the output.
In case you want to try out features that have not been released yet, you can build the image from source code yourself.
git clone https://github.com/openvinotoolkit/model_server.git
cd model_server
make release_image GPU=1
It will create an image called openvino/model_server:latest
.
Note: This operation might take 40min or more depending on your build host. Note:
GPU
parameter in image build command is needed to include dependencies for GPU device. Note: The public image from the last release might be not compatible with models exported using the the latest export script. We recommend using export script and docker image from the same release to avoid compatibility issues.