import{s as Ea,o as za,n as Ts}from"../chunks/scheduler.56730f09.js";import{S as Ha,i as Qa,g as h,s as o,u,A as Sa,h as f,f as t,c,j as S,v as j,y as J,k as N,o as E,a,w as d,d as b,t as g,x as w,m as Aa,n as qa}from"../chunks/index.ba464511.js";import{T as ma}from"../chunks/Tip.70442610.js";import{Y as La}from"../chunks/Youtube.7b20230c.js";import{I as ot}from"../chunks/IconCopyLink.89bde88e.js";import{C as X}from"../chunks/CodeBlock.2302fd0d.js";import{D as Pa}from"../chunks/DocNotebookDropdown.68fd8653.js";import{F as ct,M as mt}from"../chunks/Markdown.6303afae.js";function Da(x){let e,M,l='<a href="../model_doc/beit">BEiT</a>, <a href="../model_doc/bit">BiT</a>, <a href="../model_doc/convnext">ConvNeXT</a>, <a href="../model_doc/convnextv2">ConvNeXTV2</a>, <a href="../model_doc/cvt">CvT</a>, <a href="../model_doc/data2vec-vision">Data2VecVision</a>, <a href="../model_doc/deit">DeiT</a>, <a href="../model_doc/dinat">DiNAT</a>, <a href="../model_doc/efficientformer">EfficientFormer</a>, <a href="../model_doc/efficientnet">EfficientNet</a>, <a href="../model_doc/focalnet">FocalNet</a>, <a href="../model_doc/imagegpt">ImageGPT</a>, <a href="../model_doc/levit">LeViT</a>, <a href="../model_doc/mobilenet_v1">MobileNetV1</a>, <a href="../model_doc/mobilenet_v2">MobileNetV2</a>, <a href="../model_doc/mobilevit">MobileViT</a>, <a href="../model_doc/nat">NAT</a>, <a href="../model_doc/perceiver">Perceiver</a>, <a href="../model_doc/poolformer">PoolFormer</a>, <a href="../model_doc/regnet">RegNet</a>, <a href="../model_doc/resnet">ResNet</a>, <a href="../model_doc/segformer">SegFormer</a>, <a href="../model_doc/swin">Swin Transformer</a>, <a href="../model_doc/swinv2">Swin Transformer V2</a>, <a href="../model_doc/van">VAN</a>, <a href="../model_doc/vit">ViT</a>, <a href="../model_doc/vit_hybrid">ViT Hybrid</a>, <a href="../model_doc/vit_msn">ViTMSN</a>';return{c(){e=Aa(`이 튜토리얼에서 설명하는 작업은 다음 모델 아키텍처에 의해 지원됩니다:

`),M=h("p"),M.innerHTML=l},l(i){e=qa(i,`이 튜토리얼에서 설명하는 작업은 다음 모델 아키텍처에 의해 지원됩니다:

`),M=f(i,"P",{"data-svelte-h":!0}),J(M)!=="svelte-14s7zdt"&&(M.innerHTML=l)},m(i,T){a(i,e,T),a(i,M,T)},p:Ts,d(i){i&&(t(e),t(M))}}}function Ka(x){let e,M='이미지에 몇 가지 이미지 변환을 적용하여 과적합에 대해 모델을 더 견고하게 만듭니다. 여기서 Torchvision의 <a href="https://pytorch.org/vision/stable/transforms.html" rel="nofollow"><code>transforms</code></a> 모듈을 사용하지만, 원하는 이미지 라이브러리를 사용할 수도 있습니다.',l,i,T="이미지의 임의 부분을 크롭하고 크기를 조정한 다음, 이미지 평균과 표준 편차로 정규화하세요:",U,F,k,C,R="그런 다음 전처리 함수를 만들어 변환을 적용하고 이미지의 <code>pixel_values</code>(모델에 대한 입력)를 반환하세요:",Z,Y,G,v,V="전체 데이터 세트에 전처리 기능을 적용하려면 🤗 Datasets <code>with_transform</code>을 사용합니다. 데이터 세트의 요소를 가져올 때 변환이 즉시 적용됩니다:",r,_,H,W,z="이제 <code>DefaultDataCollator</code>를 사용하여 예제 배치를 만듭니다. 🤗 Transformers의 다른 데이터 콜레이터와 달리, <code>DefaultDataCollator</code>는 패딩과 같은 추가적인 전처리를 적용하지 않습니다.",p,$,Q;return F=new X({props:{code:"ZnJvbSUyMHRvcmNodmlzaW9uLnRyYW5zZm9ybXMlMjBpbXBvcnQlMjBSYW5kb21SZXNpemVkQ3JvcCUyQyUyMENvbXBvc2UlMkMlMjBOb3JtYWxpemUlMkMlMjBUb1RlbnNvciUwQSUwQW5vcm1hbGl6ZSUyMCUzRCUyME5vcm1hbGl6ZShtZWFuJTNEaW1hZ2VfcHJvY2Vzc29yLmltYWdlX21lYW4lMkMlMjBzdGQlM0RpbWFnZV9wcm9jZXNzb3IuaW1hZ2Vfc3RkKSUwQXNpemUlMjAlM0QlMjAoJTBBJTIwJTIwJTIwJTIwaW1hZ2VfcHJvY2Vzc29yLnNpemUlNUIlMjJzaG9ydGVzdF9lZGdlJTIyJTVEJTBBJTIwJTIwJTIwJTIwaWYlMjAlMjJzaG9ydGVzdF9lZGdlJTIyJTIwaW4lMjBpbWFnZV9wcm9jZXNzb3Iuc2l6ZSUwQSUyMCUyMCUyMCUyMGVsc2UlMjAoaW1hZ2VfcHJvY2Vzc29yLnNpemUlNUIlMjJoZWlnaHQlMjIlNUQlMkMlMjBpbWFnZV9wcm9jZXNzb3Iuc2l6ZSU1QiUyMndpZHRoJTIyJTVEKSUwQSklMEFfdHJhbnNmb3JtcyUyMCUzRCUyMENvbXBvc2UoJTVCUmFuZG9tUmVzaXplZENyb3Aoc2l6ZSklMkMlMjBUb1RlbnNvcigpJTJDJTIwbm9ybWFsaXplJTVEKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> torchvision.transforms <span class="hljs-keyword">import</span> RandomResizedCrop, Compose, Normalize, ToTensor

<span class="hljs-meta">&gt;&gt;&gt; </span>normalize = Normalize(mean=image_processor.image_mean, std=image_processor.image_std)
<span class="hljs-meta">&gt;&gt;&gt; </span>size = (
<span class="hljs-meta">... </span>    image_processor.size[<span class="hljs-string">&quot;shortest_edge&quot;</span>]
<span class="hljs-meta">... </span>    <span class="hljs-keyword">if</span> <span class="hljs-string">&quot;shortest_edge&quot;</span> <span class="hljs-keyword">in</span> image_processor.size
<span class="hljs-meta">... </span>    <span class="hljs-keyword">else</span> (image_processor.size[<span class="hljs-string">&quot;height&quot;</span>], image_processor.size[<span class="hljs-string">&quot;width&quot;</span>])
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>_transforms = Compose([RandomResizedCrop(size), ToTensor(), normalize])`,wrap:!1}}),Y=new X({props:{code:"ZGVmJTIwdHJhbnNmb3JtcyhleGFtcGxlcyklM0ElMEElMjAlMjAlMjAlMjBleGFtcGxlcyU1QiUyMnBpeGVsX3ZhbHVlcyUyMiU1RCUyMCUzRCUyMCU1Ql90cmFuc2Zvcm1zKGltZy5jb252ZXJ0KCUyMlJHQiUyMikpJTIwZm9yJTIwaW1nJTIwaW4lMjBleGFtcGxlcyU1QiUyMmltYWdlJTIyJTVEJTVEJTBBJTIwJTIwJTIwJTIwZGVsJTIwZXhhbXBsZXMlNUIlMjJpbWFnZSUyMiU1RCUwQSUyMCUyMCUyMCUyMHJldHVybiUyMGV4YW1wbGVz",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>    examples[<span class="hljs-string">&quot;pixel_values&quot;</span>] = [_transforms(img.convert(<span class="hljs-string">&quot;RGB&quot;</span>)) <span class="hljs-keyword">for</span> img <span class="hljs-keyword">in</span> examples[<span class="hljs-string">&quot;image&quot;</span>]]
<span class="hljs-meta">... </span>    <span class="hljs-keyword">del</span> examples[<span class="hljs-string">&quot;image&quot;</span>]
<span class="hljs-meta">... </span>    <span class="hljs-keyword">return</span> examples`,wrap:!1}}),_=new X({props:{code:"Zm9vZCUyMCUzRCUyMGZvb2Qud2l0aF90cmFuc2Zvcm0odHJhbnNmb3Jtcyk=",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>food = food.with_transform(transforms)',wrap:!1}}),$=new X({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMERlZmF1bHREYXRhQ29sbGF0b3IlMEElMEFkYXRhX2NvbGxhdG9yJTIwJTNEJTIwRGVmYXVsdERhdGFDb2xsYXRvcigp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> DefaultDataCollator

<span class="hljs-meta">&gt;&gt;&gt; </span>data_collator = DefaultDataCollator()`,wrap:!1}}),{c(){e=h("p"),e.innerHTML=M,l=o(),i=h("p"),i.textContent=T,U=o(),u(F.$$.fragment),k=o(),C=h("p"),C.innerHTML=R,Z=o(),u(Y.$$.fragment),G=o(),v=h("p"),v.innerHTML=V,r=o(),u(_.$$.fragment),H=o(),W=h("p"),W.innerHTML=z,p=o(),u($.$$.fragment)},l(y){e=f(y,"P",{"data-svelte-h":!0}),J(e)!=="svelte-1vagpvi"&&(e.innerHTML=M),l=c(y),i=f(y,"P",{"data-svelte-h":!0}),J(i)!=="svelte-10faf4m"&&(i.textContent=T),U=c(y),j(F.$$.fragment,y),k=c(y),C=f(y,"P",{"data-svelte-h":!0}),J(C)!=="svelte-1d0gj87"&&(C.innerHTML=R),Z=c(y),j(Y.$$.fragment,y),G=c(y),v=f(y,"P",{"data-svelte-h":!0}),J(v)!=="svelte-aqavc3"&&(v.innerHTML=V),r=c(y),j(_.$$.fragment,y),H=c(y),W=f(y,"P",{"data-svelte-h":!0}),J(W)!=="svelte-18366hl"&&(W.innerHTML=z),p=c(y),j($.$$.fragment,y)},m(y,B){a(y,e,B),a(y,l,B),a(y,i,B),a(y,U,B),d(F,y,B),a(y,k,B),a(y,C,B),a(y,Z,B),d(Y,y,B),a(y,G,B),a(y,v,B),a(y,r,B),d(_,y,B),a(y,H,B),a(y,W,B),a(y,p,B),d($,y,B),Q=!0},p:Ts,i(y){Q||(b(F.$$.fragment,y),b(Y.$$.fragment,y),b(_.$$.fragment,y),b($.$$.fragment,y),Q=!0)},o(y){g(F.$$.fragment,y),g(Y.$$.fragment,y),g(_.$$.fragment,y),g($.$$.fragment,y),Q=!1},d(y){y&&(t(e),t(l),t(i),t(U),t(k),t(C),t(Z),t(G),t(v),t(r),t(H),t(W),t(p)),w(F,y),w(Y,y),w(_,y),w($,y)}}}function Oa(x){let e,M;return e=new mt({props:{$$slots:{default:[Ka]},$$scope:{ctx:x}}}),{c(){u(e.$$.fragment)},l(l){j(e.$$.fragment,l)},m(l,i){d(e,l,i),M=!0},p(l,i){const T={};i&2&&(T.$$scope={dirty:i,ctx:l}),e.$set(T)},i(l){M||(b(e.$$.fragment,l),M=!0)},o(l){g(e.$$.fragment,l),M=!1},d(l){w(e,l)}}}function se(x){let e,M=`과적합을 방지하고 모델을 보다 견고하게 만들기 위해 데이터 세트의 훈련 부분에 데이터 증강을 추가합니다.
여기서 Keras 전처리 레이어로 훈련 데이터에 대한 변환(데이터 증강 포함)과
검증 데이터에 대한 변환(중앙 크로핑, 크기 조정, 정규화만)을 정의합니다.
<code>tf.image</code> 또는 다른 원하는 라이브러리를 사용할 수 있습니다.`,l,i,T,U,F="다음으로 한 번에 하나의 이미지가 아니라 이미지 배치에 적절한 변환을 적용하는 함수를 만듭니다.",k,C,R,Z,Y="🤗 Datasets <code>set_transform</code>를 사용하여 즉시 변환을 적용하세요:",G,v,V,r,_=`최종 전처리 단계로 <code>DefaultDataCollator</code>를 사용하여 예제 배치를 만듭니다. 🤗 Transformers의 다른 데이터 콜레이터와 달리
<code>DefaultDataCollator</code>는 패딩과 같은 추가 전처리를 적용하지 않습니다.`,H,W,z;return i=new X({props:{code:"ZnJvbSUyMHRlbnNvcmZsb3clMjBpbXBvcnQlMjBrZXJhcyUwQWZyb20lMjB0ZW5zb3JmbG93LmtlcmFzJTIwaW1wb3J0JTIwbGF5ZXJzJTBBJTBBc2l6ZSUyMCUzRCUyMChpbWFnZV9wcm9jZXNzb3Iuc2l6ZSU1QiUyMmhlaWdodCUyMiU1RCUyQyUyMGltYWdlX3Byb2Nlc3Nvci5zaXplJTVCJTIyd2lkdGglMjIlNUQpJTBBJTBBdHJhaW5fZGF0YV9hdWdtZW50YXRpb24lMjAlM0QlMjBrZXJhcy5TZXF1ZW50aWFsKCUwQSUyMCUyMCUyMCUyMCU1QiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGxheWVycy5SYW5kb21Dcm9wKHNpemUlNUIwJTVEJTJDJTIwc2l6ZSU1QjElNUQpJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwbGF5ZXJzLlJlc2NhbGluZyhzY2FsZSUzRDEuMCUyMCUyRiUyMDEyNy41JTJDJTIwb2Zmc2V0JTNELTEpJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwbGF5ZXJzLlJhbmRvbUZsaXAoJTIyaG9yaXpvbnRhbCUyMiklMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBsYXllcnMuUmFuZG9tUm90YXRpb24oZmFjdG9yJTNEMC4wMiklMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBsYXllcnMuUmFuZG9tWm9vbShoZWlnaHRfZmFjdG9yJTNEMC4yJTJDJTIwd2lkdGhfZmFjdG9yJTNEMC4yKSUyQyUwQSUyMCUyMCUyMCUyMCU1RCUyQyUwQSUyMCUyMCUyMCUyMG5hbWUlM0QlMjJ0cmFpbl9kYXRhX2F1Z21lbnRhdGlvbiUyMiUyQyUwQSklMEElMEF2YWxfZGF0YV9hdWdtZW50YXRpb24lMjAlM0QlMjBrZXJhcy5TZXF1ZW50aWFsKCUwQSUyMCUyMCUyMCUyMCU1QiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGxheWVycy5DZW50ZXJDcm9wKHNpemUlNUIwJTVEJTJDJTIwc2l6ZSU1QjElNUQpJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwbGF5ZXJzLlJlc2NhbGluZyhzY2FsZSUzRDEuMCUyMCUyRiUyMDEyNy41JTJDJTIwb2Zmc2V0JTNELTEpJTJDJTBBJTIwJTIwJTIwJTIwJTVEJTJDJTBBJTIwJTIwJTIwJTIwbmFtZSUzRCUyMnZhbF9kYXRhX2F1Z21lbnRhdGlvbiUyMiUyQyUwQSk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> tensorflow <span class="hljs-keyword">import</span> keras
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> tensorflow.keras <span class="hljs-keyword">import</span> layers

<span class="hljs-meta">&gt;&gt;&gt; </span>size = (image_processor.size[<span class="hljs-string">&quot;height&quot;</span>], image_processor.size[<span class="hljs-string">&quot;width&quot;</span>])

<span class="hljs-meta">&gt;&gt;&gt; </span>train_data_augmentation = keras.Sequential(
<span class="hljs-meta">... </span>    [
<span class="hljs-meta">... </span>        layers.RandomCrop(size[<span class="hljs-number">0</span>], size[<span class="hljs-number">1</span>]),
<span class="hljs-meta">... </span>        layers.Rescaling(scale=<span class="hljs-number">1.0</span> / <span class="hljs-number">127.5</span>, offset=-<span class="hljs-number">1</span>),
<span class="hljs-meta">... </span>        layers.RandomFlip(<span class="hljs-string">&quot;horizontal&quot;</span>),
<span class="hljs-meta">... </span>        layers.RandomRotation(factor=<span class="hljs-number">0.02</span>),
<span class="hljs-meta">... </span>        layers.RandomZoom(height_factor=<span class="hljs-number">0.2</span>, width_factor=<span class="hljs-number">0.2</span>),
<span class="hljs-meta">... </span>    ],
<span class="hljs-meta">... </span>    name=<span class="hljs-string">&quot;train_data_augmentation&quot;</span>,
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>val_data_augmentation = keras.Sequential(
<span class="hljs-meta">... </span>    [
<span class="hljs-meta">... </span>        layers.CenterCrop(size[<span class="hljs-number">0</span>], size[<span class="hljs-number">1</span>]),
<span class="hljs-meta">... </span>        layers.Rescaling(scale=<span class="hljs-number">1.0</span> / <span class="hljs-number">127.5</span>, offset=-<span class="hljs-number">1</span>),
<span class="hljs-meta">... </span>    ],
<span class="hljs-meta">... </span>    name=<span class="hljs-string">&quot;val_data_augmentation&quot;</span>,
<span class="hljs-meta">... </span>)`,wrap:!1}}),C=new X({props:{code:"aW1wb3J0JTIwbnVtcHklMjBhcyUyMG5wJTBBaW1wb3J0JTIwdGVuc29yZmxvdyUyMGFzJTIwdGYlMEFmcm9tJTIwUElMJTIwaW1wb3J0JTIwSW1hZ2UlMEElMEElMEFkZWYlMjBjb252ZXJ0X3RvX3RmX3RlbnNvcihpbWFnZSUzQSUyMEltYWdlKSUzQSUwQSUyMCUyMCUyMCUyMG5wX2ltYWdlJTIwJTNEJTIwbnAuYXJyYXkoaW1hZ2UpJTBBJTIwJTIwJTIwJTIwdGZfaW1hZ2UlMjAlM0QlMjB0Zi5jb252ZXJ0X3RvX3RlbnNvcihucF9pbWFnZSklMEElMjAlMjAlMjAlMjAlMjMlMjAlNjBleHBhbmRfZGltcygpJTYwJTIwaXMlMjB1c2VkJTIwdG8lMjBhZGQlMjBhJTIwYmF0Y2glMjBkaW1lbnNpb24lMjBzaW5jZSUwQSUyMCUyMCUyMCUyMCUyMyUyMHRoZSUyMFRGJTIwYXVnbWVudGF0aW9uJTIwbGF5ZXJzJTIwb3BlcmF0ZXMlMjBvbiUyMGJhdGNoZWQlMjBpbnB1dHMuJTBBJTIwJTIwJTIwJTIwcmV0dXJuJTIwdGYuZXhwYW5kX2RpbXModGZfaW1hZ2UlMkMlMjAwKSUwQSUwQSUwQWRlZiUyMHByZXByb2Nlc3NfdHJhaW4oZXhhbXBsZV9iYXRjaCklM0ElMEElMjAlMjAlMjAlMjAlMjIlMjIlMjJBcHBseSUyMHRyYWluX3RyYW5zZm9ybXMlMjBhY3Jvc3MlMjBhJTIwYmF0Y2guJTIyJTIyJTIyJTBBJTIwJTIwJTIwJTIwaW1hZ2VzJTIwJTNEJTIwJTVCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwdHJhaW5fZGF0YV9hdWdtZW50YXRpb24oY29udmVydF90b190Zl90ZW5zb3IoaW1hZ2UuY29udmVydCglMjJSR0IlMjIpKSklMjBmb3IlMjBpbWFnZSUyMGluJTIwZXhhbXBsZV9iYXRjaCU1QiUyMmltYWdlJTIyJTVEJTBBJTIwJTIwJTIwJTIwJTVEJTBBJTIwJTIwJTIwJTIwZXhhbXBsZV9iYXRjaCU1QiUyMnBpeGVsX3ZhbHVlcyUyMiU1RCUyMCUzRCUyMCU1QnRmLnRyYW5zcG9zZSh0Zi5zcXVlZXplKGltYWdlKSklMjBmb3IlMjBpbWFnZSUyMGluJTIwaW1hZ2VzJTVEJTBBJTIwJTIwJTIwJTIwcmV0dXJuJTIwZXhhbXBsZV9iYXRjaCUwQSUwQSUwQWRlZiUyMHByZXByb2Nlc3NfdmFsKGV4YW1wbGVfYmF0Y2gpJTNBJTBBJTIwJTIwJTIwJTIwJTIyJTIyJTIyQXBwbHklMjB2YWxfdHJhbnNmb3JtcyUyMGFjcm9zcyUyMGElMjBiYXRjaC4lMjIlMjIlMjIlMEElMjAlMjAlMjAlMjBpbWFnZXMlMjAlM0QlMjAlNUIlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjB2YWxfZGF0YV9hdWdtZW50YXRpb24oY29udmVydF90b190Zl90ZW5zb3IoaW1hZ2UuY29udmVydCglMjJSR0IlMjIpKSklMjBmb3IlMjBpbWFnZSUyMGluJTIwZXhhbXBsZV9iYXRjaCU1QiUyMmltYWdlJTIyJTVEJTBBJTIwJTIwJTIwJTIwJTVEJTBBJTIwJTIwJTIwJTIwZXhhbXBsZV9iYXRjaCU1QiUyMnBpeGVsX3ZhbHVlcyUyMiU1RCUyMCUzRCUyMCU1QnRmLnRyYW5zcG9zZSh0Zi5zcXVlZXplKGltYWdlKSklMjBmb3IlMjBpbWFnZSUyMGluJTIwaW1hZ2VzJTVEJTBBJTIwJTIwJTIwJTIwcmV0dXJuJTIwZXhhbXBsZV9iYXRjaA==",highlighted:`<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><span class="hljs-keyword">import</span> tensorflow <span class="hljs-keyword">as</span> tf
<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">def</span> <span class="hljs-title function_">convert_to_tf_tensor</span>(<span class="hljs-params">image: Image</span>):
<span class="hljs-meta">... </span>    np_image = np.array(image)
<span class="hljs-meta">... </span>    tf_image = tf.convert_to_tensor(np_image)
<span class="hljs-meta">... </span>    <span class="hljs-comment"># \`expand_dims()\` is used to add a batch dimension since</span>
<span class="hljs-meta">... </span>    <span class="hljs-comment"># the TF augmentation layers operates on batched inputs.</span>
<span class="hljs-meta">... </span>    <span class="hljs-keyword">return</span> tf.expand_dims(tf_image, <span class="hljs-number">0</span>)


<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">def</span> <span class="hljs-title function_">preprocess_train</span>(<span class="hljs-params">example_batch</span>):
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;&quot;&quot;Apply train_transforms across a batch.&quot;&quot;&quot;</span>
<span class="hljs-meta">... </span>    images = [
<span class="hljs-meta">... </span>        train_data_augmentation(convert_to_tf_tensor(image.convert(<span class="hljs-string">&quot;RGB&quot;</span>))) <span class="hljs-keyword">for</span> image <span class="hljs-keyword">in</span> example_batch[<span class="hljs-string">&quot;image&quot;</span>]
<span class="hljs-meta">... </span>    ]
<span class="hljs-meta">... </span>    example_batch[<span class="hljs-string">&quot;pixel_values&quot;</span>] = [tf.transpose(tf.squeeze(image)) <span class="hljs-keyword">for</span> image <span class="hljs-keyword">in</span> images]
<span class="hljs-meta">... </span>    <span class="hljs-keyword">return</span> example_batch


<span class="hljs-meta">... </span><span class="hljs-keyword">def</span> <span class="hljs-title function_">preprocess_val</span>(<span class="hljs-params">example_batch</span>):
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;&quot;&quot;Apply val_transforms across a batch.&quot;&quot;&quot;</span>
<span class="hljs-meta">... </span>    images = [
<span class="hljs-meta">... </span>        val_data_augmentation(convert_to_tf_tensor(image.convert(<span class="hljs-string">&quot;RGB&quot;</span>))) <span class="hljs-keyword">for</span> image <span class="hljs-keyword">in</span> example_batch[<span class="hljs-string">&quot;image&quot;</span>]
<span class="hljs-meta">... </span>    ]
<span class="hljs-meta">... </span>    example_batch[<span class="hljs-string">&quot;pixel_values&quot;</span>] = [tf.transpose(tf.squeeze(image)) <span class="hljs-keyword">for</span> image <span class="hljs-keyword">in</span> images]
<span class="hljs-meta">... </span>    <span class="hljs-keyword">return</span> example_batch`,wrap:!1}}),v=new X({props:{code:"Zm9vZCU1QiUyMnRyYWluJTIyJTVELnNldF90cmFuc2Zvcm0ocHJlcHJvY2Vzc190cmFpbiklMEFmb29kJTVCJTIydGVzdCUyMiU1RC5zZXRfdHJhbnNmb3JtKHByZXByb2Nlc3NfdmFsKQ==",highlighted:`food[<span class="hljs-string">&quot;train&quot;</span>].set_transform(preprocess_train)
food[<span class="hljs-string">&quot;test&quot;</span>].set_transform(preprocess_val)`,wrap:!1}}),W=new X({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMERlZmF1bHREYXRhQ29sbGF0b3IlMEElMEFkYXRhX2NvbGxhdG9yJTIwJTNEJTIwRGVmYXVsdERhdGFDb2xsYXRvcihyZXR1cm5fdGVuc29ycyUzRCUyMnRmJTIyKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> DefaultDataCollator

<span class="hljs-meta">&gt;&gt;&gt; </span>data_collator = DefaultDataCollator(return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)`,wrap:!1}}),{c(){e=h("p"),e.innerHTML=M,l=o(),u(i.$$.fragment),T=o(),U=h("p"),U.textContent=F,k=o(),u(C.$$.fragment),R=o(),Z=h("p"),Z.innerHTML=Y,G=o(),u(v.$$.fragment),V=o(),r=h("p"),r.innerHTML=_,H=o(),u(W.$$.fragment)},l(p){e=f(p,"P",{"data-svelte-h":!0}),J(e)!=="svelte-184q600"&&(e.innerHTML=M),l=c(p),j(i.$$.fragment,p),T=c(p),U=f(p,"P",{"data-svelte-h":!0}),J(U)!=="svelte-gi5xdk"&&(U.textContent=F),k=c(p),j(C.$$.fragment,p),R=c(p),Z=f(p,"P",{"data-svelte-h":!0}),J(Z)!=="svelte-1yygzze"&&(Z.innerHTML=Y),G=c(p),j(v.$$.fragment,p),V=c(p),r=f(p,"P",{"data-svelte-h":!0}),J(r)!=="svelte-1cqrr7b"&&(r.innerHTML=_),H=c(p),j(W.$$.fragment,p)},m(p,$){a(p,e,$),a(p,l,$),d(i,p,$),a(p,T,$),a(p,U,$),a(p,k,$),d(C,p,$),a(p,R,$),a(p,Z,$),a(p,G,$),d(v,p,$),a(p,V,$),a(p,r,$),a(p,H,$),d(W,p,$),z=!0},p:Ts,i(p){z||(b(i.$$.fragment,p),b(C.$$.fragment,p),b(v.$$.fragment,p),b(W.$$.fragment,p),z=!0)},o(p){g(i.$$.fragment,p),g(C.$$.fragment,p),g(v.$$.fragment,p),g(W.$$.fragment,p),z=!1},d(p){p&&(t(e),t(l),t(T),t(U),t(k),t(R),t(Z),t(G),t(V),t(r),t(H)),w(i,p),w(C,p),w(v,p),w(W,p)}}}function te(x){let e,M;return e=new mt({props:{$$slots:{default:[se]},$$scope:{ctx:x}}}),{c(){u(e.$$.fragment)},l(l){j(e.$$.fragment,l)},m(l,i){d(e,l,i),M=!0},p(l,i){const T={};i&2&&(T.$$scope={dirty:i,ctx:l}),e.$set(T)},i(l){M||(b(e.$$.fragment,l),M=!0)},o(l){g(e.$$.fragment,l),M=!1},d(l){w(e,l)}}}function ae(x){let e,M='<code>Trainer</code>를 사용하여 모델을 미세 조정하는 방법에 익숙하지 않은 경우, <a href="../training#train-with-pytorch-trainer">여기</a>에서 기본 튜토리얼을 확인하세요!';return{c(){e=h("p"),e.innerHTML=M},l(l){e=f(l,"P",{"data-svelte-h":!0}),J(e)!=="svelte-16aei3v"&&(e.innerHTML=M)},m(l,i){a(l,e,i)},p:Ts,d(l){l&&t(e)}}}function ee(x){let e,M,l,i="이제 모델을 훈련시킬 준비가 되었습니다! <code>AutoModelForImageClassification</code>로 ViT를 가져옵니다. 예상되는 레이블 수, 레이블 매핑 및 레이블 수를 지정하세요:",T,U,F,k,C="이제 세 단계만 거치면 끝입니다:",R,Z,Y="<li><code>TrainingArguments</code>에서 훈련 하이퍼파라미터를 정의하세요. <code>image</code> 열이 삭제되기 때문에 미사용 열을 제거하지 않는 것이 중요합니다. <code>image</code> 열이 없으면 <code>pixel_values</code>을 생성할 수 없습니다. 이 동작을 방지하려면 <code>remove_unused_columns=False</code>로 설정하세요! 다른 유일한 필수 매개변수는 모델 저장 위치를 지정하는 <code>output_dir</code>입니다. <code>push_to_hub=True</code>로 설정하면 이 모델을 허브에 푸시합니다(모델을 업로드하려면 Hugging Face에 로그인해야 합니다). 각 에폭이 끝날 때마다, <code>Trainer</code>가 정확도를 평가하고 훈련 체크포인트를 저장합니다.</li> <li><code>Trainer</code>에 모델, 데이터 세트, 토크나이저, 데이터 콜레이터 및 <code>compute_metrics</code> 함수와 함께 훈련 인수를 전달하세요.</li> <li><code>train()</code>을 호출하여 모델을 미세 조정하세요.</li>",G,v,V,r,_="훈련이 완료되면, 모든 사람이 모델을 사용할 수 있도록 <code>push_to_hub()</code> 메소드로 모델을 허브에 공유하세요:",H,W,z;return e=new ma({props:{$$slots:{default:[ae]},$$scope:{ctx:x}}}),U=new X({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckltYWdlQ2xhc3NpZmljYXRpb24lMkMlMjBUcmFpbmluZ0FyZ3VtZW50cyUyQyUyMFRyYWluZXIlMEElMEFtb2RlbCUyMCUzRCUyMEF1dG9Nb2RlbEZvckltYWdlQ2xhc3NpZmljYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMGNoZWNrcG9pbnQlMkMlMEElMjAlMjAlMjAlMjBudW1fbGFiZWxzJTNEbGVuKGxhYmVscyklMkMlMEElMjAlMjAlMjAlMjBpZDJsYWJlbCUzRGlkMmxhYmVsJTJDJTBBJTIwJTIwJTIwJTIwbGFiZWwyaWQlM0RsYWJlbDJpZCUyQyUwQSk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForImageClassification, TrainingArguments, Trainer

<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForImageClassification.from_pretrained(
<span class="hljs-meta">... </span>    checkpoint,
<span class="hljs-meta">... </span>    num_labels=<span class="hljs-built_in">len</span>(labels),
<span class="hljs-meta">... </span>    id2label=id2label,
<span class="hljs-meta">... </span>    label2id=label2id,
<span class="hljs-meta">... </span>)`,wrap:!1}}),v=new X({props:{code:"dHJhaW5pbmdfYXJncyUyMCUzRCUyMFRyYWluaW5nQXJndW1lbnRzKCUwQSUyMCUyMCUyMCUyMG91dHB1dF9kaXIlM0QlMjJteV9hd2Vzb21lX2Zvb2RfbW9kZWwlMjIlMkMlMEElMjAlMjAlMjAlMjByZW1vdmVfdW51c2VkX2NvbHVtbnMlM0RGYWxzZSUyQyUwQSUyMCUyMCUyMCUyMGV2YWx1YXRpb25fc3RyYXRlZ3klM0QlMjJlcG9jaCUyMiUyQyUwQSUyMCUyMCUyMCUyMHNhdmVfc3RyYXRlZ3klM0QlMjJlcG9jaCUyMiUyQyUwQSUyMCUyMCUyMCUyMGxlYXJuaW5nX3JhdGUlM0Q1ZS01JTJDJTBBJTIwJTIwJTIwJTIwcGVyX2RldmljZV90cmFpbl9iYXRjaF9zaXplJTNEMTYlMkMlMEElMjAlMjAlMjAlMjBncmFkaWVudF9hY2N1bXVsYXRpb25fc3RlcHMlM0Q0JTJDJTBBJTIwJTIwJTIwJTIwcGVyX2RldmljZV9ldmFsX2JhdGNoX3NpemUlM0QxNiUyQyUwQSUyMCUyMCUyMCUyMG51bV90cmFpbl9lcG9jaHMlM0QzJTJDJTBBJTIwJTIwJTIwJTIwd2FybXVwX3JhdGlvJTNEMC4xJTJDJTBBJTIwJTIwJTIwJTIwbG9nZ2luZ19zdGVwcyUzRDEwJTJDJTBBJTIwJTIwJTIwJTIwbG9hZF9iZXN0X21vZGVsX2F0X2VuZCUzRFRydWUlMkMlMEElMjAlMjAlMjAlMjBtZXRyaWNfZm9yX2Jlc3RfbW9kZWwlM0QlMjJhY2N1cmFjeSUyMiUyQyUwQSUyMCUyMCUyMCUyMHB1c2hfdG9faHViJTNEVHJ1ZSUyQyUwQSklMEElMEF0cmFpbmVyJTIwJTNEJTIwVHJhaW5lciglMEElMjAlMjAlMjAlMjBtb2RlbCUzRG1vZGVsJTJDJTBBJTIwJTIwJTIwJTIwYXJncyUzRHRyYWluaW5nX2FyZ3MlMkMlMEElMjAlMjAlMjAlMjBkYXRhX2NvbGxhdG9yJTNEZGF0YV9jb2xsYXRvciUyQyUwQSUyMCUyMCUyMCUyMHRyYWluX2RhdGFzZXQlM0Rmb29kJTVCJTIydHJhaW4lMjIlNUQlMkMlMEElMjAlMjAlMjAlMjBldmFsX2RhdGFzZXQlM0Rmb29kJTVCJTIydGVzdCUyMiU1RCUyQyUwQSUyMCUyMCUyMCUyMHRva2VuaXplciUzRGltYWdlX3Byb2Nlc3NvciUyQyUwQSUyMCUyMCUyMCUyMGNvbXB1dGVfbWV0cmljcyUzRGNvbXB1dGVfbWV0cmljcyUyQyUwQSklMEElMEF0cmFpbmVyLnRyYWluKCk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>training_args = TrainingArguments(
<span class="hljs-meta">... </span>    output_dir=<span class="hljs-string">&quot;my_awesome_food_model&quot;</span>,
<span class="hljs-meta">... </span>    remove_unused_columns=<span class="hljs-literal">False</span>,
<span class="hljs-meta">... </span>    evaluation_strategy=<span class="hljs-string">&quot;epoch&quot;</span>,
<span class="hljs-meta">... </span>    save_strategy=<span class="hljs-string">&quot;epoch&quot;</span>,
<span class="hljs-meta">... </span>    learning_rate=<span class="hljs-number">5e-5</span>,
<span class="hljs-meta">... </span>    per_device_train_batch_size=<span class="hljs-number">16</span>,
<span class="hljs-meta">... </span>    gradient_accumulation_steps=<span class="hljs-number">4</span>,
<span class="hljs-meta">... </span>    per_device_eval_batch_size=<span class="hljs-number">16</span>,
<span class="hljs-meta">... </span>    num_train_epochs=<span class="hljs-number">3</span>,
<span class="hljs-meta">... </span>    warmup_ratio=<span class="hljs-number">0.1</span>,
<span class="hljs-meta">... </span>    logging_steps=<span class="hljs-number">10</span>,
<span class="hljs-meta">... </span>    load_best_model_at_end=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>    metric_for_best_model=<span class="hljs-string">&quot;accuracy&quot;</span>,
<span class="hljs-meta">... </span>    push_to_hub=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>trainer = Trainer(
<span class="hljs-meta">... </span>    model=model,
<span class="hljs-meta">... </span>    args=training_args,
<span class="hljs-meta">... </span>    data_collator=data_collator,
<span class="hljs-meta">... </span>    train_dataset=food[<span class="hljs-string">&quot;train&quot;</span>],
<span class="hljs-meta">... </span>    eval_dataset=food[<span class="hljs-string">&quot;test&quot;</span>],
<span class="hljs-meta">... </span>    tokenizer=image_processor,
<span class="hljs-meta">... </span>    compute_metrics=compute_metrics,
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>trainer.train()`,wrap:!1}}),W=new X({props:{code:"dHJhaW5lci5wdXNoX3RvX2h1Yigp",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>trainer.push_to_hub()',wrap:!1}}),{c(){u(e.$$.fragment),M=o(),l=h("p"),l.innerHTML=i,T=o(),u(U.$$.fragment),F=o(),k=h("p"),k.textContent=C,R=o(),Z=h("ol"),Z.innerHTML=Y,G=o(),u(v.$$.fragment),V=o(),r=h("p"),r.innerHTML=_,H=o(),u(W.$$.fragment)},l(p){j(e.$$.fragment,p),M=c(p),l=f(p,"P",{"data-svelte-h":!0}),J(l)!=="svelte-uzdbrl"&&(l.innerHTML=i),T=c(p),j(U.$$.fragment,p),F=c(p),k=f(p,"P",{"data-svelte-h":!0}),J(k)!=="svelte-14zzcxs"&&(k.textContent=C),R=c(p),Z=f(p,"OL",{"data-svelte-h":!0}),J(Z)!=="svelte-ciflwy"&&(Z.innerHTML=Y),G=c(p),j(v.$$.fragment,p),V=c(p),r=f(p,"P",{"data-svelte-h":!0}),J(r)!=="svelte-16dqz6f"&&(r.innerHTML=_),H=c(p),j(W.$$.fragment,p)},m(p,$){d(e,p,$),a(p,M,$),a(p,l,$),a(p,T,$),d(U,p,$),a(p,F,$),a(p,k,$),a(p,R,$),a(p,Z,$),a(p,G,$),d(v,p,$),a(p,V,$),a(p,r,$),a(p,H,$),d(W,p,$),z=!0},p(p,$){const Q={};$&2&&(Q.$$scope={dirty:$,ctx:p}),e.$set(Q)},i(p){z||(b(e.$$.fragment,p),b(U.$$.fragment,p),b(v.$$.fragment,p),b(W.$$.fragment,p),z=!0)},o(p){g(e.$$.fragment,p),g(U.$$.fragment,p),g(v.$$.fragment,p),g(W.$$.fragment,p),z=!1},d(p){p&&(t(M),t(l),t(T),t(F),t(k),t(R),t(Z),t(G),t(V),t(r),t(H)),w(e,p),w(U,p),w(v,p),w(W,p)}}}function le(x){let e,M;return e=new mt({props:{$$slots:{default:[ee]},$$scope:{ctx:x}}}),{c(){u(e.$$.fragment)},l(l){j(e.$$.fragment,l)},m(l,i){d(e,l,i),M=!0},p(l,i){const T={};i&2&&(T.$$scope={dirty:i,ctx:l}),e.$set(T)},i(l){M||(b(e.$$.fragment,l),M=!0)},o(l){g(e.$$.fragment,l),M=!1},d(l){w(e,l)}}}function ne(x){let e,M='Keras를 사용하여 모델을 미세 조정하는 방법에 익숙하지 않은 경우, 먼저 <a href="./training#train-a-tensorflow-model-with-keras">기본 튜토리얼</a>을 확인하세요!';return{c(){e=h("p"),e.innerHTML=M},l(l){e=f(l,"P",{"data-svelte-h":!0}),J(e)!=="svelte-qz0oqm"&&(e.innerHTML=M)},m(l,i){a(l,e,i)},p:Ts,d(l){l&&t(e)}}}function pe(x){let e,M,l,i="TensorFlow에서 모델을 미세 조정하려면 다음 단계를 따르세요:",T,U,F="<li>훈련 하이퍼파라미터를 정의하고 옵티마이저와 학습률 스케쥴을 설정합니다.</li> <li>사전 훈련된 모델을 인스턴스화합니다.</li> <li>🤗 Dataset을 <code>tf.data.Dataset</code>으로 변환합니다.</li> <li>모델을 컴파일합니다.</li> <li>콜백을 추가하고 훈련을 수행하기 위해 <code>fit()</code> 메소드를 사용합니다.</li> <li>커뮤니티와 공유하기 위해 모델을 🤗 Hub에 업로드합니다.</li>",k,C,R="하이퍼파라미터, 옵티마이저 및 학습률 스케쥴을 정의하는 것으로 시작합니다:",Z,Y,G,v,V="그런 다음 레이블 매핑과 함께 <code>TFAuto ModelForImageClassification</code>으로 ViT를 가져옵니다:",r,_,H,W,z="데이터 세트를 <code>to_tf_dataset</code>와 <code>data_collator</code>를 사용하여 <code>tf.data.Dataset</code> 형식으로 변환하세요:",p,$,Q,y,B="<code>compile()</code>를 사용하여 훈련 모델을 구성하세요:",L,P,D,ls,$s=`예측에서 정확도를 계산하고 모델을 🤗 Hub로 푸시하려면 <a href="../main_classes/keras_callbacks">Keras callbacks</a>를 사용하세요.
<code>compute_metrics</code> 함수를 <a href="../main_classes/keras_callbacks#transformers.KerasMetricCallback">KerasMetricCallback</a>에 전달하고,
<a href="../main_classes/keras_callbacks#transformers.PushToHubCallback">PushToHubCallback</a>을 사용하여 모델을 업로드합니다:`,K,O,ss,ns,Us=`이제 모델을 훈련할 준비가 되었습니다! 훈련 및 검증 데이터 세트, 에폭 수와 함께 <code>fit()</code>을 호출하고,
콜백을 사용하여 모델을 미세 조정합니다:`,ts,as,q,A,ms="축하합니다! 모델을 미세 조정하고 🤗 Hub에 공유했습니다. 이제 추론에 사용할 수 있습니다!",es;return e=new ma({props:{$$slots:{default:[ne]},$$scope:{ctx:x}}}),Y=new X({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMGNyZWF0ZV9vcHRpbWl6ZXIlMEElMEFiYXRjaF9zaXplJTIwJTNEJTIwMTYlMEFudW1fZXBvY2hzJTIwJTNEJTIwNSUwQW51bV90cmFpbl9zdGVwcyUyMCUzRCUyMGxlbihmb29kJTVCJTIydHJhaW4lMjIlNUQpJTIwKiUyMG51bV9lcG9jaHMlMEFsZWFybmluZ19yYXRlJTIwJTNEJTIwM2UtNSUwQXdlaWdodF9kZWNheV9yYXRlJTIwJTNEJTIwMC4wMSUwQSUwQW9wdGltaXplciUyQyUyMGxyX3NjaGVkdWxlJTIwJTNEJTIwY3JlYXRlX29wdGltaXplciglMEElMjAlMjAlMjAlMjBpbml0X2xyJTNEbGVhcm5pbmdfcmF0ZSUyQyUwQSUyMCUyMCUyMCUyMG51bV90cmFpbl9zdGVwcyUzRG51bV90cmFpbl9zdGVwcyUyQyUwQSUyMCUyMCUyMCUyMHdlaWdodF9kZWNheV9yYXRlJTNEd2VpZ2h0X2RlY2F5X3JhdGUlMkMlMEElMjAlMjAlMjAlMjBudW1fd2FybXVwX3N0ZXBzJTNEMCUyQyUwQSk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> create_optimizer

<span class="hljs-meta">&gt;&gt;&gt; </span>batch_size = <span class="hljs-number">16</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>num_epochs = <span class="hljs-number">5</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>num_train_steps = <span class="hljs-built_in">len</span>(food[<span class="hljs-string">&quot;train&quot;</span>]) * num_epochs
<span class="hljs-meta">&gt;&gt;&gt; </span>learning_rate = <span class="hljs-number">3e-5</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>weight_decay_rate = <span class="hljs-number">0.01</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>optimizer, lr_schedule = create_optimizer(
<span class="hljs-meta">... </span>    init_lr=learning_rate,
<span class="hljs-meta">... </span>    num_train_steps=num_train_steps,
<span class="hljs-meta">... </span>    weight_decay_rate=weight_decay_rate,
<span class="hljs-meta">... </span>    num_warmup_steps=<span class="hljs-number">0</span>,
<span class="hljs-meta">... </span>)`,wrap:!1}}),_=new X({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRGQXV0b01vZGVsRm9ySW1hZ2VDbGFzc2lmaWNhdGlvbiUwQSUwQW1vZGVsJTIwJTNEJTIwVEZBdXRvTW9kZWxGb3JJbWFnZUNsYXNzaWZpY2F0aW9uLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjBjaGVja3BvaW50JTJDJTBBJTIwJTIwJTIwJTIwaWQybGFiZWwlM0RpZDJsYWJlbCUyQyUwQSUyMCUyMCUyMCUyMGxhYmVsMmlkJTNEbGFiZWwyaWQlMkMlMEEp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TFAutoModelForImageClassification

<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFAutoModelForImageClassification.from_pretrained(
<span class="hljs-meta">... </span>    checkpoint,
<span class="hljs-meta">... </span>    id2label=id2label,
<span class="hljs-meta">... </span>    label2id=label2id,
<span class="hljs-meta">... </span>)`,wrap:!1}}),$=new X({props:{code:"JTIzJTIwY29udmVydGluZyUyMG91ciUyMHRyYWluJTIwZGF0YXNldCUyMHRvJTIwdGYuZGF0YS5EYXRhc2V0JTBBdGZfdHJhaW5fZGF0YXNldCUyMCUzRCUyMGZvb2QlNUIlMjJ0cmFpbiUyMiU1RC50b190Zl9kYXRhc2V0KCUwQSUyMCUyMCUyMCUyMGNvbHVtbnMlM0QlMjJwaXhlbF92YWx1ZXMlMjIlMkMlMjBsYWJlbF9jb2xzJTNEJTIybGFiZWwlMjIlMkMlMjBzaHVmZmxlJTNEVHJ1ZSUyQyUyMGJhdGNoX3NpemUlM0RiYXRjaF9zaXplJTJDJTIwY29sbGF0ZV9mbiUzRGRhdGFfY29sbGF0b3IlMEEpJTBBJTBBJTIzJTIwY29udmVydGluZyUyMG91ciUyMHRlc3QlMjBkYXRhc2V0JTIwdG8lMjB0Zi5kYXRhLkRhdGFzZXQlMEF0Zl9ldmFsX2RhdGFzZXQlMjAlM0QlMjBmb29kJTVCJTIydGVzdCUyMiU1RC50b190Zl9kYXRhc2V0KCUwQSUyMCUyMCUyMCUyMGNvbHVtbnMlM0QlMjJwaXhlbF92YWx1ZXMlMjIlMkMlMjBsYWJlbF9jb2xzJTNEJTIybGFiZWwlMjIlMkMlMjBzaHVmZmxlJTNEVHJ1ZSUyQyUyMGJhdGNoX3NpemUlM0RiYXRjaF9zaXplJTJDJTIwY29sbGF0ZV9mbiUzRGRhdGFfY29sbGF0b3IlMEEp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># converting our train dataset to tf.data.Dataset</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>tf_train_dataset = food[<span class="hljs-string">&quot;train&quot;</span>].to_tf_dataset(
<span class="hljs-meta">... </span>    columns=<span class="hljs-string">&quot;pixel_values&quot;</span>, label_cols=<span class="hljs-string">&quot;label&quot;</span>, shuffle=<span class="hljs-literal">True</span>, batch_size=batch_size, collate_fn=data_collator
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># converting our test dataset to tf.data.Dataset</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>tf_eval_dataset = food[<span class="hljs-string">&quot;test&quot;</span>].to_tf_dataset(
<span class="hljs-meta">... </span>    columns=<span class="hljs-string">&quot;pixel_values&quot;</span>, label_cols=<span class="hljs-string">&quot;label&quot;</span>, shuffle=<span class="hljs-literal">True</span>, batch_size=batch_size, collate_fn=data_collator
<span class="hljs-meta">... </span>)`,wrap:!1}}),P=new X({props:{code:"ZnJvbSUyMHRlbnNvcmZsb3cua2VyYXMubG9zc2VzJTIwaW1wb3J0JTIwU3BhcnNlQ2F0ZWdvcmljYWxDcm9zc2VudHJvcHklMEElMEFsb3NzJTIwJTNEJTIwdGYua2VyYXMubG9zc2VzLlNwYXJzZUNhdGVnb3JpY2FsQ3Jvc3NlbnRyb3B5KGZyb21fbG9naXRzJTNEVHJ1ZSklMEFtb2RlbC5jb21waWxlKG9wdGltaXplciUzRG9wdGltaXplciUyQyUyMGxvc3MlM0Rsb3NzKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> tensorflow.keras.losses <span class="hljs-keyword">import</span> SparseCategoricalCrossentropy

<span class="hljs-meta">&gt;&gt;&gt; </span>loss = tf.keras.losses.SparseCategoricalCrossentropy(from_logits=<span class="hljs-literal">True</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model.<span class="hljs-built_in">compile</span>(optimizer=optimizer, loss=loss)`,wrap:!1}}),O=new X({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycy5rZXJhc19jYWxsYmFja3MlMjBpbXBvcnQlMjBLZXJhc01ldHJpY0NhbGxiYWNrJTJDJTIwUHVzaFRvSHViQ2FsbGJhY2slMEElMEFtZXRyaWNfY2FsbGJhY2slMjAlM0QlMjBLZXJhc01ldHJpY0NhbGxiYWNrKG1ldHJpY19mbiUzRGNvbXB1dGVfbWV0cmljcyUyQyUyMGV2YWxfZGF0YXNldCUzRHRmX2V2YWxfZGF0YXNldCklMEFwdXNoX3RvX2h1Yl9jYWxsYmFjayUyMCUzRCUyMFB1c2hUb0h1YkNhbGxiYWNrKCUwQSUyMCUyMCUyMCUyMG91dHB1dF9kaXIlM0QlMjJmb29kX2NsYXNzaWZpZXIlMjIlMkMlMEElMjAlMjAlMjAlMjB0b2tlbml6ZXIlM0RpbWFnZV9wcm9jZXNzb3IlMkMlMEElMjAlMjAlMjAlMjBzYXZlX3N0cmF0ZWd5JTNEJTIybm8lMjIlMkMlMEEpJTBBY2FsbGJhY2tzJTIwJTNEJTIwJTVCbWV0cmljX2NhbGxiYWNrJTJDJTIwcHVzaF90b19odWJfY2FsbGJhY2slNUQ=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers.keras_callbacks <span class="hljs-keyword">import</span> KerasMetricCallback, PushToHubCallback

<span class="hljs-meta">&gt;&gt;&gt; </span>metric_callback = KerasMetricCallback(metric_fn=compute_metrics, eval_dataset=tf_eval_dataset)
<span class="hljs-meta">&gt;&gt;&gt; </span>push_to_hub_callback = PushToHubCallback(
<span class="hljs-meta">... </span>    output_dir=<span class="hljs-string">&quot;food_classifier&quot;</span>,
<span class="hljs-meta">... </span>    tokenizer=image_processor,
<span class="hljs-meta">... </span>    save_strategy=<span class="hljs-string">&quot;no&quot;</span>,
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>callbacks = [metric_callback, push_to_hub_callback]`,wrap:!1}}),as=new X({props:{code:"bW9kZWwuZml0KHRmX3RyYWluX2RhdGFzZXQlMkMlMjB2YWxpZGF0aW9uX2RhdGElM0R0Zl9ldmFsX2RhdGFzZXQlMkMlMjBlcG9jaHMlM0RudW1fZXBvY2hzJTJDJTIwY2FsbGJhY2tzJTNEY2FsbGJhY2tzKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>model.fit(tf_train_dataset, validation_data=tf_eval_dataset, epochs=num_epochs, callbacks=callbacks)
Epoch <span class="hljs-number">1</span>/<span class="hljs-number">5</span>
<span class="hljs-number">250</span>/<span class="hljs-number">250</span> [==============================] - 313s 1s/step - loss: <span class="hljs-number">2.5623</span> - val_loss: <span class="hljs-number">1.4161</span> - accuracy: <span class="hljs-number">0.9290</span>
Epoch <span class="hljs-number">2</span>/<span class="hljs-number">5</span>
<span class="hljs-number">250</span>/<span class="hljs-number">250</span> [==============================] - 265s 1s/step - loss: <span class="hljs-number">0.9181</span> - val_loss: <span class="hljs-number">0.6808</span> - accuracy: <span class="hljs-number">0.9690</span>
Epoch <span class="hljs-number">3</span>/<span class="hljs-number">5</span>
<span class="hljs-number">250</span>/<span class="hljs-number">250</span> [==============================] - 252s 1s/step - loss: <span class="hljs-number">0.3910</span> - val_loss: <span class="hljs-number">0.4303</span> - accuracy: <span class="hljs-number">0.9820</span>
Epoch <span class="hljs-number">4</span>/<span class="hljs-number">5</span>
<span class="hljs-number">250</span>/<span class="hljs-number">250</span> [==============================] - 251s 1s/step - loss: <span class="hljs-number">0.2028</span> - val_loss: <span class="hljs-number">0.3191</span> - accuracy: <span class="hljs-number">0.9900</span>
Epoch <span class="hljs-number">5</span>/<span class="hljs-number">5</span>
<span class="hljs-number">250</span>/<span class="hljs-number">250</span> [==============================] - 238s 949ms/step - loss: <span class="hljs-number">0.1232</span> - val_loss: <span class="hljs-number">0.3259</span> - accuracy: <span class="hljs-number">0.9890</span>`,wrap:!1}}),{c(){u(e.$$.fragment),M=o(),l=h("p"),l.textContent=i,T=o(),U=h("ol"),U.innerHTML=F,k=o(),C=h("p"),C.textContent=R,Z=o(),u(Y.$$.fragment),G=o(),v=h("p"),v.innerHTML=V,r=o(),u(_.$$.fragment),H=o(),W=h("p"),W.innerHTML=z,p=o(),u($.$$.fragment),Q=o(),y=h("p"),y.innerHTML=B,L=o(),u(P.$$.fragment),D=o(),ls=h("p"),ls.innerHTML=$s,K=o(),u(O.$$.fragment),ss=o(),ns=h("p"),ns.innerHTML=Us,ts=o(),u(as.$$.fragment),q=o(),A=h("p"),A.textContent=ms},l(m){j(e.$$.fragment,m),M=c(m),l=f(m,"P",{"data-svelte-h":!0}),J(l)!=="svelte-um2evk"&&(l.textContent=i),T=c(m),U=f(m,"OL",{"data-svelte-h":!0}),J(U)!=="svelte-4o84bf"&&(U.innerHTML=F),k=c(m),C=f(m,"P",{"data-svelte-h":!0}),J(C)!=="svelte-17oxi9w"&&(C.textContent=R),Z=c(m),j(Y.$$.fragment,m),G=c(m),v=f(m,"P",{"data-svelte-h":!0}),J(v)!=="svelte-1s8k4gq"&&(v.innerHTML=V),r=c(m),j(_.$$.fragment,m),H=c(m),W=f(m,"P",{"data-svelte-h":!0}),J(W)!=="svelte-f9923k"&&(W.innerHTML=z),p=c(m),j($.$$.fragment,m),Q=c(m),y=f(m,"P",{"data-svelte-h":!0}),J(y)!=="svelte-18yjhtp"&&(y.innerHTML=B),L=c(m),j(P.$$.fragment,m),D=c(m),ls=f(m,"P",{"data-svelte-h":!0}),J(ls)!=="svelte-g7d2ol"&&(ls.innerHTML=$s),K=c(m),j(O.$$.fragment,m),ss=c(m),ns=f(m,"P",{"data-svelte-h":!0}),J(ns)!=="svelte-uh3niq"&&(ns.innerHTML=Us),ts=c(m),j(as.$$.fragment,m),q=c(m),A=f(m,"P",{"data-svelte-h":!0}),J(A)!=="svelte-1trgvwr"&&(A.textContent=ms)},m(m,I){d(e,m,I),a(m,M,I),a(m,l,I),a(m,T,I),a(m,U,I),a(m,k,I),a(m,C,I),a(m,Z,I),d(Y,m,I),a(m,G,I),a(m,v,I),a(m,r,I),d(_,m,I),a(m,H,I),a(m,W,I),a(m,p,I),d($,m,I),a(m,Q,I),a(m,y,I),a(m,L,I),d(P,m,I),a(m,D,I),a(m,ls,I),a(m,K,I),d(O,m,I),a(m,ss,I),a(m,ns,I),a(m,ts,I),d(as,m,I),a(m,q,I),a(m,A,I),es=!0},p(m,I){const it={};I&2&&(it.$$scope={dirty:I,ctx:m}),e.$set(it)},i(m){es||(b(e.$$.fragment,m),b(Y.$$.fragment,m),b(_.$$.fragment,m),b($.$$.fragment,m),b(P.$$.fragment,m),b(O.$$.fragment,m),b(as.$$.fragment,m),es=!0)},o(m){g(e.$$.fragment,m),g(Y.$$.fragment,m),g(_.$$.fragment,m),g($.$$.fragment,m),g(P.$$.fragment,m),g(O.$$.fragment,m),g(as.$$.fragment,m),es=!1},d(m){m&&(t(M),t(l),t(T),t(U),t(k),t(C),t(Z),t(G),t(v),t(r),t(H),t(W),t(p),t(Q),t(y),t(L),t(D),t(ls),t(K),t(ss),t(ns),t(ts),t(q),t(A)),w(e,m),w(Y,m),w(_,m),w($,m),w(P,m),w(O,m),w(as,m)}}}function re(x){let e,M;return e=new mt({props:{$$slots:{default:[pe]},$$scope:{ctx:x}}}),{c(){u(e.$$.fragment)},l(l){j(e.$$.fragment,l)},m(l,i){d(e,l,i),M=!0},p(l,i){const T={};i&2&&(T.$$scope={dirty:i,ctx:l}),e.$set(T)},i(l){M||(b(e.$$.fragment,l),M=!0)},o(l){g(e.$$.fragment,l),M=!1},d(l){w(e,l)}}}function oe(x){let e,M='이미지 분류를 위한 모델을 미세 조정하는 자세한 예제는 다음 <a href="https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/image_classification.ipynb" rel="nofollow">PyTorch notebook</a>을 참조하세요.';return{c(){e=h("p"),e.innerHTML=M},l(l){e=f(l,"P",{"data-svelte-h":!0}),J(e)!=="svelte-16trkry"&&(e.innerHTML=M)},m(l,i){a(l,e,i)},p:Ts,d(l){l&&t(e)}}}function ce(x){let e,M="이미지를 전처리하기 위해 이미지 프로세서를 가져오고 <code>input</code>을 PyTorch 텐서로 반환합니다:",l,i,T,U,F="입력을 모델에 전달하고 logits을 반환합니다:",k,C,R,Z,Y="확률이 가장 높은 예측 레이블을 가져오고, 모델의 <code>id2label</code> 매핑을 사용하여 레이블로 변환합니다:",G,v,V;return i=new X({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUwQWltcG9ydCUyMHRvcmNoJTBBJTBBaW1hZ2VfcHJvY2Vzc29yJTIwJTNEJTIwQXV0b0ltYWdlUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJteV9hd2Vzb21lX2Zvb2RfbW9kZWwlMjIpJTBBaW5wdXRzJTIwJTNEJTIwaW1hZ2VfcHJvY2Vzc29yKGltYWdlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMik=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span>image_processor = AutoImageProcessor.from_pretrained(<span class="hljs-string">&quot;my_awesome_food_model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = image_processor(image, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)`,wrap:!1}}),C=new X({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckltYWdlQ2xhc3NpZmljYXRpb24lMEElMEFtb2RlbCUyMCUzRCUyMEF1dG9Nb2RlbEZvckltYWdlQ2xhc3NpZmljYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUyMm15X2F3ZXNvbWVfZm9vZF9tb2RlbCUyMiklMEF3aXRoJTIwdG9yY2gubm9fZ3JhZCgpJTNBJTBBJTIwJTIwJTIwJTIwbG9naXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpLmxvZ2l0cw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForImageClassification

<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForImageClassification.from_pretrained(<span class="hljs-string">&quot;my_awesome_food_model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">with</span> torch.no_grad():
<span class="hljs-meta">... </span>    logits = model(**inputs).logits`,wrap:!1}}),v=new X({props:{code:"cHJlZGljdGVkX2xhYmVsJTIwJTNEJTIwbG9naXRzLmFyZ21heCgtMSkuaXRlbSgpJTBBbW9kZWwuY29uZmlnLmlkMmxhYmVsJTVCcHJlZGljdGVkX2xhYmVsJTVE",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_label = logits.argmax(-<span class="hljs-number">1</span>).item()
<span class="hljs-meta">&gt;&gt;&gt; </span>model.config.id2label[predicted_label]
<span class="hljs-string">&#x27;beignets&#x27;</span>`,wrap:!1}}),{c(){e=h("p"),e.innerHTML=M,l=o(),u(i.$$.fragment),T=o(),U=h("p"),U.textContent=F,k=o(),u(C.$$.fragment),R=o(),Z=h("p"),Z.innerHTML=Y,G=o(),u(v.$$.fragment)},l(r){e=f(r,"P",{"data-svelte-h":!0}),J(e)!=="svelte-13azkkh"&&(e.innerHTML=M),l=c(r),j(i.$$.fragment,r),T=c(r),U=f(r,"P",{"data-svelte-h":!0}),J(U)!=="svelte-b607m1"&&(U.textContent=F),k=c(r),j(C.$$.fragment,r),R=c(r),Z=f(r,"P",{"data-svelte-h":!0}),J(Z)!=="svelte-uzshui"&&(Z.innerHTML=Y),G=c(r),j(v.$$.fragment,r)},m(r,_){a(r,e,_),a(r,l,_),d(i,r,_),a(r,T,_),a(r,U,_),a(r,k,_),d(C,r,_),a(r,R,_),a(r,Z,_),a(r,G,_),d(v,r,_),V=!0},p:Ts,i(r){V||(b(i.$$.fragment,r),b(C.$$.fragment,r),b(v.$$.fragment,r),V=!0)},o(r){g(i.$$.fragment,r),g(C.$$.fragment,r),g(v.$$.fragment,r),V=!1},d(r){r&&(t(e),t(l),t(T),t(U),t(k),t(R),t(Z),t(G)),w(i,r),w(C,r),w(v,r)}}}function me(x){let e,M;return e=new mt({props:{$$slots:{default:[ce]},$$scope:{ctx:x}}}),{c(){u(e.$$.fragment)},l(l){j(e.$$.fragment,l)},m(l,i){d(e,l,i),M=!0},p(l,i){const T={};i&2&&(T.$$scope={dirty:i,ctx:l}),e.$set(T)},i(l){M||(b(e.$$.fragment,l),M=!0)},o(l){g(e.$$.fragment,l),M=!1},d(l){w(e,l)}}}function ie(x){let e,M="이미지를 전처리하기 위해 이미지 프로세서를 가져오고 <code>input</code>을 TensorFlow 텐서로 반환합니다:",l,i,T,U,F="입력을 모델에 전달하고 logits을 반환합니다:",k,C,R,Z,Y="확률이 가장 높은 예측 레이블을 가져오고, 모델의 <code>id2label</code> 매핑을 사용하여 레이블로 변환합니다:",G,v,V;return i=new X({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUwQSUwQWltYWdlX3Byb2Nlc3NvciUyMCUzRCUyMEF1dG9JbWFnZVByb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIyTWFyaWFLJTJGZm9vZF9jbGFzc2lmaWVyJTIyKSUwQWlucHV0cyUyMCUzRCUyMGltYWdlX3Byb2Nlc3NvcihpbWFnZSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIydGYlMjIp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor

<span class="hljs-meta">&gt;&gt;&gt; </span>image_processor = AutoImageProcessor.from_pretrained(<span class="hljs-string">&quot;MariaK/food_classifier&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = image_processor(image, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)`,wrap:!1}}),C=new X({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRGQXV0b01vZGVsRm9ySW1hZ2VDbGFzc2lmaWNhdGlvbiUwQSUwQW1vZGVsJTIwJTNEJTIwVEZBdXRvTW9kZWxGb3JJbWFnZUNsYXNzaWZpY2F0aW9uLmZyb21fcHJldHJhaW5lZCglMjJNYXJpYUslMkZmb29kX2NsYXNzaWZpZXIlMjIpJTBBbG9naXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpLmxvZ2l0cw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TFAutoModelForImageClassification

<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFAutoModelForImageClassification.from_pretrained(<span class="hljs-string">&quot;MariaK/food_classifier&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>logits = model(**inputs).logits`,wrap:!1}}),v=new X({props:{code:"cHJlZGljdGVkX2NsYXNzX2lkJTIwJTNEJTIwaW50KHRmLm1hdGguYXJnbWF4KGxvZ2l0cyUyQyUyMGF4aXMlM0QtMSklNUIwJTVEKSUwQW1vZGVsLmNvbmZpZy5pZDJsYWJlbCU1QnByZWRpY3RlZF9jbGFzc19pZCU1RA==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_class_id = <span class="hljs-built_in">int</span>(tf.math.argmax(logits, axis=-<span class="hljs-number">1</span>)[<span class="hljs-number">0</span>])
<span class="hljs-meta">&gt;&gt;&gt; </span>model.config.id2label[predicted_class_id]
<span class="hljs-string">&#x27;beignets&#x27;</span>`,wrap:!1}}),{c(){e=h("p"),e.innerHTML=M,l=o(),u(i.$$.fragment),T=o(),U=h("p"),U.textContent=F,k=o(),u(C.$$.fragment),R=o(),Z=h("p"),Z.innerHTML=Y,G=o(),u(v.$$.fragment)},l(r){e=f(r,"P",{"data-svelte-h":!0}),J(e)!=="svelte-dkxdqj"&&(e.innerHTML=M),l=c(r),j(i.$$.fragment,r),T=c(r),U=f(r,"P",{"data-svelte-h":!0}),J(U)!=="svelte-b607m1"&&(U.textContent=F),k=c(r),j(C.$$.fragment,r),R=c(r),Z=f(r,"P",{"data-svelte-h":!0}),J(Z)!=="svelte-uzshui"&&(Z.innerHTML=Y),G=c(r),j(v.$$.fragment,r)},m(r,_){a(r,e,_),a(r,l,_),d(i,r,_),a(r,T,_),a(r,U,_),a(r,k,_),d(C,r,_),a(r,R,_),a(r,Z,_),a(r,G,_),d(v,r,_),V=!0},p:Ts,i(r){V||(b(i.$$.fragment,r),b(C.$$.fragment,r),b(v.$$.fragment,r),V=!0)},o(r){g(i.$$.fragment,r),g(C.$$.fragment,r),g(v.$$.fragment,r),V=!1},d(r){r&&(t(e),t(l),t(T),t(U),t(k),t(R),t(Z),t(G)),w(i,r),w(C,r),w(v,r)}}}function he(x){let e,M;return e=new mt({props:{$$slots:{default:[ie]},$$scope:{ctx:x}}}),{c(){u(e.$$.fragment)},l(l){j(e.$$.fragment,l)},m(l,i){d(e,l,i),M=!0},p(l,i){const T={};i&2&&(T.$$scope={dirty:i,ctx:l}),e.$set(T)},i(l){M||(b(e.$$.fragment,l),M=!0)},o(l){g(e.$$.fragment,l),M=!1},d(l){w(e,l)}}}function fe(x){let e,M,l,i,T,U,F,k,C,R,Z="이미지 분류",Y,G,v,V,r,_,H=`이미지 분류는 이미지에 레이블 또는 클래스를 할당합니다. 텍스트 또는 오디오 분류와 달리 입력은
이미지를 구성하는 픽셀 값입니다. 이미지 분류에는 자연재해 후 피해 감지, 농작물 건강 모니터링, 의료 이미지에서 질병의 징후 검사 지원 등
다양한 응용 사례가 있습니다.`,W,z,p="이 가이드에서는 다음을 설명합니다:",$,Q,y='<li><a href="https://huggingface.co/datasets/food101" rel="nofollow">Food-101</a> 데이터 세트에서 <a href="model_doc/vit">ViT</a>를 미세 조정하여 이미지에서 식품 항목을 분류합니다.</li> <li>추론을 위해 미세 조정 모델을 사용합니다.</li>',B,L,P,D,ls="시작하기 전에, 필요한 모든 라이브러리가 설치되어 있는지 확인하세요:",$s,K,O,ss,ns="Hugging Face 계정에 로그인하여 모델을 업로드하고 커뮤니티에 공유하는 것을 권장합니다. 메시지가 표시되면, 토큰을 입력하여 로그인하세요:",Us,ts,as,q,A,ms,es,m,I,it="Food-101 데이터 세트 가져오기",Jt,_s,ya=`🤗 Datasets 라이브러리에서 Food-101 데이터 세트의 더 작은 부분 집합을 가져오는 것으로 시작합니다. 이렇게 하면 전체 데이터 세트에 대한
훈련에 많은 시간을 할애하기 전에 실험을 통해 모든 것이 제대로 작동하는지 확인할 수 있습니다.`,Tt,vs,$t,Cs,ua="데이터 세트의 <code>train</code>을 <code>train_test_split</code> 메소드를 사용하여 훈련 및 테스트 세트로 분할하세요:",Ut,Zs,_t,Is,ja="그리고 예시를 살펴보세요:",vt,ks,Ct,Gs,da="데이터 세트의 각 예제에는 두 개의 필드가 있습니다:",Zt,Ws,ba="<li><code>image</code>: 식품 항목의 PIL 이미지</li> <li><code>label</code>: 식품 항목의 레이블 클래스</li>",It,Xs,ga=`모델이 레이블 ID에서 레이블 이름을 쉽게 가져올 수 있도록
레이블 이름을 정수로 매핑하고, 정수를 레이블 이름으로 매핑하는 사전을 만드세요:`,kt,xs,Gt,Vs,wa="이제 레이블 ID를 레이블 이름으로 변환할 수 있습니다:",Wt,Rs,Xt,ps,is,ht,Ys,ia,lt,Ja="전처리",xt,Fs,Ta="다음 단계는 이미지를 텐서로 처리하기 위해 ViT 이미지 프로세서를 가져오는 것입니다:",Vt,Ns,Rt,hs,Yt,fs,Ft,rs,Ms,ft,Bs,ha,nt,$a="평가",Nt,Es,Ua=`훈련 중에 평가 지표를 포함하면 모델의 성능을 평가하는 데 도움이 되는 경우가 많습니다.
🤗 <a href="https://huggingface.co/docs/evaluate/index" rel="nofollow">Evaluate</a> 라이브러리로 평가 방법을 빠르게 가져올 수 있습니다. 이 작업에서는
<a href="https://huggingface.co/spaces/evaluate-metric/accuracy" rel="nofollow">accuracy</a> 평가 지표를 가져옵니다. (🤗 Evaluate <a href="https://huggingface.co/docs/evaluate/a_quick_tour" rel="nofollow">빠른 둘러보기</a>를 참조하여 평가 지표를 가져오고 계산하는 방법에 대해 자세히 알아보세요):`,Bt,zs,Et,Hs,_a="그런 다음 예측과 레이블을 <code>compute</code>에 전달하여 정확도를 계산하는 함수를 만듭니다:",zt,Qs,Ht,Ss,va="이제 <code>compute_metrics</code> 함수를 사용할 준비가 되었으며, 훈련을 설정하면 이 함수로 되돌아올 것입니다.",Qt,os,ys,Mt,As,fa,pt,Ca="훈련",St,us,At,js,qt,ds,Lt,cs,bs,yt,qs,Ma,rt,Za="추론",Pt,Ls,Ia="좋아요, 이제 모델을 미세 조정했으니 추론에 사용할 수 있습니다!",Dt,Ps,ka="추론을 수행하고자 하는 이미지를 가져와봅시다:",Kt,Ds,Ot,gs,Ga='<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/beignets-task-guide.png" alt="image of beignets"/>',sa,Ks,Wa="미세 조정 모델로 추론을 시도하는 가장 간단한 방법은 <code>pipeline()</code>을 사용하는 것입니다. 모델로 이미지 분류를 위한 <code>pipeline</code>을 인스턴스화하고 이미지를 전달합니다:",ta,Os,aa,st,Xa="원한다면, <code>pipeline</code>의 결과를 수동으로 복제할 수도 있습니다:",ea,ws,la,Js,na,ut,pa;return k=new ot({}),G=new Pa({props:{classNames:"absolute z-10 right-0 top-0",options:[{label:"Mixed",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/ko/image_classification.ipynb"},{label:"PyTorch",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/ko/pytorch/image_classification.ipynb"},{label:"TensorFlow",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/ko/tensorflow/image_classification.ipynb"},{label:"Mixed",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/ko/image_classification.ipynb"},{label:"PyTorch",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/ko/pytorch/image_classification.ipynb"},{label:"TensorFlow",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/ko/tensorflow/image_classification.ipynb"}]}}),V=new La({props:{id:"tjAIM7BOYhw"}}),L=new ma({props:{$$slots:{default:[Da]},$$scope:{ctx:x}}}),K=new X({props:{code:"cGlwJTIwaW5zdGFsbCUyMHRyYW5zZm9ybWVycyUyMGRhdGFzZXRzJTIwZXZhbHVhdGU=",highlighted:"pip install transformers datasets evaluate",wrap:!1}}),ts=new X({props:{code:"ZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMG5vdGVib29rX2xvZ2luJTBBJTBBbm90ZWJvb2tfbG9naW4oKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> notebook_login

<span class="hljs-meta">&gt;&gt;&gt; </span>notebook_login()`,wrap:!1}}),es=new ot({}),vs=new X({props:{code:"ZnJvbSUyMGRhdGFzZXRzJTIwaW1wb3J0JTIwbG9hZF9kYXRhc2V0JTBBJTBBZm9vZCUyMCUzRCUyMGxvYWRfZGF0YXNldCglMjJmb29kMTAxJTIyJTJDJTIwc3BsaXQlM0QlMjJ0cmFpbiU1QiUzQTUwMDAlNUQlMjIp",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>food = load_dataset(<span class="hljs-string">&quot;food101&quot;</span>, split=<span class="hljs-string">&quot;train[:5000]&quot;</span>)`,wrap:!1}}),Zs=new X({props:{code:"Zm9vZCUyMCUzRCUyMGZvb2QudHJhaW5fdGVzdF9zcGxpdCh0ZXN0X3NpemUlM0QwLjIp",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>food = food.train_test_split(test_size=<span class="hljs-number">0.2</span>)',wrap:!1}}),ks=new X({props:{code:"Zm9vZCU1QiUyMnRyYWluJTIyJTVEJTVCMCU1RA==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>food[<span class="hljs-string">&quot;train&quot;</span>][<span class="hljs-number">0</span>]
{<span class="hljs-string">&#x27;image&#x27;</span>: &lt;PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=512x512 at <span class="hljs-number">0x7F52AFC8AC50</span>&gt;,
 <span class="hljs-string">&#x27;label&#x27;</span>: <span class="hljs-number">79</span>}`,wrap:!1}}),xs=new X({props:{code:"bGFiZWxzJTIwJTNEJTIwZm9vZCU1QiUyMnRyYWluJTIyJTVELmZlYXR1cmVzJTVCJTIybGFiZWwlMjIlNUQubmFtZXMlMEFsYWJlbDJpZCUyQyUyMGlkMmxhYmVsJTIwJTNEJTIwZGljdCgpJTJDJTIwZGljdCgpJTBBZm9yJTIwaSUyQyUyMGxhYmVsJTIwaW4lMjBlbnVtZXJhdGUobGFiZWxzKSUzQSUwQSUyMCUyMCUyMCUyMGxhYmVsMmlkJTVCbGFiZWwlNUQlMjAlM0QlMjBzdHIoaSklMEElMjAlMjAlMjAlMjBpZDJsYWJlbCU1QnN0cihpKSU1RCUyMCUzRCUyMGxhYmVs",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>labels = food[<span class="hljs-string">&quot;train&quot;</span>].features[<span class="hljs-string">&quot;label&quot;</span>].names
<span class="hljs-meta">&gt;&gt;&gt; </span>label2id, id2label = <span class="hljs-built_in">dict</span>(), <span class="hljs-built_in">dict</span>()
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">for</span> i, label <span class="hljs-keyword">in</span> <span class="hljs-built_in">enumerate</span>(labels):
<span class="hljs-meta">... </span>    label2id[label] = <span class="hljs-built_in">str</span>(i)
<span class="hljs-meta">... </span>    id2label[<span class="hljs-built_in">str</span>(i)] = label`,wrap:!1}}),Rs=new X({props:{code:"aWQybGFiZWwlNUJzdHIoNzkpJTVE",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>id2label[<span class="hljs-built_in">str</span>(<span class="hljs-number">79</span>)]
<span class="hljs-string">&#x27;prime_rib&#x27;</span>`,wrap:!1}}),Ys=new ot({}),Ns=new X({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUwQSUwQWNoZWNrcG9pbnQlMjAlM0QlMjAlMjJnb29nbGUlMkZ2aXQtYmFzZS1wYXRjaDE2LTIyNC1pbjIxayUyMiUwQWltYWdlX3Byb2Nlc3NvciUyMCUzRCUyMEF1dG9JbWFnZVByb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoY2hlY2twb2ludCk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor

<span class="hljs-meta">&gt;&gt;&gt; </span>checkpoint = <span class="hljs-string">&quot;google/vit-base-patch16-224-in21k&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image_processor = AutoImageProcessor.from_pretrained(checkpoint)`,wrap:!1}}),hs=new ct({props:{pytorch:!0,tensorflow:!1,jax:!1,$$slots:{pytorch:[Oa]},$$scope:{ctx:x}}}),fs=new ct({props:{pytorch:!1,tensorflow:!0,jax:!1,$$slots:{tensorflow:[te]},$$scope:{ctx:x}}}),Bs=new ot({}),zs=new X({props:{code:"aW1wb3J0JTIwZXZhbHVhdGUlMEElMEFhY2N1cmFjeSUyMCUzRCUyMGV2YWx1YXRlLmxvYWQoJTIyYWNjdXJhY3klMjIp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> evaluate

<span class="hljs-meta">&gt;&gt;&gt; </span>accuracy = evaluate.load(<span class="hljs-string">&quot;accuracy&quot;</span>)`,wrap:!1}}),Qs=new X({props:{code:"aW1wb3J0JTIwbnVtcHklMjBhcyUyMG5wJTBBJTBBJTBBZGVmJTIwY29tcHV0ZV9tZXRyaWNzKGV2YWxfcHJlZCklM0ElMEElMjAlMjAlMjAlMjBwcmVkaWN0aW9ucyUyQyUyMGxhYmVscyUyMCUzRCUyMGV2YWxfcHJlZCUwQSUyMCUyMCUyMCUyMHByZWRpY3Rpb25zJTIwJTNEJTIwbnAuYXJnbWF4KHByZWRpY3Rpb25zJTJDJTIwYXhpcyUzRDEpJTBBJTIwJTIwJTIwJTIwcmV0dXJuJTIwYWNjdXJhY3kuY29tcHV0ZShwcmVkaWN0aW9ucyUzRHByZWRpY3Rpb25zJTJDJTIwcmVmZXJlbmNlcyUzRGxhYmVscyk=",highlighted:`<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><span class="hljs-keyword">def</span> <span class="hljs-title function_">compute_metrics</span>(<span class="hljs-params">eval_pred</span>):
<span class="hljs-meta">... </span>    predictions, labels = eval_pred
<span class="hljs-meta">... </span>    predictions = np.argmax(predictions, axis=<span class="hljs-number">1</span>)
<span class="hljs-meta">... </span>    <span class="hljs-keyword">return</span> accuracy.compute(predictions=predictions, references=labels)`,wrap:!1}}),As=new ot({}),us=new ct({props:{pytorch:!0,tensorflow:!1,jax:!1,$$slots:{pytorch:[le]},$$scope:{ctx:x}}}),js=new ct({props:{pytorch:!1,tensorflow:!0,jax:!1,$$slots:{tensorflow:[re]},$$scope:{ctx:x}}}),ds=new ma({props:{$$slots:{default:[oe]},$$scope:{ctx:x}}}),qs=new ot({}),Ds=new X({props:{code:"ZHMlMjAlM0QlMjBsb2FkX2RhdGFzZXQoJTIyZm9vZDEwMSUyMiUyQyUyMHNwbGl0JTNEJTIydmFsaWRhdGlvbiU1QiUzQTEwJTVEJTIyKSUwQWltYWdlJTIwJTNEJTIwZHMlNUIlMjJpbWFnZSUyMiU1RCU1QjAlNUQ=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>ds = load_dataset(<span class="hljs-string">&quot;food101&quot;</span>, split=<span class="hljs-string">&quot;validation[:10]&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>image = ds[<span class="hljs-string">&quot;image&quot;</span>][<span class="hljs-number">0</span>]`,wrap:!1}}),Os=new X({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMHBpcGVsaW5lJTBBJTBBY2xhc3NpZmllciUyMCUzRCUyMHBpcGVsaW5lKCUyMmltYWdlLWNsYXNzaWZpY2F0aW9uJTIyJTJDJTIwbW9kZWwlM0QlMjJteV9hd2Vzb21lX2Zvb2RfbW9kZWwlMjIpJTBBY2xhc3NpZmllcihpbWFnZSk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline

<span class="hljs-meta">&gt;&gt;&gt; </span>classifier = pipeline(<span class="hljs-string">&quot;image-classification&quot;</span>, model=<span class="hljs-string">&quot;my_awesome_food_model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>classifier(image)
[{<span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.31856709718704224</span>, <span class="hljs-string">&#x27;label&#x27;</span>: <span class="hljs-string">&#x27;beignets&#x27;</span>},
 {<span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.015232225880026817</span>, <span class="hljs-string">&#x27;label&#x27;</span>: <span class="hljs-string">&#x27;bruschetta&#x27;</span>},
 {<span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.01519392803311348</span>, <span class="hljs-string">&#x27;label&#x27;</span>: <span class="hljs-string">&#x27;chicken_wings&#x27;</span>},
 {<span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.013022331520915031</span>, <span class="hljs-string">&#x27;label&#x27;</span>: <span class="hljs-string">&#x27;pork_chop&#x27;</span>},
 {<span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.012728818692266941</span>, <span class="hljs-string">&#x27;label&#x27;</span>: <span class="hljs-string">&#x27;prime_rib&#x27;</span>}]`,wrap:!1}}),ws=new ct({props:{pytorch:!0,tensorflow:!1,jax:!1,$$slots:{pytorch:[me]},$$scope:{ctx:x}}}),Js=new ct({props:{pytorch:!1,tensorflow:!0,jax:!1,$$slots:{tensorflow:[he]},$$scope:{ctx:x}}}),{c(){e=h("meta"),M=o(),l=h("p"),i=o(),T=h("h1"),U=h("a"),F=h("span"),u(k.$$.fragment),C=o(),R=h("span"),R.textContent=Z,Y=o(),u(G.$$.fragment),v=o(),u(V.$$.fragment),r=o(),_=h("p"),_.textContent=H,W=o(),z=h("p"),z.textContent=p,$=o(),Q=h("ol"),Q.innerHTML=y,B=o(),u(L.$$.fragment),P=o(),D=h("p"),D.textContent=ls,$s=o(),u(K.$$.fragment),O=o(),ss=h("p"),ss.textContent=ns,Us=o(),u(ts.$$.fragment),as=o(),q=h("h2"),A=h("a"),ms=h("span"),u(es.$$.fragment),m=o(),I=h("span"),I.textContent=it,Jt=o(),_s=h("p"),_s.textContent=ya,Tt=o(),u(vs.$$.fragment),$t=o(),Cs=h("p"),Cs.innerHTML=ua,Ut=o(),u(Zs.$$.fragment),_t=o(),Is=h("p"),Is.textContent=ja,vt=o(),u(ks.$$.fragment),Ct=o(),Gs=h("p"),Gs.textContent=da,Zt=o(),Ws=h("ul"),Ws.innerHTML=ba,It=o(),Xs=h("p"),Xs.textContent=ga,kt=o(),u(xs.$$.fragment),Gt=o(),Vs=h("p"),Vs.textContent=wa,Wt=o(),u(Rs.$$.fragment),Xt=o(),ps=h("h2"),is=h("a"),ht=h("span"),u(Ys.$$.fragment),ia=o(),lt=h("span"),lt.textContent=Ja,xt=o(),Fs=h("p"),Fs.textContent=Ta,Vt=o(),u(Ns.$$.fragment),Rt=o(),u(hs.$$.fragment),Yt=o(),u(fs.$$.fragment),Ft=o(),rs=h("h2"),Ms=h("a"),ft=h("span"),u(Bs.$$.fragment),ha=o(),nt=h("span"),nt.textContent=$a,Nt=o(),Es=h("p"),Es.innerHTML=Ua,Bt=o(),u(zs.$$.fragment),Et=o(),Hs=h("p"),Hs.innerHTML=_a,zt=o(),u(Qs.$$.fragment),Ht=o(),Ss=h("p"),Ss.innerHTML=va,Qt=o(),os=h("h2"),ys=h("a"),Mt=h("span"),u(As.$$.fragment),fa=o(),pt=h("span"),pt.textContent=Ca,St=o(),u(us.$$.fragment),At=o(),u(js.$$.fragment),qt=o(),u(ds.$$.fragment),Lt=o(),cs=h("h2"),bs=h("a"),yt=h("span"),u(qs.$$.fragment),Ma=o(),rt=h("span"),rt.textContent=Za,Pt=o(),Ls=h("p"),Ls.textContent=Ia,Dt=o(),Ps=h("p"),Ps.textContent=ka,Kt=o(),u(Ds.$$.fragment),Ot=o(),gs=h("div"),gs.innerHTML=Ga,sa=o(),Ks=h("p"),Ks.innerHTML=Wa,ta=o(),u(Os.$$.fragment),aa=o(),st=h("p"),st.innerHTML=Xa,ea=o(),u(ws.$$.fragment),la=o(),u(Js.$$.fragment),na=o(),ut=h("p"),this.h()},l(s){const n=Sa("svelte-1phssyn",document.head);e=f(n,"META",{name:!0,content:!0}),n.forEach(t),M=c(s),l=f(s,"P",{}),S(l).forEach(t),i=c(s),T=f(s,"H1",{class:!0});var tt=S(T);U=f(tt,"A",{id:!0,class:!0,href:!0});var jt=S(U);F=f(jt,"SPAN",{});var dt=S(F);j(k.$$.fragment,dt),dt.forEach(t),jt.forEach(t),C=c(tt),R=f(tt,"SPAN",{"data-svelte-h":!0}),J(R)!=="svelte-mmw9bt"&&(R.textContent=Z),tt.forEach(t),Y=c(s),j(G.$$.fragment,s),v=c(s),j(V.$$.fragment,s),r=c(s),_=f(s,"P",{"data-svelte-h":!0}),J(_)!=="svelte-1op3s0b"&&(_.textContent=H),W=c(s),z=f(s,"P",{"data-svelte-h":!0}),J(z)!=="svelte-19dumbs"&&(z.textContent=p),$=c(s),Q=f(s,"OL",{"data-svelte-h":!0}),J(Q)!=="svelte-93mkx2"&&(Q.innerHTML=y),B=c(s),j(L.$$.fragment,s),P=c(s),D=f(s,"P",{"data-svelte-h":!0}),J(D)!=="svelte-1bc8bfk"&&(D.textContent=ls),$s=c(s),j(K.$$.fragment,s),O=c(s),ss=f(s,"P",{"data-svelte-h":!0}),J(ss)!=="svelte-1hhyu5y"&&(ss.textContent=ns),Us=c(s),j(ts.$$.fragment,s),as=c(s),q=f(s,"H2",{class:!0});var at=S(q);A=f(at,"A",{id:!0,class:!0,href:!0});var bt=S(A);ms=f(bt,"SPAN",{});var gt=S(ms);j(es.$$.fragment,gt),gt.forEach(t),bt.forEach(t),m=c(at),I=f(at,"SPAN",{"data-svelte-h":!0}),J(I)!=="svelte-1rl7jm2"&&(I.textContent=it),at.forEach(t),Jt=c(s),_s=f(s,"P",{"data-svelte-h":!0}),J(_s)!=="svelte-k4g7mc"&&(_s.textContent=ya),Tt=c(s),j(vs.$$.fragment,s),$t=c(s),Cs=f(s,"P",{"data-svelte-h":!0}),J(Cs)!=="svelte-1amyql0"&&(Cs.innerHTML=ua),Ut=c(s),j(Zs.$$.fragment,s),_t=c(s),Is=f(s,"P",{"data-svelte-h":!0}),J(Is)!=="svelte-1rb3v2y"&&(Is.textContent=ja),vt=c(s),j(ks.$$.fragment,s),Ct=c(s),Gs=f(s,"P",{"data-svelte-h":!0}),J(Gs)!=="svelte-7crmck"&&(Gs.textContent=da),Zt=c(s),Ws=f(s,"UL",{"data-svelte-h":!0}),J(Ws)!=="svelte-yxm734"&&(Ws.innerHTML=ba),It=c(s),Xs=f(s,"P",{"data-svelte-h":!0}),J(Xs)!=="svelte-1lustc3"&&(Xs.textContent=ga),kt=c(s),j(xs.$$.fragment,s),Gt=c(s),Vs=f(s,"P",{"data-svelte-h":!0}),J(Vs)!=="svelte-135k07i"&&(Vs.textContent=wa),Wt=c(s),j(Rs.$$.fragment,s),Xt=c(s),ps=f(s,"H2",{class:!0});var et=S(ps);is=f(et,"A",{id:!0,class:!0,href:!0});var wt=S(is);ht=f(wt,"SPAN",{});var xa=S(ht);j(Ys.$$.fragment,xa),xa.forEach(t),wt.forEach(t),ia=c(et),lt=f(et,"SPAN",{"data-svelte-h":!0}),J(lt)!=="svelte-1cte2wb"&&(lt.textContent=Ja),et.forEach(t),xt=c(s),Fs=f(s,"P",{"data-svelte-h":!0}),J(Fs)!=="svelte-1x7s0ft"&&(Fs.textContent=Ta),Vt=c(s),j(Ns.$$.fragment,s),Rt=c(s),j(hs.$$.fragment,s),Yt=c(s),j(fs.$$.fragment,s),Ft=c(s),rs=f(s,"H2",{class:!0});var ra=S(rs);Ms=f(ra,"A",{id:!0,class:!0,href:!0});var Va=S(Ms);ft=f(Va,"SPAN",{});var Ra=S(ft);j(Bs.$$.fragment,Ra),Ra.forEach(t),Va.forEach(t),ha=c(ra),nt=f(ra,"SPAN",{"data-svelte-h":!0}),J(nt)!=="svelte-fd7xxy"&&(nt.textContent=$a),ra.forEach(t),Nt=c(s),Es=f(s,"P",{"data-svelte-h":!0}),J(Es)!=="svelte-h5ivt1"&&(Es.innerHTML=Ua),Bt=c(s),j(zs.$$.fragment,s),Et=c(s),Hs=f(s,"P",{"data-svelte-h":!0}),J(Hs)!=="svelte-tpx6n8"&&(Hs.innerHTML=_a),zt=c(s),j(Qs.$$.fragment,s),Ht=c(s),Ss=f(s,"P",{"data-svelte-h":!0}),J(Ss)!=="svelte-1tfmmd0"&&(Ss.innerHTML=va),Qt=c(s),os=f(s,"H2",{class:!0});var oa=S(os);ys=f(oa,"A",{id:!0,class:!0,href:!0});var Ya=S(ys);Mt=f(Ya,"SPAN",{});var Fa=S(Mt);j(As.$$.fragment,Fa),Fa.forEach(t),Ya.forEach(t),fa=c(oa),pt=f(oa,"SPAN",{"data-svelte-h":!0}),J(pt)!=="svelte-tdy10p"&&(pt.textContent=Ca),oa.forEach(t),St=c(s),j(us.$$.fragment,s),At=c(s),j(js.$$.fragment,s),qt=c(s),j(ds.$$.fragment,s),Lt=c(s),cs=f(s,"H2",{class:!0});var ca=S(cs);bs=f(ca,"A",{id:!0,class:!0,href:!0});var Na=S(bs);yt=f(Na,"SPAN",{});var Ba=S(yt);j(qs.$$.fragment,Ba),Ba.forEach(t),Na.forEach(t),Ma=c(ca),rt=f(ca,"SPAN",{"data-svelte-h":!0}),J(rt)!=="svelte-8litrx"&&(rt.textContent=Za),ca.forEach(t),Pt=c(s),Ls=f(s,"P",{"data-svelte-h":!0}),J(Ls)!=="svelte-1annmqf"&&(Ls.textContent=Ia),Dt=c(s),Ps=f(s,"P",{"data-svelte-h":!0}),J(Ps)!=="svelte-gvr8fy"&&(Ps.textContent=ka),Kt=c(s),j(Ds.$$.fragment,s),Ot=c(s),gs=f(s,"DIV",{class:!0,"data-svelte-h":!0}),J(gs)!=="svelte-pnh0xy"&&(gs.innerHTML=Ga),sa=c(s),Ks=f(s,"P",{"data-svelte-h":!0}),J(Ks)!=="svelte-7ivah3"&&(Ks.innerHTML=Wa),ta=c(s),j(Os.$$.fragment,s),aa=c(s),st=f(s,"P",{"data-svelte-h":!0}),J(st)!=="svelte-1smgeha"&&(st.innerHTML=Xa),ea=c(s),j(ws.$$.fragment,s),la=c(s),j(Js.$$.fragment,s),na=c(s),ut=f(s,"P",{}),S(ut).forEach(t),this.h()},h(){N(e,"name","hf:doc:metadata"),N(e,"content",JSON.stringify(Me)),N(U,"id","image-classification"),N(U,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),N(U,"href","#image-classification"),N(T,"class","relative group"),N(A,"id","load-food101-dataset"),N(A,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),N(A,"href","#load-food101-dataset"),N(q,"class","relative group"),N(is,"id","preprocess"),N(is,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),N(is,"href","#preprocess"),N(ps,"class","relative group"),N(Ms,"id","evaluate"),N(Ms,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),N(Ms,"href","#evaluate"),N(rs,"class","relative group"),N(ys,"id","train"),N(ys,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),N(ys,"href","#train"),N(os,"class","relative group"),N(bs,"id","inference"),N(bs,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),N(bs,"href","#inference"),N(cs,"class","relative group"),N(gs,"class","flex justify-center")},m(s,n){E(document.head,e),a(s,M,n),a(s,l,n),a(s,i,n),a(s,T,n),E(T,U),E(U,F),d(k,F,null),E(T,C),E(T,R),a(s,Y,n),d(G,s,n),a(s,v,n),d(V,s,n),a(s,r,n),a(s,_,n),a(s,W,n),a(s,z,n),a(s,$,n),a(s,Q,n),a(s,B,n),d(L,s,n),a(s,P,n),a(s,D,n),a(s,$s,n),d(K,s,n),a(s,O,n),a(s,ss,n),a(s,Us,n),d(ts,s,n),a(s,as,n),a(s,q,n),E(q,A),E(A,ms),d(es,ms,null),E(q,m),E(q,I),a(s,Jt,n),a(s,_s,n),a(s,Tt,n),d(vs,s,n),a(s,$t,n),a(s,Cs,n),a(s,Ut,n),d(Zs,s,n),a(s,_t,n),a(s,Is,n),a(s,vt,n),d(ks,s,n),a(s,Ct,n),a(s,Gs,n),a(s,Zt,n),a(s,Ws,n),a(s,It,n),a(s,Xs,n),a(s,kt,n),d(xs,s,n),a(s,Gt,n),a(s,Vs,n),a(s,Wt,n),d(Rs,s,n),a(s,Xt,n),a(s,ps,n),E(ps,is),E(is,ht),d(Ys,ht,null),E(ps,ia),E(ps,lt),a(s,xt,n),a(s,Fs,n),a(s,Vt,n),d(Ns,s,n),a(s,Rt,n),d(hs,s,n),a(s,Yt,n),d(fs,s,n),a(s,Ft,n),a(s,rs,n),E(rs,Ms),E(Ms,ft),d(Bs,ft,null),E(rs,ha),E(rs,nt),a(s,Nt,n),a(s,Es,n),a(s,Bt,n),d(zs,s,n),a(s,Et,n),a(s,Hs,n),a(s,zt,n),d(Qs,s,n),a(s,Ht,n),a(s,Ss,n),a(s,Qt,n),a(s,os,n),E(os,ys),E(ys,Mt),d(As,Mt,null),E(os,fa),E(os,pt),a(s,St,n),d(us,s,n),a(s,At,n),d(js,s,n),a(s,qt,n),d(ds,s,n),a(s,Lt,n),a(s,cs,n),E(cs,bs),E(bs,yt),d(qs,yt,null),E(cs,Ma),E(cs,rt),a(s,Pt,n),a(s,Ls,n),a(s,Dt,n),a(s,Ps,n),a(s,Kt,n),d(Ds,s,n),a(s,Ot,n),a(s,gs,n),a(s,sa,n),a(s,Ks,n),a(s,ta,n),d(Os,s,n),a(s,aa,n),a(s,st,n),a(s,ea,n),d(ws,s,n),a(s,la,n),d(Js,s,n),a(s,na,n),a(s,ut,n),pa=!0},p(s,[n]){const tt={};n&2&&(tt.$$scope={dirty:n,ctx:s}),L.$set(tt);const jt={};n&2&&(jt.$$scope={dirty:n,ctx:s}),hs.$set(jt);const dt={};n&2&&(dt.$$scope={dirty:n,ctx:s}),fs.$set(dt);const at={};n&2&&(at.$$scope={dirty:n,ctx:s}),us.$set(at);const bt={};n&2&&(bt.$$scope={dirty:n,ctx:s}),js.$set(bt);const gt={};n&2&&(gt.$$scope={dirty:n,ctx:s}),ds.$set(gt);const et={};n&2&&(et.$$scope={dirty:n,ctx:s}),ws.$set(et);const wt={};n&2&&(wt.$$scope={dirty:n,ctx:s}),Js.$set(wt)},i(s){pa||(b(k.$$.fragment,s),b(G.$$.fragment,s),b(V.$$.fragment,s),b(L.$$.fragment,s),b(K.$$.fragment,s),b(ts.$$.fragment,s),b(es.$$.fragment,s),b(vs.$$.fragment,s),b(Zs.$$.fragment,s),b(ks.$$.fragment,s),b(xs.$$.fragment,s),b(Rs.$$.fragment,s),b(Ys.$$.fragment,s),b(Ns.$$.fragment,s),b(hs.$$.fragment,s),b(fs.$$.fragment,s),b(Bs.$$.fragment,s),b(zs.$$.fragment,s),b(Qs.$$.fragment,s),b(As.$$.fragment,s),b(us.$$.fragment,s),b(js.$$.fragment,s),b(ds.$$.fragment,s),b(qs.$$.fragment,s),b(Ds.$$.fragment,s),b(Os.$$.fragment,s),b(ws.$$.fragment,s),b(Js.$$.fragment,s),pa=!0)},o(s){g(k.$$.fragment,s),g(G.$$.fragment,s),g(V.$$.fragment,s),g(L.$$.fragment,s),g(K.$$.fragment,s),g(ts.$$.fragment,s),g(es.$$.fragment,s),g(vs.$$.fragment,s),g(Zs.$$.fragment,s),g(ks.$$.fragment,s),g(xs.$$.fragment,s),g(Rs.$$.fragment,s),g(Ys.$$.fragment,s),g(Ns.$$.fragment,s),g(hs.$$.fragment,s),g(fs.$$.fragment,s),g(Bs.$$.fragment,s),g(zs.$$.fragment,s),g(Qs.$$.fragment,s),g(As.$$.fragment,s),g(us.$$.fragment,s),g(js.$$.fragment,s),g(ds.$$.fragment,s),g(qs.$$.fragment,s),g(Ds.$$.fragment,s),g(Os.$$.fragment,s),g(ws.$$.fragment,s),g(Js.$$.fragment,s),pa=!1},d(s){s&&(t(M),t(l),t(i),t(T),t(Y),t(v),t(r),t(_),t(W),t(z),t($),t(Q),t(B),t(P),t(D),t($s),t(O),t(ss),t(Us),t(as),t(q),t(Jt),t(_s),t(Tt),t($t),t(Cs),t(Ut),t(_t),t(Is),t(vt),t(Ct),t(Gs),t(Zt),t(Ws),t(It),t(Xs),t(kt),t(Gt),t(Vs),t(Wt),t(Xt),t(ps),t(xt),t(Fs),t(Vt),t(Rt),t(Yt),t(Ft),t(rs),t(Nt),t(Es),t(Bt),t(Et),t(Hs),t(zt),t(Ht),t(Ss),t(Qt),t(os),t(St),t(At),t(qt),t(Lt),t(cs),t(Pt),t(Ls),t(Dt),t(Ps),t(Kt),t(Ot),t(gs),t(sa),t(Ks),t(ta),t(aa),t(st),t(ea),t(la),t(na),t(ut)),t(e),w(k),w(G,s),w(V,s),w(L,s),w(K,s),w(ts,s),w(es),w(vs,s),w(Zs,s),w(ks,s),w(xs,s),w(Rs,s),w(Ys),w(Ns,s),w(hs,s),w(fs,s),w(Bs),w(zs,s),w(Qs,s),w(As),w(us,s),w(js,s),w(ds,s),w(qs),w(Ds,s),w(Os,s),w(ws,s),w(Js,s)}}}const Me={local:"image-classification",sections:[{local:"load-food101-dataset",title:"Food-101 데이터 세트 가져오기"},{local:"preprocess",title:"전처리"},{local:"evaluate",title:"평가"},{local:"train",title:"훈련"},{local:"inference",title:"추론"}],title:"이미지 분류"};function ye(x){return za(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class $e extends Ha{constructor(e){super(),Qa(this,e,ye,fe,Ea,{})}}export{$e as component};
