![]() |
VOOZH | about |
dotnet add package ImageClassification --version 2.0.0.1
NuGet\Install-Package ImageClassification -Version 2.0.0.1
<PackageReference Include="ImageClassification" Version="2.0.0.1" />
<PackageVersion Include="ImageClassification" Version="2.0.0.1" />Directory.Packages.props
<PackageReference Include="ImageClassification" />Project file
paket add ImageClassification --version 2.0.0.1
#r "nuget: ImageClassification, 2.0.0.1"
#:package ImageClassification@2.0.0.1
#addin nuget:?package=ImageClassification&version=2.0.0.1Install as a Cake Addin
#tool nuget:?package=ImageClassification&version=2.0.0.1Install as a Cake Tool
This package is a wrapper library of ML.NET to do image classification.
You will need ImageClassification.IO packeage along with this package.
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/...).
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 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 | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 net6.0 is compatible. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Framework | net472 net472 is compatible. net48 net48 was computed. net481 net481 was computed. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.
2.0.x comes with ML.NET 2.0.0.0 or later.
Changed .NETCore3.1 to .NET6.0