import{s as tt,f as et,o as nt,n as As}from"../chunks/scheduler.25b97de1.js";import{S as at,i as lt,g as o,s as a,r as M,A as ot,h as r,f as t,c as l,j as z,u as m,x as p,k as T,y as u,a as n,v as d,d as y,t as h,w as U}from"../chunks/index.d9030fc9.js";import{T as rt}from"../chunks/Tip.baa67368.js";import{D as Ve}from"../chunks/Docstring.ffac8efa.js";import{C as Be}from"../chunks/CodeBlock.e6cd0d95.js";import{E as st}from"../chunks/ExampleCodeBlock.22dfe688.js";import{H as v,E as it}from"../chunks/EditOnGithub.91d95064.js";function ct(k){let c,w="Example:",f,j,b;return j=new Be({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(){c=o("p"),c.textContent=w,f=a(),M(j.$$.fragment)},l(i){c=r(i,"P",{"data-svelte-h":!0}),p(c)!=="svelte-11lpom8"&&(c.textContent=w),f=l(i),m(j.$$.fragment,i)},m(i,g){n(i,c,g),n(i,f,g),d(j,i,g),b=!0},p:As,i(i){b||(y(j.$$.fragment,i),b=!0)},o(i){h(j.$$.fragment,i),b=!1},d(i){i&&(t(c),t(f)),U(j,i)}}}function pt(k){let c,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(){c=o("p"),c.innerHTML=w},l(f){c=r(f,"P",{"data-svelte-h":!0}),p(c)!=="svelte-fincs2"&&(c.innerHTML=w)},m(f,j){n(f,c,j)},p:As,d(f){f&&t(c)}}}function Mt(k){let c,w="Examples:",f,j,b;return j=new Be({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(){c=o("p"),c.textContent=w,f=a(),M(j.$$.fragment)},l(i){c=r(i,"P",{"data-svelte-h":!0}),p(c)!=="svelte-kvfsh7"&&(c.textContent=w),f=l(i),m(j.$$.fragment,i)},m(i,g){n(i,c,g),n(i,f,g),d(j,i,g),b=!0},p:As,i(i){b||(y(j.$$.fragment,i),b=!0)},o(i){h(j.$$.fragment,i),b=!1},d(i){i&&(t(c),t(f)),U(j,i)}}}function mt(k){let c,w,f,j,b,i,g,Qe,W,vs=`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.`,Ze,P,ks="The abstract from the paper is the following:",xe,R,Vs="<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>",Ee,V,Bs,Ge,X,Ss='ViTPose architecture. Taken from the <a href="https://arxiv.org/abs/2204.12484">original paper.</a>',Ne,$,Qs=`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>.`,ze,F,We,L,Zs='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.',Pe,D,Re,H,Xe,Y,xs='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.',$e,K,Es=`The ViTPose+ checkpoints use 6 experts, hence 6 different dataset indices can be passed.
An overview of the various dataset indices is provided below:`,Fe,q,Gs='<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>',Le,O,Ns="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:",De,ee,He,se,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:`,Ye,te,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>',Ke,ne,qe,ae,Ps='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>):',Oe,le,es,oe,Rs='Alternatively, one can also visualize the keypoints using <a href="https://opencv.org/" rel="nofollow">OpenCV</a> (requires <code>pip install opencv-python</code>):',ss,re,ts,B,Xs,ns,ie,as,ce,$s="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.",ls,pe,Fs='<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>',os,Me,rs,J,me,hs,we,Ls="Constructs a VitPose image processor.",Us,S,de,us,Je,Ds="Preprocess an image or batch of images.",js,Q,ye,fs,Ce,Hs="Transform the heatmaps into keypoint predictions and transform them back to the image.",is,he,cs,C,Ue,bs,Ie,Ys=`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.`,gs,_e,Ks=`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.`,Ts,Z,ps,ue,Ms,_,je,ws,Ae,qs=`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.`,Js,I,fe,Cs,ve,Os='The <a href="/docs/transformers/main/en/model_doc/vitpose#transformers.VitPoseForPoseEstimation">VitPoseForPoseEstimation</a> forward method, overrides the <code>__call__</code> special method.',Is,x,_s,E,ms,be,ds,Se,ys;return b=new v({props:{title:"ViTPose",local:"vitpose",headingTag:"h1"}}),g=new v({props:{title:"Overview",local:"overview",headingTag:"h2"}}),F=new v({props:{title:"Usage Tips",local:"usage-tips",headingTag:"h2"}}),D=new Be({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}}),H=new v({props:{title:"ViTPose++ models",local:"vitpose-models",headingTag:"h3"}}),ee=new Be({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}}),ne=new v({props:{title:"Visualization",local:"visualization",headingTag:"h3"}}),le=new Be({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}}),re=new Be({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}}),ie=new v({props:{title:"Resources",local:"resources",headingTag:"h2"}}),Me=new v({props:{title:"VitPoseImageProcessor",local:"transformers.VitPoseImageProcessor",headingTag:"h2"}}),me=new Ve({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"}}),de=new Ve({props:{name:"preprocess",anchor:"transformers.VitPoseImageProcessor.preprocess",parameters:[{name:"images",val:": typing.Union[ForwardRef('PIL.Image.Image'), numpy.ndarray, ForwardRef('torch.Tensor'), typing.List[ForwardRef('PIL.Image.Image')], typing.List[numpy.ndarray], typing.List[ForwardRef('torch.Tensor')]]"},{name:"boxes",val:": typing.Union[typing.List[typing.List[float]], numpy.ndarray]"},{name:"do_affine_transform",val:": bool = None"},{name:"size",val:": typing.Dict[str, int] = None"},{name:"do_rescale",val:": bool = None"},{name:"rescale_factor",val:": float = None"},{name:"do_normalize",val:": 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>
`}}),ye=new Ve({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:": 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>
`}}),he=new v({props:{title:"VitPoseConfig",local:"transformers.VitPoseConfig",headingTag:"h2"}}),Ue=new Ve({props:{name:"class transformers.VitPoseConfig",anchor:"transformers.VitPoseConfig",parameters:[{name:"backbone_config",val:": PretrainedConfig = None"},{name:"backbone",val:": str = None"},{name:"use_pretrained_backbone",val:": bool = False"},{name:"use_timm_backbone",val:": bool = False"},{name:"backbone_kwargs",val:": 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#L26"}}),Z=new st({props:{anchor:"transformers.VitPoseConfig.example",$$slots:{default:[ct]},$$scope:{ctx:k}}}),ue=new v({props:{title:"VitPoseForPoseEstimation",local:"transformers.VitPoseForPoseEstimation",headingTag:"h2"}}),je=new Ve({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"}}),fe=new Ve({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/imagegpt#transformers.ImageGPTFeatureExtractor.__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 rt({props:{$$slots:{default:[pt]},$$scope:{ctx:k}}}),E=new st({props:{anchor:"transformers.VitPoseForPoseEstimation.forward.example",$$slots:{default:[Mt]},$$scope:{ctx:k}}}),be=new it({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/model_doc/vitpose.md"}}),{c(){c=o("meta"),w=a(),f=o("p"),j=a(),M(b.$$.fragment),i=a(),M(g.$$.fragment),Qe=a(),W=o("p"),W.innerHTML=vs,Ze=a(),P=o("p"),P.textContent=ks,xe=a(),R=o("p"),R.innerHTML=Vs,Ee=a(),V=o("img"),Ge=a(),X=o("small"),X.innerHTML=Ss,Ne=a(),$=o("p"),$.innerHTML=Qs,ze=a(),M(F.$$.fragment),We=a(),L=o("p"),L.innerHTML=Zs,Pe=a(),M(D.$$.fragment),Re=a(),M(H.$$.fragment),Xe=a(),Y=o("p"),Y.innerHTML=xs,$e=a(),K=o("p"),K.textContent=Es,Fe=a(),q=o("ul"),q.innerHTML=Gs,Le=a(),O=o("p"),O.innerHTML=Ns,De=a(),M(ee.$$.fragment),He=a(),se=o("p"),se.textContent=zs,Ye=a(),te=o("ul"),te.innerHTML=Ws,Ke=a(),M(ne.$$.fragment),qe=a(),ae=o("p"),ae.innerHTML=Ps,Oe=a(),M(le.$$.fragment),es=a(),oe=o("p"),oe.innerHTML=Rs,ss=a(),M(re.$$.fragment),ts=a(),B=o("img"),ns=a(),M(ie.$$.fragment),as=a(),ce=o("p"),ce.textContent=$s,ls=a(),pe=o("ul"),pe.innerHTML=Fs,os=a(),M(Me.$$.fragment),rs=a(),J=o("div"),M(me.$$.fragment),hs=a(),we=o("p"),we.textContent=Ls,Us=a(),S=o("div"),M(de.$$.fragment),us=a(),Je=o("p"),Je.textContent=Ds,js=a(),Q=o("div"),M(ye.$$.fragment),fs=a(),Ce=o("p"),Ce.textContent=Hs,is=a(),M(he.$$.fragment),cs=a(),C=o("div"),M(Ue.$$.fragment),bs=a(),Ie=o("p"),Ie.innerHTML=Ys,gs=a(),_e=o("p"),_e.innerHTML=Ks,Ts=a(),M(Z.$$.fragment),ps=a(),M(ue.$$.fragment),Ms=a(),_=o("div"),M(je.$$.fragment),ws=a(),Ae=o("p"),Ae.innerHTML=qs,Js=a(),I=o("div"),M(fe.$$.fragment),Cs=a(),ve=o("p"),ve.innerHTML=Os,Is=a(),M(x.$$.fragment),_s=a(),M(E.$$.fragment),ms=a(),M(be.$$.fragment),ds=a(),Se=o("p"),this.h()},l(e){const s=ot("svelte-u9bgzb",document.head);c=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),m(g.$$.fragment,e),Qe=l(e),W=r(e,"P",{"data-svelte-h":!0}),p(W)!=="svelte-5kliuq"&&(W.innerHTML=vs),Ze=l(e),P=r(e,"P",{"data-svelte-h":!0}),p(P)!=="svelte-vfdo9a"&&(P.textContent=ks),xe=l(e),R=r(e,"P",{"data-svelte-h":!0}),p(R)!=="svelte-1r8g7qv"&&(R.innerHTML=Vs),Ee=l(e),V=r(e,"IMG",{src:!0,alt:!0,width:!0}),Ge=l(e),X=r(e,"SMALL",{"data-svelte-h":!0}),p(X)!=="svelte-1rdk1gr"&&(X.innerHTML=Ss),Ne=l(e),$=r(e,"P",{"data-svelte-h":!0}),p($)!=="svelte-1pkw5cm"&&($.innerHTML=Qs),ze=l(e),m(F.$$.fragment,e),We=l(e),L=r(e,"P",{"data-svelte-h":!0}),p(L)!=="svelte-qazy8m"&&(L.innerHTML=Zs),Pe=l(e),m(D.$$.fragment,e),Re=l(e),m(H.$$.fragment,e),Xe=l(e),Y=r(e,"P",{"data-svelte-h":!0}),p(Y)!=="svelte-er0z9v"&&(Y.innerHTML=xs),$e=l(e),K=r(e,"P",{"data-svelte-h":!0}),p(K)!=="svelte-jjff6j"&&(K.textContent=Es),Fe=l(e),q=r(e,"UL",{"data-svelte-h":!0}),p(q)!=="svelte-wxmy7r"&&(q.innerHTML=Gs),Le=l(e),O=r(e,"P",{"data-svelte-h":!0}),p(O)!=="svelte-15bozem"&&(O.innerHTML=Ns),De=l(e),m(ee.$$.fragment,e),He=l(e),se=r(e,"P",{"data-svelte-h":!0}),p(se)!=="svelte-jjff6j"&&(se.textContent=zs),Ye=l(e),te=r(e,"UL",{"data-svelte-h":!0}),p(te)!=="svelte-wxmy7r"&&(te.innerHTML=Ws),Ke=l(e),m(ne.$$.fragment,e),qe=l(e),ae=r(e,"P",{"data-svelte-h":!0}),p(ae)!=="svelte-wxtr7b"&&(ae.innerHTML=Ps),Oe=l(e),m(le.$$.fragment,e),es=l(e),oe=r(e,"P",{"data-svelte-h":!0}),p(oe)!=="svelte-1mdlnn1"&&(oe.innerHTML=Rs),ss=l(e),m(re.$$.fragment,e),ts=l(e),B=r(e,"IMG",{src:!0,alt:!0,width:!0}),ns=l(e),m(ie.$$.fragment,e),as=l(e),ce=r(e,"P",{"data-svelte-h":!0}),p(ce)!=="svelte-sj3pkb"&&(ce.textContent=$s),ls=l(e),pe=r(e,"UL",{"data-svelte-h":!0}),p(pe)!=="svelte-1qutpeb"&&(pe.innerHTML=Fs),os=l(e),m(Me.$$.fragment,e),rs=l(e),J=r(e,"DIV",{class:!0});var A=z(J);m(me.$$.fragment,A),hs=l(A),we=r(A,"P",{"data-svelte-h":!0}),p(we)!=="svelte-1uf40pk"&&(we.textContent=Ls),Us=l(A),S=r(A,"DIV",{class:!0});var ge=z(S);m(de.$$.fragment,ge),us=l(ge),Je=r(ge,"P",{"data-svelte-h":!0}),p(Je)!=="svelte-1x3yxsa"&&(Je.textContent=Ds),ge.forEach(t),js=l(A),Q=r(A,"DIV",{class:!0});var Te=z(Q);m(ye.$$.fragment,Te),fs=l(Te),Ce=r(Te,"P",{"data-svelte-h":!0}),p(Ce)!=="svelte-1qvlu0g"&&(Ce.textContent=Hs),Te.forEach(t),A.forEach(t),is=l(e),m(he.$$.fragment,e),cs=l(e),C=r(e,"DIV",{class:!0});var G=z(C);m(Ue.$$.fragment,G),bs=l(G),Ie=r(G,"P",{"data-svelte-h":!0}),p(Ie)!=="svelte-owqdsz"&&(Ie.innerHTML=Ys),gs=l(G),_e=r(G,"P",{"data-svelte-h":!0}),p(_e)!=="svelte-o55m63"&&(_e.innerHTML=Ks),Ts=l(G),m(Z.$$.fragment,G),G.forEach(t),ps=l(e),m(ue.$$.fragment,e),Ms=l(e),_=r(e,"DIV",{class:!0});var ke=z(_);m(je.$$.fragment,ke),ws=l(ke),Ae=r(ke,"P",{"data-svelte-h":!0}),p(Ae)!=="svelte-1eb2kd5"&&(Ae.innerHTML=qs),Js=l(ke),I=r(ke,"DIV",{class:!0});var N=z(I);m(fe.$$.fragment,N),Cs=l(N),ve=r(N,"P",{"data-svelte-h":!0}),p(ve)!=="svelte-s2387n"&&(ve.innerHTML=Os),Is=l(N),m(x.$$.fragment,N),_s=l(N),m(E.$$.fragment,N),N.forEach(t),ke.forEach(t),ms=l(e),m(be.$$.fragment,e),ds=l(e),Se=r(e,"P",{}),z(Se).forEach(t),this.h()},h(){T(c,"name","hf:doc:metadata"),T(c,"content",dt),et(V.src,Bs="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/model_doc/vitpose-architecture.png")||T(V,"src",Bs),T(V,"alt","drawing"),T(V,"width","600"),et(B.src,Xs="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/model_doc/vitpose-coco.jpg")||T(B,"src",Xs),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(I,"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")},m(e,s){u(document.head,c),n(e,w,s),n(e,f,s),n(e,j,s),d(b,e,s),n(e,i,s),d(g,e,s),n(e,Qe,s),n(e,W,s),n(e,Ze,s),n(e,P,s),n(e,xe,s),n(e,R,s),n(e,Ee,s),n(e,V,s),n(e,Ge,s),n(e,X,s),n(e,Ne,s),n(e,$,s),n(e,ze,s),d(F,e,s),n(e,We,s),n(e,L,s),n(e,Pe,s),d(D,e,s),n(e,Re,s),d(H,e,s),n(e,Xe,s),n(e,Y,s),n(e,$e,s),n(e,K,s),n(e,Fe,s),n(e,q,s),n(e,Le,s),n(e,O,s),n(e,De,s),d(ee,e,s),n(e,He,s),n(e,se,s),n(e,Ye,s),n(e,te,s),n(e,Ke,s),d(ne,e,s),n(e,qe,s),n(e,ae,s),n(e,Oe,s),d(le,e,s),n(e,es,s),n(e,oe,s),n(e,ss,s),d(re,e,s),n(e,ts,s),n(e,B,s),n(e,ns,s),d(ie,e,s),n(e,as,s),n(e,ce,s),n(e,ls,s),n(e,pe,s),n(e,os,s),d(Me,e,s),n(e,rs,s),n(e,J,s),d(me,J,null),u(J,hs),u(J,we),u(J,Us),u(J,S),d(de,S,null),u(S,us),u(S,Je),u(J,js),u(J,Q),d(ye,Q,null),u(Q,fs),u(Q,Ce),n(e,is,s),d(he,e,s),n(e,cs,s),n(e,C,s),d(Ue,C,null),u(C,bs),u(C,Ie),u(C,gs),u(C,_e),u(C,Ts),d(Z,C,null),n(e,ps,s),d(ue,e,s),n(e,Ms,s),n(e,_,s),d(je,_,null),u(_,ws),u(_,Ae),u(_,Js),u(_,I),d(fe,I,null),u(I,Cs),u(I,ve),u(I,Is),d(x,I,null),u(I,_s),d(E,I,null),n(e,ms,s),d(be,e,s),n(e,ds,s),n(e,Se,s),ys=!0},p(e,[s]){const A={};s&2&&(A.$$scope={dirty:s,ctx:e}),Z.$set(A);const ge={};s&2&&(ge.$$scope={dirty:s,ctx:e}),x.$set(ge);const Te={};s&2&&(Te.$$scope={dirty:s,ctx:e}),E.$set(Te)},i(e){ys||(y(b.$$.fragment,e),y(g.$$.fragment,e),y(F.$$.fragment,e),y(D.$$.fragment,e),y(H.$$.fragment,e),y(ee.$$.fragment,e),y(ne.$$.fragment,e),y(le.$$.fragment,e),y(re.$$.fragment,e),y(ie.$$.fragment,e),y(Me.$$.fragment,e),y(me.$$.fragment,e),y(de.$$.fragment,e),y(ye.$$.fragment,e),y(he.$$.fragment,e),y(Ue.$$.fragment,e),y(Z.$$.fragment,e),y(ue.$$.fragment,e),y(je.$$.fragment,e),y(fe.$$.fragment,e),y(x.$$.fragment,e),y(E.$$.fragment,e),y(be.$$.fragment,e),ys=!0)},o(e){h(b.$$.fragment,e),h(g.$$.fragment,e),h(F.$$.fragment,e),h(D.$$.fragment,e),h(H.$$.fragment,e),h(ee.$$.fragment,e),h(ne.$$.fragment,e),h(le.$$.fragment,e),h(re.$$.fragment,e),h(ie.$$.fragment,e),h(Me.$$.fragment,e),h(me.$$.fragment,e),h(de.$$.fragment,e),h(ye.$$.fragment,e),h(he.$$.fragment,e),h(Ue.$$.fragment,e),h(Z.$$.fragment,e),h(ue.$$.fragment,e),h(je.$$.fragment,e),h(fe.$$.fragment,e),h(x.$$.fragment,e),h(E.$$.fragment,e),h(be.$$.fragment,e),ys=!1},d(e){e&&(t(w),t(f),t(j),t(i),t(Qe),t(W),t(Ze),t(P),t(xe),t(R),t(Ee),t(V),t(Ge),t(X),t(Ne),t($),t(ze),t(We),t(L),t(Pe),t(Re),t(Xe),t(Y),t($e),t(K),t(Fe),t(q),t(Le),t(O),t(De),t(He),t(se),t(Ye),t(te),t(Ke),t(qe),t(ae),t(Oe),t(es),t(oe),t(ss),t(ts),t(B),t(ns),t(as),t(ce),t(ls),t(pe),t(os),t(rs),t(J),t(is),t(cs),t(C),t(ps),t(Ms),t(_),t(ms),t(ds),t(Se)),t(c),U(b,e),U(g,e),U(F,e),U(D,e),U(H,e),U(ee,e),U(ne,e),U(le,e),U(re,e),U(ie,e),U(Me,e),U(me),U(de),U(ye),U(he,e),U(Ue),U(Z),U(ue,e),U(je),U(fe),U(x),U(E),U(be,e)}}}const dt='{"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 yt(k){return nt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Tt extends at{constructor(c){super(),lt(this,c,yt,mt,tt,{})}}export{Tt as component};
