Skip to content
This repository was archived by the owner on Mar 12, 2020. It is now read-only.

Example Image Classification

Deepak Kumar Battini edited this page Nov 13, 2017 · 2 revisions

Example with ImageNet models

Import namespace

using SiaNet.Application;
using SiaNet.Common;

Declare and load models

string imagePath = "path-to-jpeg-or-png-image";
ImageNet app = new ImageNet(ImageNetModel.ResNet50);
app.LoadModel();

Run prediction

var predictions = app.Predict(imagePath);
foreach (var item in predictions)
{
   Console.WriteLine("Category: {0}, Score: {1}", item.Name, item.Score);
}

Example with Cifar-10 models

Import namespace

using SiaNet.Application;
using SiaNet.Common;

Declare and load models

string imagePath = "path-to-jpeg-or-png-image";
Cifar10 app = new Cifar10(Cifar10Model.ResNet110);
app.LoadModel();

Run prediction

var predictions = app.Predict(imagePath);
foreach (var item in predictions)
{
   Console.WriteLine("Category: {0}, Score: {1}", item.Name, item.Score);
}

Clone this wiki locally