import{s as Es,o as Xs,n as Qs}from"../chunks/scheduler.bdbef820.js";import{S as Ns,i as Rs,g as p,s as t,r as h,A as zs,h as c,f as e,c as n,j as As,u as r,x as o,k as F,y as Hs,a as l,v as j,d as J,t as M,w as b}from"../chunks/index.c0aea24a.js";import{T as Ss}from"../chunks/Tip.31005f7d.js";import{C as w}from"../chunks/CodeBlock.6ccca92e.js";import{H as Fs,E as Ls}from"../chunks/EditOnGithub.725ee0c1.js";function Ds(L){let i,u=`Now that you know how to process a dataset for object detection, learn
<a href="https://colab.research.google.com/github/NielsRogge/Transformers-Tutorials/blob/master/YOLOS/Fine_tuning_YOLOS_for_object_detection_on_custom_dataset_(balloon).ipynb" rel="nofollow">how to train an object detection model</a>
and use it for inference.`;return{c(){i=p("p"),i.innerHTML=u},l(m){i=c(m,"P",{"data-svelte-h":!0}),o(i)!=="svelte-cn2hue"&&(i.innerHTML=u)},m(m,H){l(m,i,H)},p:Qs,d(m){m&&e(i)}}}function Ks(L){let i,u,m,H,x,D,f,us='Object detection models identify something in an image, and object detection datasets are used for applications such as autonomous driving and detecting natural hazards like wildfire. This guide will show you how to apply transformations to an object detection dataset following the <a href="https://albumentations.ai/docs/examples/example_bboxes/" rel="nofollow">tutorial</a> from <a href="https://albumentations.ai/docs/" rel="nofollow">Albumentations</a>.',K,U,xs="To run these examples, make sure you have up-to-date versions of <code>albumentations</code> and <code>cv2</code> installed:",P,I,q,C,fs='In this example, you’ll use the <a href="https://huggingface.co/datasets/cppe-5" rel="nofollow"><code>cppe-5</code></a> dataset for identifying medical personal protective equipment (PPE) in the context of the COVID-19 pandemic.',O,v,Us="Load the dataset and take a look at an example:",ss,B,as,_,Is="The dataset has the following fields:",es,Z,Cs='<li><code>image</code>: PIL.Image.Image object containing the image.</li> <li><code>image_id</code>: The image ID.</li> <li><code>height</code>: The image height.</li> <li><code>width</code>: The image width.</li> <li><code>objects</code>: A dictionary containing bounding box metadata for the objects in the image:<ul><li><code>id</code>: The annotation id.</li> <li><code>area</code>: The area of the bounding box.</li> <li><code>bbox</code>: The object’s bounding box (in the <a href="https://albumentations.ai/docs/getting_started/bounding_boxes_augmentation/#coco" rel="nofollow">coco</a> format).</li> <li><code>category</code>: The object’s category, with possible values including <code>Coverall (0)</code>, <code>Face_Shield (1)</code>, <code>Gloves (2)</code>, <code>Goggles (3)</code> and <code>Mask (4)</code>.</li></ul></li>',ls,k,vs='You can visualize the <code>bboxes</code> on the image using some internal torch utilities. To do that, you will need to reference the <a href="/docs/datasets/pr_6981/en/package_reference/main_classes#datasets.ClassLabel">ClassLabel</a> feature associated with the category IDs so you can look up the string labels:',ts,$,ns,g,Bs='<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/datasets/visualize_detection_example.png"/>',ps,G,_s="With <code>albumentations</code>, you can apply transforms that will affect the image while also updating the <code>bboxes</code> accordingly. In this case, the image is resized to (480, 480), flipped horizontally, and brightened.",cs,W,is,V,Zs="Now when you visualize the result, the image should be flipped, but the <code>bboxes</code> should still be in the right places.",os,Y,ms,d,ks='<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/datasets/visualize_detection_example_transformed.png"/>',hs,A,$s="Create a function to apply the transform to a batch of examples:",rs,E,js,X,Gs='Use the <a href="/docs/datasets/pr_6981/en/package_reference/main_classes#datasets.Dataset.set_transform">set_transform()</a> function to apply the transform on-the-fly which consumes less disk space. The randomness of data augmentation may return a different image if you access the same example twice. It is especially useful when training a model for several epochs.',Js,Q,Ms,N,Ws="You can verify the transform works by visualizing the 10th example:",bs,R,gs,y,Vs='<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/datasets/visualize_detection_example_transformed_2.png"/>',ds,T,ys,z,Ts,S,ws;return x=new Fs({props:{title:"Object detection",local:"object-detection",headingTag:"h1"}}),I=new w({props:{code:"cGlwJTIwaW5zdGFsbCUyMC1VJTIwYWxidW1lbnRhdGlvbnMlMjBvcGVuY3YtcHl0aG9u",highlighted:'pip <span class="hljs-keyword">install</span> -U albumentations opencv-python',wrap:!1}}),B=new w({props:{code:"ZnJvbSUyMGRhdGFzZXRzJTIwaW1wb3J0JTIwbG9hZF9kYXRhc2V0JTBBJTBBZHMlMjAlM0QlMjBsb2FkX2RhdGFzZXQoJTIyY3BwZS01JTIyKSUwQWV4YW1wbGUlMjAlM0QlMjBkcyU1Qid0cmFpbiclNUQlNUIwJTVEJTBBZXhhbXBsZQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset

<span class="hljs-meta">&gt;&gt;&gt; </span>ds = load_dataset(<span class="hljs-string">&quot;cppe-5&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>example = ds[<span class="hljs-string">&#x27;train&#x27;</span>][<span class="hljs-number">0</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>example
{<span class="hljs-string">&#x27;height&#x27;</span>: <span class="hljs-number">663</span>,
 <span class="hljs-string">&#x27;image&#x27;</span>: &lt;PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=943x663 at <span class="hljs-number">0x7FC3DC756250</span>&gt;,
 <span class="hljs-string">&#x27;image_id&#x27;</span>: <span class="hljs-number">15</span>,
 <span class="hljs-string">&#x27;objects&#x27;</span>: {<span class="hljs-string">&#x27;area&#x27;</span>: [<span class="hljs-number">3796</span>, <span class="hljs-number">1596</span>, <span class="hljs-number">152768</span>, <span class="hljs-number">81002</span>],
  <span class="hljs-string">&#x27;bbox&#x27;</span>: [[<span class="hljs-number">302.0</span>, <span class="hljs-number">109.0</span>, <span class="hljs-number">73.0</span>, <span class="hljs-number">52.0</span>],
   [<span class="hljs-number">810.0</span>, <span class="hljs-number">100.0</span>, <span class="hljs-number">57.0</span>, <span class="hljs-number">28.0</span>],
   [<span class="hljs-number">160.0</span>, <span class="hljs-number">31.0</span>, <span class="hljs-number">248.0</span>, <span class="hljs-number">616.0</span>],
   [<span class="hljs-number">741.0</span>, <span class="hljs-number">68.0</span>, <span class="hljs-number">202.0</span>, <span class="hljs-number">401.0</span>]],
  <span class="hljs-string">&#x27;category&#x27;</span>: [<span class="hljs-number">4</span>, <span class="hljs-number">4</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>],
  <span class="hljs-string">&#x27;id&#x27;</span>: [<span class="hljs-number">114</span>, <span class="hljs-number">115</span>, <span class="hljs-number">116</span>, <span class="hljs-number">117</span>]},
 <span class="hljs-string">&#x27;width&#x27;</span>: <span class="hljs-number">943</span>}`,wrap:!1}}),$=new w({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdG9yY2h2aXNpb24ub3BzJTIwaW1wb3J0JTIwYm94X2NvbnZlcnQlMEFmcm9tJTIwdG9yY2h2aXNpb24udXRpbHMlMjBpbXBvcnQlMjBkcmF3X2JvdW5kaW5nX2JveGVzJTBBZnJvbSUyMHRvcmNodmlzaW9uLnRyYW5zZm9ybXMuZnVuY3Rpb25hbCUyMGltcG9ydCUyMHBpbF90b190ZW5zb3IlMkMlMjB0b19waWxfaW1hZ2UlMEElMEFjYXRlZ29yaWVzJTIwJTNEJTIwZHMlNUIndHJhaW4nJTVELmZlYXR1cmVzJTVCJ29iamVjdHMnJTVELmZlYXR1cmUlNUInY2F0ZWdvcnknJTVEJTBBJTBBYm94ZXNfeHl3aCUyMCUzRCUyMHRvcmNoLnRlbnNvcihleGFtcGxlJTVCJ29iamVjdHMnJTVEJTVCJ2Jib3gnJTVEKSUwQWJveGVzX3h5eHklMjAlM0QlMjBib3hfY29udmVydChib3hlc194eXdoJTJDJTIwJ3h5d2gnJTJDJTIwJ3h5eHknKSUwQWxhYmVscyUyMCUzRCUyMCU1QmNhdGVnb3JpZXMuaW50MnN0cih4KSUyMGZvciUyMHglMjBpbiUyMGV4YW1wbGUlNUInb2JqZWN0cyclNUQlNUInY2F0ZWdvcnknJTVEJTVEJTBBdG9fcGlsX2ltYWdlKCUwQSUyMCUyMCUyMCUyMGRyYXdfYm91bmRpbmdfYm94ZXMoJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwcGlsX3RvX3RlbnNvcihleGFtcGxlJTVCJ2ltYWdlJyU1RCklMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBib3hlc194eXh5JTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwY29sb3JzJTNEJTIycmVkJTIyJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwbGFiZWxzJTNEbGFiZWxzJTJDJTBBJTIwJTIwJTIwJTIwKSUwQSk=",highlighted:`<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> torchvision.ops <span class="hljs-keyword">import</span> box_convert
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> torchvision.utils <span class="hljs-keyword">import</span> draw_bounding_boxes
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> torchvision.transforms.functional <span class="hljs-keyword">import</span> pil_to_tensor, to_pil_image

<span class="hljs-meta">&gt;&gt;&gt; </span>categories = ds[<span class="hljs-string">&#x27;train&#x27;</span>].features[<span class="hljs-string">&#x27;objects&#x27;</span>].feature[<span class="hljs-string">&#x27;category&#x27;</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span>boxes_xywh = torch.tensor(example[<span class="hljs-string">&#x27;objects&#x27;</span>][<span class="hljs-string">&#x27;bbox&#x27;</span>])
<span class="hljs-meta">&gt;&gt;&gt; </span>boxes_xyxy = box_convert(boxes_xywh, <span class="hljs-string">&#x27;xywh&#x27;</span>, <span class="hljs-string">&#x27;xyxy&#x27;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>labels = [categories.int2str(x) <span class="hljs-keyword">for</span> x <span class="hljs-keyword">in</span> example[<span class="hljs-string">&#x27;objects&#x27;</span>][<span class="hljs-string">&#x27;category&#x27;</span>]]
<span class="hljs-meta">&gt;&gt;&gt; </span>to_pil_image(
<span class="hljs-meta">... </span>    draw_bounding_boxes(
<span class="hljs-meta">... </span>        pil_to_tensor(example[<span class="hljs-string">&#x27;image&#x27;</span>]),
<span class="hljs-meta">... </span>        boxes_xyxy,
<span class="hljs-meta">... </span>        colors=<span class="hljs-string">&quot;red&quot;</span>,
<span class="hljs-meta">... </span>        labels=labels,
<span class="hljs-meta">... </span>    )
<span class="hljs-meta">... </span>)`,wrap:!1}}),W=new w({props:{code:"aW1wb3J0JTIwYWxidW1lbnRhdGlvbnMlMEFpbXBvcnQlMjBudW1weSUyMGFzJTIwbnAlMEElMEF0cmFuc2Zvcm0lMjAlM0QlMjBhbGJ1bWVudGF0aW9ucy5Db21wb3NlKCU1QiUwQSUyMCUyMCUyMCUyMGFsYnVtZW50YXRpb25zLlJlc2l6ZSg0ODAlMkMlMjA0ODApJTJDJTBBJTIwJTIwJTIwJTIwYWxidW1lbnRhdGlvbnMuSG9yaXpvbnRhbEZsaXAocCUzRDEuMCklMkMlMEElMjAlMjAlMjAlMjBhbGJ1bWVudGF0aW9ucy5SYW5kb21CcmlnaHRuZXNzQ29udHJhc3QocCUzRDEuMCklMkMlMEElNUQlMkMlMjBiYm94X3BhcmFtcyUzRGFsYnVtZW50YXRpb25zLkJib3hQYXJhbXMoZm9ybWF0JTNEJ2NvY28nJTJDJTIwJTIwbGFiZWxfZmllbGRzJTNEJTVCJ2NhdGVnb3J5JyU1RCkpJTBBJTBBaW1hZ2UlMjAlM0QlMjBucC5hcnJheShleGFtcGxlJTVCJ2ltYWdlJyU1RCklMEFvdXQlMjAlM0QlMjB0cmFuc2Zvcm0oJTBBJTIwJTIwJTIwJTIwaW1hZ2UlM0RpbWFnZSUyQyUwQSUyMCUyMCUyMCUyMGJib3hlcyUzRGV4YW1wbGUlNUInb2JqZWN0cyclNUQlNUInYmJveCclNUQlMkMlMEElMjAlMjAlMjAlMjBjYXRlZ29yeSUzRGV4YW1wbGUlNUInb2JqZWN0cyclNUQlNUInY2F0ZWdvcnknJTVEJTJDJTBBKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> albumentations
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np

<span class="hljs-meta">&gt;&gt;&gt; </span>transform = albumentations.Compose([
<span class="hljs-meta">... </span>    albumentations.Resize(<span class="hljs-number">480</span>, <span class="hljs-number">480</span>),
<span class="hljs-meta">... </span>    albumentations.HorizontalFlip(p=<span class="hljs-number">1.0</span>),
<span class="hljs-meta">... </span>    albumentations.RandomBrightnessContrast(p=<span class="hljs-number">1.0</span>),
<span class="hljs-meta">... </span>], bbox_params=albumentations.BboxParams(<span class="hljs-built_in">format</span>=<span class="hljs-string">&#x27;coco&#x27;</span>,  label_fields=[<span class="hljs-string">&#x27;category&#x27;</span>]))

<span class="hljs-meta">&gt;&gt;&gt; </span>image = np.array(example[<span class="hljs-string">&#x27;image&#x27;</span>])
<span class="hljs-meta">&gt;&gt;&gt; </span>out = transform(
<span class="hljs-meta">... </span>    image=image,
<span class="hljs-meta">... </span>    bboxes=example[<span class="hljs-string">&#x27;objects&#x27;</span>][<span class="hljs-string">&#x27;bbox&#x27;</span>],
<span class="hljs-meta">... </span>    category=example[<span class="hljs-string">&#x27;objects&#x27;</span>][<span class="hljs-string">&#x27;category&#x27;</span>],
<span class="hljs-meta">... </span>)`,wrap:!1}}),Y=new w({props:{code:"aW1hZ2UlMjAlM0QlMjB0b3JjaC50ZW5zb3Iob3V0JTVCJ2ltYWdlJyU1RCkucGVybXV0ZSgyJTJDJTIwMCUyQyUyMDEpJTBBYm94ZXNfeHl3aCUyMCUzRCUyMHRvcmNoLnN0YWNrKCU1QnRvcmNoLnRlbnNvcih4KSUyMGZvciUyMHglMjBpbiUyMG91dCU1QidiYm94ZXMnJTVEJTVEKSUwQWJveGVzX3h5eHklMjAlM0QlMjBib3hfY29udmVydChib3hlc194eXdoJTJDJTIwJ3h5d2gnJTJDJTIwJ3h5eHknKSUwQWxhYmVscyUyMCUzRCUyMCU1QmNhdGVnb3JpZXMuaW50MnN0cih4KSUyMGZvciUyMHglMjBpbiUyMG91dCU1QidjYXRlZ29yeSclNUQlNUQlMEF0b19waWxfaW1hZ2UoJTBBJTIwJTIwJTIwJTIwZHJhd19ib3VuZGluZ19ib3hlcyglMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBpbWFnZSUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGJveGVzX3h5eHklMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBjb2xvcnMlM0QncmVkJyUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGxhYmVscyUzRGxhYmVscyUwQSUyMCUyMCUyMCUyMCklMEEp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>image = torch.tensor(out[<span class="hljs-string">&#x27;image&#x27;</span>]).permute(<span class="hljs-number">2</span>, <span class="hljs-number">0</span>, <span class="hljs-number">1</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>boxes_xywh = torch.stack([torch.tensor(x) <span class="hljs-keyword">for</span> x <span class="hljs-keyword">in</span> out[<span class="hljs-string">&#x27;bboxes&#x27;</span>]])
<span class="hljs-meta">&gt;&gt;&gt; </span>boxes_xyxy = box_convert(boxes_xywh, <span class="hljs-string">&#x27;xywh&#x27;</span>, <span class="hljs-string">&#x27;xyxy&#x27;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>labels = [categories.int2str(x) <span class="hljs-keyword">for</span> x <span class="hljs-keyword">in</span> out[<span class="hljs-string">&#x27;category&#x27;</span>]]
<span class="hljs-meta">&gt;&gt;&gt; </span>to_pil_image(
<span class="hljs-meta">... </span>    draw_bounding_boxes(
<span class="hljs-meta">... </span>        image,
<span class="hljs-meta">... </span>        boxes_xyxy,
<span class="hljs-meta">... </span>        colors=<span class="hljs-string">&#x27;red&#x27;</span>,
<span class="hljs-meta">... </span>        labels=labels
<span class="hljs-meta">... </span>    )
<span class="hljs-meta">... </span>)`,wrap:!1}}),E=new w({props:{code:"ZGVmJTIwdHJhbnNmb3JtcyhleGFtcGxlcyklM0ElMEElMjAlMjAlMjAlMjBpbWFnZXMlMkMlMjBiYm94ZXMlMkMlMjBjYXRlZ29yaWVzJTIwJTNEJTIwJTVCJTVEJTJDJTIwJTVCJTVEJTJDJTIwJTVCJTVEJTBBJTIwJTIwJTIwJTIwZm9yJTIwaW1hZ2UlMkMlMjBvYmplY3RzJTIwaW4lMjB6aXAoZXhhbXBsZXMlNUInaW1hZ2UnJTVEJTJDJTIwZXhhbXBsZXMlNUInb2JqZWN0cyclNUQpJTNBJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwaW1hZ2UlMjAlM0QlMjBucC5hcnJheShpbWFnZS5jb252ZXJ0KCUyMlJHQiUyMikpJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwb3V0JTIwJTNEJTIwdHJhbnNmb3JtKCUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGltYWdlJTNEaW1hZ2UlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBiYm94ZXMlM0RvYmplY3RzJTVCJ2Jib3gnJTVEJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwY2F0ZWdvcnklM0RvYmplY3RzJTVCJ2NhdGVnb3J5JyU1RCUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCklMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBpbWFnZXMuYXBwZW5kKHRvcmNoLnRlbnNvcihvdXQlNUInaW1hZ2UnJTVEKS5wZXJtdXRlKDIlMkMlMjAwJTJDJTIwMSkpJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwYmJveGVzLmFwcGVuZCh0b3JjaC50ZW5zb3Iob3V0JTVCJ2Jib3hlcyclNUQpKSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGNhdGVnb3JpZXMuYXBwZW5kKG91dCU1QidjYXRlZ29yeSclNUQpJTBBJTIwJTIwJTIwJTIwcmV0dXJuJTIwJTdCJ2ltYWdlJyUzQSUyMGltYWdlcyUyQyUyMCdiYm94JyUzQSUyMGJib3hlcyUyQyUyMCdjYXRlZ29yeSclM0ElMjBjYXRlZ29yaWVzJTdE",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">def</span> <span class="hljs-title function_">transforms</span>(<span class="hljs-params">examples</span>):
<span class="hljs-meta">... </span>    images, bboxes, categories = [], [], []
<span class="hljs-meta">... </span>    <span class="hljs-keyword">for</span> image, objects <span class="hljs-keyword">in</span> <span class="hljs-built_in">zip</span>(examples[<span class="hljs-string">&#x27;image&#x27;</span>], examples[<span class="hljs-string">&#x27;objects&#x27;</span>]):
<span class="hljs-meta">... </span>        image = np.array(image.convert(<span class="hljs-string">&quot;RGB&quot;</span>))
<span class="hljs-meta">... </span>        out = transform(
<span class="hljs-meta">... </span>            image=image,
<span class="hljs-meta">... </span>            bboxes=objects[<span class="hljs-string">&#x27;bbox&#x27;</span>],
<span class="hljs-meta">... </span>            category=objects[<span class="hljs-string">&#x27;category&#x27;</span>]
<span class="hljs-meta">... </span>        )
<span class="hljs-meta">... </span>        images.append(torch.tensor(out[<span class="hljs-string">&#x27;image&#x27;</span>]).permute(<span class="hljs-number">2</span>, <span class="hljs-number">0</span>, <span class="hljs-number">1</span>))
<span class="hljs-meta">... </span>        bboxes.append(torch.tensor(out[<span class="hljs-string">&#x27;bboxes&#x27;</span>]))
<span class="hljs-meta">... </span>        categories.append(out[<span class="hljs-string">&#x27;category&#x27;</span>])
<span class="hljs-meta">... </span>    <span class="hljs-keyword">return</span> {<span class="hljs-string">&#x27;image&#x27;</span>: images, <span class="hljs-string">&#x27;bbox&#x27;</span>: bboxes, <span class="hljs-string">&#x27;category&#x27;</span>: categories}`,wrap:!1}}),Q=new w({props:{code:"ZHMlNUIndHJhaW4nJTVELnNldF90cmFuc2Zvcm0odHJhbnNmb3Jtcyk=",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>ds[<span class="hljs-string">&#x27;train&#x27;</span>].set_transform(transforms)',wrap:!1}}),R=new w({props:{code:"ZXhhbXBsZSUyMCUzRCUyMGRzJTVCJ3RyYWluJyU1RCU1QjEwJTVEJTBBdG9fcGlsX2ltYWdlKCUwQSUyMCUyMCUyMCUyMGRyYXdfYm91bmRpbmdfYm94ZXMoJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwZXhhbXBsZSU1QidpbWFnZSclNUQlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBib3hfY29udmVydChleGFtcGxlJTVCJ2Jib3gnJTVEJTJDJTIwJ3h5d2gnJTJDJTIwJ3h5eHknKSUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGNvbG9ycyUzRCdyZWQnJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwbGFiZWxzJTNEJTVCY2F0ZWdvcmllcy5pbnQyc3RyKHgpJTIwZm9yJTIweCUyMGluJTIwZXhhbXBsZSU1QidjYXRlZ29yeSclNUQlNUQlMEElMjAlMjAlMjAlMjApJTBBKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>example = ds[<span class="hljs-string">&#x27;train&#x27;</span>][<span class="hljs-number">10</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>to_pil_image(
<span class="hljs-meta">... </span>    draw_bounding_boxes(
<span class="hljs-meta">... </span>        example[<span class="hljs-string">&#x27;image&#x27;</span>],
<span class="hljs-meta">... </span>        box_convert(example[<span class="hljs-string">&#x27;bbox&#x27;</span>], <span class="hljs-string">&#x27;xywh&#x27;</span>, <span class="hljs-string">&#x27;xyxy&#x27;</span>),
<span class="hljs-meta">... </span>        colors=<span class="hljs-string">&#x27;red&#x27;</span>,
<span class="hljs-meta">... </span>        labels=[categories.int2str(x) <span class="hljs-keyword">for</span> x <span class="hljs-keyword">in</span> example[<span class="hljs-string">&#x27;category&#x27;</span>]]
<span class="hljs-meta">... </span>    )
<span class="hljs-meta">... </span>)`,wrap:!1}}),T=new Ss({props:{$$slots:{default:[Ds]},$$scope:{ctx:L}}}),z=new Ls({props:{source:"https://github.com/huggingface/datasets/blob/main/docs/source/object_detection.mdx"}}),{c(){i=p("meta"),u=t(),m=p("p"),H=t(),h(x.$$.fragment),D=t(),f=p("p"),f.innerHTML=us,K=t(),U=p("p"),U.innerHTML=xs,P=t(),h(I.$$.fragment),q=t(),C=p("p"),C.innerHTML=fs,O=t(),v=p("p"),v.textContent=Us,ss=t(),h(B.$$.fragment),as=t(),_=p("p"),_.textContent=Is,es=t(),Z=p("ul"),Z.innerHTML=Cs,ls=t(),k=p("p"),k.innerHTML=vs,ts=t(),h($.$$.fragment),ns=t(),g=p("div"),g.innerHTML=Bs,ps=t(),G=p("p"),G.innerHTML=_s,cs=t(),h(W.$$.fragment),is=t(),V=p("p"),V.innerHTML=Zs,os=t(),h(Y.$$.fragment),ms=t(),d=p("div"),d.innerHTML=ks,hs=t(),A=p("p"),A.textContent=$s,rs=t(),h(E.$$.fragment),js=t(),X=p("p"),X.innerHTML=Gs,Js=t(),h(Q.$$.fragment),Ms=t(),N=p("p"),N.textContent=Ws,bs=t(),h(R.$$.fragment),gs=t(),y=p("div"),y.innerHTML=Vs,ds=t(),h(T.$$.fragment),ys=t(),h(z.$$.fragment),Ts=t(),S=p("p"),this.h()},l(s){const a=zs("svelte-u9bgzb",document.head);i=c(a,"META",{name:!0,content:!0}),a.forEach(e),u=n(s),m=c(s,"P",{}),As(m).forEach(e),H=n(s),r(x.$$.fragment,s),D=n(s),f=c(s,"P",{"data-svelte-h":!0}),o(f)!=="svelte-jruc7r"&&(f.innerHTML=us),K=n(s),U=c(s,"P",{"data-svelte-h":!0}),o(U)!=="svelte-129tu0o"&&(U.innerHTML=xs),P=n(s),r(I.$$.fragment,s),q=n(s),C=c(s,"P",{"data-svelte-h":!0}),o(C)!=="svelte-1weiyre"&&(C.innerHTML=fs),O=n(s),v=c(s,"P",{"data-svelte-h":!0}),o(v)!=="svelte-1yzvpv3"&&(v.textContent=Us),ss=n(s),r(B.$$.fragment,s),as=n(s),_=c(s,"P",{"data-svelte-h":!0}),o(_)!=="svelte-ybiosu"&&(_.textContent=Is),es=n(s),Z=c(s,"UL",{"data-svelte-h":!0}),o(Z)!=="svelte-1fspv27"&&(Z.innerHTML=Cs),ls=n(s),k=c(s,"P",{"data-svelte-h":!0}),o(k)!=="svelte-1avpyr1"&&(k.innerHTML=vs),ts=n(s),r($.$$.fragment,s),ns=n(s),g=c(s,"DIV",{class:!0,"data-svelte-h":!0}),o(g)!=="svelte-12m4ojo"&&(g.innerHTML=Bs),ps=n(s),G=c(s,"P",{"data-svelte-h":!0}),o(G)!=="svelte-1mco384"&&(G.innerHTML=_s),cs=n(s),r(W.$$.fragment,s),is=n(s),V=c(s,"P",{"data-svelte-h":!0}),o(V)!=="svelte-kmv35f"&&(V.innerHTML=Zs),os=n(s),r(Y.$$.fragment,s),ms=n(s),d=c(s,"DIV",{class:!0,"data-svelte-h":!0}),o(d)!=="svelte-1hy8dte"&&(d.innerHTML=ks),hs=n(s),A=c(s,"P",{"data-svelte-h":!0}),o(A)!=="svelte-di1rb7"&&(A.textContent=$s),rs=n(s),r(E.$$.fragment,s),js=n(s),X=c(s,"P",{"data-svelte-h":!0}),o(X)!=="svelte-1x4nklf"&&(X.innerHTML=Gs),Js=n(s),r(Q.$$.fragment,s),Ms=n(s),N=c(s,"P",{"data-svelte-h":!0}),o(N)!=="svelte-u7hwut"&&(N.textContent=Ws),bs=n(s),r(R.$$.fragment,s),gs=n(s),y=c(s,"DIV",{class:!0,"data-svelte-h":!0}),o(y)!=="svelte-70kk7f"&&(y.innerHTML=Vs),ds=n(s),r(T.$$.fragment,s),ys=n(s),r(z.$$.fragment,s),Ts=n(s),S=c(s,"P",{}),As(S).forEach(e),this.h()},h(){F(i,"name","hf:doc:metadata"),F(i,"content",Ps),F(g,"class","flex justify-center"),F(d,"class","flex justify-center"),F(y,"class","flex justify-center")},m(s,a){Hs(document.head,i),l(s,u,a),l(s,m,a),l(s,H,a),j(x,s,a),l(s,D,a),l(s,f,a),l(s,K,a),l(s,U,a),l(s,P,a),j(I,s,a),l(s,q,a),l(s,C,a),l(s,O,a),l(s,v,a),l(s,ss,a),j(B,s,a),l(s,as,a),l(s,_,a),l(s,es,a),l(s,Z,a),l(s,ls,a),l(s,k,a),l(s,ts,a),j($,s,a),l(s,ns,a),l(s,g,a),l(s,ps,a),l(s,G,a),l(s,cs,a),j(W,s,a),l(s,is,a),l(s,V,a),l(s,os,a),j(Y,s,a),l(s,ms,a),l(s,d,a),l(s,hs,a),l(s,A,a),l(s,rs,a),j(E,s,a),l(s,js,a),l(s,X,a),l(s,Js,a),j(Q,s,a),l(s,Ms,a),l(s,N,a),l(s,bs,a),j(R,s,a),l(s,gs,a),l(s,y,a),l(s,ds,a),j(T,s,a),l(s,ys,a),j(z,s,a),l(s,Ts,a),l(s,S,a),ws=!0},p(s,[a]){const Ys={};a&2&&(Ys.$$scope={dirty:a,ctx:s}),T.$set(Ys)},i(s){ws||(J(x.$$.fragment,s),J(I.$$.fragment,s),J(B.$$.fragment,s),J($.$$.fragment,s),J(W.$$.fragment,s),J(Y.$$.fragment,s),J(E.$$.fragment,s),J(Q.$$.fragment,s),J(R.$$.fragment,s),J(T.$$.fragment,s),J(z.$$.fragment,s),ws=!0)},o(s){M(x.$$.fragment,s),M(I.$$.fragment,s),M(B.$$.fragment,s),M($.$$.fragment,s),M(W.$$.fragment,s),M(Y.$$.fragment,s),M(E.$$.fragment,s),M(Q.$$.fragment,s),M(R.$$.fragment,s),M(T.$$.fragment,s),M(z.$$.fragment,s),ws=!1},d(s){s&&(e(u),e(m),e(H),e(D),e(f),e(K),e(U),e(P),e(q),e(C),e(O),e(v),e(ss),e(as),e(_),e(es),e(Z),e(ls),e(k),e(ts),e(ns),e(g),e(ps),e(G),e(cs),e(is),e(V),e(os),e(ms),e(d),e(hs),e(A),e(rs),e(js),e(X),e(Js),e(Ms),e(N),e(bs),e(gs),e(y),e(ds),e(ys),e(Ts),e(S)),e(i),b(x,s),b(I,s),b(B,s),b($,s),b(W,s),b(Y,s),b(E,s),b(Q,s),b(R,s),b(T,s),b(z,s)}}}const Ps='{"title":"Object detection","local":"object-detection","sections":[],"depth":1}';function qs(L){return Xs(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ta extends Ns{constructor(i){super(),Rs(this,i,qs,Ks,Es,{})}}export{ta as component};
