Git Product home page Git Product logo

webnn-samples's Issues

[Fast Style Transfer] [WebNN CPU] Failed to execute 'build' on 'MLGraphBuilder', XNNPACK only supports constant padding mode

Repro Steps:

  1. Launch latest Chrome Canary on Windows 11
    C:\Users\AppData\Local\Google\Chrome SxS\Application\chrome.exe" --enable-features=WebMachineLearningNeuralNetwork

  2. Visit https://webmachinelearning.github.io/webnn-samples/style_transfer/index.html

  3. Choose webnn-cpu backend

Actual Result:

    DOMException: Failed to execute 'build' on 'MLGraphBuilder': XNNPACK only supports constant padding mode.

Environment:

Chrome Canary: 125.0.6381.0

Device OS CPU GPU
Laptop Windows 11 23H2 Ultra 7 155H Intel Arc Graphics

Run semantic segmentation sample on full GPU pipeline

This is required by webmachinelearning/webnn#226

To implement this pipeline, the semantic segmentation sample probably could execute following steps:

  1. Use mediacapture-transform to capture the VideoFrame
  2. Import the VideoFrame into a WebGPU texture (GPUExternalTexture)
  3. Execute WebGPU shader to do pre-processing and convert the GPUExternalTexture to a GPUBuffer
  4. Compute the MLGraph with converted GPUBuffer and the output is another GPUBuffer
  5. Execute WebGPU shader to do post-processing on the output GPUBuffer and render the result to a canvas.
  6. Create a VideoFrame from the CanvasImageSource and enqueue to the mediacapture-transform API's controller.

Need Face detection and Face Recognition samples migrated to new Framework as old ones crashing in Live camera use case

Hi,

I am looking for Face detection and recognition samples migrated to new repository, but i don't see any specific samples there, and i tried samples from old repository ([https://github.com/intel/webml-polyfill [github.com]) but those are crashing in the live camera case. we are looking for latest libraries which support FR/FD functionality to use in our project. so anything available immediately is of great help.

Regards
Roshan

Adapt to sync API and require pre-allocated output buffers

Implement the changes introduced by webmachinelearning/webnn#174

The changes include:

  1. Change MLGraphBuilder.build and MLGraph.compute to sync API.
  2. Change MLGraph.compute to require pre-allocated output buffers.
  3. Simplify the the input / output resources binding by MLResource. Leave MLInput only for dynamic input shape case.

The webnn-polyfill PR webmachinelearning/webnn-polyfill#85 is ready to merge.

Please adapt to that change before we merge that PR which will break the samples. Thanks!

[Handwritten Digits Classification] When the number in the picture are cleared, it can still be predicted

Repro Steps:

  1. Launch latest Chrome Canary on Windows 11
    C:\Users\AppData\Local\Google\Chrome SxS\Application\chrome.exe" --enable-features=WebMachineLearningNeuralNetwork
  2. Visit https://webmachinelearning.github.io/webnn-samples/lenet/index.html
  3. Choose backend webnn-cpu and click Clear button.
  4. Click Predict button.

Actual Result:

    When the number in the picture are cleared, it can still be predicted.
Environment:

Chrome Canary: 125.0.6381.0

Device OS CPU GPU
Laptop Windows 11 23H2 Ultra 7 155H Intel Arc Graphics

image

[Noise Suppression NSNet2] [Wasm] Kernel 'Complex' not registered for backend wasm

Repro Steps:

  1. Launch latest Chrome Canary on Windows 11 without WebNN flag
    "C:\Users\AppData\Local\Google\Chrome SxS\Application\chrome.exe"

  2. Visit https://webmachinelearning.github.io/webnn-samples/nsnet2/index.html

  3. Choose wasm backend

Actual Result:

    Error: Kernel 'Complex' not registered for backend 'wasm'.

Environment:

Chrome Canary: 125.0.6381.0

Device OS CPU GPU
Laptop Windows 11 23H2 Ultra 7 155H Intel Arc Graphics

[Noise Suppression NSNet2 RNNoise] [WebNN GPU] Failed to execute 'build' on 'MLGraphBuilder': DirectML: This operator (gru) is not supported.

Repro Steps:

  1. Launch latest Chrome Canary on Windows 11
    C:\Users\AppData\Local\Google\Chrome SxS\Application\chrome.exe" --enable-features=WebMachineLearningNeuralNetwork

  2. Visit https://webmachinelearning.github.io/webnn-samples/nsnet2/index.html

    or https://webmachinelearning.github.io/webnn-samples/rnnoise/index.html

  3. Choose webnn-gpu backend

