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

[Spec]: Helper functions for pre and post processing #11

Open
amrutha95 opened this issue Oct 19, 2021 · 0 comments
Open

[Spec]: Helper functions for pre and post processing #11

amrutha95 opened this issue Oct 19, 2021 · 0 comments
Assignees

Comments

@amrutha95
Copy link
Collaborator

amrutha95 commented Oct 19, 2021

WinML Helper functions Specification document

The HelperFunctions project is a set of APIs that are designed to help developers using WinML with some of the common pre-processing and post-processing tasks.

Image helpers

public static async Task<VideoFrame> ConvertBitmapToVideoFrame(SoftwareBitmap softwareBitmap)
Converts Bitmap to VideoFrame, which is accepted as a binding object
Arguments: softwareBitmap : The SoftwareBitmap object

public static async Task<TensorFloat> ConvertVideoFrameToTensor(VideoFrame videoFrame, long[] size)
Converts VideoFrame to Tensor. Useful in scenarios where Tensor manipulation is required, for example if image needs to be resized, transposed from NCHW to NWHC.
Arguments : videoframe : The VideoFrame object to be converted
Size : A long[] array containing the sizes of the each dimension of the tensor

public static async Task<SoftwareBitmap> ConvertStorageFileToSoftwareBitmap(StorageFile selectedStorageFile)
Converts StorageFile to SoftwareBitmap
public static async Task ConvertStorageFileToSoftwareBitmap(StorageFile selectedStorageFile)
Arguments : selectedStorageFile : The StorageFile object that needs to be converted

public static async Task<SoftwareBitmap> ResizeImage(SoftwareBitmap bitmap, uint height, uint width)
Resizes image based on given dimensions
public static async Task ResizeImage(SoftwareBitmap softwareBitmap, uint height, uint width)
Arguments : softwareBitmap: The SoftwareBitmap object that needs to be resized
height: Height of the image
width: Width of the image

public static async Task<SoftwareBitmap> Crop(SoftwareBitmap softwareBitmap, Rect bounds)
Crops images based on bounds provided
Arguments : softwareBitmap: The SoftwareBitmap image to be cropped
bounds: The bounds of the cropped image

ConvertNCHWToNWHC
Transposes an image from NCHW to NWHC. Used depending on what the model is looking for in the input.
public static async Task ConvertNCHWToNWHC(SoftwareBitmap softwareBitmap)
Arguments: softwareBitmap: The SoftwareBitmap object to be transposed

@amrutha95 amrutha95 self-assigned this Oct 19, 2021
@amrutha95 amrutha95 changed the title [Spec]: Spec for Helper functions project [Spec]: Helper functions for pre and post processing Oct 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant