onnxruntime/winml/test/image
Justin Chu c203d89958
Update ruff and clang-format versions (#21479)
ruff -> 0.5.4
clang-format -> 18
2024-07-24 11:50:11 -07:00
..
batchGroundTruth/batchGroundTruth User/xianz/enable batch tests (#3914) 2020-05-12 15:46:46 -07:00
groundTruth/groundTruth [WIP] Port image tests from WAI (#3365) 2020-04-01 15:38:44 -07:00
images [WIP] Port image tests from WAI (#3365) 2020-04-01 15:38:44 -07:00
models [WIP] Port image tests from WAI (#3365) 2020-04-01 15:38:44 -07:00
README.md replace 'master' branch ref to 'main' for onnx repo (#12678) 2022-08-30 13:41:42 -07:00
imageTestHelper.cpp Bump linter versions (#18341) 2023-11-08 13:04:40 -08:00
imageTestHelper.h Fix clang-format comment indents on Windows for winml/ (#17144) 2023-08-14 23:50:14 -04:00
imagetests.cpp Update ruff and clang-format versions (#21479) 2024-07-24 11:50:11 -07:00

README.md

Overview

ImageTests are to test all kinds of scenarios that are related to images.

Purpose

To make image related tests data driven and increase test code coverage.

Image Test Data Table

Table Name Device EvaluationStrategies Models Input Files Output Binding Strategies Input Image Sources InputPixelFormats
Table Rows GPU Async fns-candy_Bgr8_freeDimInput fish_720.png Bound FromImageFeatureValue Bgra8
CPU Sync fns-candy_Bgr8 fish_720_Gray.png Unbound FromVideoFrame Rgba8
fns-candy_Rgb8 FromCPUResource Gray8
fns-candy_tensor FromGPUResource

Test Coverage

1. Devices

Devices the Test uses.

  • GPU
  • CPU

2. Evaluation Strategy

The strategy to use during evalution.

  • EvalutateAsync
  • EvaluateSync
  • MultipleEvaluations (TODO)
  • SwapChain (TODO)
  • Chain (TODO)

3. Output Binding Strategy

  • Bound

    VideoFrame outputimage(BitmapPixelFormat::Rgba8, outputtensorshape.GetAt(3), outputtensorshape.GetAt(2));
    ImageFeatureValue outputTensor = ImageFeatureValue::CreateFromVideoFrame(outputimage);
    
  • Unbound

4. Models

Des: Currently, we are using four models, FNS-candy_Bgr8_freeDimInput, FNS-candy_Bgr8, FNS-candy_Rgb8, and FNS-candy_Tensor. We would try to get more models to cover the following listed cases.

a. Input Image Metadata

  1. No metadata provided (TODO)

  2. BitmapPixelFormat

    • Bgr8
    • Rgb8
    • Gray8
    • Bgra8 (TODO, not supported in RS5)
    • Rgba8 (TODO, not supported in RS5)
    • yuv (TODO, not in ONNX1.2.2 spec)
  • ColorSpaceGamma

    • sRGB
    • Linear (TODO, not supported in RS5)
  • NominalPixelRange

    • NominalRange_0_255
    • Normalized_0_1 (No such model)
    • Normalized_1_1 (No such model)
    • NominalRange_16_235 (No such model)

b. Model Input Output Type

  • free dimension
  • image : corresponding to ImageFeatureDescriptor
  • tensor : corresponding to TensorFeatureDescriptor

c. Models we are using.

  • Model takes Gray8 image as input and also output image (TODO, MNIST outputs tensor)
  • FNS-candy_Bgr8_freeDimInput
  • FNS-candy_Bgr8
  • FNS-candy_Rgb8
  • FNS-candy_Tensor

5. Input Image Files

  • fish_720.png
  • fish_720_gray.png

6. Input

a. input image source

  • FromImageFeatureValue

    VideoFrame frame = VideoFrame::CreateWithSoftwareBitmap(softwareBitmap);
    VERIFY_NO_THROW(m_modelBinding.Bind(inputFeature.Current().Name(), frame));
    
  • FromVideoFrame

    VideoFrame frame = VideoFrame::CreateWithSoftwareBitmap(softwareBitmap);
    VERIFY_NO_THROW(m_modelBinding.Bind(inputFeature.Current().Name(), frame));
    
  • FromGPUResource

    Bind input from GPU Resources as described in this PR

  • FromCPUResource

    Bind input from GPU Resources as described in this PR

b. Multiple inputs (TODO)

  1. test the case where 2 inputs requiring GPU processing are bound back to back forcing bind calls that potentially overlap GPU work from previous bind
  2. Test models require multiple inputs

c. Bind with Property (TODO)

  • If bind with Property, what properties should be tested? And how to make properties as parameters?

7. InputPixelFormats

We could convert the input image to the following PixelFormats, and then used as input of model. The pixel format expected from model input can be different from the pixel format of real input. But WinML can handle the conversion between them.

  • Bgra8
  • Rgba8
  • Gray8

Implementation

Googletest's value parameterized tests are used.