Actual Result:

    DOMException: Failed to execute 'build' on 'MLGraphBuilder': DirectML: This operator (gru) is not supported.

Environment:

Chrome Canary: 125.0.6381.0

Device OS CPU GPU
Laptop Windows 11 23H2 Ultra 7 155H Intel Arc Graphics

Inconsistent ”Could not get context for WebGL version 2” error message

Steps to reproduce:

  1. Load https://webmachinelearning.github.io/webnn-samples/code/?example=mul_add.js

  2. Click Run

  3. Console log prints:

Could not get context for WebGL version 2
Output shape: 2,2
Output value: 1,1,1,1
  1. Click Run again
  2. Console log prints:
Output shape: 2,2
Output value: 1,1,1,1

Expected log messages in 3 and 5 to be identical, including the WebGL error message.

Mozilla/5.0 (iPhone; CPU iPhone OS 14_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 Mobile/15E148 Safari/604.1

NNotepad: Issues with serialization of non-tensor arrays

Normally, when serializing an expression into code, an array [...] is serialized as a constant MLOperand. Since some methods take sequences, there's a WebNNUtil.isNonOperandArg() helper that answers "for method X argument Y, should it be a constant MLOperand?". If this returns true, then a method arg is serialized as a JS array instead.

But this is not applied recursively. This is sufficient for this case:

T = [[1,2],[3,4]]
concat([T, T], 1)

... where concat() wants an array of tensors. But not for:

T = [[1,2],[3,4]]
reshape(data, [1, 2, 2, 1])

... where reshape wants an array of numbers (not scalar constants).

Fast style transfer error

Hi!
Thanks for making this available!

I get an error on the fast style transfer example saying:
"the value length 874800 is invalid, size of [1,3,33,33] 3267 is expected." and it never starts. This is on Chrome (also Canary) and Firefox, Mac OSX and POP_OS.

In the console it also shows: "Error with Permissions-Policy header: Unrecognized feature: 'interest-cohort'" but this may be unrelated.

Thanks,
Dirk

Unable to run the demos locally

I tested running the sample examples locally but the following errors are coming both in MacOS and in Windows :

  1. Local VS Code Console Error :
    image

  2. Browser Error :
    image

Both of them are for the missing kernels. Do we have to download the weights separately for each of the projects?

Add fp16 precision support

Hi,
Can we add fp16 version of the models? (have all inputs and weights be fp16).
On Mac, CoreML only use NPU when the data is fp16. It would be valuable to have webnn samples with fp16 precision to compare the performance.

[Noise Suppression NSNet2 RNNoise] [WebNN CPU] Failed to execute 'build' on 'MLGraphBuilder': XNNPACK can't support broadcasting for matrix multiply.

Repro Steps:

  1. Launch latest Chrome Canary on Windows 11
    C:\Users\AppData\Local\Google\Chrome SxS\Application\chrome.exe" --enable-features=WebMachineLearningNeuralNetwork

  2. Visit https://webmachinelearning.github.io/webnn-samples/nsnet2/index.html

    or https://webmachinelearning.github.io/webnn-samples/rnnoise/index.html

  3. Choose webnn-cpu backend

Actual Result:

    DOMException: Failed to execute 'build' on 'MLGraphBuilder': XNNPACK can't support broadcasting for matrix multiply.

Environment:

Chrome Canary: 125.0.6381.0

Device OS CPU GPU
Laptop Windows 11 23H2 Ultra 7 155H Intel Arc Graphics

[NNotepad] deleting text doesn't cause refresh

Repro:

  1. Load https://webmachinelearning.github.io/webnn-samples/nnotepad/index.html
    1, In text field, select everything after a = 123, press backspace/delete

Expected:

  • results area updates with scalar 123

Actual:

  • results area still shows 2 tensors (result of split() example)

Notes:

  • The code adds an "input"event listener to the #input element, which calls refresh(). The Monaco editor must not be firing this for deletion events? Is there a better way to listen to the Monaco editor?

[NNotepad] Add custom language grammar for Monaco editor

Currently the NNotepad code uses the Monaco editor with default (?) syntax highlighting, which is okay but not perfect.

Given that NNotepad has a well defined set of tokens and a grammar for parsing, and Monaco has a way to specify custom languages, we should be able to do better.

(Not urgent, this is just a "to-do" item.)

Add NPU option

Now that the Chromium prototype supports passing "npu" in the context creation options we need samples that exercise this code path.

Invalid signature.

I run it in local and it will show "invalid signature"
my device is Win 11 22H2 and enable WebNN

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.