请求示例

- 推理图片大小不得大于30MB。
- 单次推理图片数量不得大于10张。
- 请求参数字段必须严格按照说明输入,否则会返回参数校验错误。
器件错漏反
- WithoutReg模式
{ "ProjectName": "project_ssd_resnet", "TaskName": "assm1-2", "ProductCode": "123", "ProductSN": "121", "TaskType": "WithoutReg", "CodeType": "JPG", "Files": [{"FileName": "infer_test.jpg", "ImageData": "图片数据的base64编码"}] }
- WithReg模式参数说明:
- “ROIs”可选,可以为空。
- “ExtraParams”可选,可以为空。
- “ProductSN”可选,可以为空。
- “ROIs”可选,要求为list类型。
- “ExtraParams”可选,要求为dict类型。
- “Patterns”必选,参数为配准模板,为空list时,代表异物检测模式。
- “RegisterMatrix”可选,为旋转偏移矩阵,大小必须为3 * 3。为空或不传表示使用系统的配准功能(检测框和模板框个数都必须大于或等于2),不为空表示使用视觉软件或其他工具计算出出来的旋转偏移矩阵。
- “MatchParams”"必选,“MatchParams”中 “reg_params”、“global_thresh”、“label_spec_thresh”三个字段内容为可选。
{ "ProjectName": "project_ssd_resnet", "TaskName": "assm1-2", "TaskType": "WithReg", "MachineId": "123", "ProductCode": "123", "ProductSN": "121", "TableName": "AI_Test", "CameraID": "123", "ROIs": [{"X": 100, "Y": 100, "Width": 4000, "Height": 3000, "Type": "include/exclude"}], "CodeType": "jpg", "Patterns": [{"Height": 150, "Label": "Screw", "Width": 139, "X": 967, "Y": 2341, "detail_label": "", "num_match": 1, "overlap_metric": "IOU", "overlap_thresh": 0.3,"conf_thresh": 0.5}, {"Height": 156, "Label": "Screw", "Width": 144, "X": 1004, "Y": 814, "detail_label": "", "num_match": 1, "overlap_metric": "IOU", "overlap_thresh": 0.3,"conf_thresh": 0.5}, {"Height": 155, "Label": "Screw", "Width": 150, "X": 3578, "Y": 869, "detail_label": "", "num_match": 1, "overlap_metric": "IOU", "overlap_thresh": 0.3,"conf_thresh": 0.5}, {"Height": 148, "Label": "Screw", "Width": 135, "X": 3463, "Y": 2402, "detail_label": "", "num_match": 1, "overlap_metric": "IOU", "overlap_thresh": 0.3}, {"Height": 164, "Label": "Screw", "Width": 160, "X": 1978, "Y": 2107, "detail_label": "", "num_match": 1, "overlap_metric": "IOU", "overlap_thresh": 0.3}, {"Height": 147, "Label": "Screw", "Width": 144, "X": 1138, "Y": 1104, "detail_label": "", "num_match": 1, "overlap_metric": "IOU", "overlap_thresh": 0.3} , {"Height": 85, "Label": "Screw", "Width": 83, "X": 1766, "Y": 1510, "detail_label": "", "num_match": 1, "overlap_metric": "IOU", "overlap_thresh": 0.3}], "Files": [{"FileName": "infer_test.jpg", "ImageData": "图片数据的base64编码"}], "MatchParams": {"reg_params": {"iou_thre": 0.5,"transform_guess": [[0.6, -0.05, 103], [0.5, 0.3, 220], [0, 1, 1]],"search_angle_range": [0, 45, -45, 180, 90, -90, 135, -135],"transform_type": "rigid","extension_ratio": 1}, "global_thresh": {"conf_thresh": 0.5, "overlap_thresh": 0.3, "overlap_metric": "IOU"}, "label_spec_thresh": [{"label": "Screw", "conf_thresh": 0.5, "overlap_thresh": 0.3, "overlap_metric": "IOU"}]}, "RegisterMatrix": [[1, 0, 0], [0, 1, 0], [0, 0, 1]] }
“RegisterMatrix”字段用于计算旋转偏移矩阵。
- 如果传入“RegisterMatrix”,必须为3 * 3数字矩阵,使用此旋转偏移矩阵完成配准。
- 如果未传入“RegisterMatrix”,则系统会根据传入的“Patterns”和检测框结果计算出一个最佳旋转平移矩阵用于配准,但需要注意使用系统自带配准需满足检测目标大于或等于2个。(未传入“RegisterMatrix”的情况包括如下几种情况:无“RegisterMatrix”字段、 "RegisterMatrix" : [])如需调整系统自带配准算法相关参数,可参考表12,对“MatchParams”的“reg_params”相关字段进行设置。
- det_det模式
{ "ProjectName": "project_ssd_ssd", "TaskName": "assm1-2", "MachineId": "123", "ProductCode": "123", "ProductSN": "121", "TableName": "AI_Test", "CameraID": "11", "CodeType": "jpg", "Files": [{"FileName": "infer_test.jpg", "ImageData": "图片数据的base64编码"}], "ExtraParams": {} }
- 异物检测模式参数说明:
- “TaskType”字段值必须为“WithReg”。
- “Patterns”字段值必须为空list,不允许为None。
- “MatchParams”字段可以为空。
- “ProductSN”可选,其他字段要求与WithReg模式模式一致。
{ "ProjectName": "project_ssd", "TaskName": "assm1-2", "TaskType": "WithReg", "MachineId": "123", "ProductCode": "123", "ProductSN": "121", "TableName": "AI_Test", "CameraID": "11", "CodeType": "jpg", "Files": [{"FileName": "infer_test.jpg", "ImageData": "图片数据的base64编码"}], "ROIs":[], "Patterns":[], "MatchParams": {"global_thresh": {"conf_thresh": 0.5, "overlap_thresh": 0.3, "overlap_metric": "IOU"}, "label_spec_thresh": [{"label": "Screw", "conf_thresh": 0.5, "overlap_thresh": 0.3, "overlap_metric": "IOU"}]}, "RegisterMatrix": [[1, 0, 0], [0, 1, 0], [0, 0, 1]] }
工业OCR
- CRNN
- 参数说明:
- “ExtraParams”、“ProductSN”为可选参数,其他为必选参数且参数值都不能为空。
{ "ProjectName": "project_crnn", "TaskName": "assm1-2", "TaskType": "WithReg", "MachineId": "123", "ProductCode": "123", "ProductSN": "121", "TableName": "AI_Test", "CameraID": "123", "Files": [{"FileName": "infer_test.jpg", "ImageData": "图片数据的base64编码"}], "CodeType": "JPG", "ExtraParams":{} }
- 参数说明:
- CTPN_CRNN参数说明:
- “ExtraParams”、“ProductSN”为可选参数,其他为必选参数且参数值都不能为空。
{ "ProjectName": "project_ctpn_crnn", "TaskName": "assm1-2", "TaskType": "WithReg", "MachineId": "123", "ProductCode": "2323", "ProductSN": "121", "TableName": "AI_Test", "CameraID": "23", "Files": [{"FileName": "infer_test.jpg", "ImageData": "图片数据的base64编码"}], "CodeType": "JPG", "ExtraParams":{} }
- det_ocr模式:
{ "ProjectName":"project_ssd_crnn", "TaskName":"assm1-2", "MachineId": "123", "ProductCode": "123", "ProductSN": "121", "TableName": "AI_Test", "CameraID": "11" "CodeType":"jpg", "Files":[{ "FileName":"infer_test.jpg", "ImageData":"base64编码后的图像数据" }], "ExtraParams":{} }
胶体检测
- WithoutReg模式:
{ "ProjectName": "project_unet++", "TaskName": "assm1-2", "TaskType": "WithoutReg", "CodeType": "JPG", "Files": [{"FileName": "infer_test.jpg", "ImageData": "图片数据的base64编码"}], "ExtraParams": {} }
- SetTemplate模式:
{ "ProjectName": "project_unet", "TaskName": "assm1-2", "TaskType": "SetTemplate", "MachineId": "123", "ProductCode": "123", "ProductSN": "121", "TableName": "AI_Test", "CameraID": "123", "CodeType": "JPG", "Template": { "CodeType": "JPG", "BlobMask": "Base64编码后的图像数据", "Blobs": [{"Area": 1873, "ID": 1, "Label": "battery"}, {"Area": 71, "ID": 2, "Label": "fan"}], "SelectBlobs": [1, 2] } }
- WithReg模式:
{ "ProjectName": "project_unet", "TaskName": "assm1-2", "TaskType": "WithReg", "MachineId": "123", "ProductCode": "123", "ProductSN": "121", "TableName": "AI_Test", "CameraID": "123", "CodeType": "JPG", "Files": [{"FileName": "infer_test.jpg", "ImageData": "Base64编码后的图像数据"}], "RegisterMatrix": [[1, 0, 0], [0, 1, 0], [0, 0, 1]], "MatchParams": {"overlap_thresh": 0.5, "overlap_metric": "IOU"} }
- det_seg模式:
{ "ProjectName":"project_ssd_unet", "TaskName":"assm1-2", "MachineId":"None", "ProductCode":"None", "TableName":"AI_Test", "ProductSN": "121", "CameraID":"1", "CodeType":"JPEG", "Files":[ { "FileName":"test.jpg", "ImageData":"base64编码后的图像数据" } ], "ExtraParams":{ "extra_name":"extra_value", "extra_name2":"extra_name2" } }

