目标检测方法 Args: img: 图片数据 Returns: 检测到的边界框列表 Raises: DDDDOCRError: 当功能未启用或检测失败时
(self, img: Union[bytes, str, pathlib.PurePath, Image.Image])
| 127 | ) |
| 128 | |
| 129 | def detection(self, img: Union[bytes, str, pathlib.PurePath, Image.Image]) -> List[List[int]]: |
| 130 | """ |
| 131 | 目标检测方法 |
| 132 | |
| 133 | Args: |
| 134 | img: 图片数据 |
| 135 | |
| 136 | Returns: |
| 137 | 检测到的边界框列表 |
| 138 | |
| 139 | Raises: |
| 140 | DDDDOCRError: 当功能未启用或检测失败时 |
| 141 | """ |
| 142 | if not self.det: |
| 143 | raise DDDDOCRError("当前识别类型为OCR") |
| 144 | |
| 145 | if not self.detection_engine: |
| 146 | raise DDDDOCRError("目标检测功能未初始化") |
| 147 | |
| 148 | return self.detection_engine.predict(img) |
| 149 | |
| 150 | def slide_match(self, target_img: Union[bytes, str, pathlib.PurePath, Image.Image], |
| 151 | background_img: Union[bytes, str, pathlib.PurePath, Image.Image], |
no test coverage detected