<?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 Dickson Chow on Medium]]></title>
        <description><![CDATA[Stories by Dickson Chow on Medium]]></description>
        <link>https://medium.com/@dicksondickson?source=rss-abb9b1b769d5------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*K_VIyiy9Oij4jgN0DxeQ2w.jpeg</url>
            <title>Stories by Dickson Chow on Medium</title>
            <link>https://medium.com/@dicksondickson?source=rss-abb9b1b769d5------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 05:39:43 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@dicksondickson/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[Project MIGIT — AI Server on a Potato]]></title>
            <link>https://dicksondickson.medium.com/project-migit-ai-server-on-a-potato-d613721eebd2?source=rss-abb9b1b769d5------2</link>
            <guid isPermaLink="false">https://medium.com/p/d613721eebd2</guid>
            <category><![CDATA[open-webui]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[potato]]></category>
            <category><![CDATA[ollama]]></category>
            <dc:creator><![CDATA[Dickson Chow]]></dc:creator>
            <pubDate>Mon, 10 Mar 2025 16:23:01 GMT</pubDate>
            <atom:updated>2025-03-10T16:23:01.065Z</atom:updated>
            <content:encoded><![CDATA[<h3>Project MIGIT — AI Server on a Potato</h3><h3>What is this?</h3><p>I’m writing this guide to help beginners dip their toes into running a local AI server at home. You don’t need 8x Mac minis or even a GPU — if you have an old laptop or computer, this guide is for you. The aim is to set up Linux, Ollama, and OpenWebUI on a potato, using only the CPU for inference. In addition to running LLMs, we’ll generate images too!</p><p>You can also find a copy of this guide on my Github: <a href="https://github.com/dicksondickson/project-migit">https://github.com/dicksondickson/project-migit</a></p><p>In this guide, I’ll be using a 7th gen NUC (NUC7i7DNKE) released back in 2018. It has an Intel Core i7–8650U processor, 16GB RAM, and 500GB NVMe SSD.</p><p>I have Ubuntu-based Pop!_OS, Ollama, OpenWebUI, and KokoroTTS running on this machine, and it is completely usable with smaller models.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/789/0*fq-VZ0GChJnDz4KA.jpg" /></figure><h3>Models Tested</h3><p>Here are the models I’ve tested with their performance metrics:</p><p><strong>Qwen 2.5 Models:</strong></p><ul><li>1.5 billion parameters at Q4 (qwen2.5:1.5b-instruct-q4_K_M): 48 t/s</li><li>3 billion parameters at Q4 (qwen2.5:3b-instruct-q4_K_M): 11.84 t/s</li><li>7 billion parameters at Q4 (qwen2.5:7b-instruct-q4_K_M): 5.89 t/s</li><li>Qwen 2.5 coder, 7 billion parameters at Q4 (qwen2.5-coder:7b-instruct-q4_K_M): 5.82 t/s</li></ul><p>I would say 7B Q4 models are the highest I would go for this particular machine. Anything higher becomes too slow as the conversation becomes longer.</p><p><strong>Reasoning Models:</strong> The reasoning models are hit or miss at 1.5B. DeepScaler is surprisingly usable, while Deepseek 1.5B distill “overthinks” and talks too much. The reasoning also takes quite a bit of time, but it’s still fun to play around with.</p><ul><li>Deepseek R1 Qwen 2.5 Distill, 1.5B parameter at Q4 (deepseek-r1:1.5b-qwen-distill-q4_K_M): 11.46 t/s</li><li>Deepscaler Preview, 1.5B parameter at Q4 (deepscaler:1.5b-preview-q4_K_M): 14 t/s</li></ul><p><strong>Image Generation using FastSDCPU:</strong></p><ul><li>LCM OpenVINO + TAESD: 1.73s/it</li><li>2.5 sec per image at 512x512</li></ul><h3>Let’s Do This!</h3><h3>1. Install Pop!_OS</h3><p>First, we’ll install Pop!_OS, which is based on Ubuntu.</p><ol><li>Download the image from System76: <a href="https://pop.system76.com/">https://pop.system76.com/</a></li><li>Create your bootable USB and install Pop!_OS</li><li>Follow the instructions here: <a href="https://support.system76.com/articles/live-disk/">https://support.system76.com/articles/live-disk/</a></li></ol><h3>2. Update System</h3><p>Update the system first:</p><pre>sudo apt update<br>sudo apt upgrade</pre><h3>3. System Tweaks</h3><ol><li>Disable system suspend:</li></ol><ul><li>Go to Settings &gt; Power &gt; Automatic suspend (turn it off)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*y7P58K0FWAOZUcT6.png" /></figure><ol><li>Rename system:</li></ol><ul><li>Go to Settings &gt; About &gt; Device name</li><li>I’m naming mine “migit”</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ewBg-9K1p50nIFMP.png" /></figure><h3>4. Install Python Packages</h3><pre>sudo apt install python-is-python3 python3-pip python3-venv<br><br>pip3 install --upgrade pip</pre><h3>5. Install Ollama</h3><pre>curl -fsSL https://ollama.com/install.sh | sh</pre><p>Verify installation:</p><pre>ollama -v</pre><p>Configure Ollama to work with OpenWebUI Docker container:</p><pre>sudo systemctl edit ollama.service</pre><p>Add these lines in the indicated section:</p><pre>[Service]<br>Environment=&quot;OLLAMA_HOST=0.0.0.0&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8N4E5n24RLSpZXll.png" /></figure><p>Restart Ollama service:</p><pre>systemctl daemon-reload<br>systemctl restart ollama</pre><h3>6. Install Docker Engine</h3><p>Add Docker’s official GPG key:</p><pre># Add Docker&#39;s official GPG key:<br>sudo apt-get update<br>sudo apt-get install ca-certificates curl<br>sudo install -m 0755 -d /etc/apt/keyrings<br>sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc<br>sudo chmod a+r /etc/apt/keyrings/docker.asc</pre><p>Add the repository to Apt sources:</p><pre># Add the repository to Apt sources:<br>echo \<br>  &quot;deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \<br>  $(. /etc/os-release &amp;&amp; echo &quot;${UBUNTU_CODENAME:-$VERSION_CODENAME}&quot;) stable&quot; | \<br>  sudo tee /etc/apt/sources.list.d/docker.list &gt; /dev/null<br>sudo apt-get update</pre><p>Install the latest version of Docker Engine:</p><pre>sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin</pre><p>Test Docker installation:</p><pre>sudo docker run hello-world</pre><p>Add yourself to the docker group so you don’t need to type ‘sudo’ all the time:</p><pre>sudo usermod -aG docker $USER</pre><p>Clean up Docker images and containers:</p><pre># Remove stopped containers<br>docker container prune<br><br># Remove unused images<br>docker image prune -a</pre><h3>7. Install OpenWebUI</h3><p>Pull the latest Open WebUI Docker image:</p><pre>docker pull ghcr.io/open-webui/open-webui:main</pre><p>Run OpenWebUI container:</p><pre>docker run -d \<br>  -p 3000:8080 \<br>  --add-host=host.docker.internal:host-gateway \<br>  -v open-webui:/app/backend/data \<br>  --name open-webui \<br>  --restart always \<br>  ghcr.io/open-webui/open-webui:main</pre><p>Access OpenWebUI:</p><ul><li>Open your web browser and go to <a href="http://[your-computer-name]:3000/">http://[your-computer-name]:3000/</a></li><li>Create an admin account</li></ul><h3>8. Connect OpenWebUI to Ollama</h3><ol><li>Go to Settings &gt; Admin Settings &gt; Connections &gt; Manage Ollama API Connections.</li><li>Add <a href="http://host.docker.internal:11434/">http://host.docker.internal:11434</a> and save your settings.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*s5C4Vf6iL1MGEFau.png" /></figure><h3>9. Download Models</h3><p>You can download and manage Ollama’s models directly in OpenWebUI.</p><ol><li>Go to Settings &gt; Admin Settings &gt; Models &gt; Manage Models</li><li>In the “Pull model from Ollama” field, enter: qwen2.5:1.5b-instruct-q4_K_M</li></ol><p>You can find more models at: <a href="https://ollama.com/search">https://ollama.com/search</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ZaiZLXpy-Yl5y8pN.png" /></figure><h3>10. Set Up KokoroTTS-FastAPI for Text-to-Speech</h3><p>OpenWebUI already have basic built-in text-to-speech and the better Kokoro.js. However, Kokoro.js is kind of slow. We’ll be setting up Kokoro-FastAPI for fast CPU inference.</p><p>Install Kokoro-FastAPI:</p><pre>docker run -d \<br>  -p 8880:8880 \<br>  --add-host=host.docker.internal:host-gateway \<br>  --name kokorotts-fastapi \<br>  --restart always \<br>  ghcr.io/remsky/kokoro-fastapi-cpu:latest</pre><p>Configure OpenWebUI for Text-to-Speech:</p><ol><li>Open Admin Panel &gt; Settings &gt; Audio</li><li>Set TTS Settings:</li></ol><ul><li>Text-to-Speech Engine: OpenAI</li><li>API Base URL: <a href="http://host.docker.internal:8880/v1">http://host.docker.internal:8880/v1</a></li><li>API Key: not-needed</li><li>TTS Model: kokoro</li><li>TTS Voice: af_bella</li></ul><p>Kokoro-FastAPI also have a webui where you can test the available voices. Test available voices at <a href="http://[your-computer-name]:8880/web/">http://[your-computer-name]:8880/web/</a></p><h3>BONUS Features!</h3><h3>System Resource Monitoring with btop</h3><p>You can monitor your AI server resources remotely via SSH and using btop.</p><p>Repo: <a href="https://github.com/aristocratos/btop">https://github.com/aristocratos/btop</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*d4WlLvaRqWmiH_d5.png" /></figure><p>Install btop for system monitoring:</p><pre>cd Downloads<br>curl -LO https://github.com/aristocratos/btop/releases/download/v1.4.0/btop-x86_64-linux-musl.tbz<br>tar -xjf btop-x86_64-linux-musl.tbz<br>cd btop<br>sudo make install</pre><p>Run btop:</p><pre>btop</pre><h3>Monitor your AI Server Remotely via SSH</h3><p>Install SSH server:</p><pre>sudo apt install openssh-server</pre><p>In either mac terminal or windows command prompt, run:</p><pre>ssh user@[your-computer-name]</pre><p>Then run btop.</p><h3>Image Generation with FastSDCPU</h3><p>We can also run FastSDCPU on our AI server to generate images as well. Unfortunately, the API is not compatible with OpenWebUI, but FastSDCPU have it’s own webui.</p><p>Repo: <a href="https://github.com/rupeshs/fastsdcpu">https://github.com/rupeshs/fastsdcpu</a></p><p>Install FastSDCPU:</p><pre>cd ~<br>git clone https://github.com/rupeshs/fastsdcpu.git<br>cd fastsdcpu<br>chmod +x install.sh<br>./install.sh</pre><p>We need to edit FastSDCPU so we can access the webui from any computer in our network:</p><pre>nano src/frontend/webui/ui.py</pre><p>Scroll all the way to the bottom and edit the ‘webui.launch’ parameter:</p><pre>webui.launch(share=share,server_name=&quot;0.0.0.0&quot;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*gASepMH82RXV1988.png" /></figure><p>Make sure you are at the root of FastSDCPU directory and run:</p><pre>chmod +x start-webui.sh<br>./start-webui.sh</pre><p>Access FastSDCPU WebUI at <a href="http://[your-computer-name]:7860/">http://[your-computer-name]:7860/</a></p><h4>Recommended Settings:</h4><ol><li>Mode: Select ‘LCM-OpenVINO’</li><li>Models tab: Select ‘rupeshs/sdxs-512–0.9-openvino’</li><li>Generation settings tab: Enable ‘tiny autoencoder for sd’</li></ol><p>Go to the ‘text to image’ tab and try generating an image with the prompt: “cat, watercolor painting”</p><p>Note: Required models will download automatically on first run, which may take some time depending on your internet connection. Subsequent runs will be faster.</p><p>You should now have a painting of a cat!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/0*9VfP7wVqv_l5JBgF.jpg" /></figure><h3>Access Your AI Server Securely on the Internet with Tailscale!</h3><p>Tailscale is a zero-config VPN service that creates a secure private network between your devices using WireGuard protocol, making them appear as if they’re on the same local network regardless of their physical location.</p><p>Get it at <a href="https://tailscale.com/">https://tailscale.com/</a></p><p>Their installation instructions are super simple and they have an app for both desktop and phone. Once you have Tailscale installed, you can access it via your VPN ip address or machine name.</p><h3>Hope you found this useful. Have fun!</h3><h3>Updating</h3><p>Things move quickly especially with OpenWebUI releases.</p><h3>Updating OpenWebUI</h3><pre># Pull the latest Open WebUI Docker image<br>docker pull ghcr.io/open-webui/open-webui:main<br><br># Stop the existing Open WebUI container if it&#39;s running<br>docker stop open-webui<br><br># Remove the existing Open WebUI container<br>docker rm open-webui<br><br># Run a new Open WebUI container<br>docker run -d \<br>  -p 3000:8080 \<br>  --add-host=host.docker.internal:host-gateway \<br>  -v open-webui:/app/backend/data \<br>  --name open-webui \<br>  --restart always \<br>  ghcr.io/open-webui/open-webui:main<br><br><br>echo &quot;Open WebUI Docker container has been updated and started.&quot;<br><br>echo &quot;Pruning old images and containers&quot;<br>docker container prune<br>docker image prune -a</pre><h3>Update KokoroTTS-FastAPI</h3><pre># Pull the latest kokoro Docker image<br>docker pull ghcr.io/remsky/kokoro-fastapi-cpu:latest<br><br># Stop the existing kokoro container if it&#39;s running<br>docker stop kokorotts-fastapi<br><br># Remove the existing kokoro container<br>docker rm kokorotts-fastapi<br><br># Run a new kokoro container<br>docker run -d \<br>  -p 8880:8880 \<br>  --add-host=host.docker.internal:host-gateway \<br>  --name kokorotts-fastapi \<br>  --restart always \<br>  ghcr.io/remsky/kokoro-fastapi-cpu:latest<br><br>echo &quot;Kokoro container has been updated and started.&quot;<br><br>echo &quot;Pruning old images and containers&quot;<br>docker container prune<br>docker image prune -a</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d613721eebd2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mesh VPN with Raspberry Pi 64-bit and Tailscale.]]></title>
            <link>https://dicksondickson.medium.com/mesh-vpn-with-raspberry-pi-64-bit-and-tailscale-e7f577fcb001?source=rss-abb9b1b769d5------2</link>
            <guid isPermaLink="false">https://medium.com/p/e7f577fcb001</guid>
            <category><![CDATA[tailscale]]></category>
            <category><![CDATA[vpn]]></category>
            <category><![CDATA[raspberry-pi]]></category>
            <category><![CDATA[raspberry-pi-4]]></category>
            <category><![CDATA[network]]></category>
            <dc:creator><![CDATA[Dickson Chow]]></dc:creator>
            <pubDate>Mon, 14 Feb 2022 10:56:27 GMT</pubDate>
            <atom:updated>2022-02-14T10:57:27.757Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SM9h-dE3X7-HjGsL7j7GIw.jpeg" /><figcaption>MESH!!!!!</figcaption></figure><p>A few months ago, I needed a way to access my family member’s computers and networks for tech support purposes — the job that you are automatically assigned against your will when you know even a tiny bit of computers.</p><p>In the past, running OpenVPN was the norm. I ran it on my computer, router and even built my own PFSense box at one point. But it was always a hassle to setup and throughput was SLOW.</p><p>One day, a friend introduced me to Tailscale. It changed my life. I was able to get a Wireguard based mesh VPN running in minutes and connect to my family’s computers and networks that spread across three different countries. And best of all, the throughput was fast.</p><p>Of course, nothing is complete without a Raspberry Pi. In this article I’m going to show you some Tailscale speed tests on the Raspberry Pi.</p><h3><strong>What is Tailscale?</strong></h3><p>Tailscale is a zero config VPN based on WireGuard. Tailscale runs on macOS, iOS, Windows, Linux, and Android. Install it and it just works. You can go to Tailscale’s website to learn more about the technical details. <a href="https://tailscale.com/">https://tailscale.com/</a></p><p>In addition to being able to connect to all the computers in your VPN, you can also choose which computer in your VPN will act as an exit node. When a computer acts as an exit node, all the traffic is routed through that computer.</p><p>For example, if you have a Raspberry Pi running Tailscale in San Francisco, one in Vancouver, one in Hong Kong, and you are on your laptop in India and want to watch US Netflix, you can choose to route all the traffic from your laptop through your Pi in San Francisco! No need to pay for a VPN provider.</p><h3><strong>How Fast is Tailscale?</strong></h3><p>In a previous article, I’ve briefly tested Tailscale on the reTerminal running Raspberry Pi OS 32-bit:</p><p><a href="https://dicksondickson.medium.com/seeed-studio-reterminal-review-a-raspberry-pi-cm4-based-terminal-ba6ad82ddfcb"><strong>https://dicksondickson.medium.com/seeed-studio-reterminal-review-a-raspberry-pi-cm4-based-terminal-ba6ad82ddfcb</strong></a></p><p>The performance was usable but far from great. This is due to Tailscale running on ARM and 32-bit OS. (<a href="https://github.com/tailscale/tailscale/issues/414"> https://github.com/tailscale/tailscale/issues/414</a> )</p><p>Since then, Raspberry Pi OS has gone 64-bit and Tailscale saw a few updates. In the following tests, we’ll be using Raspberry Pi OS 64-bit and Tailscale 64-bit comparing it to the 32-bit versions.</p><h3><strong>Test Setup</strong></h3><figure><img alt="SQ1 Case + Heatsink kit designed by Dickson Chow" src="https://cdn-images-1.medium.com/max/667/1*8_iSm_uWE1IniuUCDXIEDQ.jpeg" /></figure><p>This is a Raspberry Pi 4B with 4gb ram in my <strong>SQ1 Case + Heatsink kit of my own design</strong>. Silent, passively cooled, and overclocked to 2.1ghz. You can buy the SQ1 Case + Heatsink kit at my shop: <a href="https://dickson.industries/products/sq1"><strong>https://dickson.industries/products/sq1</strong></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aiz4smPgauF2khxNvFx3Rw.png" /><figcaption>seeedStudio reServer i5 1135</figcaption></figure><p>This is the seeedStudio reServer i5 1135 with a Gen 11 Intel i5 CPU running PopOS acting as an exit node. I’ll have a review of this in a future article.</p><h3><strong>Baseline Throughput Test</strong></h3><p>This is the Raspberry Pi running speedtest-cli with no Tailscale on my 1 gigabit fiber internet connection.</p><pre><strong>Speedtest-cli</strong></pre><pre>Download: 865.70 Mbit/s</pre><pre>Upload: 754.57 Mbit/s</pre><pre>Latency: 3.766 ms</pre><h3><strong>Raspberry Pi OS 32-bit vs 64-bit with Tailscale — reServer as Exit Node.</strong></h3><figure><img alt="Raspi 32-bit vs 64-bit Tailscale" src="https://cdn-images-1.medium.com/max/600/1*NYEkVoKT2wpNBNuQkFh8AQ.png" /><figcaption>WOW!</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*dEuG0KGXN-N2t6-jffvY0w.png" /><figcaption>Latency is the same.</figcaption></figure><p>The latency remains the same but the throughput increased by about 44 percent when compared against Raspberry Pi OS 32-bit. What an improvement going to 64-bit!</p><p>In this following test, we are going to use the Raspberry Pi with 64-bit OS running Tailscale as an exit node. The client will be an iMac 2020 with i7 8-core CPU. We’ll compare this with the reServer i5 also running as a Tailscale exit node.</p><h3><strong>Baseline Throughput Test</strong></h3><p>Speedtest of my <strong>iMac</strong> on my 1 gigabit fiber internet.</p><pre><strong>Speedtest</strong></pre><pre>Download: 930.29 Mbit/s</pre><pre>Upload: 926.00 Mbit/s</pre><pre>Latency: 1 ms</pre><h3><strong>Raspberry Pi OS 64-bit Exit Node vs reServer i5 1135 Exit Node</strong></h3><figure><img alt="Raspi as exit node" src="https://cdn-images-1.medium.com/max/600/1*vPFoXYT8xoBsBdCDVI4nBA.png" /><figcaption>Raspi is awesome!</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*5gBTvCSp9OlwFUH_8ZSDCw.png" /><figcaption>Latency within margin of error.</figcaption></figure><p>Using the Raspberry Pi as a Tailscale exit node is awesome. Low latency and high throughput. Of course, it’s no match for a full blown x86 setup but we are talking about a Raspberry Pi here. Latency is within the margin of error.</p><h3>I’m Sold! How do I set this up???</h3><p>Setting up Tailscale is super easy. Create an account and download the software. If you are running macOS or Windows, download Tailscale from their website: <a href="https://tailscale.com/download">https://tailscale.com/download</a></p><ol><li>To install on the Raspberry Pi, run their one command line install:</li></ol><pre>curl -fsSL <a href="https://tailscale.com/install.sh">https://tailscale.com/install.sh</a> | sh</pre><p>2. Then follow the procedure to authenticate your install.</p><p>3. Enable Magic DNS: <a href="https://tailscale.com/kb/1081/magicdns/">https://tailscale.com/kb/1081/magicdns/</a></p><p>4. To setup the Raspberry Pi as an exit node, you’ll need to enable IP forwarding:</p><pre>echo &#39;net.ipv4.ip_forward = 1&#39; | sudo tee -a /etc/sysctl.conf</pre><pre>echo &#39;net.ipv6.conf.all.forwarding = 1&#39; | sudo tee -a /etc/sysctl.conf</pre><pre>sudo sysctl -p /etc/sysctl.conf</pre><p>5. Configure your Raspberry Pi to advertise as an Exit Node:</p><pre>sudo tailscale up --advertise-exit-node</pre><p>6. Go to your admin console and enable the Pi as an Exit Node. More information here: <a href="https://tailscale.com/kb/1103/exit-nodes/?q=exit%20node">https://tailscale.com/kb/1103/exit-nodes/?q=exit%20node</a></p><h3>DONE!</h3><p>You should be able to use the Raspberry Pi as an Exit Node where all traffic will be routed through the Pi. Now you can put a Tailscale enabled Pi at each of your relative’s place, friend’s place and at your local Starbucks. ;)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e7f577fcb001" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Seeed Studio reTerminal Review: A Raspberry Pi CM4 Based Terminal.]]></title>
            <link>https://dicksondickson.medium.com/seeed-studio-reterminal-review-a-raspberry-pi-cm4-based-terminal-ba6ad82ddfcb?source=rss-abb9b1b769d5------2</link>
            <guid isPermaLink="false">https://medium.com/p/ba6ad82ddfcb</guid>
            <category><![CDATA[compute-module]]></category>
            <category><![CDATA[tailscale]]></category>
            <category><![CDATA[raspberry-pi]]></category>
            <category><![CDATA[cm4]]></category>
            <category><![CDATA[seeed-studio]]></category>
            <dc:creator><![CDATA[Dickson Chow]]></dc:creator>
            <pubDate>Fri, 19 Nov 2021 01:30:34 GMT</pubDate>
            <atom:updated>2021-12-06T20:12:33.719Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IGAHRwy7xj6Ld3896qw-6A.jpeg" /><figcaption>Tech looks good on bamboo.</figcaption></figure><p>I recently bought this interesting Raspberry Pi Compute Module 4 based device made by Seeed Studio on Amazon.</p><p><strong><em>ReTerminal on Amazon: </em></strong><a href="https://amzn.to/3Hkpv99"><strong><em>https://amzn.to/3Hkpv99</em></strong></a></p><h3>What’s the reTerminal?</h3><p>Basically, the reTerminal is a Raspberry Pi CM4 based device in a “tablet” form factor with a 5 inch touch screen, 4 buttons, and a few sensors. It measures 5.5 inches wide, 3.75 inches high and about 0.75 inches thick.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IGAHRwy7xj6Ld3896qw-6A.jpeg" /><figcaption>Nice.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ezxqxo8uEPSEdgQrWoXXyQ.jpeg" /><figcaption>Thicc?</figcaption></figure><h3>Why did you buy this?</h3><p>At $225 USD, you might ask, why would I buy this? Wouldn’t it be cheaper to use a Raspberry Pi 4B?</p><p>I love the Raspberry Pi 4B and have used it in many projects. Over time, I found myself using the 4B mainly as a headless device. When I want to prototype an idea with hardware buttons, I need to find buttons for it. When I want to see some visual feedback, maybe I’ll attach a monitor. Making it portable? That would mean finding a suitable case and dragging everything with it. All of this time and effort adds up — keeping me away from prototyping my original idea in the first place!</p><p>So, when I saw the reTerminal. I was VERY intrigued. Let’s dive into the details on what the reTerminal offers:</p><p><strong>Detailed Specs</strong></p><blockquote>Raspberry Pi CM4 Module 4gb Ram / 32gb eMMC / WiFi + Bluetooth<br>1x Micro HDMI<br>1x CSI ( for the camera module )<br>1x Ethernet port<br>2x USB 2.0 port ( more on this later )<br>1x standard Raspberry Pi pin header<br>1x buzzer</blockquote><p>Pretty standard stuff. But these are the more interesting details:</p><blockquote>5 inch 1280x720 IPS LCD screen with capacitive multitouch support<br>4 hardware buttons<br>Expansion port ( PCIe 1x Gen 2, 1x USB 2.0 port, 26 gpio, PoE )<br>Real-Time Clock — NXP PCF8563T<br>Accelerometer — STMicro LIS3DHTR<br>Encryption Chip — Microchip ATECC608A<br>Light Sensor — Levelek LTR-303ALS-01<br>Internal IO Expansion — Microchip MCP23008-E<br>1x 1/4 Inch tripod mount (on the bottom of the unit)<br>M4 screw holes ( 2x on the left side, 2x on the right side, and 2x on the back)</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QmLEV1o8Be0PLZ3Uy2PwXA.png" /><figcaption>Credit: Seeed Studio</figcaption></figure><p>The unit also has a decent sized heatsink at the top of the unit which helps to keep the CPU cool. I’ll be testing how well this works.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-Dsdgu2fSq2Hc5JJQlyW9A.jpeg" /><figcaption>The back with heatsink.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MlWhzaqAM6MB2ih2L-klzQ.jpeg" /><figcaption>Left side. USB-C Power, micro HDMI, ethernet and 2x USB 2.0 ports.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7kahyjrHPd1geWZtH0AgPg.jpeg" /><figcaption>Right side. Raspberry Pi GPIO pins.</figcaption></figure><h3>Use Cases</h3><p>What really sold it for me was the touch screen, 4x hardware buttons, and the tripod mount with everything packaged into a reasonably small form factor. Case, case mounting and hardware-based user interaction are huge pain points for me on the 4B so the reTerminal seem to meet my needs.</p><p>Now, when I want to prototype some sort of user interaction, the buttons and touchscreen is there. If I want to mount my prototype to something, the mounting holes are there. If I want to make my project portable, I can now mount things — like a camera module — to the reTerminal!</p><p>Seeed Studio designed the reTerminal to be modular where you can attach stuff to it. So that’s what the M4 screw mounts are for. But right now, no attachments have been released. I’m excited to see what they come up with in the future.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*txXY-7mtPhWD43YZvhWy5g.png" /><figcaption>Credit: Seeed Studio</figcaption></figure><p>I can’t wait to 3D print my own attachments such as a camera module and battery pack so I purchased some <a href="https://amzn.to/3qOgu2s"><em>M4 Hex Cap Screws 5mm</em></a><em>. </em>The M4 nut on the unit is pretty shallow (5mm?) so if you decide to buy some M4 screws, I recommend something about 5mm long. I tested with 8mm ones but they seem a little long.</p><p>For now, I’m using it like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Fw-8Jivlgg_wobiylRIFYQ.jpeg" /><figcaption><em>ULANZI Mini Tripod White: </em><a href="https://amzn.to/3ClQbCT"><em>https://amzn.to/3ClQbCT</em></a></figcaption></figure><p>I’m thinking of trying these other mounting options:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s26iqXDcmVf-MYBM1z2Kjg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G9Ktx61b9_oDJCnrxlEHPQ.jpeg" /><figcaption>ULANZI Desk Mount: <a href="https://amzn.to/30CmZup">https://amzn.to/30CmZup</a> | Desk Arm Mount: <a href="https://amzn.to/3cngOMZ">https://amzn.to/3cngOMZ</a></figcaption></figure><h3>The Other Interesting Details</h3><p>The other interesting stuff that Seeed Studio put into the reTerminal are:</p><blockquote>1. Real-Time Clock — NXP PCF8563T<br>2. Accelerometer — STMicro LIS3DHTR<br>3. Encryption Chip — Microchip ATECC608A<br>4. Light Sensor — Levelek LTR-303ALS-01</blockquote><p>These are some nice additions. I can absolutely see someone making an AR project using a camera module in combination with the accelerator. The encryption chip is an interesting bit. Apparently, the chip can be used for authentication for cloud platforms such as AWS IoT, Azure, Google Cloud.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sCVBYI-IcdYZbRn05f_3ew.png" /><figcaption>Credit: Seeed Studio</figcaption></figure><h3>First Impressions</h3><p>The build quality of the unit is pretty good. The plastic shell feels solid and well made and looks like it can survive a drop. The buttons are clicky and feel great. Indicator LEDs are clear and bright.</p><p>Turning on the unit requires plugging in the power to the USB-C port. I chose a beefy 5.25v @ 3.5A power supply: <a href="https://amzn.to/3x0drFu"><strong>Argon ONE PSU for Raspberry Pi</strong></a><strong>.</strong></p><p>The unit comes with Raspberry Pi OS preinstalled on the eMMC. This version has Seeed Studio’s drivers preinstalled so the screens and other onboard peripherals work out of the box.</p><p><strong>NOTE! Do not update the system software on first boot! There is a specific procedure for this:</strong></p><p><a href="https://wiki.seeedstudio.com/reTerminal-FAQ/#q3-how-to-upgrade-raspberry-pi-os-and-the-installed-packages"><strong>https://wiki.seeedstudio.com/reTerminal-FAQ/#q3-how-to-upgrade-raspberry-pi-os-and-the-installed-packages</strong></a></p><p><strong>If you upgrade the system software without following the instructions above, the screen will stop working after reboot.</strong></p><p>Boot up was fairly quick at 20 seconds thanks to the eMMC. The screen is nice and bright with good viewing angles. Touch performance seems accurate but a little hard to use with the default interface. Thankfully, it comes with an onscreen keyboard installed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3fNxhBPylHop6_isBuHjfw.jpeg" /><figcaption>On-screen Keyboard.</figcaption></figure><p>Even though the onscreen keyboard works, it was still awkward to use it with the Raspberry Pi OS Desktop UI. I eventually connected a wireless USB keyboard and mouse to it.</p><p>The reTerminal ships with a demo program to show you what touchscreen UI / UX capabilities are possible.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*auFFOS8U-tRxVhXaYyV4Og.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7hP2dtjHmqHNRm9kyaGLow.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Hi4ZZ3qiL3q3i3oFoYeMnQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2zg3vtgnKsMk1OqoDqYGHQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XNpRFQGVCLPAC_YgjVnNMQ.jpeg" /><figcaption>Demo program preinstalled on the unit.</figcaption></figure><h3>Benchmarks &amp; Overclocking</h3><p>I ran Phoronix Test Suite benchmarks to see how this little guy performs. Thanks to Jeff Geerling for his <a href="https://gist.github.com/geerlingguy/570e13f4f81a40a5395688667b1f79af">script</a>.</p><p>I also overclocked the reTerminal to 2.1ghz and 2.2ghz. The overclocking settings I used are:</p><p><strong>For 2.1ghz:</strong></p><pre>over_voltage=6<br>arm_freq=2100</pre><p><strong>For 2.2ghz:</strong></p><pre>over_voltage=8<br>arm_freq=2200</pre><p><strong>x264 Video Encoding. Higher is better.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uK6OGgIXWcXEyxBcszX7Aw.png" /></figure><p><strong>MP3 Encoding Time. Shorter is better.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hxzxFTTUy-Jy_lLFEqTkqw.png" /></figure><p><strong>PHPBench. Higher is better.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cWI21Gwml6rjt6qR5uySAg.png" /></figure><p>Overclocking to 2.2ghz was stable throughout testing and gave a huge performance boost. The CPU automatically clocks down to 700mhz when idle and would boost to 2.2ghz under load. This is the default behaviour on all Raspberry Pis and CM4 modules.</p><h3>Tailscale Test</h3><p>Tailscale is a zero config VPN based on WireGuard. A friend introduced me to this and I’ve been using it everywhere. I’ll have an in-depth article about Tailscale soon. For now, visit their website: <a href="https://tailscale.com/">https://tailscale.com/</a></p><p>In this test, I’m using a AMD Ryzen 3200G running Pop!_OS as an exit node. The reTerminal is connected to the LAN using the onboard 1gig ethernet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*BeYcLLwNkJG2ZuUvFiO4mg.png" /><figcaption>That performance drop tho…</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*KhmmuEc8cQ342LGxXuhPzw.png" /><figcaption>Omg, almost 2x the latency.</figcaption></figure><pre><strong>Speedtest-cli</strong><br>Download: 789.06 Mbits/s<br>Upload: 819.55 Mbits/s<br>Latency: 2.7ms</pre><pre><strong>Speedtest-cli + Tailscale Exit node</strong><br>Download: 145.31 Mbit/s<br>Upload: 152.82 Mbit/s<br>Latency: 6.5ms</pre><p>The reTerminal is able to achieve some nice speeds on ethernet but when using Tailscale, the performance drops quite a fair amount. This is related to Tailscale running on ARM and 32bit OS and not reTerminal itself. I’ll be investigating this in a future article. For now, you can track the Tailscale issue here: <a href="https://github.com/tailscale/tailscale/issues/414">https://github.com/tailscale/tailscale/issues/414</a></p><p>Nevertheless, even with the performance drop, it is still very usable.</p><h3>Temperature</h3><p>The reTerminal comes with a decent sized heatsink measuring 85mm x 48mm x 8mm.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-Dsdgu2fSq2Hc5JJQlyW9A.jpeg" /><figcaption>Heatsink on the back.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ezxqxo8uEPSEdgQrWoXXyQ.jpeg" /><figcaption>8mm thick heatsink.</figcaption></figure><p>CPU temperature was monitored using:</p><pre>watch -n 1 vcgencmd measure_temp</pre><p>Throttling was monitored with:</p><pre>watch -n 1 vcgencmd get_throttled</pre><p>Load temperature was taken while running Phoronix Test Suite x264 test.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*cLueLpAydkPdWyCBSSOMGA.png" /><figcaption>Charts!</figcaption></figure><p><strong>Default 1.5ghz Temperature</strong></p><blockquote>Temperature at idle: 38.9°C</blockquote><blockquote>Temperature under load: Between 49.6°C to 50.6°C</blockquote><p>At default 1.5ghz baseline ( no overclocking ), the heatsink was warm to the touch. During benchmarking, no throttling was detected.</p><p><strong>Overclocked 2.1ghz Temperature</strong></p><blockquote>Temperature at idle: 41°C</blockquote><blockquote>Temperature under load: Between 56°C to 60.3°C</blockquote><p>When overclocked to 2.1ghz with <em>over_voltage=6</em> and under load, the heatsink got really warm to the touch and was uncomfortable leaving my finger on it for a few seconds. No throttling was detected though.</p><p><strong>Overclocked 2.2ghz Temperature</strong></p><blockquote>Temperature at idle: 45°C</blockquote><blockquote>Temperature under load: Between 57.9°C to 66.2°C</blockquote><p>When overclocked to 2.2ghz with <em>over_voltage=8</em> and under load, the heatsink got really uncomfortable to touch but no throttling was detected.</p><p>It seems Seeed Studio’s passive heatsink design was good enough to withstand a 2.2ghz overclock under load without any throttling! From my tests, the highest temperature recorded was 2.2ghz at 66°C — well below the throttling threshold of about 82°C for the Compute Module 4.</p><p>I would feel very comfortable using the reTerminal in space constrained projects and even with a 2.2ghz overclock if there is a little bit of airflow.</p><h3>Power Consumption</h3><p>For the power consumption test, I measured using a <a href="https://amzn.to/3cnm6by"><strong>USB-C power meter</strong></a>.</p><p>This is plugged into the reTerminal and the power supply plugged into the meter like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BnNtiUkO2ePK6kvG6QT4xQ.jpeg" /><figcaption>This meter is dope.</figcaption></figure><blockquote><strong>Baseline 1.5ghz power consumption</strong><br>Idle: 2.55 watt @ 0.479 A<br>Load: 4.9 watt @ 0.963 A</blockquote><blockquote><strong>Overclock 2.1ghz + over_voltage=6</strong><br>Idle: 3.1 watt @ 0.518 A<br>Load: 7.1 watt @ 1.26 A</blockquote><blockquote><strong>Overclock 2.2ghz + over_voltage=8</strong><br>Idle: 3.134 watt @ 0.583 A<br>Load: 8.12 watt @ 1.2 A</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*_CCbXSPvXKYha4Ek032-1g.png" /><figcaption>More charts!</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*PkQtIb1MakKOLL0-56KBrA.png" /><figcaption>Can’t get enough of these bars!</figcaption></figure><p>Idle power consumption doesn’t change all that much since the CM4 module still clocks down to 700mhz when its doing nothing. The biggest jump in power consumption is when running overclocked under load. If I were running the reTerminal on battery power, I’d keep it at baseline 1.5ghz.</p><h3>Battery Power</h3><p>Eventually, I want to use the reTerminal in portable projects so I tested it with a power bank with no overclock. The one I used the is the <a href="https://amzn.to/3Dnj5nj"><strong>Anker PowerCore 10000 PD Redux</strong></a> which gave enough voltage under load.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d7wdH52Ko2gcSlkPU55YqA.jpeg" /><figcaption>Portable?</figcaption></figure><p>According to my rough estimate, this power bank should be able to power the reTerminal for about 10 hours.</p><p>I tried another power bank but the voltage dipped too low and the reTerminal locked up. Choose your power bank wisely.</p><h3>Overall</h3><p>In my brief testing, I found the reTerminal to be very usable out of the box. It has given me some ideas for new projects and I can’t wait to start prototyping with it. This seems to be a great platform for me to learn making UI using pyside2 / pyqt / python. Seeed Studio have some getting started tutorials on their website: <em>https://wiki.seeedstudio.com/reTerminal/</em></p><p>Hardware wise, I can’t find many fault thus far. The only issue I encountered was some slight ghosting on the LCD screen and some weird screen tearing when scrolling very fast. They released new firmware updates for the LCD driver chip so I’ll see if updating it solves the issue. The light sensor, accelerometer and encryption chip are features I look forward to playing with.</p><p>One thing that did annoy the heck out of me was the back panel is EXTREMELY hard to take off. There are two cantilever snap-fit joints near the expansion port and it required me to pry the back panel loose. They could of added two screws to make it easier considering you’ll have to open up the back panel to access the CSI camera port and boot mode switch for flashing the eMMC.</p><p>It will be interesting to see what expansion modules Seeed comes up with in the future. I am hoping for a, NVME module, battery module, SATA module, maybe a battery grip, LoRa transceiver / gateway module.</p><h3><strong>I like:</strong></h3><p>Nice little package to start prototyping quickly.<br>Options for mounting the unit and mounting things to it.<br>Solid construction.<br>Nice screen.<br>Rubber feets on the back of the unit.</p><h3>I wish:</h3><p>Documentation was written and organized better.<br>The GPIO port was colour coded.<br>More getting started tutorials especially using the light sensor, accelerometer and encryption chip.<br>Back panel was easier to access.<br>The price was lower.<br>It came with a power supply.<br>Slightly better bigger screen — 6 inches maybe?</p><h3>Will I recommend it to my friends?</h3><p>Yes! But not for beginners. Get it: r<a href="https://amzn.to/3Hkpv99">eTerminal on Amazon</a>.</p><h3>Will I recommend it to my enemies?</h3><p>No way! I want to keep all the fun for me and my homies.</p><h3>What are you going to make with it? I want to hear about it!</h3><p><em>This article contains Amazon affiliate links — I get a small commission from Amazon when you buy from these links at no extra cost to you. Think of it as a way of saying thanks!</em></p><h3>Gear I used in this review:</h3><p>r<a href="https://amzn.to/3Hkpv99">eTerminal on Amazon</a></p><p><a href="https://amzn.to/3x0drFu">Argon ONE USB-C PSU for Raspberry Pi</a></p><p><a href="https://amzn.to/3Dnj5nj">Anker PowerCore 10000 PD Redux</a></p><p><a href="https://amzn.to/3cnm6by">USB-C power meter</a></p><p><a href="https://amzn.to/3qOgu2s">M4 Hex Cap Screws</a></p><p><a href="https://amzn.to/3ClQbCT">Ulanzi White Tripod</a></p><p><a href="https://amzn.to/3niRtKk">Fujifilm XT4 Camera</a></p><p><a href="https://amzn.to/326eZC9">Logitech MX Keyboard</a></p><p><a href="https://amzn.to/3nqjKyM">Logitech ERGO M575 Wireless Trackball</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ba6ad82ddfcb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Install OpenCV 4.5.1]]></title>
            <link>https://dicksondickson.medium.com/install-opencv-4-5-1-d16715df6aad?source=rss-abb9b1b769d5------2</link>
            <guid isPermaLink="false">https://medium.com/p/d16715df6aad</guid>
            <category><![CDATA[python3]]></category>
            <category><![CDATA[install]]></category>
            <category><![CDATA[cuda]]></category>
            <category><![CDATA[opencv-python]]></category>
            <category><![CDATA[opencv]]></category>
            <dc:creator><![CDATA[Dickson Chow]]></dc:creator>
            <pubDate>Sun, 10 Jan 2021 15:11:51 GMT</pubDate>
            <atom:updated>2021-01-12T03:40:31.354Z</atom:updated>
            <content:encoded><![CDATA[<h3>Install OpenCV 4.5.1 with CUDA and cuDNN acceleration, with GStreamer and Python 3 bindings on PopOS 20.10</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J37iskZB2QCQOKp0aEaesA.png" /><figcaption>ULTIMATE THREESOME</figcaption></figure><p>OpenCV is awesome. OpenCV + CUDA = More awesome. OpenCV + CUDA + cuDNN (deep neural networks) = MIND BLOWN.</p><p>What is cuDNN?</p><blockquote>The NVIDIA CUDA® Deep Neural Network library (cuDNN) is a GPU-accelerated library of primitives for deep neural networks. cuDNN provides highly tuned implementations for standard routines such as forward and backward convolution, pooling, normalization, and activation layers.</blockquote><p>Compiling from source is always a pain. I’m here to make your life easier. Today I’m going to show you how to build and install OpenCV 4.5.1 with CUDA and cuDNN acceleration, with GStreamer and Python 3 bindings on PopOS 20.10. Since PopOS is based on Ubuntu, the instructions will work on that as well.</p><p><strong>LET’S DO THIS.</strong></p><h3><strong>Prerequisites</strong></h3><p>My workstation specs are:</p><p>AMD Ryzen 3950X.</p><p>NVIDIA RTX 2080TI.</p><p>Fresh install of PopOS 20.10 with NVIDIA drivers.</p><h3>Check your GPUs CUDA version support</h3><p>Go to NVIDIA’s website to check your which version of CUDA it supports:</p><p><a href="https://developer.nvidia.com/cuda-gpus">https://developer.nvidia.com/cuda-gpus</a></p><p>Make a note of the version number as we’ll need this information when we compile OpenCV. For my RTX 2080TI, the CUDA version is 7.5.</p><h3>Update PopOS</h3><pre>sudo apt update</pre><pre>sudo apt dist-upgrade -y --autoremove</pre><h3>Install CUDA and cuDNN libraries</h3><p>Installing cuDNN will also install matching CUDA version.</p><pre>sudo apt install system76-cudnn-11.1</pre><p>If for some reason CUDA was not installed, you can install it with:</p><pre>sudo apt install system76-cuda-11.1</pre><h3>Download cuDNN source files from NVIDIA.</h3><p>These source files are needed to compile OpenCV.</p><p><a href="https://developer.nvidia.com/rdp/cudnn-download">https://developer.nvidia.com/rdp/cudnn-download</a></p><p>The file you want is: <strong>cudnn-11.1-linux-x64-v8.0.5.39.tgz</strong></p><p>Put the file in your home directory and we’ll move these into the right place:</p><pre>cd ~</pre><pre>mv cudnn-11.1-linux-x64-v8.0.5.39.tgz cudnn.tgz</pre><pre>tar -xvf cudnn.tgz</pre><p>Make the appropriate directories:</p><pre>sudo mkdir -p /usr/local/cuda/lib64/</pre><pre>sudo mkdir -p /usr/local/cuda/include</pre><p>Copy the extracted files to the folders we created:</p><pre>cd ~/cuda/lib64</pre><pre>sudo cp * /usr/local/cuda/lib64/<br></pre><pre>cd ~/cuda/include</pre><pre>sudo cp * /usr/local/cuda/include</pre><h3>Create Python virtual environment</h3><p>Install virtual environment tools:</p><pre>sudo pip install virtualenv virtualenvwrapper</pre><pre>sudo rm -rf ~/.cache/pip</pre><p>Add the appropriate entries to bashrc:</p><pre>echo -e &quot;\n# virtualenv and virtualenvwrapper&quot; &gt;&gt; ~/.bashrc</pre><pre>echo &quot;export WORKON_HOME=$HOME/.virtualenvs&quot; &gt;&gt; ~/.bashrc</pre><pre>echo &quot;export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3&quot; &gt;&gt; ~/.bashrc</pre><pre>echo &quot;source /usr/local/bin/virtualenvwrapper.sh&quot; &gt;&gt; ~/.bashrc</pre><pre>source ~/.bashrc</pre><p>Create a virtual environment called CV:</p><pre>mkvirtualenv cv -p python3</pre><pre>workon cv</pre><p>Install numpy in our virtual environment as it will be need to compile OpenCV:</p><pre>pip install numpy</pre><h3>Install dependencies</h3><pre>sudo apt install -y \<br>build-essential \<br>cmake \<br>git \<br>gcc \<br>g++ \<br>yasm \<br>checkinstall \<br>gfortran \<br>libatlas-base-dev \<br>libavcodec-dev \<br>libavformat-dev \<br>libavresample-dev \<br>libcanberra-gtk3-module \<br>libdc1394-22-dev \<br>libeigen3-dev \<br>libglew-dev \<br>libgstreamer-plugins-base1.0-dev \<br>libgstreamer-plugins-good1.0-dev \<br>libgstreamer1.0-dev \<br>libgtk-3-dev \<br>libjpeg-dev \<br>libjpeg8-dev \<br>libjpeg-turbo8-dev \<br>liblapack-dev \<br>liblapacke-dev \<br>libopenblas-dev \<br>libpng-dev \<br>libpostproc-dev \<br>libswscale-dev \<br>libtbb-dev \<br>libtbb2 \<br>libtesseract-dev \<br>libtiff-dev \<br>libv4l-dev \<br>libxine2-dev \<br>libxvidcore-dev \<br>libx264-dev \<br>pkg-config \<br>python3-dev \<br>python3-pip \<br>python3-numpy \<br>python3-matplotlib \<br>python3-testresources \<br>qv4l2 \<br>unzip \<br>v4l-utils \<br>zlib1g-dev \<br>libfaac-dev \<br>libmp3lame-dev \<br>libtheora-dev \<br>libfaac-dev \<br>libvorbis-dev \<br>libopencore-amrnb-dev \<br>libopencore-amrwb-dev \<br>libopenexr-dev \<br>libprotobuf-dev \<br>protobuf-compiler \<br>libgoogle-glog-dev \<br>libgflags-dev \<br>libgphoto2-dev \<br>libhdf5-dev \<br>doxygen \<br>libwebp-dev</pre><h3>Prepare OpenCV source files</h3><p>Make our working folder in home:</p><pre>cd ~</pre><pre>mkdir build_opencv</pre><pre>cd build_opencv</pre><p>Clone OpenCV into our working directory:</p><pre>git clone — depth 1 — branch “4.5.1” <a href="https://github.com/opencv/opencv.git">https://github.com/opencv/opencv.git</a></pre><p>Clone OpenCV libraries:</p><pre>git clone --depth 1 --branch &quot;4.5.1&quot; https://github.com/opencv/opencv_contrib.git</pre><p>Make build folder inside the OpenCV folder:</p><pre>cd opencv</pre><pre>mkdir build</pre><pre>cd build</pre><h3>Configure and build OpenCV</h3><p>Make sure you have the right GPU version number from earlier and change this line to match your GPU CUDA version:</p><pre>-D CUDA_ARCH_BIN=7.5 \</pre><p>Configure the build:</p><pre>cmake -D CMAKE_BUILD_TYPE=RELEASE \<br>-D INSTALL_PYTHON_EXAMPLES=ON \<br>-D INSTALL_C_EXAMPLES=OFF \<br>-D ENABLE_CXX11=ON \<br>-D CMAKE_C_COMPILER=/usr/bin/gcc-9 \<br>-D CMAKE_INSTALL_PREFIX=/usr/local \<br>-D BUILD_opencv_python2=OFF \<br>-D BUILD_opencv_python3=ON \<br>-D BUILD_opencv_cudacodec=OFF \<br>-D CUDA_ARCH_BIN=7.5 \<br>-D CUDA_ARCH_PTX= \<br>-D CUDNN_VERSION=&#39;8.0.5&#39; \<br>-D CUDNN_LIBRARY=/usr/local/cuda/lib64/libcudnn.so.8.0.5 \<br>-D CUDNN_INCLUDE_DIR=/usr/local/cuda/include \<br>-D CUDA_FAST_MATH=1 \<br>-D ENABLE_FAST_MATH=1 \<br>-D OPENCV_DNN_CUDA=ON \<br>-D OPENCV_ENABLE_NONFREE=ON \<br>-D OPENCV_EXTRA_MODULES_PATH=~/build_opencv/opencv_contrib/modules \<br>-D OPENCV_GENERATE_PKGCONFIG=ON \<br>-D OPENCV_PC_FILE_NAME=opencv.pc \<br>-D PYTHON_EXECUTABLE=~/.virtualenvs/cv/bin/python \<br>-D WITH_QT=OFF \<br>-D WITH_TBB=ON \<br>-D WITH_CUBLAS=1 \<br>-D WITH_CUDA=ON \<br>-D WITH_CUDNN=ON \<br>-D WITH_GSTREAMER=ON \<br>-D WITH_LIBV4L=ON \<br>-D WITH_OPENGL=ON \<br>-D BUILD_EXAMPLES=ON .. \<br>-D BUILD_PERF_TESTS=OFF \<br>-D BUILD_TESTS=OFF \</pre><p>If the configuration completed without errors, we can build it. Change the number to the number of cpu threads to use. I have a 16 core, 32 thread CPU so I use 30 threads to leave some cpu headroom for me to watch YouTube videos while its building:</p><pre>make -j30</pre><p>Let’s install!</p><pre>sudo make install</pre><pre>sudo ldconfig</pre><h3>Final setup</h3><p>Let’s check to see if the OpenCV Python module is installed in the right path:</p><pre>ls /usr/local/lib/python3.8/site-packages/cv2/python-3.8/</pre><pre># cv2.cpython-38-x86_64-linux-gnu.so cv2.so</pre><p>We’ll rename the module and link it into our virtual environment:</p><pre>cd /usr/local/lib/python3.8/site-packages/cv2/python-3.8/</pre><pre>sudo mv cv2.cpython-38-x86_64-linux-gnu.so cv2.so</pre><p>Lets create a symbolic link to our virtual environment:</p><pre>cd ~/.virtualenvs/cv/lib/python3.8/site-packages/</pre><pre>ln -s /usr/local/lib/python3.8/site-packages/cv2/python-3.8/cv2.so cv2.so</pre><h3>Sanity check</h3><pre>pkg-config — modversion opencv</pre><pre># 4.5.1</pre><p>Check with python:</p><pre>python3 -c &quot;import cv2; print(cv2.__version__)&quot;</pre><pre># 4.5.1</pre><h3>You are done. Now go make stuff!</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d16715df6aad" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>