PaddleOcrNet.Gpu
2.0.2
See the version list below for details.
dotnet add package PaddleOcrNet.Gpu --version 2.0.2
NuGet\Install-Package PaddleOcrNet.Gpu -Version 2.0.2
<PackageReference Include="PaddleOcrNet.Gpu" Version="2.0.2" />
<PackageVersion Include="PaddleOcrNet.Gpu" Version="2.0.2" />
<PackageReference Include="PaddleOcrNet.Gpu" />
paket add PaddleOcrNet.Gpu --version 2.0.2
#r "nuget: PaddleOcrNet.Gpu, 2.0.2"
#:package PaddleOcrNet.Gpu@2.0.2
#addin nuget:?package=PaddleOcrNet.Gpu&version=2.0.2
#tool nuget:?package=PaddleOcrNet.Gpu&version=2.0.2
PaddleOcrNet.Gpu
CUDA GPU acceleration for PaddleOcrNet — high-accuracy native .NET OCR powered by PaddleOCR's neural models on ONNX Runtime.
This is a metapackage. It contains no code of its own: it pulls in PaddleOcrNet together with
Microsoft.ML.OnnxRuntime.Gpu, so the CUDA execution provider is present at runtime and PaddleOcrNet
can select it.
dotnet add package PaddleOcrNet.Gpu
Installing this package instead of PaddleOcrNet is all that is required — it brings the core library
with it.
Usage
There is no separate GPU API. Existing code is unchanged; PaddleOcrNet detects the CUDA provider and uses it automatically:
using PaddleOcrNet.Models;
using PaddleOcrNet.Services;
await using var ocr = new PaddleOcrService();
OcrResult result = await ocr.ExtractTextFromImage("invoice.png", OcrLanguage.English);
Console.WriteLine(result.UsedGpu); // true when a GPU provider was selected
Console.WriteLine(result.FullText);
ExecutionProvider defaults to OcrExecutionProvider.Auto, which probes the loaded ONNX Runtime and
picks the best accelerator available, falling back to CPU when none is:
| Platform | Auto-detect order |
|---|---|
| Windows | DirectML → CUDA → CPU |
| Linux | CUDA → CPU |
| macOS | CoreML → CPU |
To pin a provider rather than auto-detecting:
await using var ocr = new PaddleOcrService(new PaddleOcrServiceOptions
{
ExecutionProvider = OcrExecutionProvider.Cuda, // or Cpu / DirectMl / CoreMl / Auto
});
PaddleOcrServiceOptions.UseGpu = true is kept as shorthand for forcing CUDA, but prefer leaving
ExecutionProvider at Auto — it already enables a GPU when one is present.
Requirements
- An NVIDIA GPU with the proprietary driver installed, and CUDA 12+.
- Windows or Linux.
Microsoft.ML.OnnxRuntime.Gpuships native assets for those two platforms only. On macOS this package has nothing to contribute; install plainPaddleOcrNetand letAutoselect CoreML.
If CUDA is unavailable at runtime — no driver, missing libraries, no compatible device — provider
selection logs the reason and falls back to CPU rather than throwing. OcrResult.UsedGpu reports
what was actually used, so a silent fallback is still observable.
Notes
- Install either
PaddleOcrNetorPaddleOcrNet.Gpu, not both — this package already references the core library and pins it to a matching version. - The GPU packages add a substantial native payload. For CPU-only deployments, and for Native AOT,
trimmed or container images where size matters, use plain
PaddleOcrNet. - OCR models are downloaded and cached on first use exactly as with the CPU package; GPU selection does not change model sourcing.
Links
- Source, documentation and issues: https://github.com/FarhanLodi/PaddleOcrNet
- Core package: https://www.nuget.org/packages/PaddleOcrNet
License
MIT © PaddleOcrNet contributors. Downloaded models are Apache-2.0 / MIT and attributed to their authors.
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- Microsoft.ML.OnnxRuntime.Gpu (>= 1.27.0)
- PaddleOcrNet (>= 2.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.