昇腾社区首页
中文
注册

响应示例

器件错漏反

  • WithoutReg模式:
    {
        "infer_test.jpg": {
            "InferenceTime": { "Stream": 0.7452316284179688,"PostAI": 0.02 ,"All": 0.91238,"StartTime": 20211129142700.97 ,"EndTime": 20211129142701.885},
            "IsSuccess": true,
            "Objects": [
              {"Box": {"Angle": 0,  "Height": 94, "Width": 98, "X": 2898,  "Y": 1717}, "Classification": {}, "Label": "Screw", "OCR": {}, 
                  "Score": 0.914897, "Segmentation": {} },
              {"Box": {"Angle": 0,  "Height": 99,  "Width": 100,  "X": 2905,  "Y": 2487}, "Classification": {}, "Label": "Screw", "OCR": {}, 
                  "Score": 0.792413831, "Segmentation": {}},
              {"Box": {"Angle": 0,  "Height": 105, "Width": 102, "X": 3357,  "Y": 2853}, "Classification": {}, "Label": "Screw", "OCR": {},        "Score": 0.400625825, "Segmentation":         {}},
              {"Box": {"Angle": 0,  "Height": 114,  "Width": 205,  "X": 1718, "Y": 2365}, "Classification": {},  "Label": "Fall", "OCR": {},        "Score": 0.464187652, "Segmentation": {}},
              {"Box": {"Angle": 0, "Height": 122, "Width": 128, "X": 1652, "Y": 2950}, "Classification": {}, "Label": "Lampstand", "OCR": {},           "Score": 0.576576293, "Segmentation": {}}
             ]
    }
  • WithReg模式:

    如果使用系统自带的配准算法,当模板框和检测框配对个数少于2个时,系统会提示不支持,需视觉软件自行使用其他配准算法并在请求参数中传入正确的 “RegisterMatrix”字段。

    {
        "IsSuccess": true,
        "infer_test.jpg": {"InferenceTime": {"Stream": 0.6637053489685059, "All": 0.965648, "PostAI": 0.32356565,"StartTime": 20211129110502.63 ,"EndTime": 20211129110503.60},
        "Objects": [
            {"Box": {"Angle": 0, "Height": 139.0, "Width": 150.0, "X": 967.0,  "Y": 2341.0 }, "Classification": {}, "Label": "Screw", "OCR": {},        "Score": 0.937403321,  "Segmentation": {}, "result": "OK" },
            {"Box": {"Angle": 0, "Height": 144.0, "Width": 156.0,  "X": 1004.0, "Y": 814.0 }, "Classification": {}, "Label": "Screw", "OCR": {},        "Score": 0.930168927, "Segmentation": {}, "result": "OK"},
            {"Box": {"Angle": 0, "Height": 150.0, "Width": 155.0, "X": 3578.0, "Y": 869.0 }, "Classification": {}, "Label": "Screw", "OCR": {},        "Score": 0.817400515, "Segmentation": {}, "result": "OK" },
            {"Box": {"Angle": 0, "Height": 135.0, "Width": 148.0, "X": 3463.0,  "Y": 2402.0 }, "Classification": {}, "Label": "Screw", "OCR": {},        "Score": 0.79875195,  "Segmentation": {}, "result": "OK"  },
            {"Box": {"Angle": 0,  "Height": 160.0, "Width": 164.0, "X": 1978.0, "Y": 2107.0 },  "Classification": {}, "Label": "Screw", "OCR": {},        "Score": 0.767472327, "Segmentation": {},  "result": "OK" },
            {"Box": {"Angle": 0, "Height": 144.0, "Width": 146.0, "X": 1138.0, "Y": 1104.0 }, "Classification": {}, "Label": "Screw", "OCR": {},        "Score": 0.562019348, "Segmentation": {}, "result": "OK" }    
         ],    
        "Patterns": [
          {"Height": 139, "Label": "Screw", "Width": 150, "X": 967,  "Y": 2341, "overlap_metric": "IOU", "overlap_thresh": "0.3","conf_thresh": 0.5, "result": "OK"      },
          {"Height": 144, "Label": "Screw", "Width": 156,  "X": 1004, "Y": 814, "num_match": "1", "overlap_metric": "IOU", "overlap_thresh": "0.3","conf_thresh": 0.5,        "result": "OK" },
          {"Height": 150, "Label": "Screw", "Width": 155, "X": 3578, "Y": 869, "num_match": "1",  "overlap_metric": "IOU", "overlap_thresh": "0.3","conf_thresh": 0.5,        "result": "OK" },
          {"Height": 135,  "Label": "Screw", "Width": 148,  "X": 3463, "Y": 2402, "num_match": "1", "overlap_metric": "IOU",  "overlap_thresh": "0.3", "result": "OK" },
          {"Height": 160,  "Label": "Screw", "Width": 164, "X": 1978, "Y": 2107,  "num_match": "1", "overlap_metric": "IOU",  "overlap_thresh": "0.3", "result": "OK" },
          {"Height": 144, "Label": "Screw", "Width": 146, "X": 1138,  "Y": 1104, "num_match": "1", "overlap_metric": "IOU", "overlap_thresh": "0.3",        "result": "OK" }
        ],
        "RegisterMatrix": [[1, 4.996003610813204e-16, 0], [0, 1, -2.2737367544323206e-13], [0, 0, 1]],
        "Result": "OK"
      }
    }
  • det_det模式:
    {
      "infer_test.jpg": [
        {
          "Box": {
            "Angle": 0,
            "Height": 220,
            "Width": 225,
            "X": 434,
            "Y": 228
          },
          "Classification": {},
          "Label": "主板",
          "Score": 0.872070312
        },
        {
          "Box": {
            "Angle": 0,
            "Height": 28,
            "Width": 28,
            "X": 454,
            "Y": 236
          },
          "Classification": {},
          "Label": "螺丝",
          "Score": 0.813476562
        },
        {
          "Box": {
            "Angle": 0,
            "Height": 28,
            "Width": 27,
            "X": 621,
            "Y": 244
          },
          "Classification": {},
          "Label": "螺丝",
          "Score": 0.755371094
        },
        {
          "Box": {
            "Angle": 0,
            "Height": 28,
            "Width": 28,
            "X": 448,
            "Y": 400
          },
          "Classification": {},
          "Label": "螺丝",
          "Score": 0.734375
        },
        {
          "Box": {
            "Angle": 0,
            "Height": 27,
            "Width": 27,
            "X": 613,
            "Y": 407
          },
          "Classification": {},
          "Label": "螺丝",
          "Score": 0.720703125
        },
        {
          "RegisterMatrix": [
            [1.0, 0.0, 0.0],
            [0.0, 1.0,0.0],
            [0.0, 0.0, 1.0]
          ]
        },
        {
          "InferenceTime": {
            "All": 0.4144020080566406,
            "PostAI": 0.0002167224884033203,
            "Stream": 0.40537548065185547,
            "StartTime": 20211129132516.02,
            "EndTime": 20211129132516.43
          },
          "IsSuccess": true
        }
      ]
    }
  • 异物检测模式:
    {
        "infer_test.jpg": {
            "InferenceTime": {"All": 0.4303882122039795, "PostAI": 0.0005049705505371094, "Stream": 0.24739599227905273, "StartTime": 20211129132829.34, "EndTime": 20211129132829.77}, 
            "IsSuccess": true,
            "Objects": [
                {"Box": {"Angle": 0, "Height": 28, "Width": 27, "X": 407, "Y": 84}, "Classification": {}, "Label": "screw_1", "OCR": {}, 
                         "Score": 0.840820312, "Segmentation": {}, "result": "NG"},
                {"Box": {"Angle": 0, "Height": 26, "Width": 26, "X": 717, "Y": 421}, "Classification": {}, "Label": "screw_1", "OCR": {},
                         "Score": 0.728027344, "Segmentation": {}, "result": "NG"},
                {"Box": {"Angle": 0, "Height": 28, "Width": 26, "X": 732, "Y": 147}, "Classification": {}, "Label": "screw_1", "OCR": {}, 
                         "Score": 0.720703125, "Segmentation": {}, "result": "NG"}, 
                {"Box": {"Angle": 0, "Height": 28, "Width": 28, "X": 394, "Y": 405}, "Classification": {}, "Label": "screw_1", "OCR": {},
                         "Score": 0.511230469, "Segmentation": {}, "result": "NG"}, 
                {"Box": {"Angle": 0, "Height": 27, "Width": 26, "X": 261, "Y": 399}, "Classification": {}, "Label": "screw_1", "OCR": {},
                         "Score": 0.415039062, "Segmentation": {}, "result": "NG"},  
                {"Box": {"Angle": 0, "Height": 30, "Width": 32, "X": 391, "Y": 403}, "Classification": {}, "Label": "screw_5", "OCR": {}, 
                         "Score": 0.450195312, "Segmentation": {},  "result": "NG"}, 
                {"Box": {"Angle": 0, "Height": 37, "Width": 42,  "X": 306, "Y": 75}, "Classification": {}, "Label": "screw_5", "OCR": {},
                         "Score": 0.426513672, "Segmentation": {}, "result": "NG"}
             ],
             "Patterns": [],
             "Result": "OK"  
        }
    } 

工业OCR

  • CRNN响应
    {
        "infer_test.jpg": {
            "InferenceTime": {"All": 0.01590132713317871, "PostAI": 4.9114227294921875e-05, "Stream": 0.01512742042541503, "StartTime": 20211129364536.13, "EndTime": 20211129364536.146},
             "Texts": [
                          {
                               "OCRText": "A113",
                               "Quad": {},
                               "Score": 1.0
                            }
                       ]
      }
    }
  • CTPN_CRNN响应
    {
        "infer_test.jpg": {"InferenceTime": {"All": 0.31487154960632324, "PostAI": 0.0009002685546875, "Stream": 0.23632454872131348, "StartTime": 20211129153605.17, "EndTime": 20211129153605.485},
         "IsSuccess": true,
         "Texts": [                
              {"OCRText": "C","Quad": {"BottomLeft": {"X": 384, "Y": 445.861145}, "BottomRight": {"X": 441.599976, "Y": 445.861145}, "TopLeft": {"X": 384, "Y": 479.75}, "TopRight": {"X": 441.599976, "Y": 479.75}},"Score": 0.973144531},
              {"OCRText": "AN",  "Quad": {"BottomLeft": {"X": 614.4, "Y": 439.339294}, "BottomRight": {"X": 748.8, "Y": 439.339294},"TopLeft": {"X": 614.4, "Y": 500.577393}, "TopRight": {"X": 748.8, "Y": 500.577393}}, "Score": 0.962332606},
              {"OCRText": "TRS", "Quad": {"BottomLeft": {"X": 537.6, "Y": 267.55835}, "BottomRight": {"X": 614.4, "Y": 267.55835}, "TopLeft": {"X": 537.6, "Y": 280.558319}, "TopRight": {"X": 614.4, "Y": 280.558319}}, "Score": 0.963501},
              {"OCRText": "TMANTCS", "Quad": {"BottomLeft": {"X": 326.4, "Y": 344.923615}, "BottomRight": {"X": 576, "Y": 344.923615}, "TopLeft": {"X": 326.4, "Y": 359.503937}, "TopRight": {"X": 576, "Y": 359.503937}}, "Score": 0.910688937},
              {"OCRText": "AAaTaEGS", "Quad": {"BottomLeft": {"X": 326.4, "Y": 368.289917}, "BottomRight": {"X": 518.399963, "Y": 368.289917}, "TopLeft": {"X": 326.4, "Y": 382.445435},  "TopRight": {"X": 518.399963, "Y": 382.445435}}, "Score": 0.925},
              {"OCRText": "BaTaSaSAS", "Quad": {"BottomLeft": {"X": 326.4, "Y": 381.819702}, "BottomRight": {"X": 537.6, "Y": 381.819702}, "TopLeft": {"X": 326.4, "Y": 403.153}, "TopRight": {"X": 537.6, "Y": 403.153}}, "Score": 0.951704562},
              {"OCRText": "AAINALS", "Quad": {"BottomLeft": {"X": 537.6, "Y": 278.56546}, "BottomRight": {"X": 672, "Y": 278.56546}, "TopLeft": {"X": 537.6, "Y": 296.130951}, "TopRight": {"X": 672, "Y": 296.130951}}, "Score": 0.955636144}
          ]
       }
    }
  • det_ocr模式:
    {
    	"infer_test.jpg": [{
    		"Box": {"Y": 1400,"Width": 687,"Angle": 0,"X": 1311,"Height": 662},
    		"OCR": {
    			"Quad": {
    				"TopLeft": {"Y": 1066.30127,"X": 1824},
    				"BottomLeft": {"Y": 448.245911,"X": 1824},
    				"TopRight": {"Y": 1066.30127,"X": 3739.2},
    				"BottomRight": {"Y": 448.245911,"X": 3739.2}
    			},
    			"OCRText": "AVC",
    			"Score": 0.992489755
    		},
    		"Score": 0.953125,
    		"Label": "nameplate"
    	},
    	{
    		"IsSuccess": true,
    		"InferenceTime": {
    			"All": 1.5591046810150146,
    			"Stream": 0.5422663688659668,
    			"PostAI": 0.0003387928009033203,
    			"StartTime": 20211129153841.06,
    			"EndTime": 20211129153842.619
    		}
    	}]
    }

胶体检测

  • WithoutReg模式:
    {"infer_test.jpg": 
        {
            "IsSuccess": true,
            "BlobContours": "Base64编码后的图像轮廓数据",
            "BlobMask": "Base64编码后的图像数据",
            "Blobs": [{"Area": 1873, "ID": 1, "Label": "battery"}, {"Area": 71, "ID": 2, "Label": "fan"}],
            "CodeType": "JPG",
            "InferenceTime": {"All": 0.6842312812805176, "PostAI": 0.013283491134643555, "Stream": 0.3668496608734131, "StartTime": 20211129110811.24, "EndTime": 20211129110811.92},
            "LabelMap": {"0": "background", "1": "battery",  "2": "fan" }
         }
    }
  • SetTemplate模式:
    • 模板已设置:
      {
          "IsSuccess": true,
          "PodIds": "0",
          "PodsNum": 1,
      }
    • 模板未设置:
      {
           "IsSuccess": false
           "ErrorMsg": "can not find template, set the template first.",
           "PodId": "0",
           "PodsNum": 1,
           "ErrorCode": "60011"
      }
  • WithReg模式:
    {"infer_test.jpg":
     {
        "IsSuccess": true,
        "result": "NG",
        "BlobContours": "Base64编码后的图像轮廓数据",
        "BlobMask": "Base64编码后的图像数据",
        "Blobs": [
    	{"ID": 1, "result": "OK", "Label": "battery", "Area": 40591, "Overlap": 0.8235}
         ],
        "MissedBlobs": [
    	{"ID": 2, "Label": "fan", "Area": 47089, "Overlap": 1}
         ],
        "InferenceTime": {"All": 1.041982650756836, "PostAI": 0.005155324935913086, "Stream": 0.7174561023712158, "StartTime": 20211129111432.11, "EndTime": 20211129111433.15},
        "LabelMap": {"0": "background", "1": "battery", "2": "fan" }
      }
    }
  • det_seg模式:
    {
    	"infer_test.jpg": [{
    		"Box": {"Y": 1696,"Width": 118,"Angle": 0,"X": 1982,"Height": 132},
    		"Segmentation": {
    			"Box": {
    				"Y": 1696,
    				"Width": 118,
    				"Angle": 0,
    				"X": 1982,
    				"Height": 132
    			},
    			"LabelMap": {
    				"1": "battery",
    				"0": "background"
    			},
    			"Score": 1.0,
    			"Mask": "Base64编码后的图像数据",
                            "LabelMask": "Base64编码后的图像数据",
    			"CodeType": "JPG"
    		},
    		"Score": 0.00725821,
    		"Label": "screw_5"
    	},
    	{
    		"IsSuccess": true,
    		"InferenceTime": {
    			"All": 1.0099523067474365,
    			"Stream": 0.5503246784210205,
    			"PostAI": 0.03273963928222656
    			"StartTime": 20211129161812.36,
    			"EndTime": 20211129161813.37
    		}
    	}]
    }
  • 标签外观缺陷检测:
    {
      "infer_test.jpg": [
        {
          "Box": {
            "Angle": 0,
            "Height": 310,
            "Width": 952,
            "X": 1311,
            "Y": 901
          },
          "Classification": {},
          "Label": "ok",
          "Msg": "No edge defect and wrinkle in image.",
          "Score": 0.762671828,
          "config_info": {
            "big": {
              "edge_defect_thres_all": 50,
              "physical_size": [
                70,
                30
              ],
              "pipeline_key": "tag_cls_1",
              "shape": [
                1,
                128,
                512,
                3
              ]
            },
            "small": {
              "edge_defect_thres_all": 30,
              "physical_size": [
                70,
                30
              ],
              "pipeline_key": "tag_cls_2",
              "shape": [
                1,
                128,
                512,
                3
              ]
            }
          },
          "defect_area_all": 0
        },
        {
          "InferenceTime": {
            "All": 0.7734987735748291,
            "EndTime": 20220129170708.598,
            "PostAI": 0.2647209167480469,
            "StartTime": 20220129170707.824,
            "Stream": 0.5020909309387207
          },
          "IsSuccess": true
        }
      ]
    }
  • 半导体质检:
    {
      "wafer.jpg": {
        "InferenceTime": {
          "All": 0.6395280361175537,
          "EndTime": 20211216113518.38,
          "PostAI": 0.18741631507873535,
          "StartTime": 20211216113517.74,
          "Stream": 0.145965576171875
        },
        "IsSuccess": true,
        "Prediction": {
          "bincode": "01",
          "blur_weight": 27.090372327443312,
          "center": [
            20635,
            29919
          ],
          "ref_image": "base64编码图片",
          "defect_point": [
            178.0,
            261.0,
            328.0,
            411.0
          ],
          "model_version": "00201Layer3_1.1.0",
          "show_prob": 0.9962272644042969
        }
      }
    }