<?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 gary.TsAI(Taiwan A.I.) on Medium]]></title>
        <description><![CDATA[Stories by gary.TsAI(Taiwan A.I.) on Medium]]></description>
        <link>https://medium.com/@gary.tsai.advantest?source=rss-52b6c57e94fa------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*BQn7NNMI8nZs2VxMi2-RpQ.jpeg</url>
            <title>Stories by gary.TsAI(Taiwan A.I.) on Medium</title>
            <link>https://medium.com/@gary.tsai.advantest?source=rss-52b6c57e94fa------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 16:37:40 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@gary.tsai.advantest/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[️ LangChain + Pinecone + Llama2 基於 RAG 的 LLM，讀取自己的 .pdf  來回答問題]]></title>
            <link>https://medium.com/@gary.tsai.advantest/%EF%B8%8F-langchain-pinecone-llama2-%E5%9F%BA%E6%96%BC-rag-%E7%9A%84-llm-%E8%AE%80%E5%8F%96%E8%87%AA%E5%B7%B1%E7%9A%84-pdf-%E4%BE%86%E5%9B%9E%E7%AD%94%E5%95%8F%E9%A1%8C-bf62244feb91?source=rss-52b6c57e94fa------2</link>
            <guid isPermaLink="false">https://medium.com/p/bf62244feb91</guid>
            <category><![CDATA[llama-2]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[langchain]]></category>
            <category><![CDATA[pinecone]]></category>
            <dc:creator><![CDATA[gary.TsAI(Taiwan A.I.)]]></dc:creator>
            <pubDate>Wed, 20 Sep 2023 08:18:21 GMT</pubDate>
            <atom:updated>2023-09-20T08:18:21.536Z</atom:updated>
            <content:encoded><![CDATA[<h3>🦜️ LangChain + Pinecone + Llama2 🦙基於 RAG 的 LLM，讀取自己的 .pdf 來回答問題</h3><ul><li>💻 從頭開始​​開發基於檢索增強生成<strong><em>（RAG）</em></strong>的<strong><em> LLM </em></strong>程式。</li><li>🚀 整體流程（加載、分塊、嵌入、索引）</li></ul><h3>動機</h3><p>近年來，隨著科技巨頭釋出越來越多的開源的大型語言模型 <strong><em>（Large Language Model, LLM）</em></strong>，許多人可能受到新聞報導的啟發，希望將這些模型應用於比純粹的對話更為嚴肅的任務，如數據分析或程式編寫。然而，基於模型的訓練資料的數量和多樣性，<strong><em>LLM </em></strong>可能無法滿足某些特定任務的需求。舉例而言，當我詢問 <strong><em>2024 </em></strong>年台灣的總統誰會當選時，<strong><em>LLM </em></strong>可能無法提供正確答案，因為它的知識截止日期止於 <strong><em>2021 </em></strong>年 <strong><em>9 </em></strong>月。</p><p>面對這種情況，讓我們首先關注 <strong><em>HuggingFace </em></strong>的 <strong><em>LLM </em></strong>排行榜。你會發現在前 <strong><em>100 </em></strong>名模型中幾乎找不到預訓練模型<strong><em>（pre-trained）</em></strong>的蹤跡，即使是像九月最新上線的<strong><em> Falcon 180B </em></strong>這樣具有數千億參數的模型，在特定任務上仍然可能無法勝任。</p><p>因此，我們必須採用自定義/客製化的資料強化 <strong><em>LLM</em></strong>，以使其能夠適應特定任務或提高性能。目前，主要有兩種主流操作策略：微調<strong><em>（fine-tuning）</em></strong>和檢索增強生成。<strong><em>fine-tuning</em></strong> 是修改 <strong><em>LLM </em></strong>的內部參數，使其更專業化，而 <strong><em>RAG</em></strong> 則通過在推理過程中整合外部知識<strong><em>（</em></strong>例如讀取 <strong><em>PDF </em></strong>檔案<strong><em>）</em></strong>，來擴展 <strong><em>LLM </em></strong>的能力。</p><h3>RAG Architecture Diagram</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*iIKckIYOfy-G8r9s.png" /></figure><p><strong><em>RAG</em></strong> 是一種動態的操作方法<strong><em>（Approach）</em></strong>，它將外部資料嵌入<strong><em>（Embedings）</em></strong>成向量格式式並存儲在向量資料庫中<strong><em>（Pinecone</em></strong> 或是 <strong><em>ChromaDB）</em></strong>，然後進行索引<strong><em>（Indexes）</em></strong>。</p><p>當有查詢需求<strong><em>（Question）</em></strong>時，<strong><em>RAG </em></strong>通過餘弦相似度<strong><em>（Cosine）</em></strong>或歐氏距離等演算法來查找向量資料庫，檢索<strong><em>（Indexes）</em></strong>前 <strong><em>k</em></strong> 個最相關的上下文，將向量資料庫吐出的查詢結果傳遞給 <strong><em>LLM </em></strong>，<strong><em>LLM </em></strong>在根據提供的內容回復答案給用戶。</p><h3>🦜️ LangChain</h3><p><strong><em>LangChain </em></strong>為用戶提供了載入<strong><em>（1, Load）</em></strong>、分割<strong><em>（2, Chunks）</em></strong>、嵌入<strong><em>（3, Embedings）</em></strong>和相似性搜索<strong><em>（6, Similarity Search）</em></strong>及查詢<strong><em>（7, Query）</em></strong>資料的基本元件。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gWDMAyh0VhMS-y7k4z5kRw.png" /></figure><p>使用<strong><em> LangChain </em></strong>將文本切割成多個文檔模塊<strong><em>（Chunks）</em></strong>的主要目的，是為了應對 <strong><em>LLM </em></strong>的上下文長度限制，並滿足擴展上下文的需求。將大量資料分成多個文檔模塊，每個模塊都有較小的上下文範圍，但可以在整個資料集中滑動，以提供更長的連續上下文。切割成多個文檔模塊的策略旨在應對 <strong><em>LLM </em></strong>的上下文限制，使其更適合處理大型資料集，並為使用者提供更長的上下文，以提高問答和生成任務的效能。這是一項強大的技術，尤其適用於需要處理大量文本的應用場景，具有重要的實際價值。</p><ol><li>上下文長度限制：<strong><em>LLM </em></strong>的上下文長度限制是指模型可以參考的文字長度。這個限制影響了模型能夠理解和生成的文字序列的長度。以 <strong><em>ChatGPT </em></strong>為例，它的上下文長度限制通常以 <strong><em>token </em></strong>數來表示。</li><li>擴展上下文的需求：某些應用場景需要更長的上下文，例如處理大量自定義資料，如公司的文件檔案或交易紀錄。這些資料集可能相當龐大，且問題通常需要參考整個資料集才能回答。然而，由於上下文長度限制，使用<strong><em>LLM </em></strong>處理這些資料集時就必須採取一些複雜的策略。</li></ol><h3>Step 1: Install All the Required Packages</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GU3uxNA5git9BgUVb5YxWw.png" /></figure><h3>Step 2: Import All the Required Libraries</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4T9TWHJBJre8rzEWi7vdUQ.png" /></figure><h3>Step 3: Load the Data</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iqvC_UxNTUr7vDhBFk3oxA.png" /></figure><h3>Step 4: Split the Text into Chunks</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eo086qDrLTtcDPJ2wWDY_g.png" /></figure><h3>Step 5: Setup the Environment</h3><p>填入<strong><em> Pinecone </em></strong>資料庫的 <strong><em>API Keys</em></strong>。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J4fTZJ-03sQMijYw4bE4qg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/899/1*79hQbXWBdSOy7jmiZspd6w.png" /></figure><h3>Step 6: Download the Embeddings</h3><p>放入想使用的 <strong><em>Embedding </em></strong>模型。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*50ZumTLlJc57XrNNZEy4jw.png" /></figure><p>您可以在 <strong><em>Hugging Face</em></strong> 上查看此模型的維度為 <strong><em>384</em></strong>。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/914/1*ZEBo4Y-OOZDb0TibS2uQSg.png" /></figure><p>如果連結成功，您在 <strong><em>Pinecone </em></strong>資料庫中看到的 <strong><em>Indexes </em></strong>維度將會顯示 <strong><em>384</em></strong>。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ik4i341LL9rUQkBrAoy64A.png" /></figure><h3>Step 7: Initializing the Pinecone</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_ExS3LUuKWOXmgQ7Dnrh6Q.png" /></figure><h3>Step 8: Create Embeddings for Each of the Text Chunk</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6mDXiUZtZpHrtSLLrW_OQQ.png" /></figure><h3>Step 9: Similarity Search</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WHWhbtwCFgzElgH1_r6Iqw.png" /></figure><h3>Step 10: Query the Docs to get the Answer Back (Llama 2 Model)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qo5Ks8CfjymEJVu4MxnwZg.png" /></figure><h3>Step 11: Import All the Required Libraries</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b5Drov958AKpt3dQJP5kiQ.png" /></figure><h3>Step 12: Quantized Models from the Hugging Face Community</h3><p><strong><em>Hugging Face</em></strong> 提供了量化模型的功能，讓我們能夠在 <strong><em>T4 GPU（</em></strong>因為使用<strong><em>Google Colab）</em></strong>上高效且有效地利用模型。在本例中，我們將使用名為<strong><em>Llama-2–13B-chat-GGML</em></strong> 的模型。</p><p>量化會降低精度以優化資源使用。量化是一種透過使用低精度數據類型<strong><em>（</em></strong>如<strong><em>8</em></strong> 位整數 <strong><em>int8</em></strong>，而不是通常的<strong><em> 32 </em></strong>位浮點 <strong><em>float32）</em></strong>來表示權重和激活，以減少運行推論計算和內存成本的技術。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CuVf4k23aHTQVqMI2Lw9Ig.png" /></figure><p>當有查詢需求<strong><em>（Question）</em></strong>時，<strong><em>RAG </em></strong>通過相似性搜索<strong><em>（Similarity Search）</em></strong>檢索<strong><em>（Indexes）</em></strong>出前<strong><em> 3</em></strong> 個最相關的上下文。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7cisvY--C_rUTB-3oGNk4Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WAly5vipoUytSRZMa22MrA.png" /></figure><p>將向量資料庫吐出的查詢結果傳遞給 <strong><em>LLM</em></strong> ，<strong><em>LLM </em></strong>在根據提供的內容回復答案給用戶。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*imHEsq0QF-W37cdcHVGP7w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*vZQjPTkluS0mM52-OJdcvA.png" /></figure><p>結合 <strong><em>LangChain</em></strong>、<strong><em>Pinecone </em></strong>以及 <strong><em>Llama2 </em></strong>等技術，基於 <strong><em>RAG </em></strong>的大型語言模型能夠高效地從您自己的 <strong><em>PDF </em></strong>文件中提取信息，並準確地回答與 <strong><em>PDF </em></strong>相關的問題。一旦成功完成任務，對於您或貴就公司而言，將是一個重大的應用。</p><p>如果您在使用過程中有任何疑問或需要協助，請隨時與我聯絡。您可以使用以下方式聯絡我：</p><p>🚀<strong>About Author</strong></p><ul><li><strong><em>Gary Tsai, </em></strong>I have over 2 years of experience in developing AI solutions and integrating AI technologies into foundry operations. My areas of expertise include cross-departmental coordination, independent project design, establishing project development and maintenance processes, and introducing deep learning techniques for foundry wafer image classification and object detection. Throughout my career, I have collaborated with various departments within the foundry, such as Layout, Etch, and Model departments, to successfully complete multiple AI projects including circuit inductance component object detection, GaAs wafer defect image classification, etc.</li><li>My contributions to these projects have enabled the foundry to streamline operations, improve product quality, and reduce costs through the use of AI technologies.</li><li><a href="https://www.linkedin.com/in/gary-tsai-taiwan/"><strong><em>LinkedIn Profile</em></strong></a></li><li><a href="https://www.youtube.com/channel/UCDznBIEgRZgunx6HYTx-p5w"><strong><em>YouTube Channel</em></strong></a></li><li><a href="https://03053020ite.github.io/AI-Project-Store/"><strong><em>Author Website</em></strong></a></li></ul><p><strong>Please feel free to comment if you have any questions 🙂</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bf62244feb91" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Top Tutorials for Deploying Custom YOLOv8 on Android⚡️]]></title>
            <link>https://medium.com/@gary.tsai.advantest/top-tutorials-for-deploying-custom-yolov8-on-android-%EF%B8%8F-dd6746afc1e6?source=rss-52b6c57e94fa------2</link>
            <guid isPermaLink="false">https://medium.com/p/dd6746afc1e6</guid>
            <category><![CDATA[yolo]]></category>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[object-detection]]></category>
            <category><![CDATA[deep-learning]]></category>
            <dc:creator><![CDATA[gary.TsAI(Taiwan A.I.)]]></dc:creator>
            <pubDate>Sun, 19 Feb 2023 16:17:51 GMT</pubDate>
            <atom:updated>2023-02-19T16:51:39.830Z</atom:updated>
            <content:encoded><![CDATA[<h4>部署自訂義 YOLOv8🔥 到 Android⚡️ 端的🚀最佳教程</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vxSYnH_SoZx9MyV8aCYlWg.png" /><figcaption><strong>Top Tutorials for Deploying Custom YOLOv8 on Android</strong></figcaption></figure><blockquote>In this tutorial, I’ll show you how to deploy YOLOv8 using custom data sets on an Android device. Want to learn how to deploy YOLOv8 with your own data set on an Android device? I’ll walk you through it in this tutorial. If you’re interested in deploying YOLOv8 with custom data sets on an Android device, you’re in luck! This tutorial will show you how.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5fIA83GCOgCP2kghAGUhiw.gif" /><figcaption><strong>Custom YOLOv8</strong>🔥<strong> on Android</strong>⚡️<strong> Results Display</strong></figcaption></figure><p>Utilizing YOLOv8 object detection on motion footage streamed from a GoPro to a mobile device can provide valuable information about the objects in the scene, including location and type. This can be particularly useful when capturing footage of a hiking trail, helping to identify potential obstacles or hazards, and objects of interest.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*07zgfrjXEHWwFehXpHz1Fw.gif" /><figcaption><strong>YOLOv8🔥 in a Snow Bicycle Race🚴❄️🌨🧊</strong></figcaption></figure><p>In situations where quick and accurate object detection is necessary, the YOLOv8 application on a mobile phone is essential. YOLOv8 is a deep learning-based object detection model that can rapidly and accurately detect objects in images or videos, and it can be used anytime and anywhere on a mobile device.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JdzacBIKTXZj-IC4LtPfvA.gif" /><figcaption><strong>YOLOv8🔥 in MotoGP 🏍️🏰</strong></figcaption></figure><p>In order to deploy YOLOv8 with a custom dataset on an Android device, you’ll need to train a model, convert it to a format like TensorFlow Lite or ONNX, and include it in your app’s assets folder. Then, use Android Studio to create a project, add dependencies, load and parse the model, and load image data. Execute model inference, parse the output, and draw bounding boxes on the image to display detected objects. Finally, install and run the app on an Android device. However, optimizing the model for mobile devices and addressing performance issues like compression and acceleration is important for practical applications.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/665/1*Tc1GJhNxigL_6hpJHglMyg.png" /><figcaption><strong>Architecture Diagram of Deploying Custom YOLOv8🔥 on Android</strong>⚡️</figcaption></figure><blockquote>The above may sound simple, but I encountered several challenges while building. However, don’t worry, I will share the pitfalls I encountered and how I overcame them!</blockquote><p><strong>Step 0— Ultimate Guide to Understanding ncnn</strong></p><p><strong>Step 1— Training YOLOv8 with a Custom Dataset</strong></p><ul><li><em>Clone the Git Repository and Install YOLOv8</em></li><li><em>Performing Inference using a Pre-trained Weights</em></li><li><em>Data Preparation and Format Conversion</em></li><li><em>Running the Training Process</em></li><li><em>Converting the Weights to ONNX Format</em></li><li><em>Converting the Weights to NCNN Format</em></li></ul><p><strong>Step 2— Building and running on Android Studio</strong></p><ul><li><em>Download ncnn-android-yolov8</em></li><li><em>Download ncnn</em></li><li><em>Download opencv-mobile</em></li><li><em>Opening ncnn-android-yolov8 with Android Studio</em></li><li><em>Placing NCNN Format Weights in Folder</em></li><li><em>Modifying yolo.cpp</em></li></ul><h3>🔥Step 0— Ultimate Guide to Understanding ncnn</h3><p>ncnn is an open-source high-performance neural network forward computing framework specially optimized for mobile phones. From the beginning of the design, ncnn has deeply considered the deployment and use of the mobile terminal, without third-party dependencies, cross-platform, and the CPU speed of the mobile terminal is faster than all known open source frameworks. Based on ncnn, developers can easily transplant deep learning algorithms to mobile phones for efficient execution, develop artificial intelligence APPs, and bring AI to your fingertips.</p><h3>🔥Step 1— <strong>Training YOLOv8 with a Custom Dataset</strong></h3><h4>⭐Clone the Git Repository and Install YOLOv8</h4><p>YOLOv8 has released a package called ultralytics, which can be installed using the command mentioned below.</p><pre>$ mkdir yolov8<br>$ cd yolov8<br>$ git clone https://github.com/ultralytics/ultralytics<br>$ pip install -qe ultralytics<br>$ cd ultralytics</pre><h4>⭐Performing Inference using a Pre-trained Weights</h4><p>To perform object detection on your selected video or image using YOLOv8’s pre-trained weights, you can execute the command provided below in the terminal.</p><pre># image<br>$ yolo task=detect mode=predict model=yolov8m.pt source=&quot;XXX.png&quot;<br><br><br># video<br>$ yolo task=detect mode=predict model=yolov8m.pt source=&quot;XXX.mp4&quot;</pre><p>If the execution is successful, the results will be stored in the folder YOLOv8/ultralytics/runs/detect/exp/.</p><h4>⭐Data Preparation and Format Conversion</h4><p>Visit the Kaggle and download the <a href="https://www.kaggle.com/datasets/tannergi/microcontroller-detection"><strong><em>microcontroller-detection</em></strong></a> dataset.</p><p>To create a text file named chip.yaml and place it in the folder YOLOv8/ultralytics/, use the following command and add the desired content to the file.</p><pre>train: ../datasets/images/train/<br>val:   ../datasets/images/test/<br># number of classes<br>nc: 4<br># class names<br>names: [&#39;Arduino Nano&#39;, &#39;ESP8266&#39;, &#39;Raspberry Pi 3&#39;, &#39;Heltec ESP32 Lora&#39;]</pre><p>The data structure during training is presented in the table below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/417/1*tyQNVleILClJ6QB3QQEjYQ.png" /></figure><p>Move .xml under the folder Microcontroller Detection/images/train/ to folder Microcontroller Detection/images/train_xml/</p><p>Move .xml under the folder Microcontroller Detection/images/test/ to folder Microcontroller Detection/images/test_xml/</p><p>Upload the folder Microcontroller Detection/images/train/ to the folder YOLOv8/datasets/images/.</p><p>Upload the folder Microcontroller Detection/images/test/ to the folder YOLOv8/datasets/images/.</p><p>To train the YOLOv8 object detection model with this dataset, it is necessary to convert the format from .xml to .txt.</p><pre>$ cd ..<br>$ git clone  https://github.com/Isabek/XmlToTxt<br>$ cd XmlToTxt<br>$ pip install -r requirements.txt</pre><p>Modify YOLOv8/XmlToTxt/classes.txtaccording to your custom dataset.</p><pre>Arduino_Nano<br>ESP8266<br>Raspberry_Pi_3<br>Heltec_ESP32_Lora</pre><p>Upload the folder Microcontroller Detection/images/train_xml/ to the folder YOLOv8/XmlToTxt/.</p><p>Upload the folder Microcontroller Detection/images/test_xml/ to the folder YOLOv8/XmlToTxt/.</p><p>To convert a file from .xml format to .txt format, run the following command in your terminal.</p><pre># Remember to change the text in classes.txt to your own category<br># Put the xml file you want to convert inside the xml folder<br><br>$ python xmltotxt.py -xml train_xml -out train<br>$ python xmltotxt.py -xml test_xml -out test</pre><p>Move folder YOLOv8/XmlToTxt/train/ to YOLOv8/datasets/labels/.</p><p>Move folderYOLOv8/XmlToTxt/test/ to YOLOv8/datasets/labels/.</p><h4>⭐Running the Training Process</h4><p>Now that everything is set up, it is time to run the training process.</p><pre>$ yolo task=detect \<br>       mode=train \<br>       model=yolov8n.pt \<br>       data=./chip.yaml \<br>       epochs=30 \<br>       imgsz=416</pre><p>The duration of the training process may vary depending on the hardware configuration and can take several minutes or even longer. As the training process is running, the output log will display messages similar to the following.</p><pre>0/9        0G    0.1184    0.0347   0.03127        47       640:   4%|▎         | 3/85 [01:08&lt;30:00, 21.95s/it]</pre><p>After completing the training process, the resulting model ultralytics/runs/train/exp/weights/best.ptis now ready to make predictions!</p><pre>$ yolo task=detect \<br>       mode=predict \<br>       model=/runs/train/exp/weights/best.pt \<br>       conf=0.25 \<br>       source=&#39;XXX.jpg&#39;</pre><h4>⭐Converting the Weights to ONNX Format</h4><p>Modifyultralytics/ultralytics/nn/modules.py with the following content.</p><pre>class C2f(nn.Module):<br>    # CSP Bottleneck with 2 convolutions<br>    def __init__(self, c1, c2, n=1, shortcut=False, g=1, e=0.5):  # ch_in, ch_out, number, shortcut, groups, expansion<br>        super().__init__()<br>        self.c = int(c2 * e)  # hidden channels<br>        self.cv1 = Conv(c1, 2 * self.c, 1, 1)<br>        self.cv2 = Conv((2 + n) * self.c, c2, 1)  # optional act=FReLU(c2)<br>        self.m = nn.ModuleList(Bottleneck(self.c, self.c, shortcut, g, k=((3, 3), (3, 3)), e=1.0) for _ in range(n))<br><br>    def forward(self, x):<br>        # y = list(self.cv1(x).split((self.c, self.c), 1))<br>        # y.extend(m(y[-1]) for m in self.m)<br>        # return self.cv2(torch.cat(y, 1))<br><br>        print(&quot;ook&quot;)<br>        x = self.cv1(x)<br>        x = [x, x[:, self.c:, ...]]<br>        x.extend(m(x[-1]) for m in self.m)<br>        x.pop(1)<br>        return self.cv2(torch.cat(x, 1))</pre><pre>def forward(self, x):<br>        shape = x[0].shape  # BCHW<br>        for i in range(self.nl):<br>            x[i] = torch.cat((self.cv2[i](x[i]), self.cv3[i](x[i])), 1)<br>        if self.training:<br>            return x<br>        elif self.dynamic or self.shape != shape:<br>            self.anchors, self.strides = (x.transpose(0, 1) for x in make_anchors(x, self.stride, 0.5))<br>            self.shape = shape<br>        <br>        # box, cls = torch.cat([xi.view(shape[0], self.no, -1) for xi in x], 2).split((self.reg_max * 4, self.nc), 1)<br>        # dbox = dist2bbox(self.dfl(box), self.anchors.unsqueeze(0), xywh=True, dim=1) * self.strides<br>        # y = torch.cat((dbox, cls.sigmoid()), 1)<br>        # return y if self.export else (y, x)<br><br>        print(&quot;ook&quot;)<br>        return torch.cat([xi.view(shape[0], self.no, -1) for xi in x], 2).permute(0, 2, 1)</pre><p>The following command is used to convert the weights in the best.pt format to the ONNX format and save the resulting file as best.onnx.</p><pre>$yolo task=detect mode=export model=runs/detect/train4/weights/best.pt <br>format=onnx simplify=True opset=13 imgsz=416</pre><h4>⭐Converting the Weights to NCNN Format</h4><p>Visit the <a href="https://convertmodel.com/">convert weights website</a>. The blue button selects the .onnx file and the green button starts the conversion. After execution, two files, best.bin and best.param will be generated.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/864/1*sbbdSSEUY_CugPsiiIeaOg.png" /></figure><h3>🔥Step 2— Building and running on Android Studio</h3><h4>⭐<em>Download ncnn-android-yolo</em>v8</h4><p>Download <a href="https://github.com/FeiGeChuanShu/ncnn-android-yolov8">ncnn-android-yolov8</a> to your desktop</p><h4>⭐Download ncnn</h4><p>Download <a href="https://github.com/Tencent/ncnn/releases">ncnn-YYYYMMDD-android-vulkan.zip</a></p><p>Extract ncnn-YYYYMMDD-android-vulkan.zip into app/src/main/jni/</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bu2VE5UqQF8PPVuF8I97XQ.png" /></figure><p>Change the ncnn_DIR path to yours in app/src/main/jni/CMakeLists.txt</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NB-Pm6DT-qUaDChQi43-QQ.png" /></figure><h4>⭐Download <em>opencv-mobile</em></h4><p>Download <a href="https://github.com/nihui/opencv-mobile">opencv-mobile-XYZ-android.zip</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ICv5pB_4cZeHK235xXEXkQ.png" /></figure><p>Extract opencv-mobile-XYZ-android.zip into app/src/main/jni/</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fUjj-Qp2OFTmmR_aZhAMRQ.png" /></figure><p>Change the OpenCV_DIR path in app/src/main/jni/CMakeLists.txt</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AA11zYRDOXE4M60mt41SHw.png" /></figure><h4>⭐Opening ncnn-android-yolov8 with Android Studio</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*rIRHywD9JrL7QHpdXwYU2w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/897/1*6rKca4mOGMSSa5fIva0xfg.png" /></figure><p>💡 If there is a problem during the build, it should be a compatibility problem between NDK and CMake in SDK Tools. The modification method is as follows</p><p>👉 ctrl +alt +s to open the setting, install version 21.3.6528147 of NDK</p><p>👉 Install version 3.10.2.4988404 of CMake</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/977/1*0I6zf3NDe70Jjjn2i-IAbw.png" /></figure><p>👉 Add CMake path in local.properties.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4W6ScwD89NKi3mQy9Fw3NA.png" /></figure><p>👉 Press the button Sync project with Gradle Files in the upper right.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/816/1*fCYmp8fsVmqFUurfU0_tVg.png" /></figure><h4>⭐Placing NCNN Format Weights in Folder</h4><p>Placebest.bin and best.param in folderapp\src\main\assets\</p><h4>⭐Modifying yolo.cpp</h4><p>Modify app\src\main\jni\yolo.cpp&#39;s num_class according to your custom dataset.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QbCaAxQUOiPc2rZbJaee9w.png" /></figure><p>Modify app\src\main\jni\yolo.cpp&#39;s class_names according to your custom dataset.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j4tShpKAqlTZbklr3vQn6A.png" /></figure><p>Modify app\src\main\jni\yolo.cpp&#39;s layer_name according to your best.param.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6gb7Yd7vhOKHPgC2VaAU9g.png" /></figure><p>Modify app\src\main\jni\yolo.cpp&#39;s weights name.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R3wXsufFUdGeJcoc3pZwOQ.png" /></figure><p>Press the RUN button to execute the program successfully!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FTAZ-mLUO5Sg%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DTAZ-mLUO5Sg&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FTAZ-mLUO5Sg%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/ad7a67b993566ab38fca072ae1246096/href">https://medium.com/media/ad7a67b993566ab38fca072ae1246096/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FcCYjbbvCqWk%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DcCYjbbvCqWk&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FcCYjbbvCqWk%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/9a296a9884cad70a0bd0a8cd3303ea3e/href">https://medium.com/media/9a296a9884cad70a0bd0a8cd3303ea3e/href</a></iframe><p>🚀<strong>About Author</strong></p><ul><li><strong><em>Gary Tsai, </em></strong>I have over 2 years of experience in developing AI solutions and integrating AI technologies into foundry operations. My areas of expertise include cross-departmental coordination, independent project design, establishing project development and maintenance processes, and introducing deep learning techniques for foundry wafer image classification and object detection. Throughout my career, I have collaborated with various departments within the foundry, such as Layout, Etch, and Model departments, to successfully complete multiple AI projects including circuit inductance component object detection, GaAs wafer defect image classification, etc.</li><li>My contributions to these projects have enabled the foundry to streamline operations, improve product quality, and reduce costs through the use of AI technologies.</li><li><a href="https://www.linkedin.com/in/gary-tsai-taiwan/"><strong><em>LinkedIn Profile</em></strong></a></li><li><a href="https://www.youtube.com/channel/UCDznBIEgRZgunx6HYTx-p5w"><strong><em>YouTube Channel</em></strong></a></li><li><a href="https://03053020ite.github.io/AI-Project-Store/"><strong><em>Author Website</em></strong></a></li></ul><p><strong>Please feel free to comment if you have any questions 🙂</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dd6746afc1e6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Run PP-YOLO in Google Colab]]></title>
            <link>https://medium.com/@gary.tsai.advantest/how-to-run-pp-yolo-in-google-colab-2b17701c401a?source=rss-52b6c57e94fa------2</link>
            <guid isPermaLink="false">https://medium.com/p/2b17701c401a</guid>
            <category><![CDATA[yolo]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[object-detection]]></category>
            <dc:creator><![CDATA[gary.TsAI(Taiwan A.I.)]]></dc:creator>
            <pubDate>Fri, 23 Sep 2022 07:36:02 GMT</pubDate>
            <atom:updated>2022-09-23T07:40:31.605Z</atom:updated>
            <content:encoded><![CDATA[<p>我們使用 <em>Google Colab </em>實操 <em>YOLO </em>系列曾經的霸主「<em>PP-YOLO</em>」，輕鬆實現物件偵測模型。</p><h3>一、Google Colab 設定</h3><p>讓我們馬上開始使用 <em>PP-YOLO</em> 吧！我們將使用<em> Google Colab</em> 來實現。首先，配置 <em>GPU </em>使其可以使用。<em>“Runtime” -&gt; “Change runtime type” -&gt; </em>將<em>“Hardware accelerator” </em>更改為 <em>GPU。</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/406/0*giXDIK2gxgvqPIiV.png" /></figure><p>接著安裝 <em>Google Drive</em>。</p><pre>from google.colab import drive<br>drive.mount(&#39;/content/drive&#39;)<br>%cd ./drive/MyDrive</pre><p>用 <em>pip </em>安裝 <em>paddlepaddle</em></p><pre>!python -m pip install paddlepaddle-gpu==2.2.2 -i <a href="https://mirror.baidu.com/pypi/simple">https://mirror.baidu.com/pypi/simple</a></pre><p>從官方 <em>git clone</em></p><pre>!git clone https://github.com/PaddlePaddle/PaddleDetection.git</pre><p>然後導入所需的函式庫。這裡我們使用 <em>pip</em> 安裝。</p><pre>%cd PaddleDetection<br>!pip install -r requirements.txt</pre><h3>二、使用任意圖片 inference</h3><p>讓我們用任意圖片 <em>inference</em> 吧！將<em> “--infer_img” </em>參數更改為您上傳的圖像 <em>“XXX.jpg”</em>。</p><pre>!python tools/infer.py -c  configs/ppyoloe/ppyoloe_crn_m_300e_coco.yml -o use_gpu=true weights=https://paddledet.bj.bcebos.com/models/ppyoloe_crn_m_300e_coco.pdparams --infer_img=XXX.jpg</pre><p>運行結果會保存在 <em>“output”</em> 中，可以看到精準檢測人和車。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/770/0*M6E8qh3QNAskcuk2.jpeg" /><figcaption>PPYOLOE-M</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2b17701c401a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Run YOLOR in Google Colab]]></title>
            <link>https://medium.com/@gary.tsai.advantest/how-to-run-yolor-in-google-colab-549499e4fac?source=rss-52b6c57e94fa------2</link>
            <guid isPermaLink="false">https://medium.com/p/549499e4fac</guid>
            <category><![CDATA[yolo]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[object-detection]]></category>
            <category><![CDATA[computer-vision]]></category>
            <dc:creator><![CDATA[gary.TsAI(Taiwan A.I.)]]></dc:creator>
            <pubDate>Fri, 23 Sep 2022 07:22:48 GMT</pubDate>
            <atom:updated>2022-09-23T07:43:59.387Z</atom:updated>
            <content:encoded><![CDATA[<p>我們使用 <em>Google Colab </em>實操 <em>YOLO </em>系列曾經的霸主「<em>YOLOR</em>」，輕鬆實現物件偵測模型。</p><h3>一、Google Colab 設定</h3><p>讓我們馬上開始使用 <em>YOLOR</em> 吧！我們將使用<em> Google Colab</em> 來實現。首先，配置 <em>GPU </em>使其可以使用。<em>“Runtime” -&gt; “Change runtime type” -&gt; </em>將<em>“Hardware accelerator” </em>更改為 <em>GPU。</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/406/0*H5dHrg0Axnosz0rY.png" /></figure><p>接著安裝 <em>Google Drive</em>。</p><pre>from google.colab import drive<br>drive.mount(&#39;/content/drive&#39;)<br>%cd ./drive/MyDrive</pre><p>從官方 <em>git clone</em></p><pre># !git clone https://github.com/augmentedstartups/yolor</pre><p>然後導入所需的函式庫。這裡我們使用 <em>pip</em> 安裝。</p><pre>!pip install -qr requirements.txt</pre><pre>!git clone <a href="https://github.com/JunnYu/mish-cuda">https://github.com/JunnYu/mish-cuda</a><br>%cd mish-cuda</pre><pre>!python setup.py build install<br>%cd ..</pre><pre>!git clone <a href="https://github.com/fbcotter/pytorch_wavelets">https://github.com/fbcotter/pytorch_wavelets</a><br>%cd pytorch_wavelets<br>!pip install .</pre><pre>!bash scripts/get_pretrain.sh<br>%cd ..</pre><h3>二、使用任意圖片 inference</h3><p>讓我們用任意圖片 <em>inference</em> 吧！將 ”--source<em>”</em> 參數更改為您上傳的圖像 <em>“XXX.jpg”</em>。</p><pre>!python detect.py --source XXX.jpg --cfg cfg/yolor_p6.cfg --weights yolor_p6.pt --conf 0.25 --img-size 1280 --device 0 --output ./YOLOR-outputs</pre><p>運行結果會保存在<em> “YOLOR_outputs” </em>中，可以看到精準檢測人和車。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/770/0*KSQEox77lTU6uuvk.jpeg" /><figcaption>YOLOR-CSP</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=549499e4fac" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Run YOLOX in Google Colab]]></title>
            <link>https://medium.com/@gary.tsai.advantest/how-to-run-yolox-in-google-colab-40462e0cede7?source=rss-52b6c57e94fa------2</link>
            <guid isPermaLink="false">https://medium.com/p/40462e0cede7</guid>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[object-detection]]></category>
            <category><![CDATA[yolo]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[gary.TsAI(Taiwan A.I.)]]></dc:creator>
            <pubDate>Fri, 23 Sep 2022 07:13:01 GMT</pubDate>
            <atom:updated>2022-09-23T07:41:12.217Z</atom:updated>
            <content:encoded><![CDATA[<p>我們使用 <em>Google Colab </em>實操 <em>YOLO </em>系列曾經的霸主「<em>YOLOX</em>」，輕鬆實現物件偵測模型。</p><h3>一、Google Colab 設定</h3><p>讓我們馬上開始使用 <em>YOLOX</em> 吧！我們將使用<em> Google Colab</em> 來實現。首先，配置 <em>GPU </em>使其可以使用。<em>“Runtime” -&gt; “Change runtime type” -&gt; </em>將<em>“Hardware accelerator” </em>更改為 <em>GPU。</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/406/0*jL5xIMZbh50lUGIu.png" /></figure><p>接著安裝 <em>Google Drive</em>。</p><pre>from google.colab import drive<br>drive.mount(&#39;/content/drive&#39;)<br>%cd ./drive/MyDrive</pre><p>從官方 <em>git clone</em></p><pre># !git clone https://github.com/augmentedstartups/YOLOX.git</pre><p>然後導入所需的函式庫。這裡我們使用 <em>pip</em> 安裝。</p><pre>%cd YOLOX<br>!pip3 install -U pip<br>!pip3 install -qr requirements.txt</pre><pre>!pip3 install &#39;git+https://github.com/cocodataset/cocoapi.git#subdirectory=PythonAPI&#39;<br>!pip3 install -v -e .</pre><p>下載預訓練權重。</p><pre>import os<br>if not os.path.exists(&quot;weights&quot;):<br>   os.mkdir(&quot;weights&quot;)</pre><pre>!wget -nc https://github.com/Megvii-BaseDetection/YOLOX/releases/download/0.1.1rc0/yolox_s.pth -P ./weights/</pre><pre>!wget -nc https://github.com/Megvii-BaseDetection/YOLOX/releases/download/0.1.1rc0/yolox_m.pth -P ./weights/</pre><pre>!wget -nc https://github.com/Megvii-BaseDetection/YOLOX/releases/download/0.1.1rc0/yolox_l.pth -P ./weights/</pre><pre>!wget -nc https://github.com/Megvii-BaseDetection/YOLOX/releases/download/0.1.1rc0/yolox_x.pth -P ./weights/</pre><pre># !wget -nc https://github.com/Megvii-BaseDetection/YOLOX/releases/download/0.1.1rc0/yolox_darknet.pth -P /content/YOLOX/YOLOX/weights/</pre><pre># !wget -nc https://github.com/Megvii-BaseDetection/YOLOX/releases/download/0.1.1rc0/yolox_nano.pth -P /content/YOLOX/YOLOX/weights/</pre><pre># !wget -nc https://github.com/Megvii-BaseDetection/YOLOX/releases/download/0.1.1rc0/yolox_tiny.pth -P /content/YOLOX/YOLOX/weights/</pre><h3>二、使用任意圖片 inference</h3><p>讓我們用任意圖片 <em>inference</em> 吧！將 “--path<em>”</em> 參數更改為您上傳的圖像 <em>“XXX.jpg”</em>。</p><pre>!python tools/demo.py image -n yolox-s -c weights/yolox_s.pth --path &quot;XXX.jpg&quot; --conf 0.25 --nms 0.45 --tsize 640 --save_result --device gpu</pre><p>運行結果會保存在<em> “YOLOX_outputs/yolox_s/vis_res/” </em>中，可以看到精準檢測人和車。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/770/0*jAWwVV8I4tep74HG.jpeg" /><figcaption>YOLOX-S</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=40462e0cede7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Run YOLOv5 in Google Colab]]></title>
            <link>https://medium.com/@gary.tsai.advantest/how-to-run-yolov5-in-google-colab-f2a058718e09?source=rss-52b6c57e94fa------2</link>
            <guid isPermaLink="false">https://medium.com/p/f2a058718e09</guid>
            <category><![CDATA[yolo]]></category>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[object-detection]]></category>
            <category><![CDATA[deep-learning]]></category>
            <dc:creator><![CDATA[gary.TsAI(Taiwan A.I.)]]></dc:creator>
            <pubDate>Fri, 23 Sep 2022 07:01:56 GMT</pubDate>
            <atom:updated>2022-09-23T07:37:48.773Z</atom:updated>
            <content:encoded><![CDATA[<p>我們使用 <em>Google Colab </em>實操 <em>YOLO </em>系列曾經的霸主「<em>YOLOv5</em>」，輕鬆實現物件偵測模型。</p><h3>一、Google Colab 設定</h3><p>讓我們馬上開始使用 <em>YOLOv5</em> 吧！我們將使用<em> Google Colab</em> 來實現。首先，配置 <em>GPU </em>使其可以使用。<em>“Runtime” -&gt; “Change runtime type” -&gt; </em>將<em>“Hardware accelerator” </em>更改為 <em>GPU。</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/406/0*HdFBVkaFN8Cq0my_.png" /></figure><p>接著安裝 <em>Google Drive</em>。</p><pre>from google.colab import drive<br>drive.mount(&#39;/content/drive&#39;)<br>%cd ./drive/MyDrive</pre><p>從官方 <em>git clone</em></p><pre>!git clone https://github.com/ultralytics/yolov5</pre><p>然後導入所需的函式庫。這裡我們使用 <em>pip</em> 安裝。</p><pre>%cd yolov5<br>!pip install -qr requirements.txt</pre><pre>import torch<br>import utils<br>display = utils.notebook_init()  # checks</pre><p>我們現在可以使用 <em>YOLOv5 </em>囉！開始出發吧！</p><p>--source 參數放入偵測圖片，下方為多種格式：</p><pre>--source           0                              # webcam<br>                   &#39;img.jpg&#39;                      # image <br>                   &#39;video.mp4&#39;                    # video<br>                   &#39;path/&#39;                        # directory<br>                   &#39;path/*.jpg&#39;                   # glob<br>                   &#39;https://youtu.be/Zgi9g1ksQHc&#39; # YouTube</pre><p>--weights 參數放入權重，下方為多種格式：</p><pre>--weight          yolov5n.pt<br>                  yolov5s.pt<br>                  yolov5m.pt<br>                  yolov5l.pt<br>                  yolov5x.pt<br>                  yolov5n6.pt<br>                  yolov5s6.pt<br>                  yolov5m6.pt<br>                  yolov5l6.pt<br>                  yolov5x6.pt</pre><h3>二、使用任意圖片 inference</h3><p>讓我們用任意圖片 <em>inference</em> 吧！將 “-- <em>source”</em> 參數更改為您上傳的圖像 <em>“inference/images/XXX.jpg”</em>。</p><pre>!python detect.py --weights yolov5m.pt --img 64 --conf 0.25 --source &#39;inference/images/XXX.jpg&#39;</pre><p>運行結果會保存在 <em>“yolov5/runs/detect/exp”</em> 中，可以看到精準檢測人和車。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_Ysjxe0Pq5yeFlOZDpwyKg.jpeg" /><figcaption>YOLOv5-M</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f2a058718e09" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[YOLOX vs PPYOLO vs YOLOv5 vs YOLOR vs YOLOv7(Part 2/2)]]></title>
            <link>https://medium.com/@gary.tsai.advantest/yolox-s-ppyolo-m-yolov5-m-yolor-csp-yolov7-x-part-3-5-a1f2d335b3bc?source=rss-52b6c57e94fa------2</link>
            <guid isPermaLink="false">https://medium.com/p/a1f2d335b3bc</guid>
            <category><![CDATA[object-detection]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[yolo]]></category>
            <category><![CDATA[deep-learning]]></category>
            <dc:creator><![CDATA[gary.TsAI(Taiwan A.I.)]]></dc:creator>
            <pubDate>Thu, 22 Sep 2022 06:28:52 GMT</pubDate>
            <atom:updated>2022-09-23T07:45:18.622Z</atom:updated>
            <content:encoded><![CDATA[<p>在看 <strong><em>YOLOv7</em></strong> 論文時，猛然看到一張 <strong><em>Comparison of state-of-the-art real-time object detectors</em></strong> 的表格，就決定挑選多個 <em>FPS </em>在 <em>100 </em>以上的模型，比較各 <em>50</em> 張圖片的效果，就讓我們接著看下去吧！</p><p><a href="https://medium.com/@gary.tsai.advantest/yolox-s-ppyolo-m-yolov5-m-yolor-csp-yolov7-x-part-1-5-7de49a110df9">YOLOX vs PPYOLO vs YOLOv5 vs YOLOR vs YOLOv7(Part 1/2)</a></p><h3>選手 26</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q6Wxoh_N0mYOizRvDrzsNg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dT2DPWbxp5WMygyJk62bRg.jpeg" /><figcaption>YOLOX-S</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X8fQHRh9XL2YXb9y44lZmg.jpeg" /><figcaption>PPYOLOE-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cA1Nw-sZNGh87fR8ATXbDQ.jpeg" /><figcaption>YOLOv5-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fI4wmq5SwRt-CFRcEmULGQ.jpeg" /><figcaption>YOLOR-CSP</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Sm3WueeKz6ziR94WH58O-w.jpeg" /><figcaption>YOLOv7-X</figcaption></figure><h3>選手 27</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7XnRvcZbsOjfQZmqAh3nRQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Smu7omgB82F0pLEpSxksyg.jpeg" /><figcaption>YOLOX-S</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tnmJCWZSQCDlCbfjOVyNbA.jpeg" /><figcaption>PPYOLOE-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wcGX5hyuRQjCx0Izunfr7Q.jpeg" /><figcaption>YOLOv-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V_0uH5Sbc8-TMfCNOEJvyQ.jpeg" /><figcaption>YOLOR-CSP</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_OiEcRK--Zeq3VpcEmODyw.jpeg" /><figcaption>YOLOv7-X</figcaption></figure><h3>選手 28</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L1ejGbZec_kWlriPBSgJIg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NS-mpxZvTaDY9_wS1MNkPA.jpeg" /><figcaption>YOLOX-S</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eOLszKDu6VD7MigdYDbVtw.jpeg" /><figcaption>PPYOLOE-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZOU5NSfub18j4dbD2oCvaQ.jpeg" /><figcaption>YOLOv5-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QdXqQrjidz_YAgzUyVvWWg.jpeg" /><figcaption>YOLOR-CSP</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ooQ0NQVXWRfG8usfKSs5lg.jpeg" /><figcaption>YOLOv7-X</figcaption></figure><h3>選手 29</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1I0b3AkCRwj9uhN4tFL31A.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uYIbQkmInVmpbWslD5mPOg.jpeg" /><figcaption>YOLOX-S</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9EqfA6o3Badv_7A6uoZkPA.jpeg" /><figcaption>PPYOLOE-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XJpdLBi--HQlaknariOwGw.jpeg" /><figcaption>YOLOv5-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pxDwiewJWcvh6IyTIxpq9w.jpeg" /><figcaption>YOLOR-CSP</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m3KX-UAyROTkIkLXw4Pu4g.jpeg" /><figcaption>YOLOv7-X</figcaption></figure><h3>選手 30</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9x2gKKX1NQOC42BcYz4ECA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zSw8G3gZ1-ivnVo4dg4D1g.jpeg" /><figcaption>YOLOX-S</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wkrQf1etNIrdFB9h3-uJ0w.jpeg" /><figcaption>PPYOLOE-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MN3jLhCr_PiX71TdFjU5tA.jpeg" /><figcaption>YOLOv5-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FkpdIqX3vrf3m1SLCc10Vw.jpeg" /><figcaption>YOLOR-CSP</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PYMIXY1kZ8d5ge_MAq2dYg.jpeg" /><figcaption>YOLOv7-X</figcaption></figure><h3>選手 31</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8YfeVqh9TS6MxJZO.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*APsNKekvx8HaFRik.jpeg" /><figcaption>YOLOX-S</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*X8lnaP181h4mzFSP.jpeg" /><figcaption>PPYOLOE-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*F0D3FUpkTGDzSuXC.jpeg" /><figcaption>YOLOv5-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*41rWLS96agxXna6G.jpeg" /><figcaption>YOLOR-CSP</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*AaRkn-hqmWMuIsxX.jpeg" /><figcaption>YOLOv7-X</figcaption></figure><h3>選手 32</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Py0Ca4Gep28_57tX.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8ZNjEWQCVq-1exWH.jpeg" /><figcaption>YOLOX-S</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*mHeXWx8DaWMRCrvG.jpeg" /><figcaption>PPYOLOE-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*DZbTOjBILSuWsVPD.jpeg" /><figcaption>YOLOv5-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*M1iSq39ItwgdPUNb.jpeg" /><figcaption>YOLOR-CSP</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*rbnIhxP6WNjs2IuS.jpeg" /><figcaption>YOLOv7-X</figcaption></figure><h3>選手 33</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*EgZU77Q02KbFsOsB.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6j-GwVuAXpjYqS5s.jpeg" /><figcaption>YOLOX-S</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Hc4a9UHWthJ-x3Pb.jpeg" /><figcaption>PPYOLOE-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*IFjASMo1qcQUiRYg.jpeg" /><figcaption>YOLOv5-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*fQfbZJO68buwVJDs.jpeg" /><figcaption>YOLOR-CSP</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ZLSDnNik01nJgIXw.jpeg" /><figcaption>YOLOv7-X</figcaption></figure><h3>選手 34</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*yGtSTmttLnrftix3.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_t1W_ph-8OmnPR3t.jpeg" /><figcaption>YOLOX-S</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*g7F-yVpukE2YeU_o.jpeg" /><figcaption>PPYOLOE-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OmftikaN0rWhjijn.jpeg" /><figcaption>YOLOv5-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lYVN5VcFdIAox3z3.jpeg" /><figcaption>YOLOR-CSP</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Czw5PhiI-qO5T686.jpeg" /><figcaption>YOLOv7-X</figcaption></figure><h3>選手 35</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*mciUyL4Her5NNElc.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*N4EsarfMQJ3tJBYj.jpeg" /><figcaption>YOLOX-S</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_U3uhkAdsJ5nzwZh.jpeg" /><figcaption>PPYOLOE-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*79QPliAV2I-q08zc.jpeg" /><figcaption>YOLOv5-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*P3XqT79XUKJ4qvhx.jpeg" /><figcaption>YOLOR-CSP</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7xXdcpn5ujruSy1G.jpeg" /><figcaption>YOLOv7-X</figcaption></figure><h3>選手 36</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*nEO5p6TrMnTcsM5C.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*eNBk3voUpkWr_5Zq.jpeg" /><figcaption>YOLOX-S</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*jWgAhtSUN_wXTsg0.jpeg" /><figcaption>PPYOLOE-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*V7DJ9VHPOCmmg-Mv.jpeg" /><figcaption>YOLOv5-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*TfK8DPuHywx4FLKR.jpeg" /><figcaption>YOLOR-CSP</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9HFuV9khtyPoFktj.jpeg" /><figcaption>YOLOv7-X</figcaption></figure><h3>選手 37</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vwOcOSD8KI-j8vO7.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*q4qE3Q4K2Z4Svo4-.jpeg" /><figcaption>YOLOX-S</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*oCFhDE5OQVG__wl1.jpeg" /><figcaption>PPYOLOE-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*fYX7snKMDlHN6CKl.jpeg" /><figcaption>YOLOv5-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*QaZ9Dbf5kfLBMk63.jpeg" /><figcaption>YOLOR-CSP</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*WX-8iI12AH4Y_zjk.jpeg" /><figcaption>YOLOv7-X</figcaption></figure><h3>選手 38</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*eHoCMbJxia_0QcKv.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*YFae2zaNwOrm-RIV.jpeg" /><figcaption>YOLOX-S</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ZalF2ZeWSLjMW-am.jpeg" /><figcaption>PPYOLOE-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*AuO0ZJGkSvigIYev.jpeg" /><figcaption>YOLOv5-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*raTOqiwa7Z-tWwPy.jpeg" /><figcaption>YOLOR-CSP</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*CP-0Wy8FmeFPnNdg.jpeg" /><figcaption>YOLOv7-X</figcaption></figure><h3>選手 39</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5JVK9GluYSIWc1jH.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*k_X1ExkbF3xce4PH.jpeg" /><figcaption>YOLOX-S</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qjMKqpyEMd0Ehdke.jpeg" /><figcaption>PPYOLOE-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*WoJMNAu8IbbAuKGP.jpeg" /><figcaption>YOLOv5-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HwnepycCoe9uQJkO.jpeg" /><figcaption>YOLOR-CSP</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*04HAE0Q3ptWaGs4j.jpeg" /><figcaption>YOLOv7-X</figcaption></figure><h3>選手 40</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_Nis1OBU6KoSwBZa.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3jnyJO2LcXGxS98X.jpeg" /><figcaption>YOLOX-S</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*VW5OfieLtZZpUEmx.jpeg" /><figcaption>PPYOLOE-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*I2ba_dsph-8E5e1z.jpeg" /><figcaption>YOLOv5-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HLhXpbf3-x8sahdo.jpeg" /><figcaption>YOLOR-CSP</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qXMVM_F3mQaHD62d.jpeg" /><figcaption>YOLOv7-X</figcaption></figure><h3>選手 41</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*wC87vTIHR2-0fGYv.jpeg" /><figcaption>YOLOX-S</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*raaVy4Ucl0yazrQC.jpeg" /><figcaption>PPYOLOE-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*q_KyhFx-SIh7HZbZ.jpeg" /><figcaption>YOLOv5-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*AqJ9sfU9TUzxS2Fr.jpeg" /><figcaption>YOLOR-CSP</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3VOQ81mQwy63kQOX.jpeg" /><figcaption>YOLOv7-X</figcaption></figure><h3>選手 42</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*aAVdmQSq2bP0hvHj.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ukgLz0_MwNhH0r44.jpeg" /><figcaption>YOLOX-S</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1P4GQlLoD-D_KE1U.jpeg" /><figcaption>PPYOLOE-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*62Sw_41-3YvxyUiw.jpeg" /><figcaption>YOLOv5-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4qALTit-e-4z3fRF.jpeg" /><figcaption>YOLOR-CSP</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7m6sn2SPp0RqCKQ9.jpeg" /><figcaption>YOLOv7-X</figcaption></figure><h3>選手 43</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*F4rKy5j74IDw2svA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8YbjpbDbfPIPsK9h.jpeg" /><figcaption>YOLOX-S</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*PI1kktduuWx4P79N.jpeg" /><figcaption>PPYOLO-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*iLsJAmGnnJsNCb4u.jpeg" /><figcaption>YOLOv5-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OH62OmwNtRXiPjYo.jpeg" /><figcaption>YOLOR-CSP</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7JSml0f9UNwomi5B.jpeg" /><figcaption>YOLOv7-X</figcaption></figure><h3>選手 44</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*VEZbOuYm4YRk2FSZ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*AZJ8XbEYvsSt2wM_.jpeg" /><figcaption>YOLOX-S</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*eBqTlO2pa09B2PVT.jpeg" /><figcaption>PPYOLOE-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*q7KFjiQTSTY7qARC.jpeg" /><figcaption>YOLOv5-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*YFKhGvKClNzFyKFX.jpeg" /><figcaption>YOLOR-CSP</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1RuxwhOfJY5Qx7Je.jpeg" /><figcaption>YOLOv7-X</figcaption></figure><h3>選手 45</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*FFCa9KBrcKLtxibQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ux-b4AWyXGGNp6AP.jpeg" /><figcaption>YOLOX-S</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*QrZVqdiypDyYL5_Y.jpeg" /><figcaption>PPYOLOE-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*J1ESPpqfeJiCgZtC.jpeg" /><figcaption>YOLOv5-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*N348iftNSWnPiVr1.jpeg" /><figcaption>YOLOR-CSP</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*QkxagA7gvx8Fk1cl.jpeg" /><figcaption>YOLOv7-X</figcaption></figure><h3>選手 46</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3fVCby6QyybueKg8.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*kLArPHljaDqI1wlw.jpeg" /><figcaption>YOLOX-S</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8vZVlDfWHcNFl2io.jpeg" /><figcaption>PPYOLOE-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6L28dKgNoGJjxFq2.jpeg" /><figcaption>YOLOv5-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KVDEq57q4q-BcM_J.jpeg" /><figcaption>YOLOR-CSP</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vhXbj2h2XP3WMju2.jpeg" /><figcaption>YOLOv7-X</figcaption></figure><h3>選手 47</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Vsre44QPzkrqVt5y.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qk9fUMN_H-_jx_6W.jpeg" /><figcaption>YOLOX-S</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OD2Mk1N379yUPWYK.jpeg" /><figcaption>PPYOLOE-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*NEnyF_0LHNt5yE8I.jpeg" /><figcaption>YOLOv5-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QdxvqfSVUTSjaBud4-jdNQ.jpeg" /><figcaption>YOLOR-CSP</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*JmmXftAB3U3-GcAM.jpeg" /><figcaption>YOLOv7-X</figcaption></figure><h3>選手 48</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*b-So-1fwySpWlMWy.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KjoqDp5IijZ5N8tS.jpeg" /><figcaption>YOLOX-S</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*BwbfurGVQyLz7vW5.jpeg" /><figcaption>PPYOLOE-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Q7biXwRCoQnhC_VJ.jpeg" /><figcaption>YOLOv5-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vphAb_VkQ6V50p59.jpeg" /><figcaption>YOLOR-CSP</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*jsZdN0NeblLr4mEU.jpeg" /><figcaption>YOLOv7-X</figcaption></figure><h3>選手 49</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qYjTAGgwv9YF3KkV.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*LOTIvbmrnTnDIOO5.jpeg" /><figcaption>YOLOX-S</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*smzmVQw7VsSWinJb.jpeg" /><figcaption>PPYOLOE-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*sdplUJ2nLtdIUYRI.jpeg" /><figcaption>YOLOv5-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*kUGDhgIVDvK5BWgJ.jpeg" /><figcaption>YOLOR-CSP</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-nXX1Mnmn_BJBByo.jpeg" /><figcaption>YOLOv7-X</figcaption></figure><h3>選手 50</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*jSzWnd8Yqd9-CIqX.jpeg" /><figcaption>YOLOX-S</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*XoUcX0_nIxFVS4DB.jpeg" /><figcaption>PPYOLOE-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*zrTyBvzidVHXVJ8O.jpeg" /><figcaption>YOLOv5-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*oxb1kltcSPRkAHvE.jpeg" /><figcaption>YOLOR-CSP</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*VqJsbgH6XPBzTDRm.jpeg" /><figcaption>YOLOv7-X</figcaption></figure><h3>選手 51</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*iK9k-DCNFwiBifQd.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*L9RRys3jtMa1Enbp.jpeg" /><figcaption>YOLOX-S</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7ycjCh6E4-qmwce3.jpeg" /><figcaption>PPYOLOE-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bT-N7AnjUCimQoby.jpeg" /><figcaption>YOLOv5-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*kXsPbMZdq1jm0IhL.jpeg" /><figcaption>YOLOR-CSP</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cZqMeCMtHK0mICjU.jpeg" /><figcaption>YOLOv7-X</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a1f2d335b3bc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[YOLOX vs PPYOLO vs YOLOv5 vs YOLOR vs YOLOv7(Part 1/2)]]></title>
            <link>https://medium.com/@gary.tsai.advantest/yolox-s-ppyolo-m-yolov5-m-yolor-csp-yolov7-x-part-1-5-7de49a110df9?source=rss-52b6c57e94fa------2</link>
            <guid isPermaLink="false">https://medium.com/p/7de49a110df9</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[object-detection]]></category>
            <category><![CDATA[yolo]]></category>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[deep-learning]]></category>
            <dc:creator><![CDATA[gary.TsAI(Taiwan A.I.)]]></dc:creator>
            <pubDate>Thu, 22 Sep 2022 05:10:55 GMT</pubDate>
            <atom:updated>2022-09-23T07:44:41.864Z</atom:updated>
            <content:encoded><![CDATA[<p>在看 <strong><em>YOLOv7</em></strong> 論文時，猛然看到一張 <strong><em>Comparison of state-of-the-art real-time object detectors</em></strong> 的表格，就決定挑選多個 <em>FPS </em>在 <em>100 </em>以上的模型，比較各 <em>50</em> 張圖片的效果，就讓我們接著看下去吧！</p><p><a href="https://medium.com/@gary.tsai.advantest/yolox-s-ppyolo-m-yolov5-m-yolor-csp-yolov7-x-part-3-5-a1f2d335b3bc">YOLOX vs PPYOLO vs YOLOv5 vs YOLOR vs YOLOv7(Part 2/2)</a></p><p>我們分別挑選下圖紅框的五個模型：</p><ol><li><strong><em>YOLOX-S：102 FPS, 40.5% AP</em></strong></li><li><strong><em>PPYOLOE-M：123 FPS, 40.5% AP</em></strong></li><li><strong><em>YOLOv5-M：122 FPS, 45.4% AP</em></strong></li><li><strong><em>YOLOR-CSP：106 FPS, 51.1% AP</em></strong></li><li><strong><em>YOLOv7-X：114 FPS, 53.1% AP</em></strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/857/1*2etJQ0HmFNmwJO6Lam34yw.png" /></figure><h3>選手 1</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2HCm0n0vWGuYJkkIwrsorQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ob2hohE2tqE1OR5bjtgOOg.jpeg" /><figcaption>YOLOX-S</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ViJv0T5ASKQaJmtJQ7nTTA.jpeg" /><figcaption>PPYOLOE-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_Ysjxe0Pq5yeFlOZDpwyKg.jpeg" /><figcaption>YOLOv5-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mmEsG6MYE922tJB75R-sOQ.jpeg" /><figcaption>YOLOR-CSP</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1tcHIgs8-ZSCmAE0IHVOCA.jpeg" /><figcaption>YOLOv7-X</figcaption></figure><h3>選手 2</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*auDqbzF1onUWYprtZUrlfg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U7UZC9sI5Mo0qRaNPdZeig.jpeg" /><figcaption>YOLOX-S</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bhWGJ5dpTD8UA6jv41gXDw.jpeg" /><figcaption>PPYOLOE-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e_prYsk_7qN5JGA_hRfRww.jpeg" /><figcaption>YOLOv5-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qduosuGQlrKWt5sy1OwzVg.jpeg" /><figcaption>YOLOR-CSP</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e-s9xd6OQNHdWsKjPBUNgQ.jpeg" /><figcaption>YOLOv7-X</figcaption></figure><h3>選手 3</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-vwUA0CgA2WvCa3t6PU3gg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3cXtEdfwmntp--Qwiu6tVQ.jpeg" /><figcaption>YOLOX-S</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*40OVuUxUUtNE92VQmfqANQ.jpeg" /><figcaption>PPYOLOE-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4NojdV_tgOy4g_wROnpU_g.jpeg" /><figcaption>YOLOv5-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LF_bRj75vx2JCV7S-CeloQ.jpeg" /><figcaption>YOLOR-CSP</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Zij18jPz1BsIVPcxONt0uQ.jpeg" /><figcaption>YOLOv7-X</figcaption></figure><h3>選手 4</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6yz5D7kkrJQkr5NR0cT_mQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ttKhd50RPKpP3jA7wikZEw.jpeg" /><figcaption>YOLOX-S</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2QYNUTXsfN7-Vt4Em5WS0w.jpeg" /><figcaption>PPYOLOE-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JXEMENkv06GLpBklYmP3HA.jpeg" /><figcaption>YOLOv5-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GvYd_fdPFUFXQVnWseaJXw.jpeg" /><figcaption>YOLOR-CSP</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BJS-dPGZQ52m3DjlRcYcRw.jpeg" /><figcaption>YOLOv7-X</figcaption></figure><h3>選手 5</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dvUJOSdjBOFlmQ-mTwVT9w.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*poH5yhtEfYweidZoAJEKfA.jpeg" /><figcaption>YOLOX-S</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kKbgAorf4rpwAYBFP4RPUA.jpeg" /><figcaption>PPYOLOE-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ka0eSvgKHKBDIhXRYB-CgA.jpeg" /><figcaption>YOLOv5-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l2JkAWf4lsnRvutppKSZZg.jpeg" /><figcaption>YOLOR-CSP</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fEjlpfTg8j7IMR_HxyeMmg.jpeg" /><figcaption>YOLOv7-X</figcaption></figure><h3>選手 6</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3rPuuRScJjmzplbSrQUGCg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_9V2-S40nZHqjiJi2eHnFg.jpeg" /><figcaption>YOLOX-S</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ws08BmPWqsiehHv_9KXZSw.jpeg" /><figcaption>PPYOLOE-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sO2WV4o-OaZUsDaNcFObvQ.jpeg" /><figcaption>YOLOv5-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yHXn8rn_D15jnPlZEXfLzA.jpeg" /><figcaption>YOLOR-CSP</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SYEJnVwexzfhX3fBrlC__w.jpeg" /><figcaption>YOLOv7-X</figcaption></figure><h3>選手 7</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FOyROKpit0IQ1q1oL2eBow.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*acF2I2V9JIJz_tYB3EwV7A.jpeg" /><figcaption>YOLOX-S</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q9vyYStQNAaDbRstOurusw.jpeg" /><figcaption>PPYOLOE-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fLyH3Zoep60ToudrTiOeWA.jpeg" /><figcaption>YOLOv5-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qYFnKeu6YmfwHzp-OesJxg.jpeg" /><figcaption>YOLOR-CSP</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*93O23i_7p_pTYpc7Kb-r7w.jpeg" /><figcaption>YOLOv7-X</figcaption></figure><h3>選手 8</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DkHYGw3vcFHtWIPu51w_sg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r9S51cgFuApozaKFJB8ijg.jpeg" /><figcaption>YOLOX-S</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*128tFd6fKTxHWUQwXFhbFA.jpeg" /><figcaption>PPYOLOE-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RahLJqAl4RLJBpmKOk_8wg.jpeg" /><figcaption>YOLOv5-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AEEuODqY8QJWWepqVir2CA.jpeg" /><figcaption>YOLOR-CSP</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ECDclIQ_aCJrdurd-Ty8lg.jpeg" /><figcaption>YOLOv7-X</figcaption></figure><h3>選手 9</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZiGaQgErnbg2X0Hu3eue0w.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9K5P5g2H24MeX6pF5_tV_Q.jpeg" /><figcaption>YOLOX-S</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a9IW0HMOb4OnMjrk3jit7Q.jpeg" /><figcaption>PPYOLOE-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CXLhE4SSV44YhtIh8G-tNw.jpeg" /><figcaption>YOLOv5-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B0Fss45KgH5ViCuUT4y5hg.jpeg" /><figcaption>YOLOR-CSP</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VkOB83TgNHh3GlL3rg0GpQ.jpeg" /><figcaption>YOLOv7-X</figcaption></figure><h3>選手 10</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zyk2oZAK-XvcuchJmoDqdQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JJEEX8lRraDB9sojuyzVaQ.jpeg" /><figcaption>YOLOX-S</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mVdWsqBiNSC5Fc6hD71xcg.jpeg" /><figcaption>PPYOLOE-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gXGYXa9OnjbFv9bzQGe0ow.jpeg" /><figcaption>YOLOv5-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CUKsrJV9R_XWxmjrnc8EYw.jpeg" /><figcaption>YOLOR-CSP</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b4jy3Ih0qE-fREYfbr3FLg.jpeg" /><figcaption>YOLOv7-X</figcaption></figure><h3>選手 11</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0Lu7ugJGtKukQDT5.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*j04fPGgA3_sOtj3w.jpeg" /><figcaption>YOLOX-S</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Hu266-b0A9qd5ZxK.jpeg" /><figcaption>PPYOLOE-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*BVW_XbmH4q6N-Kk9.jpeg" /><figcaption>YOLOv5-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Vr65AwLwHmG0kVg5.jpeg" /><figcaption>YOLOR-CSP</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2gOb5f-5DUbYbJiM.jpeg" /><figcaption>YOLOv7-X</figcaption></figure><h3>選手 12</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*--PuwRKfKyRPy5W8.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*T4SgvpHf0uPUBdQ1.jpeg" /><figcaption>YOLOX-S</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*YkolLVmGZ0nQFe_q.jpeg" /><figcaption>PPYOLOE-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*mmqcCvapvjCez-Px.jpeg" /><figcaption>YOLOv5-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*E8S4Gj1dnCYWZS9S.jpeg" /><figcaption>YOLOR-CSP</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*U8Dta7eNRAT7jynf.jpeg" /><figcaption>YOLOv7-X</figcaption></figure><h3>選手 13</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1005/0*M1TB_w_iMqJaCF1K.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1005/0*kKDW7TxC-bTdvJsl.jpeg" /><figcaption>YOLOX-S</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1005/0*IXe6SvF36KOwY-U-.jpeg" /><figcaption>PPYOLOE-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1005/0*lrYfv_Y1b7s5pW8d.jpeg" /><figcaption>YOLOv5-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1005/0*cjk2W_5AccYJWbk1.jpeg" /><figcaption>YOLOR-CSP</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1005/0*yU9JhmDJy7blkiq5.jpeg" /><figcaption>YOLOv7-X</figcaption></figure><h3>選手 14</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*B6gpTDeIqYiruk69.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*GtlWnPS5op9HvS5J.jpeg" /><figcaption>YOLOX-S</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*eJhsB-WBcVsoMNP0.jpeg" /><figcaption>PPYOLOE-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Rgf9e9BZ_jWbvke4.jpeg" /><figcaption>YOLOv5-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8eJkdeOlXI4wiZx8.jpeg" /><figcaption>YOLOR-CSP</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xH10g-1qW57VI0qn.jpeg" /><figcaption>YOLOv7-X</figcaption></figure><h3>選手 15</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vlVHxW997zNl8TpJ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*GYzeMjA6gRaFLhp2.jpeg" /><figcaption>YOLOX-S</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*jSo47eO-4NSR3RgI.jpeg" /><figcaption>PPYOLOE-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8w_QOQwWBPTnJvJD.jpeg" /><figcaption>YOLOv5-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0aHteJDpB_E5iT8N.jpeg" /><figcaption>YOLOR-CSP</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*aTukiTvzusS99u8Q.jpeg" /><figcaption>YOLOv7-X</figcaption></figure><h3>選手 16</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*241STR1GD2I9sPIa.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6YFyZ4TwnikA9khR.jpeg" /><figcaption>YOLOX-S</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HxpuMvzr0na5ql7e.jpeg" /><figcaption>PPYOLOE-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*L6phDR9q0f2uARNv.jpeg" /><figcaption>YOLOv5-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9UR2ZfeP-pVbuCuQ.jpeg" /><figcaption>YOLOR-CSP</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9oaYHvQSxQJFUs1R.jpeg" /><figcaption>YOLOv7-X</figcaption></figure><h3>選手 17</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*p2zJWXKKAKNdLudD.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*rrWJM2OA1JvM_L4x.jpeg" /><figcaption>YOLOX-S</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*jLqFlFkB06sU-6Ui.jpeg" /><figcaption>PPYOLOE-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*TxwiP4SbIMI4TCK3.jpeg" /><figcaption>YOLOv5-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ZXeCg_BNQhCbK3B0.jpeg" /><figcaption>YOLOR-CSP</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*boM1HsgXfTqBoBY5.jpeg" /><figcaption>YOLOv7-X</figcaption></figure><h3>選手 18</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*h76kIYrwUt1bt9DQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cBY92Y-h0ml-sF7N.jpeg" /><figcaption>YOLOX-S</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*iFwtOp7ZeF9CSkKY.jpeg" /><figcaption>PPYOLOE-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*yb2vZNBRRSLKbFeC.jpeg" /><figcaption>YOLOv5-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*mWxdHlx-t2jhevd2.jpeg" /><figcaption>YOLOR-CSP</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*uiq9XuRtvf-Siav5.jpeg" /><figcaption>YOLOv7-X</figcaption></figure><h3>選手 19</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9Wv_G6RdesapdJ8h.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*EN66jfMgEJZyTDwZ.jpeg" /><figcaption>YOLOX-S</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1jTMNvhXYrpB8hKl.jpeg" /><figcaption>PPYOLOE-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*J0hgl60FTQH7XUp1.jpeg" /><figcaption>YOLOv5-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*RVUU_vtCoEbOOMaf.jpeg" /><figcaption>YOLOR-CSP</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*zh8swsx61m2KT92E.jpeg" /><figcaption>YOLOv7-X</figcaption></figure><h3>選手 20</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*TqdMgtymLZ74Rxo9.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*XP4kJzgiQHU1IaHS.jpeg" /><figcaption>YOLOX-S</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*5VnDA7qwd1-27-ux.jpeg" /><figcaption>PPYOLOE-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*uFokHeNEIbVG2K_m.jpeg" /><figcaption>YOLOv5-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*UlXAQ57_saUVKlEy.jpeg" /><figcaption>YOLOR-CSP</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*AmtmjHq2YVNWs9uV.jpeg" /><figcaption>YOLOv7-X</figcaption></figure><h3>選手 21</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*J8l8cp8u6Q6y9_Bf.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*TJXWP-MIhSbZ10ll.jpeg" /><figcaption>YOLOX-S</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Gr9A6SuavhE36yLc.jpeg" /><figcaption>PPYOLOE-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KkRyF4bUQOlBvt5L.jpeg" /><figcaption>YOLOv5-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dxTvsNoIfAmR_v1f.jpeg" /><figcaption>YOLOR-CSP</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9sUNQOAEmzmsALsy.jpeg" /><figcaption>YOLOv7-X</figcaption></figure><h3>選手 22</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*Z_mxnP5HUH5hUIIq.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*amz-qT6a2R4hLZs_.jpeg" /><figcaption>YOLOX-S</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*JX0HtQWVP0bvPURk.jpeg" /><figcaption>PPYOLOE-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*PCX48OS2qcekOKFE.jpeg" /><figcaption>YOLOv5-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*ZPEu4bHr914-TW5n.jpeg" /><figcaption>YOLOR-CSP</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*vOCSL1Bjc6o_4O7U.jpeg" /><figcaption>YOLOv7-X</figcaption></figure><h3>選手 23</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*eciWSL6GM9vwN5LC.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*eNstVlqjSOcxXOfJ.jpeg" /><figcaption>YOLOX-S</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*P8oCBETrOfUh9HcT.jpeg" /><figcaption>PPYOLOE-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*FWEUAtmFBqrFmecP.jpeg" /><figcaption>YOLOv5-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9nqkN9eycuSIEvLe.jpeg" /><figcaption>YOLOR-CSP</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cdhsigHsgmisrGHk.jpeg" /><figcaption>YOLOv7-X</figcaption></figure><h3>選手 24</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*8jBZvu_fel1oSWGY.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*mu6eivsTDerKPfS3.jpeg" /><figcaption>YOLOX-S</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*tfieCDC621lM_0QB.jpeg" /><figcaption>PPYOLOE-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*TCTVdD2jjDS33X5t.jpeg" /><figcaption>YOLOv5-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*57P0jB_Xx1yw89Ck.jpeg" /><figcaption>YOLOR-CSP</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*ZXMm8fAS7B48v4ar.jpeg" /><figcaption>YOLOv7-X</figcaption></figure><h3>選手 25</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*m2CDCvcQnx3eFYql.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*GujSCK54qpuZIcyJ.jpeg" /><figcaption>YOLOX-S</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*RXZy8rdQ-5ybkiFZ.jpeg" /><figcaption>PPYOLOE-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*PSGJknGz32wz7JaO.jpeg" /><figcaption>YOLOv5-M</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xXaHI0kUNW4EA3eW.jpeg" /><figcaption>YOLOR-CSP</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*yNfbJTaOu4Yvrv1B.jpeg" /><figcaption>YOLOv7-X</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7de49a110df9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Run YOLOv7 Instance Segmentation Inference in Google Colab]]></title>
            <link>https://medium.com/@gary.tsai.advantest/yolov7-instance-segmentation-inference-49a1eb3077c7?source=rss-52b6c57e94fa------2</link>
            <guid isPermaLink="false">https://medium.com/p/49a1eb3077c7</guid>
            <category><![CDATA[instance-segmentation]]></category>
            <category><![CDATA[yolo]]></category>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[deep-learning]]></category>
            <dc:creator><![CDATA[gary.TsAI(Taiwan A.I.)]]></dc:creator>
            <pubDate>Wed, 07 Sep 2022 08:48:40 GMT</pubDate>
            <atom:updated>2022-09-23T06:30:55.625Z</atom:updated>
            <content:encoded><![CDATA[<p>我們使用 <em>Google Colab </em>實操 <em>YOLO </em>系列的最新版本 「<em>YOLOv7</em>」，輕鬆實現最新的實例分割模型。</p><p>如果對物件偵測和人體姿態估計有興趣的小夥伴，也可以點選下方連結唷！</p><ul><li><a href="https://medium.com/@gary.tsai.advantest/yolov7-google-colab-%E5%AF%A6%E9%9A%9B%E6%93%8D%E4%BD%9C-26e08558d779">How to Run YOLOv7 in Google Colab</a></li><li><a href="https://medium.com/@gary.tsai.advantest/yolov7-human-post-estimation-4dcd94e29d36">How to Run YOLOv7 Human Post Estimation in Google Colab</a></li></ul><p>在實際操作之前，我們先上一張<strong>巨石強森</strong>和傑森斯坦森的帥照吧！</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*ZRo5ZH3EJGH3zhBfoi04Sw.jpeg" /></figure><h3>二、Google Colab 設定</h3><p>讓我們馬上開始使用 <em>YOLOv7</em> 吧！我們將使用<em> Google Colab</em> 來實現。首先，配置 <em>GPU </em>使其可以使用。<em>“Runtime” -&gt; “Change runtime type” -&gt; </em>將<em>“Hardware accelerator” </em>更改為 <em>GPU。</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/406/0*PtMXTONEbhKCrHI8.png" /></figure><p>接著安裝 <em>Google Drive。</em></p><pre>from google.colab import drive <br>drive.mount(&#39;/content/drive&#39;)</pre><p>創建新的資料夾。</p><pre>!mkdir -p &#39;/content/drive/My Drive/yolov7_segmentation/&#39;<br>%cd &#39;/content/drive/My Drive/yolov7_segmentation/&#39;</pre><p>從 <em>YOLO </em>官方 <em>git clone</em>。</p><pre>!git clone -b mask https://github.com/WongKinYiu/yolov7</pre><p>然後導入所需的函式庫。這裡我們使用 <em>pip</em> 安裝。</p><pre>%cd yolov7<br>!pip install -r requirements.txt</pre><p>我們現在可以使用 <em>YOLOv7 </em>囉！開始出發吧！</p><p>從 <em>Detectron2 </em>官方 <em>git clone</em>。</p><pre>!git clone <a href="https://github.com/facebookresearch/detectron2">https://github.com/facebookresearch/detectron2</a></pre><p>更改資料夾名稱。</p><pre>%mv ./detectron2 ./detectron</pre><p>接下來，移動本次需要的 <em>detectron2</em> 子資料夾。</p><pre>%mv ./detectron/detectron2 ./</pre><p>安裝 Pytorch 。</p><pre>%cd &#39;/content/drive/My Drive/yolov7_segmentation/yolov7&#39;<br>!pip install torchvision==0.10.1<br>!pip install torch==1.9.1</pre><p>然後導入所需的函式庫。這裡我們使用 <em>pip</em> 安裝。</p><pre>!pip install fvcore<br>!pip install omegaconf<br>!pip install fairscale<br>!pip install timm</pre><p>準備工作現已完成。</p><h3>使用範例圖片 inference</h3><p>下載訓練好的模型。</p><pre>!wget <a href="https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7-mask.pt">https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7-mask.pt</a></pre><p>首先，導入之前準備的每個函式庫。</p><pre>import matplotlib.pyplot as plt<br>import torch<br>import cv2<br>import yaml<br>from torchvision import transforms<br>import numpy as np</pre><pre>from utils.datasets import letterbox<br>from utils.general import non_max_suppression_mask_conf</pre><pre>from detectron2.modeling.poolers import ROIPooler<br>from detectron2.structures import Boxes<br>from detectron2.utils.memory import retry_if_cuda_oom<br>from detectron2.layers import paste_masks_in_image</pre><p>然後加載訓練好的模型。</p><pre>device = torch.device(&quot;cuda:0&quot; if torch.cuda.is_available() else &quot;cpu&quot;)<br>with <em>open</em>(&#39;data/hyp.scratch.mask.yaml&#39;) as f:<br>    hyp = yaml.load(f, Loader=yaml.FullLoader)<br>weigths = torch.load(&#39;yolov7-mask.pt&#39;)<br>model = weigths[&#39;model&#39;]<br>model = model.half().to(device)<br>_ = model.<em>eval</em>()</pre><p>然後加載測試圖像。</p><pre>image = cv2.imread(&#39;./inference/images/horses.jpg&#39;)  <br>image = letterbox(image, 960, stride=64, auto=True)[0]<br>image_ = image.copy()<br>image = transforms.ToTensor()(image)<br>image = torch.tensor(np.array([image.numpy()]))<br>image = image.to(device)<br>image = image.half()</pre><pre>output = model(image)</pre><p>返回推理結果。</p><pre>inf_out, train_out, attn, mask_iou, bases, sem_output = output[&#39;test&#39;], output[&#39;bbox_and_cls&#39;], output[&#39;attn&#39;], output[&#39;mask_iou&#39;], output[&#39;bases&#39;], output[&#39;sem&#39;]</pre><pre>bases = torch.cat([bases, sem_output], dim=1)<br>nb, _, height, width = image.shape<br>names = model.names<br>pooler_scale = model.pooler_scale<br>pooler = ROIPooler(output_size=hyp[&#39;mask_resolution&#39;], scales=(pooler_scale,), sampling_ratio=1, pooler_type=&#39;ROIAlignV2&#39;, canonical_level=2)</pre><pre>output, output_mask, output_mask_score, output_ac, output_ab = non_max_suppression_mask_conf(inf_out, attn, bases, pooler, hyp, conf_thres=0.25, iou_thres=0.65, merge=False, mask_iou=None)</pre><pre>pred, pred_masks = output[0], output_mask[0]<br>base = bases[0]<br>bboxes = Boxes(pred[:, :4])<br>original_pred_masks = pred_masks.view(-1, hyp[&#39;mask_resolution&#39;], hyp[&#39;mask_resolution&#39;])<br>pred_masks = retry_if_cuda_oom(paste_masks_in_image)( original_pred_masks, bboxes, (height, width), threshold=0.5)<br>pred_masks_np = pred_masks.detach().cpu().numpy()<br>pred_cls = pred[:, 5].detach().cpu().numpy()<br>pred_conf = pred[:, 4].detach().cpu().numpy()<br>nimg = image[0].permute(1, 2, 0) * 255<br>nimg = nimg.cpu().numpy().astype(np.uint8)<br>nimg = cv2.cvtColor(nimg, cv2.COLOR_RGB2BGR)<br>nbboxes = bboxes.tensor.detach().cpu().numpy().astype(np.<em>int</em>)</pre><p>根據最後獲得的結果對圖像進行遮罩。</p><pre>pnimg = nimg.copy()<br>for one_mask, bbox, cls, conf in <em>zip</em>(pred_masks_np, nbboxes, pred_cls, pred_conf):<br>    if conf &lt; 0.25:<br>        continue<br>    color = [np.random.randint(255), np.random.randint(255), np.random.randint(255)]              <br>    pnimg[one_mask] = pnimg[one_mask] * 0.5 + np.array(color, dtype=np.uint8) * 0.5</pre><p>讓我們看看結果。</p><pre>%matplotlib inline<br>plt.figure(figsize=(8,8))<br>plt.axis(&#39;off&#39;)<br>plt.imshow(pnimg)<br>plt.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/460/0*ZYRLnv18ZAyl9mik" /></figure><p>添加物見偵測的訊息，同時顯示邊界框和分數。</p><pre>pnimg = nimg.copy()<br>for one_mask, bbox, cls, conf in <em>zip</em>(pred_masks_np, nbboxes, pred_cls, pred_conf):<br>    if conf &lt; 0.25:<br>        continue<br>    color = [np.random.randint(255), np.random.randint(255), np.random.randint(255)]<br>                        <br>                        <br>    pnimg[one_mask] = pnimg[one_mask] * 0.5 + np.array(color, dtype=np.uint8) * 0.5<br>    pnimg = cv2.rectangle(pnimg, (bbox[0], bbox[1]), (bbox[2], bbox[3]), color, 2)<br>    label = &#39;%s %.3f&#39; % (names[<em>int</em>(cls)], conf)<br>    t_size = cv2.getTextSize(label, 0, fontScale=0.5, thickness=1)[0]<br>    c2 = bbox[0] + t_size[0], bbox[1] - t_size[1] - 3<br>    pnimg = cv2.rectangle(pnimg, (bbox[0], bbox[1]), c2, color, -1, cv2.LINE_AA)  # filled<br>    pnimg = cv2.putText(pnimg, label, (bbox[0], bbox[1] - 2), 0, 0.5, [255, 255, 255], thickness=1, lineType=cv2.LINE_AA)</pre><pre>%matplotlib inline<br>plt.figure(figsize=(8,8))<br>plt.axis(&#39;off&#39;)<br>plt.imshow(pnimg)<br>plt.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/460/0*DlDfYbCyYDTCJ6ER" /></figure><h3>使用任意影片 inference</h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fvz_We121bgs%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dvz_We121bgs&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fvz_We121bgs%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/3d84b80b13573bca0baa9caef7e6a736/href">https://medium.com/media/3d84b80b13573bca0baa9caef7e6a736/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=49a1eb3077c7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Run YOLOv7 Human Post Estimation in Google Colab]]></title>
            <link>https://medium.com/@gary.tsai.advantest/yolov7-human-post-estimation-4dcd94e29d36?source=rss-52b6c57e94fa------2</link>
            <guid isPermaLink="false">https://medium.com/p/4dcd94e29d36</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[yolo]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[deep-learning]]></category>
            <dc:creator><![CDATA[gary.TsAI(Taiwan A.I.)]]></dc:creator>
            <pubDate>Thu, 01 Sep 2022 05:47:42 GMT</pubDate>
            <atom:updated>2022-09-23T06:29:50.637Z</atom:updated>
            <content:encoded><![CDATA[<p>我們使用 <em>Google Colab </em>實操 <em>YOLO </em>系列的最新版本 「<em>YOLOv7</em>」，輕鬆實現最新的人體姿態估計模型。</p><p>如果對物件偵測和實例分割有興趣的小夥伴，也可以點選下方連結唷！</p><ul><li><a href="https://medium.com/@gary.tsai.advantest/yolov7-google-colab-%E5%AF%A6%E9%9A%9B%E6%93%8D%E4%BD%9C-26e08558d779">How to Run YOLOv7 in Google Colab</a></li><li><a href="https://medium.com/@gary.tsai.advantest/yolov7-instance-segmentation-inference-49a1eb3077c7">How to Run YOLOv7 Instance Segmentation Inference in Google Colab</a></li></ul><p>在實際操作之前，我們先上幾張葉問的帥照！</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*mSoQY11JIVS5A285o7LmEg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o5TFawQTdprNc3cmZn_vng.png" /></figure><h3>一、使用任意圖片 inference</h3><p>讓我們用範例圖片 <em>inference</em> 吧！首先下載訓練好的模型。這裡我們使用最高的 <em>“yolov7-w6-pose.pt”</em>。</p><pre># !wget https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7-w6-pose.pt</pre><p>首先，導入需要的函式庫。</p><pre>import torch<br>import cv2<br>from torchvision import transforms<br>import numpy as np<br>import tqdm<br>from utils.datasets import letterbox<br>from utils.general import non_max_suppression_kpt<br>from utils.plots import output_to_keypoint, plot_skeleton_kpts</pre><p>定義一個處理姿態估計的函式。</p><pre><em>def</em> pose_estimation(img):<br>  image = cv2.imread(img)<br>  image = letterbox(image, 960, stride=64, auto=True)[0]<br>  image_ = image.copy()<br>  image = transforms.ToTensor()(image)<br>  image = torch.tensor(np.array([image.numpy()]))</pre><pre>  if torch.cuda.is_available():<br>      image = image.half().to(device)   <br>  output, _ = model(image)<br>  output = non_max_suppression_kpt(output, 0.25, 0.65, nc=model.yaml[&#39;nc&#39;], nkpt=model.yaml[&#39;nkpt&#39;], kpt_label=True)<br>  with torch.no_grad():<br>      output = output_to_keypoint(output)<br>  nimg = image[0].permute(1, 2, 0) * 255<br>  nimg = nimg.cpu().numpy().astype(np.uint8)<br>  nimg = cv2.cvtColor(nimg, cv2.COLOR_RGB2BGR)</pre><pre>  for idx in <em>range</em>(output.shape[0]):<br>      plot_skeleton_kpts(nimg, output[idx, 7:].T, 3)</pre><pre>  %matplotlib inline<br>  plt.figure(figsize=(8,8))<br>  plt.axis(&#39;off&#39;)<br>  plt.imshow(nimg)<br>  plt.show()</pre><p>最後，我們指定圖片並執行該函式。</p><pre>img = &#39;./inference/images/image.jpg&#39;<br>pose_estimation(img)</pre><p>我們能夠精準地看到玩命關頭主角們身上的骨架囉！</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wDxLm9hWz1qp0xx_0mEURQ.png" /></figure><h3>一、使用任意視頻 inference</h3><p>定義一個加載視頻並處理姿態估計的函式。</p><pre><em>def</em> process_keypoints(video_file, model, output_video_path):<br>    video = cv2.VideoCapture(video_file)<br>    writer = _create_vid_writer(video, output_video_path)<br>    num_frames = <em>int</em>(video.get(cv2.CAP_PROP_FRAME_COUNT))<br>    width = <em>int</em>(video.get(cv2.CAP_PROP_FRAME_WIDTH))<br>    height = <em>int</em>(video.get(cv2.CAP_PROP_FRAME_HEIGHT))<br>    f_num = 0<br>    pbar = tqdm.tqdm(total=num_frames, desc=&quot;inf&quot;)<br>    while video.isOpened():<br>        ret, frame = video.read()<br>        if (frame is None):<br>            break<br>        pbar.update(1)<br>        <br>        frame = letterbox(frame, 1280, stride=64, auto=True)[0]<br>        frame_ = frame.copy()<br>        frame = transforms.ToTensor()(frame)<br>        frame = torch.tensor(np.array([frame.numpy()]))<br>        frame = frame.to(device)<br>        frame = frame.half()<br>        output, _ = model(frame)<br>        with torch.set_grad_enabled(False):<br>          <br>          output = non_max_suppression_kpt(output, 0.25, 0.65, nc=model.yaml[&#39;nc&#39;], nkpt=model.yaml[&#39;nkpt&#39;], kpt_label=True)<br>          output = output_to_keypoint(output)<br>        nimg = frame[0].permute(1, 2, 0) * 255<br>        nimg = nimg.cpu().numpy().astype(np.uint8)<br>        nimg = cv2.cvtColor(nimg, cv2.COLOR_BGR2RGB)<br>        nimg = cv2.cvtColor(nimg, cv2.COLOR_RGB2BGR) <br>      <br>        for idx in <em>range</em>(output.shape[0]):<br>            plot_skeleton_kpts(nimg, output[idx, 7:].T, 3)<br>        <br>        writer.write(nimg)<br>        torch.cuda.empty_cache()<br>    <br>    video.release()<br>    writer.release()</pre><p>最後，定義一個輸出視頻的函式。</p><pre><em>def</em> _create_vid_writer(vid_cap, video_path):<br>	fps = vid_cap.get(cv2.CAP_PROP_FPS)<br>	w = <em>int</em>(vid_cap.get(cv2.CAP_PROP_FRAME_WIDTH))<br>	h = <em>int</em>(vid_cap.get(cv2.CAP_PROP_FRAME_HEIGHT))<br><br>	writer = cv2.VideoWriter(video_path, cv2.VideoWriter_fourcc(&#39;m&#39;, &#39;p&#39;, &#39;4&#39;, &#39;v&#39;), fps, (1280,768))<br>	return writer</pre><pre>!python detect.py --source inference/images/horses.jpg --weights yolov7-e6e.pt --conf 0.25 --img-size 1280 --device 0</pre><p>最後，我們指定視頻並執行該函式。</p><pre>video_file = &#39;./inference/pose/pose.mp4&#39;<br>video_output = &#39;pose.mp4&#39;<br>process_keypoints(video_file, model, video_output)</pre><p>我們能夠很輕鬆運行實現姿態估計囉！</p><p>最後上個影片來一起研究葉問的咏春唄！</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FIg4WArGXmSk%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DIg4WArGXmSk&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FIg4WArGXmSk%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/0879ef4c11ba14a277ac560343fb855c/href">https://medium.com/media/0879ef4c11ba14a277ac560343fb855c/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fjc8b-gwOMro&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Djc8b-gwOMro&amp;image=http%3A%2F%2Fi.ytimg.com%2Fvi%2Fjc8b-gwOMro%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/bceedb8a5b3bc9a1ac7dacd819a116cf/href">https://medium.com/media/bceedb8a5b3bc9a1ac7dacd819a116cf/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fq8Ozct0aAIg%3Flist%3DPL2hRx7qis_Elu3vKhp5axmqajEP3_sgnd&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dq8Ozct0aAIg&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fq8Ozct0aAIg%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/bc07aa5a2be98144cca0f7398fd10af9/href">https://medium.com/media/bc07aa5a2be98144cca0f7398fd10af9/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FE3k8X3E8bXU%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DE3k8X3E8bXU&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FE3k8X3E8bXU%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/5d06c1cbdcb71771c50c55aa5b3bba96/href">https://medium.com/media/5d06c1cbdcb71771c50c55aa5b3bba96/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FVSM13CVXVXI%3Flist%3DPL2hRx7qis_Elu3vKhp5axmqajEP3_sgnd&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DVSM13CVXVXI&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FVSM13CVXVXI%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/ad0f4365d6d62240581c5c713d44f84e/href">https://medium.com/media/ad0f4365d6d62240581c5c713d44f84e/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4dcd94e29d36" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>