ImageClassification 2.0.0.1

dotnet add package ImageClassification --version 2.0.0.1                
NuGet\Install-Package ImageClassification -Version 2.0.0.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ImageClassification" Version="2.0.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ImageClassification --version 2.0.0.1                
#r "nuget: ImageClassification, 2.0.0.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install ImageClassification as a Cake Addin
#addin nuget:?package=ImageClassification&version=2.0.0.1

// Install ImageClassification as a Cake Tool
#tool nuget:?package=ImageClassification&version=2.0.0.1                

What is this?

This package is a wrapper library of ML.NET to do image classification. You will need ImageClassification.IO packeage along with this package.

Usege

Trainer class

Trainer class is a class to train the Model (which will be two zip files) from your image data. Image data you have to prepare in advence is a foldered image data like below. Each folder names will be predicted Label names (Apple/Banana/Orange/...).

  • Fruits
    • Apple
      • apple001.jpg
      • apple002.jpg
      • ...
    • Banana
    • Orange
    • ...

More images you prepare, better result you'll get.

Next, call Trainer.GenerateModel with dataDir you prepared. <pre> // Define hyper-paramters such as Epoch and BatchSize. var hp = new HyperParameter { Epoch = 200, BatchSize = 10, LearningRate = 0.01f, eTrainerArchitecture = eTrainerArchitectures.ResnetV250, TestFraction = 0.3f, ResultsToShow = 20 };

// Train and generate the model.
var results = Trainer.GenerateModel(dataDir, hp);

// Save the results as HTML file.(optional)
results.SaveAsHTML();

</pre>

Classifier class

Classifier class is a class to get a prediction from the image file you give (=imageToClassify). Call Classifier.GetSingleImagePrediction along with the Model you've created at previus section.

<pre> string imageToClassify = @"C:\your\imageToClassify(apple_or_banana_or_orange).png"; var p = Classifier.GetSingleImagePrediction(results.Resultfiles.PipelineZip, results.Resultfiles.ModelZip, imageToClassify); Console.WriteLine($@"Predicted image label is: ""{p.PredictedLabel}"". Score:{p.HighScore}"); </pre>

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Framework net472 is compatible.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.0.1 627 12/30/2022
1.5.5.3 634 5/6/2021
1.5.5.2 484 3/14/2021
1.5.5.1 421 3/11/2021
1.5.5 420 3/5/2021
1.5.4.2 432 2/26/2021
1.5.4.1 405 2/22/2021
1.5.4 439 2/21/2021
1.0.2 437 2/12/2021

2.0.x comes with ML.NET 2.0.0.0 or later.
Changed .NETCore3.1 to .NET6.0