Closed anssiko closed 4 years ago
I propose to add an example of convolution neural network (CNN) for handwritten digit classification. For example, we can use LeNet-5 topology as it only contains a few layers.
There are couple of references:
Based on the reference, the required ops include: conv2d
, add
, maxPool2d
, reshape
, matmul
, relu
and softmax
. All ops are supported by webnn spec except softmax
which is being reviewed in PR #68.
Thanks for the proposal! I feel this computer-vision problem is a classic and as such well suited for an advanced example and also gives us good op coverage with respect to what is specified currently.
Thoughts from others?
Related RESOLUTION: Add an example of convolution neural network (CNN) for handwritten digit classification:
Related RESOLUTION: Add an example of convolution neural network (CNN) for handwritten digit classification:
PR https://github.com/webmachinelearning/webnn-samples/pull/1 has been created.
A live version is hosted at: https://huningxin.github.io/webnn-samples/lenet/.
Here is a screenshot:
The LeNet graph building code is about 74 LOC: https://github.com/huningxin/webnn-samples/blob/lenet/lenet/lenet.js#L22-L96 that uses conv2d
, add
, maxPool2d
, reshape
, matmul
, relu
and softmax
ops.
If it looks good, I can create another PR to add the example into the spec.
We should add a more advanced example to the spec that makes use of (some of) the new ops we've added to the spec recently. We should keep a simple "Hello World" style example and in addition add another more advanced one within a reasonable LOC limit.
The examples in specs are often a starting point for web developers who try out a new API for the first time, so we need to make sure the examples are maintained along the spec definition.