2 instantiations of ImageResizingEstimator
Microsoft.ML.ImageAnalytics (2)
ExtensionsCatalog.cs (2)
163=> new ImageResizingEstimator(CatalogUtils.GetEnvironment(catalog), outputColumnName, imageWidth, imageHeight, inputColumnName, resizing, cropAnchor); 186=> new ImageResizingEstimator(CatalogUtils.GetEnvironment(catalog), columnOptions);
53 references to ImageResizingEstimator
Microsoft.ML.ImageAnalytics (50)
ExtensionsCatalog.cs (12)
138/// Create a <see cref="ImageResizingEstimator"/>, which resize the image from the column specified in <paramref name="inputColumnName"/> 148/// <param name="resizing"> The type of image resizing as specified in <see cref="ImageResizingEstimator.ResizingKind"/>.</param> 149/// <param name="cropAnchor">Where to place the anchor, to start cropping. Options defined in <see cref="ImageResizingEstimator.Anchor"/></param> 156public static ImageResizingEstimator ResizeImages(this TransformsCatalog catalog, 161ImageResizingEstimator.ResizingKind resizing = ImageResizingEstimator.ResizingKind.IsoCrop, 162ImageResizingEstimator.Anchor cropAnchor = ImageResizingEstimator.Anchor.Center) 174/// or just crop it can be specified separately for each column loaded, through the <see cref="ImageResizingEstimator.ColumnOptions"/>. 177/// <param name="columnOptions">The <see cref="ImageResizingEstimator.ColumnOptions"/> describing how the transform handles each image resize column.</param> 185internal static ImageResizingEstimator ResizeImages(this TransformsCatalog catalog, params ImageResizingEstimator.ColumnOptions[] columnOptions)
ImageResizer.cs (38)
33/// <see cref="ITransformer"/> resulting from fitting an <see cref="ImageResizingEstimator"/>. 46public ImageResizingEstimator.ResizingKind? Resizing; 49public ImageResizingEstimator.Anchor? CropAnchor; 82public ImageResizingEstimator.ResizingKind Resizing = ImageResizingEstimator.Defaults.Resizing; 85public ImageResizingEstimator.Anchor CropAnchor = ImageResizingEstimator.Defaults.CropAnchor; 108private readonly ImageResizingEstimator.ColumnOptions[] _columns; 113internal IReadOnlyCollection<ImageResizingEstimator.ColumnOptions> Columns => _columns.AsReadOnly(); 123/// <param name="resizing">What <see cref="ImageResizingEstimator.ResizingKind"/> to use.</param> 124/// <param name="cropAnchor">If <paramref name="resizing"/> set to <see cref="ImageResizingEstimator.ResizingKind.IsoCrop"/> what anchor to use for cropping.</param> 127ImageResizingEstimator.ResizingKind resizing = ImageResizingEstimator.ResizingKind.IsoCrop, 128ImageResizingEstimator.Anchor cropAnchor = ImageResizingEstimator.Anchor.Center) 129: this(env, new ImageResizingEstimator.ColumnOptions(outputColumnName, imageWidth, imageHeight, inputColumnName, resizing, cropAnchor)) 138internal ImageResizingTransformer(IHostEnvironment env, params ImageResizingEstimator.ColumnOptions[] columns) 144private static (string outputColumnName, string inputColumnName)[] GetColumnPairs(ImageResizingEstimator.ColumnOptions[] columns) 159var cols = new ImageResizingEstimator.ColumnOptions[args.Columns.Length]; 163cols[i] = new ImageResizingEstimator.ColumnOptions( 199_columns = new ImageResizingEstimator.ColumnOptions[ColumnPairs.Length]; 206var scale = (ImageResizingEstimator.ResizingKind)ctx.Reader.ReadByte(); 207Host.CheckDecode(Enum.IsDefined(typeof(ImageResizingEstimator.ResizingKind), scale)); 208var anchor = (ImageResizingEstimator.Anchor)ctx.Reader.ReadByte(); 209Host.CheckDecode(Enum.IsDefined(typeof(ImageResizingEstimator.Anchor), anchor)); 210_columns[i] = new ImageResizingEstimator.ColumnOptions(ColumnPairs[i].outputColumnName, width, height, ColumnPairs[i].inputColumnName, scale, anchor); 244Contracts.Assert((ImageResizingEstimator.ResizingKind)(byte)col.Resizing == col.Resizing); 246Contracts.Assert((ImageResizingEstimator.Anchor)(byte)col.Anchor == col.Anchor); 312ImageResizingEstimator.ResizingKind.IsoPad => ImageResizeMode.Pad, 313ImageResizingEstimator.ResizingKind.IsoCrop => 316ImageResizingEstimator.Anchor.Top => ImageResizeMode.CropAnchorTop, 317ImageResizingEstimator.Anchor.Bottom => ImageResizeMode.CropAnchorBottom, 318ImageResizingEstimator.Anchor.Left => ImageResizeMode.CropAnchorLeft, 319ImageResizingEstimator.Anchor.Right => ImageResizeMode.CropAnchorRight, 322ImageResizingEstimator.ResizingKind.Fill => ImageResizeMode.Fill, 444/// <param name="resizing">What <see cref="ImageResizingEstimator.ResizingKind"/> to use.</param> 445/// <param name="anchor">If <paramref name="resizing"/> set to <see cref="ImageResizingEstimator.ResizingKind.IsoCrop"/> what anchor to use for cropping.</param> 501: base(Contracts.CheckRef(env, nameof(env)).Register(nameof(ImageResizingEstimator)), transformer)
Microsoft.ML.Tests (3)
ImagesTests.cs (3)
150var cropped = new ImageResizingTransformer(env, "ImageCropped", 100, 100, "ImageReal", ImageResizingEstimator.ResizingKind.IsoPad).Transform(images); 1023resizing: ImageResizingEstimator.ResizingKind.Fill)); 1183var pipeline = mlContext.Transforms.ResizeImages("ResizedImage", 100, 100, nameof(InMemoryImage.LoadedImage));