Skip to content
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

DnnFeaturizeImage sample doesn't match the signature in the current API #3079

Closed
yaeldekel opened this issue Mar 25, 2019 · 2 comments · Fixed by #3084
Closed

DnnFeaturizeImage sample doesn't match the signature in the current API #3079

yaeldekel opened this issue Mar 25, 2019 · 2 comments · Fixed by #3084
Assignees
Labels
API Issues pertaining the friendly API documentation Related to documentation of ML.NET
Milestone

Comments

@yaeldekel
Copy link

The API for LoadImage is

LoadImages(string outputColumnName, string imageFolder, string inputColumnName = null)

but in the sample it is used like this:

mlContext.Transforms.LoadImages(imagesFolder, "ImageObject", "ImagePath")

One of them should be fixed, not sure which one? @TomFinley , @artidoro , @wschin
I kind of like the second option (the folder first, output and input column names together).

@rogancarr rogancarr self-assigned this Mar 25, 2019
@rogancarr rogancarr added API Issues pertaining the friendly API documentation Related to documentation of ML.NET labels Mar 25, 2019
@rogancarr
Copy link
Contributor

So, usually the Catalog Extension Methods have APIs like outputColumnName, inputColumnName, specific-arguments. However, there are some that have inputColumnName shoved to the back to make it nullable.

I'd like to uplevel this question to the two questions:

  1. "Is it okay to shove inputColumnName to the back to make it nullable?
  2. "Is it okay to shove inputColumnNames (arrays) to the back to allow them to be params?

Here are a list of APIs that do No. 1:

MapValue

ValueMappingEstimator<TInputType, TOutputType> MapValue<TInputType, TOutputType>(
            this TransformsCatalog.ConversionTransforms catalog,
            string outputColumnName,
            IEnumerable<KeyValuePair<TInputType, TOutputType>> keyValuePairs,
            string inputColumnName = null,
            bool treatValuesAsKeyType = false);

public static ValueMappingEstimator<TInputType, TOutputType> MapValue<TInputType, TOutputType>(
            this TransformsCatalog.ConversionTransforms catalog,
            string outputColumnName,
            IEnumerable<KeyValuePair<TInputType, TOutputType[]>> keyValuePairs,
            string inputColumnName = null);

        public static ValueMappingEstimator MapValue(
            this TransformsCatalog.ConversionTransforms catalog,
            string outputColumnName, IDataView lookupMap, DataViewSchema.Column keyColumn, DataViewSchema.Column valueColumn, string inputColumnName = null)

DNNFeaturizeImage

        public static DnnImageFeaturizerEstimator DnnFeaturizeImage(this TransformsCatalog catalog,
            string outputColumnName,
            Func<DnnImageFeaturizerInput, EstimatorChain<ColumnCopyingTransformer>> modelFactory,
            string inputColumnName = null);

ResizeImages

        public static ImageResizingEstimator ResizeImages(this TransformsCatalog catalog,
            string outputColumnName,
            int imageWidth,
            int imageHeight,
            string inputColumnName = null,
            ImageResizingEstimator.ResizingKind resizing = ImageResizingEstimator.ResizingKind.IsoCrop,
            ImageResizingEstimator.Anchor cropAnchor = ImageResizingEstimator.Anchor.Center);

ApplyWordEmbedding

        public static WordEmbeddingEstimator ApplyWordEmbedding(this TransformsCatalog.TextTransforms catalog,
            string outputColumnName,
            string customModelFile,
            string inputColumnName = null)

And here are the APIs that do No. 2:

TextFeaturizer

        public static TextFeaturizingEstimator FeaturizeText(this TransformsCatalog.TextTransforms catalog,
            string outputColumnName,
            TextFeaturizingEstimator.Options options,
            params string[] inputColumnNames);

And here is an API that just seems weird:

ApplyOnnxModel just has a funky order:

public static OnnxScoringEstimator ApplyOnnxModel(this TransformsCatalog catalog,
            string modelFile,
            string outputColumnName,
            string inputColumnName,
            int? gpuDeviceId = null,
            bool fallbackToCpu = false);

@rogancarr
Copy link
Contributor

We spoke about this offline. Standards were set in #2064.

The first two sets of APIs are correct, and should not be changed. The LoadImages discrepancy can be fixed by updating the Sample.

The ApplyOnnxModel API is incorrect and has been posted in issue #3082.

@shauheen shauheen added this to the 0319 milestone Mar 26, 2019
@ghost ghost locked as resolved and limited conversation to collaborators Mar 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
API Issues pertaining the friendly API documentation Related to documentation of ML.NET
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants