<?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 Stanley Chin on Medium]]></title>
        <description><![CDATA[Stories by Stanley Chin on Medium]]></description>
        <link>https://medium.com/@chinstan?source=rss-1360525089f3------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*7kcJat135AYGsnZAo-tysg.jpeg</url>
            <title>Stories by Stanley Chin on Medium</title>
            <link>https://medium.com/@chinstan?source=rss-1360525089f3------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 17:33:25 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@chinstan/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[What can machine learning do for you?]]></title>
            <link>https://medium.com/building-crowdriff/what-can-machine-learning-do-for-you-7eabf2562c4?source=rss-1360525089f3------2</link>
            <guid isPermaLink="false">https://medium.com/p/7eabf2562c4</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[image-classification]]></category>
            <category><![CDATA[tensorflow]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Stanley Chin]]></dc:creator>
            <pubDate>Tue, 31 Oct 2017 16:08:03 GMT</pubDate>
            <atom:updated>2017-10-31T16:08:03.033Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A8y_g03PhiUu5lqUY4kRNg.jpeg" /><figcaption>Image by Maddie Baker: <a href="https://unsplash.com/@maddybakes">https://unsplash.com/@maddybakes</a></figcaption></figure><p>Machine learning is hard to learn, but it’s getting easier and easier to use it to solve problems.</p><p>Several years ago, when I first started my CS major, machine learning was the freshest, Koolest thing to do, and working at Google was the dream workplace to be at. Several years later, machine learning is <strong>still</strong> pretty darn cool.</p><p>Imagine you go to the grocery store and compare two similar food items to see which one is healthier. You’re looking at the calories, which one has less carbs or fat, yet maximizing on fiber and protein. 300 calories are in 30g of product A, compared to 100 calories in 55g of product B, carry the 1… how much carbs are in A again? After properly trained, a machine learning model can give you an answer immediately! These types of solutions are what originally intrigued me first to really love machine learning.</p><blockquote>It’s cool because we can theoretically train a program to learn about anything and it will <em>predict</em> the results of a problem! Dare I say, witchcraft!?</blockquote><p>In my attempt, I tried many ways to pick up machine learning, going through the gold standard of Andrew Ng’s Coursera course, taking courses in data science and artificial intelligence, attempting Kaggle problems, and following blog posts to do personal projects. All of these things fell short because a) short attention span and b) there was <strong>a lot</strong> to learn before actually making something that will do machine learning.</p><p>Recently, at CrowdRiff, we had the opportunity to explore our interests through our quarterly hack days and I had vested interest to tackle a problem and solve it with machine learning.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LF0CQ6iMA32ZjeZWjEfKSg.jpeg" /><figcaption>Image by Patrick Fore: <a href="https://unsplash.com/@patrickian4">https://unsplash.com/@patrickian4</a></figcaption></figure><p>You can follow the process of what we did near the bottom of the blog post. I have provided a rundown of each individual step taken to setup, train, and test a model.</p><h3>Three things I know to be true</h3><ol><li>Google created an amazing convolutional neural net called <a href="https://www.tensorflow.org/tutorials/image_recognition"><em>Inception</em></a><em> (v3) </em>that allows us to make a copy of it and retrain its last layer so that we have a machine learning model that will classify our own images.</li><li>As a company that provides a pool of images for our clients to curate, an incredibly useful exercise would have been to see if our model can predict whether or not a certain image will be curated by a client.</li><li>Getting data is difficult,<strong> </strong>getting <strong>good data</strong> is VERY difficult.</li></ol><p>What we did was use the Tensorflow library to retrain parts of the Inception model by using our own labeled data and then classify a new, unseen image and see what the model predicts.</p><p>After retraining the model, one small exercise we tried was to personally curate certain images and verify the responses from the model. This in a way, was validation to see how well our model performed.</p><p>The figure below illustrates our own example of curating images from Niagara Falls. The results were enlightening and the model did much better than anticipated. Images that looked like ads were filtered out, things irrelevant to the Falls were also filtered out. This machine learning model helped figure out what a bad image is and presented us with options of what a good image could be.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5YjNyQv9Ssqf7TtH6UcwVA.png" /><figcaption>Output scores above 70% was labeled as ‘curatable’.</figcaption></figure><h3>Three more things I know to be true</h3><ol><li>From a scale of one to over trusting my data, I am pretty naïve. To truly understand what our model is learning, and thus predicting, we had to see the result of its output first. Then, go back and retrain.</li><li>This time around, doing a project with machine learning was much more fun and approachable because we clearly defined our problem statement, we knew what tools to use, and we cared and were driven by its results.</li><li>Machine learning is scary, especially if you are learning for fun! It took me awhile to do it but persevere, it can pay off. What I found to be very motivating is to work on a problem that you care about and not the generic “Hello World!” of machine learning which is predicting the type of iris flower example (yes I included a flower example in my tutorial).</li></ol><h3>What I learned</h3><p>Good data is defined by what the problem statement is. <strong>Predicting what the client will curate</strong> has a LOT of meaning in reference to data. Questions like, &quot;Has the client seen this picture before?&quot;, or &quot;Is a previously curated picture still relevant after <em>x</em> amount of days?&quot; are important to think about when building a model. However, we are not phased by this result, these are the type of things we expect we will learn over time.</p><p>Sometimes, it’s easier to run before you walk. Luckily for us, Tensorflow did some heavy lifting. The idea was to build something first with the least amount of background knowledge, make it work, somehow, and then review what we actually did.</p><h3>DIY — Dip your toes into image classification</h3><p>I outlined a sample workflow of what we did below. Please follow along if you are interested to make your own image classification model. This means the model will read in the pixels of each image and learn from it.</p><p>Essentially, what we’re going to do is use the Tensorflow library to retrain parts of the <em>Inception </em>model by using our own <strong>labeled</strong> data and then classify a new, unseen image and see what the model predicts.</p><h4>Learning objectives</h4><ul><li>experience with a machine learning technique called supervised learning</li><li>retrain a convolutional neural net</li><li>tackle binary/multi-class image classification (binary is two labels, multi-class is more than two)</li></ul><h4>Ingredients</h4><ul><li>Docker</li><li>some terminal skillz</li><li>images, the more the merrier</li></ul><h4>Environment setup</h4><p>Docker is a neat sandboxing tool that uses <a href="https://www.reddit.com/r/explainlikeimfive/comments/49qcdd/eli5_how_does_docker_work/d0u7qq6/">‘container’ technology</a> so that you can fire up applications within a bells and whistle-less version of your operating system.</p><p>Get Docker: <a href="https://www.docker.com/community-edition">https://www.docker.com/community-edition</a></p><p>After installation, if Docker hasn’t started yet, manually do so by running the application or running the command:</p><p>Create a Docker container with volume to persist data. This particular docker container runs a Tensorflow image so you get Tensorflow out of the box.</p><pre>docker run -d -it --name &lt;CONTAINER_NAME&gt; -v &lt;VOLUME_NAME&gt;:/tf_files gcr.io/tensorflow/tensorflow:latest-devel</pre><pre>docker exec -it &lt;CONTAINER_NAME&gt; bash</pre><p>Cool, Docker has been set up.</p><p>exec lets you SSH into the Docker container.</p><h4>Getting data</h4><p>The next step is a very important step, getting data. You could get by with 100 images of each label, but the more the merrier. The project we did was upwards of 2000 for each label.</p><blockquote>A <strong>label</strong> is what category you want the image to be named. For example, if you have 100 images of tulips, your label for that set is <strong>tulips</strong>.</blockquote><p>From here, you can download a bunch of images or copy them from your local drive. These images must be labeled by the folder name.</p><p>So if you have 100 images of tulips, store them in a folder called tulips, same goes for daisies and lilies and etc… The flower example already separates the data into categories for you.</p><p>This will be your <strong>training data </strong>which means it is the images that the model will learn from.</p><pre>(while inside your Docker container)</pre><pre>mkdir /tf &amp;&amp; cd /tf</pre><pre>curl -O <a href="http://download.tensorflow.org/example_images/flower_photos.tgz">http://download.tensorflow.org/example_images/flower_photos.tgz</a></pre><pre>tar xzf flower_photos.tgz</pre><pre>-----------------------------------------------------------------</pre><pre>(to copy images from your own drive to Docker)</pre><pre>docker cp &lt;FOLDER_NAME&gt; &lt;CONTAINER_NAME&gt;:/tf/&lt;FOLDER_NAME&gt;</pre><p>Your training images will now live in /tf/flower_photos.</p><p>The following command will start training your model to learn your images:</p><pre>cd /tensorflow &amp;&amp; git pull</pre><pre>python /tensorflow/tensorflow/examples/image_retraining/retrain.py \<br>-- bottleneck_dir=/tf_files/bottlenecks \<br>-- model_dir=/tf_files/inception \<br>-- output_graph=/tf_files/retrained_graph.pb \<br>-- output_labels=/tf_files/retrained_labels.txt \<br>-- image_dir /tf/flower_photos/</pre><p>Depending on the size of your sample set and computer, this could take anywhere from 15 minutes to an hour. But afterwards, you have a fully functional classifier!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/924/1*Xs16QabzCMMBFt9wt-_bqQ.png" /></figure><p>This accuracy means that out of 100 images, the model on average can correctly predict 91 of them.</p><p>Now you are ready to classify your images. Hop back over to your local drive and grab an image somewhere. You can open a new tab on your terminal.</p><p>Again, to copy images you want to classify from your local drive to the Docker:</p><p>docker cp &lt;FILE_NAME&gt; &lt;CONTAINER_NAME&gt;:/tf/&lt;FILE_NAME&gt;</p><p><a href="https://github.com/xblaster">Xblaster</a>, came up with this nifty script to classify your images very simply. So throw that in there too:</p><p>docker cp &lt;CONTAINER_NAME&gt;:/tf/label.py label.py</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/98d2e326b1a65884068d57859835131d/href">https://medium.com/media/98d2e326b1a65884068d57859835131d/href</a></iframe><p>So, grab an image that IS NOT from the training data. Make sure YOU know what it is, and then throw that in the classifier.</p><p>Hop back into the Docker container with:</p><p>docker exec -it &lt;CONTAINER_NAME&gt; bash</p><p>and then to run the python script:</p><pre>python /tf/label.py /tf/&lt;SOME_IMAGE&gt;.jpg</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U3lOwjzxjL5_wCG6rh1uRQ.png" /><figcaption>Dandelion image by Azmi Semih: <a href="https://unsplash.com/@azsemok">https://unsplash.com/@azsemok</a></figcaption></figure><p>The figure above illustrates the model predicting that the dandelion image is a dandelion with 99.8% confidence.</p><p>So now I ask you, what can machine learning do for you?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7eabf2562c4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/building-crowdriff/what-can-machine-learning-do-for-you-7eabf2562c4">What can machine learning do for you?</a> was originally published in <a href="https://medium.com/building-crowdriff">Building CrowdRiff</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My Knapsack]]></title>
            <link>https://medium.com/@chinstan/my-knapsack-15144cff8bed?source=rss-1360525089f3------2</link>
            <guid isPermaLink="false">https://medium.com/p/15144cff8bed</guid>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[travel]]></category>
            <dc:creator><![CDATA[Stanley Chin]]></dc:creator>
            <pubDate>Tue, 21 Feb 2017 22:43:29 GMT</pubDate>
            <atom:updated>2017-02-21T22:43:29.999Z</atom:updated>
            <content:encoded><![CDATA[<p>I love my knapsack. It is the Cotopaxi Inca 26L which is technical and lightweight. I usually equip it with the essentials for any day adventure whether it be for going to school, a trip to downtown, a weekend away, or even for hiking.</p><ol><li>Victorinox — swiss army knife | general purpose everything</li><li>AO — pilot sunglasses | protect those eyeballs</li><li>Underarmour — hydration bottle | 8 cups of water a day, people!</li><li>Anker — 10,000 mAh battery pack | recharge those batteries</li><li>Anker — extra usb-c to usb-a wire | just, yes.</li><li>Amazon — Kindle paperwhite | reading is good for me</li></ol><p>Let me know if you have any suggestions for what you pack on your back, I love quality, budget products.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=15144cff8bed" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>