@@ -391,7 +391,7 @@ public void TensorFlowTransformInceptionTest()
391
391
) ;
392
392
393
393
var data = reader . Load ( new MultiFileSource ( dataFile ) ) ;
394
- var images = mlContext . Transforms . LoadImages ( imageFolder , ( "ImageReal" , "ImagePath" ) ) . Fit ( data ) . Transform ( data ) ;
394
+ var images = mlContext . Transforms . LoadImages ( "ImageReal" , "ImagePath" , imageFolder ) . Fit ( data ) . Transform ( data ) ;
395
395
var cropped = mlContext . Transforms . ResizeImages ( "ImageCropped" , 224 , 224 , "ImageReal" ) . Fit ( images ) . Transform ( images ) ;
396
396
var pixels = mlContext . Transforms . ExtractPixels ( inputName , "ImageCropped" , interleavePixelColors : true ) . Fit ( cropped ) . Transform ( cropped ) ;
397
397
var tf = mlContext . Model . LoadTensorFlowModel ( modelLocation ) . ScoreTensorFlowModel ( outputName , inputName , true ) . Fit ( pixels ) . Transform ( pixels ) ;
@@ -507,7 +507,7 @@ public void TensorFlowTransformMNISTConvTest()
507
507
var trainData = reader . Load ( GetDataPath ( TestDatasets . mnistTiny28 . trainFilename ) ) ;
508
508
var testData = reader . Load ( GetDataPath ( TestDatasets . mnistOneClass . testFilename ) ) ;
509
509
510
- var pipe = mlContext . Transforms . CopyColumns ( ( "reshape_input" , "Placeholder" ) )
510
+ var pipe = mlContext . Transforms . CopyColumns ( "reshape_input" , "Placeholder" )
511
511
. Append ( mlContext . Model . LoadTensorFlowModel ( "mnist_model/frozen_saved_model.pb" ) . ScoreTensorFlowModel ( new [ ] { "Softmax" , "dense/Relu" } , new [ ] { "Placeholder" , "reshape_input" } ) )
512
512
. Append ( mlContext . Transforms . Concatenate ( "Features" , "Softmax" , "dense/Relu" ) )
513
513
. Append ( mlContext . MulticlassClassification . Trainers . LightGbm ( "Label" , "Features" ) ) ;
@@ -662,7 +662,7 @@ private void ExecuteTFTransformMNISTConvTrainingTest(bool shuffle, int? shuffleS
662
662
preprocessedTestData = testData ;
663
663
}
664
664
665
- var pipe = mlContext . Transforms . CopyColumns ( ( "Features" , "Placeholder" ) )
665
+ var pipe = mlContext . Transforms . CopyColumns ( "Features" , "Placeholder" )
666
666
. Append ( mlContext . Model . LoadTensorFlowModel ( modelLocation ) . RetrainTensorFlowModel (
667
667
inputColumnNames : new [ ] { "Features" } ,
668
668
outputColumnNames : new [ ] { "Prediction" } ,
@@ -729,7 +729,7 @@ public void TensorFlowTransformMNISTConvSavedModelTest()
729
729
var trainData = reader . Load ( GetDataPath ( TestDatasets . mnistTiny28 . trainFilename ) ) ;
730
730
var testData = reader . Load ( GetDataPath ( TestDatasets . mnistOneClass . testFilename ) ) ;
731
731
732
- var pipe = mlContext . Transforms . CopyColumns ( ( "reshape_input" , "Placeholder" ) )
732
+ var pipe = mlContext . Transforms . CopyColumns ( "reshape_input" , "Placeholder" )
733
733
. Append ( mlContext . Model . LoadTensorFlowModel ( "mnist_model" ) . ScoreTensorFlowModel ( new [ ] { "Softmax" , "dense/Relu" } , new [ ] { "Placeholder" , "reshape_input" } ) )
734
734
. Append ( mlContext . Transforms . Concatenate ( "Features" , new [ ] { "Softmax" , "dense/Relu" } ) )
735
735
. Append ( mlContext . MulticlassClassification . Trainers . LightGbm ( "Label" , "Features" ) ) ;
@@ -898,7 +898,7 @@ public void TensorFlowTransformCifarSavedModel()
898
898
new TextLoader . Column ( "Name" , DataKind . String , 1 ) ,
899
899
}
900
900
) ;
901
- var images = mlContext . Transforms . LoadImages ( imageFolder , ( "ImageReal" , "ImagePath" ) ) . Fit ( data ) . Transform ( data ) ;
901
+ var images = mlContext . Transforms . LoadImages ( "ImageReal" , imageFolder , "ImagePath" ) . Fit ( data ) . Transform ( data ) ;
902
902
var cropped = mlContext . Transforms . ResizeImages ( "ImageCropped" , imageWidth , imageHeight , "ImageReal" ) . Fit ( images ) . Transform ( images ) ;
903
903
var pixels = mlContext . Transforms . ExtractPixels ( "Input" , "ImageCropped" , interleavePixelColors : true ) . Fit ( cropped ) . Transform ( cropped ) ;
904
904
IDataView trans = tensorFlowModel . ScoreTensorFlowModel ( "Output" , "Input" ) . Fit ( pixels ) . Transform ( pixels ) ;
@@ -1000,15 +1000,15 @@ public void TensorFlowSentimentClassificationTest()
1000
1000
// The second pipeline 'tfEnginePipe' takes the resized integer vector and passes it to TensoFlow and gets the classification scores.
1001
1001
var estimator = mlContext . Transforms . Text . TokenizeIntoWords ( "TokenizedWords" , "Sentiment_Text" )
1002
1002
. Append ( mlContext . Transforms . Conversion . MapValue ( lookupMap , lookupMap . Schema [ "Words" ] , lookupMap . Schema [ "Ids" ] ,
1003
- new ColumnOptions [ ] { ( "Features" , "TokenizedWords" ) } ) ) ;
1003
+ new [ ] { new InputOutputColumnPair ( "Features" , "TokenizedWords" ) } ) ) ;
1004
1004
var model = estimator . Fit ( dataView ) ;
1005
1005
var dataPipe = mlContext . Model . CreatePredictionEngine < TensorFlowSentiment , TensorFlowSentiment > ( model ) ;
1006
1006
1007
1007
// For explanation on how was the `sentiment_model` created
1008
1008
// c.f. https://github.com/dotnet/machinelearning-testdata/blob/master/Microsoft.ML.TensorFlow.TestModels/sentiment_model/README.md
1009
1009
string modelLocation = @"sentiment_model" ;
1010
1010
var pipelineModel = mlContext . Model . LoadTensorFlowModel ( modelLocation ) . ScoreTensorFlowModel ( new [ ] { "Prediction/Softmax" } , new [ ] { "Features" } )
1011
- . Append ( mlContext . Transforms . CopyColumns ( ( "Prediction" , "Prediction/Softmax" ) ) )
1011
+ . Append ( mlContext . Transforms . CopyColumns ( "Prediction" , "Prediction/Softmax" ) )
1012
1012
. Fit ( dataView ) ;
1013
1013
var tfEnginePipe = mlContext . Model . CreatePredictionEngine < TensorFlowSentiment , TensorFlowSentiment > ( pipelineModel ) ;
1014
1014
@@ -1052,7 +1052,7 @@ public void TensorFlowStringTest()
1052
1052
var dataview = mlContext . Data . CreateTextLoader < TextInput > ( ) . Load ( new MultiFileSource ( null ) ) ;
1053
1053
1054
1054
var pipeline = tensorFlowModel . ScoreTensorFlowModel ( new [ ] { "Original_A" , "Joined_Splited_Text" } , new [ ] { "A" , "B" } )
1055
- . Append ( mlContext . Transforms . CopyColumns ( ( "AOut" , "Original_A" ) , ( "BOut" , "Joined_Splited_Text" ) ) ) ;
1055
+ . Append ( mlContext . Transforms . CopyColumns ( new [ ] { new InputOutputColumnPair ( "AOut" , "Original_A" ) , new InputOutputColumnPair ( "BOut" , "Joined_Splited_Text" ) } ) ) ;
1056
1056
var transformer = mlContext . Model . CreatePredictionEngine < TextInput , TextOutput > ( pipeline . Fit ( dataview ) ) ;
1057
1057
1058
1058
var input = new TextInput
0 commit comments