Azure 搜索 - 亮点 - 在图像中定位

Azure Search - Highlights - Locating in image

只是在此处寻找指导或什至是方法的大纲。

我正在使用 Azure 搜索对一批 pdf 进行 OCR。我已经打开了命中突出显示,并且我成功地获得了结果,我正在为最终用户循环/显示在我的视图中。我正在考虑将该功能扩展到 show pdf 图像,并在图像本身上突出显示,就像 JFK azure 示例中那样。我对react不精通,好像迷路了

我假设我需要使用创建的 normalized_images 将 OCR 图像保存到数据存储中以供参考?我在本地确实有可以加载的 pdf,但假设 OCR 图像可能不同。已打开 GeneratedNormalizedImagesPerPage 并打开在我的存储帐户中创建文件的缓存。

那么我假设我需要拉出相关图像,显示它,使用突出显示结果并在检测到短语的地方拉出相应的边界框?这种方法的问题是我没有看到高亮命中和命中位置(边界框)之间的任何关联,也没有看到命中所在的相关图像文件。

这里的方法可能有点偏,但欢迎任何指导。

编辑 1 我确实注意到 JFK 示例中此页面上的项目:https://github.com/microsoft/AzureSearch_JFK_Files/tree/master/JfkWebApiSkills/JfkWebApiSkills 尝试将 ImageStore(因此它们存储在我的存储帐户中)然后将 HocrGenerator(似乎处理文档中的点)复制到我的索引技能集中是一种方法吗?

这里有几个步骤:

  1. 您需要保存 layoutText from the OCR skill somewhere the UI can access it. The JFK Files demo converts it to a HOCR (to display in the UI) and saves it in index as a field in the index so that it is retrieved in the search results. HOCR isn't necessary and you may find it more efficient to store the layout in blobs using a knowlege store object projection

  2. 使用 file projection into the knowledge store. Keep in mind that the images may be resized in the process and the coordinates will match the resized image saved to the store. If you want to map the coordinates to the original image see this.

    将提取的图像保存到 blob 存储中
  3. 在搜索时,将突出显示映射到元数据。您将在 nodejs 前端找到此代码,但在 the original demo by following the code here 中遵循它可能更简单。本质上,您只需找到元数据中突出显示的单词的第一次出现,显示关联的图像,并计算单词的边界区域。