UiPath Documentation
document-understanding
2021.10
false
Document Understanding 用户指南
重要 :
新发布内容的本地化可能需要 1-2 周的时间才能完成。

OCR 服务

关于 OCR 服务

OCR 服务用于以下目的:

  • 在数据加标签时,当将文档导入 Data Manager 时。此步骤可用的引擎包括 UiPath Document OCR、Google Cloud Vision OCR 和 Microsoft Read OCR。
  • 在运行时,从 RPA 工作流调用模型时。此步骤可用的引擎是与 UiPath RPA 平台集成的所有引擎,包括上述引擎,以及 Abbyy Finereader、Microsoft OCR(旧版)、Microsoft Project Oxford OCR 和 Tesseract。

In production, we recommend calling the OCR using the Digitize Document activity in your workflow and passing the Document Object Model as input to the activity calling the ML model. For this purpose, you need to use the Machine Learning Extractor activity (Official feed).

为便于测试,您也可以直接在 AI Center(“设置”窗口)中配置 OCR,但对于生产部署不建议这样做。

要求

本节详细介绍了安装 OCR 引擎的硬件要求和软件要求。

硬件要求

  • 涉及的计算机:云虚拟机/内部部署计算机/笔记本电脑
  • 操作系统:Windows (Windows 10)/Linux (Ubuntu/RedHat)
  • 计算引擎:CPU/GPU
  • OCR:UiPath 文档 OCR CPU/UiPath 文档 OCR GPU
CPU 核心RAM (GB)视频 RAM (GB)硬盘 (GB)
UiPath CPU4450
UiPath GPU14850

软件要求

Linux 操作系统

如果您在云虚拟机上安装产品,则支持以下操作系统:

Software版本
Ubuntu20.04 LTS

18.04 LTS

16.04 LTS
RHEL7.x

如果您在内部部署数据中心的计算机上安装产品,则支持以下操作系统:

软件版本
Ubuntu20.04 LTS

18.04 LTS

16.04 LTS
RHEL7.x
Windows 操作系统

See the official Docker website for the list of Windows operating systems supported.

在 Windows 上,您的计算机需要启用虚拟化。我们强烈建议您仅在笔记本电脑或桌面工作站等物理计算机上执行此操作。我们不支持使用嵌套虚拟化技术在虚拟机(云或数据中心)的 Windows 上的 Docker 上运行。

浏览器
软件版本
Google Chrome50+

网络配置

  • Data Manager 需要访问 OCR 引擎 <IP>:<port_number>。OCR 引擎可能是内部部署 UiPath Document OCR、Google Cloud Vision OCR、Microsoft Read Azure 或内部部署 Microsoft Read。
  • 机器人需要访问 OCR <IP>:<port_number>。与上述相同的 OCR 选项。
  • OCR 引擎需要通过端口 443 访问 Azure 中 UiPath 托管的许可服务器。

最低试用配置或概念验证配置

如果您只想提供开箱即用的预训练模型,则可以在 Windows 10 笔记本电脑上运行 OCR 引擎。请确保 Docker Desktop 具有 8G RAM 可用。

如果要尝试以少量数据(不足 100 个文档)将自定义模型作为演示进行训练,您可以在 RAM 限制为 4GB 的环境中运行 OCR 引擎。对于此类小型用例,可能不需要用于 OCR 引擎的 GPU。

先决条件

OCR 引擎是在 Docker 之上运行的容器化应用程序。不能在与内部部署 AI Center 相同的计算机上运行这些 OCR 引擎。为了在单独的计算机上运行它们,可以使用下面的先决条件安装程序命令来设置 Docker,并选择性地安装 NVidia 驱动程序。这些脚本不应在将安装 AI Center 的计算机上运行。

重要提示:

Docker 映像的大小可能多达数 GB,因此 Docker 在 Linux 上用于保存其文件的文件夹必须位于足够大的分区上,以免空间不足。默认情况下,它始终位于根分区上。

要查看根分区的大小,请在终端中键入以下内容,并在最右侧的列中查找具有 / 的行:

df -h
df -h

If the size of that partition is smaller than the minimal storage requirements, then see the Configuring the Docker Data Folder section.

安装 Docker

Linux

Follow instructions in the official Docker documentation, or run this command:

curl -fsSL https://raw.githubusercontent.com/UiPath/Infrastructure/master/ML/du_prereq_installer.sh | sudo bash -s -- --env cpu
curl -fsSL https://raw.githubusercontent.com/UiPath/Infrastructure/master/ML/du_prereq_installer.sh | sudo bash -s -- --env cpu

If this command fails, then you have an incompatible Linux operating system and you need to request your IT to install Docker on the machine following the instructions in the official Docker documentation.

