![]() |
VOOZH | about |
dotnet add package PaddleOCR.Onnx --version 1.2.0
NuGet\Install-Package PaddleOCR.Onnx -Version 1.2.0
<PackageReference Include="PaddleOCR.Onnx" Version="1.2.0" />
<PackageVersion Include="PaddleOCR.Onnx" Version="1.2.0" />Directory.Packages.props
<PackageReference Include="PaddleOCR.Onnx" />Project file
paket add PaddleOCR.Onnx --version 1.2.0
#r "nuget: PaddleOCR.Onnx, 1.2.0"
#:package PaddleOCR.Onnx@1.2.0
#addin nuget:?package=PaddleOCR.Onnx&version=1.2.0Install as a Cake Addin
#tool nuget:?package=PaddleOCR.Onnx&version=1.2.0Install as a Cake Tool
本项目使用ONNX模型,速度更快。本项目同时支持X64和X86的CPU上上用。 本项目是一个基于PaddleOCR的C++代码修改并基于Microsoft.ML封装的.NET的工具类库。包含文本识别、文本检测、基于文本检测结果的统计分析的表格识别功能,同时针对小图识别不准的情况下,做了优化,提高识别准确率。包含总模型仅8.6M的超轻量级中文OCR,单模型支持中英文数字组合识别、竖排文本识别、长文本识别。同时支持多种文本检测。 项目封装极其简化,实际调用仅几行代码,极大的方便了中下游开发者的使用和降低了PaddleOCR的使用入门级别,同时提供不同的.NET框架使用,方便各个行业应用开发与部署。Nuget包即装即用,可以离线部署,不需要网络就可以识别的高精度中英文OCR。
目前不支持win7及以下操作系统。
本项目目前支持以下NET框架:
net461;net462;net47;net471;net48;net481;
netstandard2.0;netcoreapp3.1;
net5.0;net6.0;net7.0;
代码推荐使用VS2022版本编译。
OCR识别模型库支持官方所有的模型,也支持自己训练的模型。
本项目部署自带的一种轻量版8.6M模型库、服务器版模型库(更准确,需要自行下载),可以自行更改模型库适用实际需求。
模型需要转成ONNX格式采用被本项目所使用。 PaddleOCR模型转换
如果需要修改成服务器版模型库,参考代码如下:(假设服务器版模型库在运行目录的文件夹inferenceserver下)
//自带轻量版中英文模型
// OCRModelConfig config = null;
//服务器中英文模型
//OCRModelConfig config = new OCRModelConfig();
//string root = Environment.CurrentDirectory;
//string modelPathroot = root + @"\inferenceserver";
//config.det_infer = modelPathroot + @"\ch_ppocr_server_v2.0_det_infer.onnx";
//config.cls_infer = modelPathroot + @"\ch_ppocr_mobile_v2.0_cls_infer.onnx";
//config.rec_infer = modelPathroot + @"\ch_ppocr_server_v2.0_rec_infer.onnx";
//config.keys = modelPathroot + @"\ppocr_keys.txt";
//英文和数字模型
OCRModelConfig config = new OCRModelConfig();
string root = Environment.CurrentDirectory;
string modelPathroot = root + @"\en";
config.det_infer = modelPathroot + @"\ch_PP-OCRv2_det_infer";
config.cls_infer = modelPathroot + @"\ch_ppocr_mobile_v2.0_cls_infer.onnx";
config.rec_infer = modelPathroot + @"\en_number_mobile_v2.0_rec_infer.onnx";
config.keys = modelPathroot + @"\en_dict.txt";
PaddleOCREngine engine = new PaddleOCREngine(config, oCRParameter);
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = "*.*|*.bmp;*.jpg;*.jpeg;*.tiff;*.tiff;*.png";
if (ofd.ShowDialog() != DialogResult.OK) return;
var imagebyte = File.ReadAllBytes(ofd.FileName);
Bitmap bitmap = new Bitmap(new MemoryStream(imagebyte));
OCRModelConfig config = null;
OCRParameter oCRParameter = new OCRParameter ();
OCRResult ocrResult = new OCRResult();
//建议程序全局初始化一次即可,不必每次识别都初始化,容易报错。
PaddleOCREngine engine = new PaddleOCREngine(config, oCRParameter);
{
ocrResult = engine.DetectText(bitmap );
}
if (ocrResult != null)
{
MessageBox.Show(ocrResult.Text,"识别结果");
}
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 is compatible. net5.0-windows net5.0-windows was computed. net6.0 net6.0 is compatible. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 is compatible. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 is compatible. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 is compatible. |
| .NET Framework | net461 net461 is compatible. net462 net462 is compatible. net463 net463 was computed. net47 net47 is compatible. net471 net471 is compatible. net472 net472 was computed. net48 net48 is compatible. net481 net481 is compatible. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.