@@ -742,7 +742,13 @@ RapidOCR输出包括4种类型:`Union[TextDetOutput, TextClsOutput, TextRecOut
742742 ```python linenums="1" hl_lines="3"
743743 from rapidocr import RapidOCR
744744
745- engine = RapidOCR(params={"Global.with_torch": True})
745+ engine = RapidOCR(
746+ params={
747+ "Det.engine_type": EngineType.TORCH,
748+ "Cls.engine_type": EngineType.TORCH,
749+ "Rec.engine_type": EngineType.TORCH,
750+ }
751+ )
746752
747753 img_url = "https://github.com/RapidAI/RapidOCR/blob/main/python/tests/test_files/ch_en_num.jpg?raw=true"
748754 result = engine(img_url)
@@ -761,6 +767,8 @@ RapidOCR输出包括4种类型:`Union[TextDetOutput, TextClsOutput, TextRecOut
761767 "Det.engine_type": EngineType.TORCH,
762768 "Cls.engine_type": EngineType.TORCH,
763769 "Rec.engine_type": EngineType.TORCH,
770+ "EngineConfig.torch.use_cuda": True, # 使用torch GPU版推理
771+ "EngineConfig.torch.gpu_id": 0, # 指定GPU id
764772 }
765773 )
766774
@@ -784,7 +792,11 @@ RapidOCR输出包括4种类型:`Union[TextDetOutput, TextClsOutput, TextRecOut
784792
785793### 使用本地已下载模型
786794
787- 使用方法同样也是有两种:一是通过配置文件传入;二是通过初始化参数传入。下面以通过初始化参数传入为例:
795+ 使用方法同样也是有两种:一是通过配置文件传入;二是通过初始化参数传入。
796+
797+ ⚠️注意:Paddle格式模型需要传入` model_dir ` 来传入
798+
799+ 下面以通过初始化参数传入为例:
788800
789801``` python linenums="1" hl_lines="4"
790802from rapidocr import RapidOCR
0 commit comments