<?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 Amro Kamal on Medium]]></title>
        <description><![CDATA[Stories by Amro Kamal on Medium]]></description>
        <link>https://medium.com/@amrokamal-47691?source=rss-3bae1677b9db------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*vA10lRXMdwC13duA</url>
            <title>Stories by Amro Kamal on Medium</title>
            <link>https://medium.com/@amrokamal-47691?source=rss-3bae1677b9db------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 11:36:01 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@amrokamal-47691/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[Residual Blocks & ResNets]]></title>
            <link>https://amrokamal-47691.medium.com/residual-blocks-resnets-6817090ff61a?source=rss-3bae1677b9db------2</link>
            <guid isPermaLink="false">https://medium.com/p/6817090ff61a</guid>
            <category><![CDATA[residual-block]]></category>
            <category><![CDATA[resnet]]></category>
            <category><![CDATA[vanishing-gradient]]></category>
            <dc:creator><![CDATA[Amro Kamal]]></dc:creator>
            <pubDate>Sun, 04 Apr 2021 17:13:37 GMT</pubDate>
            <atom:updated>2021-11-30T15:48:25.404Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NM9DV5oqlUdZ7TfEQZHsCg.png" /><figcaption>Marra Mountains (Sudan) <a href="https://www.youtube.com/watch?v=dLyyLjp43zI">source</a></figcaption></figure><p>When deep neural networks started to boom in 2012, after the disclosure of <strong>AlexNet </strong>(the winner of ILSVRC 2012), the common belief was training a deeper neural network (increasing the number of layers) will always increase the performance of the network, and a lot of researches showed that the depth of neural networks is a crucial ingredient for their success. <br>Since 2012, network depth has played one of the most important roles in the successes of deep learning.</p><p>AlexNet, with only 5 layers, achieved 17% top-5 error in ImageNet dataset. In 2014 the Visual Geometry Group at Oxford trained the VGG networks with 16 and 19 layers (7.3% top-5 error) following a similar architecture to AlexNet. In 2014 also, Google revealed its first inception model, Google Net (6.7% top-5 error), with 22 layers.</p><p>We can see that the error decreased from 16.4% for 5-layers network to 6.7% for 22-layers network.</p><blockquote>Indeed the network depth was not the only factor in increasing Conv nets performance as a lot of training tricks and method have been invented during this period, but network depth played and important role.</blockquote><p>The question now is, <strong>Is learning better networks as easy as stacking more layers? Is it just a matter of adding more and more layers?</strong></p><p>In 2015 researchers from Microsoft answered this question by training two networks on CIFAR-10 dataset, following the same general architecture for both, one with 20 layers and the other with 56 layers. The results, which look surprising, show that the network with the 20 layers outperforms the network with the 56 layers (similar results were achieved on ImageNet dataset).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/779/1*o7-UFyR68OIsrkc81R00ig.png" /><figcaption>Figure 1 : training and test error for the 20-layers and 56-layers an CIFAR-10 dataset. The deeper network (red) has a higher error (image source: <a href="https://arxiv.org/abs/1512.03385">paper</a>)</figcaption></figure><h4>The Degradation Problem:</h4><p>These results show that getting a lower error is not just about adding additional layers to the network. As we see in the experiment, it seems that the shallower networks are learning better than their deeper counterparts and this is quite counter-intuitive. The phenomenon of having lower accuracy when increasing the number of layers is called the <strong>degradation</strong> problem. The figure below shows an approximation of how a conv net will perform when we go deeper by adding more layers to it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/622/1*qAtteBhY5QCosnzRWPSHhg.png" /><figcaption>Figure 2: The degradation problem</figcaption></figure><p>From the figure, we can see that when the network depth increases, the accuracy gets saturated and then degrades rapidly. This degradation in the accuracy happens when the model depth (number of layers) exceeds its limit.</p><blockquote>Also, we need to emphasize that this problem is not an overfitting problem since overfitting will make the training error very low, and the test error high, but here the even the training error is increasing (underfitting).</blockquote><h3>The solution:</h3><p>Now we need to find a way to optimize very deep networks and the goal of this solution is to make networks of hundreds of layers more accurate than shallower networks.</p><p>In 2015 a research group from Microsoft presented a solution to the degradation problem by introducing what is called ‘<strong>deep residual learning framework’</strong>.</p><p>They introduced the idea of directly connecting the input of layer <strong>(L)</strong> with the input of layer <strong>(L+k)</strong>, skipping <strong>k</strong> layers in-between. This connection is called residual connection, skip connection, or short-cut connection. It simply performs identity mapping, which is added to the output of the stacked layers before applying the activation function.</p><blockquote>The block of the k layers and the skip connection is called <strong>residual block</strong>. Usually the number of layer inside the skip connection is two or three.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/295/1*-jPXydy6fyWipy9k0eRA0A.png" /><figcaption>Figure 3: The architecture of VGG 19, 34-layers network without residual connections, and resnet-34 (image source: <a href="https://arxiv.org/abs/1512.03385">paper</a>)</figcaption></figure><p>We can understand the importance of these skip connections using different viewpoints:</p><h4>1-Simplifying the Learning of the layers inside the connection:</h4><p>Let us consider H(x) as an underlying mapping to be ﬁt by a few stacked layers (let’s say 2 layers) with x denoting the inputs to the ﬁrst layer of these layers. Instead of hoping these two layers (together) to directly fit the desired underlying mapping H(x), we explicitly let these layers fit a residual mapping H(x)-x, by map x directly from the input layers to the output layer as illustrated in the next figure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ocUr9dFlRq8DPddLcVBB2g.png" /><figcaption>Figure 4: Left: regular layers block, Right: Residual Block with two layers: The two layers between the skip connection will learn the residual mapping H(x)-x instead of learning H(x)</figcaption></figure><p>This residual learning framework is based on a hypothesize presented by the authors claims that it is easier to optimize the residual mapping H(x)-x than to optimize the original mapping H(x). The paper didn’t provide sufficient evidence for that, but in practice, residual mapping is often easier to optimize.</p><blockquote>This is how they explained this idea in the paper, although a better explanation could be what we are going to discuss in point (2) and (3) below.</blockquote><h4>2-Fighting Vanishing Gradient:</h4><p>IFor a network with <strong>N</strong> layers we use the gradient chain rule to update the weights of each layer using the formula :</p><p><strong>Wi= Wi -lr * dL/dWi</strong></p><p>where <strong>lr</strong> is the learning rate and <strong>dL/dWi</strong> is the gradient of the loss with respect to the weights at layer <strong>i</strong></p><p>Consider the 3-layers network in the diagram, where <strong>X</strong> is the input <strong>Wi</strong> is the weights in layer <strong>i</strong>, <strong>Zi</strong> is the output of layer <strong>i</strong> before the activation and <strong>Ai</strong> is the output after applying the activation function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*npfVvPYsU6mwUFiyxEYk8Q.png" /></figure><p>To find the derivative of the loss with respect to the <strong>W2</strong> we just follow the arrows :</p><p><strong>dL/dW2= (dL/dA3 x dA3/dZ3) x (dZ3/dA2 x dA2/dZ2) x dZ3/dW2</strong></p><p>This is a straightforward implementation of the chain rule. What is important here is that the (length) of this chain can be very long for updating the first layers in the deep network. This long chain of multiplication can cause problems if the numbers we are multiplying have small or large magnitudes. In this case, the result will be very small or very big number.</p><blockquote>Remenber that we need this number (gradient) to update the weights.</blockquote><p>Usually in neural networks, the elements in the chain are small numbers. When the result of multiplying the chain elements is too small either the computer will not be able to represent the number or the training will be very slow (remember that <strong>Wi= Wi -lr * dL/dWi</strong>). This problem is very common for deep networks. Since the gradient becomes very small, the problem is called the <strong>Vanishing Gradient </strong>problem<strong>.</strong></p><blockquote>If the gradient has very high magnitude, the network will face what is called <strong>exploding gradient.</strong></blockquote><p>The next figure shows how the gradient starts to vanish as we go back from the deeper layers (layer 7) to the shallower layers (layer 1).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1PesZaoObsACXVq8gW5n8w.png" /></figure><p>But when we do backpropagation after adding the skip connections, the gradient will pass to the weights of the layer through two paths which will result in reducing the probability of having a vanishing gradient. If the gradient in <strong>path-1</strong> starts to vanish adding the gradient from <strong>path-2 </strong>to it will reduce the probability of this new gradient vanishing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qDf7EIEgHlPsxH7o-VNruA.png" /></figure><p>Although the paper didn’t point at vanishing gradient as the main reason for the degradation problem, it is still one of the common problems that appear when we increase the depth of the networks.</p><h4>3-Simplifying the model:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/781/1*6wxhe_e1nM2ku_ShXaNzcA.png" /></figure><p>By using the skip connection we still can achieve a simple model (shallow model) even after stacking a lot of layers. If the model can find weights that make H(x)-x =0, this will act as the two layers between the connections don’t exist and this will be as we are using a shallower network.</p><h3>Residual Networks:</h3><p>Utilizing the idea of residual connections the authors trained some networks and called them ResNets. RestNets has a skip connection every 2 or 3 layers. Using a sequence of these residual blocks they trained very deep networks with more than 150 layers. The paper presents 4 version of ResNet with different number of layers, RestNet-34 (34 layers), RestNet-50 (50 layers), RestNet-101 (101 layers), and RestNet-152(152 layers).</p><p>The table below shows the top-1 and top-5 errors on ImageNet validation dataset for RestNets compared to the other famous networks like VGG and GoogleNet. We can see that ResNet had the lowest error at that time (2015).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/926/1*LzEEBBSd98zNCqCZ5xEs3A.png" /><figcaption>Figure 5: ImageNet error (image source: <a href="https://arxiv.org/abs/1512.03385">paper</a>)</figcaption></figure><blockquote>The table is up to 2015 (the date they published the paper) but today the idea of residual connections is used widely in most of the architectures after 2015.</blockquote><p>The graphs in figure 6 show the training error of the same base architectures with and without residual connection. We can see that without residual connection (left) the 18-layers network outperforms the 34-layers networks and both of them can not exceed 30% error.</p><p>When using residual connections (right) the 34-layers networks can easily outperform the 18-layers networks. We can see that using the residual connection the 34-layers network exceeded the 30% error rate.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QJc4prMrGPtQGLGh5M3yew.png" /><figcaption>Figure 6: (image source: <a href="https://arxiv.org/abs/1512.03385">paper</a>)</figcaption></figure><h4>Residual Networks Architecture:</h4><p>I will not talk in detail about the architecture of every network since there is nothing complex in the architecture. Generally, RestNets have fewer filters and lower complexity compared to VGG nets. For example, ResNet-34 has 3.6 billion FLOPs (multiply-adds), which is only 18% of VGG-19 (19.6 billion FLOPs).</p><p>Also, we can notice that they didn’t use pooling layers (except after the first conv layer) and they used a stride of 2 instead of that. Also, they used a global average pooling after the last conv layer to reduce the number of FC layers they need.</p><p>The table below summarizes the architecture of different versions of ResNet:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EMwB0zWH3rEfOrT9QNYvbA.png" /><figcaption>Figure 7: (image source: <a href="https://arxiv.org/abs/1512.03385">paper</a>)</figcaption></figure><h4>Resources:</h4><p><strong>1-Deep Residual Learning for Image Recognition (</strong><a href="https://arxiv.org/abs/1512.03385"><strong>paper</strong></a><strong>)</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6817090ff61a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[YOLO, YOLOv2 and YOLOv3: All You want to know]]></title>
            <link>https://amrokamal-47691.medium.com/yolo-yolov2-and-yolov3-all-you-want-to-know-7e3e92dc4899?source=rss-3bae1677b9db------2</link>
            <guid isPermaLink="false">https://medium.com/p/7e3e92dc4899</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[object-detection]]></category>
            <dc:creator><![CDATA[Amro Kamal]]></dc:creator>
            <pubDate>Sat, 03 Aug 2019 17:31:46 GMT</pubDate>
            <atom:updated>2021-11-12T16:25:31.100Z</atom:updated>
            <content:encoded><![CDATA[<h3>YOLO, YOLOv2, and YOLOv3: All You want to know</h3><figure><img alt="YOLO" src="https://cdn-images-1.medium.com/max/1024/1*bSLNlG7crv-p-m4LVYYk3Q.png" /></figure><p>During the last few years<strong>, Object detection </strong>has<strong> </strong>become one of the hottest areas of computer vision, and many researchers are racing to get the best object detection model. As a result, many state-of-the-art models are under development, such as RCNN, RetinaNet, and YOLO.</p><p>In this topic, we’ll dive into one of the most powerful object detection algorithms, <strong><em>You Only Look Once.</em></strong></p><h3>Object Detection:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/290/1*dB2Or2i2_GINm2UR0ktCXg.jpeg" /></figure><p>Given an image or a video stream, an object detection model can identify which of a <strong>known</strong> set of objects might be present and provide information about their <strong>positions</strong> within the image.</p><blockquote><strong>Object detection</strong> is different from<strong> classification with localization</strong>, where we need to classify a single object and determine the location of this object in the image.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*Mj8WKVKf_RpiAsX3SC1ZdQ.png" /></figure><p>Before diving into YOLO, we need to go through some terms:</p><p><strong>1-Intersect Over Union (IOU):</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/745/1*FqN8r1lTPiRJWqh2krrQzA.png" /></figure><p>IOU can be computed as Area of Intersection divided over Area of Union of two boxes, so IOU must be ≥0 and ≤1.</p><p>When predicting bounding boxes, we need the find the IOU between the predicted bounding box and the ground truth box to be ~1.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/420/1*89mVRI2rSbyjpkvujNnwxQ.jpeg" /></figure><p>In the left image, IOU is very low, but in the right image, IOU is ~1.</p><p><strong>2-</strong> <strong>Precision:</strong></p><p>Simply we can define precision as the ratio of <strong>true</strong> positive(true predictions) (TP) and the total number of <strong>predicted</strong> positives(total predictions). The formula is given as such:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/180/1*-Y2bLNfGDkcZ5BSPPzHBjQ.png" /></figure><p>For example, imagine we have 20 images, and we know that there are 120 cars in these 20 images.</p><p>Now, let’s suppose we input these images into a model, and it detects 100 cars (here the model said: I’ve found 100 cars in these 20 images, and I’ve drawn bounding boxes around every single car of them).</p><p>To calculate the precision of this model, we need to check the 100 boxes the model has drawn, and if we found that 20 of them are incorrect, then the precision will be =80/100=0.8.</p><blockquote>Here it is very important to notice that the precision ignores that the actual number of cars is 120.</blockquote><blockquote>we can consider the prediction as incorrect if the IOU between the predicted box and the ground truth box is less than the threshold value(0.5,0.75,…).</blockquote><p><strong>3-Recall:</strong></p><p>If we look at the precision example again, we find that it doesn’t consider the total number of cars in the data (120), so if there are 1000 cars instead of 120 and the model outputs 100 boxes with 80 of them are correct, then the precision will be 0.8 also.</p><p>To solve this, we need to define another metric, called the <strong>Recall,</strong> which is the ratio of <strong>true</strong> positive(true predictions) and the total of ground truth positives(total number of cars ’120’). The formula is given as such:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/198/1*nx6V3Q_EqnGWzcLfW_lL-A.png" /></figure><p>For our example, the recall=80/120=0.667.</p><p>Now we can notice that the recall measures how well we detect <strong>all</strong> the objects in the data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/350/1*kaqtNALKZujx1FGlbK11OQ.png" /><figcaption><a href="https://upload.wikimedia.org/wikipedia/commons/thumb/2/26/Precisionrecall.svg/350px-Precisionrecall.svg.png">Source</a></figcaption></figure><p><strong>4- Average Precision and Mean Average Precision(mAP):</strong></p><p>A brief definition for the Average Precision is the <strong>area</strong> under the <strong>precision-recall curve.</strong></p><p><strong>AP</strong> combines both precision and recall together. It takes a value between 0 and 1 (higher is better). To get <strong>AP</strong> =1 we need both the precision and recall to be equal to 1. The <strong>mAP</strong> is the mean of the AP calculated for all the classes.</p><h3>YOLO! What a name?</h3><p>Many object detection systems need to go through the image more than one time to be able to detect all the objects in the image, or it has to go through two stages to detect the objects. YOLO doesn’t need to go through these boring processes. It only needs to look once at the image to detect all the objects and that is why they chose the name (You Only Look Once) and that is actually the reason why YOLO is a very fast model.</p><h3>YOLO (The first version):</h3><p>YOLO divides the input image into<strong> SxS</strong> grid. For example, the image below is divided into <strong>5x5</strong> grid (YOLO actually chose S=7). If the center of an object falls into a grid cell, that grid cell is responsible for detecting that object (we assign the object to the grid cell where the center of the object exists).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/537/1*JqNCY3zzye7_RYuE35kmsg.jpeg" /><figcaption>5x5 grid</figcaption></figure><p>YOLO runs a classification and localization problem on each of the 7x7=49 grid cells simultaneously. Since the classification and localization network can detect only one object, that means any grid cell can detect only one object.</p><p>Because of this <strong>grid</strong> idea, YOLO faces some problems:</p><p>1-Since we use 7x7 grid, and any grid can detect only one object, the <strong>maximum </strong>number of objects YOLO can detect is 49.</p><p>2-If a grid cell contains more than one object; the model will not be able to detect all of them; this is the problem of <strong>close object detection</strong> that YOLO suffers from.</p><p>3-The object may be located in more than one grid (like the taxi in the image above), so the model may detect the taxi more than one time (in more than one grid), and this problem is solved using <strong>non-max suppression, </strong>which we will talk about later.</p><p>All of the 49 cells are detected simultaneously, and that is why YOLO is considered a very fast model.</p><p>Each of the 7x7 grid cells predicts <strong>B </strong>bounding boxes(YOLO chose B=2), and for each box, the model outputs a <strong>conﬁdence score ©</strong>. These conﬁdence scores reﬂect how conﬁdent the model is that the box contains an object. Using this score, we can prevent the model from detecting backgrounds, so If no object exists in the cell, the conﬁdence scores should be zero. Otherwise, we want the conﬁdence score to equal the intersection over union (IOU) between the predicted box and the ground truth.</p><p><strong>But why do we need C=IOU? </strong>Since the ground truth box is drawn by hand we are 100% sure that there is an object inside the ground truth box; accordingly, any box with a high IOU with the truth box will also surround the same object, then the higher the IOU, the higher the possibility that an object occurs inside the predicted box.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/928/1*b0DdaTvvr9NsoGZ2MyZL0Q.jpeg" /></figure><p>Although we have 7x7=49 grid cells, and for each cell, we predict 2 boxes (98 boxes in total); however, the vast majority of these boxes will have very <strong>low confidence</strong>, then we can get rid of them.</p><p>In addition to the confidence score <strong>C </strong>the model outputs 4 numbers ( (x, y), w , h) to represent the location and the dimensions of the predicted bounding box.</p><p>The (x,y) coordinates represent the center of the box relative to the<strong> bounds of the grid cell</strong>. The width and height are predicted relative to the <strong>whole image</strong>, so 0&lt;(x,y,w,h)&lt;1.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/655/1*_AOrxtXL8TIFXS14OdYolg.png" /></figure><p>YOLO was trained to detect 20 different classes of objects (class means :: cat, car, person,….). For any grid cell, the model will output 20 <strong>conditional class probabilities</strong>, one for each class.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/466/1*XH-ZgvnmVT7mtHWDmSrzpw.png" /></figure><p>While each grid cell gives us a choice between two bounding boxes, we only have one class probability vector. We will get rid of boxes with low confidence.</p><h4>Output shape:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/679/1*40rS8nfYjHKJFomARtcydA.png" /></figure><p>The predictions are encoded as <strong>S ×S ×(B ∗5 + Classes)</strong> tensor. For S=7, B=2 and Classes=20 this will give us a 7x7x30 tensor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NvKSOl_YmAEuzrQScnvxcA.png" /><figcaption>Output Tensor</figcaption></figure><h3>Network Design:</h3><p>YOLO uses a single convolutional network to simultaneously predict multiple bounding boxes and class probabilities for those boxes. This network is inspired by the <a href="https://arxiv.org/pdf/1409.4842.pdf">GoogleNet </a>model for image classiﬁcation, but instead of the inception modules used by GoogLeNet, YOLO simply uses 1×1 reduction layers followed by 3×3 convolutional layers. It has 24 convolutional layers followed by 2 fully connected layers. As we mentioned above, the ﬁnal output of the network is the 7×7×30 tensor of predictions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/678/1*sCG9Ko6bnYmV-HAy4NnYTA.png" /></figure><h3>loss function:</h3><p>YOLO used sum-squared error <strong>SSE </strong>for the loss function because it is easy to optimize. It tries to optimize the following, multi-part loss:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/465/1*uFG7cfuUbLpRzJTAbQt0Hg.png" /></figure><p>The first two terms represent the <strong>localization loss</strong></p><p>Terms 3 &amp; 4 represent the <strong>confidence loss</strong></p><p>The last term represents the <strong>classification loss</strong></p><p>we will go through these terms one by one but before that, we need to consider 3 points:<br>1- The loss function penalizes<strong> classiﬁcation</strong> error only if there is an object inside that grid cell.</p><p>2- Since we have <strong>B=2</strong> bounding boxes for each cell we need to choose one of them for the loss and this will be the box that has the highest IOU with the ground truth box so the loss will penalize <strong>localization loss</strong> if that box is responsible for the ground truth box.</p><p>3-<strong>SSE</strong> weights localization error equally with classiﬁcation error which may not be ideal.</p><h4>The first term:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/359/1*FeorAbS6Wg5g8t1WpvAo3w.png" /></figure><p>This is the <strong>SSE</strong> between the predicted box coordinates(x,y) and the ground truth coordinates (x^,y^). We sum over all the 49 grid cells in the image and for each cell, we sum over all the B boxes (B=2).</p><p>To comply with points (1) &amp; (2) above, YOLO uses a binary variable <strong>1</strong>(obj)ij, so that:</p><p><strong>1</strong>(obj)ij =1 if an object appears in cell i &amp; box j for this cell is <strong>responsible </strong>for that object, otherwise 0.</p><p><strong>“1</strong>(obj)ij=1 only if the box contain an object and responsible for detecting this object (higher IOU)“</p><blockquote>The box is responsible for detecting an object if it has the higher IOU with the ground truth box between the B boxes.</blockquote><p>Since SSE weights localization error equally with classiﬁcation error which may not be ideal as we mentioned in point (3), YOLO uses a constant (<strong>λ<em>coord</em></strong>) to give the <strong>localization </strong>error a higher weight in the loss function (They chose <strong>λ<em>coord</em></strong>=5).</p><h4>The second term:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/436/1*jKB2QwFvns3N7QNTeTYVnA.png" /></figure><p>Here everything is similar to the first term, but we calculate the error in the box dimensions.</p><p><strong>why we are using the square root of w and h? </strong>Since the 20 classes of objects that YOLO can detect has different sizes &amp; Sum-squared error weights errors in large boxes and small boxes equally. Our error metric should reﬂect that small deviation in large boxes matter less than in small boxes. To partially address this YOLO predicts the square root of the bounding box width and height instead of the width and height directly. For example, instead of predicting 0.9 for a large box and 0.09 for a small box, we predict 0.948 and 0.3 respectively).</p><p>Now if the model predicts 2 boxes with the error of 5px in the width of both boxes, we can notice that with the square root we make the square error higher for the small box.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/746/1*duBKjTnYXqqTrSBQaIUf0w.png" /></figure><blockquote>A small error (5px) in a large box is generally benign but the same small error in a small box has a much greater effect.</blockquote><h4>The third term:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/179/1*l0_fA_GcjinvTh2w1cR8Hw.png" /></figure><p>this is the <strong>confidence </strong>error where:</p><p>C^=1</p><p>0≤C≤1</p><h4>The fourth term:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/223/1*2UWXmoUO_booOriWmRhAzQ.png" /></figure><p>If there is no object in the grid we don’t need to care about the classification and the localization error. All we need to care about is the confidence <strong>C</strong>(we need our confidence to be zero when there is no object) and for that, we use a variable :</p><p><strong><em>1</em></strong>(noobj)ij = 1 if (there is no object inside cell i) <strong>or</strong> (there is an object ,but the box j for this cell is <strong>not responsible </strong>for that object) ,otherwise 0.</p><p>Since many grid cells do not contain any object, this pushes the conﬁdence scores of those cells towards zero which is the value of the ground truth conﬁdence (for example 40 of the 49 cells don’t contain objects), This can lead the training to diverge early. To remedy this, we decrease the loss from conﬁdence predictions for boxes that don’t contain objects using the parameter <strong>λnoobj </strong>=0.5.</p><h4>The last term:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/224/1*U_dYM7ABef_G8xn2_EEcBw.png" /></figure><p>Here we sum the errors for all the classes probabilities for the 49 grid cells.</p><h4>Training:</h4><p>First, they pretrained the convolutional layers of the network for classification on the ImageNet 1000-class competition dataset. For pretraining they used the ﬁrst 20 convolutional layers from the network we talked about previously followed by an average-pooling layer and a 1x1000 fully connected layer with an input size of 224×224 . This network achieved a top-5 accuracy of 88%.</p><p>Then they removed the 1x1000 fully connected layer and added four convolutional layers and two fully connected layers with randomly initialized weights and increased the input resolution of the network from 224×224 to 448×448. After that, they trained the model for detection.</p><h4>Non-maximal suppression:</h4><p>Since YOLO uses 7x7 grid then if an object occupies more than one grid this object may be detected in more than one grid.</p><p>Since we need any object to be detected only once. For example, the taxi in this image may be detected 3 times by the cells with the indexes (3,0), (3,1), and(3,2) where the red box is the ground truth box (here i draw these boxes by hand, actually the taxi may be detected more than 3 times).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/537/1*kQRNqTpCeyMqyYR5SNSCJg.jpeg" /></figure><p><strong>So how do we choose one of these boxes?</strong></p><p>For each class (cars, pedestrians, cats,….) do:</p><p>1-Discard all boxes with confidence <strong>C</strong>&lt;<strong>C</strong> -threshold (for example<strong> C</strong>&lt;0.5)</p><p>2- Sort the predictions starting from the highest confidence <strong>C.</strong></p><p>3-Choose the box with the highest <strong>C </strong>and output it as a prediction.</p><p>4-Discard any box with IOU&gt;IOU-threshold with the box in the previous step.</p><p>5-Start again from step (3) until all remaining predictions are checked.</p><blockquote>non-max suppression adds 2–3% in mAP.</blockquote><h4>Fast YOLO and YOLO VGG-16:</h4><p>Fast YOLO is a fast version of YOLO. It uses 9 convolutional layers instead of 24. It is faster than YOLO but has a lower mAP.</p><p>YOLO VGG-16 uses VGG-16 as its backbone instead of the original YOLO network. It is more accurate but slower than real-time.</p><h4>Comparison to Other Detection Systems:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qVQhdgGSRMz896mzMV3ttw.png" /><figcaption>Real-Time Systems on PASCAL VOC 2007. We can notice that YOLO struggles to localize objects correctly.</figcaption></figure><h4>Limitations of YOLO:</h4><p>1-Since each grid cell predicts only two boxes and can only have one class, this limits the number of <strong>nearby </strong>objects that YOLO can predict, especially for small objects that appear in groups, such as ﬂocks of birds.</p><p>2-YOLO can detect only 49 objects.</p><p>3-Relatively high localization error.</p><h3>YOLOv2:</h3><p>YOLO makes a signiﬁcant number of localization errors. Furthermore, YOLO has a relatively low recall. Thus in the second version of YOLO they focused mainly on improving recall and localization while maintaining classiﬁcation accuracy. To achieve a better performance they used some ideas:</p><p>1-<strong>BatchNormalization</strong>: By adding batch normalization on all the convolutional layers in YOLO they get more than 2% improvement in mAP.</p><p><strong>2-High Resolution Classiﬁer:</strong> The original YOLO was trained as follow:</p><p>i-They trained the <strong>classiﬁer</strong> network at 224×224 input size.</p><p>ii-Then they increased the resolution to 448 for <strong>detection</strong>.</p><p>This means when switching to detection the network has to simultaneously switch to learning <strong>object detection</strong> and adjust to the new input <strong>resolution</strong>. While for YOLOv2 they initially trained the model on images at 224×224, then they <strong>ﬁne tune</strong> the classiﬁcation network at the full 448×448 resolution for 10 epochs on ImageNet before training for <strong>detection</strong>. This gives the network time to adjust its ﬁlters to work better on higher resolution input. This high-resolution classiﬁcation network gives an increase of almost 4% mAP.</p><p>3-<strong>Convolutional With Anchor Boxes(</strong> multi-object prediction per grid cell)<strong>:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/252/1*7jg1NxNj0s8RVJJOcTBhLA.jpeg" /></figure><p>YOLO (v1) tries to assign the object to the grid cell that contains the middle of the object. Using this idea the red cell in the image above must detect both the <strong>man </strong>and<strong> </strong>his <strong>necktie</strong>, but since any grid cell can only detect one object, a problem will arise here. To solve this, the authors tried to allow the grid cell to detect more than one object using <strong>k</strong> bounding box.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/399/1*5HJjTA_ffsqo_0W-jWddrQ.png" /></figure><blockquote>To predict k bounding boxes YOLOv2 used<strong> </strong>the idea of <strong>Anchor boxes</strong></blockquote><p><strong>What is an Anchor Box?</strong></p><p>YOLO predicts the coordinates of bounding boxes directly using fully connected layers on top of the convolutional feature extractor. Instead of predicting coordinates directly another object detection model called <strong>Faster R-CNN</strong> predicts bounding boxes using hand-picked <strong>anchor boxes</strong>. An <strong>anchor box</strong> is a width and height. We can predict the bounding box relative to the bounding box instead of predicting the box relative to the image. Using this idea it will be easier for the network to learn. Using only convolutional layers(without fully connected layers) Faster R-CNN predicts offsets and conﬁdences for anchor boxes.</p><p>In this image, we have a grid cell(red) and 5 anchor boxes(yellow) with different shapes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*d1_fofJQhWvHiUeNtZ9p5g.png" /></figure><p>YOLOv2 tries to use the idea of anchor boxes but instead of picking the k anchor boxes by hand, it tries to find the best anchor box shapes to make it easier for the network to learn detection.</p><blockquote>In the paper they called the anchor box a <strong>(prior box)</strong></blockquote><p>In this image, the 5 red boxes represent the average dimensions and locations of objects in VOC 2007 dataset</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*m0t4vdu4LH2bKYu1zQp2dA.png" /></figure><p><strong>Someone may ask how and why they chose these 5 boxes? </strong>They run <a href="https://en.wikipedia.org/wiki/K-means_clustering">k-means clustering</a> on the training set bounding boxes for various values of k and plot the average IOU with the closest centroid, but instead of using Euclidean distance, they used IOU between the bounding box and the centroid.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/220/1*Ow-MEIbIvzpx0a6U8Xzh-w.gif" /><figcaption><a href="https://en.wikipedia.org/wiki/K-means_clustering">source</a></figcaption></figure><p>They chose k = 5 as a good trade-off between model complexity and high recall</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/606/1*BYoRZmABsiYYELjedraKYw.png" /></figure><p>YOLOv2 predicts <strong>location coordinates</strong> relative to the location of the<strong> grid cell</strong>. This bounds the ground truth to fall between 0 and 1. The network predicts 5 bounding boxes for each cell. It predicts 5 coordinates for each bounding box,<strong> tx, ty, tw, th, </strong>and<strong> to</strong>. If the cell is offset from the top left corner of the image by (cx,cy) and the bounding box prior(anchor box) has width and height pw, ph, then the predictions correspond to:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/659/1*PUNSMQg8W928CM_7Qpk-Mg.png" /></figure><p>For example, if we use 2 anchor boxes the grid cell(2,2) in the image below will output 2 boxes (the blue and the yellow boxes). Let the black dotted boxes represent the 2 anchor boxes for that cell.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r-1mBBMgiPfpuOilhNP1Yg.png" /></figure><p>Now consider only the blue box, instead of assigning the predicted blue box to the grid cell only as in YOLO, YOLOv2 assigns the blue box not only to the grid cell but also to one of the anchor boxes and that will be the one that has the highest IOU with the ground truth box. YOLOv2 uses the above equations to assign the blue box to the grid and the anchor box.</p><h4>Network Architecture:</h4><p><strong>Darknet-19:</strong></p><p>To solve the problems of complexity and accuracy the authors propose a new classiﬁcation model called <strong>Darknet-19</strong> to be used as a backbone for YOLOv2.</p><p>Darknet-19 has 19 convolutional layers and 5 max-pooling layers. It achieved 91.2% top-5 accuracy on ImageNet which is better than VGG (90%) and YOLO network(88%).</p><h4>Output shape:</h4><p>YOLOv2 output shape is 13x13x(k.(1+4+20)) where k is the number of anchor boxes, and 20 is the number of classes. For k=5 the output shape will be <strong>13x13x125.</strong></p><h4>Training:</h4><p>The model was first trained for <strong>classification </strong>then it was <strong>trained</strong> for <strong>detection.</strong></p><p>1-<strong>Classification</strong>: they trained Darknet-19 network on the standard <strong>ImageNet </strong>1000 class classiﬁcation dataset with input shape 224x224 for 160 epochs. After that, they fine-tune the network at a large input size 448x448 for 10 epochs. This gives a top-1 accuracy of 76.5% and a top-5 accuracy of 93.3%</p><p><strong>2-Detection: </strong>After training for classification they removed the last convolutional layer from Darknet-19 and instead they added three 3 × 3 convolutional layers and a 1x1 convolutional layer with the number of outputs we need for detection(13x13x125). Also, a <strong>passthrough </strong>layer was added so that our model can use ﬁne grain features from previous layers.</p><p>Then they trained the network for 160 epochs on detection datasets (VOC and COCO datasets).</p><p><strong>Multi-Scale Training:</strong></p><p>To make YOLOv2 robust to running on images of different sizes they trained the model for different input sizes.ٍ Sٍٍٍince the model uses only convolutional and pooling layers the input can be resized on the ﬂy.</p><p>Instead of ﬁxing the input image size, they changed the network every few iterations. After every 10 batches, the network randomly chooses a new image dimension size from the dimensions set {320,352,384,…,608}. Then they resize the network to that dimension and continue training. This means the same network can predict objects at different resolutions(input shapes).</p><h4>Comparison to Other Detection Systems:</h4><p>YOLOv2 is state-of-the-art and faster than other detection systems across a variety of detection datasets. Furthermore, it can be run at a variety of image sizes to provide a smooth trade-off between speed and accuracy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/381/1*CuvsAlFnZYyj3aghHcdqOg.png" /><figcaption>Accuracy and speed on VOC 2007.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/795/1*M_AMlkYaDz3deD5BHqBVeg.png" /><figcaption>PASCAL VOC2012 test detection results: YOLOv2 performs on par with state-of-the-art detectors like Faster R-CNN with ResNet and SSD512 and is 2−10×faster.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/694/1*IL6kIRb20XY_CTPpYNdTug.png" /><figcaption>Results on COCO test-dev2015</figcaption></figure><h4>YOLO9000:</h4><p>Sometimes we need a model that can detect more than 20 classes, and that is what YOLO9000 does. It is a real-time framework for detecting more than 9000 object categories by jointly optimizing detection and classiﬁcation.</p><p>As we mentioned previously, YOLOv2 was trained for classification then for detection. This is because the dataset for classification -which contains one object- is different from the dataset for detection. In YOLOv2, the authors propose a mechanism for jointly training on classiﬁcation and detection data.</p><p>During training, they mix images from both detection and classiﬁcation datasets. When the network sees an image labeled for detection, we can backpropagate based on the full YOLOv2 loss function. When it sees a classiﬁcation image we only backpropagate loss from the classiﬁcation speciﬁc parts of the architecture.</p><p>The idea of mixing detection and classification data faces a few challenges:</p><p>1-Detection datasets are small compared to classification datasets.</p><p>2-Detection datasets have only common objects and general labels, like “dog” or “boat”, while Classiﬁcation datasets have a much<strong> wider </strong>and <strong>deeper</strong> range of labels. For example, ImageNet dataset has more than a hundred breeds of dogs like “german shepherd” and “Bedlington terrier.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_bhzZ0IJimFf7tzBtK-_xA.png" /><figcaption>detection — classification</figcaption></figure><p>To merge these two datasets the authors created a hierarchical model of visual concepts and called it<strong> WordTree.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nskRV4Wt9Dul-6Jv1x09Bw.png" /></figure><p>As we see, all the classes are under the root (physical object). They trained the Darknet-19 model on WordTree .They extracted the 1000 classes of ImageNet dataset from WordTree and added to it all the <strong>intermediate nodes</strong>, which expands the label space from 1000 to 1369 and called it <strong>WordTree1k.</strong>Now the size of the output layer of darknet-19 became 1369 instead of 1000.</p><p>For these 1369 predictions, we don’t compute one softmax, but we compute a separate softmax overall synsets that are hyponyms of the same concept.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/497/1*JqL3cgM4UrA9Sx9bc8EdZw.png" /></figure><p>Despite adding 369 additional concepts Darknet-19 achieves 71.9% top-1 accuracy and 90.4% top-5 accuracy.</p><p>The detector predicts a bounding box and the <strong>tree </strong>of probabilities, but since we use more than one softmax we need to traverse the tree to find the predicted class.</p><p>We traverse the tree from top to down, taking the highest <strong>conﬁdence</strong> path at every split until we reach a node with probability &lt;<strong> threshold-probability </strong>then we predict that object class.</p><p>For example, if the input image contains a dog, the tree of probabilities will be like this tree below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/466/1*DA5GC4I3H65On223ECL-Cw.png" /></figure><p>Instead of assuming every image has an object, we use YOLOv2’s objectness predictor to give us the value of Pr(physical object), which is the root of the tree.</p><p>The model outputs a softmax for each branch level. We choose the node with the highest probability(if it is higher than a threshold value)as we move from top to down. The prediction will be the node where we stop.</p><p>In the tree above, the model will go through<strong> physical object =&gt; dog=&gt;hunting dog</strong>. It will stop at ‘hunting dog’ and do not go down to <strong>sighthound </strong>(a type of hunting dogs) because its confidence is less than the confidence threshold value, so the model will predict <strong>hunting dog </strong>not <strong>sighthound.</strong></p><p>Performing classiﬁcation in this manner also has some beneﬁts. Performance degrades gracefully on new or unknown object categories. For example, if the network sees a picture of a dog but it is uncertain which type of dog it is, it will stop at the <strong>dog </strong>with high conﬁdence and the output will be (<strong>dog</strong>).</p><p>The combined dataset was created using the COCO detection dataset and the top 9000 classes from the full ImageNet release.YOLO9000 uses three priors(anchor boxes) instead of 5 to limit the output size. It learns to ﬁnd objects in images using the detection data in the COCO dataset and it learns to classify a wide variety of these objects using data from the ImageNet dataset.</p><p>When the network sees a detection image, we backpropagate loss as normal. When it sees a classiﬁcation image we only backpropagate classiﬁcation loss.</p><p>Since COCO does not have a bounding box label for many categories, YOLO9000 struggles to model some categories like “sunglasses” or “swimming trunks.”</p><h3>YOLOv3:</h3><blockquote>It’s a little bigger but more accurate.</blockquote><h4>Bounding Box Prediction:</h4><p>Same as YOLO9000, the network predicts 4 coordinates for each bounding box, tx, ty, tw, th. If the cell is offset from the top left corner of the image by (cx,cy) and the bounding box prior has width and height Pw, Ph, then the predictions correspond to:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/235/1*L2mpfhg2tixnWJqMSyoEEQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/614/1*Fl-TbhgQBvfZ9x-8BV77CA.png" /></figure><p>YOLOv3 also predicts an objectness score(confidence) for each bounding box using<strong> logistic regression.</strong> This should be 1 if the bounding box prior overlaps a ground truth object by more than any other bounding box prior. For example (prior 1) overlaps the first ground truth object more than any other bounding box prior (has the highest IOU) and prior 2 overlaps the second ground truth object by more than any other bounding box prior. The system only assigns one bounding box prior to each ground truth object. If a bounding box prior is not assigned to a ground truth object it incurs no loss for coordinate or class predictions, only objectness.</p><p>If the box does not have the highest IOU but does overlap a ground truth object by more than some threshold we ignore the prediction (They use the threshold of 0.5).</p><h4>Multi labels prediction:</h4><p>In some datasets like the Open Image Dataset an object may have multi labels. For example, an object can be labeled as a woman and as a person.</p><p>In this dataset, there are many overlapping labels. Using a softmax for class prediction imposes the assumption that each box has exactly one class, which is often not the case(as in Open Image Dataset).</p><p>For this reason, YOLOv3 does not use a softmax; instead, it simply uses independent logistic classiﬁers for any class. During training, they used<strong> binary cross-entropy loss</strong> for the class predictions.</p><p>Using independent logistic classiﬁers, an object can be detected as a woman an as a person at the same time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4HLPGIqe9WTjMOfvab-uLQ.png" /></figure><h4>Small objects detection:</h4><p>YOLO struggles with small objects. However, with YOLOv3 we see better performance for small objects, and that is because of using <strong>short-cut connections</strong>. Using these connections method allows us to get more ﬁner-grained information from the earlier feature map. However comparing to the previous version, YOLOv3 has worse performance on medium and larger size objects.</p><h4>Feature Extractor Network (Darknet-53):</h4><p>YOLOv3 uses a new network for performing feature extraction. The new network is a hybrid approach between the network used in YOLOv2 (Darknet-19) and the residual network, so it has some shortcut connections. It has 53 convolutional layers so they call it Darknet-53.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/428/1*-yZK9UyN719G91ZKob5IBw.png" /></figure><p>Darknet-53 performs on par with state-of-the-art classiﬁers but with fewer ﬂoating point operations and more speed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/375/1*Sr9Ffl3fbwes_tT1Uccgpw.png" /></figure><blockquote>After training on classification the fully connected layer is removed from Darknet-53.</blockquote><h4>Predictions Across Scales:</h4><p>Unlike YOLO and YOLO2, which predict the output at the last layer, YOLOv3 predicts boxes at 3 different scales as illustrated in the below image.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9U9rJmRBatdbRWm5eo86qg.png" /></figure><blockquote>This is a simple diagram for the network .<em>I </em>didn’t draw the short cut connections for simplicity.</blockquote><p>At each scale, YOLOv3 uses 3 anchor boxes and predicts 3 boxes for any grid cell. Each <strong>object is </strong>still only assigned to one grid <strong>cell </strong>in <strong>one </strong>detection tensor.</p><h4>Performance:</h4><p>When we plot accuracy vs. speed on the AP50 (IOU 0.5 metric), we see that YOLOv3 has signiﬁcant beneﬁts over other detection systems.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/446/1*Q5gPOdXE1PfjzCo3n6YFsQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/677/1*lHR_XI8jVg_Fg4hAjJaBKg.png" /></figure><p>However, YOLOv3 performance drops signiﬁcantly as the IOU threshold increases (IOU =0.75), indicating that YOLOv3 struggles to get the boxes perfectly aligned with the object, but it still faster than other methods.</p><p>Now I will let you with this video from <a href="https://pjreddie.com/darknet/yolo/">YOLO website</a>:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FMPU2HistivI%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DMPU2HistivI&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FMPU2HistivI%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/b6ea94511373ff26011a13dc6ed070b8/href">https://medium.com/media/b6ea94511373ff26011a13dc6ed070b8/href</a></iframe><h4>Try it yourself with a pre-trained model:</h4><p>The original YOLO model was written in Darknet, an open-source neural network framework written in C and CUDA. It supports CPU and GPU computation. You can follow this <a href="https://pjreddie.com/darknet/yolo/">link </a>to install Darknet and the pre-trained weights.</p><p>For windows, you can also use <a href="https://github.com/thtrieu/darkflow">darkflow </a>which is a tensorflow implementation of darknet, but Darkflow doesn’t offer an implementation for YOLOv3 yet.</p><p>If you are interested to run YOLO without GPU, you can read about <a href="https://arxiv.org/pdf/1811.05588.pdf">YOLO-lite, </a>which is a <strong>real-time</strong> object detection model developed to run on portable devices such as a <strong>laptop </strong>or <strong>cellphone </strong>lacking a GPU.</p><p>You can also visit this <a href="https://github.com/kaka-lin/object-detection">github repository</a> to learn about <strong>tiny-YOLO</strong> to use YOLO for cellphones<strong>.</strong></p><h4>Resources:</h4><p>YOLO: <a href="https://arxiv.org/pdf/1506.02640.pdf">https://arxiv.org/pdf/1506.02640.pdf</a></p><p>YOLOv2 and YOLO9000: <a href="https://arxiv.org/pdf/1612.08242.pdf">https://arxiv.org/pdf/1612.08242.pdf</a></p><p>YOLOv3:<a href="https://arxiv.org/pdf/1804.02767.pdf">https://arxiv.org/pdf/1804.02767.pdf</a>YOLO, YOLOv2 and</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7e3e92dc4899" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>