<?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 Samuel Mohebban on Medium]]></title>
        <description><![CDATA[Stories by Samuel Mohebban on Medium]]></description>
        <link>https://medium.com/@HeeebsInc?source=rss-caf4b32fe258------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*2AapGRaLc-EITUpbyCwn7A.jpeg</url>
            <title>Stories by Samuel Mohebban on Medium</title>
            <link>https://medium.com/@HeeebsInc?source=rss-caf4b32fe258------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 12:24:25 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@HeeebsInc/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[Object Detection: Stopping Karens Before They Can Strike using Keras and OpenCV]]></title>
            <link>https://medium.com/data-science/custom-object-detection-using-keras-and-opencv-ddfe89bb3c3?source=rss-caf4b32fe258------2</link>
            <guid isPermaLink="false">https://medium.com/p/ddfe89bb3c3</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[object-detection]]></category>
            <category><![CDATA[keras]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[covid19]]></category>
            <dc:creator><![CDATA[Samuel Mohebban]]></dc:creator>
            <pubDate>Wed, 14 Oct 2020 21:28:03 GMT</pubDate>
            <atom:updated>2020-10-14T21:28:03.863Z</atom:updated>
            <content:encoded><![CDATA[<h3>Object Detection: Stopping Karens Before They Can Strike With Keras and OpenCV</h3><h4>Walkthrough on how to build your own facial detection system that can determine whether someone is wearing a mask, or if they are happy, neutral, or angry.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*_trnzAW0JZpmL4Mjt5BsjA.png" /><figcaption>Model Demonstration (Photo by Author)</figcaption></figure><p>In the age of COVID-19, we have seen that wearing masks can substantially decrease the spread of the virus. However, as we sometimes see online, there are a lot of people that strongly disagree with this statement. Videos online show people becoming very disgruntled when they are asked to follow this protocol. In this project, I will show you how to create a neural network that can detect whether someone is wearing a mask, and if they are not, we will detect the facial expression on their face. With more scale, this can be applied to local businesses so that managers can detect whether someone is wearing a mask and whether they are indeed a Karen ready to strike.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2Fj1svspDN51FBUeQpFz%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2Fj1svspDN51FBUeQpFz%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2Fj1svspDN51FBUeQpFz%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="537" frameborder="0" scrolling="no"><a href="https://medium.com/media/dab25317ae3dc935c10ec235705ada1c/href">https://medium.com/media/dab25317ae3dc935c10ec235705ada1c/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TNxHSkIZMwMLZxxwBecGjw.png" /><figcaption>Model Demonstration (Photo by Author)</figcaption></figure><p><em>**The code for this tutorial can be found on my </em><a href="https://github.com/HeeebsInc/FaceMaskEmotionDetection"><em>GitHub</em></a><em>**</em></p><h3>Requirements</h3><ul><li>Keras</li><li>OpenCV</li><li>NumPy</li><li>Matplotlib</li><li>tqdm</li><li>Sklearn</li></ul><h3>Data</h3><ol><li>Face Mask: ~12K Images Dataset (<a href="https://www.kaggle.com/ashishjangra27/face-mask-12k-images-dataset?select=Face+Mask+Dataset">Kaggle</a>)</li><li>Emotion: ~30K Images Dataset (<a href="https://www.kaggle.com/msambare/fer2013">Kaggle</a>)</li></ol><h3>Mask Detection</h3><p>The first step to this project is to build a neural network that can detect whether a person is wearing a mask. For this portion, we will use Mobilenet.</p><p>Before we build the model, we need to extract each image and preprocess it so that it can be fed into Mobilenet. In the dataset above, we see that there are three directories in the outermost layer: (1) Train, (2) Test, and (3) Validation. Below is the code for how to extract each image, preprocess them for mobilenet, and save them to a NumPy array.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bb1abd91f03234de2195aef4d35f4e21/href">https://medium.com/media/bb1abd91f03234de2195aef4d35f4e21/href</a></iframe><p>After running the cell above, you should see a window like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/995/1*blgOQ4UrDDFuYB_xC5FQ8Q.png" /><figcaption>Train Test Split (Photo by Author)</figcaption></figure><p>In the later sections, we will reuse the function get_image_value, which is why we pass a parameter stating which model type it should retrieve the image for.</p><p>Now that we have the image values, it is time to build the neural network that will be used to detect the mask. Make sure you have a folder called ModelWeights inside the current directory. In this folder, we will save the weights for each model that we train.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4e243b98490522b5d88b870263b25174/href">https://medium.com/media/4e243b98490522b5d88b870263b25174/href</a></iframe><p>Above, we specified that the model should train for 2000 epochs. Because the model likely does not need 2000 epochs, we included an early stopping parameter to prevent the model from overfitting after 5 consecutive iterations with no change in the loss. After running the cell above, you should see a window like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1002/1*fFk7cilFqguoNiveFU579A.png" /></figure><p>After the training is complete, you should see a .h5 file within the ModelWeights folder named Mobilenet_Masks.h5. In this file, the weights for the model are stored and will be used later on when we apply this neural network to live video.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/567/1*6EcT-mjOtUafBXfD6zoVoQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*yKKIlWqJZy4qMp4Y-DxLCA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/571/1*pa3IEGWE9NWPpiuAEW2gAA.png" /></figure><p>Above, we see the ROC score, confusion matrix, and loss/accuracy for the mobilenet training. Considering the amount of data we used, these metrics are pretty good. For the validation set, only 13 images were incorrectly classified. As for the loss and accuracy, the loss was able to go below .1 and the accuracy was well above 94%. Finally, the ROC score shows great success as each class had a perfect score of 1.0, while F1 scores for each class were greater than .98.</p><h3>Emotion Detection</h3><p>Like the last model, we must first start by extracting the image values and placing them into a NumPy array. Like I mentioned earlier, we will reuse the get_image_value function within a new function designed to extract only the emotion images. The dataset contains 7 classes: angry, happy, neutral, sad, disgust, fear, and surprise. For this project, we will only be focusing on the first 3 classes: angry, happy, and neutral. Also, the model that we will use for training will take an input image with size (48,48,3), which is much smaller than mobilenet dimensions of (224,224,3).</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/789ef14c52fdcfcce40d40599be19c01/href">https://medium.com/media/789ef14c52fdcfcce40d40599be19c01/href</a></iframe><p>As you can see above, we limited each class to include only a maximum of 4000 images. This was performed so that training would be faster and so that we could properly track the performance with equal class balance.</p><p>After running the code above, you should see a similar window as before that looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*LlFLkSeZssxAqOZExzXR4A.png" /><figcaption>Emotion Train Test Split (Photo by Author)</figcaption></figure><p>Now that we have the train test split arrays, we will build the neural network that will detect the emotion on a person’s face. Below is the code for how to build this neural network. Unlike mobilenet, we will not apply augmentation to the dataset.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3aa2b22caed473b70bdc422ce2c800f8/href">https://medium.com/media/3aa2b22caed473b70bdc422ce2c800f8/href</a></iframe><p>After running the code above, you should see a window like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1002/1*ZmIFAT71IEEInW7MZeHEgw.png" /><figcaption>Emotion Training (Photo by Author)</figcaption></figure><p>Once the training is complete, you should find a .h5 file called Normal_Emotions.h5 which will contain the weights for the model. Like the previous model we trained, this will be used for the live video portion below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/567/1*yawnKpr2qesx_6iIwMc5AA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/610/1*D-RkE16L5JP-UxKFrMltxA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/570/1*jUg9UQi9PFbAgIZ8QuVx7w.png" /></figure><p>Above, we see the ROC score, confusion matrix, and loss/accuracy for the emotion model. Considering the amount of data we used, these metrics are pretty good, but not as good as mobilenet. For the training set, only 1,786 images were incorrectly classified out of the ~12,000. As for the loss and accuracy, the loss was able to go below .7 and the accuracy stayed between 70–75%. Finally, the ROC score shows pretty good success as each class maintained a score greater than .9, while F1 scores for each class were between .7 and .9.</p><h3>Deployment</h3><p>Now that we have each model trained, we will apply them both to live video using OpenCV. For this portion, you must have a webcam set up on you local machine.</p><p>Before we get into the code, let me first explain the steps for how this work.</p><ol><li>Using <a href="https://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_objdetect/py_face_detection/py_face_detection.html">haar cascade classifier</a>, we ill find the coordinates of a face within a video frame (<a href="https://github.com/HeeebsInc/FaceMaskEmotionDetection/blob/master/ModelWeights/haarcascade_frontalface_default.xml">download link</a>)</li><li>After finding the coordinates of the face, we will extract that portion, which is also called our region of interest (ROI).</li><li>Because we want to figure out if there is a mask present, we will first reshape that ROI to (224,224) so that it can be fed into our mobilenet model.</li><li>If the mobilenet model predicts there is a mask, then it will continue without using the emotion model.</li><li>However, if the mobilenet model predicts there is no mask, then it will use the ROI again and input it into the emotion model.</li></ol><p>Below is the code for how it would work. At first glance, it seems like there are a lot of conditions within the for loop, but just read it slowly and it will make sense.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/14a9eacfdae0d490534e3fb87f98e428/href">https://medium.com/media/14a9eacfdae0d490534e3fb87f98e428/href</a></iframe><p>Once you run the code above, a window should pop up like the one below. To Stop this process, press the ‘q’ button on your keyboard.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xc_RsIu9xgOQ2bxdefZmSw.gif" /><figcaption>Model Demonstration (Photo by Author)</figcaption></figure><h4>Limitations</h4><ul><li>From what I can tell, this model has a hard time distinguishing whether a mask is present if the person in the frame is wearing glasses.</li><li>More data containing people wearing masks with glasses would improve this limitation</li></ul><p><strong>Future Directions</strong></p><ul><li>I plan to find a camera that can detect heat (if I can find one that is affordable)</li><li>Using a camera to detect heat as well as these other features can be beneficial to prevent people from entering stores if they are found to be experiencing a fever.</li></ul><p><strong>Also, I am currently looking for a job in Data Science so if you have any advice on that front please reach out to me via </strong><a href="https://www.linkedin.com/in/samuel-mohebban-b50732139/"><strong>LinkedIn</strong></a><strong>!</strong></p><p><em>*The code for this tutorial can be found on my </em><a href="https://github.com/HeeebsInc/FaceMaskEmotionDetection"><em>GitHub</em></a><em>**</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ddfe89bb3c3" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/custom-object-detection-using-keras-and-opencv-ddfe89bb3c3">Object Detection: Stopping Karens Before They Can Strike using Keras and OpenCV</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Nvidia 3000 GPUs: Where Data Scientists, Gamers, and Scalpers Collide]]></title>
            <link>https://medium.com/data-science/nvidia-3000-gpus-where-data-scientists-gamers-and-scalpers-collide-7a9a6f34f81f?source=rss-caf4b32fe258------2</link>
            <guid isPermaLink="false">https://medium.com/p/7a9a6f34f81f</guid>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[nvidia]]></category>
            <category><![CDATA[gaming]]></category>
            <category><![CDATA[amd]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Samuel Mohebban]]></dc:creator>
            <pubDate>Tue, 29 Sep 2020 18:22:00 GMT</pubDate>
            <atom:updated>2026-02-21T04:16:32.138Z</atom:updated>
            <cc:license>http://creativecommons.org/licenses/by/4.0/</cc:license>
            <content:encoded><![CDATA[<h4>Overview of the new Nvidia Ampere collection; different GPU benchmarks, specs, rumors, and manufacturing issues; and my experience trying to actually buy the 3000 series GPUs myself</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZswAiKhLOOPHqFO2QnbUSA.jpeg" /><figcaption>Photo Credit: Christian Weidiger (<a href="https://unsplash.com/photos/TErYPw4o1KM">Unsplash</a>)</figcaption></figure><p>In this blog, I will explain the hype around the new Nvidia Ampere 3000 series GPUs, how they compare to the Turing 2000 series cards, and the current benchmarks available today for each RTX generation. I will also go over rumors for upcoming variants of the 3080, as well as the reports from users saying the cards they received were defective. At the bottom of the article, I will go over my opinion and the advice I have for anyone trying to get them, regardless if it&#39;s for gaming, data science, or flexing on the latter two.</p><h3>Why is Nvidia so Popular?</h3><p>Nvidia has always been a winner within the GPU space, but it’s for a variety of reasons and not just their “power”. When you want to compare computational power or the amount of TFLOPS between Nvidia and AMD GPUs, there is actually no big difference- and often, AMD comes out on top in this regard. For example, when comparing the AMD Radeon RX Vega 64 ($~400) and the Nvidia 2080 (~$700), you see the cracks in the argument that Nvidia is the <em>most powerful. </em>When comparing the TeraFlop performance between these cards, the AMD Radeon 64 comes out on top in every aspect (FP16, FP32, and FP64). So if AMD offers cards that are more powerful (in terms of TF) at a much lower cost, then why is Nvidia regarded as the best manufacturer of GPUs? The real answer comes when looking at the bells and whistles that Nvidia offers, and how they target multiple different types of customers ranging from Graphic Designers, Data Scientists, and most importantly, <strong>Gamers</strong>. When it comes to games, the amount of TF does not equate to the gaming experience they provide. Looking at the Vega 64 and RTX 2080, the RTX 2080 crushed the Vega in every single gaming benchmark, averaging a 20%-50% increase in Frames Per Second(FPS) [<a href="https://www.gpucheck.com/compare/amd-radeon-rx-vega-64-vs-nvidia-geforce-rtx-2080/intel-core-i7-7700k-4-20ghz-vs-intel-core-i7-8700k-3-70ghz/">Vega 64 vs 2080 Benchmarks</a>]. I know some might be thinking, why on earth did you use the comparison between the Vega64 and RX 2080? I know these cards are completely different in terms of their usage, but I wanted to illustrate that just saying “more powerful” is only half the story. There are multiple reasons why Nvidia is better than AMD in terms of GPUs, and only some of these reasons are specific to the way you plan to use the hardware. I will go into what I mean in more detail throughout the rest of the blog post.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Pe1x_739R-QdjAxFmWRYHg.jpeg" /><figcaption>Photo Credit: Florian Olivo (<a href="https://unsplash.com/photos/Mf23RF8xArY">Unsplash</a>)</figcaption></figure><p>The reason the RTX GPUs are so powerful in modern games is due to their technology of ray tracing and the implementation of what Nvidia calls CUDA Cores. CUDA cores were created for gaming, but the icing on the cake for Nvidia is that they are also really impressive in deep learning and Artificial Intelligence- allowing this technology to have a wider target audience. Having more CUDA cores does not only increase your ability to implement neural networks and advanced algorithms, but when applied to games they create more realistic graphics and much higher FPS rates.</p><h3>RTX 2000 Series (Turing Architecture)</h3><p>To fully understand why the 3000 series is getting so much attention, it is important to know the past generation of Nvidia cards and the huge jump in performance the 3000 series has. For the sake of consistency, I will stick to these cards: Nvidia 2060, 2060S, 2070, 2070S, 2080, 2080S, 2080ti, and Titan RTX.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mjM-NkipAjJs1PGpAiVwPQ.png" /><figcaption>Nvidia Turing 2000 Series (Photo by Author)</figcaption></figure><p>Above we can see the difference in performance across each GPU within the 2000 series lineup. I want to note that prior to this generation, there were no Super cards. The implementation of Super is thought to be a response to AMD’s aggressive pricing strategies, as Nvidia filled the price gap between each model to make their products more enticing than compared to AMD’s cheaper cards. I also want to note that the pricing that is listed above is not the release price but rather the current prices on Amazon and Newegg. The retail price for these cards when they came out were about 20%–40% more for each card. One major jump from this series to the 3000 series is the core clocks, Bit bandwidth, and most importantly, the CUDA core count. As we can see above, the flagship card in the 2000 series has 4606 CUDA cores, a bit bandwidth of 384-bit, and 1350–1770 MHz clock speeds; and was priced at launch for a whopping $2,500. This performance is impressive, but compared to the new 3000 series lineup these specs get blown out of the water.</p><h3>Nvidia 3000 Series (Ampere Architecture)</h3><p>In this generation of GPUs, Nvidia really outdid themselves. They not only created a lineup that crushed their last ones, but they added a new pricing strategy that is very unconventional of them as a hardware company. Below you can see the specs for the new series. Every card marked with *** is considered to be rumored and not definite in terms of pricing and specs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1WuBmCuqONhOpm0MRQ4Www.png" /><figcaption>Nvidia Ampere 3000 Series vs. Turing 2000 Series (Photo by Author)</figcaption></figure><p>As you can see above, the pricing not only halves their last generation, but the low tier 3000 series cards are faster than their flagship? I added a question mark here because like you, I just don’t understand. Looking at the 3080 which is priced at ~$700 USD we can see there are almost 50% more CUDA cores and achieves clock speeds higher than the previous flagship RTX Titan- I know, crazy right... By creating these cards and pricing them like this, Nvidia made their own previous generation products completely irrelevant- well that is, for gamers. This brings me to my next topic, <strong><em>memory. </em></strong>The memory bandwidth across the 2000 series and 3000 series is a bit different, as the 3080 contains only 10GB, 1 less than the previous generation 2080ti which contains 11GB. For gamers, 1GB loss does not matter as much as long as the FPS rates and Ray Tracing cores increase, which they did. However, for deep learning and graphic designers, this was a little disappointing. The memory bandwidth available in graphics cards is very crucial for using state of the art (SOTA) techniques. <a href="https://timdettmers.com/2018/12/16/deep-learning-hardware-guide/#:~:text=You%20should%20have%20enough%20RAM,not%20necessarily%20need%20more%20RAM.">Here </a>is an article explaining how memory bandwidth is important, and which GPUs are necessary for certain deep learning techniques. In the article, the author, Tim Dettmers explains the following:</p><ul><li>Research that is hunting state-of-the-art scores: &gt;=11 GB</li><li>Research that is hunting for interesting architectures: &gt;=8 GB</li><li>Any other research: 8 GB</li><li>Kaggle: 4–8 GB</li><li>Startups: 8 GB (but check the specific application area for model sizes)</li><li>Companies: 8 GB for prototyping, &gt;=11 GB for training</li></ul><p>Considering this, although the lack of memory bandwidth for the 3080 was disappointing, the inclusion of a whopping 24gb 3090 model makes up for the pain some people felt. Looking at the new 3090 series, it not only packs more CUDA cores, but also 2GB more of memory than the RTX Titan- and don’t forget its $1,000 cheaper!</p><h3>3080 20GB Rumors</h3><p>If you are one of the few people that had the chance to buy the 3080 GPU on release day, you might be looking at the chart with panic. Although it is not definite, there are countless leaks from well-established sources saying there will be a 3080 20GB variant. Personally, when I read these I felt very relieved as I was trying to buy a 3080 myself. The idea behind this release is that Nvidia will release this variant during the same week as AMD’s Big Navi release. AMD announced some specs for their next-generation 6000 series cards, showing that their flagship will contain a total of 16GB memory and will be <em>faster </em>than the 3080. This increase is impressive as well, but Nvidia holding out on a 20GB model is genius considering it will be more enticing than the Big Navi release. <a href="https://www.techradar.com/news/amd-big-navi-might-still-be-faster-than-the-rtx-3080">This article</a> by Carly Page outlines the leaked specs and how they compare to the Nvidia 3000 series. If it is true that AMD created a card that is faster than the 3080, having more memory in the 3080 will push customers towards Nvidia and away from the AMD launch.</p><p>The first leak comes from the GIGABYTE website. As you can see <a href="https://www.bit-tech.net/news/gigabyte-suggests-geforce-rtx-3080-20gb-cards-are-on-the-way/1/">here</a>, they posted various redemption codes for the 3000 series launch and included cards that have not yet been announced. When I saw this, I was already convinced it was true, especially since Nvidia has yet to correct these rumors and stayed quiet.</p><p>A few days after this leak, there was another coming from Galax, another GPU manufacturer. <a href="https://hothardware.com/news/galaxy-ampere-leaked-roadmap-geforce-rtx-3060">In this leak</a>, a roadmap during an internal presentation was shown to feature a 3080 20GB variant. Considering these two leaks within the same week, and Nvidia not saying a thing about it, it is clear in my opinion that this release may actually happen.</p><p>From a machine learning perspective, the introduction of a card with 20GB priced below $1000 would be a game-changer- especially for me as I currently use an RX 580 8GB card. However, from a gaming perspective, these increases in memory are not that important for most people. I will go into my opinions on the massive hype around 3090 and why some people should not be as excited if they plan to use it just for gaming.</p><h3>Reports of Broken/Defective Cards</h3><p>As users began actually receiving their cards, there have been a number of reports that the cards are not working as they are supposed to, or that their card was shipped without a box, causing bending and aesthetic damage to the cards. The former issue of cards being sent without a box is outlined in <a href="https://www.tomshardware.com/news/newegg-shipping-evga-rtx-3080s-without-boxes">this article</a>, where the authors explain this is the fault of distribution partners such as Newegg. On the other hand, to fully understand why cards are crashing and not working properly, you have to also know how the distribution and manufacturing of the cards work. When Nvidia creates a GPU, there are different versions that go out into the market. For example, every founder&#39;s edition card are those that Nvidia creates themselves, and is thought to have the best silicone quality and specs in order to create the full experience the cards are designed for. On the other hand, Nvidia also licenses their designs to third-party manufacturers such as EVGA and ASUS, where these companies are given the minimum specs required for these cards to work. The issue that a lot of people are having is due to these minimal requirements, and the layout of the capacitors on these cards. As you can see below, the image on the left is a Founder’s Edition card containing two rows of large capacitors and one row of very small capacitors (middle row). Looking at the card in the middle, we see that there are only the small capacitors in each row, making this card more expensive to manufacture. While lastly, the Zotac cards, which is one of the cards reporting issues, have only the larger, cheaper capacitors. These issues are not problematic in the sense that these cards are defective, but rather they cannot boost to the clock speed they are intended to. What capacitors are made to do is allow for safe and stable energy transfer. Having only the large capacitors can make the card unstable, and can cause crashes when the card tries to boost itself. In <a href="https://www.youtube.com/watch?v=x6bUUEEe-X8&amp;list=WL&amp;index=59&amp;t=1133s&amp;ab_channel=JayzTwoCents">this video</a> by JayzTwoCents, he explains why this is happening and possible fixes for those that are having this issue.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/502/1*EwZNFgkJtkzjIqg-5Mcs8w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/682/1*i8jvcJNrexbvVCnaJX8hVQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/587/1*FlbXNsMAQweH5i3MwNWm7A.png" /><figcaption>Left (Founders Edition), Middle (ASUS TUF), Right (Zotac) [Photo Credit: <a href="https://www.youtube.com/watch?v=x6bUUEEe-X8&amp;list=WL&amp;index=59&amp;t=1133s&amp;ab_channel=JayzTwoCents">JayzTwoCents </a>&amp;<a href="https://www.igorslab.de/en/what-real-what-can-be-investigative-within-the-crashes-and-instabilities-of-the-force-rtx-3080-andrtx-3090/"> Igor’s Lab</a>]</figcaption></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FlnaPs6Y1SE6LDQgQR3%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FlnaPs6Y1SE6LDQgQR3%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FlnaPs6Y1SE6LDQgQR3%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="244" frameborder="0" scrolling="no"><a href="https://medium.com/media/176017ba5bd3b404f6f6f1778750405f/href">https://medium.com/media/176017ba5bd3b404f6f6f1778750405f/href</a></iframe><h3>My Opinions</h3><p>Before I get into it, I want to note that people have the freedom to buy what they want and that&#39;s it. These opinions are just expressing how money can be spent in better ways, and how the whole scalping era of GPU hardware is absolutely pointless as I believe people will get burned badly in trying to do so.</p><p>Although the new 3000 GPU launch is incredible in terms of performance upgrades, there have to be some things considered if you are just using these GPUs for gaming. As an avid gamer myself, I feel as though I can provide input for why certain models should not have been sold out so fast as it makes no sense to spend that type of money to see <strong><em>minimal </em></strong>performance increases. Looking at 3090 compared to the 3080, there are plenty of benchmark videos on Youtube that show there is not a considerable difference in FPS performance despite the $700 price gap. In <a href="https://wccftech.com/nvidia-geforce-rtx-3090-10-15-percent-faster-geforce-rtx-3080-in-4k-gaming-confirms-limited-supply-at-launch/">this article,</a> the authors lay out benchmark performances and show there is only a 10% increase in performance across the 3080 and 3090. Also considering the CUDA cores, there are of course more in the 3090, but being that they are both well above the past generation flagship models the extra 2000 CUDA cores make little to no difference for games. I may be biased as I am a data scientist obsessed with neural networks, but I believe the 3090 is best suited for data science and machine learning. The extra 14GB of memory may seem sexy at first glance, but the only time it will actually make a difference in your gaming experience is if you are playing on an 8K monitor, which I am sure a very very small portion of gamers are doing. Yes, some could argue, “Well Sam! Its future proof”. While that is correct, all the hype around getting it now just makes no sense to me. Not only do you need a high-end processer, like an i9 or Ryzen 9 (which can cost between $700-$1000), but you most definitely have to upgrade your power supply as well. So if you are one of the avid gamers that bought the 3090, you not only spent the $1500 on the card, $200 on the PSU but unless you have the CPU that can handle the GPU, you are seeing literally no difference in your experience (unless you are upgrading from a GTX 900 series card or lower).</p><h4>Scalping</h4><p>Moving onto my next point, SCALPERS! I have never been a sneakerhead myself, but now I understand the pain they deal with every launch. You would think that these big companies, especially one like Nvidia that has such a big hand in machine learning, would have anticipated this or developed algorithms to detect scalpers. Of course, this is an oversimplification of the difficulty of creating such algorithms, however, I still believe Nvidia has enough time between now and the next launch in late October to fix it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*AMeTAPSIh7d2VUtgb5V6Ag.jpeg" /><figcaption>Photo Credit: Nerino (<a href="https://www.memedroid.com/memes/detail/3086991/NVIDIA-is-trying-to-prevent-bots-from-buying-30-series?refGallery=tags&amp;page=1&amp;tag=nvidia">Memedroid</a>)</figcaption></figure><p>From my perspective, people saw the opportunity to buy a product that was getting a lot of hype. However, unlike sneakers, graphics cards are not limited in their production. Yes, this release had limited stock, but not because Nvidia wanted it that way but because of decreased production due to COVID-19. For example, big sneaker companies like Nike will announce they are releasing a shoe and they are only making a few hundred and that it. In this case, Nvidia is constantly making more each week and plans to go back to a normal production schedule in the next few months. Scalpers thinking they can buy a card and price it at $1000 higher than the retail cost is just surprisingly dumb. Yes, maybe some had success in selling theirs on eBay, but I will bet that it was so few. Just because there are hundreds of listings on eBay for these new cards at a $1000-$2000 upcharge does not mean people are buying them.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F3krAxhMRrpsdH17A24%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F3krAxhMRrpsdH17A24%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2F3krAxhMRrpsdH17A24%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="244" frameborder="0" scrolling="no"><a href="https://medium.com/media/59452adaf4392226a83e0e91c760aa76/href">https://medium.com/media/59452adaf4392226a83e0e91c760aa76/href</a></iframe><h3>My Experience Trying to Buy 3090</h3><p>To fully understand the gravity of the situation, let me walk you through <strong><em>my experience </em></strong>trying to buy the 3090 at my local Micro Center on launch day. I woke up extra early because I knew there would be a line outside before the store opened. To be honest, because I did not plan on camping out the night before I knew the chances of me being able to get my hands on a 3090 were slim considering the launch of the 3080 a week before, but I still wanted to try and see the chaos for myself. I finally arrived at the Micro Center about 20 minutes after they opened, and with no surprise, there were dozens of people camping outside the store. As I am walking up to the entrance, I see two people walking out of the store holding their brand new 3090s. As soon as the campers outside the store saw them, two people rushed up to the lucky buyers and asked them if they could buy the cards off them for $500 more than what they had just paid for it inside. The answer I heard made me soo disappointed. When these people were asked if they were willing to sell the cards, their answer was this: “Well, I was planning on selling the card on eBay for $4000”. I thought to myself… how dumb is that… $4000??!?!? This logic is so ridiculous considering you can buy a pre-built pc with a 3090 inside for just under $4000. So if someone was that desperate for the card they could buy the pre-built, remove the card, and sell the other parts and spend exactly what the card is worth. Of course, I do not wish bad upon anyone, and the opportunity to make $1000 is very important to some people considering the economy today; however, I just hope a lesson is learned that shoes and GPUs are completely different things.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FxT5LMuwtkyTall6BsA%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FxT5LMuwtkyTall6BsA%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FxT5LMuwtkyTall6BsA%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="331" frameborder="0" scrolling="no"><a href="https://medium.com/media/2cd790c3bf486792948c564b91a2d6c5/href">https://medium.com/media/2cd790c3bf486792948c564b91a2d6c5/href</a></iframe><h3>My Advice</h3><p>My advice is simple. If you do not currently have a graphics card and you have been waiting for this release, then by all means go out and try to get one. I&#39;ve been there, I know the excitement of building a computer and trying it on your very own games so I am not downplaying that at all. However, if you cannot get the card, I recommend getting an interim card such as the 1660 or RX 580. You can find these cards on eBay for under $200 and they work great. Currently, I have an RX 580 8GB that I bought for $125. In every game,(Fortnite, League of Legends, COD Warzone) I get amazing frames at 1080p. The beauty of these cards is they are cheap to buy, and there will always be a market for resale when you are done with them. If you are in a rush to get a gaming pc, buy one of these cards and use it until you feel that buying the new-gen 3000 cards is not as much of a hassle. For example, let say you buy an RX 580 for $150. Once you feel that the 3000 series cards are easy to get, sell the RX 580 for $100 to guarantee a quick sell. After doing that, you only spent $50 on an interim card and was able to have the gaming experience you wanted rather than wait with nothing.</p><p>If you are a data scientist, my advice is bleaker (this is what I am experiencing right now). Currently, I am working on a few different projects that have been a headache to get to work with my graphics card, so the thought of being able to upgrade was really exciting. Because these launches have been a disaster, the only thing to do is wait. For me, I plan on waiting until late October when AMD/Nvidia release new cards, and maybe I will camp out at the store- I am not sure yet. In my opinion, the scarcity of the cards will start to decrease as Nvidia increases their production and distribution as they have in the past.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F26BRuo6sLetdllPAQ%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fsiliconvalleyhbo-watching-goodbye-window-26BRuo6sLetdllPAQ&amp;image=https%3A%2F%2Fmedia2.giphy.com%2Fmedia%2F26BRuo6sLetdllPAQ%2Fgiphy-downsized-large.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="303" frameborder="0" scrolling="no"><a href="https://medium.com/media/b677ac753227f7c89ac42a465ebad474/href">https://medium.com/media/b677ac753227f7c89ac42a465ebad474/href</a></iframe><p>I hope I was able to lay out some good advice. If you are in a similar position as I am, do not worry- we are in this together :)</p><p>Just a few more months and stock will be replenished, and the scalpers will see that this move was a bad business decision.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7a9a6f34f81f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/nvidia-3000-gpus-where-data-scientists-gamers-and-scalpers-collide-7a9a6f34f81f">Nvidia 3000 GPUs: Where Data Scientists, Gamers, and Scalpers Collide</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Build A Weapon Detection System using Keras and OpenCV]]></title>
            <link>https://medium.com/data-science/how-to-build-a-weapon-detection-system-using-keras-and-opencv-67b19234e3dd?source=rss-caf4b32fe258------2</link>
            <guid isPermaLink="false">https://medium.com/p/67b19234e3dd</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[object-detection]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[keras]]></category>
            <dc:creator><![CDATA[Samuel Mohebban]]></dc:creator>
            <pubDate>Wed, 09 Sep 2020 18:07:17 GMT</pubDate>
            <atom:updated>2021-08-25T14:23:08.573Z</atom:updated>
            <cc:license>http://creativecommons.org/licenses/by/4.0/</cc:license>
            <content:encoded><![CDATA[<h3>Custom Object Detection Using Keras and OpenCV</h3><h4>Build a System That Can Identify a Weapon Within a Given Image or Frame</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1012/1*HH0ViYXe9t_Z_TrGCDZErA.png" /><figcaption>Weapon Detection System (<a href="https://www.pxfuel.com/en/free-photo-ovfsz">Original Photo</a>)</figcaption></figure><p>I recently completed a project I am very proud of and figured I should share it in case anyone else is interested in implementing something similar to their specific needs. Before I get started in the tutorial, I want to give a HEFTY thanks to Adrian Rosebrock, PhD, creator of <a href="https://www.pyimagesearch.com/">PyImageSearch</a>. I am a self-taught programmer, so without his resources, much of this project would not be possible. He is the epitome of a <em>mensch- </em>I could not be more appreciative of the resources he puts on his website. If you want to learn advanced deep learning techniques but find textbooks and research papers dull, I highly recommend visiting his website linked above.</p><p>In most projects related to weapon classification, I was only able to find a dataset of 100–200 images maximum. This posed an issue because, from my experience, it is hard to get a working model with so little images. To gather images, I rigged my raspberry pi to scrape<a href="http://www.imfdb.org/wiki/Main_Page"> IMFDB.com</a>- a website where gun enthusiasts post pictures where a model gun is featured in a frame or clip from a movie. If you visit the website, this will be more clear. To access the images that I used, you can visit my <a href="https://drive.google.com/file/d/1EZZKhCk0DK3S9zB53o3nWhKrZUbmN2Up/view?usp=sharing">Google Drive</a>. In this zip file, you will find all the images that were used in this project and the corresponding .xml files for the bounding boxes. If you are in need of bounding boxes for a large dataset, I highly recommend <a href="https://scaleops.ai/">ScaleOps.AI</a>, a company that specializes in data labeling for machine learning algorithms. Currently, I have 120,000 images from the IMFDB website, but for this project, I only used ~5000 due to time and money constraints.</p><p>Now, let’s get to the logic. The architecture of this project follows the logic shown on <a href="https://www.pyimagesearch.com/2020/07/13/r-cnn-object-detection-with-keras-tensorflow-and-deep-learning/">this </a>website. Although we implement the logic here, there are many areas for which it is different so that it can be useful for our specific problem — detecting weapons. The project uses 6 basic steps:</p><ol><li>Build a dataset using OpenCV Selective search segmentation</li><li>Build a CNN for detecting the objects you wish to classify (in our case this will be 0 = No Weapon, 1 = Handgun, and 2 = Rifle)</li><li>Train the model on the images built from the selective search segmentation</li><li>When creating a bounding box for a new image, run the image through the selective search segmentation, then grab every piece of the picture.</li><li>Run each piece of an image through the algorithm, and whenever the algorithm predicts the object you are looking for mark the locations with a bounding box</li><li>If multiple bounding boxes are marked, apply Non-Maxima suppression to include only the box with the high confidence/region of interest (this part I am still figuring out… you will see my issue below)</li></ol><p>Below is a gif showing how the algorithm works. For a given image, each square will be fed into the neural network. If a square is predicted as positive (handgun or rifle), we will mark the area that we fed onto the original image.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hBT9swO3CzxRezROo717eg.gif" /><figcaption>Sliding Window Approach: Object Detection (Image by Author)</figcaption></figure><p>If you want to see the entire code for the project, visit my <a href="https://github.com/HeeebsInc/WeaponDetection">GitHub Repo </a>where I explain the steps in greater depth.</p><p>The data I linked above contains a lot of folders that I need to explain in order to understand whats going on. After unzipping the folder, these are the files &amp; folders that are important for the project: AR, FinalImages, Labels, Pistol, Stock_AR, and Stock_Pistol, and PATHS.csv. Inside the folders, you will find the corresponding images pertaining to the folder name. So for the AR folder, you will find images of Assault rifles inside. Inside the Labels folder, you will see the .xml labels for all the images inside the class folders. Lastly, the PATHS.csv will point to every single image that will be used in the algorithm. For the purpose of this tutorial these are the only folders/files you need to worry about:</p><ol><li>FinalImages/NoWeapon</li><li>FinalImages/Pistol</li><li>FinalImages/Rifle</li></ol><p>The way the images within these folders were made is the following.</p><ul><li>For every image with a bounding box, extract the bounding box and put it into its corresponding class folder. So for an image where a person is holding a pistol, the bounding box around the pistol will become positive, while every part outside the bounding box will become the negative (no weapon)</li><li>In the image below, imagine a bounding box around the image on the left. After extracting the pixels inside the bounding box (image on the right), we place that image to another folder (FinalImages/Pistol), while we place all the white space around the bounding box in the NoWeapons folder.</li><li>Although the image on the right looks like a resized version of the one on the left, it is really a segmented image. Picture a bounding box around the gun on the left. The image on the right is <em>just</em> the bounding box and nothing else (removing everything outside the box). This technique is called region of interest (ROI).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/238/1*9PK49fAlIOhYNuioqNmgdA.png" /><figcaption>ROI Extraction (Image by Author)</figcaption></figure><p>After gathering the dataset (which can be found inside Separated/FinalImages), we need to use these files for our algorithm, we need to prepare it in such a way where we have a list of RGB values and the corresponding label (0= No Weapon, 1 = Pistol, 2 = Rifle)</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f3bd08e5308b6559a67660eab0c1cff3/href">https://medium.com/media/f3bd08e5308b6559a67660eab0c1cff3/href</a></iframe><p>If you run the code above with the Separated folder <em>outside </em>of the current directory, you will see a tqdm window that shows it is loading the images. After the process is finished, you should see this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*loWCSzU7MA9mjX8CvZJXmA.png" /><figcaption>(Image by Author)</figcaption></figure><p>Now its time for the neural network. In the code below, the function will return a model given a dimension size. If you noticed in the code above, the dimensions for the photos were resized to (150, 150, 3). If you wish to use different dimensions just make sure you change the variable DIM above, as well as the dim in the function below</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9eaee7310078fa0a3dd8e37e57dd04a2/href">https://medium.com/media/9eaee7310078fa0a3dd8e37e57dd04a2/href</a></iframe><p>The model returned above will have the architecture shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/540/1*uoVfR0lS3j5lCaIPwSCnzA.png" /><figcaption>CNN Architecture (Image by Author)</figcaption></figure><p>Once we have our train and test sets, all we need to do is fit it onto our model. Running the code below will start the training process.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8ff358c468aa11f2c16ece23aa5db0c6/href">https://medium.com/media/8ff358c468aa11f2c16ece23aa5db0c6/href</a></iframe><p>If you run the code without any errors, you should see a window like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1002/1*I61KTjqRcojL2XCWWX8dXg.png" /></figure><p>I want to note that I have the epochs set to 1000, but the EarlyStopping will prevent the algorithm from overfitting so it should not run for longer than 30–50 epochs. After the model is finished, you should see a .h5 file in your directory called ModelWeights.h5. This file is the weights that the model produced, so loading these into a model will load the model before it started to overfit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/623/1*pMlOayRDUdax2jxGRXrhyQ.png" /><figcaption>Accuracy of the Model (Image by Author)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/1*p20L6OnePc2ipnqs_axc5g.png" /><figcaption>ROC For each Class (Image by Author)</figcaption></figure><p>The accuracy was pretty good considering a balanced data set. Looking at the ROC curve, we can also assume pretty good classification given that the area under each class is very close to 1.</p><p>Now time for object detection! The following logic is used to create the bounding boxes:</p><ol><li>Input an image or frame within a video and retrieve a base prediction</li><li>Apply selective search segmentation to create hundreds or thousands of bounding box propositions</li><li>Run each bounding box through the trained algorithm and retrieve the locations where the prediction is the same as the base predictions (in step 1)</li><li>After retrieving the locations where the algorithm predicted the same as the base prediction, mark a bounding box on the location that was run through the algorithm</li><li>If multiple bounding boxes are chosen, apply non-maxima suppression to suppress all but one box, leaving the box with the highest probability and best Region of Interest (ROI)</li></ol><ul><li>Note: Non-maxima suppression is still a work in progress. In some instances, it can only detect features of the gun rather than the entire gun itself (see model comparisons below).</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/83170404f393fe491750677b4b28119d/href">https://medium.com/media/83170404f393fe491750677b4b28119d/href</a></iframe><p>Before you run the code above, create a folder Tests, and download any image from the internet and name the image the class for which you want to predict. Running the code above will search through every image inside the Tests folder and run that image through our object detection algorithm using the CNN we build above.</p><p>The images I tested on were the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aOhSoF1MobbEttshp2cewg.png" /><figcaption>Base Images</figcaption></figure><p>After running the code above, these are the predictions the algorithm gave as an output.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DTD3qEB010zXk8uaLFGF6w.png" /><figcaption>Model Results (Image by Author)[Click <a href="https://github.com/HeeebsInc/NN_Weapon_Detection/blob/master/Figures/ModelComparisons/Normal/Normal.png">here </a>for larger image]</figcaption></figure><p>As you can see above, Non-maxima suppression is not perfect, but it does work in some sense. The issue I have here is that there are multiple bounding boxes with 100% confidence so it is hard to pick which one is the <em>best. </em>Also, the algorithm is unable to detect non-weapon when there is no weapon in the frame (sheep image).</p><p>Using the logic implemented above, <a href="https://www.youtube.com/watch?v=e6tFxT-BpFg&amp;t=1s&amp;ab_channel=SamuelMohebban">here</a> is a cool visual of where I apply the code to a video.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fe6tFxT-BpFg%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3De6tFxT-BpFg&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fe6tFxT-BpFg%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/6c66af50b97285db17e8df4c9f1a8aa3/href">https://medium.com/media/6c66af50b97285db17e8df4c9f1a8aa3/href</a></iframe><p>Based on the examples above, we see that the algorithm is faaaar from perfect. This is okay because we still created a pretty cool model that only used 5000 images. Like I said earlier, I have a total of 120,000 images that I scraped from IMFDB.com, so this can only get better with more images we pass in during training.</p><h4>LIME: Feature Extraction</h4><p>One of the difficult parts of building and testing a neural network is that the way it works is basically a black box, meaning that you don&#39;t understand why the weights are what they are or what within the image the algorithm is using to make its predictions. Using <a href="https://github.com/marcotcr/lime">LIME</a>, we can better understand how our algorithm is performing and what within the picture is important for predictions.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/11635b0e285e3e28e698d7b547535fc4/href">https://medium.com/media/11635b0e285e3e28e698d7b547535fc4/href</a></iframe><p>Running the code above will create an image that looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/717/1*Z8VNlmeQFRMhDB-AMSYqRw.png" /><figcaption>LIME (Image by Author)</figcaption></figure><p>The areas that are green are those that the algorithm deems “important”, while the opposite is true for the areas that are red. What we are seeing above is good considering we want the algorithm to detect features of the gun and not the hands or other portions of an image.</p><p>Now that we can say we created our very own sentient being… it is time to get real for a second. The model we made is nothing compared to the tools that are already out there. This leads me to Transfer Learning…. where we see some really cool results. For the sake of this tutorial, I will not post the code here but you can find it on my <a href="https://github.com/HeeebsInc/NN_Weapon_Detection">GitHub Repo</a></p><h4>Mobilenet</h4><ul><li>In the example below, mobilenet was better at predicting objects that were not weapons and had bounding boxes around correct areas.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hNc1zbmj7U22NuTInCuCrg.png" /><figcaption>Mobilenet (Image by Author)[Click <a href="https://github.com/HeeebsInc/NN_Weapon_Detection/blob/master/Figures/ModelComparisons/Mobilenet/Mobilenet.png">here </a>for larger image]</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/722/1*-UoAFOsj28fAuzJJf44Zng.png" /><figcaption>Mobilenet LIME (Image by Author)</figcaption></figure><h4>VGG16</h4><ul><li>In the example below, VGG16 was unable to distinguish non-weapons like the architecture we built ourselves. It incorrectly classified 1 out of 3 handgun images, while correctly classifying the rest as a handgun</li><li>Although it incorrectly classified a handgun as no weapon (4th to the right), the bounding boxes were not on the gun whatsoever as it stayed on the hand holding the gun.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aExnnNRQFDAYr47AGQpgyw.png" /><figcaption>VGG16 (Image by Author)[Click <a href="https://github.com/HeeebsInc/NN_Weapon_Detection/blob/master/Figures/ModelComparisons/VGG16/VGG16.png">here </a>for larger image]</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/724/1*3tNKHkaZbVlPc59YKbjCPg.png" /><figcaption>VGG16: LIME (Image by Author)</figcaption></figure><h4>Conclusion</h4><ul><li>The goal of this project was to create an algorithm that can integrate itself into traditional surveillance systems and prevent a bad situation faster than a person would (considering the unfortunate circumstances in today’s society).</li><li>Although this was cool, the hardware in my computer is not yet there. To segment an image and process each portion of the image takes about 10–45 seconds, which is too slow for live video.</li><li>The video demonstration I showed above was a 30-second clip, and that took about 20 minutes to process.</li><li>However, although live video is not feasible with an RX 580, using the new Nvidia GPU (3000 series) might have better results.</li><li>Also, this technique can be used for retroactive examination of an event such as body cam footage or protests.</li></ul><p>**NOTE** If you want to follow along with the full project, visit my <a href="https://github.com/HeeebsInc/WeaponDetection">GitHub</a> **</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=67b19234e3dd" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/how-to-build-a-weapon-detection-system-using-keras-and-opencv-67b19234e3dd">How to Build A Weapon Detection System using Keras and OpenCV</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[PlaidML: Deep Learning on a Budget]]></title>
            <link>https://medium.com/data-science/plaidml-deep-learning-on-a-budget-ce22b58ba8c2?source=rss-caf4b32fe258------2</link>
            <guid isPermaLink="false">https://medium.com/p/ce22b58ba8c2</guid>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[neural-networks]]></category>
            <category><![CDATA[graphics-card]]></category>
            <category><![CDATA[keras]]></category>
            <category><![CDATA[tensorflow]]></category>
            <dc:creator><![CDATA[Samuel Mohebban]]></dc:creator>
            <pubDate>Mon, 10 Aug 2020 13:01:51 GMT</pubDate>
            <atom:updated>2020-08-10T15:52:20.383Z</atom:updated>
            <cc:license>https://creativecommons.org/publicdomain/mark/1.0/</cc:license>
            <content:encoded><![CDATA[<h4>PlaidML allows people to utilize their Intel and AMD hardware the same way you would if you had a Nvidia graphics card</h4><p>In the world of deep learning and artificial neural networks (ANN), hardware has always been a major topic of discussion. Thanks to packages such as TensorFlow, GPUs have been able to accelerate training and offer more precise accuracy scores; however, they often come with a hefty price tag. In this blog, I hope to outline the world of graphics cards as well as offer alternatives for people trying to learn ANNs on a budget.</p><p>Before I get into installing and using PlaidML, I want to discuss the importance of graphics cards and why they are widely used in Deep Learning. In every dedicated graphics card, there is a board (similar to a motherboard), dedicated cooling fans, and a processing unit (similar to a CPU). The reason this is so helpful for deep learning is that it offers researchers the ability to run multiple processes at once, while simultaneously freeing CPU workloads - which in turn allows for faster computations and more efficient CPU cycles. Today, a popular name that often follows deep learning is Nvidia, a company that specializes in GPU hardware. One reason Nvidia is so popular in the field of deep learning is that the company offers software that allows for this type of training. For example, traditional uses for GPUs tend to be for graphic processing, such as gaming, graphic design, and video editing. The issue when it comes to neural networks is that most graphics cards are created so they can be given instructions for how to process video. Nvidia has become a big player here because they have created their hardware so that it can be given various different instructions that don’t only have to do with how a video or game is being processed. Although Nvidia is a leader for providing software for deep learning, they also have more expensive products than their competitors for this same reason.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VYcYXp2YFcVpO5uPy6gcSA.jpeg" /><figcaption>RTX &amp; GTX Graphics Card (Photo Credit: <a href="https://unsplash.com/photos/A1blvxJxGU0">Nana Dua</a>)</figcaption></figure><p>I might just be a typical fanboy, but I am AMD all the way. If you’ve never heard of AMD, they are a company that specializes not only in CPUs, but GPUs as well. In the last few years they have been able to scale their products to outperform big players such as Intel, and in some cases Nividia as well. The only problem here is AMD has not focused on deep learning, and focuses more on computer performance for things such as gaming and graphic design.</p><p>The reason I love AMD so much is that I am a gamer at heart. Before I started learning about deep learning and neural networks, I was really into computer hardware in order to increase my performance in games such as Fortnite and League of Legends. The problem I had, like many other gamers, is that gaming computers are often priced much higher than traditional computers and gaming consoles due to the hardware they pack inside. That being said, I was a little discouraged considering modern Intel CPUs can cost between $200–$1000 while Nividia GPUs cost between $500–$1200. And remember, these are just 2 of the 6 or 7 parts you would need to build a computer. However, as I did more and more research, I started learning more about how AMD uses its competitor&#39;s prices to their advantage. AMD offers hardware that is identical, if not better in performance then these other leading brands, but for a <em>fraction</em> of the price. After doing months of research, I ended up buying the Ryzen 7 2700x 8-core CPU ($200) and the RX 580 8gb GPU ($220). To compare these with their competitors, Intel offers an 8-core CPU that is priced at $350+ while Nvidia offers GPUs with an almost identical performance for $400+. Because of AMD, I was able to build my very own computer that is powerful <em>and </em>costed much less than if I had gone with Intel or Nvidia.</p><p>However, once I started getting into deep learning and data science in general, I was very disappointed to read that TensorFlow and other popular packages are only capable of working with CUDA cores - Nvidia&#39;s technology. This made no sense to me because performances between Nvidia and AMD are so minuscule that you can barely feel the difference when playing computationally-intensive video games, so why can’t you do deep learning on AMD GPUs? The answer here is not because they are not capable or lesser than their competitors, but because AMD has not really spent the money nor manpower into developing these types of software like Nvidia has done.</p><p>This brings me to PlaidML, the best open-source library I have ever used. PlaidML allows people to utilize their Intel and AMD hardware the same way you would if you had a Nvidia graphics card. Like TensorFlow, PlaidML sits as a backend for Keras, allowing for computations to take place on your graphics card rather than your CPU. In this tutorial, I will show you how to set up PlaidML, and how it can speed up training by almost 4x or more than compared to using just your CPU.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pPRaKKKOoIRFp9x-W7vIGg.png" /><figcaption>PlaidML Logo (<a href="https://github.com/plaidml/plaidml">Github</a>)</figcaption></figure><p>Before typing in the code below, I recommend creating a virtual environment so that you can isolate these changes in case you want to revert back to the old version.</p><p>In your terminal, install PlaidML using:</p><p>pip install -U plaidml-keras</p><p>After installing PlaidML, you must configure the hardware in your computer by typing the following into your terminal:</p><p>plaidml-setup</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/659/1*plGIn2he0BvAODjdCDUucA.png" /></figure><p>When being prompted with this message, type in y (yes) and press enter. You will then be prompted with another screen showing the different options you have to choose from. It should look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/608/1*t9pLKPIjn4sMqEpbajC0yQ.png" /></figure><p>The graphics card on my current machine is Intel HD Graphics 4000. This may look different then what you see in your terminal but either way, select the option with OpenCL then press enter.</p><p>And that’s it!!</p><p>After you have PlaidML installed, run the following code:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/15a6c43a52cfe06640710b32bcbadf3c/href">https://medium.com/media/15a6c43a52cfe06640710b32bcbadf3c/href</a></iframe><p>After running the cell above, you should see the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1009/1*vfL2bY8cueRKhMIXakiyIg.png" /><figcaption>Using PlaidML as Keras backend</figcaption></figure><p>As you can see, instead of showing TensorFlow as the backend, we successfully changed it to PlaidML. Now, whenever you run a cell with a neural network it will utilize the graphics card you specified during setup instead of your CPU.</p><p>I want to note that this tutorial was done on Mac OS. On my gaming computer which runs on Windows 10, this was a little bit trickier to accomplish. If you are using a Windows machine, follow the same steps as you would with Mac. If you run the cell above and it still says TensorFlow backend, then you must find the keras.json file and change the backend from “TensorFlow” to “plaidml.keras.backend”.</p><p>Although this package will help speed up training by 4x or more, you still might run into memory issues depending on what graphics card you are using. I also want to point out that a lot of laptops and desktops are not made to handle such computations, so I would recommend installing third-party software that monitors temperatures within your computer. If you are training for more than 30 minutes and see either your CPU or GPU go above 90–100 degrees, I would stop the training and find an alternative method as you do not want to damage your computer (especially with macs…. the worst cooling in the industry).</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ce22b58ba8c2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/plaidml-deep-learning-on-a-budget-ce22b58ba8c2">PlaidML: Deep Learning on a Budget</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Image Classification: Using AI to Detect Pneumonia]]></title>
            <link>https://medium.com/data-science/using-ai-to-detect-pneumonia-3ec4601acd07?source=rss-caf4b32fe258------2</link>
            <guid isPermaLink="false">https://medium.com/p/3ec4601acd07</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[medicine]]></category>
            <category><![CDATA[ai-medical-imaging]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Samuel Mohebban]]></dc:creator>
            <pubDate>Mon, 20 Jul 2020 12:34:57 GMT</pubDate>
            <atom:updated>2020-07-20T18:48:22.133Z</atom:updated>
            <cc:license>http://creativecommons.org/licenses/by/4.0/</cc:license>
            <content:encoded><![CDATA[<h4>Implementing a Neural Network with Python (Keras) to Classify X-Ray Images</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kRmdHCnsFKBQa2t_i6le3Q.png" /><figcaption>Normal Lung (Left) vs. Pneumonia (Right) (<a href="https://www.drbeen.com/blog/the-basics-of-chest-x-ray-interpretation/">Source</a>)</figcaption></figure><p>In <a href="https://medium.com/the-sports-scientist/using-ai-to-hack-your-fantasy-lineup-2fe022886769">my last blog</a>, I showed you guys how to create a neural network that can predict an NBA player’s performance on any given night. Although it was a very fun project, I was unable to test it on a regular-season due to COVID-19. Considering the global pandemic, I was really hesitant about starting a new project as this year can be considered an outlier in not just sports, but also for financial and sentiment analysis. With this problem, I started searching through Kaggle and came across a data set filled with X-ray images of both normal and non-normal lungs (Pneumonia). This intrigued me, so I continued searching for more databases and found more labeled photos. I was able to combine two datasets into a single folder (no duplicates), totaling to 6,000 images. Using these images, I will show you how to create a Convolutional Neural Network that can predict whether a person has Pneumonia with a ~98% accuracy (test set).</p><p><strong>Datasets</strong></p><ul><li><a href="https://www.kaggle.com/praveengovi/coronahack-chest-xraydataset">Kaggle </a>CoronaHack</li><li><a href="https://github.com/HeeebsInc/covid-chestxray-dataset">GitHub </a>COVID Dataset</li><li><a href="https://drive.google.com/drive/folders/1XsUTrl65JuLQvQeoSGvxqPHvZCWb6tM7?usp=sharing">GoogleDrive </a>(contains combined datasets, pickles, and csv with image paths/labels)</li></ul><h3>Convolutional Neural Network</h3><p>Although we see images with color and shapes, in their most basic level they are lists of numbers, each number corresponding to an RGB value which is then processed by your computer to show you the image. Convolutional neural networks have gained traction in image processing because they are able to split the RGB array into (1x1), (2x2), or (3x3) pixels in order to learn patterns within an image</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Thdyo1SzUtPUNJHj3Y4WzQ.png" /><figcaption>Image Taken From <a href="https://www.mdpi.com/2076-3417/9/21/4500/htm">Van Hiep Phung, et. al</a></figcaption></figure><p><em>**All the code shown below can be found on my </em><a href="https://github.com/HeeebsInc/NN_Pneumonia_Detection"><em>GitHub</em></a><em>***</em></p><h3>Code</h3><p>The dataset with the .csv was too large to upload to my GitHub, so instead, I made it public on my <a href="https://drive.google.com/file/d/1QM5NqLIFuYIwCjUwtl5jM24YVHs3L4Kb/view?usp=sharing">GoogleDrive</a>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3a7d015eaa05a74fcc971baeed90f99c/href">https://medium.com/media/3a7d015eaa05a74fcc971baeed90f99c/href</a></iframe><p><strong>Packages</strong></p><ul><li>Sklearn</li><li>Keras</li><li>Tensorflow</li><li>Pandas</li><li>Numpy</li><li>Pickle</li><li>Matplotlib &amp; Seaborn</li></ul><h4>Train Test Split</h4><p>Because this is my first image classification project, understanding an architecture for properly splitting the data into test and train took me a few hours to grasp- especially since I gathered data from <em>multiple </em>sources. The approach I ended up taking was this:(1) I first created a CSV file with the paths and labels for each image (2) Split the train and test as I normally would, stratifying each group based on their labels, (3) Then I iterated through each image path and extracted its RGB values</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d77da8b9383a654f8ecb99e67792932c/href">https://medium.com/media/d77da8b9383a654f8ecb99e67792932c/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/538/1*LnMX8rogDpBvXMOvMLtufw.png" /><figcaption>X Train Class Frequencies</figcaption></figure><p>Grabbing each image and its RGB array can take a few minutes depending on the speed of your computer, so I pickled each sample to avoid doing this every time I wanted to train a new model (<a href="https://drive.google.com/drive/folders/1XsUTrl65JuLQvQeoSGvxqPHvZCWb6tM7?usp=sharing">GoogleDrive</a>).</p><p>After saving the pickles, it is now time to move onto building the neural network. Below is a screenshot of the model architecture. ReLU activation function was used for every layer except the output layer. Sigmoid was used for the activation layer because the classification set is binary.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/467/1*xhysNWdve4qEKQpJSW31VA.png" /><figcaption>CNN Model Architecture</figcaption></figure><p>I found sigmoid activation to be better for this model as it is more accurate for binary classification. If you were to tweak this model to predict the type of pneumonia (viral, fungal, etc.), then a softmax activation would be better for the output layer, and using categorical_crossentropy would be better than binary_crossentropy.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b3e05d2aa3bf505976f538e4a24c9094/href">https://medium.com/media/b3e05d2aa3bf505976f538e4a24c9094/href</a></iframe><p>Running the cell below in the same notebook with start the training process. early_stopping will prevent the model from overfitting while model checkpoint saves weights every time val_loss decreases.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/079d27a82e99569839324fc39ab4eff7/href">https://medium.com/media/079d27a82e99569839324fc39ab4eff7/href</a></iframe><h4>Model Evaluation</h4><p>The model checkpoint parameter was able to stop the model at 30 epochs to prevent from overfitting further. Looking at the graph below, we see the train and test accuracy remained steady above 96%. However, one thing I learned is never to take accuracy at face value. To better investigate the model’s performance, I plotted AUC, ROC, and decision boundary curves to determine how the model changes using different thresholds. Again, all the code for these graphs can be found on my <a href="https://github.com/HeeebsInc/NN_Pneumonia_Detection">GitHub</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*p1t4oGohDiID-BZQaCCARA.png" /><figcaption>Validation/Training Loss and Accuracy</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OS3ENMY-8IrYzX1-tFvCkg.png" /><figcaption>F1, AUC, ROC Score</figcaption></figure><p>The model had F1, AUC, and ROC scores of .935, .972, and .994 respectively.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/456/1*4wLy8xek9R7JKhFAa4h2YQ.png" /><figcaption>TPR and FPR vs. Thresholds</figcaption></figure><p>Before choosing a threshold, it is first important to understand the context of the problem you are trying to solve and how this can affect your desired outcome. In our case, we wish to classify Pneumonia when it is present. On the other hand, it is not so bad if we classify a normal lung as having pneumonia as long as we are detecting pneumonia more often than not. Deciding the decision threshold for this problem is choosing between the best that yields the lowest <em>cost- </em>which differs in every machine learning problem. Below, you can see the confusion matrix for the different thresholds .2, .5, and .6</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/783/1*W4iSvdcF8XOXON1lG_KJXA.png" /><figcaption>Confusion Matrix with different thresholds</figcaption></figure><p>To test the model on outside data, I gathered 17 images from Google and used a probability threshold of .65. As you can see below, the model had a 100% True Positive rate and 56% True Negative rate. If you download the code in my repo, there is a folder where you can try a prediction yourself. All you have to do is download the image, name the file normal or non-normal to remember its label, then run the <a href="https://github.com/HeeebsInc/NN_Pneumonia_Detection/blob/master/CNN.ipynb">code</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/806/1*VYBo48y5yQGuH0xiI7vUuw.png" /><figcaption><a href="https://github.com/HeeebsInc/NN_Pneumonia_Detection/blob/master/CNN.ipynb">Predictions using images from Google</a></figcaption></figure><h4>Future Directions</h4><ul><li>Classify the type of Pneumonia (Viral, Fungal, etc.)</li><li>Use grey-scale (1D array)</li><li>Apply <a href="https://machinelearningmastery.com/smote-oversampling-for-imbalanced-classification/">SMOTE</a> to alter class imbalances</li><li>Use larger images with dimensions of (96,96,3) or (204, 204,4). I initially tried using larger dimensions but my computer was too low. Having larger images can make detection more accurate as there is more detail than the latter.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3ec4601acd07" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/using-ai-to-detect-pneumonia-3ec4601acd07">Image Classification: Using AI to Detect Pneumonia</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using A.I. To Hack Your Fantasy Lineup]]></title>
            <link>https://medium.com/the-sports-scientist/using-ai-to-hack-your-fantasy-lineup-2fe022886769?source=rss-caf4b32fe258------2</link>
            <guid isPermaLink="false">https://medium.com/p/2fe022886769</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[basketball]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Samuel Mohebban]]></dc:creator>
            <pubDate>Mon, 29 Jun 2020 18:43:43 GMT</pubDate>
            <atom:updated>2020-07-01T22:04:04.903Z</atom:updated>
            <cc:license>http://creativecommons.org/licenses/by/4.0/</cc:license>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*9T7hpticbre-2zR0tWTbPg.jpeg" /><figcaption>Photo Credit: <a href="https://www.spencertom.com/2019/06/29/statistics-101-multivariate-regression-and-interpreting-regression-results-part-3-of-3/">Jason Oh</a></figcaption></figure><p>In my last <a href="https://medium.com/@HeeebsInc/using-machine-learning-to-predict-daily-fantasy-basketball-scores-part-i-811de3c54a98">blog</a>, I showed you how to scrape seasons worth of NBA data. In this tutorial, I will show you how to use that data in your very own machine learning model. I will implement three types of models in this tutorial: (1) Linear Regression, (2) Artificial Neural Network (ANN), and (3) Multivariate-Recurrent Neural Network (LSTM-RNN)</p><p>Before we get into coding each model, I will <em>briefly </em>go over the advantages and disadvantages of each and how they can be useful for predicting fantasy sports.</p><h3>Multivariable Linear Regression Model</h3><p>As the name implies, this model fits your data in terms of a linear relationship. Like the famous equation we all learned in high school: y = mx + b, a multivariate regression applies this concept within multiple dimensions. This method is used to measure relationships between more than one independent variables (inputs) and one or more dependent variables (outputs).</p><p>In our case, this model is useful because we will be using multiple inputs (player average stats: rebounds, assists, etc.) in order to predict an output with a continuous value (fantasy points scored).</p><p><strong>Advantages</strong></p><ul><li>Very easy to create</li><li>Requires minimal computational power when compared with Neural Networks</li></ul><p><strong>Disadvantages</strong></p><ul><li>Can only capture linear relationships</li><li>Deals with noise and outliers poorly</li></ul><h3>Artificial Neural Networks (ANN)</h3><p>AAN is the most basic type of neural network architecture. In Neural Networks, patterns are learned using input, hidden, and output layers. In each layer, there are nodes that compute an activation function, providing the next layer with their output. Think of the input layer as the number of inputs you use to create an output. In our case, this layer will consist of 16 nodes corresponding to 16 different stats per player (vectors). For the hidden layers, this varies depending on the complexity of the problem and the computational power you have available. Within each node inside the hidden layers, an activation function is defined (ReLU, LeakyReLU, Sigmoid, etc.), which computes a given weight for an input. This process is repeated across every layer, hundreds or even thousands of times until the network finds optimal weights for each vector. In our case, the network will attempt to place a weight on each input variable (stat types) and use that weight to make future predictions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/659/1*3fA77_mLNiJTSgZFhYnU0Q@2x.png" /><figcaption>AAN Architecture (Photo Credit: <a href="https://www.analyticsvidhya.com/blog/2014/10/ann-work-simplified/">TAVISH SRIVASTAVA</a>)</figcaption></figure><p><strong>Pros</strong></p><ul><li>great for categorical and binary classification</li><li>Can learn complex and non-linear relationships</li></ul><p><strong>Cons</strong></p><ul><li>Requires a lot of data and takes a lot of time to train</li><li>Very easy to overfit (too many epochs, low batch size, etc)</li><li>Requires substantial computational power and sometimes specific hardware depending on the model (GPU)</li></ul><h3>Multivariate-Recurrent Neural Network (LSTM-RNN)</h3><p>Multivariate RNN is very similar to ANN and widely used for predicting sequential data. Instead of using a single feed-forward approach (like ANNs), RNNs use a chain-link which acts as a memory process for understanding conditional patterns. In order to do this outputs are shared between nodes, unlike ANNs where nodes act independently from one another.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*6bnC0MXi9BmbB6x8KYkHYQ.jpeg" /><figcaption>RNN with 1 hidden layer (Photo Credit: <a href="https://medium.com/intro-to-artificial-intelligence/entity-extraction-using-deep-learning-8014acac6bb8">Dhanoop Karunakaran</a>)</figcaption></figure><p><strong>Pros</strong></p><ul><li>Ideal for mixed inputs (continuous and categorical)</li><li>Popular for language processing and sequential time-series predictions</li></ul><p><strong>Cons</strong></p><ul><li>like other neural network architectures, these require a lot of data</li><li>Require more computational power than ANN as layers increase in size</li><li>Prone to over-fitting</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*ThnGnjnLORWlzJq7FPc5rQ.jpeg" /><figcaption>Photo Credit: <a href="https://www.disruptiveadvertising.com/author/radu-vrabie/">Radu Vrabie</a></figcaption></figure><p><em>**Check out my </em><a href="https://github.com/HeeebsInc/NN_FantasyBasketball/tree/master"><em>GitHub repository</em></a><em> to follow the code implemented in this project**</em></p><p>In addition to the game stats we scraped in the first tutorial, we will also use fantasy stats (player salary, salary change, and fantasy points scored). A problem I found with incorporating this data is that fantasy websites like DraftKings and FanDuel do not post past stats, making web-scraping an unviable option. To get this information, I purchased data from <a href="http://rotoguru.com/">rotoguru.com</a>; a website that hosts fantasy stats dating as far back as the early 2000s.</p><p>Once I had the fantasy stats for each season, I performed an inner join on player_name, gameID, and date. Giving me a data frame with a shape of (48204,31)- 48,204 rows and 31 columns.</p><p>As input variables for each model, we will use the stat averages over the last 2 games. The reason I decided on 2 games is that injuries tend to skew the averages over longer time periods giving inaccurate predictions. For the output variable, we will use the amount of FanDuel points scores. To make this logic more clear, we will be using a players stat averages over the last 2 games to predict their current fantasy performance.</p><p>To get stat averages for each player, I iterated through each unique name in the data frame, making a new data frame consisting of every data point for a single player. Once I had that data frame, I looped over each row (skipping the first two), and calculate the average for each stat and appending it into its own column. On my GitHub, I show the full notebook which allows you to choose the number of games you want to use for the averages.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/796d62c62d1cbf40e516fd024ca93342/href">https://medium.com/media/796d62c62d1cbf40e516fd024ca93342/href</a></iframe><p>The data frame will now have almost twice as many columns, with the second half of the new table looking like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IRw2x9CiD9PdUtYIytBpcw.png" /></figure><p>Now that we have formatted the data, we can move onto actually creating and training different models.</p><h3><strong>Load and Organize Data</strong></h3><p>In this step, we will load our merged data, split it into train and test set, then visualize the distributions for fantasy points scored.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/27bc48ea4b31c120fc2a26bc1e785faf/href">https://medium.com/media/27bc48ea4b31c120fc2a26bc1e785faf/href</a></iframe><p><strong>Distributions:</strong></p><p>Looking at the distributions, we see there are a lot of rows where the player scored 0 fantasy points. Although we can assume this will cause an accuracy problem, lets include these points in the linear model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/632/1*i3iEEpZ4_Kq9f0xKyh-SeA.png" /><figcaption>Fantasy Point Distribution</figcaption></figure><h3>Linear Model</h3><p>One of the benefits of creating a linear model is how easy and fast it is to do it. Shown in the code snippet below, this can be done in just a few lines of code.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/33f2be0a23a168389b3ee1bce68c5fcd/href">https://medium.com/media/33f2be0a23a168389b3ee1bce68c5fcd/href</a></iframe><p>Below is a picture of a scatter plot for the predictions vs. actual values. The threshold for being a good prediction was 7 points; meaning, if actual points were 30 and the algorithm predicted anything between 23 and 37, it counts as a good prediction (green). Although there can be issues with this in terms of optimization, I only used it to create visualization so it is easier to see where where the model made a <em>useful </em>prediction.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/962/1*Z_CQ9RKdxjb36M_51MZqlA.png" /><figcaption>Linear Model: Scatterplot for Predicted vs. Actual</figcaption></figure><p>A really great tool within Sklearn’s linear regression models is finding each vector’s coefficient. The coefficient for a vector is similar to a neural network’s weight, in that it is associated with its strength for predictions. Below is a bar graph illustrating each vector’s weight for predictions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/766/1*qcnRdsoRIy4nLFYOfUvTVg.png" /></figure><p>As we can see, averages for minutes played, total rebounds, assists, steals, blocks, 2-pointers, and fan duel points have the greatest effect on predictions.</p><h3>ANN Model</h3><p>For <strong><em>both</em></strong> neural network models of this project, we will use the same data except we will ignore every row where FanDuel points = 0. The reason we are doing this is to capture a better fit for the model and thus make better predictions. Before creating and fitting the ANN model, we must preprocess our data using Sklearn’s preprocessing module. In this project, we used MinMaxScaler but feel free to try others to see if you get more accurate predictions.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ca803d8251641144b75cb847bbd9bc08/href">https://medium.com/media/ca803d8251641144b75cb847bbd9bc08/href</a></iframe><p>After running the code above for 50 epochs, we see that it preformed almost identically with the linear model showing a loss of 110.53 validating the test set. We can also see that the model started overfitting our data at about the 9th epoch.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/585/1*21uy_mQ-GJ5oTo79SYB3Dw.png" /><figcaption>Loss/Validation ANN</figcaption></figure><h3>Multivariate RNN Model</h3><p>Like the previous ANN model, you must first normalize your data using MinMaxScaler() and separate your data into a training and test set. Before plugging in x_train and y_train into an RNN model, you must first reshape each x array (x_train, x_test) to be 3 dimensional such that the shape is (# samples, time steps, features). In this example, # of samples will be the number of rows, time steps will be 1, and features are 15 (each player feature).</p><p>Although the model performed the best out of three, it still shows a pretty big loss. Similar to the ANN model, we see the RNN model began overfitting at around 10 epochs; however, validation loss consistently stayed below 100 MSE.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ef252752fc9d643e25a1df5f9f473c3d/href">https://medium.com/media/ef252752fc9d643e25a1df5f9f473c3d/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/580/1*EKANs5D8d3m3eZq52TiRNQ.png" /><figcaption>Loss/Validation RNN</figcaption></figure><h3>Conclusion</h3><p>Comparing the loss between each model, the best turned out to be RNN (by a marginal difference). What we can conclude from these values is that there is no latent pattern within our dataset. A takeaway from this project is that predicting continuous values in AAN is no different than predicting values using a linear regression (in most cases). However, I do still believe there is an application of RNN in fantasy basketball due to the sequential nature of the data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/508/1*kgcxV94h8JpAnbx-0yR4Pg.png" /></figure><h3>Future Directions/Optimizations</h3><ul><li>More data points! (Include more categorical data)</li><li>Reorganize the population data so that there are multiple samples rather than just one.</li><li>Increase timestep from 1 to 10 or more.</li><li>In the future, I plan to include another column using home and away, as well as the number of games each player participated in over the last week. This statistic will be different than the averages because it shows whether a player has played many games, consequently leading to poorer performance (fatigue). In the NBA, some teams will play 3–4 games a week while others can play two with larger breaks in between. These differences could illustrate a pattern that would be useful for training an RNN</li><li>We could also use an RNN to predict a single player’s performance. In this method, we will sample the population to gather hundreds of datasets comprising of only a single player, then run an RNN on that data frame. By doing this, the algorithm may be able to understand patterns of a single player rather than those of the entire league.</li></ul><p><em>**Check out my </em><a href="https://github.com/HeeebsInc/NN_FantasyBasketball/tree/master"><em>GitHub repository</em></a><em> to follow the code implemented in this project**</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2fe022886769" width="1" height="1" alt=""><hr><p><a href="https://medium.com/the-sports-scientist/using-ai-to-hack-your-fantasy-lineup-2fe022886769">Using A.I. To Hack Your Fantasy Lineup</a> was originally published in <a href="https://medium.com/the-sports-scientist">The Sports Scientist</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using Machine Learning to Predict Daily Fantasy Basketball Scores (Part I)]]></title>
            <link>https://medium.com/@HeeebsInc/using-machine-learning-to-predict-daily-fantasy-basketball-scores-part-i-811de3c54a98?source=rss-caf4b32fe258------2</link>
            <guid isPermaLink="false">https://medium.com/p/811de3c54a98</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[fantasy-basketball]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Samuel Mohebban]]></dc:creator>
            <pubDate>Tue, 02 Jun 2020 16:56:35 GMT</pubDate>
            <atom:updated>2020-06-10T12:47:51.280Z</atom:updated>
            <cc:license>https://creativecommons.org/licenses/by-nc/4.0/</cc:license>
            <content:encoded><![CDATA[<h3>Machine Learning in Fantasy Basketball: Data Collection Using BeautifulSoup</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1N3JCDs2D8yUoVvPzuLzWA.jpeg" /><figcaption>Applies to FanDuel/DraftKings/Yahoo (<a href="https://www.thestreet.com/investing/draftkings-fanduel-play-high-stakes-ipo-game-as-fantasy-sports-yahoo-face-investigation-13372916">Image</a>)</figcaption></figure><p>This project is a great start for beginners as it was the first machine learning project I ever did. Completing this project allowed me to grasp the fundamentals of BeautifulSoup, Pandas, NumPy, and Scikit-Learn — all of which are extremely important in data science. Before I go into the code, it is important to first understand the goals of the projects, as well as the data required to accomplish them. The architecture of this project is inspired by a <a href="http://cs229.stanford.edu/proj2015/104_report.pdf">Stanford article</a>; which I recommend reading to get a better understanding as you attempt to do it yourself.</p><p>In every machine learning application, there are at least two critical phases: (1) Training and (2) Testing. The most common way to accomplish both is to first gather data, then split that data into a test and training set. In the training test, the model will be given <em>both</em> inputs and outputs which will be used to form predicitions on data that is unlabeled or contains no output. If this sounds confusing to you its okay, I will go over this concept in more depth in the next few parts.</p><p>When I first started this project, data collection was the hardest part. I searched so many websites to see if I could find multiple seasons worth of NBA scores and was surprised to see how complicated it could be. In the article I linked above, the authors mention they scraped their data from ESPN.com, which I could not do because the website changed completely since the article publication. I then found other options that offered fixed pricing for labeled CSV files- but paying for my data seemed like the <em>lazy way out.</em> I finally came across <a href="https://www.basketball-reference.com/">https://www.basketball-reference.com</a>, which offers scores dating back to as long as 20 years ago!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k0mURu1QYg2RE84ymIDTPg.jpeg" /></figure><p><em>***Code in this article can be found on my </em><a href="https://github.com/HeeebsInc/MLFantasyBasketball"><em>GitHub</em></a><em>***</em></p><h4>Python Libraries</h4><ul><li>Beautiful Soup (pip install bs4)</li><li>Pandas (pip install pandas)</li><li>Requests</li></ul><p>When thinking about <em>how much </em>data I could scrape, I considered how far back do I have to go to determine if a player will be good today? Using the Stanford article as a reference, I ended up at two seasons. The reason I chose two is because although many players are stars throughout their career in the NBA, daily fantasy basketball is targeted more towards picking the <em>wildcards</em> that are inexpensive and score a lot of points. Moreover, sometimes the most valuable players are those that do not play much at all, so too much data could actually hurt these types of predictions. If you play fantasy basketball then you know what I am talking about, otherwise, this article is probably putting you sleep.</p><p>The code I implement below is meant to scrape a single season, so if you wish to scrape more than one season just run the code below with different initializing URLs.</p><p>So we are on the same page throughout the tutorial, I started my scraping on <a href="https://www.basketball-reference.com/leagues/NBA_2020_games.html">this url</a>. As you can see, this page shows a chart of every game and links the box score for each. On the top of the chart, the page also features each month of the season where the same box score format is repeated (see pictures below).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1010/1*glEsUtim8AxmLdSt5RoLqQ.png" /><figcaption>Example of season format (<a href="https://www.basketball-reference.com/leagues/NBA_2019_games.html">link</a>)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*MQ4L1ekcWvsJIf_GjYBjKQ.png" /><figcaption>Example of box scores for each game (<a href="https://www.basketball-reference.com/boxscores/201810190TOR.html">link</a>)</figcaption></figure><p>The way we will scrape the website is as follows. First, we will create a list that houses the links for each month of the season. For example, the first link will be the October page, the second will be the November page, and so on. After we have a list of each month’s url, we will iterate through the list and visit each page. So the first visit will be the page pictured above for the month of October. On each month page, we will then iterate through every box score and save the url in another array. After we have the array of every single box score for the entire season, we will visit each url and scrape the data for the game. The reason I first saved all of the box score urls in a seperate array is because you will find that scraping each players scores for each game across an entire season can take a very long time depending on your computer (25,000+ data points per season). So by saving all the links to an array first, you can stop the program if you need then start it up at the same index at which you stopped. You will see what I mean later-on.</p><p>Before we begin the main script, create a file called mVariables.py. In the file, copy and paste the code snippet below. This portion is just used for formatting of the data so it is cleaner when it is saved in the csv.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f8fc33d92135404e3f6b6577c990b5d3/href">https://medium.com/media/f8fc33d92135404e3f6b6577c990b5d3/href</a></iframe><p>Now that we have created a mVariables.py file with all the necessary dictionaries, create another file called mScraper.py. On top of the file, import the following:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/13ffc8b67f8289c34639328995ed8637/href">https://medium.com/media/13ffc8b67f8289c34639328995ed8637/href</a></iframe><p>After we have the dependencies imported, it is now time to move onto the actual script. To make it easier to follow, I decided to condense the entire process into a single function. Of course you could separate the function into numerous different one and apply pool processing but I just want to keep it simple for the sake of the tutorial.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/be509c56b2bdf9a675be1df661213162/href">https://medium.com/media/be509c56b2bdf9a675be1df661213162/href</a></iframe><p>In the snippet above, we created a function that takes a base url. For our example, this URL will be the <a href="https://www.basketball-reference.com/leagues/NBA_2019_games.html">October page </a>for the 2018–2019 season. If you wish to scrape another season just feed it the url for the first month in that season. The function then creates a month_link_array which houses the url link to each month, which we will then iterate through (code snippet below) to collect each box score url.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3b9185112e35c85419ad01450d3ade40/href">https://medium.com/media/3b9185112e35c85419ad01450d3ade40/href</a></iframe><p>In the snippet above, we created an array called box_link_array, which houses all the links to each box score for the entire season. In the next part, we will again iterate through each box score and scrape the game data on each (this is the part that takes quite a bit of time).</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ad536cbeb0b66e711b615a3dd148c717/href">https://medium.com/media/ad536cbeb0b66e711b615a3dd148c717/href</a></iframe><p>Here, we separated each player within a game to a separate array, then added each element of the array (box score) to a pandas data frame. Because we scraped the advanced stats on the website, these are the columns that we focused on:</p><h4>Columns:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/564/1*ped_w_-p0_9gKwMUKHvbrw.png" /><figcaption>CSV Columns</figcaption></figure><p>Once you have that down your scraper is complete! On the same file, call the season_stats_getter(url) function on the bottom of the page as shown below. We added an enumeration for loop above so that you can track the position in the array in case you need to pause and restart later. I have used this script to successfuly scrape numerous seasons but just in case, I would recommend adding a try and except statement to protect against a hard stop.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d555a458c92138c18376e80847ef9202/href">https://medium.com/media/d555a458c92138c18376e80847ef9202/href</a></iframe><p>In the terminal, navigate to the project directory and type in python3 mScraper.py and press enter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c-tYgYr_JFfGcdc7Sl9lrw.png" /><figcaption>Terminal Example</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/849/1*LtFE_EEdMIdbSDcS2C71ag.png" /><figcaption>CSV File (<a href="https://www.kaggle.com/heeebsinc/nbaseasonstats201820">Kaggle</a>)</figcaption></figure><p>And Voila! You have created a web scraper that can handle <em>any </em>season on <a href="https://www.basketball-reference.com/">https://basketball-reference.com</a>. After you successfully run the program for a single season, you will see that that the resulting csv file can consist of 25,000+ data points. So, between two seasons, 50,000 data points should be sufficient for training our ML algorithm.</p><p>Although the function is pretty long, when you split it up into smaller parts it is not as complicated as it seems. There are surely many ways to make it faster and more memory efficient — so please comment below and share your optimization practices!</p><p>This section of the tutorial was not ML heavy, however, it is considered to be one of the most important steps in developing a reliable model. In the next steps of this project, I will use this data to implement regression algorithms to predict which players will score the most fantasy points on a given night. After, we will explore constraint satisfaction (CSP) to determine a lineup consisting of the best possible combination of players on a given night.</p><p>Check out my <a href="https://github.com/HeeebsInc/MLFantasyBasketball">GitHub</a> to see the code for this project! You can also visit my <a href="https://www.kaggle.com/heeebsinc/nbaseasonstats201820">Kaggle</a> to access the full csv files I scraped from my local computer as well as other data sets I have used in different projects.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/664/1*8ahwzMWubyfM7m4bzu0rSA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=811de3c54a98" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>