AI开发平台MODELARTS-模型配置文件编写说明:目标检测模型配置文件示例

时间:2023-11-21 09:08:24

目标检测模型配置文件示例

如下代码以TensorFlow引擎为例,您可以根据实际使用的引擎类型修改model_type参数后使用。

  • 模型输入

    key:images

    value:图片文件

  • 模型输出
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    {
        "detection_classes": [
            "face",
            "arm"
        ],
        "detection_boxes": [
            [
                33.6,
                42.6,
                104.5,
                203.4
            ],
            [
                103.1,
                92.8,
                765.6,
                945.7
            ]
        ],
        "detection_scores": [0.99, 0.73]
    }
    
  • 配置文件
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    {
        "model_type": "TensorFlow",
        "model_algorithm": "object_detection",
        "metrics": {
            "f1": 0.345294,
            "accuracy": 0.462963,
            "precision": 0.338977,
            "recall": 0.351852
        },
        "apis": [{
            "url": "/",
            "method": "post",
            "request": {
                "Content-type": "multipart/form-data",
                "data": {
                    "type": "object",
                    "properties": {
                        "images": {
                            "type": "file"
                        }
                    }
                }
            },
            "response": {
                "Content-type": "application/json",
                "data": {
                    "type": "object",
                    "properties": {
                        "detection_classes": {
                            "type": "array",
                            "items": [{
                                "type": "string"
                            }]
                        },
                        "detection_boxes": {
                            "type": "array",
                            "items": [{
                                "type": "array",
                                "minItems": 4,
                                "maxItems": 4,
                                "items": [{
                                    "type": "number"
                                }]
                            }]
                        },
                        "detection_scores": {
                            "type": "array",
                            "items": [{
                                "type": "number"
                            }]
                        }
                    }
                }
            }
        }],
        "dependencies": [{
            "installer": "pip",
            "packages": [{
                    "restraint": "EXACT",
                    "package_version": "1.15.0",
                    "package_name": "numpy"
                },
                {
                    "restraint": "EXACT",
                    "package_version": "5.2.0",
                    "package_name": "Pillow"
                }
            ]
        }]
    }
    
support.huaweicloud.com/inference-modelarts/inference-modelarts-0056.html