import{s as Pa,o as Ka,n as Ms}from"../chunks/scheduler.9bc65507.js";import{S as Oa,i as st,g as w,s as r,r as h,A as at,h as d,f as a,c,j as Da,u as j,x as _,k as Za,y as tt,a as t,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 lt}from"../chunks/Youtube.e1129c6f.js";import{C as G}from"../chunks/CodeBlock.54a9f38d.js";import{D as et}from"../chunks/DocNotebookDropdown.41f65cb5.js";import{F as xs,M as zs}from"../chunks/Markdown.8ab98a13.js";import{H as Bs,E as nt}from"../chunks/EditOnGithub.922df6ba.js";function pt(X){let l,M='このタスクと互換性のあるすべてのアーキテクチャとチェックポイントを確認するには、<a href="https://huggingface.co/tasks/image-classification" rel="nofollow">タスクページ</a> を確認することをお勧めします。';return{c(){l=w("p"),l.innerHTML=M},l(e){l=d(e,"P",{"data-svelte-h":!0}),_(l)!=="svelte-kxk9fo"&&(l.innerHTML=M)},m(e,o){t(e,l,o)},p:Ms,d(e){e&&a(l)}}}function mt(X){let l,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> メソッドを使用します。変換は、データセットの要素を読み込むときにオンザフライで適用されます。",m,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(){l=w("p"),l.innerHTML=M,e=r(),o=w("p"),o.textContent=T,C=r(),h(Y.$$.fragment),W=r(),Z=w("p"),Z.innerHTML=F,I=r(),h(V.$$.fragment),R=r(),$=w("p"),$.innerHTML=x,m=r(),h(U.$$.fragment),N=r(),v=w("p"),v.innerHTML=z,p=r(),h(J.$$.fragment)},l(f){l=d(f,"P",{"data-svelte-h":!0}),_(l)!=="svelte-9lrlsl"&&(l.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),m=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){t(f,l,B),t(f,e,B),t(f,o,B),t(f,C,B),y(Y,f,B),t(f,W,B),t(f,Z,B),t(f,I,B),y(V,f,B),t(f,R,B),t(f,$,B),t(f,m,B),y(U,f,B),t(f,N,B),t(f,v,B),t(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(l),a(e),a(o),a(C),a(W),a(Z),a(I),a(R),a($),a(m),a(N),a(v),a(p)),b(Y,f),b(V,f),b(U,f),b(J,f)}}}function rt(X){let l,M;return l=new zs({props:{$$slots:{default:[mt]},$$scope:{ctx:X}}}),{c(){h(l.$$.fragment)},l(e){j(l.$$.fragment,e)},m(e,o){y(l,e,o),M=!0},p(e,o){const T={};o&2&&(T.$$scope={dirty:o,ctx:e}),l.$set(T)},i(e){M||(u(l.$$.fragment,e),M=!0)},o(e){g(l.$$.fragment,e),M=!1},d(e){b(l,e)}}}function ct(X){let l,M=`過剰適合を回避し、モデルをより堅牢にするために、データセットのトレーニング部分にデータ拡張を追加します。
ここでは、Keras 前処理レイヤーを使用してトレーニング データの変換 (データ拡張を含む) を定義します。
検証データの変換 (中央のトリミング、サイズ変更、正規化のみ)。 <code>tf.image</code> または
他のライブラリでも構いません。`,e,o,T,C,Y="次に、一度に 1 つの画像ではなく、画像のバッチに適切な変換を適用する関数を作成します。",W,Z,F,I,V="🤗 データセット <code>set_transform</code> を使用して、その場で変換を適用します。",R,$,x,m,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(){l=w("p"),l.innerHTML=M,e=r(),h(o.$$.fragment),T=r(),C=w("p"),C.textContent=Y,W=r(),h(Z.$$.fragment),F=r(),I=w("p"),I.innerHTML=V,R=r(),h($.$$.fragment),x=r(),m=w("p"),m.innerHTML=U,N=r(),h(v.$$.fragment)},l(p){l=d(p,"P",{"data-svelte-h":!0}),_(l)!=="svelte-1bftz3e"&&(l.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),m=d(p,"P",{"data-svelte-h":!0}),_(m)!=="svelte-zm6h83"&&(m.innerHTML=U),N=c(p),j(v.$$.fragment,p)},m(p,J){t(p,l,J),t(p,e,J),y(o,p,J),t(p,T,J),t(p,C,J),t(p,W,J),y(Z,p,J),t(p,F,J),t(p,I,J),t(p,R,J),y($,p,J),t(p,x,J),t(p,m,J),t(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(l),a(e),a(T),a(C),a(W),a(F),a(I),a(R),a(x),a(m),a(N)),b(o,p),b(Z,p),b($,p),b(v,p)}}}function it(X){let l,M;return l=new zs({props:{$$slots:{default:[ct]},$$scope:{ctx:X}}}),{c(){h(l.$$.fragment)},l(e){j(l.$$.fragment,e)},m(e,o){y(l,e,o),M=!0},p(e,o){const T={};o&2&&(T.$$scope={dirty:o,ctx:e}),l.$set(T)},i(e){M||(u(l.$$.fragment,e),M=!0)},o(e){g(l.$$.fragment,e),M=!1},d(e){b(l,e)}}}function ot(X){let l,M='<a href="/docs/transformers/main/ja/main_classes/trainer#transformers.Trainer">Trainer</a> を使用したモデルの微調整に慣れていない場合は、<a href="../training#train-with-pytorch-trainer">こちら</a> の基本的なチュートリアルをご覧ください。';return{c(){l=w("p"),l.innerHTML=M},l(e){l=d(e,"P",{"data-svelte-h":!0}),_(l)!=="svelte-u6v1yb"&&(l.innerHTML=M)},m(e,o){t(e,l,o)},p:Ms,d(e){e&&a(l)}}}function Mt(X){let l,M,e,o='これでモデルのトレーニングを開始する準備が整いました。 <a href="/docs/transformers/main/ja/model_doc/auto#transformers.AutoModelForImageClassification">AutoModelForImageClassification</a> を使用して ViT をロードします。ラベルの数と予想されるラベルの数、およびラベル マッピングを指定します。',T,C,Y,W,Z="この時点で残っているステップは 3 つだけです。",F,I,V='<li><a href="/docs/transformers/main/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/main/ja/main_classes/trainer#transformers.Trainer">Trainer</a> は精度を評価し、トレーニング チェックポイントを保存します。</li> <li>トレーニング引数を、モデル、データセット、トークナイザー、データ照合器、および <code>compute_metrics</code> 関数とともに <a href="/docs/transformers/main/ja/main_classes/trainer#transformers.Trainer">Trainer</a> に渡します。</li> <li><a href="/docs/transformers/main/ja/main_classes/trainer#transformers.Trainer.train">train()</a> を呼び出してモデルを微調整します。</li>',R,$,x,m,U='トレーニングが完了したら、 <a href="/docs/transformers/main/ja/main_classes/trainer#transformers.Trainer.push_to_hub">push_to_hub()</a> メソッドを使用してモデルをハブに共有し、誰もがモデルを使用できるようにします。',N,v,z;return l=new _a({props:{$$slots:{default:[ot]},$$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(l.$$.fragment),M=r(),e=w("p"),e.innerHTML=o,T=r(),h(C.$$.fragment),Y=r(),W=w("p"),W.textContent=Z,F=r(),I=w("ol"),I.innerHTML=V,R=r(),h($.$$.fragment),x=r(),m=w("p"),m.innerHTML=U,N=r(),h(v.$$.fragment)},l(p){j(l.$$.fragment,p),M=c(p),e=d(p,"P",{"data-svelte-h":!0}),_(e)!=="svelte-1wsijgh"&&(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-gv3xzt"&&(I.innerHTML=V),R=c(p),j($.$$.fragment,p),x=c(p),m=d(p,"P",{"data-svelte-h":!0}),_(m)!=="svelte-ngexm3"&&(m.innerHTML=U),N=c(p),j(v.$$.fragment,p)},m(p,J){y(l,p,J),t(p,M,J),t(p,e,J),t(p,T,J),y(C,p,J),t(p,Y,J),t(p,W,J),t(p,F,J),t(p,I,J),t(p,R,J),y($,p,J),t(p,x,J),t(p,m,J),t(p,N,J),y(v,p,J),z=!0},p(p,J){const E={};J&2&&(E.$$scope={dirty:J,ctx:p}),l.$set(E)},i(p){z||(u(l.$$.fragment,p),u(C.$$.fragment,p),u($.$$.fragment,p),u(v.$$.fragment,p),z=!0)},o(p){g(l.$$.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(m),a(N)),b(l,p),b(C,p),b($,p),b(v,p)}}}function ft(X){let l,M;return l=new zs({props:{$$slots:{default:[Mt]},$$scope:{ctx:X}}}),{c(){h(l.$$.fragment)},l(e){j(l.$$.fragment,e)},m(e,o){y(l,e,o),M=!0},p(e,o){const T={};o&2&&(T.$$scope={dirty:o,ctx:e}),l.$set(T)},i(e){M||(u(l.$$.fragment,e),M=!0)},o(e){g(l.$$.fragment,e),M=!1},d(e){b(l,e)}}}function ht(X){let l,M='Keras を使用したモデルの微調整に慣れていない場合は、まず <a href="./training#train-a-tensorflow-model-with-keras">基本チュートリアル</a> を確認してください。';return{c(){l=w("p"),l.innerHTML=M},l(e){l=d(e,"P",{"data-svelte-h":!0}),_(l)!=="svelte-m0v6mc"&&(l.innerHTML=M)},m(e,o){t(e,l,o)},p:Ms,d(e){e&&a(l)}}}function jt(X){let l,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/main/ja/model_doc/auto#transformers.TFAutoModelForImageClassification">TFAutoModelForImageClassification</a> を使用して ViT を読み込みます。',m,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,ts,q,Es="おめでとう！モデルを微調整し、🤗 Hub で共有しました。これで推論に使用できるようになりました。",ls;return l=new _a({props:{$$slots:{default:[ht]},$$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(l.$$.fragment),M=r(),e=w("p"),e.textContent=o,T=r(),C=w("ol"),C.innerHTML=Y,W=r(),Z=w("p"),Z.textContent=F,I=r(),h(V.$$.fragment),R=r(),$=w("p"),$.innerHTML=x,m=r(),h(U.$$.fragment),N=r(),v=w("p"),v.innerHTML=z,p=r(),h(J.$$.fragment),E=r(),f=w("p"),f.innerHTML=B,K=r(),h(H.$$.fragment),fs=r(),L=w("p"),L.innerHTML=D,O=r(),h(Q.$$.fragment),ss=r(),S=w("p"),S.textContent=Ns,as=r(),h(A.$$.fragment),ts=r(),q=w("p"),q.textContent=Es},l(i){j(l.$$.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-qyawgk"&&($.innerHTML=x),m=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),ts=c(i),q=d(i,"P",{"data-svelte-h":!0}),_(q)!=="svelte-f4xo0m"&&(q.textContent=Es)},m(i,k){y(l,i,k),t(i,M,k),t(i,e,k),t(i,T,k),t(i,C,k),t(i,W,k),t(i,Z,k),t(i,I,k),y(V,i,k),t(i,R,k),t(i,$,k),t(i,m,k),y(U,i,k),t(i,N,k),t(i,v,k),t(i,p,k),y(J,i,k),t(i,E,k),t(i,f,k),t(i,K,k),y(H,i,k),t(i,fs,k),t(i,L,k),t(i,O,k),y(Q,i,k),t(i,ss,k),t(i,S,k),t(i,as,k),y(A,i,k),t(i,ts,k),t(i,q,k),ls=!0},p(i,k){const P={};k&2&&(P.$$scope={dirty:k,ctx:i}),l.$set(P)},i(i){ls||(u(l.$$.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),ls=!0)},o(i){g(l.$$.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),ls=!1},d(i){i&&(a(M),a(e),a(T),a(C),a(W),a(Z),a(I),a(R),a($),a(m),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(ts),a(q)),b(l,i),b(V,i),b(U,i),b(J,i),b(H,i),b(Q,i),b(A,i)}}}function yt(X){let l,M;return l=new zs({props:{$$slots:{default:[jt]},$$scope:{ctx:X}}}),{c(){h(l.$$.fragment)},l(e){j(l.$$.fragment,e)},m(e,o){y(l,e,o),M=!0},p(e,o){const T={};o&2&&(T.$$scope={dirty:o,ctx:e}),l.$set(T)},i(e){M||(u(l.$$.fragment,e),M=!0)},o(e){g(l.$$.fragment,e),M=!1},d(e){b(l,e)}}}function ut(X){let l,M='画像分類用のモデルを微調整する方法の詳細な例については、対応する <a href="https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/image_classification.ipynb" rel="nofollow">PyTorch ノートブック</a>';return{c(){l=w("p"),l.innerHTML=M},l(e){l=d(e,"P",{"data-svelte-h":!0}),_(l)!=="svelte-14b518"&&(l.innerHTML=M)},m(e,o){t(e,l,o)},p:Ms,d(e){e&&a(l)}}}function gt(X){let l,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(){l=w("p"),l.innerHTML=M,e=r(),h(o.$$.fragment),T=r(),C=w("p"),C.textContent=Y,W=r(),h(Z.$$.fragment),F=r(),I=w("p"),I.innerHTML=V,R=r(),h($.$$.fragment)},l(m){l=d(m,"P",{"data-svelte-h":!0}),_(l)!=="svelte-cy7wl9"&&(l.innerHTML=M),e=c(m),j(o.$$.fragment,m),T=c(m),C=d(m,"P",{"data-svelte-h":!0}),_(C)!=="svelte-jwtn5w"&&(C.textContent=Y),W=c(m),j(Z.$$.fragment,m),F=c(m),I=d(m,"P",{"data-svelte-h":!0}),_(I)!=="svelte-1y0o568"&&(I.innerHTML=V),R=c(m),j($.$$.fragment,m)},m(m,U){t(m,l,U),t(m,e,U),y(o,m,U),t(m,T,U),t(m,C,U),t(m,W,U),y(Z,m,U),t(m,F,U),t(m,I,U),t(m,R,U),y($,m,U),x=!0},p:Ms,i(m){x||(u(o.$$.fragment,m),u(Z.$$.fragment,m),u($.$$.fragment,m),x=!0)},o(m){g(o.$$.fragment,m),g(Z.$$.fragment,m),g($.$$.fragment,m),x=!1},d(m){m&&(a(l),a(e),a(T),a(C),a(W),a(F),a(I),a(R)),b(o,m),b(Z,m),b($,m)}}}function bt(X){let l,M;return l=new zs({props:{$$slots:{default:[gt]},$$scope:{ctx:X}}}),{c(){h(l.$$.fragment)},l(e){j(l.$$.fragment,e)},m(e,o){y(l,e,o),M=!0},p(e,o){const T={};o&2&&(T.$$scope={dirty:o,ctx:e}),l.$set(T)},i(e){M||(u(l.$$.fragment,e),M=!0)},o(e){g(l.$$.fragment,e),M=!1},d(e){b(l,e)}}}function Jt(X){let l,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(){l=w("p"),l.innerHTML=M,e=r(),h(o.$$.fragment),T=r(),C=w("p"),C.textContent=Y,W=r(),h(Z.$$.fragment),F=r(),I=w("p"),I.innerHTML=V,R=r(),h($.$$.fragment)},l(m){l=d(m,"P",{"data-svelte-h":!0}),_(l)!=="svelte-e92fpp"&&(l.innerHTML=M),e=c(m),j(o.$$.fragment,m),T=c(m),C=d(m,"P",{"data-svelte-h":!0}),_(C)!=="svelte-jwtn5w"&&(C.textContent=Y),W=c(m),j(Z.$$.fragment,m),F=c(m),I=d(m,"P",{"data-svelte-h":!0}),_(I)!=="svelte-1y0o568"&&(I.innerHTML=V),R=c(m),j($.$$.fragment,m)},m(m,U){t(m,l,U),t(m,e,U),y(o,m,U),t(m,T,U),t(m,C,U),t(m,W,U),y(Z,m,U),t(m,F,U),t(m,I,U),t(m,R,U),y($,m,U),x=!0},p:Ms,i(m){x||(u(o.$$.fragment,m),u(Z.$$.fragment,m),u($.$$.fragment,m),x=!0)},o(m){g(o.$$.fragment,m),g(Z.$$.fragment,m),g($.$$.fragment,m),x=!1},d(m){m&&(a(l),a(e),a(T),a(C),a(W),a(F),a(I),a(R)),b(o,m),b(Z,m),b($,m)}}}function wt(X){let l,M;return l=new zs({props:{$$slots:{default:[Jt]},$$scope:{ctx:X}}}),{c(){h(l.$$.fragment)},l(e){j(l.$$.fragment,e)},m(e,o){y(l,e,o),M=!0},p(e,o){const T={};o&2&&(T.$$scope={dirty:o,ctx:e}),l.$set(T)},i(e){M||(u(l.$$.fragment,e),M=!0)},o(e){g(l.$$.fragment,e),M=!1},d(e){b(l,e)}}}function dt(X){let l,M,e,o,T,C,Y,W,Z,F,I,V=`画像分類では、画像にラベルまたはクラスを割り当てます。テキストや音声の分類とは異なり、入力は
画像を構成するピクセル値。損傷の検出など、画像分類には多くの用途があります
自然災害の後、作物の健康状態を監視したり、病気の兆候がないか医療画像をスクリーニングしたりするのに役立ちます。`,R,$,x="このガイドでは、次の方法を説明します。",m,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,ts,q,Es="<code>train_test_split</code> メソッドを使用して、データセットの <code>train</code> 分割をトレイン セットとテスト セットに分割します。",ls,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,ta,ns,la,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> に渡して精度を計算する関数を作成します。",ma,Cs,ra,Is,Ya="これで <code>compute_metrics</code>関数の準備が整いました。トレーニングを設定するときにこの関数に戻ります。",ca,ks,ia,ps,oa,ms,Ma,rs,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/main/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 et({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 lt({props:{id:"tjAIM7BOYhw"}}),z=new _a({props:{$$slots:{default:[pt]},$$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:[rt]},$$scope:{ctx:X}}}),ns=new xs({props:{pytorch:!1,tensorflow:!0,jax:!1,$$slots:{tensorflow:[it]},$$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:[ft]},$$scope:{ctx:X}}}),ms=new xs({props:{pytorch:!1,tensorflow:!0,jax:!1,$$slots:{tensorflow:[yt]},$$scope:{ctx:X}}}),rs=new _a({props:{$$slots:{default:[ut]},$$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:[bt]},$$scope:{ctx:X}}}),os=new xs({props:{pytorch:!1,tensorflow:!0,jax:!1,$$slots:{tensorflow:[wt]},$$scope:{ctx:X}}}),Vs=new nt({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/ja/tasks/image_classification.md"}}),{c(){l=w("meta"),M=r(),e=w("p"),o=r(),h(T.$$.fragment),C=r(),h(Y.$$.fragment),W=r(),h(Z.$$.fragment),F=r(),I=w("p"),I.textContent=V,R=r(),$=w("p"),$.textContent=x,m=r(),U=w("ol"),U.innerHTML=N,v=r(),h(z.$$.fragment),p=r(),J=w("p"),J.textContent=E,f=r(),h(B.$$.fragment),K=r(),H=w("p"),H.textContent=fs,L=r(),h(D.$$.fragment),O=r(),h(Q.$$.fragment),ss=r(),S=w("p"),S.textContent=Ns,as=r(),h(A.$$.fragment),ts=r(),q=w("p"),q.innerHTML=Es,ls=r(),h(i.$$.fragment),k=r(),P=w("p"),P.textContent=Ca,Qs=r(),h(hs.$$.fragment),Ss=r(),js=w("p"),js.textContent=Ia,As=r(),ys=w("ul"),ys.innerHTML=ka,qs=r(),us=w("p"),us.textContent=Wa,Ls=r(),h(gs.$$.fragment),Ds=r(),bs=w("p"),bs.textContent=va,Ps=r(),h(Js.$$.fragment),Ks=r(),h(ws.$$.fragment),Os=r(),ds=w("p"),ds.textContent=Ga,sa=r(),h($s.$$.fragment),aa=r(),h(es.$$.fragment),ta=r(),h(ns.$$.fragment),la=r(),h(Ts.$$.fragment),ea=r(),Us=w("p"),Us.innerHTML=Xa,na=r(),h(_s.$$.fragment),pa=r(),Zs=w("p"),Zs.innerHTML=Ra,ma=r(),h(Cs.$$.fragment),ra=r(),Is=w("p"),Is.innerHTML=Ya,ca=r(),h(ks.$$.fragment),ia=r(),h(ps.$$.fragment),oa=r(),h(ms.$$.fragment),Ma=r(),h(rs.$$.fragment),fa=r(),h(Ws.$$.fragment),ha=r(),vs=w("p"),vs.textContent=Fa,ja=r(),Gs=w("p"),Gs.textContent=Va,ya=r(),h(Xs.$$.fragment),ua=r(),cs=w("div"),cs.innerHTML=xa,ga=r(),Rs=w("p"),Rs.innerHTML=Ba,ba=r(),h(Ys.$$.fragment),Ja=r(),Fs=w("p"),Fs.innerHTML=za,wa=r(),h(is.$$.fragment),da=r(),h(os.$$.fragment),$a=r(),h(Vs.$$.fragment),Ta=r(),Hs=w("p"),this.h()},l(s){const n=at("svelte-u9bgzb",document.head);l=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),m=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),ts=c(s),q=d(s,"P",{"data-svelte-h":!0}),_(q)!=="svelte-m4w3yq"&&(q.innerHTML=Es),ls=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),ta=c(s),j(ns.$$.fragment,s),la=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),ma=c(s),j(Cs.$$.fragment,s),ra=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(ms.$$.fragment,s),Ma=c(s),j(rs.$$.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-hu6m5y"&&(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(l,"name","hf:doc:metadata"),Za(l,"content",$t),Za(cs,"class","flex justify-center")},m(s,n){tt(document.head,l),t(s,M,n),t(s,e,n),t(s,o,n),y(T,s,n),t(s,C,n),y(Y,s,n),t(s,W,n),y(Z,s,n),t(s,F,n),t(s,I,n),t(s,R,n),t(s,$,n),t(s,m,n),t(s,U,n),t(s,v,n),y(z,s,n),t(s,p,n),t(s,J,n),t(s,f,n),y(B,s,n),t(s,K,n),t(s,H,n),t(s,L,n),y(D,s,n),t(s,O,n),y(Q,s,n),t(s,ss,n),t(s,S,n),t(s,as,n),y(A,s,n),t(s,ts,n),t(s,q,n),t(s,ls,n),y(i,s,n),t(s,k,n),t(s,P,n),t(s,Qs,n),y(hs,s,n),t(s,Ss,n),t(s,js,n),t(s,As,n),t(s,ys,n),t(s,qs,n),t(s,us,n),t(s,Ls,n),y(gs,s,n),t(s,Ds,n),t(s,bs,n),t(s,Ps,n),y(Js,s,n),t(s,Ks,n),y(ws,s,n),t(s,Os,n),t(s,ds,n),t(s,sa,n),y($s,s,n),t(s,aa,n),y(es,s,n),t(s,ta,n),y(ns,s,n),t(s,la,n),y(Ts,s,n),t(s,ea,n),t(s,Us,n),t(s,na,n),y(_s,s,n),t(s,pa,n),t(s,Zs,n),t(s,ma,n),y(Cs,s,n),t(s,ra,n),t(s,Is,n),t(s,ca,n),y(ks,s,n),t(s,ia,n),y(ps,s,n),t(s,oa,n),y(ms,s,n),t(s,Ma,n),y(rs,s,n),t(s,fa,n),y(Ws,s,n),t(s,ha,n),t(s,vs,n),t(s,ja,n),t(s,Gs,n),t(s,ya,n),y(Xs,s,n),t(s,ua,n),t(s,cs,n),t(s,ga,n),t(s,Rs,n),t(s,ba,n),y(Ys,s,n),t(s,Ja,n),t(s,Fs,n),t(s,wa,n),y(is,s,n),t(s,da,n),y(os,s,n),t(s,$a,n),y(Vs,s,n),t(s,Ta,n),t(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}),ms.$set(Sa);const Aa={};n&2&&(Aa.$$scope={dirty:n,ctx:s}),rs.$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(ms.$$.fragment,s),u(rs.$$.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(ms.$$.fragment,s),g(rs.$$.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(m),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(ts),a(q),a(ls),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(ta),a(la),a(ea),a(Us),a(na),a(pa),a(Zs),a(ma),a(ra),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(l),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(ms,s),b(rs,s),b(Ws,s),b(Xs,s),b(Ys,s),b(is,s),b(os,s),b(Vs,s)}}}const $t='{"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 Tt(X){return Ka(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Gt extends Oa{constructor(l){super(),st(this,l,Tt,dt,Pa,{})}}export{Gt as component};
