PVT v2 b0 for Core AI

PVT v2 b0 (3.7M parameters, ImageNet-1k) from timm, exported to Apple Core AI with the apple/coreai-models recipe:

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, download pvt-v2-b0/ into app storage, then:

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). The labels come from timm's ImageNet metadata. This repository only converts the model to Core AI format.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Paper for grabbou/pvt-v2-b0-CoreAI