Azure 虚拟机

如果要在 Azure 虚拟机上安装,请改用此命令:

curl -fsSL https://raw.githubusercontent.com/UiPath/Infrastructure/master/ML/du_prereq_installer.sh | sudo bash -s -- --env cpu --cloud azure
curl -fsSL https://raw.githubusercontent.com/UiPath/Infrastructure/master/ML/du_prereq_installer.sh | sudo bash -s -- --env cpu --cloud azure
Windows 10

Download and install Docker Desktop. On recently updated versions of Windows 10, you will need WSL2 installed. So when presented with a dialog saying "WSL 2 Installation is Incomplete" please click the Restart button.

运行 Data Manager 时,您需要为每个 Docker 容器创建一个工作文件夹(对于 Data Manager,可能名为 workdir),并将其路径包含在 docker run 命令中的 -v 标志后面。在 Windows 上执行此操作时,Docker Desktop 将弹出如下通知。您需要单击“共享”以继续。

配置 Docker 数据文件夹(仅限 Linux)

填写您希望 Docker 将其文件保存到的文件夹的路径,然后运行此命令,接着重新启动:

curl -fsSL https://raw.githubusercontent.com/UiPath/Infrastructure/master/ML/du_prereq_installer.sh | sudo bash -s -- --change-mount </path/to/folder>
curl -fsSL https://raw.githubusercontent.com/UiPath/Infrastructure/master/ML/du_prereq_installer.sh | sudo bash -s -- --change-mount </path/to/folder>

Docker 速查表

Docker 帮助以“Docker 映像”形式发布软件。映像的运行实例称为容器。只要有映像,就可以根据需要多次停止、删除和重新启动容器。

删除映像后,映像将丢失。恢复映像的唯一方法是,如果它仍然存在,请从它来自的注册表中再次拉取它。

A running container is analogous to a small Virtual Machine, in that it has an internal filesystemand network interfaces, which are separate from the host machine filesystem and network. Folders and ports can be mapped from the container to the host using –v and –p arguments, respectively.

在下表中,您可以找到 Docker 命令行的常用命令列表。

Click here for the full list of base Docker commands.

命令描述
docker login <registry name> -u <username> -p <password>登录到注册表。
docker pull <registry name>/<image name>:<image tag>从注册表下载映像。标签“latest”通常用于指代映像的最新版本。
docker run –d -p 5000:80 <registry name>/<image name>:<image tag>



docker run –d –p 5000:80 <image id>
Run an image in detached mode, while mapping port 80 from inside the container to port 5000 on the host machine, and <container folder> to <host folder>. Detached mode means the container does not block the terminal, so you can perform other operations on the same terminal.
docker images列出系统中存在的映像。
docker ps –a列出所有容器(正在运行和已停止)。

The container id is used to refer to that container when one needs to stop it or remove it, for instance.
docker stop <container id>停止容器

此命令不会删除容器,但在删除容器之前需要执行此命令。
docker rm <container id>删除容器

必须事先停止容器。
docker logs <container id>并显示容器的日志。
docker rmi <image id>从系统中删除一个或多个映像

这可帮助节省存储空间,因为映像可能会占用大量空间。
Docker container prune -f删除所有已停止的容器

Linux 终端速查表

命令描述
sudo <any_command>以管理员身份运行命令。遇到“权限被拒绝”错误时,请尝试此方法。
ifconfig显示有关系统中网络接口的信息。在 eth0 或 docker0 部分中找到您的计算机 IP。
pwd显示当前文件夹的路径。
ls列出目录的内容。
cd <folder_name>转到其他文件夹。
mkdir <folder_name>创建新文件夹。

(可选)GPU 计算机安装

Linux

运行以下命令:

curl -fsSL https://raw.githubusercontent.com/UiPath/Infrastructure/master/ML/du_prereq_installer.sh | sudo bash -s -- --env gpu
curl -fsSL https://raw.githubusercontent.com/UiPath/Infrastructure/master/ML/du_prereq_installer.sh | sudo bash -s -- --env gpu

在某些系统上必须运行此命令两次,否则可能需要重新启动系统以安装所要求的所有依赖项。

Azure Specific: To use the NV-series virtual machines you need to either install the NVIDIA driver before executing the above command, or you can use a Driver Extension from Azure to install the necessary NVIDIA driver according to that tier GPU model.

Azure 虚拟机

如果要在 Azure 虚拟机上安装,请改用此命令:

curl -fsSL https://raw.githubusercontent.com/UiPath/Infrastructure/master/ML/du_prereq_installer.sh | sudo bash -s -- --env gpu --cloud azure
curl -fsSL https://raw.githubusercontent.com/UiPath/Infrastructure/master/ML/du_prereq_installer.sh | sudo bash -s -- --env gpu --cloud azure

