Instructions to use onnx-community/vitpose-base-simple with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers.js
How to use onnx-community/vitpose-base-simple with Transformers.js:
// npm i @huggingface/transformers import { AutoModel, AutoImageProcessor, RawImage } from '@huggingface/transformers'; const model = await AutoModel.from_pretrained('onnx-community/vitpose-base-simple'); const processor = await AutoImageProcessor.from_pretrained('onnx-community/vitpose-base-simple'); const image = await RawImage.read('https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/ryan-gosling.jpg'); const inputs = await processor(image); const { heatmaps } = await model(inputs); // ViTPose is a top-down model: pass one box per person, in COCO format [x, y, width, height] const boxes = [[[0, 0, image.width, image.height]]]; const results = processor.post_process_pose_estimation(heatmaps, boxes)[0][0]; console.log(results); // { bbox, scores, labels, keypoints }
Ctrl+K