<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Nisit Sirimarnkit on Medium]]></title>
        <description><![CDATA[Stories by Nisit Sirimarnkit on Medium]]></description>
        <link>https://medium.com/@nisitsirimarnkit?source=rss-cf3e97dbd7c9------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*C15DfvqauU59cnBxXdAQTA.jpeg</url>
            <title>Stories by Nisit Sirimarnkit on Medium</title>
            <link>https://medium.com/@nisitsirimarnkit?source=rss-cf3e97dbd7c9------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 04:48:00 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@nisitsirimarnkit/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Auto Post Facebook ด้วย Garudust AI Agent]]></title>
            <link>https://nisitsirimarnkit.medium.com/auto-post-facebook-%E0%B8%94%E0%B9%89%E0%B8%A7%E0%B8%A2-garudust-ai-agent-639466871551?source=rss-cf3e97dbd7c9------2</link>
            <guid isPermaLink="false">https://medium.com/p/639466871551</guid>
            <category><![CDATA[garudust-agent]]></category>
            <category><![CDATA[auto-post-facebook]]></category>
            <category><![CDATA[garudust-hub]]></category>
            <category><![CDATA[garudust]]></category>
            <dc:creator><![CDATA[Nisit Sirimarnkit]]></dc:creator>
            <pubDate>Mon, 11 May 2026 09:50:57 GMT</pubDate>
            <atom:updated>2026-05-11T09:50:57.716Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HGbeulr909iC7yB-XEgDLQ.png" /></figure><blockquote><em>บทความนี้จะแนะนำวิธีใช้ </em><strong><em>Garudust</em></strong><em> — AI Agent แบบ open-source ที่รันบน command line — เพื่อค้นหาข่าวล่าสุด เขียนโพสต์ภาษาไทย สร้างรูปภาพด้วย AI และโพสต์ขึ้น Facebook Page โดยอัตโนมัติในคำสั่งเดียว</em></blockquote><h3>Garudust คืออะไร</h3><p><a href="https://github.com/garudust-org/garudust-agent">Garudust</a> คือ AI Agent CLI ที่สร้างด้วย Rust รองรับทั้ง cloud model (Claude, GPT-4o) และ local model (ผ่าน vLLM หรือ Ollama) มาพร้อม tool และ skill system ที่ขยายได้ง่าย</p><p>สิ่งที่ทำได้ในบทความนี้:</p><ul><li>ค้นหาข่าวจาก Google แบบ real-time</li><li>เขียนโพสต์ภาษาไทยจากข่าวที่หามาได้</li><li>สร้างรูปภาพด้วย AI (FLUX.1-schnell)</li><li>โพสต์ขึ้น Facebook Page พร้อมรูป</li></ul><p>ทั้งหมดนี้ทำด้วย <strong>prompt เดียว</strong></p><h3>สิ่งที่ต้องเตรียม</h3><h3>Tools และ Skill</h3><p>ชื่อประเภทหน้าที่generate_imageToolสร้างรูปภาพด้วย HuggingFace FLUX.1-schnellfacebook_postToolโพสต์ข้อความและรูปไปยัง Facebook Pageweb_searchTool (built-in)ค้นหาข่าวจาก Google ผ่าน Serperfacebook-workflowSkillรวม research → เขียน → สร้างรูป → โพสต์ ในขั้นตอนเดียว</p><h3>API Keys ที่ต้องขอ</h3><p>Keyที่มาค่าใช้จ่ายFACEBOOK_ACCESS_TOKENFacebook DevelopersฟรีHF_TOKENhuggingface.co/settings/tokensฟรีSERPER_API_KEYserper.devฟรี 2,500 queries/เดือน</p><h3>ขั้นตอนที่ 1 — ติดตั้ง Garudust</h3><pre>cargo install garudust</pre><p>ตรวจสอบว่าติดตั้งสำเร็จ:</p><pre>garudust --version</pre><h3>ขั้นตอนที่ 2 — ติดตั้ง Tools และ Skill</h3><pre># ติดตั้ง tools<br>garudust tool install generate_image --hub<br>garudust tool install facebook_post --hub</pre><pre># ติดตั้ง skill<br>garudust skill install facebook-workflow --hub</pre><p>ตรวจสอบว่าติดตั้งครบ:</p><pre>garudust tool list<br>garudust skill list</pre><h3>ขั้นตอนที่ 3 — ขอ API Keys</h3><h3>Facebook Page Token</h3><p>Token ที่ต้องการคือ <strong>Page Access Token แบบไม่มีวันหมดอายุ</strong> ขอได้ดังนี้:</p><ol><li>ไปที่ <a href="https://developers.facebook.com/">developers.facebook.com</a> → สร้าง App ประเภท <strong>Business</strong></li><li>เพิ่ม Product: <strong>Facebook Login</strong></li><li>ขอ User Token ที่มี permission: pages_manage_posts, pages_read_engagement</li><li>แลก Long-lived User Token:</li></ol><pre>curl &quot;https://graph.facebook.com/oauth/access_token \<br>  ?grant_type=fb_exchange_token \<br>  &amp;client_id=YOUR_APP_ID \<br>  &amp;client_secret=YOUR_APP_SECRET \<br>  &amp;fb_exchange_token=YOUR_SHORT_TOKEN&quot;</pre><ol><li>ดึง Page Token จาก Long-lived User Token:</li></ol><pre>curl &quot;https://graph.facebook.com/me/accounts \<br>  ?access_token=YOUR_LONG_LIVED_USER_TOKEN&quot;</pre><p>ใน response จะมี access_token ของแต่ละ Page — นี่คือ Page Access Token ที่ไม่มีวันหมดอายุ</p><h3>HuggingFace Token</h3><ol><li>สมัครที่ <a href="https://huggingface.co/">huggingface.co</a></li><li>ไปที่ <strong>Settings → Access Tokens → New token</strong></li><li>เลือก type: <strong>Read</strong></li><li>Copy token</li></ol><h3>Serper API Key</h3><ol><li>สมัครที่ <a href="https://serper.dev/">serper.dev</a></li><li>เข้า Dashboard → Copy API Key</li></ol><h3>หา Page ID</h3><ol><li>เปิด Facebook Page</li><li>ไปที่ <strong>Settings → About</strong></li><li>เลื่อนลงล่าง จะเห็น <strong>Page ID</strong> (ตัวเลข เช่น 831735183365530)</li></ol><h3>ขั้นตอนที่ 4 — ตั้งค่า</h3><p>เพิ่ม keys ใน ~/.garudust/.env:</p><pre>FACEBOOK_ACCESS_TOKEN=your_page_access_token<br>HF_TOKEN=your_hf_token<br>SERPER_API_KEY=your_serper_key</pre><p>ตั้งค่า model ใน ~/.garudust/config.yaml:</p><pre>max_output_tokens: 2048</pre><h3>ขั้นตอนที่ 5 — ใช้งาน</h3><h3>แบบ One-shot (Command Line)</h3><pre>garudust &quot;ใช้ skill facebook-workflow ค้นหาข่าวเทคโนโลยี AI ล่าสุด เลือก 1 เรื่องที่น่าสนใจที่สุด เขียนโพสต์ภาษาไทยแบบละเอียด สร้างรูปที่เกี่ยวข้อง และโพสต์ไปเพจ PAGE_NAME page_id YOUR_PAGE_ID&quot;</pre><h3>แบบ TUI (Interactive)</h3><pre>garudust</pre><p>แล้วพิมพ์ prompt ในช่อง input:</p><pre>ใช้ skill facebook-workflow ค้นหาข่าวเทคโนโลยี AI ล่าสุด เลือก 1 เรื่องที่น่าสนใจที่สุด เขียนโพสต์ภาษาไทยแบบละเอียด สร้างรูปที่เกี่ยวข้อง และโพสต์ไปเพจ PAGE_NAME page_id YOUR_PAGE_ID</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*QEaBgQxlT54sv21Eh3cOBQ.gif" /><figcaption>ตัวอย่างการ prompt สั่งให้ agent post ข้อความและรูปไปเพจ</figcaption></figure><h3>TUI Commands ที่มีประโยชน์</h3><p>คำสั่งผล/newเริ่ม session ใหม่ (ล้าง history)/helpดูคำสั่งทั้งหมดCtrl+Cออกจากโปรแกรม</p><h3>Flow การทำงาน</h3><pre>User prompt<br>    │<br>    ▼<br>skill_view ─── โหลด facebook-workflow instructions<br>    │<br>    ▼<br>web_search ─── ค้นหาข่าวล่าสุดจาก Google (Serper)<br>    │<br>    ▼<br>generate_image ─── สร้างรูปด้วย FLUX.1-schnell (HuggingFace)<br>    │<br>    ▼<br>facebook_post ─── โพสต์ข้อความ + รูปขึ้น Facebook Page<br>    │<br>    ▼<br>รายงาน Post ID ✅</pre><h3>ตัวอย่าง Prompt เพิ่มเติม</h3><p><strong>โพสต์ข่าวหัวข้อที่กำหนด:</strong></p><pre>ใช้ skill facebook-workflow ค้นหาข่าวเกี่ยวกับ cryptocurrency ล่าสุด เขียนโพสต์ภาษาไทย สร้างรูป และโพสต์ไป page_id YOUR_PAGE_ID</pre><p><strong>โพสต์เนื้อหาที่เขียนเอง:</strong></p><pre>ใช้ skill facebook-workflow เขียนโพสต์เกี่ยวกับประโยชน์ของ AI ในชีวิตประจำวัน สร้างรูปที่เกี่ยวข้อง และโพสต์ไป page_id YOUR_PAGE_ID</pre><p><strong>โพสต์พร้อมรูปที่มีอยู่แล้ว:</strong></p><pre>ใช้ skill facebook-workflow โพสต์ข้อความเกี่ยวกับ AI ใช้รูปที่มีอยู่แล้วที่ /tmp/my_image.png ไป page_id YOUR_PAGE_ID</pre><h3>ข้อจำกัดและแนวทางแก้ไข</h3><p>ปัญหาสาเหตุแนวทางContext overflowModel มี context window จำกัดลด max_output_tokens หรือใช้ cloud modelโพสต์สั้นเกินไปLocal model ขนาดเล็กเขียนสั้นใช้ Claude หรือ GPT-4o แทนgenerate_image ช้าFLUX.1-schnell ใช้เวลา ~5-10 วินาทีปกติ รอได้Token หมดอายุใช้ short-lived tokenต้องแลก long-lived page token (ดูขั้นตอนที่ 3)</p><h3>สรุป</h3><p>ด้วย Garudust คุณสามารถ auto post Facebook ได้ครบวงจรด้วยคำสั่งเดียว ตั้งแต่ค้นหาข่าว เขียนโพสต์ภาษาไทย สร้างรูปภาพ AI ไปจนถึงโพสต์ขึ้นเพจ โดยไม่ต้องเขียนโค้ดเพิ่มเติม</p><p>ทั้งหมดนี้ใช้ <strong>free tier</strong> ของทุก service ใช้ได้ทันทีโดยไม่มีค่าใช้จ่าย</p><p><strong>Resources:</strong></p><ul><li>GitHub: <a href="https://github.com/garudust-org/garudust-agent">github.com/garudust-org/garudust-agent</a></li><li>HuggingFace Token: <a href="https://huggingface.co/settings/tokens">huggingface.co/settings/tokens</a></li><li>Serper API: <a href="https://serper.dev/">serper.dev</a></li><li>Facebook Developers: <a href="https://developers.facebook.com/">developers.facebook.com</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=639466871551" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[สอนการใช้ AGENT ทำแชทบอท LINE OFFICIAL ด้วย GARUDUST AGENT]]></title>
            <link>https://nisitsirimarnkit.medium.com/%E0%B8%AA%E0%B8%AD%E0%B8%99%E0%B8%81%E0%B8%B2%E0%B8%A3%E0%B9%83%E0%B8%8A%E0%B9%89-agent-%E0%B8%97%E0%B8%B3%E0%B9%81%E0%B8%8A%E0%B8%97%E0%B8%9A%E0%B8%AD%E0%B8%97%E0%B9%83%E0%B8%99-line-official-%E0%B8%94%E0%B9%89%E0%B8%A7%E0%B8%A2-garudust-agent-617861e37f32?source=rss-cf3e97dbd7c9------2</link>
            <guid isPermaLink="false">https://medium.com/p/617861e37f32</guid>
            <category><![CDATA[line]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[chatbots]]></category>
            <category><![CDATA[garudust]]></category>
            <dc:creator><![CDATA[Nisit Sirimarnkit]]></dc:creator>
            <pubDate>Wed, 06 May 2026 17:13:33 GMT</pubDate>
            <atom:updated>2026-05-06T17:16:53.994Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/724/1*rKhNOQgCCtNNmwWkVB1KFA.jpeg" /></figure><pre># 1. ติดตั้ง<br>curl -LO https://github.com/garudust-org/garudust-agent/releases/latest/download/garudust-aarch64-apple-darwin.tar.gz<br>tar -xzf garudust-*.tar.gz &amp;&amp; sudo mv garudust garudust-server /usr/local/bin/<br><br># 2. ตั้งค่า<br>garudust setup<br><br><br># 3. ใส่ LINE credentials ใน ~/.garudust/.env<br>ถ้าใส่ใน setup ขั้นตอนที่ 2 แล้ว ข้ามขั้นตอนนี้ได้เลย<br>echo &quot;LINE_CHANNEL_TOKEN=&lt;channel-access-token&gt;&quot; &gt;&gt; ~/.garudust/.env<br>echo &quot;LINE_CHANNEL_SECRET=&lt;32-char-hex-secret&gt;&quot;  &gt;&gt; ~/.garudust/.env<br><br># 4. รัน server<br>garudust-server --port 3000<br><br># 5. เปิด tunnel (terminal ใหม่)<br>ngrok http 3002<br><br># 6. เอา URL จาก ngrok ไปใส่ใน LINE Developers Console<br># Webhook URL: https://xxxx.ngrok-free.app/line</pre><h3>เริ่มต้นกับ Garudust Agent: ติดตั้งและเชื่อมต่อ LINE ใน 6 ขั้นตอน</h3><p>Garudust เป็น AI Agent framework ที่เขียนด้วย Rust — ออกแบบมาสำหรับ Edge AI และ multi-platform messaging รองรับ LINE, Telegram, และ Discord ในตัวเดียว</p><p>บทความนี้จะพาคุณผ่านการติดตั้งและเชื่อมต่อ LINE Official Account เข้ากับ Garudust Agent แบบ step-by-step ตั้งแต่ศูนย์จนถึงรับ-ส่งข้อความอัตโนมัติได้จริง</p><h3>ภาพรวม: Garudust ทำงานอย่างไร?</h3><p>ก่อนเริ่ม ทำความเข้าใจโครงสร้างการทำงานของ Garudust กันสักเล็กน้อย</p><pre>LINE App → LINE Platform → ngrok (tunnel) → garudust-server (port 3000) → Agent Core</pre><p>เมื่อผู้ใช้ส่งข้อความมาใน LINE — LINE Platform จะยิง webhook event ไปยัง URL ที่เราตั้งไว้ ngrok ทำหน้าที่เป็น tunnel จาก internet เข้ามายัง localhost และ garudust-server รับ request นั้นแล้วส่งต่อให้ agent loop ประมวลผล</p><p>โครงสร้าง crate หลักที่เกี่ยวข้อง:</p><ul><li><strong>garudust-server</strong> — HTTP server รับ webhook event จาก LINE platform</li><li><strong>garudust-core</strong> — Agent loop หลัก จัดการ memory, tool calling, และ LLM inference</li><li><strong>garudust-channels</strong> — Channel adapters สำหรับ LINE, Telegram, Discord</li><li><strong>garudust-skills</strong> — Self-improving skills loop ที่ agent เรียนรู้และเพิ่ม skill ได้เอง</li></ul><h3>สิ่งที่ต้องเตรียม</h3><ul><li>macOS (Apple Silicon) หรือ Linux x86_64</li><li><a href="https://ngrok.com/">ngrok</a> ติดตั้งไว้แล้ว</li><li>LINE Official Account พร้อม Messaging API เปิดใช้งาน</li><li>Terminal สองหน้าต่าง</li></ul><h3>ขั้นตอนที่ 1: ติดตั้ง Binary</h3><p>ดาวน์โหลด pre-built binary สำหรับ Apple Silicon จาก GitHub Releases แล้วย้ายไปไว้ใน /usr/local/bin/ เพื่อให้ใช้ได้จากทุก directory</p><pre># ดาวน์โหลด release ล่าสุด (Apple Silicon)<br>curl -LO https://github.com/garudust-org/garudust-agent/releases/latest/download/garudust-aarch64-apple-darwin.tar.gz</pre><pre># แตกไฟล์และย้าย binary ไปยัง PATH<br>tar -xzf garudust-*.tar.gz &amp;&amp; sudo mv garudust garudust-server /usr/local/bin/</pre><blockquote><strong><em>Linux (x86_64):</em></strong><em> เปลี่ยน </em><em>aarch64-apple-darwin เป็น </em><em>x86_64-unknown-linux-gnu ใน URL ด้านบน</em></blockquote><h3>ขั้นตอนที่ 2: ตั้งค่าเริ่มต้น</h3><p>คำสั่ง garudust setup จะสร้าง directory ~/.garudust/ พร้อม config template และไฟล์ .env ที่พร้อมให้กรอก credentials</p><pre>garudust setup</pre><pre># คำสั่งนี้จะสร้าง:<br>#   ~/.garudust/config.toml   — ตั้งค่า LLM, skills, memory<br>#   ~/.garudust/.env          — environment variables (credentials)<br>#   ~/.garudust/db/           — SQLite สำหรับ memory &amp; session</pre><h3>ขั้นตอนที่ 3: ใส่ LINE Credentials</h3><pre>ถ้าใส่ใน setup ขั้นตอนที่ 2 แล้ว ข้ามขั้นตอนนี้ได้เลย</pre><p>ต้องการ 2 ค่าจาก LINE Developers Console:</p><ol><li><strong>Channel Access Token</strong> (Long-lived) — ไปที่ Messaging API → Issue token</li><li><strong>Channel Secret</strong> (32-char hex) — อยู่ในหน้า Basic settings</li></ol><pre># Channel Access Token<br>echo &quot;LINE_CHANNEL_TOKEN=&lt;channel-access-token&gt;&quot; &gt;&gt; ~/.garudust/.env</pre><pre># Channel Secret (32 ตัวอักษร hex)<br>echo &quot;LINE_CHANNEL_SECRET=&lt;32-char-hex-secret&gt;&quot; &gt;&gt; ~/.garudust/.env</pre><blockquote><strong><em>หาค่าเหล่านี้ได้ที่:</em></strong><em> </em><a href="https://developers.line.biz/"><em>developers.line.biz</em></a><em> → เลือก Provider → Channel → แท็บ </em><strong><em>Messaging API</em></strong></blockquote><h3>ขั้นตอนที่ 4: รัน Garudust Server</h3><p>garudust-server จะ start HTTP listener บน port ที่กำหนด และรอรับ webhook event จาก LINE platform</p><pre>garudust-server --port 3000</pre><pre># Expected output:<br>#  INFO garudust_server: Listening on 0.0.0.0:3000<br>#  INFO garudust_core: Agent ready · skills=0 · memory=sqlite</pre><p>ตรวจสอบ log ว่าเห็น Agent ready ก่อนไปขั้นตอนถัดไป</p><h3>ขั้นตอนที่ 5: เปิด Tunnel ด้วย ngrok</h3><p>LINE platform ต้องการ HTTPS webhook URL ที่ public เข้าถึงได้ ใช้ ngrok สร้าง secure tunnel จาก internet เข้ามายัง localhost — <strong>เปิด terminal ใหม่</strong> แล้วรันคำสั่งนี้</p><pre>ngrok http 3000</pre><pre># ngrok จะแสดง URL เช่น:<br>#  Forwarding  <a href="https://a1b2c3d4.ngrok-free.app/">https://a1b2c3d4.ngrok-free.app</a> → <a href="http://localhost:3000/">http://localhost:3000</a><br>#<br># copy URL ส่วน <a href="https://xxxx.ngrok-free.app/">https://xxxx.ngrok-free.app</a> ไว้ใช้ขั้นตอนถัดไป</pre><blockquote><strong><em>ngrok free tier:</em></strong><em> URL จะเปลี่ยนทุกครั้งที่รีสตาร์ท สำหรับ production ควรใช้ static domain ของ ngrok หรือเปลี่ยนไปใช้ Cloudflare Tunnel แทน</em></blockquote><h3>ขั้นตอนที่ 6: ตั้งค่า Webhook ใน LINE Developers Console</h3><p>นำ URL จาก ngrok ไปกรอกใน LINE Developers Console — ต้องเพิ่ม path /line ต่อท้าย URL ด้วย เพราะเป็น route ของ Garudust LINE channel</p><pre>Webhook URL: https://xxxx.ngrok-free.app/line</pre><p>ขั้นตอนใน Console:</p><ol><li><a href="https://developers.line.biz/">developers.line.biz</a> → Channel → Messaging API</li><li>กด <strong>Edit</strong> ที่ “Webhook URL”</li><li>วาง URL ด้านบน → กด <strong>Update</strong></li><li>กด <strong>Verify</strong> — ควรได้ Status: 200 OK</li><li>เปิด <strong>“Use webhook”</strong> toggle</li></ol><h3>ทดสอบว่าทำงานถูกต้อง</h3><p>เปิด LINE แล้วส่งข้อความหา Official Account — ถ้า garudust-server log แสดง INFO webhook received แปลว่า webhook เชื่อมต่อสำเร็จแล้ว</p><p><strong>Tips สำหรับ debug:</strong></p><ul><li>ถ้า Verify ใน Console ไม่ผ่าน → ตรวจว่า garudust-server ยังรันอยู่ และ ngrok ชี้ไปที่ port เดียวกัน</li><li>ดู request log แบบ real-time ได้ที่ http://127.0.0.1:4040 (ngrok inspector UI)</li><li>ตรวจสอบ .env ว่าไม่มี trailing space ด้วย cat -A ~/.garudust/.env</li></ul><h3>ขั้นตอนถัดไป</h3><p>หลังจาก webhook ทำงานแล้ว สามารถขยายความสามารถของ agent ได้ผ่าน config.toml เช่น:</p><ul><li>เชื่อมต่อ LLM (local vLLM หรือ OpenAI-compatible endpoint)</li><li>เพิ่ม skills ผ่าน garudust-skills</li><li>ตั้ง cron schedule ด้วย garudust-cron</li><li>เพิ่ม channel อื่น ๆ อย่าง Telegram และ Discord</li></ul><p><em>Garudust เป็น open-source project ที่ยังอยู่ในช่วง early development — ติดตามความคืบหน้าได้ที่ </em><a href="https://github.com/garudust-org"><em>github.com/garudust-org</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=617861e37f32" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Garudust Agent — AI Agent ที่เขียนด้วย Rust พร้อม Self-Improving]]></title>
            <link>https://nisitsirimarnkit.medium.com/garudust-agent-ai-agent-%E0%B8%97%E0%B8%B5%E0%B9%88%E0%B9%80%E0%B8%82%E0%B8%B5%E0%B8%A2%E0%B8%99%E0%B8%94%E0%B9%89%E0%B8%A7%E0%B8%A2-rust-%E0%B8%9E%E0%B8%A3%E0%B9%89%E0%B8%AD%E0%B8%A1-self-improving-loop-d56611a7b620?source=rss-cf3e97dbd7c9------2</link>
            <guid isPermaLink="false">https://medium.com/p/d56611a7b620</guid>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[chatbots]]></category>
            <category><![CDATA[garudust]]></category>
            <category><![CDATA[self-improvement]]></category>
            <dc:creator><![CDATA[Nisit Sirimarnkit]]></dc:creator>
            <pubDate>Mon, 04 May 2026 23:46:35 GMT</pubDate>
            <atom:updated>2026-05-06T07:51:15.530Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DhDRUQjOh-DSE_UHqCljEQ.png" /><figcaption><a href="https://garudust-org.github.io/garudust-agent/">https://garudust-org.github.io/garudust-agent/</a></figcaption></figure><p>Garudust Agent คือ AI agent runtime แบบ self-hostable ที่เขียนด้วยภาษา Rust ใช้งานได้ฟรี Opensource MIT licenseโดยมีความสามารถหลักคือ persistent memory, skills system, multi-platform gateway และ cron scheduling ชื่อโปรเจกต์มาจากการรวมกันของ “Garuda” (ครุฑ สัญลักษณ์แห่งพลังและปัญญาในวัฒนธรรมไทย) กับ “Rust” สะท้อนถึงรากเหง้าและทิศทางที่มุ่งเน้นประสิทธิภาพสูงสุด <a href="https://github.com/garudust-org/garudust-agent">github</a></p><h3>ทำไมต้องใช้ Garudust Agent?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*etj65thMNGiGqJ-pTCoL0g.png" /></figure><p>ตลาด AI agent framework ส่วนใหญ่ถูกครองโดย Python — LangChain, AutoGPT, CrewAI — ซึ่งมีข้อจำกัดด้าน footprint และ cold start เมื่อ deploy บน edge หรือ single-board computer เช่น Raspberry Pi</p><p>Garudust เลือกแนวทางต่างออกไป:</p><ul><li>Binary ขนาด ~10 MB และ cold start ต่ำกว่า 20 ms — เป็น statically-linked binary เดียว ไม่มี runtime dependency สำหรับการใช้งานในเครื่อง</li><li>รองรับการสลับ LLM provider ด้วย env var เดียว — ไม่ว่าจะเป็น Anthropic, OpenRouter, AWS Bedrock, Ollama, vLLM หรือ endpoint ที่ compatible กับ OpenAI</li><li>รองรับหลายภาษาโดยอัตโนมัติ — ตรวจจับภาษาไทย จีน ญี่ปุ่น อาหรับ เกาหลี และอื่น ๆ โดยไม่ต้องตั้งค่า</li></ul><p>ปัจจุบันรองรับการใช้งาน 3 แบบ</p><ol><li>แบบ TUI หรือ Terminal User Interface การใช้งานในรูปแบบหน้าตาเหมือน command line</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TLwBz8ZhouxTlQIQWVIGIA.png" /><figcaption>คุยกับ Garudust Agent ผ่าน Terminal (TUI)</figcaption></figure><p>2. ใช้งานแบบ One Shot คือ ส่งคำสั่งใน command line ด้วย garudust ตามด้วยข้อความ เช่น</p><pre>garudust &quot;สวัสดี&quot;</pre><p>3. ใช้งานแบบเรียกผ่าน API หรือ Platforms เช่น LINE, Telegram, Discord, อื่นๆ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/724/1*DfGar77zSCY5zPs0M2So3g.png" /></figure><h3>ความสามารถหลัก</h3><h4>1. Self-Improving Memory</h4><p>Agent จะบันทึกความรู้ที่ยั่งยืนไว้ที่ ~/.garudust/memory/ โดยอัตโนมัติ ได้แก่ user preferences, project conventions และสิ่งที่คุณแก้ไขพฤติกรรมของมัน <a href="https://github.com/garudust-org/garudust-agent">github</a></p><p>ตัวอย่างเช่น บอก Agent ว่า “always format JSON with 2-space indent” — Session ถัดไปมันจะจำและทำตามโดยไม่ต้องบอกซ้ำ</p><p>มีระบบ “nudge” ที่คอยกระตุ้นให้ agent บันทึกข้อมูลใหม่ก่อนจบ session ยาว โดยสามารถตั้งค่า interval หรือปิดได้ใน ~/.garudust/config.yaml <a href="https://github.com/garudust-org/garudust-agent">github</a></p><h4>2. Skills System</h4><p>Skills คือชุดคำสั่งที่นำกลับมาใช้ได้ใหม่ ซึ่ง agent โหลดก่อนทำงาน โดยอยู่ใน ~/.garudust/skills/ และ hot-reload ทุกครั้งที่เรียกใช้ — แก้ไขไฟล์แล้วข้อความถัดไปจะรับการเปลี่ยนแปลงทันที <a href="https://github.com/garudust-org/garudust-agent">github</a></p><p>Agent จะสร้าง skills โดยอัตโนมัติเมื่อค้นพบ workflow หลายขั้นตอน และถ้าพบว่าขั้นตอนของ skill ล้าสมัยหรือผิดพลาดระหว่างงาน มันจะแก้ไขไฟล์ทันที — ไม่ต้องบอก <a href="https://github.com/garudust-org/garudust-agent">github</a></p><h4>3. Multi-Platform Gateway</h4><p>garudust-server รัน HTTP gateway, platform adapter ทั้งหมด และ cron job ในกระบวนการเดียว : <a href="https://github.com/garudust-org/garudust-agent">github</a></p><p>Platform วิธีเชื่อมต่อ</p><ul><li>TelegramTELEGRAM_TOKEN</li><li>DiscordDISCORD_TOKEN</li><li>SlackSLACK_BOT_TOKEN + SLACK_APP_TOKEN</li><li>Matrixhomeserver + credentialsHTTP เปิดอยู่เสมอที่ port 3000</li><li>LINE Webhook + LINE_CHANNEL_TOKEN + LINE_CHANNEL_SECRET</li></ul><h4>4. Built-in Tools</h4><p>เครื่องมือที่รวมมาในตัวได้แก่ web_fetch, web_search (ผ่าน Brave Search API), browser (ควบคุม Chrome/Chromium ผ่าน CDP), read_file, write_file, terminal, memory, session_search (Full-text search ข้าม conversation ด้วย SQLite FTS5) และ delegate_task สำหรับ spawn sub-agent แบบ parallel <a href="https://github.com/garudust-org/garudust-agent">github</a></p><p>นอกจากนี้ยังรองรับ MCP (Model Context Protocol) server ผ่านการตั้งค่าใน ~/.garudust/config.yaml ทำให้เชื่อมต่อกับ filesystem, database หรือบริการภายนอกอื่น ๆ ได้ <a href="https://github.com/garudust-org/garudust-agent">github</a></p><h3>สถาปัตยกรรม Crate</h3><p>โปรเจกต์แบ่งออกเป็น crate ย่อย ดังนี้:</p><ul><li><strong>garudust-core</strong> — Shared traits &amp; types, ไม่มี I/O</li><li><strong>garudust-transport</strong> — LLM adapters สำหรับ Anthropic, OpenAI-compat, Codex, Bedrock, Ollama, vLLM</li><li><strong>garudust-tools</strong> — Tool registry และ built-in toolsets</li><li><strong>garudust-memory</strong> — FileMemoryStore (markdown) และ SessionDb (SQLite + FTS5)</li><li><strong>garudust-agent</strong> — Agent run loop, context compressor, prompt builder</li><li><strong>garudust-platforms</strong> — Telegram, Discord, Slack, Matrix, Webhook</li><li><strong>garudust-cron</strong> — Cron scheduler</li><li><strong>garudust-gateway</strong> — axum HTTP gateway <a href="https://github.com/garudust-org/garudust-agent">github</a></li></ul><p>การออกแบบแบบนี้ทำให้ การเพิ่ม tool, transport หรือ platform adapter มักแตะแค่ crate เดียว และใช้โค้ดไม่ถึง 100 บรรทัด <a href="https://github.com/garudust-org/garudust-agent">github</a></p><h3>การติดตั้งและเริ่มต้น</h3><p>สำหรับผู้ที่ไม่ต้องการ compile เองสามารถดาวน์โหลด pre-built binary ได้จาก GitHub Releases รองรับ macOS (Apple Silicon / Intel), Linux (x86_64 / ARM64) และ Windows</p><p>สำหรับการทดสอบผู้เขียนใช้ vLLM ที่ run อยู่บน local server (ใช้โมเดล Qwen3 บน RTX 4070 Ti SUPER):</p><p>bash</p><pre>VLLM_BASE_URL=http://localhost:8000/v1<br>VLLM_API_KEY=token-abc123<br>GARUDUST_MODEL=Qwen/Qwen3-8B-AWQ<br>garudust</pre><h3>จุดเด่นสำหรับ Developer ไทย</h3><p>Garudust ออกแบบมาให้เหมาะกับ use case ที่นักพัฒนาในไทยต้องเผชิญ:</p><ul><li><strong>ต้นทุนต่ำ</strong> — เชื่อมต่อ self-hosted LLM (Ollama/vLLM) ได้โดยตรง ลดค่า API</li><li><strong>LINE รองรับผ่าน Webhook</strong> — endpoint /webhook ที่เปิดอยู่เสมอสามารถต่อกับ LINE Messaging API ได้</li><li><strong>Deploy บน edge ได้จริง</strong> — binary เล็ก, cold start เร็ว, รัน ARM64 บน Raspberry Pi ได้</li><li><strong>ภาษาไทย</strong> — detection อัตโนมัติ ไม่ต้องตั้งค่าเพิ่ม</li></ul><h3>สถานะปัจจุบัน</h3><p>โปรเจกต์เผยแพร่เวอร์ชัน v0.2.0 เมื่อ 5 พฤษภาคม 2025 เขียนด้วย Rust เกือบทั้งหมด (99.7%) ภายใต้ license MIT พร้อมเปิดรับ contribution — โดยเฉพาะ platform adapter ใหม่อย่าง LINE และ WhatsApp ที่ยังอยู่ใน roadmap</p><p><em>Garudust เป็นโปรเจกต์ที่น่าจับตามอง — มันนำจุดแข็งของ Rust (ความเร็ว, binary ขนาดเล็ก, ความปลอดภัย) มาผสมกับแนวคิด self-improving agent ที่ทำให้ระบบฉลาดขึ้นเรื่อย ๆ ตามการใช้งาน แทนที่จะต้องตั้งค่าซ้ำทุกครั้ง</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/1*NG8XHpgKYq0KUBREZJ_y1g.png" /><figcaption>มาร่วมเป็นชาว Garudian ด้วยกันนะครับ <a href="https://github.com/garudust-org">https://github.com/garudust-org</a></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d56611a7b620" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[การใช้ Intel Neural Compute Stick 2 กับ Raspberry Pi 4]]></title>
            <link>https://medium.com/super-ai-engineer/%E0%B8%81%E0%B8%B2%E0%B8%A3%E0%B9%83%E0%B8%8A%E0%B9%89-intel-neural-compute-stick-2-%E0%B8%81%E0%B8%B1%E0%B8%9A-raspberry-pi-4-22bc087015ca?source=rss-cf3e97dbd7c9------2</link>
            <guid isPermaLink="false">https://medium.com/p/22bc087015ca</guid>
            <category><![CDATA[intel]]></category>
            <category><![CDATA[raspberry-pi-4]]></category>
            <category><![CDATA[openvino]]></category>
            <category><![CDATA[ncs2]]></category>
            <dc:creator><![CDATA[Nisit Sirimarnkit]]></dc:creator>
            <pubDate>Wed, 14 Apr 2021 06:14:18 GMT</pubDate>
            <atom:updated>2021-05-07T02:12:30.006Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rgEDLz6ER6Fp41fAQvtEyA.jpeg" /></figure><p>สวัสดีครับ… วันนี้ผมจะมาพูดถึงอุปกรณ์ Intel Neural Compute Stick 2 เรียกสั้นๆว่า NCS2 เป็นอุปกรณ์ที่ใช้เป็นตัวเร่งการประมวลผลด้าน AI ที่อยู่ในรูปแท่ง USB ยอดนิยม โดยเวอร์ชั่นใหม่นี้ ซึ่งก็คือเวอร์ชัน 2 ให้ทั้งประสิทธิภาพที่มากขึ้น รวมทั้งครอบคลุมการนำไปประยุกต์ใช้ได้หลากหลายขึ้น</p><p>สำหรับ NCS2 นี้ใช้ชิป Vision Processing Unit (VPU)ตัวล่าสุดในชื่อ Movidius Myriad X VPU ทำให้มีประสิทธิภาพเหนือกว่า NCS รุ่นแรกถึง 8 เท่า รวมทั้งมีชุดเครื่องมือ IntelOpenVINO ที่เปิดให้นักพัฒนาสามารถสร้างและฝึกโมเดล AI บนคลาวด์ได้</p><p>ซึ่งในบทความนี้จะเป็นการนำ NCS2 มาใช้กับ Raspberry Pi 4 เรียกย่อๆว่า RPI4 ซึ่งเป็นบอร์ดตัวหนึ่งที่รันแบบมี OS เป็นของตัวเอง เปรียบเสมือนคอมพิวเตอร์จิ๋วตัวหนึ่ง ประสิทธิภาพก็จะมีข้อจำกัดตามขนาด ซึ่งหากเราต้องการใช้ RPI4 รันระบบ AI ก็อาจจะทำให้การประมวลผลนั้นค่อนข้างช้ามาก จึงเป็นที่มาที่เรานำตัว NCS2 มาช่วยในส่วนนี้ครับ</p><h3>Install NCS2 บน OS ของ RPI4</h3><p>เริ่มจาก Install Software ที่ใช้ในการติดตั้งครับ</p><pre># install software</pre><pre>sudo apt-get update</pre><pre>sudo apt-get install git</pre><pre>sudo apt-get install cmake</pre><pre>sudo apt-get install libatlas-base-dev</pre><pre>sudo apt-get install python3-pip</pre><pre>sudo apt install libgtk-3-dev</pre><pre>pip3 install — upgrade pip</pre><pre>pip3 install numpy</pre><p>ดาวน์โหลด Openvino Toolkit เลือกที่เป็นเวอร์ชันสำหรับ Raspberry Pi</p><p><a href="https://storage.openvinotoolkit.org/repositories/openvino/packages/2021.2/l_openvino_toolkit_runtime_raspbian_p_2021.2.185.tgz">https://storage.openvinotoolkit.org/repositories/openvino/packages/2021.2/l_openvino_toolkit_runtime_raspbian_p_2021.2.185.tgz</a></p><p>แตกไฟล์ที่ดาวน์โหลด แก้ไขชื่อ folder ตามต้องการ ในบทความนี้ผมจะตั้งเป็น openvino_toolkit</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/168/0*l9L3UKC0nRAnXKYc" /></figure><p>รัน Environment ของ Openvino ถ้ารันแล้วสามารถเช็คจากเวอร์ชันของ Opencv ถ้าเป็น Openvino จะเป็น 4.x.x-openvino</p><pre># set environment</pre><pre>source /openvino_toolkit/bin/setupvars.sh</pre><p>ติดตั้ง USB Rules เพื่อให้ RPI 4 เห็นอุปกรณ์ NCS2 ผ่าน USB</p><pre># add usb rules</pre><pre>sudo usermod -a -G users “$(whoami)”</pre><pre>sh /openvino_toolkit/install_dependencies/install_NCS_udev_rules.sh</pre><pre>cd /etc/udev/rules.d/</pre><pre>cat 97-myriad-usbboot.rules</pre><p>ในไฟล์ 97-myriad-usbboot.rules จะต้องมีข้อความตามนี้</p><pre>SUBSYSTEM==”usb”, ATTRS{idProduct}==”2150&quot;, ATTRS{idVendor}==”03e7&quot;, GROUP=”users”, MODE=”0660&quot;, ENV{ID_MM_DEVICE_IGNORE}=”1&quot;</pre><pre>SUBSYSTEM==”usb”, ATTRS{idProduct}==”2485&quot;, ATTRS{idVendor}==”03e7&quot;, GROUP=”users”, MODE=”0660&quot;, ENV{ID_MM_DEVICE_IGNORE}=”1&quot;</pre><pre>SUBSYSTEM==”usb”, ATTRS{idProduct}==”f63b”, ATTRS{idVendor}==”03e7&quot;, GROUP=”users”, MODE=”0660&quot;, ENV{ID_MM_DEVICE_IGNORE}=”1&quot;</pre><p>จากนั้นเรามาทำการทดสอบกันครับ สร้างไฟล์ openvino_fd_myriad.py</p><pre>import cv2 as cv</pre><pre># Load the model.</pre><pre>net = cv.dnn_DetectionModel(‘face-detection-adas-0001.xml’,</pre><pre>‘face-detection-adas-0001.bin’)</pre><pre># Specify target device.</pre><pre>net.setPreferableTarget(cv.dnn.DNN_TARGET_MYRIAD)</pre><pre># Read an image.</pre><pre>frame = cv.imread(‘/path/to/image’)</pre><pre>if frame is None:</pre><pre>raise Exception(‘Image not found!’)</pre><pre># Perform an inference.</pre><pre>_, confidences, boxes = net.detect(frame, confThreshold=0.5)</pre><pre># Draw detected faces on the frame.</pre><pre>for confidence, box in zip(list(confidences), boxes):</pre><pre>cv.rectangle(frame, box, color=(0, 255, 0))</pre><pre># Save the frame to an image file.</pre><pre>cv.imwrite(‘out.png’, frame)</pre><p>ดาวน์โหลดไฟล์ weight ที่เป็น .bin</p><pre>wget — no-check-certificate <a href="https://download.01.org/opencv/2020/openvinotoolkit/2020.1/open_model_zoo/models_bin/1/face-detection-adas-0001/FP16/face-detection-adas-0001.bin">https://download.01.org/opencv/2020/openvinotoolkit/2020.1/open_model_zoo/models_bin/1/face-detection-adas-0001/FP16/face-detection-adas-0001.bin</a></pre><p>ดาวน์โหลดไฟล์ .xml</p><pre>wget — no-check-certificate <a href="https://download.01.org/opencv/2020/openvinotoolkit/2020.1/open_model_zoo/models_bin/1/face-detection-adas-0001/FP16/face-detection-adas-0001.xml">https://download.01.org/opencv/2020/openvinotoolkit/2020.1/open_model_zoo/models_bin/1/face-detection-adas-0001/FP16/face-detection-adas-0001.xml</a></pre><p>จากนั้นลองรันด้วยคำสั่ง</p><pre>python3 openvino_fd_myriad.py</pre><p>จะได้ไฟล์ out.png ที่เป็นการประมวลผลรูปภาพที่สำเร็จแล้ว ลองเปิดไฟล์เพื่อดูผล</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cfbgn9k3ZASqo_Q4fY7ugA.png" /></figure><p>จากนั้นทำการรันทดสอบกับไฟล์วิดิโอกันบ้างครับ รันแบบปกติบน RPI4 แบบไม่ใช้ NCS2 จะได้ FPS ตามด้านล่างครับ</p><pre>FPS: 1.15 (excluding drawing time of 32.57ms)<br>FPS: 1.24 (excluding drawing time of 30.59ms)<br>FPS: 1.32 (excluding drawing time of 30.58ms)<br>FPS: 1.24 (excluding drawing time of 31.96ms)<br>FPS: 1.37 (excluding drawing time of 31.31ms)<br>FPS: 1.28 (excluding drawing time of 30.64ms)<br>FPS: 1.28 (excluding drawing time of 30.44ms)<br>FPS: 1.24 (excluding drawing time of 34.44ms)</pre><p>ต่อไปลองเสียบ NCS2 แล้วลองรัน Openvino Environment และลองรันโปรแกรมใหม่อีกทีครับ</p><pre>FPS: 14.02 (excluding drawing time of 55.95ms)<br>FPS: 18.72 (excluding drawing time of 40.07ms)<br>FPS: 16.93 (excluding drawing time of 40.36ms)<br>FPS: 16.29 (excluding drawing time of 42.52ms)<br>FPS: 16.75 (excluding drawing time of 39.74ms)<br>FPS: 16.54 (excluding drawing time of 41.56ms)<br>FPS: 16.84 (excluding drawing time of 41.47ms)<br>FPS: 19.02 (excluding drawing time of 39.78ms)</pre><p>จะเห็นได้ว่า FPS เร็วขึ้นมากถึง 13 เท่าเลยทีเดียวครับ ขอจบเพียงเท่านี้ครับ…</p><p><strong>Ref:</strong> <a href="https://docs.openvinotoolkit.org/2020.1/_docs_install_guides_installing_openvino_raspbian.html">https://docs.openvinotoolkit.org/2020.1/_docs_install_guides_installing_openvino_raspbian.html</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=22bc087015ca" width="1" height="1" alt=""><hr><p><a href="https://medium.com/super-ai-engineer/%E0%B8%81%E0%B8%B2%E0%B8%A3%E0%B9%83%E0%B8%8A%E0%B9%89-intel-neural-compute-stick-2-%E0%B8%81%E0%B8%B1%E0%B8%9A-raspberry-pi-4-22bc087015ca">การใช้ Intel Neural Compute Stick 2 กับ Raspberry Pi 4</a> was originally published in <a href="https://medium.com/super-ai-engineer">Super AI Engineer</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[การทำ labeling ข้อมูลเพื่อนำไป train]]></title>
            <link>https://medium.com/super-ai-engineer/%E0%B8%81%E0%B8%B2%E0%B8%A3%E0%B8%97%E0%B8%B3-labeling-%E0%B8%82%E0%B9%89%E0%B8%AD%E0%B8%A1%E0%B8%B9%E0%B8%A5%E0%B9%80%E0%B8%9E%E0%B8%B7%E0%B9%88%E0%B8%AD%E0%B8%99%E0%B8%B3%E0%B9%84%E0%B8%9B-train-82eefd7c3563?source=rss-cf3e97dbd7c9------2</link>
            <guid isPermaLink="false">https://medium.com/p/82eefd7c3563</guid>
            <category><![CDATA[labeling]]></category>
            <category><![CDATA[yolov5]]></category>
            <category><![CDATA[super-ai-engineer]]></category>
            <category><![CDATA[kiddeesuperai]]></category>
            <dc:creator><![CDATA[Nisit Sirimarnkit]]></dc:creator>
            <pubDate>Fri, 02 Apr 2021 07:49:18 GMT</pubDate>
            <atom:updated>2021-04-03T04:21:53.479Z</atom:updated>
            <content:encoded><![CDATA[<h3>การทำ Labeling ข้อมูลเพื่อใช้ในการ Train โมเดล</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/799/0*MDk5sOXe7Z9xU8_A" /><figcaption><a href="https://github.com/tzutalin/labelImg">https://github.com/tzutalin/labelImg</a></figcaption></figure><p>สวัสดีครับ ในช่วงนี้เป็นช่วงเวลาที่ผมกำลังทำงานในสายงานใหม่ นั่นคือ เกี่ยวกับงานทางด้าน AI ซึ่งผมได้ทำในส่วนที่เกี่ยวกับ image processing และ computer vision ซึ่งในส่วนการทำงานยังอยู่ระหว่างรอการติดตั้งกล้องบนไลน์การผลิต วันนี้ผมเลยจะมาแชร์โปรแกรมที่ใช้ในการ labeling ข้อมูลเพื่อใช้ในการ train ให้กับ yolov5 ครับ นั่นคือ โปรแกรม labelImg ครับ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/470/0*n-7dkov92Gd6DurR" /><figcaption>รูปปุ่มเลือก Format และ Create RectBox</figcaption></figure><p>ซึ่งการใช้งานก็ง่ายๆครับ รันเปิดโปรแกรมขึ้นมา ก็จะมีหน้า UI ให้เราใช้งานแบบใช้เมาส์คลิกเลือกได้เลยครับ โดยขั้นแรกเลือกโฟลเดอรูปภาพ จากนั้นเลือกรูปที่เราจะ label จากนั้นคลิก Create RectBox แล้วก็ลากกรอบ object ที่ต้องการและกด save จะมีหน้าต่างขึ้นมาให้ใส่ชื่อ class นั้น กด save อีกครั้ง เราก็จะได้ไฟล์ txt,xml หรืออื่นๆแล้วแต่เราเลือก format หรือจะกำหนดเองเลยก็ได้ครับ เมื่อคลิกเข้าไปจะเป็นข้อมูลระบุ class พร้อมกับตำแหน่ง object ในรูปภาพครับ โดยโปรแกรมนี้จะสามารถเลือก format ได้ 3 แบบ คือ yolo,createML,PascalVOC</p><h3>Format Yolo</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/790/0*QdkfJjYcsZGwgr-K" /></figure><p>จากรูปด้านบน อันนี้ผมเลือกเป็น format แบบ yolo หลังจากเรากด save แล้ว เราจะได้ไฟล์ที่ชื่อเหมือนกับไฟล์รูปภาพ ซึ่งในที่นี้คือรูป img3.jpg แต่จะได้เป็นไฟล์นามสกุล img3.txt เพิ่มมาอีกไฟล์ เมื่อคลิกข้างในก็จะเป็นข้อความที่บอกตำแหน่งของ object ในรูปภาพนี้ โดย format ของ yolo คือ</p><p>&lt;object-class&gt; &lt;x&gt; &lt;y&gt; &lt;width&gt; &lt;height&gt;</p><h3>Format createML</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KEVIqKmkd4kGi0oI" /></figure><p>format ของ createML จะเป็นในรูปของ json ครับ ก็ตามในรูปภาพด้านบนเลยครับ</p><h3>Format PascalVOC</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/790/0*_9rB6qDMLYMNUbMT" /></figure><p>จะเป็น format ในรูปแบบ xml ครับ ตามรูปด้านบน ยังไงก็เลือกใช้งานกันตามความต้องการนะครับ</p><h3>Minimum Labeling</h3><p>ในส่วนของการทำ label เพื่อมาใช้งานในการ train กับ yolov5 ส่วนที่ผมทำตอนนี้ คือ label ทั้งหมดประมาณ 80 ขึ้นไปถึงจะจับ object ได้ ก่อนหน้านี้ข้อมูลประมาณ 30 กว่าตรวจจับไม่เจอครับ ผมจึงสรุปให้ว่าขั้นต่ำควรจะ 100 ขึ้นไปล่ะกันครับ 🙂</p><p>ยังไงลองไปใช้งานกันดูนะครับ โปรแกรมจะเป็นแบบไฟล์ python ดูข้อมูลได้จากลิงค์ github ซึ่งผมได้ให้วาปทิ้งไว้ที่ด้านล่างแล้วครับ จะ clone มาหรือ download มาก็ได้ จากนั้นรันคำสั่ง</p><pre>python labelImg.py</pre><p><em>ดูข้อมูลได้จาก </em><a href="https://github.com/tzutalin/labelImg"><em>https://github.com/tzutalin/labelImg</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=82eefd7c3563" width="1" height="1" alt=""><hr><p><a href="https://medium.com/super-ai-engineer/%E0%B8%81%E0%B8%B2%E0%B8%A3%E0%B8%97%E0%B8%B3-labeling-%E0%B8%82%E0%B9%89%E0%B8%AD%E0%B8%A1%E0%B8%B9%E0%B8%A5%E0%B9%80%E0%B8%9E%E0%B8%B7%E0%B9%88%E0%B8%AD%E0%B8%99%E0%B8%B3%E0%B9%84%E0%B8%9B-train-82eefd7c3563">การทำ labeling ข้อมูลเพื่อนำไป train</a> was originally published in <a href="https://medium.com/super-ai-engineer">Super AI Engineer</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Line Developer Day 2020]]></title>
            <link>https://nisitsirimarnkit.medium.com/line-developer-day-2020-b84e5d6affcc?source=rss-cf3e97dbd7c9------2</link>
            <guid isPermaLink="false">https://medium.com/p/b84e5d6affcc</guid>
            <category><![CDATA[developer]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[line]]></category>
            <dc:creator><![CDATA[Nisit Sirimarnkit]]></dc:creator>
            <pubDate>Sat, 06 Feb 2021 04:21:33 GMT</pubDate>
            <atom:updated>2021-02-06T11:23:29.382Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Session </strong>: <strong>Image-to-Image Translation and Applications</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cJm1hugSpTjzFzEoiV5rKQ.png" /><figcaption><a href="https://linedevday.linecorp.com/2020/en">https://linedevday.linecorp.com/2020/en</a></figcaption></figure><p>สวัสดีครับบังเอิญผมได้เข้าไปดูงาน Line Developer Day 2020 โดยเป็นงานที่จัดขึ้นโดย LINE เพื่อเหล่า Developer ที่สนใจในการพัฒนาตัวเอง โดยจะมีหัวข้อให้เข้าฟังหรือเรียนรู้ต่างๆมากมาย ทั้งเกี่ยวกับ LINE เองและอื่นๆก็มีครับ สำหรับ Session ที่ผมจะมาแนะนำวันนี้เกี่ยวกับหมวดของ AI ชื่อ Session ว่า Image-to-Image Translation and Applications ซึ่งจะเป็นอย่างไรนั้น เดี๋ยวผมจะมาแชร์ให้ได้อ่านกันครับ ต้องออกตัวก่อนว่าภาษาอังกฤษของผู้เขียนก็ยังไม่ค่อยแข็งแรงมาก หากมีข้อผิดพลาดประการใด สามารถแจ้งให้ผู้เขียนแก้ไขได้เลยนะครับ ขอบคุณล่วงหน้าครับ</p><p>เรามาเริ่มกันเลยดีกว่า…</p><p>Session นี้ ถูกแท็กอยู่ในหมวดของ #AI #Computer Vision โดยผู้บรรยายของเรื่องนี้คือ Yunjey Choi จาก NAVER AI LAB</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qDviS9gImi-_wQRpK-zWvA.png" /><figcaption><a href="https://linedevday.linecorp.com/2020/en/sessions/8573">https://linedevday.linecorp.com/2020/en/sessions/8573</a></figcaption></figure><p>โดยใน Session นี้ ผู้บรรยายต้องการนำเสนอว่ามีแอปพลิเคชันต่างๆมากมายที่ใช้งาน Image To Image Translation ตามความเข้าใจ คือ การที่รูปภาพหนึ่งเปลี่ยนไปเป็นรูปภาพใหม่โดยอิงจากภาพเก่า ซึ่งอาจจะเกิดจากภาพเดียวหรือหลายภาพก็ได้ โดยแบ่งเป็น</p><ol><li>Edge2image วาดภาพเขียนแล้ว AI จะสร้างเป็นภาพที่ใกล้เคียงภาพจริง</li><li>Semantic Image Synthesis เปลี่ยนจากภาพป้ายถนนหรือรถยนต์เป็นภาพใหม่แทนที่ และยังสามารถเปลี่ยนจากภาพพื้นที่สีเป็นภาพจริงได้อีกด้วย</li><li>Animal Translation เปลี่ยนภาพสัตว์ตัวเดิมเป็นแบบใหม่ได้</li><li>Face Image Synthesis สามารถเปลี่ยนภาพหน้าคน เป็นคนใหม่ได้โดยอิงจากภาพคนเก่า</li></ol><p>นอกจากนี้ผู้บรรยายยังได้กล่าวว่า ทางทีม NAVER AI LAB ได้มีการจัดทำโมเดลที่ใช้สำหรับงานด้านนี้อีกด้วย</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/952/1*JDciuSP4RWrLP2VYl18y2g.png" /><figcaption><a href="https://linedevday.linecorp.com/2020/en/sessions/8573">https://linedevday.linecorp.com/2020/en/sessions/8573</a></figcaption></figure><p>Pix2Pix เป็นโมเดลรุ่นแรกที่ออกมา โดยมีการทำงานสองส่วน คือ Generator ที่ทำหน้าที่สร้างข้อมูล และ Discriminator ที่จะคอยบอกว่า Generator สร้างข้อมูลออกมาใกล้เคียงกับเป้าหมายที่สนใจหรือไม่</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/918/1*TnW-ubVki75kE9t7T6xXqw.png" /><figcaption><a href="https://linedevday.linecorp.com/2020/en/sessions/8573">https://linedevday.linecorp.com/2020/en/sessions/8573</a></figcaption></figure><p>ด้านล่างเป็นตัวอย่างการทำงานของโมเดล pix2pix โดยจะแปลงภาพเขียน เป็นภาพเหมือนจริงได้</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/840/1*HOn7X_Cle0f_cKpuuplE-A.png" /><figcaption><a href="https://linedevday.linecorp.com/2020/en/sessions/8573">https://linedevday.linecorp.com/2020/en/sessions/8573</a></figcaption></figure><p>หลังจากนั้นได้พัฒนาเป็น pix2pixHD ซึ่งสามารถใช้งานกับภาพที่มีความละเอียดสูงขึ้นได้</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/922/1*5WMKgQBUBASwDmHvIUyi8Q.png" /><figcaption><a href="https://linedevday.linecorp.com/2020/en/sessions/8573">https://linedevday.linecorp.com/2020/en/sessions/8573</a></figcaption></figure><p>จากตัวอย่างข้างล่างโมเดล pix2pixHD สามารถเปลี่ยนภาพรถยนต์หรือถนนหรือสิ่งอื่นๆเป็นภาพอันใหม่แทนลงไปได้ โดยที่ภาพที่เปลี่ยนจะอยู่ในขอบเขตตามพื้นที่สีที่ถูก Segmentation และภาพจะเปลี่ยนไปตามรูปภาพที่เลือกลงไปแทนที่ภาพเดิม</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/826/1*zAexJWeixJ020-xRD5UGqg.png" /><figcaption><a href="https://linedevday.linecorp.com/2020/en/sessions/8573">https://linedevday.linecorp.com/2020/en/sessions/8573</a></figcaption></figure><p>ขอตัดมาส่วนที่คิดว่าน่าจะสำคัญของ Session นี้ นั่นคือ โมเดล StarGan v2 ที่ทาง NAVER AI LAB ของผู้บรรยายเป็นผู้จัดทำขึ้น ซึ่งได้กล่าวไว้แล้วในช่วงต้นของวิดิโอ เรามาดูกันว่าโมเดลนี้ ทำอะไรได้บ้าง</p><h3><strong>StarGAN v2</strong></h3><p>เป็นโมเดลที่สังเคราะห์ภาพใหม่จากหลายโดเมนหรือหลายภาพ โดยภาพที่สังเคราะห์ใหม่จะอิงมาจากภาพเก่า จากภาพตัวอย่างด้านล่าง ภาพ Input คือ ภาพที่ส่งเข้าไปในโมเดล จากนั้นโมเดลจะ Generate ภาพ Output ออกมาเป็นหลายโดเมนหรือหลายแบบ โดย StarGAN v2 จะถูกเขียนมาจาก PyTorch ใครสนใจอยากทดสอบสามารถเข้าไปดูรายละเอียดได้ที่ <a href="https://github.com/clovaai/stargan-v2">https://github.com/clovaai/stargan-v2</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9Bylm2MCgSfcYMSlgr30yA.png" /><figcaption><a href="https://github.com/clovaai/stargan-v2">https://github.com/clovaai/stargan-v2</a></figcaption></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F0EVh5Ki4dIY%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D0EVh5Ki4dIY&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F0EVh5Ki4dIY%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/007fb536f68007ce5ff3a15c3a888cf4/href">https://medium.com/media/007fb536f68007ce5ff3a15c3a888cf4/href</a></iframe><p>และนี่เป็นเพียงตัวอย่างเล็กๆน้อยๆ อยากรู้รายละเอียดมากกว่านี้สามารถกดดูคลิปแบบเต็มๆได้ด้านล่างนี้ได้เลยครับ ขอจบเพียงเท่านี้ครับ ขอบคุณครับ</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FTpD8Ydrnv4o%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DTpD8Ydrnv4o&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FTpD8Ydrnv4o%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/3f548d1851a98f48207d4172600680ff/href">https://medium.com/media/3f548d1851a98f48207d4172600680ff/href</a></iframe><p>ที่มา : <a href="https://linedevday.linecorp.com/2020/en/sessions/8573">https://linedevday.linecorp.com/2020/en/sessions/8573</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b84e5d6affcc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[เทคนิคการใช้ Pyspark กับ Big Data]]></title>
            <link>https://medium.com/super-ai-engineer/%E0%B9%80%E0%B8%97%E0%B8%84%E0%B8%99%E0%B8%B4%E0%B8%84%E0%B8%81%E0%B8%B2%E0%B8%A3%E0%B9%83%E0%B8%8A%E0%B9%89-pyspark-%E0%B8%81%E0%B8%B1%E0%B8%9A-big-data-4e2c17d081b4?source=rss-cf3e97dbd7c9------2</link>
            <guid isPermaLink="false">https://medium.com/p/4e2c17d081b4</guid>
            <category><![CDATA[super-ai-engineer]]></category>
            <category><![CDATA[big-data]]></category>
            <category><![CDATA[kiddeesuperai]]></category>
            <category><![CDATA[pyspark]]></category>
            <dc:creator><![CDATA[Nisit Sirimarnkit]]></dc:creator>
            <pubDate>Sat, 02 Jan 2021 02:00:15 GMT</pubDate>
            <atom:updated>2021-02-07T06:15:24.972Z</atom:updated>
            <content:encoded><![CDATA[<h3>เทคนิคการใช้ PySpark กับ Big Data</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/650/1*IW_5zINDvDn7-vhfsCs1PA.png" /><figcaption><a href="https://opensource.com/article/18/11/pyspark-jupyter-notebook">https://opensource.com/article/18/11/pyspark-jupyter-notebook</a></figcaption></figure><p>สวัสดีครับวันนี้ ผมจะมาแชร์เทคนิคเล็กๆน้อยๆซึ่งหลายๆคนก็อาจจะทราบกันดีอยู่ แล้ว แต่บางคนก็อาจจะยังไม่ทราบ เทคนิคนี้ก็คือการใช้ PySpark เพื่อจัดการข้อมูลกับ Big Data หรือข้อมูลที่มีขนาดใหญ่ เรามาดูว่ามี Pandas อยู่แล้ว ทำไมยังต้องไปใช้ PySpark กันอีกล่ะ เรามีการทดสอบให้ดูเพื่อให้เห็นความแตกต่างด้วยครับ</p><h3>Big Data คืออะไร?</h3><p>แบบไหนถึงเรียกว่า Big Data เราพิจารณาได้จาก 6V มีดังนี้</p><ol><li>ปริมาตร (Volume) คือ ข้อมูลนั้นมันต้องมีขนาดใหญ่มาก ข้อมูลได้มาจากหลากหลายที่ ซึ่งไม่สามารถประมวลผลด้วยระบบฐานข้อมูลได้</li><li>ความเร็ว (Velocity) คือ ข้อมูลต้องมีอัตราการเพิ่มขึ้นอย่างรวดเร็ว มีปริมาณการเพิ่มขึ้นตลอดเวลา</li><li>ความหลากหลาย (Variety) คือ รูปแบบข้อมูลต้องมีความหลากหลาย</li><li>ความถูกต้อง (Veracity) คือ มีความน่าเชื่อถือของแหล่งที่มาข้อมูล มีกระบวนการในการตรวจสอบและยืนยันความถูกต้องของข้อมูล</li><li>คุณค่า (Value) หมายถึง ข้อมูลมีประโยชน์และมีความสัมพันธ์ในเชิงธุรกิจ ซึ่งต้องเข้าใจก่อนว่าไม่ใช่ทุกข้อมูลจะมีประโยชน์ในการเก็บและวิเคราะห์</li><li>ความแปรผันได้ (Variability) หมายถึง ข้อมูลสามารถเปลี่ยนแปลงรูปแบบไปตามการใช้งาน วิเคราะห์ได้จากหลายแง่มุม และรูปแบบในการจัดเก็บข้อมูลก็อาจจะต่างกันออกไปตามแหล่งข้อมูล</li></ol><p>คุณสมบัติข้างต้นทำให้การจัดการ Big Data เป็นเรื่องยาก อีกทั้งการจัดเก็บข้อมูลแบบเก่าเป็น Database แบบ Relational Database ซึ่งต้องกำหนดโครงสร้างของข้อมูลก่อน แต่ Big Data ส่วนใหญ่เป็นข้อมูลแบบที่ไม่มีรูปแบบตายตัวมักจะมีปัญหาในการเก็บข้อมูลแบบเดิม และจะมีปัญหาเมื่อต้องประมวลผลกับชุดข้อมูลขนาดใหญ่ที่มีการอัพเดตตลอดเวลา และข้อมูลทั้งหมดเป็นข้อมูลที่ยังต้องรอการนำไปวิเคราะห์เพื่อนำไปต่อยอดใช้ในเชิงธุรกิจ</p><h3><strong>เทคโนโลยี Big Data</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/892/1*yC0RcJnSpLr7bCwLZB6sBA.jpeg" /><figcaption><a href="https://www.business2community.com/big-data/big-data-moving-technology-business-value-delivery-01853267">https://www.business2community.com/big-data/big-data-moving-technology-business-value-delivery-01853267</a></figcaption></figure><p>จากปัญหาที่เกิดจากการเก็บข้อมูลแบบเดิมที่ไม่สามารถรองรับข้อมูลปริมาณมากๆที่ไหลผ่านตลอดเวลาและมีรูปแบบที่หลากหลาย จึงเกิดการพัฒนาเทคโนโลยีที่นำมาช่วยในการใช้งานกับ Big Data นั่นคือ NoSQL Database , Hadoop, Spark รวมถึงเทคโนโลยีอื่นๆ</p><p>Spark หรือ Apache Spark เป็น Open Source ที่ทำงานแบบ Parallel Process ซึ่งช่วยให้ผู้ใช้งานสามารถทำงานวิเคราะห์ข้อมูลระหว่าง Cluster ได้ โดยจากที่ทำการค้นข้อมูลมาบอกได้เลยว่าทำงานได้เร็วกว่า Hadoop และมีระบบรองรับการประมวลผลแบบ Realtime อีกด้วย ได้ยินแบบนี้แล้วเราก็มาลุย Spark กันต่อเลยดีกว่าครับ</p><h3>Apache Spark (Spark)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/661/1*LKFDHWDV-huz0ZsP9HWwAQ.jpeg" /><figcaption><a href="https://dwgeek.com/apache-spark-architecture-design-and-overview.html/">https://dwgeek.com/apache-spark-architecture-design-and-overview.html/</a></figcaption></figure><p>Spark จะมีการใช้งานหลักๆ คือ</p><ul><li><strong>Spark streaming</strong> สำหรับการประมวลผลแบบ Realtime Streaming</li><li><strong>Spark SQL</strong> สำหรับการประมวลผลที่ใช้ภาษาคล้ายกับ SQL</li><li><strong>GraphX </strong>สำหรับการสร้างกราฟเส้นเชื่อมต่อเป็น node แบบเครือข่าย</li><li><strong>MLlib </strong>สำหรับการประมวลผลที่เป็นแบบ Machine Learning</li></ul><p>Spark ถูกเขียนขึ้นด้วยภาษา Scala ซึ่งรันบน JVM ของ Java ดังนั้นหากต้องการใช้งาน Spark ด้วยภาษา Python พระเอกของเราก็คือ PySpark นั่นเองครับ</p><h3>การติดตั้ง PySpark</h3><p>วิธีการนี้จะเป็นการติดตั้ง PySpark พร้อมกับ Jupyter ทำให้ใช้งาน PySpark บน Jupyter ได้ครับ ในส่วนนี้ขออธิบายเฉพาะในส่วนของผู้ใช้งาน Mac OS นะครับ</p><ol><li>ติดตั้ง PySpark</li></ol><pre>$ pip install pyspark</pre><p>2. ติดตั้ง Jupyter</p><pre>$ pip install jupyter</pre><p>3. ในไฟล์ ~/.bashrc หรือ~/.zshrc ให้เพิ่มข้อมูล</p><pre>export SPARK_HOME=”/opt/spark” <br>export PATH=$SPARK_HOME/bin:$PATH <br>export SPARK_LOCAL_IP=’127.0.0.1&#39; <br>export PYSPARK_DRIVER_PYTHON=jupyter <br>export PYSPARK_DRIVER_PYTHON_OPTS=’notebook’ # หรือ lab (jupyter lab)<br>export PYSPARK_PYTHON=python3</pre><p>4. รันคำสั่ง</p><p>$ source ~/.bashrc หรือ $ source ~/.zshrc</p><p>จากนั้นเมื่อรันคำสั่ง pyspark ที่ Terminal ก็จะเปิดหน้า jupyter notebook มาให้ใช้งานเลยครับ</p><h3>การใช้งาน PySpark</h3><p>เรามาเริ่มใช้งานกันเลยครับ เริ่มจากนำเข้าไลบารีของ PySpark เข้ามาในไฟล์ Python และ import คลาส SparkSession</p><pre>import pyspark<br>from pyspark.sql import SparkSession</pre><p>สร้าง Object SparkSession เพื่อใช้เรียกใช้งานในส่วนอื่นๆต่อไป</p><pre>spark = SparkSession.builder \<br>    .master(&#39;local[*]&#39;) \<br>    .config(&quot;spark.driver.memory&quot;, &quot;15g&quot;) \<br>    .appName(&#39;my-app&#39;) \<br>    .getOrCreate()</pre><p>สร้างตัวแปร df และเก็บค่าของ Object Spark ที่เรียกคำสั่งอ่านไฟล์ csv โดยอ่านไฟล์ทั้งหมดใน Current Path ที่เป็นไฟล์นามสกุล gz</p><pre>df = spark.read.csv(&#39;*.gz&#39;,header=True)</pre><p>คำสั่งเพื่อโชว์ข้อมูล 10 rows</p><pre>df.show(10)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BO6WSAmVa6ReGvte5Exggg.png" /></figure><p>จะเห็นได้ว่าข้อมูลที่แสดงออกมาจะไม่เหมือนกับที่ Pandas แสดงออกมา และคำสั่งที่ใช้ก็จะไม่เหมือนกัน แต่โดยรวมทั่วไปคุณสมบัติการใช้งานมีคล้ายๆกัน ดังนั้น หากต้องการใช้ PySpark อาจจะต้องศึกษาคำสั่งและการใช้งานต่างๆ เพิ่มเติมครับ</p><h3>ทำไมต้องใช้ PySpark</h3><p>ต่อไปเรามาทดสอบการใช้งาน PySpark กันครับ โดยชุดข้อมูลที่เราเตรียมมาก็เป็นไฟล์ csv ธรรมดาๆไฟล์หนึ่งนั้นเอง ตามภาพข้างล่างนี่เลยครับ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/508/1*f-A0hTyvPleeRt00fdvANg.png" /></figure><p>ขนาดก็เบาๆไม่เท่าไหร่ครับ 9.27GB (*_*) ต่อไปกระบวนท่ามาตรฐาน เมื่อเราเห็น csv เราก็นึกได้ทันทีว่าจะดึงข้อมูลมาใช้งานเราก็ใช้ Pandas สิ เรามาลอง Pandas กันครับ โดยขั้นตอนนี้จะมีการจับเวลาด้วยครับ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/942/1*OT0K944OhUUm4khbzl1MCQ.png" /></figure><p>ได้ 262 วินาที หรือ 4.37 นาที เอิ่มมมม เก็บไว้ในใจก่อน เรามาลอง PySpark กันบ้างคราวนี้</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/926/1*bRee2F5ZeFDlmHahmdNDow.png" /></figure><p>โอววว 5.98 วินาที เร็วกว่า Pandas ถึง 44 เท่า! เปลี่ยนสิครับจะรออะไร จะเห็นได้ว่าเร็วกว่ากันเยอะมาก นอกจากนี้ในส่วนโค้ดที่คอมเม้นไว้ คือ PySpark ยังสามารถอ่านไฟล์ gz ได้หลายๆไฟล์พร้อมกันอีกด้วย ผมจะเทสให้ดูไฟล์ทั้งหมดกับเวลาที่อ่าน</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PYSYERRqY6NFFo-Q7FczLg.png" /></figure><p>รวมทั้งหมด 13.04 GB เรามาดูเวลาที่ PySpark ใช้อ่านกันครับ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/906/1*wvNqbLQonh-KuVkSXkvUzw.png" /></figure><p>ใช้เวลา 6.29 วินาที ถือว่าอ่านเร็วมากๆ เมื่อเทียบกับขนาดไฟล์ ส่วนกรณี Pandas เท่าที่ลองทดสอบอ่าน รอนานเกินไป จึงขอข้ามผลลัพท์ไปเลยนะครับ ดังนั้นกรณีที่ใช้ข้อมูลใหญ่ๆ ปริมาณมากๆจึงแนะนำว่าควรใช้ PySpark ดีกว่าครับ เร็วแบบ The Flash เรียกเพื่อนเลยครับ :)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*2C3nLPjPyttcYUScokYuiQ.gif" /><figcaption><a href="https://giphy.com/explore/flash-afternoon">https://giphy.com/explore/flash-afternoon</a></figcaption></figure><h3>PySpark สร้าง Model Machine Learning</h3><p>ต่อไปเรามาดูวิธีการสร้าง Model ใน PySpark กันครับ โดยข้อมูลหรือ Data ที่ใช้ทดสอบมาจาก <a href="https://www.kaggle.com/uciml/pima-indians-diabetes-database">Kaggle</a> เป็นฐานข้อมูลผู้ป่วยเป็นโรคเบาหวานของคนอินเดีย</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Slfw7ybBpIg6VfgRB8ZOfQ.png" /><figcaption><a href="https://www.kaggle.com/uciml/pima-indians-diabetes-database">https://www.kaggle.com/uciml/pima-indians-diabetes-database</a></figcaption></figure><p>เริ่มต้นจากอ่านข้อมูลจาก csv เพื่อเก็บลงตัวแปร df และแสดงโครงสร้างมาตรวจสอบก่อนครับ</p><pre>from pyspark.sql import SparkSession</pre><pre>spark = SparkSession.builder.appName(&#39;ml-diabetes&#39;).getOrCreate()<br>df = spark.read.csv(&#39;diabetes.csv&#39;, header = True, inferSchema = True)<br>df.printSchema()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/952/1*h-b8sHuKaNb5rWARtkukJQ.png" /></figure><p>จะเห็นได้ว่ามีข้อมูลที่เป็น null เราจึงต้องจัดการข้อมูลส่วนนี้โดยการ Drop ทิ้งไปก่อนครับ</p><pre>df = df.replace(&#39;null&#39;, None).dropna(how=&#39;any&#39;)</pre><p>เลือก Column ที่ต้องการใช้ และเอา Column ที่ไม่ต้องการใช้ออก วิธีการนี้คือขั้นตอนที่เรียกว่า Feature Selection</p><pre>df = df.drop(&#39;SkinThickness&#39;)<br>df = df.drop(&#39;Insulin&#39;)<br>df = df.drop(&#39;DiabetesPedigreeFunction&#39;)<br>df = df.drop(&#39;Pregnancies&#39;)</pre><pre>df.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/696/1*RcO0t3hDFVHCzQcnNky7ng.png" /></figure><p>จัดข้อมูลเพื่อเตรียมนำเข้า Model</p><pre>from pyspark.ml.feature import VectorAssembler</pre><pre>selected = [&#39;Glucose&#39;,&#39;BloodPressure&#39;,&#39;BMI&#39;,&#39;Age&#39;]</pre><pre>va = VectorAssembler(inputCols=selected, outputCol=&#39;features&#39;)</pre><pre>df_transform = va.transform(df)<br>df_transform.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/986/1*c5YuvyI5dSTWM0lGGeoPlA.png" /></figure><p>แบ่งข้อมูล Train,Test โดยสัดส่วน 80/20</p><pre>(train_data, test_data) = df_transform.randomSplit([0.8,0.2])</pre><p>Model ที่เลือกใช้คือ RandomForest</p><pre>from pyspark.ml.classification import RandomForestClassifier</pre><pre>rf = RandomForestClassifier(labelCol=&#39;Outcome&#39;,<br>                        featuresCol=&#39;features&#39;,<br>                        maxDepth=5)</pre><pre>model = rf.fit(train_data)</pre><p>ทายผลข้อมูลชุด Test</p><pre>rf_predictions = model.transform(test_data)</pre><p>วัดผลประสิทธิภาพ จะได้ประมาณ 0.79</p><pre>from pyspark.ml.evaluation import MulticlassClassificationEvaluator</pre><pre>eval = MulticlassClassificationEvaluator(labelCol = &#39;Outcome&#39;, metricName = &#39;accuracy&#39;)</pre><pre>print(&#39;Random Forest classifier Accuracy:&#39;, eval.evaluate(rf_predictions))</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/868/1*Z_QUciI6OVSkfunGLQOCIw.png" /></figure><p>เสร็จขั้นตอนนี้เราก็จะได้ Model นำไปใช้งานกันแล้วนะครับ ที่เหลือก็คือการหา Model อื่นๆมาทดสอบและปรับจูนเพื่อหา Model ที่ดีที่สุดกันต่อไปนะครับ</p><p>สรุปบทความนี้ก็เป็นเทคนิคการใช้ PySpark กับข้อมูลที่มีปริมาณมากๆหรือ Big Data แทนที่เราจะใช้ Pandas แบบปกติ เนื่องด้วยประสิทธิภาพที่ถูกออกแบบมาให้เหมาะกับการใช้งานและความเร็วที่เร็วกว่ามาก ดังนั้นเราอาจจะพิจารณาเลือกใช้ PySpark ในการวิเคราะห์ข้อมูลแทนครับ นอกจากเรื่องความเร็วแล้ว PySpark ก็ยังสามารถใช้สร้าง Model Machine Learning ได้อีกด้วย ยังไงก็ลองตัดสินใจกันดูนะครับหรืออาจจะใช้ควบคู่กันไปกับ Pandas ก็ได้ครับ ขอจบเพียงเท่านี้ ไว้เจอกันในบทความหน้าครับ</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4e2c17d081b4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/super-ai-engineer/%E0%B9%80%E0%B8%97%E0%B8%84%E0%B8%99%E0%B8%B4%E0%B8%84%E0%B8%81%E0%B8%B2%E0%B8%A3%E0%B9%83%E0%B8%8A%E0%B9%89-pyspark-%E0%B8%81%E0%B8%B1%E0%B8%9A-big-data-4e2c17d081b4">เทคนิคการใช้ Pyspark กับ Big Data</a> was originally published in <a href="https://medium.com/super-ai-engineer">Super AI Engineer</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[การใช้งาน Machine Learning บนอุปกรณ์มือถือ]]></title>
            <link>https://medium.com/super-ai-engineer/machine-learning-mobile-devices-94c8406c125c?source=rss-cf3e97dbd7c9------2</link>
            <guid isPermaLink="false">https://medium.com/p/94c8406c125c</guid>
            <category><![CDATA[ml-kit]]></category>
            <category><![CDATA[kiddeesuperai]]></category>
            <category><![CDATA[coreml]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[super-ai-engineer]]></category>
            <dc:creator><![CDATA[Nisit Sirimarnkit]]></dc:creator>
            <pubDate>Fri, 01 Jan 2021 07:57:08 GMT</pubDate>
            <atom:updated>2021-01-29T21:08:12.069Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fO8_uO2iqL3f1MwCzceGEg.jpeg" /><figcaption><a href="https://knowtechie.com/machine-learning-in-smartphones/">https://knowtechie.com/machine-learning-in-smartphones/</a></figcaption></figure><p>สวัสดีปีใหม่ 2021 ครับ วันนี้ผมอยากจะมาแชร์เรื่อง การใช้งาน Machine Learning บนอุปกรณ์มือถือ เช่น โทรศัพท์มือถือ,แท็บเล็ต เป็นต้น โดยวิธีการนำ Machine Learning มาใช้งานกับอุปกรณ์พกพานั้นมีหลากหลายวิธี เช่น การให้อุปกรณ์มือถือใช้งาน Machine Learning ผ่าน Server หรือ Cloud , การใช้งาน Machine Learning ผ่านตัวอุปกรณ์มือถือโดยตรง เป็นต้น โดยในบทความนี้จะเน้นการใช้งาน Machine Learning ผ่านอุปกรณ์มือถือโดยตรง ซึ่งการประมวลผลแบบนี้ มีข้อดีคือจะประมวลผลได้ค่อนข้างเร็ว ในบทความนี้จะกล่าวถึงเฉพาะในส่วนที่เป็นระบบปฏิบัติการของ Android และ iOS</p><h3>ลักษณะการใช้งาน</h3><p>การใช้งาน AI บนอุปกรณ์มือถือ โดยทั่วไปส่วนใหญ่ ที่เราพบเจอ ก็คือจะใช้งานบนแอปพลิเคชันโทรศัพท์มือถือหรือแท๊ปเล็ต เนื่องจากเป็นอุปกรณ์ที่ใกล้ตัวเราทุกคนและใช้งานกันเป็นประจำ โดย AI สามารถช่วยเพิ่มประสิทธิภาพการถ่ายรูป ระบบยืนยันตัวตนผู้ใช้งานโทรศัพท์ด้วยการแสกนใบหน้า ระบบแปลภาษาในตัวซึ่งทำให้เราใช้งานได้แม้ไม่ต้องต่ออินเตอร์เน็ต เป็นต้น ต่อไปเรามาดูตัวอย่างแอปพลิเคชันที่นำ AI ไปประยุกต์ใช้งานกันนะครับ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3WrjCGWI054m6owNZIkBRA.jpeg" /><figcaption><a href="https://worldofs.com/faceapp-privacy/">https://worldofs.com/faceapp-privacy/</a></figcaption></figure><p><strong>FaceApp</strong> เป็นแอปพลิเคชันที่ตกแต่งรูปภาพโดยจะใช้ AI ตรวจจับบริเวณใบหน้า และสามารถปรับแต่งให้หน้าแก่,หน้าเด็กหรือใส่เครา อื่นๆได้ โดยภาพที่ได้จะมีความเหมือนมากเพราะมีการนำ AI มาช่วยในการปรับแต่ง</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/745/1*bSIKOTf8RiraQ9A6fKWJYg.jpeg" /><figcaption><a href="https://www.salika.co/2018/10/16/siri-artificial-intelligence-thai-owned/">https://www.salika.co/2018/10/16/siri-artificial-intelligence-thai-owned/</a></figcaption></figure><p><strong>Siri</strong> เป็นแอปพลิเคชัน AI บนโทรศัพท์มือถือ iPhone ที่สามารถพูดโต้ตอบกับผู้ใช้งานได้เสมือนมีหุ่นยนต์เลขาติดตัวไปด้วยทุกที่ ซึ่งสามารถช่วยค้นหาข้อมูลต่างๆ หรือสิ่งที่เราต้องการหาได้โดยที่เราไม่ต้องหาเอง ถือได้ว่าเพิ่มความสะดวกสบายให้ผู้ใช้งานเป็นอย่างมาก</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*vVe6wSwUYXGPMlw3ibOaSw.gif" /><figcaption><a href="https://tenor.com/view/reface-app-marvel-doctor-strange-gif-18328793">https://tenor.com/view/reface-app-marvel-doctor-strange-gif-18328793</a></figcaption></figure><p><strong>Reface </strong>เป็นอีกแอปพลิเคชันหนึ่งที่นำ AI ออกมาใช้ได้น่าสนใจมากครับ โดยจะนำใบหน้าที่เราเลือกไปใส่แทนหน้าตัวละครในคลิปวิดิโอ ซึ่งก็ทำออกมาได้ค่อนข้างดีเลยครับ ผมชอบมาก ยกตัวอย่างในภาพที่เอาหน้าที่เราเลือกไปใส่เป็นพระเอกในเรื่อง Doctor Strange ครับ</p><p>ที่กล่าวมาข้างต้นก็เป็นเพียงแค่บางส่วนเล็กๆน้อยๆนะครับ ยังมีการใช้งานอื่นๆอีกมากมาย และในอนาคตก็มีแนวโน้มที่จะมีการประยุกต์ใช้งานในด้านต่างๆมากขึ้น ยังไงก็คงต้องรอติดตามกันต่อไป ในฐานะที่เป็นผู้ใช้งานยังไงก็เลือกใช้งานแอปพลิเคชันเท่าที่จำเป็นและเลือกดูผู้พัฒนาที่ไว้ใจได้นะครับ</p><p>อันดับต่อไปเราก็จะมาทำความเข้าใจและทำความรู้จักกับ AI ให้มากขึ้นและมาดูเบื้องหลังว่า AI ที่ใช้บนอุปกรณ์มือถือของเรามีขั้นตอนการทำงานอย่างไรกันนะครับ</p><h3>AI,ML และ DL คืออะไร?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/558/1*bd7Sz7Un3Z9xLQ6doVydbw.png" /><figcaption><a href="https://camrojud.com/artificial-intelligence-vs-machine-learning-vs-deep-learning-whats-the-difference/">https://camrojud.com/artificial-intelligence-vs-machine-learning-vs-deep-learning-whats-the-difference/</a></figcaption></figure><p>AI หรือ Artificial Intelligence คือ ปัญญาประดิษฐ์ ระบบประมวลผล ที่มีการวิเคราะห์เชิงลึก คล้ายความฉลาดของมนุษย์ และสามารถก่อให้เกิดผลลัพธ์ที่เป็นการกระทำได้ เช่น รับข้อมูลและทำการตัดสินใจ เป็นต้น โดยปัจจุบัน AI เข้ามามีบทบาทในชีวิตประจำวันค่อนข้างมาก ทั่วโลกต่างให้ความสำคัญ เพราะสามารถนำมาใช้งานอัตโนมัติแทนมนุษย์ในด้านต่างๆมากมาย</p><p>ML หรือ Machine Learning คือ ส่วนการเรียนรู้ของเครื่อง จะเป็นส่วนที่อยู่ภายในเป็นซับเซ็ตของ AI โดยมีหน้าที่ถูกใช้งานเสมือนเป็นสมองของ AI เราอาจพูดได้ว่า AI ใช้ Machine Learning ในการเรียนรู้ สร้างความฉลาด หรือสร้าง model ที่เกิดจากการเรียนรู้ของปัญญาประดิษฐ์เอง ไม่ได้เกิดจากการเขียน rule base โดยที่มนุษย์มีหน้าที่เขียนโปรแกรมให้ AI เรียนรู้จากข้อมูลเท่านั้น</p><p>DL หรือ Deep Learning คือ การเรียนรู้เชิงลึก เป็นส่วนหนึ่งของวิธีการการเรียนรู้ของเครื่อง การเรียนรู้สามารถเป็นได้ทั้งแบบการเรียนรู้แบบมีผู้สอน การเรียนรู้แบบกึ่งมีผู้สอน และการเรียนรู้แบบไม่มีผู้สอน ลึกมีความหมายมาจากการที่มีชั้นของโครงข่ายหลายชั้น โดยในบทความนี้จะยังไม่กล่าวถึงนะครับ</p><h3>กระบวนการสร้าง Machine Learning</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*85FgTs42zHrVlN2C0y7-kQ.jpeg" /><figcaption><a href="https://www.fiverr.com/azizpresswala/create-machine-learning-or-deep-learning-models">https://www.fiverr.com/azizpresswala/create-machine-learning-or-deep-learning-models</a></figcaption></figure><p>ลำดับต่อไปก่อนที่เราจะไปดูการใช้งาน เราต้องเข้าใจหลักการของการทำ Machine Learning ก่อน ซึ่งการสร้าง Machine Learning จะแบ่งได้ 5 ขั้นตอน ดังนี้</p><ol><li>เก็บข้อมูล</li><li>ทำความสะอาดข้อมูล</li><li>สร้างโมเดล</li><li>ทดสอบวัดผลประสิทธิภาพโมเดล</li><li>พัฒนาและนำไปใช้งาน</li></ol><h3>การสร้าง Machine Learning บน Android &amp; iOS</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ODCIo0j9ymwzDHV3AqQQCg.png" /><figcaption><a href="https://analyticsindiamag.com/apples-core-ml-2-vs-googles-ml-kit-which-one-is-better-for-you/">https://analyticsindiamag.com/apples-core-ml-2-vs-googles-ml-kit-which-one-is-better-for-you/</a></figcaption></figure><p>มาถึงหัวข้อหลักสำคัญของบทความนี้ครับ ขออธิบายให้เห็นภาพการใช้งาน Machine Learning กับอุปกรณ์มือถือง่ายๆ เช่น การสร้างแอปที่มีการถ่ายรูปและมีการตรวจจับวัตถุในรูปและบอกว่าเป็นวัตถุอะไร,ตรวจจับข้อความในรูปภาพ,การตรวจจับใบหน้า เป็นต้น</p><p>วิธีการสร้าง Machine Learning บนอุปกรณ์มือถือ ที่เป็นระบบ Android และ iOS โดยเป็นวิธีการใช้งานแบบรันโมเดลบนตัวอุปกรณ์มือถือ อย่างที่กล่าวไว้ข้างต้น วิธีการที่แนะนำมีอยู่ 2 วิธี ดังนี้</p><h3>1. Core ML (iOS)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QsnoBxbmeNjDRDTaMR19GQ.png" /><figcaption><a href="https://developer.apple.com/machine-learning/core-ml/">https://developer.apple.com/machine-learning/core-ml/</a></figcaption></figure><p>Core ML เป็น Framework ที่ใช้ทำ Machine Learning ของ Apple นั่นเอง โดยสามารถใช้งานได้เฉพาะกับ iOS เท่านั้น</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/908/1*sRWS9g4lV_pu-Yq7ZU_htw.png" /><figcaption><a href="https://developer.apple.com/documentation/coreml">https://developer.apple.com/documentation/coreml</a></figcaption></figure><p>หลักการใช้งาน Core ML คือ การใช้งานแอป iOS ที่มีการใช้งาน Machine Learning ผ่าน Core ML โดยจะเรียกโมเดล (Core ML model) ผ่านตัวกลาง คือ Core ML โดยที่โมเดลนั้นจะเป็นไฟล์ที่ใช้งานกับ Core ML โดยตรง โดยการได้มาของไฟล์โมเดลหลักๆจะได้มาจากการสร้างโมเดลใหม่หรือได้มาจากการแปลงมาจากไฟล์โมเดลชนิดอื่นๆ</p><p>การแปลงโมเดล(Convert) ซึ่งการแปลงจากโมเดลอื่นเป็น Core ML model นั้น วิธีการจะต้องใช้ <a href="https://github.com/apple/coremltools">coremltools</a> ซึ่งเป็น python package ที่เอาไว้แปลงโมเดลจาก ML Framework ต่างๆ เช่น Keras, Sci-kit learn อื่นๆ ให้กลายเป็น Core ML model</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/784/1*zXWprWxZrZkK-od2zUpj4g.png" /><figcaption><a href="https://developer.apple.com/documentation/createml">https://developer.apple.com/documentation/createml</a></figcaption></figure><p>การสร้าง model ขึ้นใหม่(Create) โดยการนำข้อมูล Train และ Test มาทดสอบและสร้างโมเดลใหม่ โดยใช้งานผ่านโปรแกรม xcode นั่นคือ การใช้งานเฟรมเวิคที่ชื่อว่า Create ML ทำให้เราสร้างโมเดลเพื่อนำมาใช้งานตามความต้องการได้</p><p>โดยใน Create ML จะมีโมเดลที่ให้เราใช้งาน 6 ประเภทคือ</p><ol><li>Image Models</li><li>Video Models</li><li>Text Models</li><li>Sound Models</li><li>Motion Models</li><li>Tabula Models</li></ol><p>โดยในตัว Core ML หากเราไม่ต้องการสร้างโมเดลหรือ Train ข้อมูลเอง ในระบบเองก็จะมีส่วนที่เรียกใช้งานได้เลย นั่นคือ</p><ol><li><a href="https://developer.apple.com/documentation/vision">Vision</a></li><li><a href="https://developer.apple.com/documentation/naturallanguage">Natural Language</a></li><li><a href="https://developer.apple.com/documentation/speech">Speech</a></li><li><a href="https://developer.apple.com/documentation/soundanalysis">Sound Analysis</a></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/716/1*qVXH0GSxPwEABZe6Ih7VMg.png" /><figcaption><a href="https://developer.apple.com/documentation/coreml">https://developer.apple.com/documentation/coreml</a></figcaption></figure><h3>ภาพตัวอย่างการทดสอบแอปที่ใช้งาน Core ML</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*eZTM2FczR-b2E1V3HzQUBg.jpeg" /><figcaption>ภาพตัวอย่างการใช้งาน Core ML ตรวจจับการเคลื่อนไหวร่างกาย <a href="https://developer.apple.com/documentation/coreml/detecting_human_body_poses_in_an_image">https://developer.apple.com/documentation/coreml/detecting_human_body_poses_in_an_image</a></figcaption></figure><h3>2. ML Kit (iOS,Android)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Rl_NAx6mDFhN3xSMCa3AlQ.jpeg" /><figcaption><a href="https://www.googblogs.com/tag/ml-kit/">https://www.googblogs.com/tag/ml-kit/</a></figcaption></figure><p>ML Kit เป็น Framework ของ Google สามารถนำไปใช้ได้ทั้ง iOS และ Android โดยค่าเริ่มต้น API ของ ML Kit จะใช้งานประสิทธิภาพจากโมเดล Machine Learning ที่ผ่านการฝึกอบรมจาก Google โมเดลเหล่านี้ออกแบบมาเพื่อให้ครอบคลุมการใช้งานที่หลากหลาย</p><p>ประเภท APIs ที่พร้อมให้ใช้งาน แบ่งการใช้งานได้ดังนี้</p><ol><li><a href="https://developers.google.com/ml-kit/vision/text-recognition">text recognition</a></li><li><a href="https://developers.google.com/ml-kit/vision/face-detection">face detection</a></li><li><a href="https://developers.google.com/ml-kit/vision/barcode-scanning">barcode scanning</a></li><li><a href="https://developers.google.com/ml-kit/vision/image-labeling">image labeling</a></li><li><a href="https://developers.google.com/ml-kit/vision/object-detection">object detection and tracking</a></li><li><a href="https://developers.google.com/ml-kit/language/smart-reply">smart reply</a></li><li><a href="https://developers.google.com/ml-kit/language/translation">text translation</a></li><li><a href="https://developers.google.com/ml-kit/language/identification">language identification</a></li></ol><p>นอกจากนี้ การใช้งานบางอย่างต้องการโมเดลที่เฉพาะเจาะจงนอกเหนือจากนี้ ดังนั้น การใช้งานโมเดลอื่นๆหรือโมเดลที่เราสร้างขึ้นเอง จะเรียกว่าการทำ Custom Model และนี่เป็นเหตุผลที่ ML Kit API บางตัวให้ใช้งานโมเดลเริ่มต้นใหม่ ด้วยโมเดลที่มาจาก TensorFlow Lite ที่สร้างเอง ทั้ง Image Labeling และ Object Detection &amp; Tracking API ซึ่งโมเดลรูปแบบอื่นๆที่ได้จากการ Custom ที่ผ่านการ Train มาแล้ว สามารถดูข้อมูลได้ที่ <a href="https://tfhub.dev/">TensorFlow Hub</a> หรือโมเดลที่ต้องการสร้างเองสามารถ Train ข้อมูลได้จาก TensorFlow, AutoML Vision Edge หรือ TensorFlow Lite Model Maker เป็นต้น</p><h3>ภาพตัวอย่างแอปที่ใช้งาน ML Kit</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*qbVIXt91-AN8WvUt8b32Dw.png" /><figcaption>ตัวอย่างการใช้งาน ML Kit Object Detection <a href="https://www.tensorflow.org/lite/models/object_detection/overview">https://www.tensorflow.org/lite/models/object_detection/overview</a></figcaption></figure><p>สรุปทิ้งท้ายของบทความนี้ หากเราต้องใช้งาน Machine Learning แบบที่รันโมเดลบนตัวอุปกรณ์ ซึ่งจะได้ผลรันที่ไวกว่าแต่ก็มีข้อจำกัดด้านประสิทธิภาพต่างๆซึ่งอาจจะไม่เทียบเท่าในฝั่งที่รันบน Cloud หรือ Server ขึ้นอยู่กับความต้องการและการใช้งาน ดังนั้นหากเลือกแบบรันบนตัวอุปกรณ์ ให้เราเลือกใช้งานตามระบบของ OS นั้น เช่น กรณี Android ก็ให้ใช้ ML Kit ส่วน iOS ก็เลือกได้ครับว่าจะใช้ Core ML ซึ่งเป็นของ Apple เองหรือจะเป็น ML Kit ของ Google ซึ่งจะรองรับทั้งสองระบบ ขอให้สนุกกับโลกของ AI ครับ…</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=94c8406c125c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/super-ai-engineer/machine-learning-mobile-devices-94c8406c125c">การใช้งาน Machine Learning บนอุปกรณ์มือถือ</a> was originally published in <a href="https://medium.com/super-ai-engineer">Super AI Engineer</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>