Skip to content

WCR: ImageDescriptionGenerator::DescribeAsync returns InternalError #5385

Closed
@riverar

Description

@riverar

Describe the bug

The ImageDescriptionGenerator.DescribeAsync() method, for unknown reasons, has started returning InternalError across reboots, updates, etc. Might be caused by a Windows update?

Phi Silica, Text Recognition (OCR), Image Super Resolution, Image Segmentation, and Object Erase are unaffected.

Feedback Hub trace

https://aka.ms/AAw297q

Steps to reproduce the bug

  1. Clone https://github.com/riverar/repro-799c78fb
  2. Deploy and execute app on arm64 machine
  3. Click the single button in the app and observe debug output:
    Status: InternalError
    Description: 
    

Tip: This also reproduces in the Microsoft AI Dev Gallery Preview app.

Expected behavior

  Status: Complete (or similar)
  Description: Swirly blue whatever (or similar)

Code

private async void Button_Click(object sender, RoutedEventArgs e)
{
    if (ImageDescriptionGenerator.GetReadyState() == AIFeatureReadyState.EnsureNeeded)
    {
        var result = await ImageDescriptionGenerator.EnsureReadyAsync();
        if (result.Status != AIFeatureReadyResultState.Failure)
        {
            {
                throw result.ExtendedError;
            }
        }
    }

    ImageDescriptionGenerator imageDescriptionGenerator = await ImageDescriptionGenerator.CreateAsync();


    var file = await StorageFile.GetFileFromPathAsync(@"C:\Windows\Web\Wallpaper\Windows\img0.jpg");
    using var stream = await file.OpenAsync(FileAccessMode.Read);
    var decoder = await BitmapDecoder.CreateAsync(stream);
    using var softwareBitmap = await decoder.GetSoftwareBitmapAsync();
    using ImageBuffer inputImage = ImageBuffer.CreateCopyFromBitmap(softwareBitmap);

    // Create content moderation thresholds object.
    ContentFilterOptions filterOptions = new ContentFilterOptions();
    filterOptions.ResponseMaxAllowedSeverityLevel = new TextContentFilterSeverity(SeverityLevel.High);
    filterOptions.ImageMaxAllowedSeverityLevel = new ImageContentFilterSeverity(SeverityLevel.High);

    // Get text description.
    var languageModelResponse = await imageDescriptionGenerator.DescribeAsync(inputImage, ImageDescriptionKind.BriefDescription, filterOptions);

    Debug.Print($"Status: {languageModelResponse.Status}");
    Debug.Print($"Description: {languageModelResponse.Description}");

}

NuGet package version

Windows App SDK 1.8 Experimental 1: 1.8.250410001-experimental1

Packaging type

Packaged (MSIX)

Windows version

Insider Build (xxxxx)

IDE

Visual Studio 2022-preview

Additional context

Windows vNext 10.0.26200.5570

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions