How to inject models directly in to the Vizi-AI Model Manager API

Reading Time: 5 minutes

Head of Engineering and Architecture for ADLINK Technology

Sometimes our users want to integrate their own model creation solution with the ADLINK Model Manager rather than manually adding them using Edge Profile Builder, this guide will show you how to do that. In this guide you will see that I am using Postman to demonstrate how to integrate with the Model Manager API.

Firstly I will run the user through installing Postman to test and see how I have injected my models.

Install postman which is a tool which enables direct interactions with API’s, the Model Manager has an API which is used by Profile Builder to add models to the Model Zoo. In this document we are going to by-pass Profile Builder and manually inject a model into the API directly. Firstly, you will need to install postman, it is available from this URL (https://www.postman.com/downloads/) You download it from the download button in the middle of the window highlighted below.

You will then see Postman installing, there are no other options etc it simply shows this screen and then installs.

Once the install has finished you will be presented with the loading screen.

You then need to create an account, click the Create Account button.

You are required to supply your Email, Username, Password and select to Agree to the Terms of Use, then click Create Account.

Once you have created your account, you need to create your user profile, simply add your name and the role that is closest to yours from the drop down and click continue.

Now provide your team with a name, anything that is relevant to you, and click continue.

At this point you can invite people to your team but this is not necessary simply click maybe later.

At this point it is probably a good idea to retrieve the IP address for your Vizi-AI, to do this simply open Profile Builder, select the devices tab and make a note of the IP address shown in the table.

Once you have registered with Postman you will now be displayed the Postman application, click the ‘+’ icon at the top of the screen to get started.

You will then have created a new request; however the default is a GET request and we are looking at a POST request. Click the drop-down list to be provided with the options.

Select POST

And then select the tab underneath Entitled Body.

Next, we have to configure the POST request we are going to send: the format that the Model Manager API uses for this request is:

http://<YOUR-VIZI-AI-IP-ADDRESS>:8081/model/<MODEL-NAME>/version/<VERSION>

The highlighted areas are the areas you need to fill in. The Table in Appendix A will tell you what you need to enter for each model example model that is provided.

In the body tab you need select the form-data sub tab and start to enter keys into the form-data.

Firstly enter a key called “database_entry” and the value of that depends on the model you are inserting, for example for the face detection model, that is provided in Appendix A, the entry reads

{"precisionmode":"FLOAT16","outputtype":"OBJECTBOUNDINGBOX","labels_file":"labels.json"}

You need to ensure that the precision mode, output type and labels file are named correctly, the table in Appendix A has the correct information for the provided examples, you will have to know these values when working with your own models.

You also in the Body need to enter a key called “file” once you have created the key, click off it and hover your mouse to the right of the key box it will show up by default as a text value, change this to file.

You will then be presented with a button in the value field, click on this.

Browse to the folder containing your model and select it and click open.

In my case this is the face-detection model.

As you can see if you navigate to the Vision Tab within Profile Builder we have a model Zoo that contains no models at present.

Once you are happy that you have your POST string correctly entered and you have the database_entry and the file configured click send.

If it is successful in the highlighted area below you will get a Status 201 Created message displayed.

If you now go to profile builder’s Vision tab or refresh your page if you were already in that tab you will see the model now in the model manager.

When you apply a model to a stream you must select these options to apply the model immediately to the stream. Please be mindful that models need to be sent to the inferencing engine and can take some time depending on the size of the model. To look at progress please use Portainer to view the logs for the model manage and OpenVINO engine apps.

Appendix A

Model NameModel DescriptionModel LocationPOST ValueDatabase_entry value
Face DetectionThis model detects faces and is best used when
operating a USB web cam with your Vizi. Instructions for configuring your Vizi
to use a web cam can be found here (https://goto50.ai/tutorial/How-to-show-a-web-cam-output-instead-of-a-video-on-Vizi-AI
)
https://vizi-ai-ppa.s3.eu-west-2.amazonaws.com/models/openvino/face-detection.tar.gzhttp://192.168.1.42:8081/model/face-detection-retail-0004-fp16/version/1{"precision_mode":"FLOAT16","output_type":"OBJECT_BOUNDING_BOX","labels_file":"labels.json"}
Frozen Inference GraphThis is the model that Vizi-AI provides you out of the box.
It is an object detection model
https://vizi-ai-ppa.s3.eu-west-2.amazonaws.com/models/openvino/frozen_inference_graph.tar.gzhttp://192.168.1.42:8081/model/frozen_inference_graph/version/1{"precision_mode":"FLOAT32","output_type":"OBJECT_BOUNDING_BOX","labels_file":"coco_labels.json"}
Pedestrian DetectionThis model is a pedestrian detection model, you
can use this either with your webcam or the generic video we provide you with.
https://vizi-ai-ppa.s3.eu-west-2.amazonaws.com/models/openvino/pedestrian-detection-adas-0002.tar.gzhttp://192.168.1.42:8081/model/pedestrian-detection-adas-0002/version/1{"precision_mode":"FLOAT32","output_type":"OBJECT_BOUNDING_BOX","labels_file":"labels.json"}

Stay in touch

Sign up to our email list to be notified of the latest industry news