<?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 Charlie Chen (陳慶裕) on Medium]]></title>
        <description><![CDATA[Stories by Charlie Chen (陳慶裕) on Medium]]></description>
        <link>https://medium.com/@jscinin?source=rss-2743dffd763a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*xRd-T3LlMvow21GTQbqNJw.jpeg</url>
            <title>Stories by Charlie Chen (陳慶裕) on Medium</title>
            <link>https://medium.com/@jscinin?source=rss-2743dffd763a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 05:55:49 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jscinin/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[[FPGA - 4] LiteFury XC7A100T 於系統建立資料送進 LiteFury 運算（概念篇）]]></title>
            <link>https://jscinin.medium.com/fpga-4-litefury-xc7a100t-%E6%96%BC%E7%B3%BB%E7%B5%B1%E5%BB%BA%E7%AB%8B%E8%B3%87%E6%96%99%E9%80%81%E9%80%B2-litefury-%E9%81%8B%E7%AE%97-%E6%A6%82%E5%BF%B5%E7%AF%87-49c3909d97ed?source=rss-2743dffd763a------2</link>
            <guid isPermaLink="false">https://medium.com/p/49c3909d97ed</guid>
            <category><![CDATA[fpga]]></category>
            <category><![CDATA[litefury]]></category>
            <category><![CDATA[xc7a100t]]></category>
            <dc:creator><![CDATA[Charlie Chen (陳慶裕)]]></dc:creator>
            <pubDate>Thu, 20 Aug 2026 19:50:46 GMT</pubDate>
            <atom:updated>2026-08-20T19:50:46.077Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L6j9X6pDSf5iP4khrRFDCA.png" /></figure><p>可以先到官方Github下載專案 Sample-Projects\Project-0\FPGA\LiteFury 直接下載，下一步直接用 Vivado 2026.1 開啟官方 Project-0 專案。</p><p><a href="https://github.com/RHSResearchLLC/NiteFury-and-LiteFury?utm_source=chatgpt.com">LiteFury 官方 GitHub repository</a></p><pre>Project-0<br>└─ FPGA<br>   ├─ common<br>   │  ├─ Constraints<br>   │  │  ├─ early.xdc<br>   │  │  └─ normal.xdc<br>   │  ├─ HDL<br>   │  │  ├─ CodeBlinker.v<br>   │  │  ├─ dna_reader.v<br>   │  │  └─ user_efuse.v<br>   │  └─ Scripts<br>   │     ├─ build.tcl<br>   │     ├─ rebuild.tcl<br>   │     ├─ make-mcs.tcl<br>   │     └─ program-flash.tcl<br>   │<br>   ├─ LiteFury          ← ★ 我們要用這個<br>   │  ├─ mcs<br>   │  │  ├─ out.bin<br>   │  │  └─ out.mcs<br>   │  │<br>   │  └─ project<br>   │     ├─ project.xpr ← ★ Vivado Project<br>   │     └─ project.srcs<br>   │<br>   └─ Nitefury-II       ← 這個不要用</pre><p>前面主要是在確認「LiteFury 硬體能不能被開發工具控制」，接下來才會真正進入「用 FPGA 做運算系統」。</p><p>上一章節我們建立的 litefury_test01 專案，主要目的其實是驗證開發環境。</p><p>我們已經確認：</p><pre>Windows 10<br>   ↓<br>Vivado 2026.1<br>   ↓<br>Digilent HS2<br>   ↓ JTAG<br>XC7A100T<br>   ↓<br>XADC<br>   ↓<br>可以讀到 FPGA 溫度約 63°C</pre><p>代表 Vivado → HS2 → JTAG → XC7A100T 這條基本開發鏈已經打通，但 litefury_test01 是我們從零建立的空白 FPGA Project，它並不知道 LiteFury 板子上有哪些東西。</p><p>而官方專案 LiteFury 裡，則已經包含 LiteFury 板子的硬體架構，因此我們不用從「一顆裸 XC7A100T」開始重新摸索 LiteFury PCB，如下：</p><pre>XC7A100T<br> │<br> ├─ PCIe / XDMA<br> │<br> ├─ DDR3 / MIG<br> │<br> ├─ AXI Interconnect<br> │<br> ├─ AXI GPIO<br> │<br> ├─ SPI<br> │<br> ├─ XADC<br> │<br> └─ LiteFury 對應的 Pin / Clock / Constraint</pre><blockquote>我們真正的目標是建立一套 Windows PC 可以透過 PCIe 把資料送進 LiteFury，由 XC7A100T 執行硬體運算，再把結果傳回 Windows 的完整系統。</blockquote><p>這才是 LiteFury （FPGA）相較於一般 Arduino、STM32 開發真正有意思的地方。架構流程如下說明：</p><pre>               Windows 10<br>                    │<br>             Python / C#<br>                    │<br>                 PCIe<br>                    │<br>               XDMA Driver<br>                    │<br>══════════════ LiteFury ═════════════<br>                    │<br>                  XDMA<br>                    │<br>                  AXI<br>                    │<br>          ┌─────────┴─────────┐<br>          │                   │<br>       DDR3 RAM          FPGA Logic<br>                              │<br>                        自訂運算模組<br>                              │<br>                     ┌────────┴────────┐<br>                     │                 │<br>                 特徵計算          AI / Signal<br>                     │                 │<br>                     └────────┬────────┘<br>                              │<br>                            Result<br>                              │<br>                            PCIe<br>                              │<br>                              ▼<br>                         Python / C#</pre><h3><strong>第一階段</strong>：說明一下Verilog跟平時我們開發C#的區別</h3><p>這是第一個需要建立的觀念，說明如下：</p><p>C#：如下程式碼是 CPU 執行一條指令</p><pre>result = a + b; </pre><p>Verilog：是在 FPGA 裡真的建立一組執行加法的數位電路</p><pre>assign result = a + b;</pre><h3><strong>第二階段</strong>：從 Verilog 進入 AXI</h3><p>接下來你會遇到 FPGA 世界非常重要的東西：<strong><em>AXI Bus<br></em></strong>可以先把 AXI 想成 FPGA 裡面的「高速內部資料公路」，執行架構如下說明：</p><pre>PCIe<br> │<br> ▼<br>XDMA<br> │<br> ▼<br>AXI Interconnect<br> │<br> ├──── AXI GPIO<br> │<br> ├──── DDR3 Controller<br> │<br> ├──── XADC<br> │<br> └──── 我們自己的模組</pre><p>如果用 C# 的世界來看可能就像是熟悉的軟體架構：</p><pre>Controller<br>   ↓<br>Service<br>   ↓<br>Repository<br>   ↓<br>Database</pre><p>FPGA 世界可能變成：</p><pre>PCIe XDMA<br>   ↓<br>AXI Interconnect<br>   ↓<br>AXI Slave<br>   ↓<br>Custom IP<br>   ↓<br>FPGA Logic</pre><p>所以你以前的軟體架構概念不是全部丟掉，而是要轉換成硬體思維。</p><h3><strong>第三階段</strong>：真正打通 PCIe</h3><p>LiteFury 插在我的 GA-Z97MX 主機板上，本質上就可以把它當成一張 PCIe 裝置，因為 M.2 通道實質上也是利用PCIe進行傳輸，而我們希望最後 Windows 可以看到：</p><pre>裝置管理員<br><br>PCI Express Device<br>        ↓<br>LiteFury / XDMA</pre><p>然後 Windows → PCIe → LiteFury 這中接階段會經過以下過程：<br>PCIe、XDMA、Windows Driver、BAR、DMA、AXI、Memory Mapping</p><h3><strong>第四階段</strong>：做第一個 PC ↔ FPGA 運算</h3><p>這是我們將要來進行第一個完整 Demo ，先進行 PC 傳兩個數字給 FPGA，FPGA 做運算，再把答案傳回 PC 。如以下流程：</p><pre>Python<br><br>a = 100<br>b = 50<br><br>        │<br>        ▼<br>      PCIe<br>        │<br>        ▼<br>    LiteFury<br>        │<br>        ▼<br>   FPGA Adder<br>        │<br>   100 + 50<br>        │<br>        ▼<br>      150<br>        │<br>        ▼<br>      PCIe<br>        │<br>        ▼<br>Python 顯示<br><br>result = 150</pre><p>這個 Demo 看起來很簡單，但一旦成功，代表：</p><p><strong>PC → Driver → PCIe → XDMA → AXI → Verilog → AXI → XDMA → PCIe → PC</strong></p><p>整條鏈都成功，這是非常重要的一步。</p><h3><strong>第五階段</strong>：從單一數值升級成大量資料</h3><p>然後我們才開始碰 DMA ，例如使用 Python 處理一百萬筆資料，不可能一筆一筆送給 FPGA 進行運作，一定是一次大量資料傳輸過去，這時候 LiteFury 上的 DDR3 就開始有用途了。流程如下所示：</p><pre>Python / C#<br>      │<br>      │  大量資料<br>      ▼<br>    RAM<br>      │<br>      ▼<br>PCIe DMA<br>      │<br>      ▼<br>LiteFury DDR3<br>      │<br>      ▼<br> FPGA Pipeline<br>      │<br>      ▼<br>   Result Buffer<br>      │<br>      ▼<br>PCIe DMA<br>      │<br>      ▼<br>Windows</pre><h3><strong>第六階段</strong>：把資料科學運算搬進 FPGA</h3><p>等前面的 PCIe / DMA / AXI 都掌握之後，我們就可以開始做比較有趣的東西。例如原本 Python：</p><pre>imbalance = (buy_qty - sell_qty) / (buy_qty + sell_qty)</pre><p>可以考慮改成：</p><pre>buy_qty ───┐<br>           ├─ SUB ──────┐<br>sell_qty ──┘             │<br>                         ├─ DIV ──► imbalance<br>buy_qty ───┐             │<br>           ├─ ADD ──────┘<br>sell_qty ──┘</pre><p>FPGA 與 CPU 最大的差異開始出現：</p><pre>CPU<br><br>A<br>↓<br>B<br>↓<br>C<br>↓<br>D</pre><p>FPGA 可以設計成 pipeline：</p><pre>Data 1 → A → B → C → D<br>             ↑<br>Data 2 → A → B → C<br>             ↑<br>Data 3 → A → B<br>             ↑<br>Data 4 → A</pre><p>pipeline 填滿後，可以做到非常高的資料吞吐量，這才是 FPGA 值得研究的核心。</p><h3><strong>第七階段</strong>：最後才進 AI / 金融運算</h3><p>如果前六階段成功，才建議逐步挑適合 FPGA 的運算。例如：</p><pre>市場原始資料<br>      ↓<br>LiteFury<br>      ↓<br>Order Flow 計算<br>      ↓<br>Feature Engineering<br>      ↓<br>market_energy<br>market_entropy<br>market_temperature<br>      ↓<br>Threshold / Signal Logic<br>      ↓<br>交易訊號<br>      ↓<br>PCIe<br>      ↓<br>Python</pre><p>甚至更進一步：</p><pre>              ┌── CPU / Python<br>市場資料 ─────┤<br>              │     複雜控制<br>              │     資料庫<br>              │     模型管理<br>              │<br>              └── FPGA<br>                    │<br>                    ├─ 高速資料處理<br>                    ├─ Feature calculation<br>                    ├─ Pipeline<br>                    ├─ Signal processing<br>                    └─ AI inference</pre><p>這會比「把整個 Python (XGBoost, AI分析) 程式硬塞進 FPGA」實際很多。</p><p>接下來大概會經歷的技術可以把整條學習路線濃縮成一條，但不需要現在一次全部學，我們會透過實作一路把它串起來。學習路線如下所示：</p><pre>① Vivado / JTAG<br>       ↓<br>② Verilog / RTL<br>       ↓<br>③ Clock / Reset / Timing<br>       ↓<br>④ XDC / Pin Constraint<br>       ↓<br>⑤ AXI<br>       ↓<br>⑥ Block Design / IP Integrator<br>       ↓<br>⑦ PCIe<br>       ↓<br>⑧ XDMA<br>       ↓<br>⑨ Windows Driver<br>       ↓<br>⑩ PC ↔ FPGA Memory Mapping<br>       ↓<br>⑪ DMA<br>       ↓<br>⑫ DDR3 / MIG<br>       ↓<br>⑬ 自訂 AXI IP<br>       ↓<br>⑭ FPGA Pipeline<br>       ↓<br>⑮ Fixed Point<br>       ↓<br>⑯ DSP / BRAM<br>       ↓<br>⑰ Python / C# ↔ FPGA<br>       ↓<br>⑱ AI / 金融資料運算</pre><p>而官方的專案 Project-0 價值就在這裡，如果完全從空白專案開始門檻非常高，如下：</p><pre>XC7A100T<br><br> ↓ 自己研究<br><br>PCIe pins<br>Clock<br>Reset<br>DDR3 pins<br>MIG<br>XDMA<br>AXI<br>SPI<br>XDC<br>Board layout<br>...</pre><p>現在則是：</p><pre>LiteFury Project-0<br>       │<br>       ├─ PCIe XDMA ───── 已有<br>       ├─ DDR3 MIG ────── 已有<br>       ├─ AXI ─────────── 已有<br>       ├─ XADC ────────── 已有<br>       ├─ Constraints ─── 已有<br>       │<br>       ▼<br>我們理解它<br>       ↓<br>讓 Vivado 2026.1 正確 Build<br>       ↓<br>修改它<br>       ↓<br>加入自己的 IP<br>       ↓<br>PC ↔ FPGA<br>       ↓<br>金融 / AI 加速</pre><p>所以我們<strong>不是單純要把 Project-0 跑起來</strong>，而是把它當作 LiteFury 的「硬體底盤」，逐漸把你自己的運算模組放進去。</p><h4>我建議設定三個明確里程碑</h4><blockquote><strong>里程碑 1：LiteFury 原始工程成功 Build + JTAG Program</strong></blockquote><p>證明我們真的可以修改並重新產生 LiteFury bitstream。</p><blockquote><strong>里程碑 2：Windows → PCIe → LiteFury → PCIe → Windows</strong></blockquote><p>例如：</p><pre>Python：100 + 50<br>          ↓<br>        FPGA<br>          ↓<br>Python：150</pre><blockquote>里程碑 3：把一個實際資料運算移進 FPGA</blockquote><p>例如先做：</p><pre>buy_qty<br>sell_qty<br>   ↓<br>FPGA<br>   ↓<br>Order Imbalance<br>   ↓<br>Python</pre><p>到這裡，你就不只是「會用 Vivado」，而是真的完成了一個 <strong>CPU + PCIe + FPGA 異質運算架構</strong>。而後面才有條件把它逐漸發展成 <strong>Python/C# + LiteFury FPGA 的金融資料加速平台</strong>。</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=49c3909d97ed" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[[FPGA - 3] LiteFury XC7A100T 第一個 Vivado 測試 Project — XADC 溫度監控]]></title>
            <link>https://jscinin.medium.com/fpga-3-litefury-xc7a100t-%E7%AC%AC%E4%B8%80%E5%80%8B-vivado-%E6%B8%AC%E8%A9%A6-project-xadc-%E6%BA%AB%E5%BA%A6%E7%9B%A3%E6%8E%A7-78c67fd31298?source=rss-2743dffd763a------2</link>
            <guid isPermaLink="false">https://medium.com/p/78c67fd31298</guid>
            <category><![CDATA[fpga]]></category>
            <category><![CDATA[xc7a100t]]></category>
            <category><![CDATA[fpga-xilinx]]></category>
            <category><![CDATA[litefury]]></category>
            <category><![CDATA[vivado]]></category>
            <dc:creator><![CDATA[Charlie Chen (陳慶裕)]]></dc:creator>
            <pubDate>Wed, 19 Aug 2026 20:15:50 GMT</pubDate>
            <atom:updated>2026-08-19T20:16:30.286Z</atom:updated>
            <content:encoded><![CDATA[<p>接下來建議先<strong>不要動原本 LiteFury 的 FPGA 程式</strong>。我們先建立第一個 Vivado 測試 Project，確認正確的 <strong>XC7A100T 型號/package、LiteFury pin constraints（XDC）與原廠 bitstream 備份方式</strong>，再做最簡單的測試。這樣比較不容易把 LiteFury 原本的 PCIe 功能覆蓋掉。</p><p>尤其你目前 Windows 裝置管理員已經能看到 PCI\VEN_10EE&amp;DEV_7011，這也很像板子目前已經載入 PCIe FPGA 設計。因此現階段<strong>不要直接按 </strong><strong>Program device 寫入我們自己的空白 bitstream</strong>。</p><p>我們下一步可以先做「<strong>備份/確認 LiteFury 原廠 FPGA 設定 → 建立 XC7A100T Vivado Project → 第一個安全測試專案</strong>」。</p><p>建立新專案：</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/523/1*0-3wuepMIVFJhrg5BSz3UQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/801/1*sdqVjKiGErbChLkPSgdifw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/806/1*oCw5fcnNytEc4Dy6ClMAaA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/792/1*IP9IGxXvRRo5U4jt68Mn2Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/802/1*Kdhf6JHuZetdpXZj8nXLPg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vzqyk-imKa6jZVyTdKU81g.png" /></figure><p>這個畫面代表 <strong>第一個 Vivado 專案已成功建立</strong>。而且我從畫面上可以確認：</p><ul><li>Project：litefury_test01</li><li>Product family：<strong>Artix-7</strong></li><li>Project part：<strong>xc7a100tfgg484–2L</strong></li><li>Target language：<strong>Verilog</strong></li><li>Vivado：<strong>2026.1</strong></li></ul><p>接下來我們先做一個「最小可驗證 FPGA 專案」，確認 <strong>Verilog → Synthesis → Implementation → Bitstream → HS2/JTAG → LiteFury</strong> 都能正常工作</p><p>不過 LiteFury 不像一般 FPGA 教學板有現成 LED，因此我們先不要隨便指定 FPGA 腳位，避免把輸出接到 PCIe、Flash 或其他重要腳位。</p><blockquote>下一步：建立第一個 Verilog Source</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2jzpuQsOOckQlIZiwFhkGg.png" /></figure><p>左側點：</p><p><strong>Project Manager → Add Sources</strong></p><p>接著選：</p><p><strong>Add or create design sources</strong></p><p>→ <strong>Next</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/854/1*slXGKtbx6Dz8H6PFwp7X-w.png" /></figure><p>→ <strong>Create File</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/853/1*j1h-mb4ALioRNe6o3sfTQQ.png" /></figure><p>設定：</p><pre>File type : Verilog<br>File name : litefury_test</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/852/1*LZwpEQGRVJotHM32OYaxjg.png" /></figure><p>按 <strong>OK → Finish</strong></p><p>如果接下來出現 <strong>Define Module</strong> 視窗</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/702/1*Y7G3aPwipZJAJbjLSasSsA.png" /></figure><p>先設定：</p><pre>Module name:<br>litefury_test</pre><p>Ports <strong>全部留空</strong>，然後按「 <strong>OK</strong> 」</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/702/1*npQU7ktPfKX3h-bLk66R5g.png" /></figure><p>它是在說：</p><blockquote><em>你沒有修改任何 I/O Port 定義，確定要用目前這個「沒有輸入/輸出腳位」的 Module 嗎？</em></blockquote><p>你現在這一步就是要建立一個<strong>空介面的頂層 module</strong>，所以直接按：「<strong>Yes</strong>」</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jf3IttSxNlCHhEu1oY3hoA.png" /></figure><p>建立完成後，Vivado 會產生類似：</p><pre>module litefury_test(<br><br>    );<br><br>endmodule</pre><p>現在先<strong>不要按 Run Synthesis / Generate Bitstream</strong>。</p><p>下一步真正重要的是取得 <strong>LiteFury 的腳位定義（XDC）</strong>。因為你的 FPGA 雖然確定是 XC7A100T-FGG484，但我們不能只靠晶片型號猜 LiteFury PCB 上的 Clock、LED、PCIe、SPI Flash 等接在哪些 FPGA pins。</p><p>接下來我們這樣做，先找你這張 LiteFury 對應的官方/開源硬體資料，至少確認：</p><pre>LiteFury XC7A100T<br>        │<br>        ├── FPGA：XC7A100T-FGG484  ✓<br>        │<br>        ├── JTAG                   ✓<br>        │<br>        ├── Clock                  ← 下一步<br>        ├── LED / 可測試 GPIO      ← 下一步<br>        ├── PCIe REFCLK<br>        ├── PCIe RX/TX<br>        └── SPI Flash</pre><p>找到正確腳位後，我會帶你建立：</p><pre>litefury_test.v       ← Verilog 程式<br>litefury_test.xdc     ← LiteFury 腳位定義</pre><p>RHS Research 官方 repository 本身就提供了 <strong>Hardware</strong> 與 <strong>Sample-Projects</strong>；官方 Sample Project 已經做到 PCIe x4、DMA 到板載 DDR、識別暫存器等功能。</p><p><a href="https://github.com/RHSResearchLLC/NiteFury-and-LiteFury?utm_source=chatgpt.com">LiteFury 官方 GitHub repository</a></p><p>這張 LiteFury 已經裝在主機板裡、容易被 CPU 散熱器或 GPU 遮住，最適合的第一個範例其實是：</p><blockquote>用 Vivado 的 XADC / System Monitor 直接讀 FPGA 晶片溫度與核心電壓</blockquote><p>這完全不需要看到板子上的 LED，也不需要外接任何 GPIO。7-Series 的 XADC 本身就能透過 JTAG 讀取晶片溫度與供電狀態，而且即使你的設計沒有特別 instantiate XADC，它也可以用預設模式監控內部溫度與電壓。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/485/1*Wr-P4iF-HQxCQBWS6b-Jpg.png" /></figure><p>建議先做「XADC 溫度監控」範例</p><p>先回到：</p><p><strong>Vivado → Open Hardware Manager → Open Target → Auto Connect</strong></p><p>然後左側展開：</p><pre>xc7a100t_0<br>   └─ XADC (System Monitor)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dL3XYlbBEyb8m6cDbcUcjg.png" /></figure><p>點選或雙擊 <strong>XADC (System Monitor)</strong>。</p><p>Vivado 的 System Monitor 可以顯示 FPGA 的：</p><ul><li>Die Temperature</li><li>VCCINT</li><li>VCCAUX</li><li>VCCBRAM</li><li>最高 / 最低溫度紀錄</li></ul><p>這些都是 FPGA 晶片內部的硬體感測值</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Rbivt4aKYUoK5-p7_5f4SQ.png" /></figure><p>這張畫面非常有價值，代表你的 <strong>LiteFury → HS2 → JTAG → Vivado → XADC</strong> 整條鏈路已經正常。</p><p>目前 XADC 顯示：</p><p><strong>FPGA Die Temperature ≈ 63.0°C</strong></p><p>曲線大約維持在 <strong>62.8～63.6°C</strong>，而且相當穩定。</p><p>以你目前 LiteFury 安裝在機殼內、又靠近 CPU/GPU 的環境來看，<strong>63°C 可以正常使用，但溫度不算低</strong>。之後我們真正載入 PCIe、DDR、DMA 或大量邏輯後，功耗會增加，所以建議持續觀察溫度；如果長時間往 80°C 以上走，就值得改善 LiteFury 周圍風流。</p><p>我們可以開始真正寫第一個 FPGA 程式：</p><pre>板載 Clock<br>     ↓<br>XC7A100T<br>     ↓<br>32-bit Counter<br>     ↓<br>ILA Debug Core<br>     ↓<br>JTAG<br>     ↓<br>HS2<br>     ↓<br>Vivado<br>     ↓<br>電腦螢幕直接看 Counter 波形</pre><p>這會比 LED Blink 更有學習價值，因為你會第一次真正完成：</p><p><strong>Verilog → Synthesis → Implementation → Bitstream → Program FPGA → ILA 即時觀察 FPGA 內部訊號</strong></p><p>下一章建議<strong>不要自己再做空白 Counter 專案了</strong>，而是直接切到 LiteFury 官方的 <strong>Project-0</strong>。這樣更適合，因為它本來就包含 <strong>PCIe x4、DMA 到板載 DDR、識別暫存器</strong>，而且是 RHS Research 官方針對 LiteFury 的範例。</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=78c67fd31298" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[[FPGA - 2] LiteFury XC7A100T 驅動程式安裝 & 開發環境建置]]></title>
            <link>https://jscinin.medium.com/fpga-2-litefury-xc7a100t-%E9%A9%85%E5%8B%95%E7%A8%8B%E5%BC%8F%E5%AE%89%E8%A3%9D-%E9%96%8B%E7%99%BC%E7%92%B0%E5%A2%83%E5%BB%BA%E7%BD%AE-c858d1f5246c?source=rss-2743dffd763a------2</link>
            <guid isPermaLink="false">https://medium.com/p/c858d1f5246c</guid>
            <category><![CDATA[litefury]]></category>
            <category><![CDATA[xc7a100t]]></category>
            <category><![CDATA[fpga-xilinx]]></category>
            <dc:creator><![CDATA[Charlie Chen (陳慶裕)]]></dc:creator>
            <pubDate>Tue, 18 Aug 2026 19:01:35 GMT</pubDate>
            <atom:updated>2026-08-19T11:57:01.550Z</atom:updated>
            <content:encoded><![CDATA[<p>當硬體設備全安裝上後，接下來要確認安裝的步驟，如下所示：</p><blockquote>① 【裝置管理員】黃色驚嘆號確認為LiteFury裝置<br>② 安裝 Vivado 2026.1 + Artix-7 device support<br>③ Vivado BASIC 產生有效的 FLEX License 檔案<br>④ Vivado Hardware Manager 確認能看到 <em>xc7a100t</em></blockquote><h3>①【裝置管理員】黃色驚嘆號處理好</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/776/1*w-5aMBKOk8WfpTMj1S4SYA.png" /><figcaption>⚠️ <strong>PCI 裝置</strong></figcaption></figure><p>這個「PCI 裝置」可能<strong>不一定是 LiteFury</strong>，但我們利用以下步驟來了解：</p><pre>右鍵 【PCI 裝置】<br>→「內容」<br>→「詳細資料」<br>上方「內容」選「硬體識別碼」<br>會看到類似：<br>PCI\VEN_XXXX&amp;DEV_XXXX&amp;SUBSYS_...</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/464/1*PS7mKDdd9_Cj3VKxYkvPIA.png" /><figcaption>硬體識別碼</figcaption></figure><p>若看到上圖（硬體識別碼），裝置管理員裡的「PCI 裝置」就是 Xilinx/AMD FPGA 的 PCIe 裝置，而且極可能就是你現在的 LiteFury。</p><pre>進一步說明：<br>PCI\VEN_10EE&amp;DEV_7011<br><br>VEN_10EE = Xilinx Corporation<br>DEV_7011 = 7-Series FPGA Hard PCIe block（AXI/debug）<br>LiteFury 本身正是 XC7A100T Artix-7 + PCIe Gen2 x4 的板子。</pre><p>也就是說，<strong>主機板 M.2 確實有把 LiteFury 當 PCIe 裝置辨識出來</strong>，但是 Windows 尚未有這個 FPGA PCIe Endpoint 的驅動程式。</p><h3>② 安裝 Vivado 2026.1 + Artix-7 device support</h3><p>因為我的環境目前為 Windows 10 22H2 ，所以建議裝 Vivado 2026.1。AMD 官方目前仍明確支援 Windows 10 22H2 Pro/Enterprise；2026.2 已不再支援 Windows 10。</p><p><a href="https://www.amd.com/en/support/downloads/adaptive-socs-and-fpgas/development-tools/2026-1.html?utm_source=chatgpt.com">下載 AMD Unified Installer</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JsgkixNPJTLfHn-a6Mf6IQ.png" /></figure><p>點選後需要先註冊帳號才能進行下載，所以就先填寫資料，再登入後會需要填寫公司資訊才能進行下載軟體</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ENpxbIIeoXOY6dUDI6qPQw.png" /></figure><p>下載完後如下圖，直接點選進行安裝：</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/422/1*lY4HmJxZZ7-dBL1JFz0xdg.png" /></figure><p>出現以下安全性警訊，直接允許存取即可</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/1*pDCIS1zEI4ByddRLm2h80A.png" /></figure><p>接下來安裝步驟會再次需要您輸入帳號&amp;密碼，並直接下一步到選擇項目安裝畫面如下：</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/869/1*OLYj_3fP6J0ivTiTPIRLmg.png" /><figcaption>請選擇Vivado</figcaption></figure><p>請記得點選「Vivado」項目進行安裝，目標是 LiteFury 的 <strong>XC7A100T（Artix-7 FPGA）硬體開發</strong>，用途：Verilog/SystemVerilog、合成、Bitstream、JTAG、ILA、PCIe IP</p><p>安裝選單如下：</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/801/1*tY6_OG5iGNsPnfLMA8pLFg.png" /><figcaption>請依畫面上勾選安裝項目</figcaption></figure><p>依上圖勾選後，點選「Next」</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/872/1*cFEC7r_gZ2znIy4yFhW-lQ.png" /><figcaption>同意 Vivado 與第三方元件的軟體授權條款</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/867/1*0nuGqAFnLsP_Uie25VxcCQ.png" /></figure><p>該畫面看使用者調整，我是不調整，直接「Next」</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/361/1*4aWVWzniQq9b9Ni0ILybsQ.png" /></figure><p>C:\AMDDesignTools 目前不存在，要不要建立這個資料夾？直接選「Yes」</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/871/1*om9CMYkcLQU-yFIVxfI2eg.png" /></figure><p>畫面特別寫：</p><blockquote><strong><em>You MUST disconnect all Xilinx Platform Cable USB II cables before proceeding</em></strong></blockquote><p>你使用的是 <strong>Digilent JTAG-HS2</strong>，但為了避免安裝 Cable Driver 時 USB/JTAG 裝置干擾，我仍建議現在先<strong>把 HS2 的 USB 從電腦拔掉 → 再按 「Install」</strong>（LiteFury 本身可以繼續裝在 M.2，不必拆板子；只是暫時不要讓 HS2 USB 接著電腦）</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/870/1*dBAqGwBTy4_1bfiep4EwKQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/870/1*NxkQ9IeW4VdsEUvynEEVAA.png" /></figure><p>Windows 安全性，直接點選「安裝」</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/867/1*QnovnolTSRyBmx-L265tnw.png" /></figure><p>安裝結束！</p><pre>Windows 10<br>   ↓<br>Digilent HS2 USB<br>   ↓<br>Vivado Hardware Manager<br>   ↓<br>JTAG<br>   ↓<br>LiteFury<br>   ↓<br>XC7A100T</pre><p>安裝完第一件事情不是寫程式，而是先確認 Vivado 能不能透過 HS2 找到 XC7A100T。這一步成功後，再做第一個 LiteFury Bitstream。（記得把Digilent JTAG-HS2的 USB 接回去電腦主機）</p><p>先進行重新開機！</p><h3>③ Vivado BASIC 產生有效的 FLEX License 檔案</h3><p>先進 AMD 官方授權頁：</p><p><a href="https://account.amd.com/en/forms/license/license-form.html?utm_source=chatgpt.com">AMD Product Licensing 官方頁面</a></p><p>填完資料後，點選「Submit」</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0-0fWgOhvAoFvE22-tBwzA.png" /></figure><p>就會進入到【Product Licensing】頁面，<br>選擇「Vivado Basic Tier License, Node Locked License」，也就是免費的 Vivado Basic Node-Locked 授權。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yS-5lDlR5WVqyV-kZ-KQNg.png" /></figure><p>然後按 「<strong>Generate Node-Locked License」</strong>會出現以下畫面</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/797/1*4OfFr5icGf1vMwK1oQXjQg.png" /></figure><p>下一步在【2.System Information】按「Select a host…」</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IZQO8I7g8OWt6zBl3Yq8jQ.png" /></figure><p>通常會讓你新增 Host，Host Name直接設定主機名稱，這時需要取得 Windows 10 這台電腦的 Host ID Value 比較建議你綁定實體有線網卡的 MAC Address，因為 Node-Locked License 會依 Host ID 判斷是不是同一台電腦。</p><p>你這台電腦未來還會繼續作為 LiteFury 開發主機的話，選主機板上的實體 Ethernet 網卡通常最穩定。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FtvdnMLGMH_9cBCY3drNMg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oD9CRwWKc1vDzhtqa2moiA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W5Qbtwhlzwnr6eUaiw3Gfw.png" /></figure><p>成功了。從你的畫面可以確認 <strong>Vivado Basic Tier Node-Locked License 已經產生完成</strong>。</p><blockquote>下一步：把 .lic 安裝進 Windows / Vivado</blockquote><p>先到你的 Email 找 AMD/Xilinx 寄來的信，寄件資訊畫面顯示為 xilinx.notification@entitlenow.com。通常會有一個 .lic License 檔。</p><p><strong>先不要修改 </strong><strong>.lic 內容，</strong>取得後，我們要進行：</p><p><strong>開啟 Vivado License Manager / Vitis License Manager</strong></p><p>開始功能表搜尋：Vivado License Manager，或開啟以下程式「Manage Licenses 2026.1」</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/639/1*dU-9Bgkk-HMY9IVncD7Lhg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/841/1*q6Yqq0bNTBapkQ4kys-jUA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/842/1*gokiysgBoXXc5PCoGWe9hg.png" /></figure><p>成功了，這張畫面代表 <strong>Vivado 2026.1 License 已經正確載入</strong>。</p><h3>④ Vivado Hardware Manager 確認能看到 <em>xc7a100t</em></h3><p>開啟剛剛安裝的「Vivado 2026.1」</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/182/1*mpsoAcFIefBX-6L_zjDG8A.png" /></figure><ol><li>啟動 <strong>Vivado 2026.1</strong></li><li>如果能正常進入主畫面，就代表 License 第一關通過。</li><li>找到 <strong>Hardware Manager</strong></li><li>點 <strong>Open Hardware Manager</strong></li><li>接著選：<br> <strong>Open Target → Auto Connect</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ks-H-x3-yJpki5OgZe9zYg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/613/1*zz2UFH4bW7R_C0JGTOqtHQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zACVPK5RbdnGqwuD4wF5IQ.png" /></figure><p>然後直接點畫面上方藍色：<strong>Open target</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/447/1*UcSkDhucgLeklGxchq1WIA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/609/1*pbjN5fmKy6Tmn2gFVzldJg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/555/1*ZqPMx7Cbyrw3u-z5xIdlPg.png" /></figure><p>成功了。你這張畫面已經明確證明 <strong>LiteFury XC7A100T 的 JTAG 開發環境完全連通</strong>。下一步建議先<strong>不要動原本 LiteFury 的 FPGA 程式</strong>。我們先建立第一個 Vivado 測試 Project。</p><pre>Windows 10<br>   │ USB<br>   ▼<br>Digilent JTAG-HS2<br>   │ JTAG<br>   ▼<br>LiteFury<br>   │<br>   └── Xilinx Artix-7 XC7A100T  ← Vivado 已成功辨識</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c858d1f5246c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[[FPGA - 1] LiteFury XC7A100T 硬體環境建置說明]]></title>
            <link>https://jscinin.medium.com/fpga-1-litefury-xc7a100t-%E7%A1%AC%E9%AB%94%E7%92%B0%E5%A2%83%E5%BB%BA%E7%BD%AE%E8%AA%AA%E6%98%8E-e2d85c8f9c23?source=rss-2743dffd763a------2</link>
            <guid isPermaLink="false">https://medium.com/p/e2d85c8f9c23</guid>
            <category><![CDATA[fpga-xilinx]]></category>
            <category><![CDATA[litefury]]></category>
            <category><![CDATA[xc7a100t]]></category>
            <dc:creator><![CDATA[Charlie Chen (陳慶裕)]]></dc:creator>
            <pubDate>Tue, 18 Aug 2026 12:56:38 GMT</pubDate>
            <atom:updated>2026-08-18T13:07:25.660Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/894/1*qh-_23tCXcvKPjSpXHy3rA.jpeg" /></figure><p>LiteFury XC7A100T 的定位其實很有特色，它不是像 Arty A7 那種「教學型 FPGA 開發板」，而比較像一張可以直接裝進 PC、拿來做 PCIe FPGA 加速器原型的小型運算卡，對於想做的金融程式交易、低延遲運算來說，它相當適合拿來當第一階段 FPGA 平台，但也有幾個很明顯的限制。</p><p>LiteFury 使用 AMD/Xilinx <strong>Artix-7 XC7A100T-L2FGG484E</strong>，做成 M.2 2280 Key-M 外型，可以直接放在 M.2 插槽，或透過 <strong>M.2 → PCIe x4 轉接卡</strong>裝到桌上型電腦。官方開源資料列出的主要規格為：</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/318/1*V7-GFzB2VtGVhkpJBtysbw.png" /><figcaption><strong>LiteFury XC7A100T-L2FGG484E 規格表</strong></figcaption></figure><p>它最大的用途：把 FPGA 當成 PC 的硬體加速器，FPGA 跟 CPU 最大的差別不是單純「時脈比較快」，而是可以把很多運算電路<strong>真正並行化</strong>，所以特別適合 streaming data。</p><h3>把 LiteFury XC7A100T 接上主機板</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KXY0NdHW9BnUaEXk_oIuSw.jpeg" /><figcaption>GA-Z97MX-Gaming 5主機板接上LiteFury</figcaption></figure><p>單只是把 LiteFury XC7A100T 接上主機板還不夠，因為這樣還無法透過系統開發的程式碼寫入晶片，若要寫入還要進行安裝 Digilent JTAG-HS2 ，如下產品：Digilent JTAG-HS2™ Programming Cable for Xilinx® FPGAs（外購）</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/470/1*9bxFRoIxdkbSXJHOrLthYw.jpeg" /><figcaption>Digilent JTAG-HS2™ Programming Cable for Xilinx® FPGAs</figcaption></figure><h3>LiteFury XC7A100T 接上 JTAG-HS2（外購）</h3><p>首先把 LiteFury 接上 JTAG adapter（這是含在 LiteFury 產品裡的接線）</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YhGgRX5FuESRemu1wicYiQ.jpeg" /></figure><p>然後再從 14-Pin JTAG adapter 接上 Digilent JTAG-HS2（外購），如下圖示：</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M5Fk9hIfGoBnOqTtJLTfTg.jpeg" /></figure><p>目前串接流程如下說明：</p><pre>GA-Z97MX-Gaming 5<br>       │<br>       ├── M.2 PCIe ── LiteFury XC7A100T<br>       │                    │<br>       │                 JTAG排線<br>       │                    ↓<br>       │              JTAG Adapter<br>       │                    ↓<br>       │              Digilent JTAG-HS2<br>       │                    │<br>       └──── USB ◀──────────┘</pre><p>可以注意到最後 Digilent JTAG-HS2 串接出來的USB線，要再接回去主機板上的USB，這部份是為了要把開發好的程式碼透過JTAG-HS2（USB線）燒錄到 LiteFury XC7A100T，而不是透過 M.2 PCIe ，這一點要特別注意；程式系統透過M.2 PCIe是為了要處理目前燒錄好的程序正常運作，而不是為了寫入程式碼。</p><h3>以上建置步驟如下：</h3><ul><li>確認 LiteFury 已固定在 M.2</li><li>確認 JTAG 排線與 HS2 都插到底</li><li>HS2 的 USB 插到 <strong>GA-Z97 主機後方 USB</strong></li><li>開啟電腦</li></ul><p>目前就已經完成好 FPGA（LiteFury） 硬體的串接，下一章節將要說明如何安裝驅動程式，以及開發程式安裝。</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e2d85c8f9c23" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[[Python] PTT網站CRAWLER (純code，非說明文章)]]></title>
            <link>https://jscinin.medium.com/craw-d1a649ffc445?source=rss-2743dffd763a------2</link>
            <guid isPermaLink="false">https://medium.com/p/d1a649ffc445</guid>
            <dc:creator><![CDATA[Charlie Chen (陳慶裕)]]></dc:creator>
            <pubDate>Thu, 14 Jul 2022 23:58:10 GMT</pubDate>
            <atom:updated>2022-08-11T20:12:35.976Z</atom:updated>
            <content:encoded><![CDATA[<p>from selenium import webdriver<br>from bs4 import BeautifulSoup<br>import pandas as pd<br>import re<br>import time<br>import datetime<br>import json<br>from selenium.webdriver.firefox.options import Options<br>import sys, os</p><p>timespan = str(int(datetime.datetime.now().timestamp()))</p><p>def get_htmltext():<br> options = Options()<br> options.headless = True<br> driver = webdriver.Firefox(options=options)<br> #driver.get(‘<a href="https://www.pttweb.cc/bbs/NBA&#39;">https://www.pttweb.cc/bbs/NBA&#39;</a>)<br> driver.get(‘<a href="https://www.pttweb.cc/bbs/NBA/search/t/Live&#39;">https://www.pttweb.cc/bbs/NBA/search/t/Live&#39;</a>)<br> time.sleep(1)<br> htmltext = “”<br> #設定range數字，影響文章取得數量(15=&gt;大約100篇文章)<br> for i in range(17):<br> print(i)<br> y = 500 * (i + 1)<br> driver.execute_script(f”window.scrollTo(0, {y})”)<br> time.sleep(2)<br> htmltext += driver.page_source</p><p>driver.close()<br> <br> file1 = open(“ptt_origin_”+timespan+”.txt”,”w”,encoding=”utf-8&quot;)<br> file1.write(htmltext) <br> file1.close() <br> return htmltext</p><p>def parse_htmltext(htmltext):<br> ‘’’<br> 解析臉書貼文與回覆的原始碼。<br> htmltext為原始碼，str<br> star_date為起始日期，datetime.datetime<br> end_date為結束日期，datetime.datetime<br> ‘’’<br> result = []<br> print(‘into parse_htmltext’)<br> <br> soup = BeautifulSoup(htmltext, ‘html.parser’)<br> #body = soup.find(‘body’)<br> body = soup.find_all(‘body’)<br> last_body = 0<br> if len(body) &gt; 0:<br> last_body = len(body) — 1<br> print(‘last_body:’,str(last_body))<br> <br> for body_idx in range(last_body):<br> posts = body[body_idx].select(‘div[class=”mt-2&quot;]’)[0]<br> articles = posts.find_all(‘div’,’e7-container’)<br> print(‘e7-container:’,len(articles))<br> <br> #設定取得多少文章<br> #range_count = 100<br> #if len(articles) &lt; range_count:<br> # range_count = len(articles)<br> #print(‘range_count:’,range_count)<br> #index = 0<br> try:<br> for i in range(len(articles)):<br> print(i)<br> #if index &gt; range_count:<br> # break<br> <br> article_info = {<br> “status”:0,<br> “fail_msg”:””,<br> “index”:0,<br> “push_boo_count”:””,<br> “comment_count”:””,<br> “title”:””,<br> “content_link”:””,<br> “author”:””,<br> “time”:””,<br> “content”:””,<br> “comments”:[]<br> }<br> <br> #推噓數<br> push_boo_count = articles[i].find_all(‘div’,’e7-recommendScore’)<br> if len(push_boo_count) &gt; 0:<br> article_info[“push_boo_count”] = push_boo_count[0].text.replace(‘\n’,’’).strip()<br> print(push_boo_count[0].text.replace(‘\n’,’’).strip())<br> else:<br> continue<br> #留言數 <br> comment_count = articles[i].find_all(‘div’,’e7-recommendCount’)<br> if len(comment_count) &gt; 0:<br> article_info[“comment_count”] = comment_count[0].text.replace(‘\n’,’’).strip()<br> print(comment_count[0].text.replace(‘\n’,’’).strip())<br> else:<br> continue<br> #標題<br> title = articles[i].find_all(‘span’,’e7-show-if-device-is-not-xs’)<br> if len(title) &gt; 0:<br> article_info[“title”] = title[0].text<br> print(title[0].text)<br> else:<br> continue<br> #文章連結<br> content_link = articles[i].find_all(‘a’)<br> if len(content_link) &gt; 0:<br> article_info[“content_link”] = content_link[0].get(‘href’)<br> print(content_link[0].get(‘href’))<br> else:<br> continue<br> #作者<br> author = articles[i].find_all(‘span’,’grey — text e7-link-to-article’)<br> if len(author) &gt; 0:<br> article_info[“author”] = author[0].text<br> print(author[0].text)<br> else:<br> continue<br> #時間<br> time = articles[i].find_all(‘span’,’text-no-wrap’)<br> if len(time) &gt; 0:<br> print(time[1].text)<br> article_info[“time”] = time[1].text<br> else:<br> continue<br> #index<br> #article_info[“index”] = index + 1<br> result.append(article_info)<br> #index = index + 1<br> <br> except Exception as e:<br> exc_type, exc_obj, exc_tb = sys.exc_info()<br> fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]<br> print(exc_type, fname, exc_tb.tb_lineno)<br> article_info[“status”] = 1<br> article_info[“fail_msg”] = “寫入時失敗:”,exc_type,fname,exc_tb.tb_lineno<br> result.append(article_info)</p><p>return result</p><p>#取出所有url文章和留言內容<br>def parse_url_content(articles):<br> print(‘\r\n\r\n parse_urllist_start \r\n\r\n’)<br> print(len(articles))<br> for article in articles:<br> try:<br> if article[“content_link”].strip() != “”:<br> options = Options()<br> options.headless = True<br> driver = webdriver.Firefox(options=options)<br> <br> print(‘<a href="https://www.pttweb.cc&/#39;">https://www.pttweb.cc’</a> + article[“content_link”])<br> driver.get(‘<a href="https://www.pttweb.cc&/#39;">https://www.pttweb.cc’</a> + article[“content_link&quot;])<br> <br> time.sleep(0.2)<br> scrl_count = 10<br> print(article[“comment_count”])<br> if article[“comment_count”].strip() != “” and article[“comment_count”].strip().isnumeric():<br> scrl_count = int(article[“comment_count”])<br> scrl_count_s = int(scrl_count / 10)<br> print(scrl_count)<br> for i in range(scrl_count_s):<br> print(str(i) + “/” + str(scrl_count_s))<br> y = 100 * (i + 1)<br> driver.execute_script(f”window.scrollTo(0, {y})”)<br> time.sleep(0.2)<br> <br> def clickformore():<br> hrefbtns = driver.find_elements_by_tag_name(‘button’) <br> for btn in hrefbtns:<br> try:<br> s = btn.get_attribute(‘class’)<br> except:<br> continue<br> if s == ‘amber — text v-btn v-btn — outline v-btn — depressed theme — dark’:<br> try:<br> btn.click()<br> time.sleep(0.2)<br> except:<br> continue<br> clickformore()<br> clickformore()<br> htmltext = driver.page_source<br> driver.close()<br> <br> #file1 = open(“ptt_commant_”+timespan+”.txt”,”w”,encoding=”utf-8&quot;)<br> #file1.write(htmltext) <br> #file1.close()<br> <br> soup = BeautifulSoup(htmltext, ‘html.parser’)<br> body = soup.find(‘body’)<br> #文章內容<br> #content = body.select(‘div[class=”e7-main-content”]’)<br> content = body.find_all(‘div’,’e7-main-content’)<br> <br> account = body.find_all(‘div’,’e7-author’)<br> push_boo = body.find_all(‘div’,’e7-left’)<br> comment = body.find_all(‘div’,’yellow — text text — darken-2 e7-recommend-message’)<br> w_time = body.find_all(‘div’,’e7-larger-than-xs ml-2 e7-ipdatetime2&#39;)<br> floor = body.find_all(‘span’,’e7-floor e7-xs’)<br> <br> print(content[0].text)<br> if len(content) &gt; 0:<br> print(‘content:’+str(len(content)))<br> article[“content”] = content[0].text<br> <br> for i in range(scrl_count):<br> comment_body = {<br> “account”:””,<br> “push_boo”:””,<br> “comment”:””,<br> “time”:””,<br> “floor”:””<br> }<br> <br> #留言帳號<br> #account = body.find_all(‘div’,’e7-author’)<br> print(“account_count:” + str(len(account)))<br> print(str(i)+”/”+str(scrl_count))<br> if i &lt; len(account):<br> comment_body[“account”] = account[i].text<br> print(‘account:’+account[i].text)<br> #print(account[i].text)<br> #吹噓<br> #push_boo = body.find_all(‘div’,’e7-left’)<br> comment_body[“push_boo”] = push_boo[i].text<br> print(‘push_boo:’+push_boo[i].text)<br> #print(push_boo[i].text)<br> #留言內容<br> #comment = body.find_all(‘div’,’yellow — text text — darken-2 e7-recommend-message’)<br> comment_body[“comment”] = comment[i].text<br> print(‘comment:’+comment[i].text)<br> #print(comment[i].text)<br> #時間<br> #w_time = body.find_all(‘div’,’e7-larger-than-xs ml-2 e7-ipdatetime2&#39;)<br> comment_body[“time”] = w_time[i].text.split(‘,’)[0].strip()<br> print(‘time:’+w_time[i].text.split(‘,’)[0].strip())<br> #print(w_time[i].text.split(‘,’)[0].strip())<br> #樓層<br> comment_body[“floor”] = w_time[i].text.split(‘,’)[1].strip()<br> #floor = body.find_all(‘span’,’e7-floor e7-xs’)<br> print(‘floor:’+w_time[i].text.split(‘,’)[1].strip())<br> print(‘’)<br> <br> article[“comments”].append(comment_body)<br> #for loop end<br> else:<br> continue<br> else:<br> continue<br> print(article)<br> except Exception as e:<br> print(e)<br> exc_type, exc_obj, exc_tb = sys.exc_info()<br> fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]<br> print(exc_type, fname, exc_tb.tb_lineno)<br> <br> return articles<br> <br>def distinct_json_data(data):<br> if len(data) == 0:<br> return<br> <br> limit_all = 100 #限制取得文章數量<br> limit_s = 1 #計算目前取得文章數<br> unique_data = []<br> for i in range(len(data)):<br> if len(unique_data) &gt; 0:<br> flag_uni = False<br> for j in range(len(unique_data)):<br> if unique_data[j][“content_link”] == data[i][“content_link”]:<br> flag_uni = True<br> if flag_uni == False:<br> if limit_s &lt; limit_all:<br> data[i][“index”] = limit_s<br> unique_data.append(data[i])<br> limit_s = limit_s + 1<br> else:<br> break<br> else:<br> unique_data.append(data[i])<br> <br> if limit_s &gt;= limit_all:<br> break<br> <br> return unique_data<br> <br>def make_file(jsons, filename):<br> file1 = open(filename+”_”+timespan+”.json”,”w”,encoding=”utf-8&quot;)<br> file1.write(json.dumps(jsons, indent=4, ensure_ascii=False)) <br> file1.close()</p><p>if __name__ == ‘__main__’:<br> htmltext = get_htmltext()<br> get_all_article = parse_htmltext(htmltext)<br> make_file(get_all_article, ‘get_all_article’)<br> #去除重複的json資料，並且設idx<br> distinct_data = distinct_json_data(get_all_article)<br> make_file(distinct_data, ‘distinct_article’)<br> all_articles_commants = parse_url_content(distinct_data)<br> make_file(all_articles_commants, ‘all_articles_commants’)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d1a649ffc445" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[[AI] [Nvidia Clara 4] NVIDIA Clara-Train-SDK 4.0 進行 2D 圖像 AI 模型訓練 (1)]]></title>
            <link>https://jscinin.medium.com/ai-nvidia-clara-4-nvidia-clara-train-sdk-4-0-%E9%80%B2%E8%A1%8C-2d-%E5%9C%96%E5%83%8F-ai-%E6%A8%A1%E5%9E%8B%E8%A8%93%E7%B7%B4-1-f8558fadf7e8?source=rss-2743dffd763a------2</link>
            <guid isPermaLink="false">https://medium.com/p/f8558fadf7e8</guid>
            <category><![CDATA[ubuntu-20-04]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[training]]></category>
            <category><![CDATA[clara-train-sdk-4]]></category>
            <category><![CDATA[nvidia-clara]]></category>
            <dc:creator><![CDATA[Charlie Chen (陳慶裕)]]></dc:creator>
            <pubDate>Sun, 27 Feb 2022 17:46:18 GMT</pubDate>
            <atom:updated>2022-02-28T18:40:23.338Z</atom:updated>
            <content:encoded><![CDATA[<p>接下來要進行說明的是 Clara 的訓練過程，本篇以2D圖像為訓練教材，請先準備好 Clara-Train-SDK:4.0 的 Docker image 來進行訓練。請參閱文章『<a href="https://jscinin.medium.com/ai-nvidia-clara-4-nvidia-triton-inference-server-%E5%BB%BA%E7%BD%AE%E8%AA%AA%E6%98%8E-wsl2-ubuntu-20-04-9e700559652b">[AI] [Nvidia Clara 4] NVIDIA Triton Inference Server 建置說明 (WSL2-Ubuntu 20.04)</a>』，若已經下載過了，就直接往下步驟看。</p><p>由於訓練過程都是自己摸索出的結論，所以本篇只是闡述個人對於 Nvidia Clara 訓練的操作過程，所以config_aiaa.json大致上不會去改變任何作業流程，對於訓練的結果及辨識程度，則不在本篇研究之中。</p><p>— — — — — — — — — — — — — — — — — — — — — — —</p><p>訓練流程如下列表：</p><p><strong>一、請至 Nvidia NGC 下載 Model</strong></p><p><strong>二、下載 Dataset 圖檔</strong></p><p><strong>三、調整 config</strong></p><p><strong>四、進行訓練</strong></p><p>— — — — — — — — — — — — — — — — — — — — — — —</p><p>以下為本篇開始介紹訓練資料集流程，內文中的Dataset編輯，實務上會因方法、用途、目的等而撰寫不同的設計方式，但是目前只是希望先執行過一次體驗訓練過程，至於當中的正確性則不在本篇討論範圍內，只針對訓練流程做說明。</p><blockquote><strong>步驟一、請至 Nvidia NGC 下載 Model</strong></blockquote><p>進入 Nvidia NGC 後，左邊menu點選 Model 選單，搜尋「<strong>clara_pt_pathology_metastasis_detection</strong>」下載模組，（目前Clara models提供2D圖像只有二個，另一個為X-Ray圖像模型，但應該是 SDK 4.0 以下版本，這邊就不再說明）</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q4uQoPU9L9cC2PJcWkN7wQ.png" /></figure><p>下載完後請解壓縮，可以先查看config/datalist_0.json，裡面是所有要訓練資料的檔案列表格式資訊，也可以發現至對應的資料夾裡找不到圖檔，下一章就來說明。</p><blockquote><strong>步驟二、下載 Dataset 圖檔</strong></blockquote><p>其實有注意多看幾眼剛剛 NGC 裡的訓練檔資訊，可以了解到這個訓練模組是取之於「Camelyon16」資料集作為基礎，當中就可以得到圖檔的下載位<a href="http://gigadb.org/dataset/100439">址 http://gigadb.org/dataset/1004</a>39</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7VDo0zInu_TQMu7fqGT_wA.png" /></figure><p>如果全部下載的話，大概至少有700GB以上，所以硬碟空間要先準備一下，那這次只有先下載5個圖檔，分別為tumor_001.tif, tumor_002.tif, tumor_003.tif, tumor_105.tif, test_001.tif，請分別放至以下資料夾，下章就要開始為準備config，做訓練前的調整格式。</p><p><strong>/data/training/images</strong>資料夾放入：tumor_001.tif, tumor_002.tif, tumor_003.tif, tumor_105.tif</p><p><strong>/data/testing/images</strong>資料夾放入：test_001.tif</p><p>本資料集每個圖檔都至少1GB以上，所以可能會遇到圖像無法開啟的情況，我甚至為了打開還安裝PhotoShop也是不行，這個問題就要看各位怎麼去處理了（我最後是寫C#把圖像進行縮圖才確認這個圖像Dataset和訓練Model是一致）</p><blockquote><strong>步驟三、調整 config</strong></blockquote><p><strong>1.調整environment.json，指定 DATA_ROOT 到 dataset 資料夾</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/793/1*TQ0JAp7jXR4L67A23AwAZw.png" /></figure><p><strong>2.撰寫程式調整datalist_0.json</strong></p><p>這份datalist_0.json因為是記錄Camelyon16所有圖檔(700GB以上)，但目前我只有下載5個圖檔，所以json檔內容要進行調整，請在/config 底下先備份datalist_0.json檔案(方便之後調整json內容用)，並建立一個python程式如下：</p><pre>import json<br> <br># Opening JSON file (備份datalist_0.json檔案)<br>f = open(&#39;datalist_0_o.json&#39;)</pre><pre>new_list = {<br>&quot;training&quot;: [],<br>&quot;validation&quot;: [],<br>&quot;testing_one&quot;: [],<br>&quot;testing_two&quot;: [],<br>&quot;testing&quot;: []<br>}<br> <br># returns JSON object as<br># a dictionary<br>data = json.load(f)<br> <br># Iterating through the json<br># list<br>for i in data[&#39;training&#39;]:<br>    if i[&quot;image&quot;] == &quot;training/images/tumor_001.tif&quot;:<br>        print(i)<br>        new_list[&quot;training&quot;].append(i)<br>    if i[&quot;image&quot;] == &quot;training/images/tumor_002.tif&quot;:<br>        print(i)<br>        new_list[&quot;training&quot;].append(i)<br>    if i[&quot;image&quot;] == &quot;training/images/tumor_003.tif&quot;:<br>        print(i)<br>        new_list[&quot;training&quot;].append(i)<br>for i in data[&#39;validation&#39;]:<br>    if i[&quot;image&quot;] == &quot;training/images/tumor_105.tif&quot;:<br>        print(i)<br>        new_list[&quot;validation&quot;].append(i)<br> <br># Closing file<br>f.close()</pre><pre># write file<br>jsonString = json.dumps(new_list, indent=4)<br>jsonFile = open(&quot;datalist_0.json&quot;, &quot;w&quot;)<br>jsonFile.write(jsonString)<br>jsonFile.close()</pre><p>請建立後，並且執行程式，就會產生新的datalist_0.json，打開它後，請用你任何方式把test_001.tif寫入datalist_0.json，如下testing_one、testing_two、testing等這三個屬性都填上資料（本篇為介紹訓練過程之用，所以資料集撰寫方式正確性不在此限內討論，請斟酌參考）</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*tWsnMYOPjQgoqqD47JAlXQ.png" /></figure><blockquote><strong>步驟四、進行訓練</strong></blockquote><ol><li>進入docker系統，說明下面指令中source=/home/{username}/{models}，對應本機model資料夾的系統位址，{username}為系統使用者名稱，{models}為放置model的資料夾名稱；進入Docker後，建議把/workspace/clara-experiments資料夾權限全開。</li></ol><p>Docker執行CPU指令用：</p><pre>sudo docker run -it --rm --shm-size=1G --ulimit memlock=-1 --ulimit stack=67108864 --ipc=host --net=host --mount type=bind,source=/home/{username}/{models},target=/workspace/clara-experiments nvcr.io/nvidia/clara-train-sdk:v4.0 /bin/bash</pre><p>Docker啟動GPU指令用：</p><pre>sudo docker run -it --rm --gpus=1 --shm-size=1G --ulimit memlock=-1 --ulimit stack=67108864 --ipc=host --net=host --mount type=bind,source=/home/{username}/{models},target=/workspace/clara-experiments nvcr.io/nvidia/clara-train-sdk:v4.0 /bin/bash</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/786/1*VTGubjjczoAtkzIgTlLAVg.png" /></figure><p>資料夾/workspace/clara-experiments目錄下權限全開：</p><pre>sudo chmod -R 777 ./</pre><p>2. 到訓練資料夾裡，執行指令/workspace/clara-experiments/{模型資料夾名稱}/commands</p><pre>cd /workspace/clara-experiments/clara_pt_pathology/commands</pre><p>接著執行設定環境變數</p><pre>./set_env.sh</pre><p>3. 執行指令『./train.sh 0』我的主機約8小時跑完4張圖，之後會產生models/models.pt檔案</p><pre>./train.sh 0</pre><p>4. 執行指令『./export.sh』隨即會產生models/models.ts檔案</p><pre>./export.sh</pre><p>5. 訓練好之後，接下來就可以再進行打包，因為圖檔太大可刪除data資料夾再壓縮成zip，就可以上傳檔案至Triton Inference Server（至少要有config_aiaa.json、models.ts），請參考【<a href="https://jscinin.medium.com/ai-nvidia-clara-4-nvidia-triton-inference-server-%E9%80%B2%E8%A1%8C-client-%E7%AB%AF%E9%81%8B%E4%BD%9C-%E4%B8%8A%E5%82%B3model%E5%8F%8A%E6%93%8D%E4%BD%9C%E8%AA%AA%E6%98%8E-3d-slicer-d25e0ab8e711"> [AI] [Nvidia Clara 4] NVIDIA Triton Inference Server 進行 Client 端運作，上傳Model及操作說明(3D Slicer)</a>】</p><p>以上只是很簡單說明訓練 Clara SDK 過程，當中其實還有很多細節可以參考<a href="https://docs.nvidia.com/clara/clara-train-sdk/index.html">官方Clara-Train-SDK 4.0文件</a>，和需要自己去找資料了解dataset和datalist_0.json裡組成的要素，之後有機會再來寫第二篇有關這model更進階的說明，但會是在什麼時候…等我心血來潮的那一天吧…謝謝！</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f8558fadf7e8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[[AI] [Nvidia Clara 4] NVIDIA Triton Inference Server 進行 Client 端運作，上傳Model及操作說明(3D Slicer)]]></title>
            <link>https://jscinin.medium.com/ai-nvidia-clara-4-nvidia-triton-inference-server-%E9%80%B2%E8%A1%8C-client-%E7%AB%AF%E9%81%8B%E4%BD%9C-%E4%B8%8A%E5%82%B3model%E5%8F%8A%E6%93%8D%E4%BD%9C%E8%AA%AA%E6%98%8E-3d-slicer-d25e0ab8e711?source=rss-2743dffd763a------2</link>
            <guid isPermaLink="false">https://medium.com/p/d25e0ab8e711</guid>
            <category><![CDATA[clara]]></category>
            <category><![CDATA[nvidia]]></category>
            <category><![CDATA[3dslicer]]></category>
            <dc:creator><![CDATA[Charlie Chen (陳慶裕)]]></dc:creator>
            <pubDate>Mon, 21 Feb 2022 18:56:24 GMT</pubDate>
            <atom:updated>2022-03-03T15:53:55.768Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*1uwrViqZPZp9tYzufityVQ.png" /></figure><p>上一篇【<a href="https://jscinin.medium.com/ai-nvidia-clara-4-nvidia-triton-inference-server-%E5%BB%BA%E7%BD%AE%E8%AA%AA%E6%98%8E-wsl2-ubuntu-20-04-9e700559652b">[AI] [Nvidia Clara 4] NVIDIA Triton Inference Server 建置說明 (WSL2-Ubuntu 20.04)</a>】介紹完 Server 端建置說明後，本篇將進行 Client 端實務操作，說明的流程大致分以下幾點來看：</p><p>— — — — — — — — — — — — — — — — — — — — — — —</p><p><strong>一、上傳 Model 至 Triton Inference Server</strong></p><p><strong>二、下載 Client 端標記程式 (3D Slicer)</strong></p><p><strong>三、3D Slicer 伺服器設置 Triton Inference Server 位址</strong></p><p><strong>四、自動標記操作說明</strong></p><p>— — — — — — — — — — — — — — — — — — — — — — —</p><blockquote><strong>一、上傳 Model 至 Triton Inference Server</strong></blockquote><p>Clara 訓練好的 Model 可以從 <a href="https://catalog.ngc.nvidia.com/">Nvidia NGC</a> 上去做下載的動作，這邊就不再細細說明，就直接從現有的 Model 進行上傳，以下是我已經從 NGC 下載的 Model 名稱為【clara_pt_covid19_ct_lung_segmentation.zip】</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/363/1*p_LVHVz63lNiahr2qA8HOw.png" /></figure><p>再來我們確定一下 <strong>Triton Inference Server </strong>的 Docker 是否還在運作中，執行以下指令</p><pre>sudo docker ps</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/919/1*y_RPpNbgEtzCtxNesiifJg.png" /></figure><p>確認沒有問題後，就可以準備一下 Model 準備上傳，從 NGC 準備好的模型名稱『clara_pt_covid19_ct_lung_segmentation.zip』來進行上傳</p><p>先到檔案目錄下: (依自己放置位子)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/648/1*rcvYI7tBPo_rMDizPz1HAg.png" /></figure><p>接下來進行指令上傳：</p><pre>curl -X PUT &quot;127.0.0.1:5000/admin/model/clara_pt_covid19_ct_lung_segmentation&quot; -F &quot;data=<a href="http://twitter.com/clara_pt_covid19_ct_">@clara_pt_covid19_ct_</a>lung_segmentation.zip&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/776/1*twCVaA71Dbpl0RligAVRpA.png" /></figure><p>若出現以上訊息代表成功，接下來我們就進行 Client 端標記實做。</p><blockquote><strong>二、下載 Client 端標記程式 (3D Slicer)</strong></blockquote><p>接下來 client 端程式，目前 Clara 官方支援二套程式為 3D Slicer、MITK，現在要說的是運用 3D Slicer 來進行自動標記作業，請先至以下網址下載安裝</p><p><a href="https://download.slicer.org/">https://download.slicer.org/</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/841/1*dD55a618xiIX4WGooXEOlw.png" /></figure><p>這邊是下載最近的版本Preview Release，原因是跟Stable Release版本相差快1年時間，兩者之間還是存在一些小落差，所以比較建議用最新版本，執行後如下畫面：</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g-rIHY2h6KlHR5uD-h3arw.png" /></figure><p>首先要先在 3D Slicer 進行安裝 AIAA 的擴充套件，從『view』--&gt;『Extensions Manager』</p><p>出現新視窗後點選『Install Extensions』--&gt; 搜尋套件 『NvidiaAIAssistedAnnotation』然後進行安裝。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oUO1lH1vavbMKbNIlN7eLw.png" /></figure><blockquote><strong>三、3D Slicer 伺服器設置 Triton Inference Server 位址</strong></blockquote><p>接下來我們需要進行 <strong>Triton Inference Server </strong>的連結設定，請點選以下圖示位址【Edit】 →【Application Settings】</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/530/1*oZr73ezqmfUEC2YPMdkHWQ.png" /></figure><p>再請以下紅框設定，Url為 Server 端 <strong>Triton Inference Server </strong>的位址，如果有改變設定，也請一併改掉。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/391/1*CwYLhqeOGpkW3UyuYc4u0A.png" /></figure><p>以上就大致設定好 Client 端連結 Server 端的參數，接下來就要進入自動推論</p><blockquote><strong>四、自動標記操作說明</strong></blockquote><p>首先請下載好資料集，請根據您上傳的 Model 來選擇 Dataset，以下已經有自行下載 lung 的資料集，請各位自行去搜尋。(本篇預防有任何侵權行為，將不提供資料集下載)</p><ol><li>載入圖片</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/402/1*Ce6XQ6lU_k5raSZkesi9TA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/739/1*QM18YLma1Pj2_HSezhXWTQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hu1EW2dc_k-m4zWVcaVPDQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/743/1*dd72nxh2Hj2vOWPy3AYjvQ.png" /></figure><p>接下來就會出現圖示在 3D Slicer上</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kBCkGQYweFR0Kyy72GXVpg.png" /></figure><p>2.再來我們進行標記作業的流程</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/614/1*dtYgqEY3xEF9jHDO8hDrKQ.png" /></figure><p>3.出現以下畫面，再進行點選【Add】和【AIAA】的圖示，然後就可以點選【Start】。（藍色框的部份需要注意一下server端位址和model的填選）</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kM3mADDJTzhfSyDlkPkDaw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/274/1*A-kvyspxzMELj2ZLdxMgIw.png" /></figure><p>回傳成功後就會像以下的畫面，代表自動推論已經把 lung 的區域(藍色透明)標記出來，是不是很神速~完全不經人手操作標記</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ipZ6j_DBVIkgE5jJHfqOyQ.png" /></figure><p>這篇就介紹到這邊，本篇多是以 Client 端操作為主，如果有興趣的話，可以自己進行玩看看吧！(記得上一篇【<a href="https://jscinin.medium.com/ai-nvidia-clara-4-nvidia-triton-inference-server-%E5%BB%BA%E7%BD%AE%E8%AA%AA%E6%98%8E-wsl2-ubuntu-20-04-9e700559652b">[AI] [Nvidia Clara 4] NVIDIA Triton Inference Server 建置說明 (WSL2-Ubuntu 20.04)</a>】需要先操作完喔)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d25e0ab8e711" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[[AI] [Nvidia Clara 4] NVIDIA Triton Inference Server 建置說明 (WSL2-Ubuntu 20.04)]]></title>
            <link>https://jscinin.medium.com/ai-nvidia-clara-4-nvidia-triton-inference-server-%E5%BB%BA%E7%BD%AE%E8%AA%AA%E6%98%8E-wsl2-ubuntu-20-04-9e700559652b?source=rss-2743dffd763a------2</link>
            <guid isPermaLink="false">https://medium.com/p/9e700559652b</guid>
            <category><![CDATA[nvidia-clara]]></category>
            <category><![CDATA[wsl-2]]></category>
            <category><![CDATA[ubuntu-20-04]]></category>
            <dc:creator><![CDATA[Charlie Chen (陳慶裕)]]></dc:creator>
            <pubDate>Sat, 19 Feb 2022 18:30:40 GMT</pubDate>
            <atom:updated>2022-02-21T16:25:50.929Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/625/1*wjcPpy0DFISUMV6dftSpOQ.png" /><figcaption>AI 推論工作流程</figcaption></figure><p>關於 Triton Inference Server 的說明可參閱一下官方的說明如下：</p><p><a href="https://developer.nvidia.com/nvidia-triton-inference-server">https://developer.nvidia.com/nvidia-triton-inference-server</a></p><p><a href="https://blogs.nvidia.com.tw/2021/01/26/simplifying-and-scaling-inference-serving-with-triton-2-3/">https://blogs.nvidia.com.tw/2021/01/26/simplifying-and-scaling-inference-serving-with-triton-2-3/</a></p><p>這邊主要是說明如何快速建置 Triton Inference Server 系統，所以只用下面簡單的一句話開門見山。</p><blockquote>Triton Inference Server 打造影像人工智慧的標記伺服器服務，目的在於自動回傳推論標記結果。</blockquote><p>所以可想而知，在 AI 訓練過程中，最需要人力繁瑣的地方，莫過於標記圖檔的工作，所以 Triton Inference Server 等於是為 AI 標記的工作員省下很多手工的部份，也為 AI 標記邁向新的里程碑。</p><p>— — — — — — — — — — — — — — — — — — — — — — —</p><p>安裝流程如下列表：</p><p><strong>一、安裝 Docker</strong></p><p><strong>二、安裝 Docker-Compose</strong></p><p><strong>三、安裝 Nvidia-Container-Runtime</strong></p><p><strong>四、安裝 PyTorch</strong></p><p><strong>五、安裝 MONAI</strong></p><p><strong>六、下載 Docker image (Clara-Train-SDK、TritonServer)</strong></p><p><strong>七、建置啟動 Server 端 Docker (Clara-Train-SDK、TritonServer)</strong></p><p>— — — — — — — — — — — — — — — — — — — — — — —</p><blockquote>Triton Inference Server 建置，開始進行安裝流程：</blockquote><blockquote><strong>一、安裝Docker</strong></blockquote><p>1.1 需要等一陣子，並輸入root密碼</p><pre>curl <a href="https://get.docker.com/">https://get.docker.com</a> | sh</pre><p>1.2</p><pre>distribution=$(. /etc/os-release;echo $ID$VERSION_ID)</pre><p>1.3</p><pre>curl -s -L <a href="https://nvidia.github.io/nvidia-docker/gpgkey">https://nvidia.github.io/nvidia-docker/gpgkey</a> | sudo apt-key add -</pre><p>1.4</p><pre>curl -s -L <a href="https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list">https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list</a> | sudo tee /etc/apt/sources.list.d/nvidia-docker.list</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*80ZSFqqUdk-NNaQ9aiMWlw.png" /></figure><p>1.5 更新軟件</p><pre>sudo apt-get update</pre><p>1.6</p><pre>sudo apt-get install -y nvidia-docker2</pre><p>1.7</p><pre>sudo service docker stop<br>sudo service docker start</pre><p>1.8 問題排解，在啟動docker出現下面訊息的話，再執行以下指令<br>&gt;&gt;&gt; docker: unrecognized service</p><pre>curl -fsSL <a href="https://get.docker.com/">https://get.docker.com</a> -o get-docker.sh<br>sudo sh get-docker.sh<br>(需要等待10~20分鐘)</pre><pre>sudo service docker start</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bKBFe4RMk5iavP6DZkbxHg.png" /></figure><blockquote><strong>二、安裝Docker-Compose</strong></blockquote><p>2.1</p><pre>sudo curl -L &quot;<a href="https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname">https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname</a> -s)-$(uname -m)&quot; -o /usr/local/bin/docker-compose</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XDlhCsvI6BN6ER1K0UaCmw.png" /></figure><p>2.2</p><pre>sudo chmod +x /usr/local/bin/docker-compose</pre><p>2.3</p><pre>sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose</pre><p>2.4</p><pre>docker-compose --version</pre><p>2.5</p><pre>docker-compose migrate-to-labels</pre><blockquote><strong>三、安裝 Nvidia-Container-Runtime</strong></blockquote><p>3.1</p><pre>sudo apt-get install nvidia-container-runtime</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/969/1*K2MfbyX8YnxKjfz4tzCPKQ.png" /></figure><p>3.2</p><pre>sudo which nvidia-container-runtime-hook</pre><blockquote><strong>四、安裝PyTorch</strong></blockquote><p>4.1</p><pre>sudo pip3 install torch==1.10.0+cu113 torchvision==0.11.1+cu113 torchaudio==0.10.0+cu113 -f <a href="https://download.pytorch.org/whl/cu113/torch_stable.html">https://download.pytorch.org/whl/cu113/torch_stable.html</a></pre><p>4.2</p><pre>sudo apt install net-tools</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/924/1*StNjm84JuC-1PpAoJzxJTw.png" /></figure><p><strong>五、安裝MONAI</strong></p><p>5.1</p><pre>sudo pip install monai</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/759/1*cqdjioR_8w818SM69NyAKw.png" /></figure><p>5.2</p><pre>sudo pip install monai-weekly</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZQ7ssMrw6oUq2yOgEPQTQg.png" /></figure><p>5.3</p><pre>sudo pip install git+<a href="https://github.com/Project-MONAI/MONAI#egg=monai">https://github.com/Project-MONAI/MONAI#egg=monai</a></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MDoiL4YUOxlZG12LxnkZAw.png" /></figure><p>5.4</p><pre>sudo BUILD_MONAI=1 pip install git+<a href="https://github.com/Project-MONAI/MONAI#egg=monai">https://github.com/Project-MONAI/MONAI#egg=monai</a></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qthVdmOIZeIrbg9bjEXdbg.png" /></figure><p>5.5</p><pre>sudo BUILD_MONAI=1 pip install --no-build-isolation git+<a href="https://github.com/Project-MONAI/MONAI#egg=monai">https://github.com/Project-MONAI/MONAI#egg=monai</a></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vAiIKvvup-ltD9G1xzLwGw.png" /></figure><blockquote><strong>六、下載 Docker image (Clara-Train-SDK、TritonServer)</strong></blockquote><p>6.1 pull clara-train-sdk:v4.0 image</p><pre>sudo docker pull nvcr.io/nvidia/clara-train-sdk:v4.0</pre><p>6.2 pull tritonserver:21.02-py3 image</p><pre>sudo docker pull nvcr.io/nvidia/tritonserver:21.02-py3</pre><blockquote><strong>七、建置啟動 Server 端 Docker (Clara-Train-SDK、TritonServer)</strong></blockquote><p>7.1 製作資料夾 aiaa_experiments</p><pre>mkdir aiaa_experiments<br>sudo chmod -R 777 .<br>cd aiaa_experiments</pre><p>7.2 參考以下網址製作二份檔案 (docker-compose.yml、docker-compose.env)，並放入 aiaa_experiments 資料夾</p><p><a href="https://docs.nvidia.com/clara/clara-train-sdk/aiaa/quickstart.html?highlight=docker%20compose%20yml">Getting Started — Clara Train SDK v4.0 documentation (nvidia.com)</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/203/1*CVjN9vtF8znO2dazr_1_pw.png" /></figure><p>7.3 執行以下指令</p><pre>docker-compose --env-file docker-compose.env -p aiaa_triton up --remove-orphans -d</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dF6xwOU9oGK1gZgyI9x3vw.png" /></figure><pre>sudo docker ps</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oRUeVju0WY_Nb305Aqpjrw.png" /></figure><p>以上若有看到二個docker都已經順利執行，而這篇文章就交代好 Server 端的設置成功為止，下一篇文章主要會來說明 Client 端程式如何做到自動標記，謝謝。</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9e700559652b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[[WSL] 利器 LxRunOffline 查詢虛擬機實體位址及克隆(Clone)虛擬機]]></title>
            <link>https://jscinin.medium.com/wsl2-%E6%9F%A5%E8%A9%A2%E8%99%9B%E6%93%AC%E6%A9%9F%E5%84%B2%E5%AD%98%E4%BD%8D%E5%9D%80%E5%8F%8A%E5%85%8B%E9%9A%86-clone-%E8%99%9B%E6%93%AC%E6%A9%9F-c47059ae029b?source=rss-2743dffd763a------2</link>
            <guid isPermaLink="false">https://medium.com/p/c47059ae029b</guid>
            <category><![CDATA[lxrunoffline]]></category>
            <category><![CDATA[wsl]]></category>
            <dc:creator><![CDATA[Charlie Chen (陳慶裕)]]></dc:creator>
            <pubDate>Wed, 15 Dec 2021 06:30:19 GMT</pubDate>
            <atom:updated>2021-12-15T08:19:28.904Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://github.com/DDoSolitary/LxRunOffline">GitHub - DDoSolitary/LxRunOffline: A full-featured utility for managing Windows Subsystem for Linux (WSL)</a></p><p>LxRunOffline 是個支援 WSL 的一套軟體，請先下載</p><p><a href="https://github.com/DDoSolitary/LxRunOffline/releases/download/v3.5.0/LxRunOffline-v3.5.0-mingw.zip">https://github.com/DDoSolitary/LxRunOffline/releases/download/v3.5.0/LxRunOffline-v3.5.0-mingw.zip</a></p><blockquote>一、下載完後在解壓縮後的資料夾下，輸入以下指令，可以查看目前的虛擬機：</blockquote><pre>LxRunOffline.exe l</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/442/1*eXYpFh8hqQpJzzH-ttOgag.png" /></figure><blockquote>二、查詢某一虛擬機的存放位址：</blockquote><pre>lxrunoffline get-dir -n Ubuntu-20.04</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/845/1*z-fQeB_IRR4nJ4JZu7wSWg.png" /></figure><blockquote>三、克隆(clone)虛擬機</blockquote><pre>LxRunOffline.exe d -n Ubuntu-20.04 -d c:\wsl2\Ubuntu-20.04-20211207\ -N Ubuntu-20.04-20211207-1</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/962/1*qLP5y457Xd6IbWfPo9OjIA.png" /></figure><p>克隆完，也請記得在 docker desktop 開啟 WSL 虛擬機的支援</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KVyu-lw4JHmhr8WgWdoH_A.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c47059ae029b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[[Codility] [後記]]]></title>
            <link>https://jscinin.medium.com/codility-%E5%BE%8C%E8%A8%98-6d3f5164f17e?source=rss-2743dffd763a------2</link>
            <guid isPermaLink="false">https://medium.com/p/6d3f5164f17e</guid>
            <category><![CDATA[csharp]]></category>
            <category><![CDATA[codility]]></category>
            <dc:creator><![CDATA[Charlie Chen (陳慶裕)]]></dc:creator>
            <pubDate>Wed, 15 Dec 2021 02:15:52 GMT</pubDate>
            <atom:updated>2024-01-30T13:28:51.264Z</atom:updated>
            <content:encoded><![CDATA[<p>感覺滿有趣的網站，而且測驗的網站做得很好，至少不會讓你感覺距離操作Visual Studio太遠，算是很容易上手。</p><p>然後，我參與了某機構給的測驗後，我感覺很失落…在120分裡要解6個題目，其實我覺得光理解題意也差不多佔1/4的時間(英文出題)，有一題我沒時間寫…到現在回想起來，覺得它應該是要求最小公倍數吧！？除了這題不說，其它不知道是不是每題寫完都要按【Submit】，還是全部做完才按一次就好？總之有二題沒得到分數(一題寫到一半)，我很意外，因為執行階段裡至少有成功跑過一個測試，還有一題原本想說可以得到100分，卻只有50分，另一題100分</p><p>整體考試很不理想…但其實機會只有一次，邏輯夠清楚其實都可以透過程式寫出來，只是有沒有看懂而已，真的比較適合畢業的學生試試，因為寫程式寫多了，就會發現有些細節說明是可以延伸演繹，這就變成專案中要釐清的需求問題，所以做過一些專案再來測驗，其實會相對容易把題目複雜化。</p><p>總之，這個經驗對我來說很特別，感覺很像回到資策會求學的階段，每天晚上都有題目給你腦力激盪，那種感覺真的很有意思~！直到現在，我還是覺得資策會是個很棒的機構，可以從無到有的把一套程式語言學到好（當然心態也是很重要），當時的我，目標是想要做出一個產品，所以就有一種破釜沉舟的心要把它學好，但一頭栽進去就出不來，因為根本學不完，希望我這苦行僧的修行道路上能夠越來越順遂，走過的崎嶇道路能夠越走越平。</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6d3f5164f17e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>