Azure AI文档智能Studio与.NET客户端结果不一致问题咨询
排查Azure Document Intelligence预构建健康保险卡模型识别差异问题
校验文件一致性
先确认.NET代码读取的文件和Document Intelligence Studio上传的文件完全一致:计算两个文件的MD5哈希值,确保没有文件损坏、格式转换或内容差异。如果文件存在倾斜、低分辨率或模糊情况,尝试先对图像做预处理(比如旋转至正确方向、提升分辨率)后再测试。对齐请求参数
打开开发者工具查看Studio发送的完整请求体,对比你的.NET代码请求,补充缺失的参数:- 检查是否指定了
locale参数(健康保险卡模型通常需要指定en-US),添加到调用中:var result = await client.AnalyzeDocumentAsync(WaitUntil.Completed, "prebuilt-healthInsuranceCard.us", content, stringIndexType: StringIndexType.Utf16CodeUnit, locale: "en-US"); - 确认是否启用了额外分析功能(比如条码识别,部分保险卡会员ID嵌入条码),可以添加
features参数:var result = await client.AnalyzeDocumentAsync(WaitUntil.Completed, "prebuilt-healthInsuranceCard.us", content, stringIndexType: StringIndexType.Utf16CodeUnit, locale: "en-US", features: new List<AnalyzeDocumentFeature> { AnalyzeDocumentFeature.Barcodes });
- 检查是否指定了
更换上传方式
尝试将Base64上传改为流上传,避免Base64编码可能带来的潜在问题:using var stream = new FileStream(insuranceCardPath, FileMode.Open, FileAccess.Read); var content = new AnalyzeDocumentContent(); content.StreamSource = stream; var result = await client.AnalyzeDocumentAsync(WaitUntil.Completed, "prebuilt-healthInsuranceCard.us", content, stringIndexType: StringIndexType.Utf16CodeUnit, locale: "en-US");对比API响应细节
将.NET客户端返回的结果序列化为JSON,和Studio的响应做逐字段对比:重点查看documents下的字段是否缺失,模型识别的文本区域(boundingRegions)是否一致,以此定位是字段映射问题还是识别区域问题。指定最新模型版本
尝试在调用时明确指定最新模型版本,确保使用和Studio相同的模型实例:var result = await client.AnalyzeDocumentAsync(WaitUntil.Completed, "prebuilt-healthInsuranceCard.us@latest", content, stringIndexType: StringIndexType.Utf16CodeUnit, locale: "en-US");
内容的提问来源于stack exchange,提问作者Travis Troyer
相关产品推荐
相关产品推荐

