MCPcopy
hub / github.com/sml2h3/ddddocr / initialize

Method initialize

ddddocr/core/detection_engine.py:34–47  ·  view source on GitHub ↗

初始化检测引擎 Raises: ModelLoadError: 当初始化失败时

(self, **kwargs)

Source from the content-addressed store, hash-verified

32 self.initialize()
33
34 def initialize(self, **kwargs) -> None:
35 """
36 初始化检测引擎
37
38 Raises:
39 ModelLoadError: 当初始化失败时
40 """
41 try:
42 # 加载检测模型
43 self.session = self.model_loader.load_detection_model()
44 self.is_initialized = True
45
46 except Exception as e:
47 raise ModelLoadError(f"检测引擎初始化失败: {str(e)}") from e
48
49 def predict(self, image: Union[bytes, str, Image.Image]) -> List[List[int]]:
50 """

Callers 1

__init__Method · 0.95

Calls 2

ModelLoadErrorClass · 0.85
load_detection_modelMethod · 0.80

Tested by

no test coverage detected