- SetTemplate模式下,设置模板将以 “MachineId”、“CameraID”、“ProductCode ”3个字段的组合作为键存储模板。
- WithReg模式下,将根据“MachineId”、“CameraID”、“ProductCode ”3个字段的组合,取出相应的模板完成带配准的胶体检测。
因此如需设置多个模板,需保持这3个字段的组合不同。
标签外观缺陷检测
参数说明:
“ExtraParams”、“ProductSN”为可选参数,其他为必选参数且参数值都不能为空。
{ "ProjectName" : "tag_paste", "TaskName" : "tag_paste", "MachineId" : "123", "ProductCode" : "2323", "ProductSN": "121", "TableName" : "AI_Test", "CameraID" : "23", "Files" : [{"FileName" : "infer_test", "ImageData" : "Base64编码后的图像数据"}], "CodeType" : "JPG", "ExtraParams":{} }
半导体质检
{ "ProjectName" : "project_wafer", "TaskName" : "assm1-2", "Files" : [ { "FileName" : "wafer.jpg", "ImageData" : "Base64编码后的图像数据", "Content": { "x_img": '11926.4563382787', "y_img": '981.054314524084', "setup_id": 'Layer3', "device": '00002', "deviceshort": "H01FOI00002A", "station_name": 'station' } } ] }
父主题: 推理API