import{s as lt,A as nt,o as ot,n as ks}from"../chunks/scheduler.01eeda35.js";import{S as rt,i as it,g as o,s as a,r as M,A as pt,h as r,f as t,c as l,j as z,u as m,x as c,k as T,y as u,a as n,v as d,d as y,t as h,w as U}from"../chunks/index.6dd51b66.js";import{T as ct}from"../chunks/Tip.de9bae2b.js";import{D as Be}from"../chunks/Docstring.cb556860.js";import{C as Se}from"../chunks/CodeBlock.19ec9b8c.js";import{E as at}from"../chunks/ExampleCodeBlock.69db56ad.js";import{H as v,E as Mt}from"../chunks/index.58fe8f9d.js";function mt(k){let p,w="Example:",f,j,b;return j=new Se({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFZpdFBvc2VDb25maWclMkMlMjBWaXRQb3NlRm9yUG9zZUVzdGltYXRpb24lMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwVml0UG9zZSUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwVml0UG9zZUNvbmZpZygpJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMG1vZGVsJTIwKHdpdGglMjByYW5kb20lMjB3ZWlnaHRzKSUyMGZyb20lMjB0aGUlMjBjb25maWd1cmF0aW9uJTBBbW9kZWwlMjAlM0QlMjBWaXRQb3NlRm9yUG9zZUVzdGltYXRpb24oY29uZmlndXJhdGlvbiklMEElMEElMjMlMjBBY2Nlc3NpbmclMjB0aGUlMjBtb2RlbCUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwbW9kZWwuY29uZmln",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> VitPoseConfig, VitPoseForPoseEstimation

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a VitPose configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = VitPoseConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model (with random weights) from the configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = VitPoseForPoseEstimation(configuration)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Accessing the model configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = model.config`,wrap:!1}}),{c(){p=o("p"),p.textContent=w,f=a(),M(j.$$.fragment)},l(i){p=r(i,"P",{"data-svelte-h":!0}),c(p)!=="svelte-11lpom8"&&(p.textContent=w),f=l(i),m(j.$$.fragment,i)},m(i,g){n(i,p,g),n(i,f,g),d(j,i,g),b=!0},p:ks,i(i){b||(y(j.$$.fragment,i),b=!0)},o(i){h(j.$$.fragment,i),b=!1},d(i){i&&(t(p),t(f)),U(j,i)}}}function dt(k){let p,w=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){p=o("p"),p.innerHTML=w},l(f){p=r(f,"P",{"data-svelte-h":!0}),c(p)!=="svelte-fincs2"&&(p.innerHTML=w)},m(f,j){n(f,p,j)},p:ks,d(f){f&&t(p)}}}function yt(k){let p,w="Examples:",f,j,b;return j=new Se({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyMFZpdFBvc2VGb3JQb3NlRXN0aW1hdGlvbiUwQWltcG9ydCUyMHRvcmNoJTBBZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEElMEFwcm9jZXNzb3IlMjAlM0QlMjBBdXRvSW1hZ2VQcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKCUyMnVzeWQtY29tbXVuaXR5JTJGdml0cG9zZS1iYXNlLXNpbXBsZSUyMiklMEFtb2RlbCUyMCUzRCUyMFZpdFBvc2VGb3JQb3NlRXN0aW1hdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIydXN5ZC1jb21tdW5pdHklMkZ2aXRwb3NlLWJhc2Utc2ltcGxlJTIyKSUwQSUwQXVybCUyMCUzRCUyMCUyMmh0dHAlM0ElMkYlMkZpbWFnZXMuY29jb2RhdGFzZXQub3JnJTJGdmFsMjAxNyUyRjAwMDAwMDAzOTc2OS5qcGclMjIlMEFpbWFnZSUyMCUzRCUyMEltYWdlLm9wZW4ocmVxdWVzdHMuZ2V0KHVybCUyQyUyMHN0cmVhbSUzRFRydWUpLnJhdyklMEFib3hlcyUyMCUzRCUyMCU1QiU1QiU1QjQxMi44JTJDJTIwMTU3LjYxJTJDJTIwNTMuMDUlMkMlMjAxMzguMDElNUQlMkMlMjAlNUIzODQuNDMlMkMlMjAxNzIuMjElMkMlMjAxNS4xMiUyQyUyMDM1Ljc0JTVEJTVEJTVEJTBBaW5wdXRzJTIwJTNEJTIwcHJvY2Vzc29yKGltYWdlJTJDJTIwYm94ZXMlM0Rib3hlcyUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBJTBBd2l0aCUyMHRvcmNoLm5vX2dyYWQoKSUzQSUwQSUyMCUyMCUyMCUyMG91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyklMEFoZWF0bWFwcyUyMCUzRCUyMG91dHB1dHMuaGVhdG1hcHM=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, VitPoseForPoseEstimation
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> requests

<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoImageProcessor.from_pretrained(<span class="hljs-string">&quot;usyd-community/vitpose-base-simple&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = VitPoseForPoseEstimation.from_pretrained(<span class="hljs-string">&quot;usyd-community/vitpose-base-simple&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;http://images.cocodataset.org/val2017/000000039769.jpg&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image = Image.<span class="hljs-built_in">open</span>(requests.get(url, stream=<span class="hljs-literal">True</span>).raw)
<span class="hljs-meta">&gt;&gt;&gt; </span>boxes = [[[<span class="hljs-number">412.8</span>, <span class="hljs-number">157.61</span>, <span class="hljs-number">53.05</span>, <span class="hljs-number">138.01</span>], [<span class="hljs-number">384.43</span>, <span class="hljs-number">172.21</span>, <span class="hljs-number">15.12</span>, <span class="hljs-number">35.74</span>]]]
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = processor(image, boxes=boxes, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">with</span> torch.no_grad():
<span class="hljs-meta">... </span>    outputs = model(**inputs)
<span class="hljs-meta">&gt;&gt;&gt; </span>heatmaps = outputs.heatmaps`,wrap:!1}}),{c(){p=o("p"),p.textContent=w,f=a(),M(j.$$.fragment)},l(i){p=r(i,"P",{"data-svelte-h":!0}),c(p)!=="svelte-kvfsh7"&&(p.textContent=w),f=l(i),m(j.$$.fragment,i)},m(i,g){n(i,p,g),n(i,f,g),d(j,i,g),b=!0},p:ks,i(i){b||(y(j.$$.fragment,i),b=!0)},o(i){h(j.$$.fragment,i),b=!1},d(i){i&&(t(p),t(f)),U(j,i)}}}function ht(k){let p,w,f,j,b,i,g,Vs='<img alt="PyTorch" src="https://img.shields.io/badge/PyTorch-DE3412?style=flat&amp;logo=pytorch&amp;logoColor=white"/>',Ze,W,xe,P,Bs=`The ViTPose model was proposed in <a href="https://arxiv.org/abs/2204.12484" rel="nofollow">ViTPose: Simple Vision Transformer Baselines for Human Pose Estimation</a> by Yufei Xu, Jing Zhang, Qiming Zhang, Dacheng Tao. ViTPose employs a standard, non-hierarchical <a href="vit">Vision Transformer</a> as backbone for the task of keypoint estimation. A simple decoder head is added on top to predict the heatmaps from a given image. Despite its simplicity, the model gets state-of-the-art results on the challenging MS COCO Keypoint Detection benchmark. The model was further improved in <a href="https://arxiv.org/abs/2212.04246" rel="nofollow">ViTPose++: Vision Transformer for Generic Body Pose Estimation</a> where the authors employ
a mixture-of-experts (MoE) module in the ViT backbone along with pre-training on more data, which further enhances the performance.`,Ee,X,Ss="The abstract from the paper is the following:",Ge,R,Qs="<em>Although no specific domain knowledge is considered in the design, plain vision transformers have shown excellent performance in visual recognition tasks. However, little effort has been made to reveal the potential of such simple structures for pose estimation tasks. In this paper, we show the surprisingly good capabilities of plain vision transformers for pose estimation from various aspects, namely simplicity in model structure, scalability in model size, flexibility in training paradigm, and transferability of knowledge between models, through a simple baseline model called ViTPose. Specifically, ViTPose employs plain and non-hierarchical vision transformers as backbones to extract features for a given person instance and a lightweight decoder for pose estimation. It can be scaled up from 100M to 1B parameters by taking the advantages of the scalable model capacity and high parallelism of transformers, setting a new Pareto front between throughput and performance. Besides, ViTPose is very flexible regarding the attention type, input resolution, pre-training and finetuning strategy, as well as dealing with multiple pose tasks. We also empirically demonstrate that the knowledge of large ViTPose models can be easily transferred to small ones via a simple knowledge token. Experimental results show that our basic ViTPose model outperforms representative methods on the challenging MS COCO Keypoint Detection benchmark, while the largest model sets a new state-of-the-art.</em>",Ne,V,Zs,ze,$,xs='ViTPose architecture. Taken from the <a href="https://arxiv.org/abs/2204.12484">original paper.</a>',We,F,Es=`This model was contributed by <a href="https://huggingface.co/nielsr" rel="nofollow">nielsr</a> and <a href="https://github.com/SangbumChoi" rel="nofollow">sangbumchoi</a>.
The original code can be found <a href="https://github.com/ViTAE-Transformer/ViTPose" rel="nofollow">here</a>.`,Pe,L,Xe,D,Gs='ViTPose is a so-called top-down keypoint detection model. This means that one first uses an object detector, like <a href="rt_detr.md">RT-DETR</a>, to detect people (or other instances) in an image. Next, ViTPose takes the cropped images as input and predicts the keypoints for each of them.',Re,H,$e,Y,Fe,K,Ns='The best <a href="https://huggingface.co/collections/usyd-community/vitpose-677fcfd0a0b2b5c8f79c4335" rel="nofollow">checkpoints</a> are those of the <a href="https://arxiv.org/abs/2212.04246" rel="nofollow">ViTPose++ paper</a>. ViTPose++ models employ a so-called <a href="https://huggingface.co/blog/moe" rel="nofollow">Mixture-of-Experts (MoE)</a> architecture for the ViT backbone, resulting in better performance.',Le,q,zs=`The ViTPose+ checkpoints use 6 experts, hence 6 different dataset indices can be passed.
An overview of the various dataset indices is provided below:`,De,O,Ws='<li>0: <a href="https://cocodataset.org/#overview" rel="nofollow">COCO validation 2017</a> dataset, using an object detector that gets 56 AP on the “person” class</li> <li>1: <a href="https://github.com/fabbrimatteo/AiC-Dataset" rel="nofollow">AiC</a> dataset</li> <li>2: <a href="https://www.mpi-inf.mpg.de/departments/computer-vision-and-machine-learning/software-and-datasets/mpii-human-pose-dataset" rel="nofollow">MPII</a> dataset</li> <li>3: <a href="https://github.com/AlexTheBad/AP-10K" rel="nofollow">AP-10K</a> dataset</li> <li>4: <a href="https://github.com/pandorgan/APT-36K" rel="nofollow">APT-36K</a> dataset</li> <li>5: <a href="https://github.com/jin-s13/COCO-WholeBody" rel="nofollow">COCO-WholeBody</a> dataset</li>',He,ee,Ps="Pass the <code>dataset_index</code> argument in the forward of the model to indicate which experts to use for each example in the batch. Example usage is shown below:",Ye,se,Ke,te,Xs=`The ViTPose+ checkpoints use 6 experts, hence 6 different dataset indices can be passed.
An overview of the various dataset indices is provided below:`,qe,ne,Rs='<li>0: <a href="https://cocodataset.org/#overview" rel="nofollow">COCO validation 2017</a> dataset, using an object detector that gets 56 AP on the “person” class</li> <li>1: <a href="https://github.com/fabbrimatteo/AiC-Dataset" rel="nofollow">AiC</a> dataset</li> <li>2: <a href="https://www.mpi-inf.mpg.de/departments/computer-vision-and-machine-learning/software-and-datasets/mpii-human-pose-dataset" rel="nofollow">MPII</a> dataset</li> <li>3: <a href="https://github.com/AlexTheBad/AP-10K" rel="nofollow">AP-10K</a> dataset</li> <li>4: <a href="https://github.com/pandorgan/APT-36K" rel="nofollow">APT-36K</a> dataset</li> <li>5: <a href="https://github.com/jin-s13/COCO-WholeBody" rel="nofollow">COCO-WholeBody</a> dataset</li>',Oe,ae,es,le,$s='To visualize the various keypoints, one can either leverage the <code>supervision</code> [library](<a href="https://github.com/roboflow/supervision" rel="nofollow">https://github.com/roboflow/supervision</a> (requires <code>pip install supervision</code>):',ss,oe,ts,re,Fs='Alternatively, one can also visualize the keypoints using <a href="https://opencv.org/" rel="nofollow">OpenCV</a> (requires <code>pip install opencv-python</code>):',ns,ie,as,B,Ls,ls,pe,os,ce,Ds="A list of official Hugging Face and community (indicated by 🌎) resources to help you get started with ViTPose. If you’re interested in submitting a resource to be included here, please feel free to open a Pull Request and we’ll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource.",rs,Me,Hs='<li>A demo of ViTPose on images and video can be found <a href="https://huggingface.co/spaces/hysts/ViTPose-transformers" rel="nofollow">here</a>.</li> <li>A notebook illustrating inference and visualization can be found <a href="https://github.com/NielsRogge/Transformers-Tutorials/blob/master/ViTPose/Inference_with_ViTPose_for_human_pose_estimation.ipynb" rel="nofollow">here</a>.</li>',is,me,ps,J,de,us,Je,Ys="Constructs a VitPose image processor.",js,S,ye,fs,Ce,Ks="Preprocess an image or batch of images.",bs,Q,he,gs,_e,qs="Transform the heatmaps into keypoint predictions and transform them back to the image.",cs,Ue,Ms,C,ue,Ts,Ie,Os=`This is the configuration class to store the configuration of a <a href="/docs/transformers/main/en/model_doc/vitpose#transformers.VitPoseForPoseEstimation">VitPoseForPoseEstimation</a>. It is used to instantiate a
VitPose model according to the specified arguments, defining the model architecture. Instantiating a configuration
with the defaults will yield a similar configuration to that of the VitPose
<a href="https://huggingface.co/usyd-community/vitpose-base-simple" rel="nofollow">usyd-community/vitpose-base-simple</a> architecture.`,ws,Ae,et=`Configuration objects inherit from <a href="/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> and can be used to control the model outputs. Read the
documentation from <a href="/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,Js,Z,ms,je,ds,I,fe,Cs,ve,st=`The VitPose model with a pose estimation head on top.
This model is a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`,_s,_,be,Is,ke,tt='The <a href="/docs/transformers/main/en/model_doc/vitpose#transformers.VitPoseForPoseEstimation">VitPoseForPoseEstimation</a> forward method, overrides the <code>__call__</code> special method.',As,x,vs,E,ys,ge,hs,Qe,Us;return b=new v({props:{title:"ViTPose",local:"vitpose",headingTag:"h1"}}),W=new v({props:{title:"Overview",local:"overview",headingTag:"h2"}}),L=new v({props:{title:"Usage Tips",local:"usage-tips",headingTag:"h2"}}),H=new Se({props:{code:"aW1wb3J0JTIwdG9yY2glMEFpbXBvcnQlMjByZXF1ZXN0cyUwQWltcG9ydCUyMG51bXB5JTIwYXMlMjBucCUwQSUwQWZyb20lMjBQSUwlMjBpbXBvcnQlMjBJbWFnZSUwQSUwQWZyb20lMjB0cmFuc2Zvcm1lcnMlMjBpbXBvcnQlMjBBdXRvUHJvY2Vzc29yJTJDJTIwUlREZXRyRm9yT2JqZWN0RGV0ZWN0aW9uJTJDJTIwVml0UG9zZUZvclBvc2VFc3RpbWF0aW9uJTBBJTBBZGV2aWNlJTIwJTNEJTIwJTIyY3VkYSUyMiUyMGlmJTIwdG9yY2guY3VkYS5pc19hdmFpbGFibGUoKSUyMGVsc2UlMjAlMjJjcHUlMjIlMEElMEF1cmwlMjAlM0QlMjAlMjJodHRwJTNBJTJGJTJGaW1hZ2VzLmNvY29kYXRhc2V0Lm9yZyUyRnZhbDIwMTclMkYwMDAwMDAwMDAxMzkuanBnJTIyJTBBaW1hZ2UlMjAlM0QlMjBJbWFnZS5vcGVuKHJlcXVlc3RzLmdldCh1cmwlMkMlMjBzdHJlYW0lM0RUcnVlKS5yYXcpJTBBJTBBJTIzJTIwLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tJTBBJTIzJTIwU3RhZ2UlMjAxLiUyMERldGVjdCUyMGh1bWFucyUyMG9uJTIwdGhlJTIwaW1hZ2UlMEElMjMlMjAtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0lMEElMEElMjMlMjBZb3UlMjBjYW4lMjBjaG9vc2UlMjBhbnklMjBkZXRlY3RvciUyMG9mJTIweW91ciUyMGNob2ljZSUwQXBlcnNvbl9pbWFnZV9wcm9jZXNzb3IlMjAlM0QlMjBBdXRvUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJQZWtpbmdVJTJGcnRkZXRyX3I1MHZkX2NvY29fbzM2NSUyMiklMEFwZXJzb25fbW9kZWwlMjAlM0QlMjBSVERldHJGb3JPYmplY3REZXRlY3Rpb24uZnJvbV9wcmV0cmFpbmVkKCUyMlBla2luZ1UlMkZydGRldHJfcjUwdmRfY29jb19vMzY1JTIyJTJDJTIwZGV2aWNlX21hcCUzRGRldmljZSklMEElMEFpbnB1dHMlMjAlM0QlMjBwZXJzb25faW1hZ2VfcHJvY2Vzc29yKGltYWdlcyUzRGltYWdlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMikudG8oZGV2aWNlKSUwQSUwQXdpdGglMjB0b3JjaC5ub19ncmFkKCklM0ElMEElMjAlMjAlMjAlMjBvdXRwdXRzJTIwJTNEJTIwcGVyc29uX21vZGVsKCoqaW5wdXRzKSUwQSUwQXJlc3VsdHMlMjAlM0QlMjBwZXJzb25faW1hZ2VfcHJvY2Vzc29yLnBvc3RfcHJvY2Vzc19vYmplY3RfZGV0ZWN0aW9uKCUwQSUyMCUyMCUyMCUyMG91dHB1dHMlMkMlMjB0YXJnZXRfc2l6ZXMlM0R0b3JjaC50ZW5zb3IoJTVCKGltYWdlLmhlaWdodCUyQyUyMGltYWdlLndpZHRoKSU1RCklMkMlMjB0aHJlc2hvbGQlM0QwLjMlMEEpJTBBcmVzdWx0JTIwJTNEJTIwcmVzdWx0cyU1QjAlNUQlMjAlMjAlMjMlMjB0YWtlJTIwZmlyc3QlMjBpbWFnZSUyMHJlc3VsdHMlMEElMEElMjMlMjBIdW1hbiUyMGxhYmVsJTIwcmVmZXJzJTIwMCUyMGluZGV4JTIwaW4lMjBDT0NPJTIwZGF0YXNldCUwQXBlcnNvbl9ib3hlcyUyMCUzRCUyMHJlc3VsdCU1QiUyMmJveGVzJTIyJTVEJTVCcmVzdWx0JTVCJTIybGFiZWxzJTIyJTVEJTIwJTNEJTNEJTIwMCU1RCUwQXBlcnNvbl9ib3hlcyUyMCUzRCUyMHBlcnNvbl9ib3hlcy5jcHUoKS5udW1weSgpJTBBJTBBJTIzJTIwQ29udmVydCUyMGJveGVzJTIwZnJvbSUyMFZPQyUyMCh4MSUyQyUyMHkxJTJDJTIweDIlMkMlMjB5MiklMjB0byUyMENPQ08lMjAoeDElMkMlMjB5MSUyQyUyMHclMkMlMjBoKSUyMGZvcm1hdCUwQXBlcnNvbl9ib3hlcyU1QiUzQSUyQyUyMDIlNUQlMjAlM0QlMjBwZXJzb25fYm94ZXMlNUIlM0ElMkMlMjAyJTVEJTIwLSUyMHBlcnNvbl9ib3hlcyU1QiUzQSUyQyUyMDAlNUQlMEFwZXJzb25fYm94ZXMlNUIlM0ElMkMlMjAzJTVEJTIwJTNEJTIwcGVyc29uX2JveGVzJTVCJTNBJTJDJTIwMyU1RCUyMC0lMjBwZXJzb25fYm94ZXMlNUIlM0ElMkMlMjAxJTVEJTBBJTBBJTIzJTIwLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tJTBBJTIzJTIwU3RhZ2UlMjAyLiUyMERldGVjdCUyMGtleXBvaW50cyUyMGZvciUyMGVhY2glMjBwZXJzb24lMjBmb3VuZCUwQSUyMyUyMC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSUwQSUwQWltYWdlX3Byb2Nlc3NvciUyMCUzRCUyMEF1dG9Qcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKCUyMnVzeWQtY29tbXVuaXR5JTJGdml0cG9zZS1iYXNlLXNpbXBsZSUyMiklMEFtb2RlbCUyMCUzRCUyMFZpdFBvc2VGb3JQb3NlRXN0aW1hdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIydXN5ZC1jb21tdW5pdHklMkZ2aXRwb3NlLWJhc2Utc2ltcGxlJTIyJTJDJTIwZGV2aWNlX21hcCUzRGRldmljZSklMEElMEFpbnB1dHMlMjAlM0QlMjBpbWFnZV9wcm9jZXNzb3IoaW1hZ2UlMkMlMjBib3hlcyUzRCU1QnBlcnNvbl9ib3hlcyU1RCUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpLnRvKGRldmljZSklMEElMEF3aXRoJTIwdG9yY2gubm9fZ3JhZCgpJTNBJTBBJTIwJTIwJTIwJTIwb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKSUwQSUwQXBvc2VfcmVzdWx0cyUyMCUzRCUyMGltYWdlX3Byb2Nlc3Nvci5wb3N0X3Byb2Nlc3NfcG9zZV9lc3RpbWF0aW9uKG91dHB1dHMlMkMlMjBib3hlcyUzRCU1QnBlcnNvbl9ib3hlcyU1RCklMEFpbWFnZV9wb3NlX3Jlc3VsdCUyMCUzRCUyMHBvc2VfcmVzdWx0cyU1QjAlNUQlMjAlMjAlMjMlMjByZXN1bHRzJTIwZm9yJTIwZmlyc3QlMjBpbWFnZQ==",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">import</span> requests
<span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np

<span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image

<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoProcessor, RTDetrForObjectDetection, VitPoseForPoseEstimation

device = <span class="hljs-string">&quot;cuda&quot;</span> <span class="hljs-keyword">if</span> torch.cuda.is_available() <span class="hljs-keyword">else</span> <span class="hljs-string">&quot;cpu&quot;</span>

url = <span class="hljs-string">&quot;http://images.cocodataset.org/val2017/000000000139.jpg&quot;</span>
image = Image.<span class="hljs-built_in">open</span>(requests.get(url, stream=<span class="hljs-literal">True</span>).raw)

<span class="hljs-comment"># ------------------------------------------------------------------------</span>
<span class="hljs-comment"># Stage 1. Detect humans on the image</span>
<span class="hljs-comment"># ------------------------------------------------------------------------</span>

<span class="hljs-comment"># You can choose any detector of your choice</span>
person_image_processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;PekingU/rtdetr_r50vd_coco_o365&quot;</span>)
person_model = RTDetrForObjectDetection.from_pretrained(<span class="hljs-string">&quot;PekingU/rtdetr_r50vd_coco_o365&quot;</span>, device_map=device)

inputs = person_image_processor(images=image, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).to(device)

<span class="hljs-keyword">with</span> torch.no_grad():
    outputs = person_model(**inputs)

results = person_image_processor.post_process_object_detection(
    outputs, target_sizes=torch.tensor([(image.height, image.width)]), threshold=<span class="hljs-number">0.3</span>
)
result = results[<span class="hljs-number">0</span>]  <span class="hljs-comment"># take first image results</span>

<span class="hljs-comment"># Human label refers 0 index in COCO dataset</span>
person_boxes = result[<span class="hljs-string">&quot;boxes&quot;</span>][result[<span class="hljs-string">&quot;labels&quot;</span>] == <span class="hljs-number">0</span>]
person_boxes = person_boxes.cpu().numpy()

<span class="hljs-comment"># Convert boxes from VOC (x1, y1, x2, y2) to COCO (x1, y1, w, h) format</span>
person_boxes[:, <span class="hljs-number">2</span>] = person_boxes[:, <span class="hljs-number">2</span>] - person_boxes[:, <span class="hljs-number">0</span>]
person_boxes[:, <span class="hljs-number">3</span>] = person_boxes[:, <span class="hljs-number">3</span>] - person_boxes[:, <span class="hljs-number">1</span>]

<span class="hljs-comment"># ------------------------------------------------------------------------</span>
<span class="hljs-comment"># Stage 2. Detect keypoints for each person found</span>
<span class="hljs-comment"># ------------------------------------------------------------------------</span>

image_processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;usyd-community/vitpose-base-simple&quot;</span>)
model = VitPoseForPoseEstimation.from_pretrained(<span class="hljs-string">&quot;usyd-community/vitpose-base-simple&quot;</span>, device_map=device)

inputs = image_processor(image, boxes=[person_boxes], return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).to(device)

<span class="hljs-keyword">with</span> torch.no_grad():
    outputs = model(**inputs)

pose_results = image_processor.post_process_pose_estimation(outputs, boxes=[person_boxes])
image_pose_result = pose_results[<span class="hljs-number">0</span>]  <span class="hljs-comment"># results for first image</span>`,wrap:!1}}),Y=new v({props:{title:"ViTPose++ models",local:"vitpose-models",headingTag:"h3"}}),se=new Se({props:{code:"aW1hZ2VfcHJvY2Vzc29yJTIwJTNEJTIwQXV0b1Byb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIydXN5ZC1jb21tdW5pdHklMkZ2aXRwb3NlLXBsdXMtYmFzZSUyMiklMEFtb2RlbCUyMCUzRCUyMFZpdFBvc2VGb3JQb3NlRXN0aW1hdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIydXN5ZC1jb21tdW5pdHklMkZ2aXRwb3NlLXBsdXMtYmFzZSUyMiUyQyUyMGRldmljZSUzRGRldmljZSklMEElMEFpbnB1dHMlMjAlM0QlMjBpbWFnZV9wcm9jZXNzb3IoaW1hZ2UlMkMlMjBib3hlcyUzRCU1QnBlcnNvbl9ib3hlcyU1RCUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpLnRvKGRldmljZSklMEElMEFkYXRhc2V0X2luZGV4JTIwJTNEJTIwdG9yY2gudGVuc29yKCU1QjAlNUQlMkMlMjBkZXZpY2UlM0RkZXZpY2UpJTIwJTIzJTIwbXVzdCUyMGJlJTIwYSUyMHRlbnNvciUyMG9mJTIwc2hhcGUlMjAoYmF0Y2hfc2l6ZSUyQyklMEElMEF3aXRoJTIwdG9yY2gubm9fZ3JhZCgpJTNBJTBBJTIwJTIwJTIwJTIwb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzJTJDJTIwZGF0YXNldF9pbmRleCUzRGRhdGFzZXRfaW5kZXgp",highlighted:`image_processor = AutoProcessor.from_pretrained(<span class="hljs-string">&quot;usyd-community/vitpose-plus-base&quot;</span>)
model = VitPoseForPoseEstimation.from_pretrained(<span class="hljs-string">&quot;usyd-community/vitpose-plus-base&quot;</span>, device=device)

inputs = image_processor(image, boxes=[person_boxes], return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).to(device)

dataset_index = torch.tensor([<span class="hljs-number">0</span>], device=device) <span class="hljs-comment"># must be a tensor of shape (batch_size,)</span>

<span class="hljs-keyword">with</span> torch.no_grad():
    outputs = model(**inputs, dataset_index=dataset_index)`,wrap:!1}}),ae=new v({props:{title:"Visualization",local:"visualization",headingTag:"h3"}}),oe=new Se({props:{code:"aW1wb3J0JTIwc3VwZXJ2aXNpb24lMjBhcyUyMHN2JTBBJTBBeHklMjAlM0QlMjB0b3JjaC5zdGFjayglNUJwb3NlX3Jlc3VsdCU1QidrZXlwb2ludHMnJTVEJTIwZm9yJTIwcG9zZV9yZXN1bHQlMjBpbiUyMGltYWdlX3Bvc2VfcmVzdWx0JTVEKS5jcHUoKS5udW1weSgpJTBBc2NvcmVzJTIwJTNEJTIwdG9yY2guc3RhY2soJTVCcG9zZV9yZXN1bHQlNUInc2NvcmVzJyU1RCUyMGZvciUyMHBvc2VfcmVzdWx0JTIwaW4lMjBpbWFnZV9wb3NlX3Jlc3VsdCU1RCkuY3B1KCkubnVtcHkoKSUwQSUwQWtleV9wb2ludHMlMjAlM0QlMjBzdi5LZXlQb2ludHMoJTBBJTIwJTIwJTIwJTIweHklM0R4eSUyQyUyMGNvbmZpZGVuY2UlM0RzY29yZXMlMEEpJTBBJTBBZWRnZV9hbm5vdGF0b3IlMjAlM0QlMjBzdi5FZGdlQW5ub3RhdG9yKCUwQSUyMCUyMCUyMCUyMGNvbG9yJTNEc3YuQ29sb3IuR1JFRU4lMkMlMEElMjAlMjAlMjAlMjB0aGlja25lc3MlM0QxJTBBKSUwQXZlcnRleF9hbm5vdGF0b3IlMjAlM0QlMjBzdi5WZXJ0ZXhBbm5vdGF0b3IoJTBBJTIwJTIwJTIwJTIwY29sb3IlM0Rzdi5Db2xvci5SRUQlMkMlMEElMjAlMjAlMjAlMjByYWRpdXMlM0QyJTBBKSUwQWFubm90YXRlZF9mcmFtZSUyMCUzRCUyMGVkZ2VfYW5ub3RhdG9yLmFubm90YXRlKCUwQSUyMCUyMCUyMCUyMHNjZW5lJTNEaW1hZ2UuY29weSgpJTJDJTBBJTIwJTIwJTIwJTIwa2V5X3BvaW50cyUzRGtleV9wb2ludHMlMEEpJTBBYW5ub3RhdGVkX2ZyYW1lJTIwJTNEJTIwdmVydGV4X2Fubm90YXRvci5hbm5vdGF0ZSglMEElMjAlMjAlMjAlMjBzY2VuZSUzRGFubm90YXRlZF9mcmFtZSUyQyUwQSUyMCUyMCUyMCUyMGtleV9wb2ludHMlM0RrZXlfcG9pbnRzJTBBKQ==",highlighted:`<span class="hljs-keyword">import</span> supervision <span class="hljs-keyword">as</span> sv

xy = torch.stack([pose_result[<span class="hljs-string">&#x27;keypoints&#x27;</span>] <span class="hljs-keyword">for</span> pose_result <span class="hljs-keyword">in</span> image_pose_result]).cpu().numpy()
scores = torch.stack([pose_result[<span class="hljs-string">&#x27;scores&#x27;</span>] <span class="hljs-keyword">for</span> pose_result <span class="hljs-keyword">in</span> image_pose_result]).cpu().numpy()

key_points = sv.KeyPoints(
    xy=xy, confidence=scores
)

edge_annotator = sv.EdgeAnnotator(
    color=sv.Color.GREEN,
    thickness=<span class="hljs-number">1</span>
)
vertex_annotator = sv.VertexAnnotator(
    color=sv.Color.RED,
    radius=<span class="hljs-number">2</span>
)
annotated_frame = edge_annotator.annotate(
    scene=image.copy(),
    key_points=key_points
)
annotated_frame = vertex_annotator.annotate(
    scene=annotated_frame,
    key_points=key_points
)`,wrap:!1}}),ie=new Se({props:{code:" ",highlighted:`<span class="hljs-keyword">import</span> math
<span class="hljs-keyword">import</span> cv2

<span class="hljs-keyword">def</span> <span class="hljs-title function_">draw_points</span>(<span class="hljs-params">image, keypoints, scores, pose_keypoint_color, keypoint_score_threshold, radius, show_keypoint_weight</span>):
    <span class="hljs-keyword">if</span> pose_keypoint_color <span class="hljs-keyword">is</span> <span class="hljs-keyword">not</span> <span class="hljs-literal">None</span>:
        <span class="hljs-keyword">assert</span> <span class="hljs-built_in">len</span>(pose_keypoint_color) == <span class="hljs-built_in">len</span>(keypoints)
    <span class="hljs-keyword">for</span> kid, (kpt, kpt_score) <span class="hljs-keyword">in</span> <span class="hljs-built_in">enumerate</span>(<span class="hljs-built_in">zip</span>(keypoints, scores)):
        x_coord, y_coord = <span class="hljs-built_in">int</span>(kpt[<span class="hljs-number">0</span>]), <span class="hljs-built_in">int</span>(kpt[<span class="hljs-number">1</span>])
        <span class="hljs-keyword">if</span> kpt_score &gt; keypoint_score_threshold:
            color = <span class="hljs-built_in">tuple</span>(<span class="hljs-built_in">int</span>(c) <span class="hljs-keyword">for</span> c <span class="hljs-keyword">in</span> pose_keypoint_color[kid])
            <span class="hljs-keyword">if</span> show_keypoint_weight:
                cv2.circle(image, (<span class="hljs-built_in">int</span>(x_coord), <span class="hljs-built_in">int</span>(y_coord)), radius, color, -<span class="hljs-number">1</span>)
                transparency = <span class="hljs-built_in">max</span>(<span class="hljs-number">0</span>, <span class="hljs-built_in">min</span>(<span class="hljs-number">1</span>, kpt_score))
                cv2.addWeighted(image, transparency, image, <span class="hljs-number">1</span> - transparency, <span class="hljs-number">0</span>, dst=image)
            <span class="hljs-keyword">else</span>:
                cv2.circle(image, (<span class="hljs-built_in">int</span>(x_coord), <span class="hljs-built_in">int</span>(y_coord)), radius, color, -<span class="hljs-number">1</span>)

<span class="hljs-keyword">def</span> <span class="hljs-title function_">draw_links</span>(<span class="hljs-params">image, keypoints, scores, keypoint_edges, link_colors, keypoint_score_threshold, thickness, show_keypoint_weight, stick_width = <span class="hljs-number">2</span></span>):
    height, width, _ = image.shape
    <span class="hljs-keyword">if</span> keypoint_edges <span class="hljs-keyword">is</span> <span class="hljs-keyword">not</span> <span class="hljs-literal">None</span> <span class="hljs-keyword">and</span> link_colors <span class="hljs-keyword">is</span> <span class="hljs-keyword">not</span> <span class="hljs-literal">None</span>:
        <span class="hljs-keyword">assert</span> <span class="hljs-built_in">len</span>(link_colors) == <span class="hljs-built_in">len</span>(keypoint_edges)
        <span class="hljs-keyword">for</span> sk_id, sk <span class="hljs-keyword">in</span> <span class="hljs-built_in">enumerate</span>(keypoint_edges):
            x1, y1, score1 = (<span class="hljs-built_in">int</span>(keypoints[sk[<span class="hljs-number">0</span>], <span class="hljs-number">0</span>]), <span class="hljs-built_in">int</span>(keypoints[sk[<span class="hljs-number">0</span>], <span class="hljs-number">1</span>]), scores[sk[<span class="hljs-number">0</span>]])
            x2, y2, score2 = (<span class="hljs-built_in">int</span>(keypoints[sk[<span class="hljs-number">1</span>], <span class="hljs-number">0</span>]), <span class="hljs-built_in">int</span>(keypoints[sk[<span class="hljs-number">1</span>], <span class="hljs-number">1</span>]), scores[sk[<span class="hljs-number">1</span>]])
            <span class="hljs-keyword">if</span> (
                x1 &gt; <span class="hljs-number">0</span>
                <span class="hljs-keyword">and</span> x1 &lt; width
                <span class="hljs-keyword">and</span> y1 &gt; <span class="hljs-number">0</span>
                <span class="hljs-keyword">and</span> y1 &lt; height
                <span class="hljs-keyword">and</span> x2 &gt; <span class="hljs-number">0</span>
                <span class="hljs-keyword">and</span> x2 &lt; width
                <span class="hljs-keyword">and</span> y2 &gt; <span class="hljs-number">0</span>
                <span class="hljs-keyword">and</span> y2 &lt; height
                <span class="hljs-keyword">and</span> score1 &gt; keypoint_score_threshold
                <span class="hljs-keyword">and</span> score2 &gt; keypoint_score_threshold
            ):
                color = <span class="hljs-built_in">tuple</span>(<span class="hljs-built_in">int</span>(c) <span class="hljs-keyword">for</span> c <span class="hljs-keyword">in</span> link_colors[sk_id])
                <span class="hljs-keyword">if</span> show_keypoint_weight:
                    X = (x1, x2)
                    Y = (y1, y2)
                    mean_x = np.mean(X)
                    mean_y = np.mean(Y)
                    length = ((Y[<span class="hljs-number">0</span>] - Y[<span class="hljs-number">1</span>]) ** <span class="hljs-number">2</span> + (X[<span class="hljs-number">0</span>] - X[<span class="hljs-number">1</span>]) ** <span class="hljs-number">2</span>) ** <span class="hljs-number">0.5</span>
                    angle = math.degrees(math.atan2(Y[<span class="hljs-number">0</span>] - Y[<span class="hljs-number">1</span>], X[<span class="hljs-number">0</span>] - X[<span class="hljs-number">1</span>]))
                    polygon = cv2.ellipse2Poly(
                        (<span class="hljs-built_in">int</span>(mean_x), <span class="hljs-built_in">int</span>(mean_y)), (<span class="hljs-built_in">int</span>(length / <span class="hljs-number">2</span>), <span class="hljs-built_in">int</span>(stick_width)), <span class="hljs-built_in">int</span>(angle), <span class="hljs-number">0</span>, <span class="hljs-number">360</span>, <span class="hljs-number">1</span>
                    )
                    cv2.fillConvexPoly(image, polygon, color)
                    transparency = <span class="hljs-built_in">max</span>(<span class="hljs-number">0</span>, <span class="hljs-built_in">min</span>(<span class="hljs-number">1</span>, <span class="hljs-number">0.5</span> * (keypoints[sk[<span class="hljs-number">0</span>], <span class="hljs-number">2</span>] + keypoints[sk[<span class="hljs-number">1</span>], <span class="hljs-number">2</span>])))
                    cv2.addWeighted(image, transparency, image, <span class="hljs-number">1</span> - transparency, <span class="hljs-number">0</span>, dst=image)
                <span class="hljs-keyword">else</span>:
                    cv2.line(image, (x1, y1), (x2, y2), color, thickness=thickness)


<span class="hljs-comment"># Note: keypoint_edges and color palette are dataset-specific</span>
keypoint_edges = model.config.edges

palette = np.array(
    [
        [<span class="hljs-number">255</span>, <span class="hljs-number">128</span>, <span class="hljs-number">0</span>],
        [<span class="hljs-number">255</span>, <span class="hljs-number">153</span>, <span class="hljs-number">51</span>],
        [<span class="hljs-number">255</span>, <span class="hljs-number">178</span>, <span class="hljs-number">102</span>],
        [<span class="hljs-number">230</span>, <span class="hljs-number">230</span>, <span class="hljs-number">0</span>],
        [<span class="hljs-number">255</span>, <span class="hljs-number">153</span>, <span class="hljs-number">255</span>],
        [<span class="hljs-number">153</span>, <span class="hljs-number">204</span>, <span class="hljs-number">255</span>],
        [<span class="hljs-number">255</span>, <span class="hljs-number">102</span>, <span class="hljs-number">255</span>],
        [<span class="hljs-number">255</span>, <span class="hljs-number">51</span>, <span class="hljs-number">255</span>],
        [<span class="hljs-number">102</span>, <span class="hljs-number">178</span>, <span class="hljs-number">255</span>],
        [<span class="hljs-number">51</span>, <span class="hljs-number">153</span>, <span class="hljs-number">255</span>],
        [<span class="hljs-number">255</span>, <span class="hljs-number">153</span>, <span class="hljs-number">153</span>],
        [<span class="hljs-number">255</span>, <span class="hljs-number">102</span>, <span class="hljs-number">102</span>],
        [<span class="hljs-number">255</span>, <span class="hljs-number">51</span>, <span class="hljs-number">51</span>],
        [<span class="hljs-number">153</span>, <span class="hljs-number">255</span>, <span class="hljs-number">153</span>],
        [<span class="hljs-number">102</span>, <span class="hljs-number">255</span>, <span class="hljs-number">102</span>],
        [<span class="hljs-number">51</span>, <span class="hljs-number">255</span>, <span class="hljs-number">51</span>],
        [<span class="hljs-number">0</span>, <span class="hljs-number">255</span>, <span class="hljs-number">0</span>],
        [<span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">255</span>],
        [<span class="hljs-number">255</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>],
        [<span class="hljs-number">255</span>, <span class="hljs-number">255</span>, <span class="hljs-number">255</span>],
    ]
)

link_colors = palette[[<span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">7</span>, <span class="hljs-number">7</span>, <span class="hljs-number">7</span>, <span class="hljs-number">9</span>, <span class="hljs-number">9</span>, <span class="hljs-number">9</span>, <span class="hljs-number">9</span>, <span class="hljs-number">9</span>, <span class="hljs-number">16</span>, <span class="hljs-number">16</span>, <span class="hljs-number">16</span>, <span class="hljs-number">16</span>, <span class="hljs-number">16</span>, <span class="hljs-number">16</span>, <span class="hljs-number">16</span>]]
keypoint_colors = palette[[<span class="hljs-number">16</span>, <span class="hljs-number">16</span>, <span class="hljs-number">16</span>, <span class="hljs-number">16</span>, <span class="hljs-number">16</span>, <span class="hljs-number">9</span>, <span class="hljs-number">9</span>, <span class="hljs-number">9</span>, <span class="hljs-number">9</span>, <span class="hljs-number">9</span>, <span class="hljs-number">9</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>]]

numpy_image = np.array(image)

<span class="hljs-keyword">for</span> pose_result <span class="hljs-keyword">in</span> image_pose_result:
    scores = np.array(pose_result[<span class="hljs-string">&quot;scores&quot;</span>])
    keypoints = np.array(pose_result[<span class="hljs-string">&quot;keypoints&quot;</span>])

    <span class="hljs-comment"># draw each point on image</span>
    draw_points(numpy_image, keypoints, scores, keypoint_colors, keypoint_score_threshold=<span class="hljs-number">0.3</span>, radius=<span class="hljs-number">4</span>, show_keypoint_weight=<span class="hljs-literal">False</span>)

    <span class="hljs-comment"># draw links</span>
    draw_links(numpy_image, keypoints, scores, keypoint_edges, link_colors, keypoint_score_threshold=<span class="hljs-number">0.3</span>, thickness=<span class="hljs-number">1</span>, show_keypoint_weight=<span class="hljs-literal">False</span>)

pose_image = Image.fromarray(numpy_image)
pose_image`,wrap:!1}}),pe=new v({props:{title:"Resources",local:"resources",headingTag:"h2"}}),me=new v({props:{title:"VitPoseImageProcessor",local:"transformers.VitPoseImageProcessor",headingTag:"h2"}}),de=new Be({props:{name:"class transformers.VitPoseImageProcessor",anchor:"transformers.VitPoseImageProcessor",parameters:[{name:"do_affine_transform",val:": bool = True"},{name:"size",val:": typing.Dict[str, int] = None"},{name:"do_rescale",val:": bool = True"},{name:"rescale_factor",val:": typing.Union[int, float] = 0.00392156862745098"},{name:"do_normalize",val:": bool = True"},{name:"image_mean",val:": typing.Union[float, typing.List[float], NoneType] = None"},{name:"image_std",val:": typing.Union[float, typing.List[float], NoneType] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.VitPoseImageProcessor.do_affine_transform",description:`<strong>do_affine_transform</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to apply an affine transformation to the input images.`,name:"do_affine_transform"},{anchor:"transformers.VitPoseImageProcessor.size",description:`<strong>size</strong> (<code>Dict[str, int]</code> <em>optional</em>, defaults to <code>{&quot;height&quot; -- 256, &quot;width&quot;: 192}</code>):
Resolution of the image after <code>affine_transform</code> is applied. Only has an effect if <code>do_affine_transform</code> is set to <code>True</code>. Can
be overriden by <code>size</code> in the <code>preprocess</code> method.`,name:"size"},{anchor:"transformers.VitPoseImageProcessor.do_rescale",description:`<strong>do_rescale</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to apply the scaling factor (to make pixel values floats between 0. and 1.).`,name:"do_rescale"},{anchor:"transformers.VitPoseImageProcessor.rescale_factor",description:`<strong>rescale_factor</strong> (<code>int</code> or <code>float</code>, <em>optional</em>, defaults to <code>1/255</code>) &#x2014;
Scale factor to use if rescaling the image. Can be overriden by <code>rescale_factor</code> in the <code>preprocess</code>
method.`,name:"rescale_factor"},{anchor:"transformers.VitPoseImageProcessor.do_normalize",description:`<strong>do_normalize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to normalize the input with mean and standard deviation.`,name:"do_normalize"},{anchor:"transformers.VitPoseImageProcessor.image_mean",description:`<strong>image_mean</strong> (<code>List[int]</code>, defaults to <code>[0.485, 0.456, 0.406]</code>, <em>optional</em>) &#x2014;
The sequence of means for each channel, to be used when normalizing images.`,name:"image_mean"},{anchor:"transformers.VitPoseImageProcessor.image_std",description:`<strong>image_std</strong> (<code>List[int]</code>, defaults to <code>[0.229, 0.224, 0.225]</code>, <em>optional</em>) &#x2014;
The sequence of standard deviations for each channel, to be used when normalizing images.`,name:"image_std"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/vitpose/image_processing_vitpose.py#L328"}}),ye=new Be({props:{name:"preprocess",anchor:"transformers.VitPoseImageProcessor.preprocess",parameters:[{name:"images",val:": typing.Union[ForwardRef('PIL.Image.Image'), numpy.ndarray, ForwardRef('torch.Tensor'), list['PIL.Image.Image'], list[numpy.ndarray], list['torch.Tensor']]"},{name:"boxes",val:": typing.Union[typing.List[typing.List[float]], numpy.ndarray]"},{name:"do_affine_transform",val:": typing.Optional[bool] = None"},{name:"size",val:": typing.Dict[str, int] = None"},{name:"do_rescale",val:": typing.Optional[bool] = None"},{name:"rescale_factor",val:": typing.Optional[float] = None"},{name:"do_normalize",val:": typing.Optional[bool] = None"},{name:"image_mean",val:": typing.Union[float, typing.List[float], NoneType] = None"},{name:"image_std",val:": typing.Union[float, typing.List[float], NoneType] = None"},{name:"return_tensors",val:": typing.Union[str, transformers.utils.generic.TensorType, NoneType] = None"},{name:"data_format",val:": typing.Union[str, transformers.image_utils.ChannelDimension] = <ChannelDimension.FIRST: 'channels_first'>"},{name:"input_data_format",val:": typing.Union[str, transformers.image_utils.ChannelDimension, NoneType] = None"}],parametersDescription:[{anchor:"transformers.VitPoseImageProcessor.preprocess.images",description:`<strong>images</strong> (<code>ImageInput</code>) &#x2014;
Image to preprocess. Expects a single or batch of images with pixel values ranging from 0 to 255. If
passing in images with pixel values between 0 and 1, set <code>do_rescale=False</code>.`,name:"images"},{anchor:"transformers.VitPoseImageProcessor.preprocess.boxes",description:`<strong>boxes</strong> (<code>List[List[List[float]]]</code> or <code>np.ndarray</code>) &#x2014;
List or array of bounding boxes for each image. Each box should be a list of 4 floats representing the bounding
box coordinates in COCO format (top_left_x, top_left_y, width, height).`,name:"boxes"},{anchor:"transformers.VitPoseImageProcessor.preprocess.do_affine_transform",description:`<strong>do_affine_transform</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_affine_transform</code>) &#x2014;
Whether to apply an affine transformation to the input images.`,name:"do_affine_transform"},{anchor:"transformers.VitPoseImageProcessor.preprocess.size",description:`<strong>size</strong> (<code>Dict[str, int]</code> <em>optional</em>, defaults to <code>self.size</code>) &#x2014;
Dictionary in the format <code>{&quot;height&quot;: h, &quot;width&quot;: w}</code> specifying the size of the output image after
resizing.`,name:"size"},{anchor:"transformers.VitPoseImageProcessor.preprocess.do_rescale",description:`<strong>do_rescale</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_rescale</code>) &#x2014;
Whether to rescale the image values between [0 - 1].`,name:"do_rescale"},{anchor:"transformers.VitPoseImageProcessor.preprocess.rescale_factor",description:`<strong>rescale_factor</strong> (<code>float</code>, <em>optional</em>, defaults to <code>self.rescale_factor</code>) &#x2014;
Rescale factor to rescale the image by if <code>do_rescale</code> is set to <code>True</code>.`,name:"rescale_factor"},{anchor:"transformers.VitPoseImageProcessor.preprocess.do_normalize",description:`<strong>do_normalize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_normalize</code>) &#x2014;
Whether to normalize the image.`,name:"do_normalize"},{anchor:"transformers.VitPoseImageProcessor.preprocess.image_mean",description:`<strong>image_mean</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>self.image_mean</code>) &#x2014;
Image mean to use if <code>do_normalize</code> is set to <code>True</code>.`,name:"image_mean"},{anchor:"transformers.VitPoseImageProcessor.preprocess.image_std",description:`<strong>image_std</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>self.image_std</code>) &#x2014;
Image standard deviation to use if <code>do_normalize</code> is set to <code>True</code>.`,name:"image_std"},{anchor:"transformers.VitPoseImageProcessor.preprocess.return_tensors",description:`<strong>return_tensors</strong> (<code>str</code> or <a href="/docs/transformers/main/en/internal/file_utils#transformers.TensorType">TensorType</a>, <em>optional</em>, defaults to <code>&apos;np&apos;</code>) &#x2014;
If set, will return tensors of a particular framework. Acceptable values are:</p>
<ul>
<li><code>&apos;tf&apos;</code>: Return TensorFlow <code>tf.constant</code> objects.</li>
<li><code>&apos;pt&apos;</code>: Return PyTorch <code>torch.Tensor</code> objects.</li>
<li><code>&apos;np&apos;</code>: Return NumPy <code>np.ndarray</code> objects.</li>
<li><code>&apos;jax&apos;</code>: Return JAX <code>jnp.ndarray</code> objects.</li>
</ul>`,name:"return_tensors"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/vitpose/image_processing_vitpose.py#L423",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/main/en/main_classes/feature_extractor#transformers.BatchFeature"
>BatchFeature</a> with the following fields:</p>
<ul>
<li><strong>pixel_values</strong> — Pixel values to be fed to a model, of shape (batch_size, num_channels, height,
width).</li>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><a
  href="/docs/transformers/main/en/main_classes/feature_extractor#transformers.BatchFeature"
>BatchFeature</a></p>
`}}),he=new Be({props:{name:"post_process_pose_estimation",anchor:"transformers.VitPoseImageProcessor.post_process_pose_estimation",parameters:[{name:"outputs",val:": VitPoseEstimatorOutput"},{name:"boxes",val:": typing.Union[typing.List[typing.List[typing.List[float]]], numpy.ndarray]"},{name:"kernel_size",val:": int = 11"},{name:"threshold",val:": typing.Optional[float] = None"},{name:"target_sizes",val:": typing.Union[transformers.utils.generic.TensorType, typing.List[typing.Tuple]] = None"}],parametersDescription:[{anchor:"transformers.VitPoseImageProcessor.post_process_pose_estimation.outputs",description:`<strong>outputs</strong> (<code>VitPoseEstimatorOutput</code>) &#x2014;
VitPoseForPoseEstimation model outputs.`,name:"outputs"},{anchor:"transformers.VitPoseImageProcessor.post_process_pose_estimation.boxes",description:`<strong>boxes</strong> (<code>List[List[List[float]]]</code> or <code>np.ndarray</code>) &#x2014;
List or array of bounding boxes for each image. Each box should be a list of 4 floats representing the bounding
box coordinates in COCO format (top_left_x, top_left_y, width, height).`,name:"boxes"},{anchor:"transformers.VitPoseImageProcessor.post_process_pose_estimation.kernel_size",description:`<strong>kernel_size</strong> (<code>int</code>, <em>optional</em>, defaults to 11) &#x2014;
Gaussian kernel size (K) for modulation.`,name:"kernel_size"},{anchor:"transformers.VitPoseImageProcessor.post_process_pose_estimation.threshold",description:`<strong>threshold</strong> (<code>float</code>, <em>optional</em>, defaults to None) &#x2014;
Score threshold to keep object detection predictions.`,name:"threshold"},{anchor:"transformers.VitPoseImageProcessor.post_process_pose_estimation.target_sizes",description:`<strong>target_sizes</strong> (<code>torch.Tensor</code> or <code>List[Tuple[int, int]]</code>, <em>optional</em>) &#x2014;
Tensor of shape <code>(batch_size, 2)</code> or list of tuples (<code>Tuple[int, int]</code>) containing the target size
<code>(height, width)</code> of each image in the batch. If unset, predictions will be resize with the default value.`,name:"target_sizes"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/vitpose/image_processing_vitpose.py#L597",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A list of dictionaries, each dictionary containing the keypoints and boxes for an image
in the batch as predicted by the model.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>List[List[Dict]]</code></p>
`}}),Ue=new v({props:{title:"VitPoseConfig",local:"transformers.VitPoseConfig",headingTag:"h2"}}),ue=new Be({props:{name:"class transformers.VitPoseConfig",anchor:"transformers.VitPoseConfig",parameters:[{name:"backbone_config",val:": typing.Optional[transformers.configuration_utils.PretrainedConfig] = None"},{name:"backbone",val:": typing.Optional[str] = None"},{name:"use_pretrained_backbone",val:": bool = False"},{name:"use_timm_backbone",val:": bool = False"},{name:"backbone_kwargs",val:": typing.Optional[dict] = None"},{name:"initializer_range",val:": float = 0.02"},{name:"scale_factor",val:": int = 4"},{name:"use_simple_decoder",val:": bool = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.VitPoseConfig.backbone_config",description:`<strong>backbone_config</strong> (<code>PretrainedConfig</code> or <code>dict</code>, <em>optional</em>, defaults to <code>VitPoseBackboneConfig()</code>) &#x2014;
The configuration of the backbone model. Currently, only <code>backbone_config</code> with <code>vitpose_backbone</code> as <code>model_type</code> is supported.`,name:"backbone_config"},{anchor:"transformers.VitPoseConfig.backbone",description:`<strong>backbone</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Name of backbone to use when <code>backbone_config</code> is <code>None</code>. If <code>use_pretrained_backbone</code> is <code>True</code>, this
will load the corresponding pretrained weights from the timm or transformers library. If <code>use_pretrained_backbone</code>
is <code>False</code>, this loads the backbone&#x2019;s config and uses that to initialize the backbone with random weights.`,name:"backbone"},{anchor:"transformers.VitPoseConfig.use_pretrained_backbone",description:`<strong>use_pretrained_backbone</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to use pretrained weights for the backbone.`,name:"use_pretrained_backbone"},{anchor:"transformers.VitPoseConfig.use_timm_backbone",description:`<strong>use_timm_backbone</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to load <code>backbone</code> from the timm library. If <code>False</code>, the backbone is loaded from the transformers
library.`,name:"use_timm_backbone"},{anchor:"transformers.VitPoseConfig.backbone_kwargs",description:`<strong>backbone_kwargs</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
Keyword arguments to be passed to AutoBackbone when loading from a checkpoint
e.g. <code>{&apos;out_indices&apos;: (0, 1, 2, 3)}</code>. Cannot be specified if <code>backbone_config</code> is set.`,name:"backbone_kwargs"},{anchor:"transformers.VitPoseConfig.initializer_range",description:`<strong>initializer_range</strong> (<code>float</code>, <em>optional</em>, defaults to 0.02) &#x2014;
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.`,name:"initializer_range"},{anchor:"transformers.VitPoseConfig.scale_factor",description:`<strong>scale_factor</strong> (<code>int</code>, <em>optional</em>, defaults to 4) &#x2014;
Factor to upscale the feature maps coming from the ViT backbone.`,name:"scale_factor"},{anchor:"transformers.VitPoseConfig.use_simple_decoder",description:`<strong>use_simple_decoder</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to use a <code>VitPoseSimpleDecoder</code> to decode the feature maps from the backbone into heatmaps. Otherwise it uses <code>VitPoseClassicDecoder</code>.`,name:"use_simple_decoder"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/vitpose/configuration_vitpose.py#L28"}}),Z=new at({props:{anchor:"transformers.VitPoseConfig.example",$$slots:{default:[mt]},$$scope:{ctx:k}}}),je=new v({props:{title:"VitPoseForPoseEstimation",local:"transformers.VitPoseForPoseEstimation",headingTag:"h2"}}),fe=new Be({props:{name:"class transformers.VitPoseForPoseEstimation",anchor:"transformers.VitPoseForPoseEstimation",parameters:[{name:"config",val:": VitPoseConfig"}],parametersDescription:[{anchor:"transformers.VitPoseForPoseEstimation.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/vitpose#transformers.VitPoseConfig">VitPoseConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/vitpose/modeling_vitpose.py#L237"}}),be=new Be({props:{name:"forward",anchor:"transformers.VitPoseForPoseEstimation.forward",parameters:[{name:"pixel_values",val:": Tensor"},{name:"dataset_index",val:": typing.Optional[torch.Tensor] = None"},{name:"flip_pairs",val:": typing.Optional[torch.Tensor] = None"},{name:"labels",val:": typing.Optional[torch.Tensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.VitPoseForPoseEstimation.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/main/en/model_doc/vitpose#transformers.VitPoseImageProcessor">VitPoseImageProcessor</a>. See
<a href="/docs/transformers/main/en/model_doc/vilt#transformers.ViltFeatureExtractor.__call__">VitPoseImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.VitPoseForPoseEstimation.forward.dataset_index",description:`<strong>dataset_index</strong> (<code>torch.Tensor</code> of shape <code>(batch_size,)</code>) &#x2014;
Index to use in the Mixture-of-Experts (MoE) blocks of the backbone.</p>
<p>This corresponds to the dataset index used during training, e.g. For the single dataset index 0 refers to the corresponding dataset. For the multiple datasets index 0 refers to dataset A (e.g. MPII) and index 1 refers to dataset B (e.g. CrowdPose).`,name:"dataset_index"},{anchor:"transformers.VitPoseForPoseEstimation.forward.flip_pairs",description:`<strong>flip_pairs</strong> (<code>torch.tensor</code>, <em>optional</em>) &#x2014;
Whether to mirror pairs of keypoints (for example, left ear &#x2014; right ear).`,name:"flip_pairs"},{anchor:"transformers.VitPoseForPoseEstimation.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.VitPoseForPoseEstimation.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.VitPoseForPoseEstimation.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/vitpose/modeling_vitpose.py#L260",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <code>transformers.models.vitpose.modeling_vitpose.VitPoseEstimatorOutput</code> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/vitpose#transformers.VitPoseConfig"
>VitPoseConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) — Loss is not supported at this moment. See <a
  href="https://github.com/ViTAE-Transformer/ViTPose/tree/main/mmpose/models/losses"
  rel="nofollow"
>https://github.com/ViTAE-Transformer/ViTPose/tree/main/mmpose/models/losses</a> for further detail.</p>
</li>
<li>
<p><strong>heatmaps</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_keypoints, height, width)</code>) — Heatmaps as predicted by the model.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each stage) of shape <code>(batch_size, sequence_length, hidden_size)</code>. Hidden-states
(also called feature maps) of the model at the output of each stage.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, patch_size, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>transformers.models.vitpose.modeling_vitpose.VitPoseEstimatorOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),x=new ct({props:{$$slots:{default:[dt]},$$scope:{ctx:k}}}),E=new at({props:{anchor:"transformers.VitPoseForPoseEstimation.forward.example",$$slots:{default:[yt]},$$scope:{ctx:k}}}),ge=new Mt({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/model_doc/vitpose.md"}}),{c(){p=o("meta"),w=a(),f=o("p"),j=a(),M(b.$$.fragment),i=a(),g=o("div"),g.innerHTML=Vs,Ze=a(),M(W.$$.fragment),xe=a(),P=o("p"),P.innerHTML=Bs,Ee=a(),X=o("p"),X.textContent=Ss,Ge=a(),R=o("p"),R.innerHTML=Qs,Ne=a(),V=o("img"),ze=a(),$=o("small"),$.innerHTML=xs,We=a(),F=o("p"),F.innerHTML=Es,Pe=a(),M(L.$$.fragment),Xe=a(),D=o("p"),D.innerHTML=Gs,Re=a(),M(H.$$.fragment),$e=a(),M(Y.$$.fragment),Fe=a(),K=o("p"),K.innerHTML=Ns,Le=a(),q=o("p"),q.textContent=zs,De=a(),O=o("ul"),O.innerHTML=Ws,He=a(),ee=o("p"),ee.innerHTML=Ps,Ye=a(),M(se.$$.fragment),Ke=a(),te=o("p"),te.textContent=Xs,qe=a(),ne=o("ul"),ne.innerHTML=Rs,Oe=a(),M(ae.$$.fragment),es=a(),le=o("p"),le.innerHTML=$s,ss=a(),M(oe.$$.fragment),ts=a(),re=o("p"),re.innerHTML=Fs,ns=a(),M(ie.$$.fragment),as=a(),B=o("img"),ls=a(),M(pe.$$.fragment),os=a(),ce=o("p"),ce.textContent=Ds,rs=a(),Me=o("ul"),Me.innerHTML=Hs,is=a(),M(me.$$.fragment),ps=a(),J=o("div"),M(de.$$.fragment),us=a(),Je=o("p"),Je.textContent=Ys,js=a(),S=o("div"),M(ye.$$.fragment),fs=a(),Ce=o("p"),Ce.textContent=Ks,bs=a(),Q=o("div"),M(he.$$.fragment),gs=a(),_e=o("p"),_e.textContent=qs,cs=a(),M(Ue.$$.fragment),Ms=a(),C=o("div"),M(ue.$$.fragment),Ts=a(),Ie=o("p"),Ie.innerHTML=Os,ws=a(),Ae=o("p"),Ae.innerHTML=et,Js=a(),M(Z.$$.fragment),ms=a(),M(je.$$.fragment),ds=a(),I=o("div"),M(fe.$$.fragment),Cs=a(),ve=o("p"),ve.innerHTML=st,_s=a(),_=o("div"),M(be.$$.fragment),Is=a(),ke=o("p"),ke.innerHTML=tt,As=a(),M(x.$$.fragment),vs=a(),M(E.$$.fragment),ys=a(),M(ge.$$.fragment),hs=a(),Qe=o("p"),this.h()},l(e){const s=pt("svelte-u9bgzb",document.head);p=r(s,"META",{name:!0,content:!0}),s.forEach(t),w=l(e),f=r(e,"P",{}),z(f).forEach(t),j=l(e),m(b.$$.fragment,e),i=l(e),g=r(e,"DIV",{class:!0,"data-svelte-h":!0}),c(g)!=="svelte-13t8s2t"&&(g.innerHTML=Vs),Ze=l(e),m(W.$$.fragment,e),xe=l(e),P=r(e,"P",{"data-svelte-h":!0}),c(P)!=="svelte-5kliuq"&&(P.innerHTML=Bs),Ee=l(e),X=r(e,"P",{"data-svelte-h":!0}),c(X)!=="svelte-vfdo9a"&&(X.textContent=Ss),Ge=l(e),R=r(e,"P",{"data-svelte-h":!0}),c(R)!=="svelte-1r8g7qv"&&(R.innerHTML=Qs),Ne=l(e),V=r(e,"IMG",{src:!0,alt:!0,width:!0}),ze=l(e),$=r(e,"SMALL",{"data-svelte-h":!0}),c($)!=="svelte-1rdk1gr"&&($.innerHTML=xs),We=l(e),F=r(e,"P",{"data-svelte-h":!0}),c(F)!=="svelte-1pkw5cm"&&(F.innerHTML=Es),Pe=l(e),m(L.$$.fragment,e),Xe=l(e),D=r(e,"P",{"data-svelte-h":!0}),c(D)!=="svelte-qazy8m"&&(D.innerHTML=Gs),Re=l(e),m(H.$$.fragment,e),$e=l(e),m(Y.$$.fragment,e),Fe=l(e),K=r(e,"P",{"data-svelte-h":!0}),c(K)!=="svelte-er0z9v"&&(K.innerHTML=Ns),Le=l(e),q=r(e,"P",{"data-svelte-h":!0}),c(q)!=="svelte-jjff6j"&&(q.textContent=zs),De=l(e),O=r(e,"UL",{"data-svelte-h":!0}),c(O)!=="svelte-wxmy7r"&&(O.innerHTML=Ws),He=l(e),ee=r(e,"P",{"data-svelte-h":!0}),c(ee)!=="svelte-15bozem"&&(ee.innerHTML=Ps),Ye=l(e),m(se.$$.fragment,e),Ke=l(e),te=r(e,"P",{"data-svelte-h":!0}),c(te)!=="svelte-jjff6j"&&(te.textContent=Xs),qe=l(e),ne=r(e,"UL",{"data-svelte-h":!0}),c(ne)!=="svelte-wxmy7r"&&(ne.innerHTML=Rs),Oe=l(e),m(ae.$$.fragment,e),es=l(e),le=r(e,"P",{"data-svelte-h":!0}),c(le)!=="svelte-wxtr7b"&&(le.innerHTML=$s),ss=l(e),m(oe.$$.fragment,e),ts=l(e),re=r(e,"P",{"data-svelte-h":!0}),c(re)!=="svelte-1mdlnn1"&&(re.innerHTML=Fs),ns=l(e),m(ie.$$.fragment,e),as=l(e),B=r(e,"IMG",{src:!0,alt:!0,width:!0}),ls=l(e),m(pe.$$.fragment,e),os=l(e),ce=r(e,"P",{"data-svelte-h":!0}),c(ce)!=="svelte-sj3pkb"&&(ce.textContent=Ds),rs=l(e),Me=r(e,"UL",{"data-svelte-h":!0}),c(Me)!=="svelte-1qutpeb"&&(Me.innerHTML=Hs),is=l(e),m(me.$$.fragment,e),ps=l(e),J=r(e,"DIV",{class:!0});var A=z(J);m(de.$$.fragment,A),us=l(A),Je=r(A,"P",{"data-svelte-h":!0}),c(Je)!=="svelte-1uf40pk"&&(Je.textContent=Ys),js=l(A),S=r(A,"DIV",{class:!0});var Te=z(S);m(ye.$$.fragment,Te),fs=l(Te),Ce=r(Te,"P",{"data-svelte-h":!0}),c(Ce)!=="svelte-1x3yxsa"&&(Ce.textContent=Ks),Te.forEach(t),bs=l(A),Q=r(A,"DIV",{class:!0});var we=z(Q);m(he.$$.fragment,we),gs=l(we),_e=r(we,"P",{"data-svelte-h":!0}),c(_e)!=="svelte-1qvlu0g"&&(_e.textContent=qs),we.forEach(t),A.forEach(t),cs=l(e),m(Ue.$$.fragment,e),Ms=l(e),C=r(e,"DIV",{class:!0});var G=z(C);m(ue.$$.fragment,G),Ts=l(G),Ie=r(G,"P",{"data-svelte-h":!0}),c(Ie)!=="svelte-owqdsz"&&(Ie.innerHTML=Os),ws=l(G),Ae=r(G,"P",{"data-svelte-h":!0}),c(Ae)!=="svelte-o55m63"&&(Ae.innerHTML=et),Js=l(G),m(Z.$$.fragment,G),G.forEach(t),ms=l(e),m(je.$$.fragment,e),ds=l(e),I=r(e,"DIV",{class:!0});var Ve=z(I);m(fe.$$.fragment,Ve),Cs=l(Ve),ve=r(Ve,"P",{"data-svelte-h":!0}),c(ve)!=="svelte-1eb2kd5"&&(ve.innerHTML=st),_s=l(Ve),_=r(Ve,"DIV",{class:!0});var N=z(_);m(be.$$.fragment,N),Is=l(N),ke=r(N,"P",{"data-svelte-h":!0}),c(ke)!=="svelte-s2387n"&&(ke.innerHTML=tt),As=l(N),m(x.$$.fragment,N),vs=l(N),m(E.$$.fragment,N),N.forEach(t),Ve.forEach(t),ys=l(e),m(ge.$$.fragment,e),hs=l(e),Qe=r(e,"P",{}),z(Qe).forEach(t),this.h()},h(){T(p,"name","hf:doc:metadata"),T(p,"content",Ut),T(g,"class","flex flex-wrap space-x-1"),nt(V.src,Zs="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/model_doc/vitpose-architecture.png")||T(V,"src",Zs),T(V,"alt","drawing"),T(V,"width","600"),nt(B.src,Ls="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/model_doc/vitpose-coco.jpg")||T(B,"src",Ls),T(B,"alt","drawing"),T(B,"width","600"),T(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(Q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(_,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,s){u(document.head,p),n(e,w,s),n(e,f,s),n(e,j,s),d(b,e,s),n(e,i,s),n(e,g,s),n(e,Ze,s),d(W,e,s),n(e,xe,s),n(e,P,s),n(e,Ee,s),n(e,X,s),n(e,Ge,s),n(e,R,s),n(e,Ne,s),n(e,V,s),n(e,ze,s),n(e,$,s),n(e,We,s),n(e,F,s),n(e,Pe,s),d(L,e,s),n(e,Xe,s),n(e,D,s),n(e,Re,s),d(H,e,s),n(e,$e,s),d(Y,e,s),n(e,Fe,s),n(e,K,s),n(e,Le,s),n(e,q,s),n(e,De,s),n(e,O,s),n(e,He,s),n(e,ee,s),n(e,Ye,s),d(se,e,s),n(e,Ke,s),n(e,te,s),n(e,qe,s),n(e,ne,s),n(e,Oe,s),d(ae,e,s),n(e,es,s),n(e,le,s),n(e,ss,s),d(oe,e,s),n(e,ts,s),n(e,re,s),n(e,ns,s),d(ie,e,s),n(e,as,s),n(e,B,s),n(e,ls,s),d(pe,e,s),n(e,os,s),n(e,ce,s),n(e,rs,s),n(e,Me,s),n(e,is,s),d(me,e,s),n(e,ps,s),n(e,J,s),d(de,J,null),u(J,us),u(J,Je),u(J,js),u(J,S),d(ye,S,null),u(S,fs),u(S,Ce),u(J,bs),u(J,Q),d(he,Q,null),u(Q,gs),u(Q,_e),n(e,cs,s),d(Ue,e,s),n(e,Ms,s),n(e,C,s),d(ue,C,null),u(C,Ts),u(C,Ie),u(C,ws),u(C,Ae),u(C,Js),d(Z,C,null),n(e,ms,s),d(je,e,s),n(e,ds,s),n(e,I,s),d(fe,I,null),u(I,Cs),u(I,ve),u(I,_s),u(I,_),d(be,_,null),u(_,Is),u(_,ke),u(_,As),d(x,_,null),u(_,vs),d(E,_,null),n(e,ys,s),d(ge,e,s),n(e,hs,s),n(e,Qe,s),Us=!0},p(e,[s]){const A={};s&2&&(A.$$scope={dirty:s,ctx:e}),Z.$set(A);const Te={};s&2&&(Te.$$scope={dirty:s,ctx:e}),x.$set(Te);const we={};s&2&&(we.$$scope={dirty:s,ctx:e}),E.$set(we)},i(e){Us||(y(b.$$.fragment,e),y(W.$$.fragment,e),y(L.$$.fragment,e),y(H.$$.fragment,e),y(Y.$$.fragment,e),y(se.$$.fragment,e),y(ae.$$.fragment,e),y(oe.$$.fragment,e),y(ie.$$.fragment,e),y(pe.$$.fragment,e),y(me.$$.fragment,e),y(de.$$.fragment,e),y(ye.$$.fragment,e),y(he.$$.fragment,e),y(Ue.$$.fragment,e),y(ue.$$.fragment,e),y(Z.$$.fragment,e),y(je.$$.fragment,e),y(fe.$$.fragment,e),y(be.$$.fragment,e),y(x.$$.fragment,e),y(E.$$.fragment,e),y(ge.$$.fragment,e),Us=!0)},o(e){h(b.$$.fragment,e),h(W.$$.fragment,e),h(L.$$.fragment,e),h(H.$$.fragment,e),h(Y.$$.fragment,e),h(se.$$.fragment,e),h(ae.$$.fragment,e),h(oe.$$.fragment,e),h(ie.$$.fragment,e),h(pe.$$.fragment,e),h(me.$$.fragment,e),h(de.$$.fragment,e),h(ye.$$.fragment,e),h(he.$$.fragment,e),h(Ue.$$.fragment,e),h(ue.$$.fragment,e),h(Z.$$.fragment,e),h(je.$$.fragment,e),h(fe.$$.fragment,e),h(be.$$.fragment,e),h(x.$$.fragment,e),h(E.$$.fragment,e),h(ge.$$.fragment,e),Us=!1},d(e){e&&(t(w),t(f),t(j),t(i),t(g),t(Ze),t(xe),t(P),t(Ee),t(X),t(Ge),t(R),t(Ne),t(V),t(ze),t($),t(We),t(F),t(Pe),t(Xe),t(D),t(Re),t($e),t(Fe),t(K),t(Le),t(q),t(De),t(O),t(He),t(ee),t(Ye),t(Ke),t(te),t(qe),t(ne),t(Oe),t(es),t(le),t(ss),t(ts),t(re),t(ns),t(as),t(B),t(ls),t(os),t(ce),t(rs),t(Me),t(is),t(ps),t(J),t(cs),t(Ms),t(C),t(ms),t(ds),t(I),t(ys),t(hs),t(Qe)),t(p),U(b,e),U(W,e),U(L,e),U(H,e),U(Y,e),U(se,e),U(ae,e),U(oe,e),U(ie,e),U(pe,e),U(me,e),U(de),U(ye),U(he),U(Ue,e),U(ue),U(Z),U(je,e),U(fe),U(be),U(x),U(E),U(ge,e)}}}const Ut='{"title":"ViTPose","local":"vitpose","sections":[{"title":"Overview","local":"overview","sections":[],"depth":2},{"title":"Usage Tips","local":"usage-tips","sections":[{"title":"ViTPose++ models","local":"vitpose-models","sections":[],"depth":3},{"title":"Visualization","local":"visualization","sections":[],"depth":3}],"depth":2},{"title":"Resources","local":"resources","sections":[],"depth":2},{"title":"VitPoseImageProcessor","local":"transformers.VitPoseImageProcessor","sections":[],"depth":2},{"title":"VitPoseConfig","local":"transformers.VitPoseConfig","sections":[],"depth":2},{"title":"VitPoseForPoseEstimation","local":"transformers.VitPoseForPoseEstimation","sections":[],"depth":2}],"depth":1}';function ut(k){return ot(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ct extends rt{constructor(p){super(),it(this,p,ut,ht,lt,{})}}export{Ct as component};
