MobileNetV2 Image Classification using WebNN.
This model has been created with webnn-graph (https://github.com/tarekziade/webnn-graph), it's composed of 3 files:
model.webnn: Graph definitionmodel.weights: Model weightsmanifest.json: metadata, describes tensor shapes, data types and other things
To run this model, install PyWebNN and Pillow:
pip install pywebnn pillow onnxruntime
Warning : you need PyWebNN v0.5.0+
Grab the demo script here : https://huggingface.co/tarekziade/mobilenet-webnn/blob/main/demo.py
Then run the classifier on one of your images
➜ python demo.py test.jpg
======================================================================
MobileNetV2 Image Classification (Hugging Face Hub)
======================================================================
Image: test.jpg
Model: tarekziade/mobilenet-webnn
Backend: ONNX CPU
Downloading model from Hugging Face Hub...
[CACHED] model.webnn
[CACHED] model.weights
[CACHED] manifest.json
[OK] Downloaded (0.37ms)
- Graph: model.webnn
Loading graph...
[OK] Loaded (8.97ms)
Preprocessing image...
[OK] (1, 3, 224, 224) (16.05ms)
Creating WebNN context...
[OK] Context created (accelerated=False)
Running inference...
[OK] Done (67.80ms)
Top 5 Predictions:
----------------------------------------------------------------------
1. lesser panda 99.60%
2. polecat 0.20%
3. weasel 0.09%
4. black-footed ferret 0.02%
5. kit fox 0.01%
======================================================================
Performance Summary:
- Model Download: 0.37ms
- Graph Load: 8.97ms
- Preprocessing: 16.05ms
- Inference: 67.80ms
- Total Time: 93.19ms
======================================================================
[OK] Done. Cache dir: /Users/tarekziade/.cache/webnn
Inference Providers
NEW
This model isn't deployed by any Inference Provider.
🙋
Ask for provider support