<?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 Peng Dai on Medium]]></title>
        <description><![CDATA[Stories by Peng Dai on Medium]]></description>
        <link>https://medium.com/@dperception?source=rss-b181a18f817a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*HKuK8SDgGVTaj-WOqjdYbA.png</url>
            <title>Stories by Peng Dai on Medium</title>
            <link>https://medium.com/@dperception?source=rss-b181a18f817a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 06 Apr 2026 19:18:02 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@dperception/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[AI literature, created by GPT-4]]></title>
            <link>https://medium.com/@dperception/ai-literature-created-by-gpt-4-6c5d92a9a9f7?source=rss-b181a18f817a------2</link>
            <guid isPermaLink="false">https://medium.com/p/6c5d92a9a9f7</guid>
            <dc:creator><![CDATA[Peng Dai]]></dc:creator>
            <pubDate>Sun, 19 Mar 2023 01:21:15 GMT</pubDate>
            <atom:updated>2023-03-19T01:21:15.721Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/889/1*MzVvg6r6Qzv0DmzcWoT2Sw.png" /><figcaption>Prompt used to generate the storyline</figcaption></figure><h3><strong><em>Title: “The Legend of Declan”</em></strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zhOpGSC0dbxmzp4IdqCL_g.png" /></figure><p><strong>I. Introduction A</strong>.</p><p>Introduce the mystical world of Shinoria, where people with unique abilities, known as Shinorians, live and train to hone their powers. B. Introduce the main character, Declan, an orphan with a mysterious past and a strong desire to become the greatest Shinorian warrior. C. Establish Declan’s rival, Tristan, a talented and arrogant young warrior from a prestigious family.</p><p><strong>II. Act 1 — The Journey Begins A.</strong></p><p>Declan enrolls in the Shinorian Academy, where students learn to harness and control their powers. B. Alongside his teammates, the strategic and intelligent Cassidy and the brute force, but kindhearted, Mason, Declan begins his training. C. Declan struggles to master his unique and untamed power, which sometimes causes havoc and puts him in dangerous situations.</p><p><strong>III. Act 2 — The Hidden Truth A.</strong></p><p>During a mission, Declan and his team stumble upon a secret organization that plans to exploit the Shinorians’ powers for evil purposes. B. The team learns about a prophecy, foretelling the rise of a great warrior who will save Shinoria from impending darkness — Declan. C. The secret organization, led by a mysterious figure, seeks to capture Declan and use his powers for their own sinister goals.</p><p><strong>IV. Act 3 — The Test of Friendship A.</strong></p><p>Tristan, blinded by jealousy and seduced by the promise of power, joins the secret organization and becomes one of Declan’s greatest adversaries. B. Declan and his team must face various challenges, including battling former friends, as they seek to uncover the truth and stop the organization’s plans. C. Declan’s powers grow stronger, and he learns to control them, revealing his true potential as the prophesized warrior.</p><p><strong>V. Act 4 — The Final Battle A.</strong></p><p>Declan’s team infiltrates the secret organization’s headquarters and confronts the mysterious leader, who turns out to be a long-lost relative of Declan. B. A fierce battle ensues between Declan and the leader, pushing Declan to his limits and forcing him to embrace the full extent of his powers. C. Declan ultimately defeats the leader and destroys the organization, saving Shinoria from the dark forces that threatened its existence.</p><p><strong>VI. Conclusion A.</strong></p><p>Declan and his team return as heroes, and Declan is recognized as the greatest Shinorian warrior. B. Tristan, who has seen the error of his ways, apologizes to Declan, and they reconcile, forging a newfound respect for each other. C. Declan continues his journey, dedicated to protecting Shinoria and helping others to unlock their true potential.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6c5d92a9a9f7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[[Basics] Installing CentOS 7 for deep learning]]></title>
            <link>https://medium.com/@dperception/basics-installing-centos-7-for-deep-learning-323a6b55c575?source=rss-b181a18f817a------2</link>
            <guid isPermaLink="false">https://medium.com/p/323a6b55c575</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[nvidia-docker]]></category>
            <category><![CDATA[dependencies]]></category>
            <category><![CDATA[centos]]></category>
            <dc:creator><![CDATA[Peng Dai]]></dc:creator>
            <pubDate>Mon, 27 Jan 2020 01:00:39 GMT</pubDate>
            <atom:updated>2020-01-27T01:00:39.860Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*MYcLtt7f0yzBYOAV_Wj63g.png" /></figure><p>With the fast development of deep learning, the primary jobs of many servers have become running deep learning (or CUDA) programs. Those code may require different versions of CUDA or even different versions of gcc.</p><p>Although the Python level version mismatch can be solved by <strong>virtual environments</strong> (e.g. Anaconda), the system level version conflicts (e.g. gcc5 Vs gcc4, CUDA8 Vs CUDA10.1) is very tricky to resolve. It’s very difficult to solve those dependencies with a single OS. Therefore, docker is one of the easiest tools to solve the dependency problem.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/555/1*djzgAX3ef1C44O3gMeTVgA.png" /><figcaption>System structure, host-container</figcaption></figure><p>The server works as the host machine, which only handles the communication with GPUs. Docker is used to support different dependencies, e.g. gcc, CUDA version, etc.</p><p>This post introduces the first step, i.e. installing CentOS.</p><p>Set your boot device to USB or DVD, whichever holds the CentOS boot drive. The computer will boot and show similar log information like below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jBc4x5qZ3Msh6zWaApJj_g.png" /></figure><p>Choose language, English or any other listed</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6lHJRyO8JaSUtQNfgLW1zw.png" /><figcaption>Choose language</figcaption></figure><p>If your hard drive is supported by the CentOS image, all drives should be listed here. In my case, all my drives are listed here. I have 5T drives (2 Physical drives). One drive is chosen as the system drive and the other is reserved for data.</p><p>I choose to manually set the partition, since I want to keep the system files separated from my home folder (e.g. /home). Thus, reinstalling OS will remove all my data. Of course, backing up important files at the other physical drive also do the trick.</p><p>Keep clicking next, util you reach a similar screen, where we can choose ‘INSTALLATION DESTINATION’</p><p>Here, we choose ‘I will configure partitioning’</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ai7H09L6GGXwXaAj8eb6ug.png" /><figcaption>Choose ‘INSTALLATION DESTINATION’</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1022/1*zLFm7znHDxhcKtJWdyUtRw.jpeg" /><figcaption>Setup hard drive partitioning</figcaption></figure><p>For partition, I prefer to give relative small space for /, since I don’t install many packages to my host machine. All my dependencies are handled by docker</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6ZiNJbd6ueOkhEq0XDYwgw.png" /><figcaption>Hard drive partitioning</figcaption></figure><p>Here, we give about 60G for the root path, i.e. /. The home path, i.e. /home, is given about 1.7T. The settings for other parts, i.e. /boot/efi, swap, are routine. Please note if you have very large RAM, I would set the OS ‘swappiness’ to a very small value. Swap partition is on the hard drive. So it’s slower than RAM.</p><p>After we’re done with hard drive settings, we can start the installation. While the computer is busy running the installation, we can create the root password and create a user.</p><p>We can also create additional user after the installation by</p><pre>sudo useradd -d &lt;customize the home folder location&gt; -m -s /bin/bash &lt;username&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z_geb1uWahCIE7ONCxmNPg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q60-WOVgUks-kEsB6vT9hg.png" /><figcaption>Create root password and create new user</figcaption></figure><p>After sometime we’ll be able to see the following screen</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1020/1*CIgAKGmmzoqxMhXIVPFviQ.png" /></figure><p>Now we have a fresh new CentOS installed. The next step would be to install the basic dependencies for deep learning. I setup the system following the following idea. Only the basic drivers for coordinating with the hardware are installed at the host machine. All other detailed dependencies are handled by docker.</p><h3>Summary</h3><p>In this tutorial you learned how to install CentOS. It is the first step to setup your server for deep learning. I have another post describing the details about setting up the system based on the host-container structure at the following link.</p><p><a href="https://medium.com/@dperception/setup-centos-for-deep-learning-ee2b8608e41f">https://medium.com/@dperception/setup-centos-for-deep-learning-ee2b8608e41f</a></p><p>I also put the basic commands for setting up CentOS for deep learning at my gist at <a href="https://gist.github.com/pdaicode/c82f28da9f39a6f8c1f552b2ffd6af8b">https://gist.github.com/pdaicode/c82f28da9f39a6f8c1f552b2ffd6af8b</a></p><p>I’ll prepare another blog about detailed steps for building a docker image for some popular github repositories.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/524/1*QKhI_PRg3-4lq6uIDdV8jA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=323a6b55c575" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Setup CentOS for Deep Learning]]></title>
            <link>https://medium.com/@dperception/setup-centos-for-deep-learning-ee2b8608e41f?source=rss-b181a18f817a------2</link>
            <guid isPermaLink="false">https://medium.com/p/ee2b8608e41f</guid>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[fundamentals]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[proxy]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Peng Dai]]></dc:creator>
            <pubDate>Mon, 13 Jan 2020 04:24:02 GMT</pubDate>
            <atom:updated>2020-01-13T04:24:02.646Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*spuWXBCvBLeYLTpRWNgbUw.jpeg" /></figure><p>Setting up your Linux machine for Deep Learning is the first step towards a successful model. Although the process is very straight forward, there are some issues that may take some time to fix. This blog gives a quick note for system setup.</p><p>The general idea is to setup the machine as host (only install cuda) and use (nvidia-)docker to support all other dependencies.</p><ol><li><strong>Install the OS</strong></li></ol><p>Please refer to <a href="https://www.centos.org/">CentOS websit</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/581/1*pd1GMtghJoTE7kIzCDA0cA.png" /><figcaption>Please refer to <a href="https://www.centos.org/">https://www.centos.org/</a></figcaption></figure><p>2. <strong>Internet setting (you can skip this section if there is no proxy)</strong></p><ul><li><strong><em>Proxy</em></strong>: Companies usually have additional security settings (firewall) for the internet. Therefore, employees need to use particular proxy settings to access external internet. Usually, there will be certificate verification issue when working behind firewall. You can easier fix the certificate with the help of internet manager (IT team) or disable the certificate check (unsecure)<br>Initially, the proxy can be set as</li></ul><pre>export http_proxy=//http:&lt;&gt;:&lt;&gt;@&lt;proxy server&gt;:&lt;port&gt;<br>export https_proxy=//https:&lt;&gt;:&lt;&gt;@&lt;proxy server&gt;:&lt;port&gt;</pre><ul><li>CNTLM: We don’t want to expressly put the username/password combination as an environment variable. I use <a href="https://sourceforge.net/projects/cntlm/">CNTLM</a>.</li></ul><p>3. <strong>CUDA</strong></p><p>Before start, we need to update OS and install some basic dependencies. As sudo user, run the following command</p><pre>yum update<br>yum groupinstall “Development Tools”<br>yum install kernel-devel epel-release<br>yum install dkms</pre><p>Download cuda rpm file from nvidia. Basically, google search “cuda &lt;version&gt; download” and you will get the url. A sample selection is given below (cuda10.0)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q6dIDEjLDDlFuuUEPmZgkQ.png" /></figure><p>Sometimes the new driver raises some errors in boot sequence. If you don’t have a complete UI or control OS, it’s better to run the following command before reboot</p><pre>systemctl isolate multi-user.target</pre><p>4. <strong>Docker</strong></p><p>Following the official instructions at the docker <a href="https://docs.docker.com/install/linux/docker-ce/centos/">website</a>.</p><pre>sudo yum remove docker \<br>                  docker-client \<br>                  docker-client-latest \<br>                  docker-common \<br>                  docker-latest \<br>                  docker-latest-logrotate \<br>                  docker-logrotate \<br>                  docker-engine</pre><pre>sudo yum install -y yum-utils \<br>  device-mapper-persistent-data \<br>  lvm2</pre><pre>sudo yum-config-manager \<br>    --add-repo \<br>    <a href="https://download.docker.com/linux/centos/docker-ce.repo">https://download.docker.com/linux/centos/docker-ce.repo</a></pre><pre>sudo yum install docker-ce docker-ce-cli containerd.io</pre><ul><li>Setup proxy for docker</li></ul><p>Create a drop-in</p><pre>mkdir /etc/systemd/system/docker.service.d</pre><p>Create a file with name</p><p>/etc/systemd/system/docker.service.d/http-proxy.conf</p><p>that adds the HTTP_PROXY environment variable:</p><pre>[Service]<br>Environment=&quot;HTTP_PROXY=<a href="http://user01:password@10.10.10.10:8080/">http://user:password@10.10.10.10:8080/</a>&quot;<br>Environment=&quot;HTTPS_PROXY=<a href="https://user01:password@10.10.10.10:8080/">https://user:password@10.10.10.10:8080/</a>&quot;<br>Environment=&quot;NO_PROXY= hostname.example.com,172.10.10.10&quot;</pre><p>Reload the systemd daemon</p><pre>systemctl daemon-reload</pre><p>Restart docker</p><pre>systemctl restart docker</pre><p>Test the installation</p><pre>docker pull hello-world</pre><p>5. <a href="https://github.com/NVIDIA/nvidia-docker"><strong>nvidia-docker</strong></a></p><p>The official command from nvidia-docker is</p><pre>$ distribution=$(. /etc/os-release;echo $ID$VERSION_ID)<br>$ curl -s -L <a href="https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.repo">https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.repo</a> | sudo tee /etc/yum.repos.d/nvidia-docker.repo</pre><pre>$ sudo yum install -y nvidia-container-toolkit<br>$ sudo systemctl restart docker</pre><p>With proxy</p><pre>$ distribution=$(. /etc/os-release;echo $ID$VERSION_ID)<br>$ curl -skL <a href="https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.repo">https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.repo</a> | sudo tee /etc/yum.repos.d/nvidia-docker.repo</pre><pre>$ sudo yum install -y nvidia-container-toolkit<br>$ sudo systemctl restart docker</pre><p>Nvidia-docker will share the same proxy setting as docker. Test the installation with</p><pre>docker run --gpus all nvidia/cuda:9.0-base nvidia-smi</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ee2b8608e41f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Psychoacoutic Models — part 1]]></title>
            <link>https://medium.com/@dperception/psychoacoutic-models-part-1-774bdf5dbf61?source=rss-b181a18f817a------2</link>
            <guid isPermaLink="false">https://medium.com/p/774bdf5dbf61</guid>
            <category><![CDATA[matlab]]></category>
            <category><![CDATA[psychoacoustics]]></category>
            <category><![CDATA[signal-processing]]></category>
            <dc:creator><![CDATA[Peng Dai]]></dc:creator>
            <pubDate>Tue, 06 Aug 2019 01:51:41 GMT</pubDate>
            <atom:updated>2019-08-06T01:51:41.986Z</atom:updated>
            <content:encoded><![CDATA[<h3>Psychoacoutic Models — part 1</h3><p><a href="https://en.wikipedia.org/wiki/Psychoacoustics"><strong>Psychoacoustics</strong></a> is the science which studies how human perceives sound.</p><p>One of the most common phenomena in psychoacoustics is masking effect. It is a kind of phenomenon in which a clearly audible sound can be masked by another sound. Masking effects may be classified as simultaneous or temporal according to the occurrence of the signals.</p><p>Let me give a simple example:</p><blockquote>Assuming you’re making an important phone call. However, your roommate is singing very loudly. You probably want to make the call in a different place, since it’s basically impossible to hear anything from the phone. It is because the loud sound (the loud song) “mask” the weak sound (speech from the phone).</blockquote><p>Masking effect between any two signals that occur at the same time is called simultaneous masking. Signals can also be masked by the preceding sound, called forward masking, or by the sound after it, called backward masking. Forward masking and backward masking are known as temporal masking.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/462/1*ZT-GRZus_0F49EOa9sXH3A.png" /><figcaption>Masking effect in time frequency domain <a href="https://repository.ntu.edu.sg/handle/10356/64833">[2]</a></figcaption></figure><h4>1. How to implement the model?</h4><p>In classical signal processing, one of the most common way to preprocess the signal is Short Time Fourier Transform (STFT)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/674/1*5DJlNpOlXi2U3tvIgaao4g.png" /><figcaption>Short time Fourier transform</figcaption></figure><p>Fourier transform inherently assumes that the signal source remains stationary. By cutting the signal into multiple short pieces, the assumption becomes much easier to maintain. It makes more sense to assume the signal source stays stationary for a short period rather than the entire time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/792/1*5znxpy81dzATskK5S5S26Q.png" /><figcaption>System Diagram: 1st row corresponds to classical MFCC; 2nd row includes the additional steps required for the psychoacoustic models</figcaption></figure><h4>2. The Coding Part</h4><p>My original experiments are developed using Matlab. Special thanks to <a href="http://www.ee.ic.ac.uk/hp/staff/dmb/voicebox/voicebox.html">Voicebox</a>, which contains a wide range of tools for speech processing.</p><p>The part of the code I used are (<a href="http://www.ee.ic.ac.uk/hp/staff/dmb/voicebox/mdoc/v_mfiles/v_melcepst.html">v_melcepst.m</a>)</p><pre>[z,tc]=enframe(s,0.54-0.46*cos(2*pi*(0:n-1)&#39;/(n-1)),inc); % Hamming window<br>f=rfft(z.&#39;);<br>% This is where you put the 2D psychoacoustic model<br>f = conv2(f, psy_f, &#39;same&#39;)<br>% for detailed parameters for psy_f please refer to the paper<br>[m,a,b]=v_melbankm(p,n,fs,fl,fh,w);<br>pw=f(a:b,:).*conj(f(a:b,:));<br>pth=max(pw(:))*1E-20;<br>y=log(max(m*pw,pth));<br>c=rdct(y).&#39;;<br>nf=size(c,1);<br>nc=nc+1;</pre><p>For implementation in Python, we can use librosa</p><p>The easiest way is to add an 2d convolution before the spetrogram is passed to the mel filter banks at <a href="https://github.com/librosa/librosa/blob/master/librosa/feature/spectral.py#L1787">code</a> (also given below). In other words, the 2D psychoacoustic filter goes between spectrogram and mel filter banks.</p><pre>S, n_fft = _spectrogram(y=y, S=S, n_fft=n_fft,hop_length=hop_length, power=power, win_length=win_length, window=window, center=center, pad_mode=pad_mode)</pre><blockquote>In next session, I’ll setup a Jupyter Notebook with the necessary code.</blockquote><p><strong>Reference:</strong></p><p>[1] P. Dai and I. Y. Soon, <a href="https://www.sciencedirect.com/science/article/abs/pii/S0167639311001427">A Temporal Frequency Warped (TFW) 2D Psychoacoustic Filter for Robust Speech Recognition System</a>, Speech Communication, vol. 54, pp. 402–413, 2012.</p><p>[2] P. Dai, <a href="https://repository.ntu.edu.sg/handle/10356/64833">Front-end noise reduction algorithms for automatic speech recognition</a>, PhD thesis, Nanyang Technological University, 2013.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=774bdf5dbf61" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>