import{s as Pa,o as Ka,n as fs}from"../chunks/scheduler.9bc65507.js";import{S as Oa,i as st,g as w,s as m,r as h,A as at,h as d,f as a,c,j as Da,u as y,x as _,k as Za,y as tt,a as t,v as j,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 W}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,f='このタスクと互換性のあるすべてのアーキテクチャとチェックポイントを確認するには、<a href="https://huggingface.co/tasks/image-classification" rel="nofollow">タスクページ</a> を確認することをお勧めします。';return{c(){l=w("p"),l.innerHTML=f},l(e){l=d(e,"P",{"data-svelte-h":!0}),_(l)!=="svelte-kxk9fo"&&(l.innerHTML=f)},m(e,o){t(e,l,o)},p:fs,d(e){e&&a(l)}}}function rt(X){let l,f='いくつかの画像変換を画像に適用して、モデルの過学習に対する堅牢性を高めます。ここでは torchvision の <a href="https://pytorch.org/vision/stable/transforms.html" rel="nofollow"><code>transforms</code></a> モジュールを使用しますが、任意の画像ライブラリを使用することもできます。',e,o,T="画像のランダムな部分をトリミングし、サイズを変更し、画像の平均と標準偏差で正規化します。",C,V,v,Z,Y="次に、変換を適用し、画像の <code>pixel_values</code> (モデルへの入力) を返す前処理関数を作成します。",I,F,R,$,x="データセット全体に前処理関数を適用するには、🤗 Datasets <code>with_transform</code> メソッドを使用します。変換は、データセットの要素を読み込むときにオンザフライで適用されます。",r,U,N,G,z="次に、<code>DefaultDataCollat​​or</code> を使用してサンプルのバッチを作成します。 🤗 Transformers の他のデータ照合器とは異なり、<code>DefaultDataCollat​​or</code> はパディングなどの追加の前処理を適用しません。",p,J,E;return V=new W({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}}),F=new W({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 W({props:{code:"Zm9vZCUyMCUzRCUyMGZvb2Qud2l0aF90cmFuc2Zvcm0odHJhbnNmb3Jtcyk=",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>food = food.with_transform(transforms)',wrap:!1}}),J=new W({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=f,e=m(),o=w("p"),o.textContent=T,C=m(),h(V.$$.fragment),v=m(),Z=w("p"),Z.innerHTML=Y,I=m(),h(F.$$.fragment),R=m(),$=w("p"),$.innerHTML=x,r=m(),h(U.$$.fragment),N=m(),G=w("p"),G.innerHTML=z,p=m(),h(J.$$.fragment)},l(M){l=d(M,"P",{"data-svelte-h":!0}),_(l)!=="svelte-9lrlsl"&&(l.innerHTML=f),e=c(M),o=d(M,"P",{"data-svelte-h":!0}),_(o)!=="svelte-vjeng9"&&(o.textContent=T),C=c(M),y(V.$$.fragment,M),v=c(M),Z=d(M,"P",{"data-svelte-h":!0}),_(Z)!=="svelte-76n8td"&&(Z.innerHTML=Y),I=c(M),y(F.$$.fragment,M),R=c(M),$=d(M,"P",{"data-svelte-h":!0}),_($)!=="svelte-9bsq10"&&($.innerHTML=x),r=c(M),y(U.$$.fragment,M),N=c(M),G=d(M,"P",{"data-svelte-h":!0}),_(G)!=="svelte-me6jz3"&&(G.innerHTML=z),p=c(M),y(J.$$.fragment,M)},m(M,B){t(M,l,B),t(M,e,B),t(M,o,B),t(M,C,B),j(V,M,B),t(M,v,B),t(M,Z,B),t(M,I,B),j(F,M,B),t(M,R,B),t(M,$,B),t(M,r,B),j(U,M,B),t(M,N,B),t(M,G,B),t(M,p,B),j(J,M,B),E=!0},p:fs,i(M){E||(u(V.$$.fragment,M),u(F.$$.fragment,M),u(U.$$.fragment,M),u(J.$$.fragment,M),E=!0)},o(M){g(V.$$.fragment,M),g(F.$$.fragment,M),g(U.$$.fragment,M),g(J.$$.fragment,M),E=!1},d(M){M&&(a(l),a(e),a(o),a(C),a(v),a(Z),a(I),a(R),a($),a(r),a(N),a(G),a(p)),b(V,M),b(F,M),b(U,M),b(J,M)}}}function mt(X){let l,f;return l=new zs({props:{$$slots:{default:[rt]},$$scope:{ctx:X}}}),{c(){h(l.$$.fragment)},l(e){y(l.$$.fragment,e)},m(e,o){j(l,e,o),f=!0},p(e,o){const T={};o&2&&(T.$$scope={dirty:o,ctx:e}),l.$set(T)},i(e){f||(u(l.$$.fragment,e),f=!0)},o(e){g(l.$$.fragment,e),f=!1},d(e){b(l,e)}}}function ct(X){let l,f=`過剰適合を回避し、モデルをより堅牢にするために、データセットのトレーニング部分にデータ拡張を追加します。
ここでは、Keras 前処理レイヤーを使用してトレーニング データの変換 (データ拡張を含む) を定義します。
検証データの変換 (中央のトリミング、サイズ変更、正規化のみ)。 <code>tf.image</code> または
他のライブラリでも構いません。`,e,o,T,C,V="次に、一度に 1 つの画像ではなく、画像のバッチに適切な変換を適用する関数を作成します。",v,Z,Y,I,F="🤗 データセット <code>set_transform</code> を使用して、その場で変換を適用します。",R,$,x,r,U=`最後の前処理ステップとして、<code>DefaultDataCollat​​or</code>を使用してサンプルのバッチを作成します。 🤗 Transformers の他のデータ照合機能とは異なり、
<code>DefaultDataCollat​​or</code> は、パディングなどの追加の前処理を適用しません。`,N,G,z;return o=new W({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 W({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 W({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}}),G=new W({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=f,e=m(),h(o.$$.fragment),T=m(),C=w("p"),C.textContent=V,v=m(),h(Z.$$.fragment),Y=m(),I=w("p"),I.innerHTML=F,R=m(),h($.$$.fragment),x=m(),r=w("p"),r.innerHTML=U,N=m(),h(G.$$.fragment)},l(p){l=d(p,"P",{"data-svelte-h":!0}),_(l)!=="svelte-1bftz3e"&&(l.innerHTML=f),e=c(p),y(o.$$.fragment,p),T=c(p),C=d(p,"P",{"data-svelte-h":!0}),_(C)!=="svelte-1g4py9p"&&(C.textContent=V),v=c(p),y(Z.$$.fragment,p),Y=c(p),I=d(p,"P",{"data-svelte-h":!0}),_(I)!=="svelte-qy5n6r"&&(I.innerHTML=F),R=c(p),y($.$$.fragment,p),x=c(p),r=d(p,"P",{"data-svelte-h":!0}),_(r)!=="svelte-zm6h83"&&(r.innerHTML=U),N=c(p),y(G.$$.fragment,p)},m(p,J){t(p,l,J),t(p,e,J),j(o,p,J),t(p,T,J),t(p,C,J),t(p,v,J),j(Z,p,J),t(p,Y,J),t(p,I,J),t(p,R,J),j($,p,J),t(p,x,J),t(p,r,J),t(p,N,J),j(G,p,J),z=!0},p:fs,i(p){z||(u(o.$$.fragment,p),u(Z.$$.fragment,p),u($.$$.fragment,p),u(G.$$.fragment,p),z=!0)},o(p){g(o.$$.fragment,p),g(Z.$$.fragment,p),g($.$$.fragment,p),g(G.$$.fragment,p),z=!1},d(p){p&&(a(l),a(e),a(T),a(C),a(v),a(Y),a(I),a(R),a(x),a(r),a(N)),b(o,p),b(Z,p),b($,p),b(G,p)}}}function it(X){let l,f;return l=new zs({props:{$$slots:{default:[ct]},$$scope:{ctx:X}}}),{c(){h(l.$$.fragment)},l(e){y(l.$$.fragment,e)},m(e,o){j(l,e,o),f=!0},p(e,o){const T={};o&2&&(T.$$scope={dirty:o,ctx:e}),l.$set(T)},i(e){f||(u(l.$$.fragment,e),f=!0)},o(e){g(l.$$.fragment,e),f=!1},d(e){b(l,e)}}}function ot(X){let l,f='<a href="/docs/transformers/pr_30510/ja/main_classes/trainer#transformers.Trainer">Trainer</a> を使用したモデルの微調整に慣れていない場合は、<a href="../training#train-with-pytorch-trainer">こちら</a> の基本的なチュートリアルをご覧ください。';return{c(){l=w("p"),l.innerHTML=f},l(e){l=d(e,"P",{"data-svelte-h":!0}),_(l)!=="svelte-18vxxpy"&&(l.innerHTML=f)},m(e,o){t(e,l,o)},p:fs,d(e){e&&a(l)}}}function ft(X){let l,f,e,o='これでモデルのトレーニングを開始する準備が整いました。 <a href="/docs/transformers/pr_30510/ja/model_doc/auto#transformers.AutoModelForImageClassification">AutoModelForImageClassification</a> を使用して ViT をロードします。ラベルの数と予想されるラベルの数、およびラベル マッピングを指定します。',T,C,V,v,Z="この時点で残っているステップは 3 つだけです。",Y,I,F='<li><a href="/docs/transformers/pr_30510/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_30510/ja/main_classes/trainer#transformers.Trainer">Trainer</a> は精度を評価し、トレーニング チェックポイントを保存します。</li> <li>トレーニング引数を、モデル、データセット、トークナイザー、データ照合器、および <code>compute_metrics</code> 関数とともに <a href="/docs/transformers/pr_30510/ja/main_classes/trainer#transformers.Trainer">Trainer</a> に渡します。</li> <li><a href="/docs/transformers/pr_30510/ja/main_classes/trainer#transformers.Trainer.train">train()</a> を呼び出してモデルを微調整します。</li>',R,$,x,r,U='トレーニングが完了したら、 <a href="/docs/transformers/pr_30510/ja/main_classes/trainer#transformers.Trainer.push_to_hub">push_to_hub()</a> メソッドを使用してモデルをハブに共有し、誰もがモデルを使用できるようにします。',N,G,z;return l=new _a({props:{$$slots:{default:[ot]},$$scope:{ctx:X}}}),C=new W({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 W({props:{code:"dHJhaW5pbmdfYXJncyUyMCUzRCUyMFRyYWluaW5nQXJndW1lbnRzKCUwQSUyMCUyMCUyMCUyMG91dHB1dF9kaXIlM0QlMjJteV9hd2Vzb21lX2Zvb2RfbW9kZWwlMjIlMkMlMEElMjAlMjAlMjAlMjByZW1vdmVfdW51c2VkX2NvbHVtbnMlM0RGYWxzZSUyQyUwQSUyMCUyMCUyMCUyMGV2YWxfc3RyYXRlZ3klM0QlMjJlcG9jaCUyMiUyQyUwQSUyMCUyMCUyMCUyMHNhdmVfc3RyYXRlZ3klM0QlMjJlcG9jaCUyMiUyQyUwQSUyMCUyMCUyMCUyMGxlYXJuaW5nX3JhdGUlM0Q1ZS01JTJDJTBBJTIwJTIwJTIwJTIwcGVyX2RldmljZV90cmFpbl9iYXRjaF9zaXplJTNEMTYlMkMlMEElMjAlMjAlMjAlMjBncmFkaWVudF9hY2N1bXVsYXRpb25fc3RlcHMlM0Q0JTJDJTBBJTIwJTIwJTIwJTIwcGVyX2RldmljZV9ldmFsX2JhdGNoX3NpemUlM0QxNiUyQyUwQSUyMCUyMCUyMCUyMG51bV90cmFpbl9lcG9jaHMlM0QzJTJDJTBBJTIwJTIwJTIwJTIwd2FybXVwX3JhdGlvJTNEMC4xJTJDJTBBJTIwJTIwJTIwJTIwbG9nZ2luZ19zdGVwcyUzRDEwJTJDJTBBJTIwJTIwJTIwJTIwbG9hZF9iZXN0X21vZGVsX2F0X2VuZCUzRFRydWUlMkMlMEElMjAlMjAlMjAlMjBtZXRyaWNfZm9yX2Jlc3RfbW9kZWwlM0QlMjJhY2N1cmFjeSUyMiUyQyUwQSUyMCUyMCUyMCUyMHB1c2hfdG9faHViJTNEVHJ1ZSUyQyUwQSklMEElMEF0cmFpbmVyJTIwJTNEJTIwVHJhaW5lciglMEElMjAlMjAlMjAlMjBtb2RlbCUzRG1vZGVsJTJDJTBBJTIwJTIwJTIwJTIwYXJncyUzRHRyYWluaW5nX2FyZ3MlMkMlMEElMjAlMjAlMjAlMjBkYXRhX2NvbGxhdG9yJTNEZGF0YV9jb2xsYXRvciUyQyUwQSUyMCUyMCUyMCUyMHRyYWluX2RhdGFzZXQlM0Rmb29kJTVCJTIydHJhaW4lMjIlNUQlMkMlMEElMjAlMjAlMjAlMjBldmFsX2RhdGFzZXQlM0Rmb29kJTVCJTIydGVzdCUyMiU1RCUyQyUwQSUyMCUyMCUyMCUyMHRva2VuaXplciUzRGltYWdlX3Byb2Nlc3NvciUyQyUwQSUyMCUyMCUyMCUyMGNvbXB1dGVfbWV0cmljcyUzRGNvbXB1dGVfbWV0cmljcyUyQyUwQSklMEElMEF0cmFpbmVyLnRyYWluKCk=",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>    tokenizer=image_processor,
<span class="hljs-meta">... </span>    compute_metrics=compute_metrics,
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>trainer.train()`,wrap:!1}}),G=new W({props:{code:"dHJhaW5lci5wdXNoX3RvX2h1Yigp",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>trainer.push_to_hub()',wrap:!1}}),{c(){h(l.$$.fragment),f=m(),e=w("p"),e.innerHTML=o,T=m(),h(C.$$.fragment),V=m(),v=w("p"),v.textContent=Z,Y=m(),I=w("ol"),I.innerHTML=F,R=m(),h($.$$.fragment),x=m(),r=w("p"),r.innerHTML=U,N=m(),h(G.$$.fragment)},l(p){y(l.$$.fragment,p),f=c(p),e=d(p,"P",{"data-svelte-h":!0}),_(e)!=="svelte-1r91mlc"&&(e.innerHTML=o),T=c(p),y(C.$$.fragment,p),V=c(p),v=d(p,"P",{"data-svelte-h":!0}),_(v)!=="svelte-5p19xw"&&(v.textContent=Z),Y=c(p),I=d(p,"OL",{"data-svelte-h":!0}),_(I)!=="svelte-1p5dlpn"&&(I.innerHTML=F),R=c(p),y($.$$.fragment,p),x=c(p),r=d(p,"P",{"data-svelte-h":!0}),_(r)!=="svelte-bcptzq"&&(r.innerHTML=U),N=c(p),y(G.$$.fragment,p)},m(p,J){j(l,p,J),t(p,f,J),t(p,e,J),t(p,T,J),j(C,p,J),t(p,V,J),t(p,v,J),t(p,Y,J),t(p,I,J),t(p,R,J),j($,p,J),t(p,x,J),t(p,r,J),t(p,N,J),j(G,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(G.$$.fragment,p),z=!0)},o(p){g(l.$$.fragment,p),g(C.$$.fragment,p),g($.$$.fragment,p),g(G.$$.fragment,p),z=!1},d(p){p&&(a(f),a(e),a(T),a(V),a(v),a(Y),a(I),a(R),a(x),a(r),a(N)),b(l,p),b(C,p),b($,p),b(G,p)}}}function Mt(X){let l,f;return l=new zs({props:{$$slots:{default:[ft]},$$scope:{ctx:X}}}),{c(){h(l.$$.fragment)},l(e){y(l.$$.fragment,e)},m(e,o){j(l,e,o),f=!0},p(e,o){const T={};o&2&&(T.$$scope={dirty:o,ctx:e}),l.$set(T)},i(e){f||(u(l.$$.fragment,e),f=!0)},o(e){g(l.$$.fragment,e),f=!1},d(e){b(l,e)}}}function ht(X){let l,f='Keras を使用したモデルの微調整に慣れていない場合は、まず <a href="./training#train-a-tensorflow-model-with-keras">基本チュートリアル</a> を確認してください。';return{c(){l=w("p"),l.innerHTML=f},l(e){l=d(e,"P",{"data-svelte-h":!0}),_(l)!=="svelte-m0v6mc"&&(l.innerHTML=f)},m(e,o){t(e,l,o)},p:fs,d(e){e&&a(l)}}}function yt(X){let l,f,e,o="TensorFlow でモデルを微調整するには、次の手順に従います。",T,C,V="<li>トレーニングのハイパーパラメータを定義し、オプティマイザーと学習率スケジュールを設定します。</li> <li>事前トレーニングされたモデルをインスタンス化します。</li> <li>🤗 データセットを <code>tf.data.Dataset</code> に変換します。</li> <li>モデルをコンパイルします。</li> <li>コールバックを追加し、<code>fit()</code> メソッドを使用してトレーニングを実行します。</li> <li>モデルを 🤗 Hub にアップロードしてコミュニティと共有します。</li>",v,Z,Y="まず、ハイパーパラメーター、オプティマイザー、学習率スケジュールを定義します。",I,F,R,$,x='次に、ラベル マッピングとともに <a href="/docs/transformers/pr_30510/ja/model_doc/auto#transformers.TFAutoModelForImageClassification">TFAutoModelForImageClassification</a> を使用して ViT を読み込みます。',r,U,N,G,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,M,B="<code>compile()</code> を使用してトレーニング用にモデルを設定します。",K,Q,Ms,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,H,ss,S,Ns=`ついに、モデルをトレーニングする準備が整いました。トレーニングおよび検証データセット、エポック数、
モデルを微調整するためのコールバック:`,as,q,ts,A,Es="おめでとう！モデルを微調整し、🤗 Hub で共有しました。これで推論に使用できるようになりました。",ls;return l=new _a({props:{$$slots:{default:[ht]},$$scope:{ctx:X}}}),F=new W({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 W({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 W({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}}),Q=new W({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}}),H=new W({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}}),q=new W({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),f=m(),e=w("p"),e.textContent=o,T=m(),C=w("ol"),C.innerHTML=V,v=m(),Z=w("p"),Z.textContent=Y,I=m(),h(F.$$.fragment),R=m(),$=w("p"),$.innerHTML=x,r=m(),h(U.$$.fragment),N=m(),G=w("p"),G.innerHTML=z,p=m(),h(J.$$.fragment),E=m(),M=w("p"),M.innerHTML=B,K=m(),h(Q.$$.fragment),Ms=m(),L=w("p"),L.innerHTML=D,O=m(),h(H.$$.fragment),ss=m(),S=w("p"),S.textContent=Ns,as=m(),h(q.$$.fragment),ts=m(),A=w("p"),A.textContent=Es},l(i){y(l.$$.fragment,i),f=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=V),v=c(i),Z=d(i,"P",{"data-svelte-h":!0}),_(Z)!=="svelte-1u4w84l"&&(Z.textContent=Y),I=c(i),y(F.$$.fragment,i),R=c(i),$=d(i,"P",{"data-svelte-h":!0}),_($)!=="svelte-1jyup3v"&&($.innerHTML=x),r=c(i),y(U.$$.fragment,i),N=c(i),G=d(i,"P",{"data-svelte-h":!0}),_(G)!=="svelte-myl0l6"&&(G.innerHTML=z),p=c(i),y(J.$$.fragment,i),E=c(i),M=d(i,"P",{"data-svelte-h":!0}),_(M)!=="svelte-1l4vvgv"&&(M.innerHTML=B),K=c(i),y(Q.$$.fragment,i),Ms=c(i),L=d(i,"P",{"data-svelte-h":!0}),_(L)!=="svelte-145ej7o"&&(L.innerHTML=D),O=c(i),y(H.$$.fragment,i),ss=c(i),S=d(i,"P",{"data-svelte-h":!0}),_(S)!=="svelte-bif4s6"&&(S.textContent=Ns),as=c(i),y(q.$$.fragment,i),ts=c(i),A=d(i,"P",{"data-svelte-h":!0}),_(A)!=="svelte-f4xo0m"&&(A.textContent=Es)},m(i,k){j(l,i,k),t(i,f,k),t(i,e,k),t(i,T,k),t(i,C,k),t(i,v,k),t(i,Z,k),t(i,I,k),j(F,i,k),t(i,R,k),t(i,$,k),t(i,r,k),j(U,i,k),t(i,N,k),t(i,G,k),t(i,p,k),j(J,i,k),t(i,E,k),t(i,M,k),t(i,K,k),j(Q,i,k),t(i,Ms,k),t(i,L,k),t(i,O,k),j(H,i,k),t(i,ss,k),t(i,S,k),t(i,as,k),j(q,i,k),t(i,ts,k),t(i,A,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(F.$$.fragment,i),u(U.$$.fragment,i),u(J.$$.fragment,i),u(Q.$$.fragment,i),u(H.$$.fragment,i),u(q.$$.fragment,i),ls=!0)},o(i){g(l.$$.fragment,i),g(F.$$.fragment,i),g(U.$$.fragment,i),g(J.$$.fragment,i),g(Q.$$.fragment,i),g(H.$$.fragment,i),g(q.$$.fragment,i),ls=!1},d(i){i&&(a(f),a(e),a(T),a(C),a(v),a(Z),a(I),a(R),a($),a(r),a(N),a(G),a(p),a(E),a(M),a(K),a(Ms),a(L),a(O),a(ss),a(S),a(as),a(ts),a(A)),b(l,i),b(F,i),b(U,i),b(J,i),b(Q,i),b(H,i),b(q,i)}}}function jt(X){let l,f;return l=new zs({props:{$$slots:{default:[yt]},$$scope:{ctx:X}}}),{c(){h(l.$$.fragment)},l(e){y(l.$$.fragment,e)},m(e,o){j(l,e,o),f=!0},p(e,o){const T={};o&2&&(T.$$scope={dirty:o,ctx:e}),l.$set(T)},i(e){f||(u(l.$$.fragment,e),f=!0)},o(e){g(l.$$.fragment,e),f=!1},d(e){b(l,e)}}}function ut(X){let l,f='画像分類用のモデルを微調整する方法の詳細な例については、対応する <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=f},l(e){l=d(e,"P",{"data-svelte-h":!0}),_(l)!=="svelte-14b518"&&(l.innerHTML=f)},m(e,o){t(e,l,o)},p:fs,d(e){e&&a(l)}}}function gt(X){let l,f="画像プロセッサをロードして画像を前処理し、<code>input</code>を PyTorch テンソルとして返します。",e,o,T,C,V="入力をモデルに渡し、ロジットを返します。",v,Z,Y,I,F="最も高い確率で予測されたラベルを取得し、モデルの <code>id2label</code> マッピングを使用してラベルに変換します。",R,$,x;return o=new W({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 W({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 W({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=f,e=m(),h(o.$$.fragment),T=m(),C=w("p"),C.textContent=V,v=m(),h(Z.$$.fragment),Y=m(),I=w("p"),I.innerHTML=F,R=m(),h($.$$.fragment)},l(r){l=d(r,"P",{"data-svelte-h":!0}),_(l)!=="svelte-cy7wl9"&&(l.innerHTML=f),e=c(r),y(o.$$.fragment,r),T=c(r),C=d(r,"P",{"data-svelte-h":!0}),_(C)!=="svelte-jwtn5w"&&(C.textContent=V),v=c(r),y(Z.$$.fragment,r),Y=c(r),I=d(r,"P",{"data-svelte-h":!0}),_(I)!=="svelte-1y0o568"&&(I.innerHTML=F),R=c(r),y($.$$.fragment,r)},m(r,U){t(r,l,U),t(r,e,U),j(o,r,U),t(r,T,U),t(r,C,U),t(r,v,U),j(Z,r,U),t(r,Y,U),t(r,I,U),t(r,R,U),j($,r,U),x=!0},p:fs,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(l),a(e),a(T),a(C),a(v),a(Y),a(I),a(R)),b(o,r),b(Z,r),b($,r)}}}function bt(X){let l,f;return l=new zs({props:{$$slots:{default:[gt]},$$scope:{ctx:X}}}),{c(){h(l.$$.fragment)},l(e){y(l.$$.fragment,e)},m(e,o){j(l,e,o),f=!0},p(e,o){const T={};o&2&&(T.$$scope={dirty:o,ctx:e}),l.$set(T)},i(e){f||(u(l.$$.fragment,e),f=!0)},o(e){g(l.$$.fragment,e),f=!1},d(e){b(l,e)}}}function Jt(X){let l,f="画像プロセッサをロードして画像を前処理し、<code>input</code>を TensorFlow テンソルとして返します。",e,o,T,C,V="入力をモデルに渡し、ロジットを返します。",v,Z,Y,I,F="最も高い確率で予測されたラベルを取得し、モデルの <code>id2label</code> マッピングを使用してラベルに変換します。",R,$,x;return o=new W({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 W({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 W({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=f,e=m(),h(o.$$.fragment),T=m(),C=w("p"),C.textContent=V,v=m(),h(Z.$$.fragment),Y=m(),I=w("p"),I.innerHTML=F,R=m(),h($.$$.fragment)},l(r){l=d(r,"P",{"data-svelte-h":!0}),_(l)!=="svelte-e92fpp"&&(l.innerHTML=f),e=c(r),y(o.$$.fragment,r),T=c(r),C=d(r,"P",{"data-svelte-h":!0}),_(C)!=="svelte-jwtn5w"&&(C.textContent=V),v=c(r),y(Z.$$.fragment,r),Y=c(r),I=d(r,"P",{"data-svelte-h":!0}),_(I)!=="svelte-1y0o568"&&(I.innerHTML=F),R=c(r),y($.$$.fragment,r)},m(r,U){t(r,l,U),t(r,e,U),j(o,r,U),t(r,T,U),t(r,C,U),t(r,v,U),j(Z,r,U),t(r,Y,U),t(r,I,U),t(r,R,U),j($,r,U),x=!0},p:fs,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(l),a(e),a(T),a(C),a(v),a(Y),a(I),a(R)),b(o,r),b(Z,r),b($,r)}}}function wt(X){let l,f;return l=new zs({props:{$$slots:{default:[Jt]},$$scope:{ctx:X}}}),{c(){h(l.$$.fragment)},l(e){y(l.$$.fragment,e)},m(e,o){j(l,e,o),f=!0},p(e,o){const T={};o&2&&(T.$$scope={dirty:o,ctx:e}),l.$set(T)},i(e){f||(u(l.$$.fragment,e),f=!0)},o(e){g(l.$$.fragment,e),f=!1},d(e){b(l,e)}}}function dt(X){let l,f,e,o,T,C,V,v,Z,Y,I,F=`画像分類では、画像にラベルまたはクラスを割り当てます。テキストや音声の分類とは異なり、入力は
画像を構成するピクセル値。損傷の検出など、画像分類には多くの用途があります
自然災害の後、作物の健康状態を監視したり、病気の兆候がないか医療画像をスクリーニングしたりするのに役立ちます。`,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>',G,z,p,J,E="始める前に、必要なライブラリがすべてインストールされていることを確認してください。",M,B,K,Q,Ms="Hugging Face アカウントにログインして、モデルをアップロードしてコミュニティと共有することをお勧めします。プロンプトが表示されたら、トークンを入力してログインします。",L,D,O,H,ss,S,Ns=`Datasets、🤗 データセット ライブラリから Food-101 データセットの小さいサブセットを読み込みます。これにより、次の機会が得られます
完全なデータセットのトレーニングにさらに時間を費やす前に、実験してすべてが機能することを確認してください。`,as,q,ts,A,Es="<code>train_test_split</code> メソッドを使用して、データセットの <code>train</code> 分割をトレイン セットとテスト セットに分割します。",ls,i,k,P,Ca="次に、例を見てみましょう。",Hs,hs,Ss,ys,Ia="データセット内の各例には 2 つのフィールドがあります。",qs,js,ka="<li><code>image</code>: 食品の PIL 画像</li> <li><code>label</code>: 食品のラベルクラス</li>",As,us,va=`モデルがラベル ID からラベル名を取得しやすくするために、ラベル名をマップする辞書を作成します。
整数への変換、またはその逆:`,Ls,gs,Ds,bs,Ga="これで、ラベル ID をラベル名に変換できるようになりました。",Ps,Js,Ks,ws,Os,ds,Wa="次のステップでは、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> に渡して精度を計算する関数を作成します。",ra,Cs,ma,Is,Va="これで <code>compute_metrics</code>関数の準備が整いました。トレーニングを設定するときにこの関数に戻ります。",ca,ks,ia,ps,oa,rs,fa,ms,Ma,vs,ha,Gs,Ya="モデルを微調整したので、それを推論に使用できるようになりました。",ya,Ws,Fa="推論を実行したい画像を読み込みます。",ja,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_30510/ja/main_classes/pipelines#transformers.pipeline">pipeline()</a> で使用することです。モデルを使用して画像分類用の<code>pipeline</code>をインスタンス化し、それに画像を渡します。',ba,Vs,Ja,Ys,za="必要に応じて、<code>pipeline</code>の結果を手動で複製することもできます。",wa,is,da,os,$a,Fs,Ta,Qs,Ua;return T=new Bs({props:{title:"Image classification",local:"image-classification",headingTag:"h1"}}),V=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 W({props:{code:"cGlwJTIwaW5zdGFsbCUyMHRyYW5zZm9ybWVycyUyMGRhdGFzZXRzJTIwZXZhbHVhdGU=",highlighted:"pip install transformers datasets evaluate",wrap:!1}}),D=new W({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}}),H=new Bs({props:{title:"Load Food-101 dataset",local:"load-food-101-dataset",headingTag:"h2"}}),q=new W({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 W({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 W({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 W({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 W({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 W({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:[mt]},$$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 W({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 W({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:[Mt]},$$scope:{ctx:X}}}),rs=new xs({props:{pytorch:!1,tensorflow:!0,jax:!1,$$slots:{tensorflow:[jt]},$$scope:{ctx:X}}}),ms=new _a({props:{$$slots:{default:[ut]},$$scope:{ctx:X}}}),vs=new Bs({props:{title:"Inference",local:"inference",headingTag:"h2"}}),Xs=new W({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}}),Vs=new W({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}}}),Fs=new nt({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/ja/tasks/image_classification.md"}}),{c(){l=w("meta"),f=m(),e=w("p"),o=m(),h(T.$$.fragment),C=m(),h(V.$$.fragment),v=m(),h(Z.$$.fragment),Y=m(),I=w("p"),I.textContent=F,R=m(),$=w("p"),$.textContent=x,r=m(),U=w("ol"),U.innerHTML=N,G=m(),h(z.$$.fragment),p=m(),J=w("p"),J.textContent=E,M=m(),h(B.$$.fragment),K=m(),Q=w("p"),Q.textContent=Ms,L=m(),h(D.$$.fragment),O=m(),h(H.$$.fragment),ss=m(),S=w("p"),S.textContent=Ns,as=m(),h(q.$$.fragment),ts=m(),A=w("p"),A.innerHTML=Es,ls=m(),h(i.$$.fragment),k=m(),P=w("p"),P.textContent=Ca,Hs=m(),h(hs.$$.fragment),Ss=m(),ys=w("p"),ys.textContent=Ia,qs=m(),js=w("ul"),js.innerHTML=ka,As=m(),us=w("p"),us.textContent=va,Ls=m(),h(gs.$$.fragment),Ds=m(),bs=w("p"),bs.textContent=Ga,Ps=m(),h(Js.$$.fragment),Ks=m(),h(ws.$$.fragment),Os=m(),ds=w("p"),ds.textContent=Wa,sa=m(),h($s.$$.fragment),aa=m(),h(es.$$.fragment),ta=m(),h(ns.$$.fragment),la=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=Va,ca=m(),h(ks.$$.fragment),ia=m(),h(ps.$$.fragment),oa=m(),h(rs.$$.fragment),fa=m(),h(ms.$$.fragment),Ma=m(),h(vs.$$.fragment),ha=m(),Gs=w("p"),Gs.textContent=Ya,ya=m(),Ws=w("p"),Ws.textContent=Fa,ja=m(),h(Xs.$$.fragment),ua=m(),cs=w("div"),cs.innerHTML=xa,ga=m(),Rs=w("p"),Rs.innerHTML=Ba,ba=m(),h(Vs.$$.fragment),Ja=m(),Ys=w("p"),Ys.innerHTML=za,wa=m(),h(is.$$.fragment),da=m(),h(os.$$.fragment),$a=m(),h(Fs.$$.fragment),Ta=m(),Qs=w("p"),this.h()},l(s){const n=at("svelte-u9bgzb",document.head);l=d(n,"META",{name:!0,content:!0}),n.forEach(a),f=c(s),e=d(s,"P",{}),Da(e).forEach(a),o=c(s),y(T.$$.fragment,s),C=c(s),y(V.$$.fragment,s),v=c(s),y(Z.$$.fragment,s),Y=c(s),I=d(s,"P",{"data-svelte-h":!0}),_(I)!=="svelte-33aqnx"&&(I.textContent=F),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),G=c(s),y(z.$$.fragment,s),p=c(s),J=d(s,"P",{"data-svelte-h":!0}),_(J)!=="svelte-1lya3k8"&&(J.textContent=E),M=c(s),y(B.$$.fragment,s),K=c(s),Q=d(s,"P",{"data-svelte-h":!0}),_(Q)!=="svelte-1bh3yv"&&(Q.textContent=Ms),L=c(s),y(D.$$.fragment,s),O=c(s),y(H.$$.fragment,s),ss=c(s),S=d(s,"P",{"data-svelte-h":!0}),_(S)!=="svelte-1ncb48h"&&(S.textContent=Ns),as=c(s),y(q.$$.fragment,s),ts=c(s),A=d(s,"P",{"data-svelte-h":!0}),_(A)!=="svelte-m4w3yq"&&(A.innerHTML=Es),ls=c(s),y(i.$$.fragment,s),k=c(s),P=d(s,"P",{"data-svelte-h":!0}),_(P)!=="svelte-1r6oj5w"&&(P.textContent=Ca),Hs=c(s),y(hs.$$.fragment,s),Ss=c(s),ys=d(s,"P",{"data-svelte-h":!0}),_(ys)!=="svelte-24qbwx"&&(ys.textContent=Ia),qs=c(s),js=d(s,"UL",{"data-svelte-h":!0}),_(js)!=="svelte-8eiv2s"&&(js.innerHTML=ka),As=c(s),us=d(s,"P",{"data-svelte-h":!0}),_(us)!=="svelte-ts333s"&&(us.textContent=va),Ls=c(s),y(gs.$$.fragment,s),Ds=c(s),bs=d(s,"P",{"data-svelte-h":!0}),_(bs)!=="svelte-wrnhuq"&&(bs.textContent=Ga),Ps=c(s),y(Js.$$.fragment,s),Ks=c(s),y(ws.$$.fragment,s),Os=c(s),ds=d(s,"P",{"data-svelte-h":!0}),_(ds)!=="svelte-13jkt14"&&(ds.textContent=Wa),sa=c(s),y($s.$$.fragment,s),aa=c(s),y(es.$$.fragment,s),ta=c(s),y(ns.$$.fragment,s),la=c(s),y(Ts.$$.fragment,s),ea=c(s),Us=d(s,"P",{"data-svelte-h":!0}),_(Us)!=="svelte-1x40z70"&&(Us.innerHTML=Xa),na=c(s),y(_s.$$.fragment,s),pa=c(s),Zs=d(s,"P",{"data-svelte-h":!0}),_(Zs)!=="svelte-o90xg4"&&(Zs.innerHTML=Ra),ra=c(s),y(Cs.$$.fragment,s),ma=c(s),Is=d(s,"P",{"data-svelte-h":!0}),_(Is)!=="svelte-7bx6io"&&(Is.innerHTML=Va),ca=c(s),y(ks.$$.fragment,s),ia=c(s),y(ps.$$.fragment,s),oa=c(s),y(rs.$$.fragment,s),fa=c(s),y(ms.$$.fragment,s),Ma=c(s),y(vs.$$.fragment,s),ha=c(s),Gs=d(s,"P",{"data-svelte-h":!0}),_(Gs)!=="svelte-cyrfc8"&&(Gs.textContent=Ya),ya=c(s),Ws=d(s,"P",{"data-svelte-h":!0}),_(Ws)!=="svelte-14onr13"&&(Ws.textContent=Fa),ja=c(s),y(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-1qvf1hx"&&(Rs.innerHTML=Ba),ba=c(s),y(Vs.$$.fragment,s),Ja=c(s),Ys=d(s,"P",{"data-svelte-h":!0}),_(Ys)!=="svelte-p649vi"&&(Ys.innerHTML=za),wa=c(s),y(is.$$.fragment,s),da=c(s),y(os.$$.fragment,s),$a=c(s),y(Fs.$$.fragment,s),Ta=c(s),Qs=d(s,"P",{}),Da(Qs).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,f,n),t(s,e,n),t(s,o,n),j(T,s,n),t(s,C,n),j(V,s,n),t(s,v,n),j(Z,s,n),t(s,Y,n),t(s,I,n),t(s,R,n),t(s,$,n),t(s,r,n),t(s,U,n),t(s,G,n),j(z,s,n),t(s,p,n),t(s,J,n),t(s,M,n),j(B,s,n),t(s,K,n),t(s,Q,n),t(s,L,n),j(D,s,n),t(s,O,n),j(H,s,n),t(s,ss,n),t(s,S,n),t(s,as,n),j(q,s,n),t(s,ts,n),t(s,A,n),t(s,ls,n),j(i,s,n),t(s,k,n),t(s,P,n),t(s,Hs,n),j(hs,s,n),t(s,Ss,n),t(s,ys,n),t(s,qs,n),t(s,js,n),t(s,As,n),t(s,us,n),t(s,Ls,n),j(gs,s,n),t(s,Ds,n),t(s,bs,n),t(s,Ps,n),j(Js,s,n),t(s,Ks,n),j(ws,s,n),t(s,Os,n),t(s,ds,n),t(s,sa,n),j($s,s,n),t(s,aa,n),j(es,s,n),t(s,ta,n),j(ns,s,n),t(s,la,n),j(Ts,s,n),t(s,ea,n),t(s,Us,n),t(s,na,n),j(_s,s,n),t(s,pa,n),t(s,Zs,n),t(s,ra,n),j(Cs,s,n),t(s,ma,n),t(s,Is,n),t(s,ca,n),j(ks,s,n),t(s,ia,n),j(ps,s,n),t(s,oa,n),j(rs,s,n),t(s,fa,n),j(ms,s,n),t(s,Ma,n),j(vs,s,n),t(s,ha,n),t(s,Gs,n),t(s,ya,n),t(s,Ws,n),t(s,ja,n),j(Xs,s,n),t(s,ua,n),t(s,cs,n),t(s,ga,n),t(s,Rs,n),t(s,ba,n),j(Vs,s,n),t(s,Ja,n),t(s,Ys,n),t(s,wa,n),j(is,s,n),t(s,da,n),j(os,s,n),t(s,$a,n),j(Fs,s,n),t(s,Ta,n),t(s,Qs,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 Qa={};n&2&&(Qa.$$scope={dirty:n,ctx:s}),ns.$set(Qa);const Ha={};n&2&&(Ha.$$scope={dirty:n,ctx:s}),ps.$set(Ha);const Sa={};n&2&&(Sa.$$scope={dirty:n,ctx:s}),rs.$set(Sa);const qa={};n&2&&(qa.$$scope={dirty:n,ctx:s}),ms.$set(qa);const Aa={};n&2&&(Aa.$$scope={dirty:n,ctx:s}),is.$set(Aa);const La={};n&2&&(La.$$scope={dirty:n,ctx:s}),os.$set(La)},i(s){Ua||(u(T.$$.fragment,s),u(V.$$.fragment,s),u(Z.$$.fragment,s),u(z.$$.fragment,s),u(B.$$.fragment,s),u(D.$$.fragment,s),u(H.$$.fragment,s),u(q.$$.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(vs.$$.fragment,s),u(Xs.$$.fragment,s),u(Vs.$$.fragment,s),u(is.$$.fragment,s),u(os.$$.fragment,s),u(Fs.$$.fragment,s),Ua=!0)},o(s){g(T.$$.fragment,s),g(V.$$.fragment,s),g(Z.$$.fragment,s),g(z.$$.fragment,s),g(B.$$.fragment,s),g(D.$$.fragment,s),g(H.$$.fragment,s),g(q.$$.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(vs.$$.fragment,s),g(Xs.$$.fragment,s),g(Vs.$$.fragment,s),g(is.$$.fragment,s),g(os.$$.fragment,s),g(Fs.$$.fragment,s),Ua=!1},d(s){s&&(a(f),a(e),a(o),a(C),a(v),a(Y),a(I),a(R),a($),a(r),a(U),a(G),a(p),a(J),a(M),a(K),a(Q),a(L),a(O),a(ss),a(S),a(as),a(ts),a(A),a(ls),a(k),a(P),a(Hs),a(Ss),a(ys),a(qs),a(js),a(As),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(ra),a(ma),a(Is),a(ca),a(ia),a(oa),a(fa),a(Ma),a(ha),a(Gs),a(ya),a(Ws),a(ja),a(ua),a(cs),a(ga),a(Rs),a(ba),a(Ja),a(Ys),a(wa),a(da),a($a),a(Ta),a(Qs)),a(l),b(T,s),b(V,s),b(Z,s),b(z,s),b(B,s),b(D,s),b(H,s),b(q,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(vs,s),b(Xs,s),b(Vs,s),b(is,s),b(os,s),b(Fs,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 Wt extends Oa{constructor(l){super(),st(this,l,Tt,dt,Pa,{})}}export{Wt as component};
