openvinotoolkit / model_server

A scalable inference server for models optimized with OpenVINO™
https://docs.openvino.ai/2024/ovms_what_is_openvino_model_server.html
Apache License 2.0
676 stars 212 forks source link

[Question] Combined Recognition #685

Closed pedromoraesh closed 3 years ago

pedromoraesh commented 3 years ago

Hey, I've been using the model server as API to do some combined predictions.

First, I ran the example from the Combined Inference section, but the model doesn't load properly. The log says "FAILED PRECONDITION". Steps i did:

By itself, Age-Gender and Emotion models work fine, but when combined it's not working.

Then I have two questions: The model version, if not specified in the pipeline have any impact to create the pipeline? Can I do an entire Face Recognition pipeline using Combined Inference? (Face Detection, Face Crop, Landmarks, Face Alling and Face Re ID)

Here is my JSON:

{
    "model_config_list": [
        {
            "config": {
                "name": "emotions_classification",
                "base_path": "/models/emotions",
                "model_version_policy": {"specific": { "versions":[1,2,3] }}
            }
        },
        {
            "config": {
                "name": "age_gender_classification",
                "base_path": "/models/age-gender",
                "model_version_policy": {"specific": { "versions":[1,2,3] }}
            }
        },
        {
            "config": {
                "name": "face_detection",
                "base_path": "/models/face-detection",
                "model_version_policy": {"specific": { "versions":[1] }}
            }
        },
        {
            "config": {
                "name": "face_reidentification",
                "base_path": "/models/face-reidentification",
                "model_version_policy": {"specific": { "versions":[1] }}
            }
        },
        {
            "config": {
                "name": "landmarks",
                "base_path": "/models/landmarks",
                "model_version_policy": {"specific": { "versions":[1] }}
            }
        },
        {
            "config": {
                "name": "person_detection",
                "base_path": "/models/person-detection",
                "model_version_policy": {"specific": { "versions":[1] }}
            }
        }
    ],
    "pipeline_config_list": [
        {
            "name": "combined-recognition",
            "inputs": ["image"],
            "nodes": [
                {
                    "name": "emotions",
                    "model_name": "emotions_classification",
                    "type": "DL model",
                    "inputs": [
                        {"data": {"node_name": "request",
                                   "data_item": "image"}}
                    ], 
                    "outputs": [
                        {"data_item": "prob_emotion",
                         "alias": "emotion"}
                    ] 
                },
                {
                    "name": "age_gender",
                    "model_name": "age_gender_classification",
                    "type": "DL model",
                    "inputs": [
                        {"data": {"node_name": "request",
                                  "data_item": "image"}}
                    ], 
                    "outputs": [
                        {"data_item": "age_conv3",
                         "alias": "age"},
                        {"data_item": "prob",
                         "alias": "gender"}
                    ] 
                }
            ],
            "outputs": [
                {"age": {"node_name": "age-gender",
                           "data_item": "age"}},
                {"gender": {"node_name": "age-gender",
                           "data_item": "gender"}},
                {"emotion": {"node_name": "emotions",
                           "data_item": "emotion"}}
            ]
        }
    ]
}
dtrawins commented 3 years ago

@pedromoraesh it turns out there was a bug in the example documentation. It just got fixed with https://github.com/openvinotoolkit/model_server/pull/692 The problem was that the models were accepting input images with different resolution. 62 and 64 pixels. Pipeline configuration can be fixed by updating one of the model input shape so both of them could accept the same image.

pedromoraesh commented 3 years ago

62 and 64 pixels

I did realize that yesterday, thx for the reply. I did fix by adding shape argument into JSON.