import{s as Pa,o as Ka,n as Ms}from"../chunks/scheduler.9bc65507.js";import{S as Oa,i as sl,g as w,s as m,r as h,A as al,h as d,f as a,c,j as Da,u as j,x as _,k as Za,y as ll,a as l,v as y,d as u,t as g,w as b}from"../chunks/index.707bf1b6.js";import{T as _a}from"../chunks/Tip.c2ecdbf4.js";import{Y as tl}from"../chunks/Youtube.e1129c6f.js";import{C as G}from"../chunks/CodeBlock.54a9f38d.js";import{D as el}from"../chunks/DocNotebookDropdown.41f65cb5.js";import{F as xs,M as zs}from"../chunks/Markdown.8ab98a13.js";import{H as Bs,E as nl}from"../chunks/EditOnGithub.922df6ba.js";function pl(X){let t,M='このタスクと互換性のあるすべてのアーキテクチャとチェックポイントを確認するには、<a href="https://huggingface.co/tasks/image-classification" rel="nofollow">タスクページ</a> を確認することをお勧めします。';return{c(){t=w("p"),t.innerHTML=M},l(e){t=d(e,"P",{"data-svelte-h":!0}),_(t)!=="svelte-kxk9fo"&&(t.innerHTML=M)},m(e,o){l(e,t,o)},p:Ms,d(e){e&&a(t)}}}function rl(X){let t,M='いくつかの画像変換を画像に適用して、モデルの過学習に対する堅牢性を高めます。ここでは torchvision の <a href="https://pytorch.org/vision/stable/transforms.html" rel="nofollow"><code>transforms</code></a> モジュールを使用しますが、任意の画像ライブラリを使用することもできます。',e,o,T="画像のランダムな部分をトリミングし、サイズを変更し、画像の平均と標準偏差で正規化します。",C,Y,W,Z,F="次に、変換を適用し、画像の <code>pixel_values</code> (モデルへの入力) を返す前処理関数を作成します。",I,V,R,$,x="データセット全体に前処理関数を適用するには、🤗 Datasets <code>with_transform</code> メソッドを使用します。変換は、データセットの要素を読み込むときにオンザフライで適用されます。",r,U,N,v,z="次に、<code>DefaultDataCollat​​or</code> を使用してサンプルのバッチを作成します。 🤗 Transformers の他のデータ照合器とは異なり、<code>DefaultDataCollat​​or</code> はパディングなどの追加の前処理を適用しません。",p,J,E;return Y=new G({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}}),V=new G({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}}),U=new G({props:{code:"Zm9vZCUyMCUzRCUyMGZvb2Qud2l0aF90cmFuc2Zvcm0odHJhbnNmb3Jtcyk=",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>food = food.with_transform(transforms)',wrap:!1}}),J=new G({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(){t=w("p"),t.innerHTML=M,e=m(),o=w("p"),o.textContent=T,C=m(),h(Y.$$.fragment),W=m(),Z=w("p"),Z.innerHTML=F,I=m(),h(V.$$.fragment),R=m(),$=w("p"),$.innerHTML=x,r=m(),h(U.$$.fragment),N=m(),v=w("p"),v.innerHTML=z,p=m(),h(J.$$.fragment)},l(f){t=d(f,"P",{"data-svelte-h":!0}),_(t)!=="svelte-9lrlsl"&&(t.innerHTML=M),e=c(f),o=d(f,"P",{"data-svelte-h":!0}),_(o)!=="svelte-vjeng9"&&(o.textContent=T),C=c(f),j(Y.$$.fragment,f),W=c(f),Z=d(f,"P",{"data-svelte-h":!0}),_(Z)!=="svelte-76n8td"&&(Z.innerHTML=F),I=c(f),j(V.$$.fragment,f),R=c(f),$=d(f,"P",{"data-svelte-h":!0}),_($)!=="svelte-9bsq10"&&($.innerHTML=x),r=c(f),j(U.$$.fragment,f),N=c(f),v=d(f,"P",{"data-svelte-h":!0}),_(v)!=="svelte-me6jz3"&&(v.innerHTML=z),p=c(f),j(J.$$.fragment,f)},m(f,B){l(f,t,B),l(f,e,B),l(f,o,B),l(f,C,B),y(Y,f,B),l(f,W,B),l(f,Z,B),l(f,I,B),y(V,f,B),l(f,R,B),l(f,$,B),l(f,r,B),y(U,f,B),l(f,N,B),l(f,v,B),l(f,p,B),y(J,f,B),E=!0},p:Ms,i(f){E||(u(Y.$$.fragment,f),u(V.$$.fragment,f),u(U.$$.fragment,f),u(J.$$.fragment,f),E=!0)},o(f){g(Y.$$.fragment,f),g(V.$$.fragment,f),g(U.$$.fragment,f),g(J.$$.fragment,f),E=!1},d(f){f&&(a(t),a(e),a(o),a(C),a(W),a(Z),a(I),a(R),a($),a(r),a(N),a(v),a(p)),b(Y,f),b(V,f),b(U,f),b(J,f)}}}function ml(X){let t,M;return t=new zs({props:{$$slots:{default:[rl]},$$scope:{ctx:X}}}),{c(){h(t.$$.fragment)},l(e){j(t.$$.fragment,e)},m(e,o){y(t,e,o),M=!0},p(e,o){const T={};o&2&&(T.$$scope={dirty:o,ctx:e}),t.$set(T)},i(e){M||(u(t.$$.fragment,e),M=!0)},o(e){g(t.$$.fragment,e),M=!1},d(e){b(t,e)}}}function cl(X){let t,M=`過剰適合を回避し、モデルをより堅牢にするために、データセットのトレーニング部分にデータ拡張を追加します。
ここでは、Keras 前処理レイヤーを使用してトレーニング データの変換 (データ拡張を含む) を定義します。
検証データの変換 (中央のトリミング、サイズ変更、正規化のみ)。 <code>tf.image</code> または
他のライブラリでも構いません。`,e,o,T,C,Y="次に、一度に 1 つの画像ではなく、画像のバッチに適切な変換を適用する関数を作成します。",W,Z,F,I,V="🤗 データセット <code>set_transform</code> を使用して、その場で変換を適用します。",R,$,x,r,U=`最後の前処理ステップとして、<code>DefaultDataCollat​​or</code>を使用してサンプルのバッチを作成します。 🤗 Transformers の他のデータ照合機能とは異なり、
<code>DefaultDataCollat​​or</code> は、パディングなどの追加の前処理を適用しません。`,N,v,z;return o=new G({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}}),Z=new G({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}}),$=new G({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}}),v=new G({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(){t=w("p"),t.innerHTML=M,e=m(),h(o.$$.fragment),T=m(),C=w("p"),C.textContent=Y,W=m(),h(Z.$$.fragment),F=m(),I=w("p"),I.innerHTML=V,R=m(),h($.$$.fragment),x=m(),r=w("p"),r.innerHTML=U,N=m(),h(v.$$.fragment)},l(p){t=d(p,"P",{"data-svelte-h":!0}),_(t)!=="svelte-1bftz3e"&&(t.innerHTML=M),e=c(p),j(o.$$.fragment,p),T=c(p),C=d(p,"P",{"data-svelte-h":!0}),_(C)!=="svelte-1g4py9p"&&(C.textContent=Y),W=c(p),j(Z.$$.fragment,p),F=c(p),I=d(p,"P",{"data-svelte-h":!0}),_(I)!=="svelte-qy5n6r"&&(I.innerHTML=V),R=c(p),j($.$$.fragment,p),x=c(p),r=d(p,"P",{"data-svelte-h":!0}),_(r)!=="svelte-zm6h83"&&(r.innerHTML=U),N=c(p),j(v.$$.fragment,p)},m(p,J){l(p,t,J),l(p,e,J),y(o,p,J),l(p,T,J),l(p,C,J),l(p,W,J),y(Z,p,J),l(p,F,J),l(p,I,J),l(p,R,J),y($,p,J),l(p,x,J),l(p,r,J),l(p,N,J),y(v,p,J),z=!0},p:Ms,i(p){z||(u(o.$$.fragment,p),u(Z.$$.fragment,p),u($.$$.fragment,p),u(v.$$.fragment,p),z=!0)},o(p){g(o.$$.fragment,p),g(Z.$$.fragment,p),g($.$$.fragment,p),g(v.$$.fragment,p),z=!1},d(p){p&&(a(t),a(e),a(T),a(C),a(W),a(F),a(I),a(R),a(x),a(r),a(N)),b(o,p),b(Z,p),b($,p),b(v,p)}}}function il(X){let t,M;return t=new zs({props:{$$slots:{default:[cl]},$$scope:{ctx:X}}}),{c(){h(t.$$.fragment)},l(e){j(t.$$.fragment,e)},m(e,o){y(t,e,o),M=!0},p(e,o){const T={};o&2&&(T.$$scope={dirty:o,ctx:e}),t.$set(T)},i(e){M||(u(t.$$.fragment,e),M=!0)},o(e){g(t.$$.fragment,e),M=!1},d(e){b(t,e)}}}function ol(X){let t,M='<a href="/docs/transformers/pr_29969/ja/main_classes/trainer#transformers.Trainer">Trainer</a> を使用したモデルの微調整に慣れていない場合は、<a href="../training#train-with-pytorch-trainer">こちら</a> の基本的なチュートリアルをご覧ください。';return{c(){t=w("p"),t.innerHTML=M},l(e){t=d(e,"P",{"data-svelte-h":!0}),_(t)!=="svelte-el5fbc"&&(t.innerHTML=M)},m(e,o){l(e,t,o)},p:Ms,d(e){e&&a(t)}}}function Ml(X){let t,M,e,o='これでモデルのトレーニングを開始する準備が整いました。 <a href="/docs/transformers/pr_29969/ja/model_doc/auto#transformers.AutoModelForImageClassification">AutoModelForImageClassification</a> を使用して ViT をロードします。ラベルの数と予想されるラベルの数、およびラベル マッピングを指定します。',T,C,Y,W,Z="この時点で残っているステップは 3 つだけです。",F,I,V='<li><a href="/docs/transformers/pr_29969/ja/main_classes/trainer#transformers.TrainingArguments">TrainingArguments</a> でトレーニング ハイパーパラメータを定義します。 <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 にサインインする必要があります)。各エポックの終了時に、<a href="/docs/transformers/pr_29969/ja/main_classes/trainer#transformers.Trainer">Trainer</a> は精度を評価し、トレーニング チェックポイントを保存します。</li> <li>トレーニング引数を、モデル、データセット、トークナイザー、データ照合器、および <code>compute_metrics</code> 関数とともに <a href="/docs/transformers/pr_29969/ja/main_classes/trainer#transformers.Trainer">Trainer</a> に渡します。</li> <li><a href="/docs/transformers/pr_29969/ja/main_classes/trainer#transformers.Trainer.train">train()</a> を呼び出してモデルを微調整します。</li>',R,$,x,r,U='トレーニングが完了したら、 <a href="/docs/transformers/pr_29969/ja/main_classes/trainer#transformers.Trainer.push_to_hub">push_to_hub()</a> メソッドを使用してモデルをハブに共有し、誰もがモデルを使用できるようにします。',N,v,z;return t=new _a({props:{$$slots:{default:[ol]},$$scope:{ctx:X}}}),C=new G({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}}),$=new G({props:{code:"dHJhaW5pbmdfYXJncyUyMCUzRCUyMFRyYWluaW5nQXJndW1lbnRzKCUwQSUyMCUyMCUyMCUyMG91dHB1dF9kaXIlM0QlMjJteV9hd2Vzb21lX2Zvb2RfbW9kZWwlMjIlMkMlMEElMjAlMjAlMjAlMjByZW1vdmVfdW51c2VkX2NvbHVtbnMlM0RGYWxzZSUyQyUwQSUyMCUyMCUyMCUyMGV2YWxfc3RyYXRlZ3klM0QlMjJlcG9jaCUyMiUyQyUwQSUyMCUyMCUyMCUyMHNhdmVfc3RyYXRlZ3klM0QlMjJlcG9jaCUyMiUyQyUwQSUyMCUyMCUyMCUyMGxlYXJuaW5nX3JhdGUlM0Q1ZS01JTJDJTBBJTIwJTIwJTIwJTIwcGVyX2RldmljZV90cmFpbl9iYXRjaF9zaXplJTNEMTYlMkMlMEElMjAlMjAlMjAlMjBncmFkaWVudF9hY2N1bXVsYXRpb25fc3RlcHMlM0Q0JTJDJTBBJTIwJTIwJTIwJTIwcGVyX2RldmljZV9ldmFsX2JhdGNoX3NpemUlM0QxNiUyQyUwQSUyMCUyMCUyMCUyMG51bV90cmFpbl9lcG9jaHMlM0QzJTJDJTBBJTIwJTIwJTIwJTIwd2FybXVwX3JhdGlvJTNEMC4xJTJDJTBBJTIwJTIwJTIwJTIwbG9nZ2luZ19zdGVwcyUzRDEwJTJDJTBBJTIwJTIwJTIwJTIwbG9hZF9iZXN0X21vZGVsX2F0X2VuZCUzRFRydWUlMkMlMEElMjAlMjAlMjAlMjBtZXRyaWNfZm9yX2Jlc3RfbW9kZWwlM0QlMjJhY2N1cmFjeSUyMiUyQyUwQSUyMCUyMCUyMCUyMHB1c2hfdG9faHViJTNEVHJ1ZSUyQyUwQSklMEElMEF0cmFpbmVyJTIwJTNEJTIwVHJhaW5lciglMEElMjAlMjAlMjAlMjBtb2RlbCUzRG1vZGVsJTJDJTBBJTIwJTIwJTIwJTIwYXJncyUzRHRyYWluaW5nX2FyZ3MlMkMlMEElMjAlMjAlMjAlMjBkYXRhX2NvbGxhdG9yJTNEZGF0YV9jb2xsYXRvciUyQyUwQSUyMCUyMCUyMCUyMHRyYWluX2RhdGFzZXQlM0Rmb29kJTVCJTIydHJhaW4lMjIlNUQlMkMlMEElMjAlMjAlMjAlMjBldmFsX2RhdGFzZXQlM0Rmb29kJTVCJTIydGVzdCUyMiU1RCUyQyUwQSUyMCUyMCUyMCUyMHByb2Nlc3NpbmdfY2xhc3MlM0RpbWFnZV9wcm9jZXNzb3IlMkMlMEElMjAlMjAlMjAlMjBjb21wdXRlX21ldHJpY3MlM0Rjb21wdXRlX21ldHJpY3MlMkMlMEEpJTBBJTBBdHJhaW5lci50cmFpbigp",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>    eval_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>    processing_class=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}}),v=new G({props:{code:"dHJhaW5lci5wdXNoX3RvX2h1Yigp",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>trainer.push_to_hub()',wrap:!1}}),{c(){h(t.$$.fragment),M=m(),e=w("p"),e.innerHTML=o,T=m(),h(C.$$.fragment),Y=m(),W=w("p"),W.textContent=Z,F=m(),I=w("ol"),I.innerHTML=V,R=m(),h($.$$.fragment),x=m(),r=w("p"),r.innerHTML=U,N=m(),h(v.$$.fragment)},l(p){j(t.$$.fragment,p),M=c(p),e=d(p,"P",{"data-svelte-h":!0}),_(e)!=="svelte-15f4su6"&&(e.innerHTML=o),T=c(p),j(C.$$.fragment,p),Y=c(p),W=d(p,"P",{"data-svelte-h":!0}),_(W)!=="svelte-5p19xw"&&(W.textContent=Z),F=c(p),I=d(p,"OL",{"data-svelte-h":!0}),_(I)!=="svelte-1d8vq2v"&&(I.innerHTML=V),R=c(p),j($.$$.fragment,p),x=c(p),r=d(p,"P",{"data-svelte-h":!0}),_(r)!=="svelte-xo0k18"&&(r.innerHTML=U),N=c(p),j(v.$$.fragment,p)},m(p,J){y(t,p,J),l(p,M,J),l(p,e,J),l(p,T,J),y(C,p,J),l(p,Y,J),l(p,W,J),l(p,F,J),l(p,I,J),l(p,R,J),y($,p,J),l(p,x,J),l(p,r,J),l(p,N,J),y(v,p,J),z=!0},p(p,J){const E={};J&2&&(E.$$scope={dirty:J,ctx:p}),t.$set(E)},i(p){z||(u(t.$$.fragment,p),u(C.$$.fragment,p),u($.$$.fragment,p),u(v.$$.fragment,p),z=!0)},o(p){g(t.$$.fragment,p),g(C.$$.fragment,p),g($.$$.fragment,p),g(v.$$.fragment,p),z=!1},d(p){p&&(a(M),a(e),a(T),a(Y),a(W),a(F),a(I),a(R),a(x),a(r),a(N)),b(t,p),b(C,p),b($,p),b(v,p)}}}function fl(X){let t,M;return t=new zs({props:{$$slots:{default:[Ml]},$$scope:{ctx:X}}}),{c(){h(t.$$.fragment)},l(e){j(t.$$.fragment,e)},m(e,o){y(t,e,o),M=!0},p(e,o){const T={};o&2&&(T.$$scope={dirty:o,ctx:e}),t.$set(T)},i(e){M||(u(t.$$.fragment,e),M=!0)},o(e){g(t.$$.fragment,e),M=!1},d(e){b(t,e)}}}function hl(X){let t,M='Keras を使用したモデルの微調整に慣れていない場合は、まず <a href="./training#train-a-tensorflow-model-with-keras">基本チュートリアル</a> を確認してください。';return{c(){t=w("p"),t.innerHTML=M},l(e){t=d(e,"P",{"data-svelte-h":!0}),_(t)!=="svelte-m0v6mc"&&(t.innerHTML=M)},m(e,o){l(e,t,o)},p:Ms,d(e){e&&a(t)}}}function jl(X){let t,M,e,o="TensorFlow でモデルを微調整するには、次の手順に従います。",T,C,Y="<li>トレーニングのハイパーパラメータを定義し、オプティマイザーと学習率スケジュールを設定します。</li> <li>事前トレーニングされたモデルをインスタンス化します。</li> <li>🤗 データセットを <code>tf.data.Dataset</code> に変換します。</li> <li>モデルをコンパイルします。</li> <li>コールバックを追加し、<code>fit()</code> メソッドを使用してトレーニングを実行します。</li> <li>モデルを 🤗 Hub にアップロードしてコミュニティと共有します。</li>",W,Z,F="まず、ハイパーパラメーター、オプティマイザー、学習率スケジュールを定義します。",I,V,R,$,x='次に、ラベル マッピングとともに <a href="/docs/transformers/pr_29969/ja/model_doc/auto#transformers.TFAutoModelForImageClassification">TFAutoModelForImageClassification</a> を使用して ViT を読み込みます。',r,U,N,v,z="Convert your datasets to the <code>tf.data.Dataset</code> format using the <code>to_tf_dataset</code> and your <code>data_collator</code>:",p,J,E,f,B="<code>compile()</code> を使用してトレーニング用にモデルを設定します。",K,H,fs,L,D=`予測から精度を計算し、モデルを 🤗 ハブにプッシュするには、<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> を使用してモデルをアップロードします。`,O,Q,ss,S,Ns=`ついに、モデルをトレーニングする準備が整いました。トレーニングおよび検証データセット、エポック数、
モデルを微調整するためのコールバック:`,as,A,ls,q,Es="おめでとう！モデルを微調整し、🤗 Hub で共有しました。これで推論に使用できるようになりました。",ts;return t=new _a({props:{$$slots:{default:[hl]},$$scope:{ctx:X}}}),V=new G({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}}),U=new G({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}}),J=new G({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}}),H=new G({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}}),Q=new G({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}}),A=new G({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(){h(t.$$.fragment),M=m(),e=w("p"),e.textContent=o,T=m(),C=w("ol"),C.innerHTML=Y,W=m(),Z=w("p"),Z.textContent=F,I=m(),h(V.$$.fragment),R=m(),$=w("p"),$.innerHTML=x,r=m(),h(U.$$.fragment),N=m(),v=w("p"),v.innerHTML=z,p=m(),h(J.$$.fragment),E=m(),f=w("p"),f.innerHTML=B,K=m(),h(H.$$.fragment),fs=m(),L=w("p"),L.innerHTML=D,O=m(),h(Q.$$.fragment),ss=m(),S=w("p"),S.textContent=Ns,as=m(),h(A.$$.fragment),ls=m(),q=w("p"),q.textContent=Es},l(i){j(t.$$.fragment,i),M=c(i),e=d(i,"P",{"data-svelte-h":!0}),_(e)!=="svelte-a44fb"&&(e.textContent=o),T=c(i),C=d(i,"OL",{"data-svelte-h":!0}),_(C)!=="svelte-k6hrg7"&&(C.innerHTML=Y),W=c(i),Z=d(i,"P",{"data-svelte-h":!0}),_(Z)!=="svelte-1u4w84l"&&(Z.textContent=F),I=c(i),j(V.$$.fragment,i),R=c(i),$=d(i,"P",{"data-svelte-h":!0}),_($)!=="svelte-qg1efp"&&($.innerHTML=x),r=c(i),j(U.$$.fragment,i),N=c(i),v=d(i,"P",{"data-svelte-h":!0}),_(v)!=="svelte-myl0l6"&&(v.innerHTML=z),p=c(i),j(J.$$.fragment,i),E=c(i),f=d(i,"P",{"data-svelte-h":!0}),_(f)!=="svelte-1l4vvgv"&&(f.innerHTML=B),K=c(i),j(H.$$.fragment,i),fs=c(i),L=d(i,"P",{"data-svelte-h":!0}),_(L)!=="svelte-145ej7o"&&(L.innerHTML=D),O=c(i),j(Q.$$.fragment,i),ss=c(i),S=d(i,"P",{"data-svelte-h":!0}),_(S)!=="svelte-bif4s6"&&(S.textContent=Ns),as=c(i),j(A.$$.fragment,i),ls=c(i),q=d(i,"P",{"data-svelte-h":!0}),_(q)!=="svelte-f4xo0m"&&(q.textContent=Es)},m(i,k){y(t,i,k),l(i,M,k),l(i,e,k),l(i,T,k),l(i,C,k),l(i,W,k),l(i,Z,k),l(i,I,k),y(V,i,k),l(i,R,k),l(i,$,k),l(i,r,k),y(U,i,k),l(i,N,k),l(i,v,k),l(i,p,k),y(J,i,k),l(i,E,k),l(i,f,k),l(i,K,k),y(H,i,k),l(i,fs,k),l(i,L,k),l(i,O,k),y(Q,i,k),l(i,ss,k),l(i,S,k),l(i,as,k),y(A,i,k),l(i,ls,k),l(i,q,k),ts=!0},p(i,k){const P={};k&2&&(P.$$scope={dirty:k,ctx:i}),t.$set(P)},i(i){ts||(u(t.$$.fragment,i),u(V.$$.fragment,i),u(U.$$.fragment,i),u(J.$$.fragment,i),u(H.$$.fragment,i),u(Q.$$.fragment,i),u(A.$$.fragment,i),ts=!0)},o(i){g(t.$$.fragment,i),g(V.$$.fragment,i),g(U.$$.fragment,i),g(J.$$.fragment,i),g(H.$$.fragment,i),g(Q.$$.fragment,i),g(A.$$.fragment,i),ts=!1},d(i){i&&(a(M),a(e),a(T),a(C),a(W),a(Z),a(I),a(R),a($),a(r),a(N),a(v),a(p),a(E),a(f),a(K),a(fs),a(L),a(O),a(ss),a(S),a(as),a(ls),a(q)),b(t,i),b(V,i),b(U,i),b(J,i),b(H,i),b(Q,i),b(A,i)}}}function yl(X){let t,M;return t=new zs({props:{$$slots:{default:[jl]},$$scope:{ctx:X}}}),{c(){h(t.$$.fragment)},l(e){j(t.$$.fragment,e)},m(e,o){y(t,e,o),M=!0},p(e,o){const T={};o&2&&(T.$$scope={dirty:o,ctx:e}),t.$set(T)},i(e){M||(u(t.$$.fragment,e),M=!0)},o(e){g(t.$$.fragment,e),M=!1},d(e){b(t,e)}}}function ul(X){let t,M='画像分類用のモデルを微調整する方法の詳細な例については、対応する <a href="https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/image_classification.ipynb" rel="nofollow">PyTorch ノートブック</a>';return{c(){t=w("p"),t.innerHTML=M},l(e){t=d(e,"P",{"data-svelte-h":!0}),_(t)!=="svelte-14b518"&&(t.innerHTML=M)},m(e,o){l(e,t,o)},p:Ms,d(e){e&&a(t)}}}function gl(X){let t,M="画像プロセッサをロードして画像を前処理し、<code>input</code>を PyTorch テンソルとして返します。",e,o,T,C,Y="入力をモデルに渡し、ロジットを返します。",W,Z,F,I,V="最も高い確率で予測されたラベルを取得し、モデルの <code>id2label</code> マッピングを使用してラベルに変換します。",R,$,x;return o=new G({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}}),Z=new G({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}}),$=new G({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(){t=w("p"),t.innerHTML=M,e=m(),h(o.$$.fragment),T=m(),C=w("p"),C.textContent=Y,W=m(),h(Z.$$.fragment),F=m(),I=w("p"),I.innerHTML=V,R=m(),h($.$$.fragment)},l(r){t=d(r,"P",{"data-svelte-h":!0}),_(t)!=="svelte-cy7wl9"&&(t.innerHTML=M),e=c(r),j(o.$$.fragment,r),T=c(r),C=d(r,"P",{"data-svelte-h":!0}),_(C)!=="svelte-jwtn5w"&&(C.textContent=Y),W=c(r),j(Z.$$.fragment,r),F=c(r),I=d(r,"P",{"data-svelte-h":!0}),_(I)!=="svelte-1y0o568"&&(I.innerHTML=V),R=c(r),j($.$$.fragment,r)},m(r,U){l(r,t,U),l(r,e,U),y(o,r,U),l(r,T,U),l(r,C,U),l(r,W,U),y(Z,r,U),l(r,F,U),l(r,I,U),l(r,R,U),y($,r,U),x=!0},p:Ms,i(r){x||(u(o.$$.fragment,r),u(Z.$$.fragment,r),u($.$$.fragment,r),x=!0)},o(r){g(o.$$.fragment,r),g(Z.$$.fragment,r),g($.$$.fragment,r),x=!1},d(r){r&&(a(t),a(e),a(T),a(C),a(W),a(F),a(I),a(R)),b(o,r),b(Z,r),b($,r)}}}function bl(X){let t,M;return t=new zs({props:{$$slots:{default:[gl]},$$scope:{ctx:X}}}),{c(){h(t.$$.fragment)},l(e){j(t.$$.fragment,e)},m(e,o){y(t,e,o),M=!0},p(e,o){const T={};o&2&&(T.$$scope={dirty:o,ctx:e}),t.$set(T)},i(e){M||(u(t.$$.fragment,e),M=!0)},o(e){g(t.$$.fragment,e),M=!1},d(e){b(t,e)}}}function Jl(X){let t,M="画像プロセッサをロードして画像を前処理し、<code>input</code>を TensorFlow テンソルとして返します。",e,o,T,C,Y="入力をモデルに渡し、ロジットを返します。",W,Z,F,I,V="最も高い確率で予測されたラベルを取得し、モデルの <code>id2label</code> マッピングを使用してラベルに変換します。",R,$,x;return o=new G({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}}),Z=new G({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}}),$=new G({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(){t=w("p"),t.innerHTML=M,e=m(),h(o.$$.fragment),T=m(),C=w("p"),C.textContent=Y,W=m(),h(Z.$$.fragment),F=m(),I=w("p"),I.innerHTML=V,R=m(),h($.$$.fragment)},l(r){t=d(r,"P",{"data-svelte-h":!0}),_(t)!=="svelte-e92fpp"&&(t.innerHTML=M),e=c(r),j(o.$$.fragment,r),T=c(r),C=d(r,"P",{"data-svelte-h":!0}),_(C)!=="svelte-jwtn5w"&&(C.textContent=Y),W=c(r),j(Z.$$.fragment,r),F=c(r),I=d(r,"P",{"data-svelte-h":!0}),_(I)!=="svelte-1y0o568"&&(I.innerHTML=V),R=c(r),j($.$$.fragment,r)},m(r,U){l(r,t,U),l(r,e,U),y(o,r,U),l(r,T,U),l(r,C,U),l(r,W,U),y(Z,r,U),l(r,F,U),l(r,I,U),l(r,R,U),y($,r,U),x=!0},p:Ms,i(r){x||(u(o.$$.fragment,r),u(Z.$$.fragment,r),u($.$$.fragment,r),x=!0)},o(r){g(o.$$.fragment,r),g(Z.$$.fragment,r),g($.$$.fragment,r),x=!1},d(r){r&&(a(t),a(e),a(T),a(C),a(W),a(F),a(I),a(R)),b(o,r),b(Z,r),b($,r)}}}function wl(X){let t,M;return t=new zs({props:{$$slots:{default:[Jl]},$$scope:{ctx:X}}}),{c(){h(t.$$.fragment)},l(e){j(t.$$.fragment,e)},m(e,o){y(t,e,o),M=!0},p(e,o){const T={};o&2&&(T.$$scope={dirty:o,ctx:e}),t.$set(T)},i(e){M||(u(t.$$.fragment,e),M=!0)},o(e){g(t.$$.fragment,e),M=!1},d(e){b(t,e)}}}function dl(X){let t,M,e,o,T,C,Y,W,Z,F,I,V=`画像分類では、画像にラベルまたはクラスを割り当てます。テキストや音声の分類とは異なり、入力は
画像を構成するピクセル値。損傷の検出など、画像分類には多くの用途があります
自然災害の後、作物の健康状態を監視したり、病気の兆候がないか医療画像をスクリーニングしたりするのに役立ちます。`,R,$,x="このガイドでは、次の方法を説明します。",r,U,N='<li><a href="https://huggingface.co/datasets/food101" rel="nofollow">Food-101</a> データセットの <a href="model_doc/vit">ViT</a> を微調整して、画像内の食品を分類します。</li> <li>微調整したモデルを推論に使用します。</li>',v,z,p,J,E="始める前に、必要なライブラリがすべてインストールされていることを確認してください。",f,B,K,H,fs="Hugging Face アカウントにログインして、モデルをアップロードしてコミュニティと共有することをお勧めします。プロンプトが表示されたら、トークンを入力してログインします。",L,D,O,Q,ss,S,Ns=`Datasets、🤗 データセット ライブラリから Food-101 データセットの小さいサブセットを読み込みます。これにより、次の機会が得られます
完全なデータセットのトレーニングにさらに時間を費やす前に、実験してすべてが機能することを確認してください。`,as,A,ls,q,Es="<code>train_test_split</code> メソッドを使用して、データセットの <code>train</code> 分割をトレイン セットとテスト セットに分割します。",ts,i,k,P,Ca="次に、例を見てみましょう。",Qs,hs,Ss,js,Ia="データセット内の各例には 2 つのフィールドがあります。",As,ys,ka="<li><code>image</code>: 食品の PIL 画像</li> <li><code>label</code>: 食品のラベルクラス</li>",qs,us,Wa=`モデルがラベル ID からラベル名を取得しやすくするために、ラベル名をマップする辞書を作成します。
整数への変換、またはその逆:`,Ls,gs,Ds,bs,va="これで、ラベル ID をラベル名に変換できるようになりました。",Ps,Js,Ks,ws,Os,ds,Ga="次のステップでは、ViT 画像プロセッサをロードして画像をテンソルに処理します。",sa,$s,aa,es,la,ns,ta,Ts,ea,Us,Xa=`トレーニング中にメトリクスを含めると、多くの場合、モデルのパフォーマンスを評価するのに役立ちます。すぐにロードできます
🤗 <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> 指標 (詳細については、🤗 評価 <a href="https://huggingface.co/docs/evaluate/a_quick_tour" rel="nofollow">クイック ツアー</a> を参照してくださいメトリクスをロードして計算する方法):`,na,_s,pa,Zs,Ra="次に、予測とラベルを <code>compute</code> に渡して精度を計算する関数を作成します。",ra,Cs,ma,Is,Ya="これで <code>compute_metrics</code>関数の準備が整いました。トレーニングを設定するときにこの関数に戻ります。",ca,ks,ia,ps,oa,rs,Ma,ms,fa,Ws,ha,vs,Fa="モデルを微調整したので、それを推論に使用できるようになりました。",ja,Gs,Va="推論を実行したい画像を読み込みます。",ya,Xs,ua,cs,xa='<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/beignets-task-guide.png" alt="image of beignets"/>',ga,Rs,Ba='推論用に微調整されたモデルを試す最も簡単な方法は、それを <a href="/docs/transformers/pr_29969/ja/main_classes/pipelines#transformers.pipeline">pipeline()</a> で使用することです。モデルを使用して画像分類用の<code>pipeline</code>をインスタンス化し、それに画像を渡します。',ba,Ys,Ja,Fs,za="必要に応じて、<code>pipeline</code>の結果を手動で複製することもできます。",wa,is,da,os,$a,Vs,Ta,Hs,Ua;return T=new Bs({props:{title:"Image classification",local:"image-classification",headingTag:"h1"}}),Y=new el({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/ja/image_classification.ipynb"},{label:"PyTorch",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/ja/pytorch/image_classification.ipynb"},{label:"TensorFlow",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/ja/tensorflow/image_classification.ipynb"},{label:"Mixed",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/ja/image_classification.ipynb"},{label:"PyTorch",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/ja/pytorch/image_classification.ipynb"},{label:"TensorFlow",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/ja/tensorflow/image_classification.ipynb"}]}}),Z=new tl({props:{id:"tjAIM7BOYhw"}}),z=new _a({props:{$$slots:{default:[pl]},$$scope:{ctx:X}}}),B=new G({props:{code:"cGlwJTIwaW5zdGFsbCUyMHRyYW5zZm9ybWVycyUyMGRhdGFzZXRzJTIwZXZhbHVhdGU=",highlighted:"pip install transformers datasets evaluate",wrap:!1}}),D=new G({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}}),Q=new Bs({props:{title:"Load Food-101 dataset",local:"load-food-101-dataset",headingTag:"h2"}}),A=new G({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}}),i=new G({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}}),hs=new G({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}}),gs=new G({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}}),Js=new G({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}}),ws=new Bs({props:{title:"Preprocess",local:"preprocess",headingTag:"h2"}}),$s=new G({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}}),es=new xs({props:{pytorch:!0,tensorflow:!1,jax:!1,$$slots:{pytorch:[ml]},$$scope:{ctx:X}}}),ns=new xs({props:{pytorch:!1,tensorflow:!0,jax:!1,$$slots:{tensorflow:[il]},$$scope:{ctx:X}}}),Ts=new Bs({props:{title:"Evaluate",local:"evaluate",headingTag:"h2"}}),_s=new G({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}}),Cs=new G({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}}),ks=new Bs({props:{title:"Train",local:"train",headingTag:"h2"}}),ps=new xs({props:{pytorch:!0,tensorflow:!1,jax:!1,$$slots:{pytorch:[fl]},$$scope:{ctx:X}}}),rs=new xs({props:{pytorch:!1,tensorflow:!0,jax:!1,$$slots:{tensorflow:[yl]},$$scope:{ctx:X}}}),ms=new _a({props:{$$slots:{default:[ul]},$$scope:{ctx:X}}}),Ws=new Bs({props:{title:"Inference",local:"inference",headingTag:"h2"}}),Xs=new G({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}}),Ys=new G({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}}),is=new xs({props:{pytorch:!0,tensorflow:!1,jax:!1,$$slots:{pytorch:[bl]},$$scope:{ctx:X}}}),os=new xs({props:{pytorch:!1,tensorflow:!0,jax:!1,$$slots:{tensorflow:[wl]},$$scope:{ctx:X}}}),Vs=new nl({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/ja/tasks/image_classification.md"}}),{c(){t=w("meta"),M=m(),e=w("p"),o=m(),h(T.$$.fragment),C=m(),h(Y.$$.fragment),W=m(),h(Z.$$.fragment),F=m(),I=w("p"),I.textContent=V,R=m(),$=w("p"),$.textContent=x,r=m(),U=w("ol"),U.innerHTML=N,v=m(),h(z.$$.fragment),p=m(),J=w("p"),J.textContent=E,f=m(),h(B.$$.fragment),K=m(),H=w("p"),H.textContent=fs,L=m(),h(D.$$.fragment),O=m(),h(Q.$$.fragment),ss=m(),S=w("p"),S.textContent=Ns,as=m(),h(A.$$.fragment),ls=m(),q=w("p"),q.innerHTML=Es,ts=m(),h(i.$$.fragment),k=m(),P=w("p"),P.textContent=Ca,Qs=m(),h(hs.$$.fragment),Ss=m(),js=w("p"),js.textContent=Ia,As=m(),ys=w("ul"),ys.innerHTML=ka,qs=m(),us=w("p"),us.textContent=Wa,Ls=m(),h(gs.$$.fragment),Ds=m(),bs=w("p"),bs.textContent=va,Ps=m(),h(Js.$$.fragment),Ks=m(),h(ws.$$.fragment),Os=m(),ds=w("p"),ds.textContent=Ga,sa=m(),h($s.$$.fragment),aa=m(),h(es.$$.fragment),la=m(),h(ns.$$.fragment),ta=m(),h(Ts.$$.fragment),ea=m(),Us=w("p"),Us.innerHTML=Xa,na=m(),h(_s.$$.fragment),pa=m(),Zs=w("p"),Zs.innerHTML=Ra,ra=m(),h(Cs.$$.fragment),ma=m(),Is=w("p"),Is.innerHTML=Ya,ca=m(),h(ks.$$.fragment),ia=m(),h(ps.$$.fragment),oa=m(),h(rs.$$.fragment),Ma=m(),h(ms.$$.fragment),fa=m(),h(Ws.$$.fragment),ha=m(),vs=w("p"),vs.textContent=Fa,ja=m(),Gs=w("p"),Gs.textContent=Va,ya=m(),h(Xs.$$.fragment),ua=m(),cs=w("div"),cs.innerHTML=xa,ga=m(),Rs=w("p"),Rs.innerHTML=Ba,ba=m(),h(Ys.$$.fragment),Ja=m(),Fs=w("p"),Fs.innerHTML=za,wa=m(),h(is.$$.fragment),da=m(),h(os.$$.fragment),$a=m(),h(Vs.$$.fragment),Ta=m(),Hs=w("p"),this.h()},l(s){const n=al("svelte-u9bgzb",document.head);t=d(n,"META",{name:!0,content:!0}),n.forEach(a),M=c(s),e=d(s,"P",{}),Da(e).forEach(a),o=c(s),j(T.$$.fragment,s),C=c(s),j(Y.$$.fragment,s),W=c(s),j(Z.$$.fragment,s),F=c(s),I=d(s,"P",{"data-svelte-h":!0}),_(I)!=="svelte-33aqnx"&&(I.textContent=V),R=c(s),$=d(s,"P",{"data-svelte-h":!0}),_($)!=="svelte-w5jzhi"&&($.textContent=x),r=c(s),U=d(s,"OL",{"data-svelte-h":!0}),_(U)!=="svelte-1y90kv1"&&(U.innerHTML=N),v=c(s),j(z.$$.fragment,s),p=c(s),J=d(s,"P",{"data-svelte-h":!0}),_(J)!=="svelte-1lya3k8"&&(J.textContent=E),f=c(s),j(B.$$.fragment,s),K=c(s),H=d(s,"P",{"data-svelte-h":!0}),_(H)!=="svelte-1bh3yv"&&(H.textContent=fs),L=c(s),j(D.$$.fragment,s),O=c(s),j(Q.$$.fragment,s),ss=c(s),S=d(s,"P",{"data-svelte-h":!0}),_(S)!=="svelte-1ncb48h"&&(S.textContent=Ns),as=c(s),j(A.$$.fragment,s),ls=c(s),q=d(s,"P",{"data-svelte-h":!0}),_(q)!=="svelte-m4w3yq"&&(q.innerHTML=Es),ts=c(s),j(i.$$.fragment,s),k=c(s),P=d(s,"P",{"data-svelte-h":!0}),_(P)!=="svelte-1r6oj5w"&&(P.textContent=Ca),Qs=c(s),j(hs.$$.fragment,s),Ss=c(s),js=d(s,"P",{"data-svelte-h":!0}),_(js)!=="svelte-24qbwx"&&(js.textContent=Ia),As=c(s),ys=d(s,"UL",{"data-svelte-h":!0}),_(ys)!=="svelte-8eiv2s"&&(ys.innerHTML=ka),qs=c(s),us=d(s,"P",{"data-svelte-h":!0}),_(us)!=="svelte-ts333s"&&(us.textContent=Wa),Ls=c(s),j(gs.$$.fragment,s),Ds=c(s),bs=d(s,"P",{"data-svelte-h":!0}),_(bs)!=="svelte-wrnhuq"&&(bs.textContent=va),Ps=c(s),j(Js.$$.fragment,s),Ks=c(s),j(ws.$$.fragment,s),Os=c(s),ds=d(s,"P",{"data-svelte-h":!0}),_(ds)!=="svelte-13jkt14"&&(ds.textContent=Ga),sa=c(s),j($s.$$.fragment,s),aa=c(s),j(es.$$.fragment,s),la=c(s),j(ns.$$.fragment,s),ta=c(s),j(Ts.$$.fragment,s),ea=c(s),Us=d(s,"P",{"data-svelte-h":!0}),_(Us)!=="svelte-1x40z70"&&(Us.innerHTML=Xa),na=c(s),j(_s.$$.fragment,s),pa=c(s),Zs=d(s,"P",{"data-svelte-h":!0}),_(Zs)!=="svelte-o90xg4"&&(Zs.innerHTML=Ra),ra=c(s),j(Cs.$$.fragment,s),ma=c(s),Is=d(s,"P",{"data-svelte-h":!0}),_(Is)!=="svelte-7bx6io"&&(Is.innerHTML=Ya),ca=c(s),j(ks.$$.fragment,s),ia=c(s),j(ps.$$.fragment,s),oa=c(s),j(rs.$$.fragment,s),Ma=c(s),j(ms.$$.fragment,s),fa=c(s),j(Ws.$$.fragment,s),ha=c(s),vs=d(s,"P",{"data-svelte-h":!0}),_(vs)!=="svelte-cyrfc8"&&(vs.textContent=Fa),ja=c(s),Gs=d(s,"P",{"data-svelte-h":!0}),_(Gs)!=="svelte-14onr13"&&(Gs.textContent=Va),ya=c(s),j(Xs.$$.fragment,s),ua=c(s),cs=d(s,"DIV",{class:!0,"data-svelte-h":!0}),_(cs)!=="svelte-pnh0xy"&&(cs.innerHTML=xa),ga=c(s),Rs=d(s,"P",{"data-svelte-h":!0}),_(Rs)!=="svelte-esezkf"&&(Rs.innerHTML=Ba),ba=c(s),j(Ys.$$.fragment,s),Ja=c(s),Fs=d(s,"P",{"data-svelte-h":!0}),_(Fs)!=="svelte-p649vi"&&(Fs.innerHTML=za),wa=c(s),j(is.$$.fragment,s),da=c(s),j(os.$$.fragment,s),$a=c(s),j(Vs.$$.fragment,s),Ta=c(s),Hs=d(s,"P",{}),Da(Hs).forEach(a),this.h()},h(){Za(t,"name","hf:doc:metadata"),Za(t,"content",$l),Za(cs,"class","flex justify-center")},m(s,n){ll(document.head,t),l(s,M,n),l(s,e,n),l(s,o,n),y(T,s,n),l(s,C,n),y(Y,s,n),l(s,W,n),y(Z,s,n),l(s,F,n),l(s,I,n),l(s,R,n),l(s,$,n),l(s,r,n),l(s,U,n),l(s,v,n),y(z,s,n),l(s,p,n),l(s,J,n),l(s,f,n),y(B,s,n),l(s,K,n),l(s,H,n),l(s,L,n),y(D,s,n),l(s,O,n),y(Q,s,n),l(s,ss,n),l(s,S,n),l(s,as,n),y(A,s,n),l(s,ls,n),l(s,q,n),l(s,ts,n),y(i,s,n),l(s,k,n),l(s,P,n),l(s,Qs,n),y(hs,s,n),l(s,Ss,n),l(s,js,n),l(s,As,n),l(s,ys,n),l(s,qs,n),l(s,us,n),l(s,Ls,n),y(gs,s,n),l(s,Ds,n),l(s,bs,n),l(s,Ps,n),y(Js,s,n),l(s,Ks,n),y(ws,s,n),l(s,Os,n),l(s,ds,n),l(s,sa,n),y($s,s,n),l(s,aa,n),y(es,s,n),l(s,la,n),y(ns,s,n),l(s,ta,n),y(Ts,s,n),l(s,ea,n),l(s,Us,n),l(s,na,n),y(_s,s,n),l(s,pa,n),l(s,Zs,n),l(s,ra,n),y(Cs,s,n),l(s,ma,n),l(s,Is,n),l(s,ca,n),y(ks,s,n),l(s,ia,n),y(ps,s,n),l(s,oa,n),y(rs,s,n),l(s,Ma,n),y(ms,s,n),l(s,fa,n),y(Ws,s,n),l(s,ha,n),l(s,vs,n),l(s,ja,n),l(s,Gs,n),l(s,ya,n),y(Xs,s,n),l(s,ua,n),l(s,cs,n),l(s,ga,n),l(s,Rs,n),l(s,ba,n),y(Ys,s,n),l(s,Ja,n),l(s,Fs,n),l(s,wa,n),y(is,s,n),l(s,da,n),y(os,s,n),l(s,$a,n),y(Vs,s,n),l(s,Ta,n),l(s,Hs,n),Ua=!0},p(s,[n]){const Na={};n&2&&(Na.$$scope={dirty:n,ctx:s}),z.$set(Na);const Ea={};n&2&&(Ea.$$scope={dirty:n,ctx:s}),es.$set(Ea);const Ha={};n&2&&(Ha.$$scope={dirty:n,ctx:s}),ns.$set(Ha);const Qa={};n&2&&(Qa.$$scope={dirty:n,ctx:s}),ps.$set(Qa);const Sa={};n&2&&(Sa.$$scope={dirty:n,ctx:s}),rs.$set(Sa);const Aa={};n&2&&(Aa.$$scope={dirty:n,ctx:s}),ms.$set(Aa);const qa={};n&2&&(qa.$$scope={dirty:n,ctx:s}),is.$set(qa);const La={};n&2&&(La.$$scope={dirty:n,ctx:s}),os.$set(La)},i(s){Ua||(u(T.$$.fragment,s),u(Y.$$.fragment,s),u(Z.$$.fragment,s),u(z.$$.fragment,s),u(B.$$.fragment,s),u(D.$$.fragment,s),u(Q.$$.fragment,s),u(A.$$.fragment,s),u(i.$$.fragment,s),u(hs.$$.fragment,s),u(gs.$$.fragment,s),u(Js.$$.fragment,s),u(ws.$$.fragment,s),u($s.$$.fragment,s),u(es.$$.fragment,s),u(ns.$$.fragment,s),u(Ts.$$.fragment,s),u(_s.$$.fragment,s),u(Cs.$$.fragment,s),u(ks.$$.fragment,s),u(ps.$$.fragment,s),u(rs.$$.fragment,s),u(ms.$$.fragment,s),u(Ws.$$.fragment,s),u(Xs.$$.fragment,s),u(Ys.$$.fragment,s),u(is.$$.fragment,s),u(os.$$.fragment,s),u(Vs.$$.fragment,s),Ua=!0)},o(s){g(T.$$.fragment,s),g(Y.$$.fragment,s),g(Z.$$.fragment,s),g(z.$$.fragment,s),g(B.$$.fragment,s),g(D.$$.fragment,s),g(Q.$$.fragment,s),g(A.$$.fragment,s),g(i.$$.fragment,s),g(hs.$$.fragment,s),g(gs.$$.fragment,s),g(Js.$$.fragment,s),g(ws.$$.fragment,s),g($s.$$.fragment,s),g(es.$$.fragment,s),g(ns.$$.fragment,s),g(Ts.$$.fragment,s),g(_s.$$.fragment,s),g(Cs.$$.fragment,s),g(ks.$$.fragment,s),g(ps.$$.fragment,s),g(rs.$$.fragment,s),g(ms.$$.fragment,s),g(Ws.$$.fragment,s),g(Xs.$$.fragment,s),g(Ys.$$.fragment,s),g(is.$$.fragment,s),g(os.$$.fragment,s),g(Vs.$$.fragment,s),Ua=!1},d(s){s&&(a(M),a(e),a(o),a(C),a(W),a(F),a(I),a(R),a($),a(r),a(U),a(v),a(p),a(J),a(f),a(K),a(H),a(L),a(O),a(ss),a(S),a(as),a(ls),a(q),a(ts),a(k),a(P),a(Qs),a(Ss),a(js),a(As),a(ys),a(qs),a(us),a(Ls),a(Ds),a(bs),a(Ps),a(Ks),a(Os),a(ds),a(sa),a(aa),a(la),a(ta),a(ea),a(Us),a(na),a(pa),a(Zs),a(ra),a(ma),a(Is),a(ca),a(ia),a(oa),a(Ma),a(fa),a(ha),a(vs),a(ja),a(Gs),a(ya),a(ua),a(cs),a(ga),a(Rs),a(ba),a(Ja),a(Fs),a(wa),a(da),a($a),a(Ta),a(Hs)),a(t),b(T,s),b(Y,s),b(Z,s),b(z,s),b(B,s),b(D,s),b(Q,s),b(A,s),b(i,s),b(hs,s),b(gs,s),b(Js,s),b(ws,s),b($s,s),b(es,s),b(ns,s),b(Ts,s),b(_s,s),b(Cs,s),b(ks,s),b(ps,s),b(rs,s),b(ms,s),b(Ws,s),b(Xs,s),b(Ys,s),b(is,s),b(os,s),b(Vs,s)}}}const $l='{"title":"Image classification","local":"image-classification","sections":[{"title":"Load Food-101 dataset","local":"load-food-101-dataset","sections":[],"depth":2},{"title":"Preprocess","local":"preprocess","sections":[],"depth":2},{"title":"Evaluate","local":"evaluate","sections":[],"depth":2},{"title":"Train","local":"train","sections":[],"depth":2},{"title":"Inference","local":"inference","sections":[],"depth":2}],"depth":1}';function Tl(X){return Ka(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Gl extends Oa{constructor(t){super(),sl(this,t,Tl,dl,Pa,{})}}export{Gl as component};
