Class OcrEngine
Ocr을 수행할 수 있는 Engine입니다.
Implements
Inherited Members
Namespace: SaigeVision.Core.Inference
Assembly: SaigeVision.Core.Inference.dll
Syntax
public sealed class OcrEngine : InspectionEngine<EngineMetadata, TrainingOptions, OcrOptions>, IDisposable
Remarks
SaigeVision이 제공하는 '트레이너'를 통해 훈련된 'Ocr Model'을 사용하여 Ocr을 수행할 수 있는 Engine을 제공합니다.
해당 Engine은 OcrOptions를 통해 검사에 대한 몇가지 옵션을 지정 할 수 있습니다.
Examples
다음을 샘플 이미지 한장에 대한 Ocr을 수행하는 방법을 설명합니다.
SaigeVision.Core.SaigeVisionApp.Init();
IGpuService gpuService = new NvGpuService();
gpuService.DetectConnectedGPUs();
PhysicalGpu gpu = gpuService.CurrentDetectedGPUs[0];
SrImage image = new SrImage(@"....\000001.png");
Uri model = new Uri(@"....\model.srCls");
using(var engine = EngineLoader.LoadFrom(typeof(ClassificationEngine),model))
{
engine.AllocateNetwork(gpu);
ClassificationReport report = engine.Inspect(image);
ClassInfo prediction = report.Prediction;
Console.WriteLine($"Inspection time : {report.InspectionTime}");
Console.WriteLine($"Predicted : {prediction.Name}");
}
image.Dispose();
Methods
View SourceInspect(SrImage)
input에 대한 검사를 진행합니다.
Declaration
public OcrReport Inspect(SrImage input)
Parameters
| Type | Name | Description |
|---|---|---|
| SrImage | input |
Returns
| Type | Description |
|---|---|
| OcrReport | 검사 결과. |
See Also
View SourceInspectAsync(SrImage, CancellationToken)
input에 대한 검사를 진행합니다.
Declaration
public Task<OcrReport> InspectAsync(SrImage input, CancellationToken token = default)
Parameters
| Type | Name | Description |
|---|---|---|
| SrImage | input | 검사할 이미지. |
| CancellationToken | token | 검사 취소 토큰. |
Returns
| Type | Description |
|---|---|
| Task<OcrReport> | 검사 결과. |