😎优化PaddleOCRSharp初始化
This commit is contained in:
parent
d76cde34c6
commit
d9ece804fb
@ -17,14 +17,14 @@
|
|||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Remove="Configuration\App.*.json"/>
|
<Content Remove="Configuration\App.*.json" />
|
||||||
<Content Include="Configuration\App.*.json">
|
<Content Include="Configuration\App.*.json">
|
||||||
<DependentUpon>App.json</DependentUpon>
|
<DependentUpon>App.json</DependentUpon>
|
||||||
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
|
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Remove="Configuration\Database.*.json"/>
|
<Content Remove="Configuration\Database.*.json" />
|
||||||
<Content Include="Configuration\Database.*.json">
|
<Content Include="Configuration\Database.*.json">
|
||||||
<DependentUpon>Database.json</DependentUpon>
|
<DependentUpon>Database.json</DependentUpon>
|
||||||
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||||
|
|||||||
@ -18,6 +18,7 @@ namespace Admin.NET.Plugin.PaddleOCR.Service;
|
|||||||
public class PaddleOCRService : IDynamicApiController, ISingleton
|
public class PaddleOCRService : IDynamicApiController, ISingleton
|
||||||
{
|
{
|
||||||
private readonly PaddleOCREngine _engine;
|
private readonly PaddleOCREngine _engine;
|
||||||
|
private readonly PaddleStructureEngine _structengine;
|
||||||
|
|
||||||
public PaddleOCRService()
|
public PaddleOCRService()
|
||||||
{
|
{
|
||||||
@ -56,13 +57,19 @@ public class PaddleOCRService : IDynamicApiController, ISingleton
|
|||||||
//config.rec_infer = modelPathroot + @"\ch_PP-OCRv4_rec_server_infer";
|
//config.rec_infer = modelPathroot + @"\ch_PP-OCRv4_rec_server_infer";
|
||||||
//config.keys = modelPathroot + @"\ppocr_keys.txt";
|
//config.keys = modelPathroot + @"\ppocr_keys.txt";
|
||||||
|
|
||||||
// 参数
|
//// 参数
|
||||||
OCRParameter oCRParameter = new OCRParameter();
|
//OCRParameter oCRParameter = new OCRParameter();
|
||||||
// oCRParameter.use_gpu=true; // 当使用GPU版本的预测库时,该参数打开才有效果
|
// oCRParameter.use_gpu=true; // 当使用GPU版本的预测库时,该参数打开才有效果
|
||||||
// oCRParameter.enable_mkldnn = false;
|
// oCRParameter.enable_mkldnn = false;
|
||||||
|
|
||||||
// 初始化OCR引擎
|
// 初始化OCR引擎
|
||||||
_engine = new PaddleOCREngine(config, oCRParameter);
|
_engine = new PaddleOCREngine(config, "");
|
||||||
|
|
||||||
|
// 模型配置,使用默认值
|
||||||
|
StructureModelConfig structureModelConfig = null;
|
||||||
|
// 表格识别参数配置,使用默认值
|
||||||
|
StructureParameter structureParameter = new();
|
||||||
|
_structengine = new PaddleStructureEngine(structureModelConfig, structureParameter);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user