视觉控制检测 (OmniParser)
我们还支持使用 OmniParser-v2 进行视觉控制检测。此方法有助于检测应用程序中可能无法被标准 UIA 方法识别的自定义控件。视觉控制检测使用计算机视觉技术,根据其视觉外观来识别和交互 UI 元素。
部署
在您的远程 GPU 服务器上,克隆 OmniParser 仓库
git clone https://github.com/microsoft/OmniParser.git
启动 omniparserserver
服务
cd OmniParser/omnitool/omniparserserver
python gradio_demo.py
这将为您提供一个短 URL
* Running on local URL: http://0.0.0.0:7861
* Running on public URL: https://xxxxxxxxxxxxxxxxxx.gradio.live
注意:如果您对 OmniParser 的部署有任何疑问,请查阅 OmniParser 仓库中的 README 文件。
配置
部署 OmniParser 模型后,您需要在 config.yaml
文件中配置 OmniParser 设置
OMNIPARSER: {
ENDPOINT: "<YOUR_END_POINT>", # The endpoint for the omniparser deployment
BOX_THRESHOLD: 0.05, # The box confidence threshold for the omniparser, default is 0.05
IOU_THRESHOLD: 0.1, # The iou threshold for the omniparser, default is 0.1
USE_PADDLEOCR: True, # Whether to use the paddleocr for the omniparser
IMGSZ: 640 # The image size for the omniparser
}
要激活图标控制过滤,您需要在 config_dev.yaml
文件中将 CONTROL_BACKEND
设置为 ["omniparser"]
。
CONTROL_BACKEND: ["omniparser"]
参考
以下类用于 OmniParser 中的视觉控制检测
基类:BasicGrounding
OmniparserGrounding 类是 BasicGrounding 的子类,用于表示 Omniparser 基础模型。
parse_results(results, application_window=None)
将基础结果字符串解析为控件元素信息字典列表。
参数 |
|
---|
返回 |
|
---|
源代码位于 automator/ui_control/grounding/omniparser.py
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
|
predict(image_path, box_threshold=0.05, iou_threshold=0.1, use_paddleocr=True, imgsz=640, api_name='/process')
预测给定图像的基础。
参数 |
|
---|
返回 |
|
---|
源代码位于 automator/ui_control/grounding/omniparser.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
|