The code block below describes the simple code of Classification how to use
{
//Initialize
SaigeVision.Core.SaigeVisionApp.Init();
//Prepare
IGpuService gpuService = new NvGpuService();
gpuService.DetectConnectedGPUs();
PhysicalGpu gpu = gpuService.CurrentDetectedGPUs[0];
SrImage image = new SrImage("c:\...\...\...\Sample1.jpg");
Uri model = new Uri("c:\...\...\...\model.SrCls");
//Inspect
using (var engine = EngineLoader.LoadFrom<ClassificationEngine>(model))
{
engine.AllocateNetwork(gpu);
ClassificationReport report = engine.Inspect(image);
ClassInfo prediction = report.Prediction;
Console.WriteLine($"Predicted : {prediction.Name}");
}
//Clean up (optional)
image.Dispose();
}
With simple code like this, you can perform the inspection functionality provided by SaigeVision.Core.Inference.
If you have successfully referenced SaigeVision.Core.Inference in the 'Workspace', try to 'Copy & paste' the above sample code to make it work.
As shown in the sample code, the use of 'Inference' provided by 'SaigeVision' has some regular procedures.
The description of the procedure is as follows
- Initialize: Initialize
SaigeVision.Coreto a usable state - Prepare: .Prepare the necessary data and environment
- Inspect : Load and inspect
InspectionEngine - Clean up (optional): Dispose used resource.
InspectionEngine is a generic term for ClassificationEngine, DetectionEngine, and SegmentationEngine, and it's good to know because it keeps popping up in the docs.
At this stage, it is important to understand the overall flow of performing 'Inference' via SagieVision.Core.Infernece
in addition to the inspection results. All InspectionEngine use these procedures in common.
SaigeVision.Core.Inference provides the ClassificationEngine, DetectionEngine and SegmentationEngine
Check out these Docs for more details and guides on each InspectionEngine.
🚫 All tools in the namespace starting with
SaigeVision.Corerequire license checking before you can use them.
