|
Download README.md from grabbou/pvt-v2-b0-CoreAI: direct link, hf CLI and curl.
- Browser
- Download file 1.66 kB
-
https://huggingface.co/grabbou/pvt-v2-b0-CoreAI/resolve/main/README.md
- Command line
-
hf download hf://grabbou/pvt-v2-b0-CoreAI/README.md
-
curl -L -o README.md https://huggingface.co/grabbou/pvt-v2-b0-CoreAI/resolve/main/README.md
1.66 kB
| license: apache-2.0 | |
| pipeline_tag: image-classification | |
| library_name: coreai | |
| tags: | |
| - core-ai | |
| - ios | |
| - imagenet | |
| # PVT v2 b0 for Core AI | |
| PVT v2 b0 (3.7M parameters, ImageNet-1k) from [timm](https://huggingface.co/docs/timm), exported to Apple Core AI with the [`apple/coreai-models`](https://github.com/apple/coreai-models/tree/main/models/pvt) recipe: | |
| ```sh | |
| uv run models/pvt/export.py --dtype float16 | |
| ``` | |
| | Folder | Contents | Size | Platforms | | |
| | ------------ | ----------------------------------------------------------------------------------------- | ------ | ---------- | | |
| | `pvt-v2-b0/` | `pvt-v2-b0.aimodel`: `main(x) -> logits`, `x` is `[1, 3, 224, 224]` float16 RGB normalized with the ImageNet mean and std. `labels.json`: the 1000 ImageNet class names, by logit index | 7.1 MB | iOS, macOS | | |
| ## Use | |
| With [`@react-native-ai/core-ai`](https://github.com/callstackincubator/ai/tree/main/packages/core-ai), download `pvt-v2-b0/` into app storage, then: | |
| ```ts | |
| const { output } = await CoreAI.runTask( | |
| 'classification', | |
| { id: 'pvt-v2-b0', sourceType: 'file', sourceUri: pathToFolder }, | |
| { imageUri }, | |
| { topK: 5 } | |
| ) | |
| // output.classifications: [{ label: 'tabby, tabby cat', index: 281, confidence: 0.36 }, ...] | |
| ``` | |
| The Neural Engine compiler rejects this export on macOS 27.0, so load it on the GPU there (`computeUnits: 'gpu'`). | |
| ## License | |
| PVT v2 and its timm weights are Apache-2.0 ([paper](https://arxiv.org/abs/2106.13797)). The labels come from timm's ImageNet metadata. This repository only converts the model to Core AI format. | |