安装

UiPath 文档 OCR

UiPath 文档 OCR 是 UiPath 的专有 OCR 技术,支持以下拉丁语脚本语言使用的字符:英语、法语、德语、意大利语、葡萄牙语、罗马尼亚语和西班牙语。该技术能够识别其他语言的文本,但不带重音符号,例如,波兰语中的“Ł”将被识别为“L”。使用 UiPath 文档 OCR 处理的页面不计入与 Document Understanding 企业版许可证一起购买的页面配额,因此 UiPath 文档 OCR 可免费使用。

UiPath 文档 OCR 可用于以下部署类型:

  • cloud public URLs - more details on the Public Endpoints page
  • 使用 UiPath.DocumentUnderstanding.OCR. 本地服务器活动包(无需互联网访问)的内部部署(包括离线部署)
  • 内部部署的常规独立 Docker 容器(需要互联网访问)
  • 内部部署的离线独立 Docker 容器(无需互联网访问)
  • 在 AI Center 常规部署中作为 ML 技能进行内部部署(需要访问互联网)
  • 在 AI Center 离线部署中作为 ML 技能进行内部部署(无需互联网访问)
  1. 要安装 UiPath 文档 OCR 独立 Docker 容器,请运行以下命令:

    docker login aiflprodweacr.azurecr.io -u *** -p **docker pull aiflprodweacr.azurecr.io/uipath-ocr:latest
    docker login aiflprodweacr.azurecr.io -u *** -p **docker pull aiflprodweacr.azurecr.io/uipath-ocr:latest
    
  2. 使用 CPU 运行

    docker run -d -p 5000:80 aiflprodweacr.azurecr.io/uipath-ocr:latest LicenseAgreement=accept
    docker run -d -p 5000:80 aiflprodweacr.azurecr.io/uipath-ocr:latest LicenseAgreement=accept
    
  3. 使用 GPU 运行

    docker run -d -p 5000:80 --gpus all aiflprodweacr.azurecr.io/uipath-ocr:latest LicenseAgreement=accept
    docker run -d -p 5000:80 --gpus all aiflprodweacr.azurecr.io/uipath-ocr:latest LicenseAgreement=accept
    
  4. 在 AI Center 中,当创建新的 ML 包时,屏幕底部有一个可选的 OCR 配置部分,您可以在其中定义服务器端 OCR 引擎类型、OCR URL 和 OCR 密钥。OCR 密钥是您从 Automation Cloud 帐户的“许可证”部分获取的 API 密钥。如果您选中“使用服务器端 OCR”复选框,则机器学习提取程序活动将使用此 OCR 配置。默认情况下,此复选框处于未选中状态,在这种情况下,提取程序将在“数字化文档”活动中使用 OCR。

    重要提示:

    UiPath 文档 OCR 容器不能与内部部署 AI Center 在同一台计算机上运行。

Google Cloud OCR

The endpoint can be obtained from the Google Cloud Platform documentation. The ApiKey can be obtained from your Google Cloud Platform Console if you have a Google Cloud Vision service in your subscription.

Microsoft Read

重要提示:

适用于 Azure 和内部部署容器端点。

对于 Azure 服务,您需要同时提供端点和 API 密钥

对于内部部署容器端点,则不需要提供 API 密钥

在 Data Manager 和 AI Center Document Understanding ML 包中配置 OCR 服务

下表显示了如何在 Data Manager 和 AI Center 中配置 6 种受支持的 OCR 引擎类型。

OCR 引擎OCR 方法OCR 密钥OCR URL
UiPathUiPath 文档 OCRUiPath Automation Cloud

Document Understanding API 密钥

企业计划
http://<IP_addr>:<port_number>
GoogleGoogle Cloud Vision OCRGCP 控制台 API 密钥https://vision.googleapis.com/v1/images:annotate
Microsoft Read 2.0 内部部署Microsoft Read OCRhttp://<IP_addr>:<port_number>/vision/v2.0/read/core/Analyze
Microsoft Read 2.0 AzureMicrosoft Read OCR来自 Azure 门户的资源的 API 密钥<Azure_resource_Endpoint>/vision/v2.0/read/core/asyncBatchAnalyze
Microsoft Read 3.2 内部部署Microsoft Read OCRhttp://<IP_addr>:<port_number>/vision/v3.2/read/analyze
Microsoft Read 3.2 AzureMicrosoft Read OCR来自 Azure 门户的资源的 API 密钥<Azure_resource_Endpoint>/vision/v3.2/read/analyze

此页面有帮助吗?

连接

需要帮助? 支持

想要了解详细内容? UiPath Academy

有问题? UiPath 论坛

保持更新