Skip to content

Commit

Permalink
Move options
Browse files Browse the repository at this point in the history
  • Loading branch information
jwood803 committed Oct 6, 2020
1 parent 6b7dbb6 commit dc924d4
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions MLNetExamples/DeepNeuralNetworkUpdate/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ static void Main(string[] args)
.Fit(testTrainData.TestSet)
.Transform(testTrainData.TestSet);

var imagesPipeline = context.Transforms.Conversion.MapValueToKey("LabelKey", "Label", keyOrdinality: Microsoft.ML.Transforms.ValueToKeyMappingEstimator.KeyOrdinality.ByValue)
.Append(context.Transforms.LoadRawImageBytes("Image", imagesFolder, "ImagePath"));

var imageDataModel = imagesPipeline.Fit(testTrainData.TrainSet);

var imageDataView = imageDataModel.Transform(testTrainData.TrainSet);

var options = new ImageClassificationTrainer.Options()
{
Arch = ImageClassificationTrainer.Architecture.ResnetV250,
Expand All @@ -44,13 +51,6 @@ static void Main(string[] args)
ValidationSet = validationData
};

var imagesPipeline = context.Transforms.Conversion.MapValueToKey("LabelKey", "Label", keyOrdinality: Microsoft.ML.Transforms.ValueToKeyMappingEstimator.KeyOrdinality.ByValue)
.Append(context.Transforms.LoadRawImageBytes("Image", imagesFolder, "ImagePath"));

var imageDataModel = imagesPipeline.Fit(testTrainData.TrainSet);

var imageDataView = imageDataModel.Transform(testTrainData.TrainSet);

var pipeline = context.MulticlassClassification.Trainers.ImageClassification(options)
.Append(context.Transforms.Conversion.MapKeyToValue("PredictedLabel"));

Expand Down

0 comments on commit dc924d4

Please sign in to comment.