Segmentation Example with a PaddlePaddle Model

Overview

This guide demonstrates how to run inference requests for PaddlePaddle model with OpenVINO Model Server. As an example, we will use ocrnet-hrnet-w48-paddle to perform segmentation on an image.

Prerequisites

  • Docker installed

  • Python 3.7 or newer installed

Preparing to Run

Clone the repository and enter segmentation_using_paddlepaddle_model directory

git clone https://github.com/openvinotoolkit/model_server.git
cd model_server/demos/segmentation_using_paddlepaddle_model/python

Install paddlepaddle and other packages required to export the model to deployable format

pip3 install paddlepaddle
pip3 install pyyaml
pip3 install scipy
pip3 install opencv-python
pip3 install requests

You can prepare the workspace by just running

make

Deploying OVMS

Deploy OVMS with vehicles analysis pipeline using the following command:

docker run -p 9000:9000 -d -v ${PWD}/model:/models openvino/model_server --port 9000 --model_path /models --model_name ocrnet

Requesting the Service

Install python dependencies:

pip3 install -r requirements.txt

Now you can run the client:

python3 segmentation_using_paddlepaddle_model.py --grpc_port 9000 --image_input_path ../../common/static/images/cars/road1.jpg --image_output_path ./road2.jpg

Exemplary result of running the demo:

Road