Skip to content

Image classification preview 2. #4151

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 27 commits into from
Aug 30, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
PR feedback.
  • Loading branch information
codemzs committed Aug 29, 2019
commit ff6b9fdf890c102ea3f9fd1f678301454a5c85e2
25 changes: 14 additions & 11 deletions test/Microsoft.ML.Tests/ImageClassification.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,6 @@ public partial class TensorFlowScenarioTests
[TensorFlowFact]
public void TensorFlowImageClassification()
{
// On Ubuntu the results seem to vary quite a bit but they can probably be
// controlled by training more epochs, however that will slow the
// build down.
if (!(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ||
(RuntimeInformation.IsOSPlatform(OSPlatform.OSX))))
{
return;
}

string assetsRelativePath = @"assets";
string assetsPath = GetAbsolutePath(assetsRelativePath);
string imagesDownloadFolderPath = Path.Combine(assetsPath, "inputs",
Expand Down Expand Up @@ -86,8 +77,20 @@ public void TensorFlowImageClassification()
IDataView predictions = trainedModel.Transform(testDataset);
var metrics = mlContext.MulticlassClassification.Evaluate(predictions);

Assert.InRange(metrics.MicroAccuracy, 0.75, 1);
Assert.InRange(metrics.MacroAccuracy, 0.75, 1);
// On Ubuntu the results seem to vary quite a bit but they can probably be
// controlled by training more epochs, however that will slow the
// build down.
if (!(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ||
(RuntimeInformation.IsOSPlatform(OSPlatform.OSX))))
{
Assert.InRange(metrics.MicroAccuracy, 0.3, 1);
Assert.InRange(metrics.MacroAccuracy, 0.3, 1);
}
else
{
Assert.Equal(1, metrics.MicroAccuracy);
Assert.Equal(1, metrics.MacroAccuracy);
}
}

public static IEnumerable<ImageData> LoadImagesFromDirectory(string folder,
Expand Down