{
  "source_file": "0930",
  "source_platform": "Medium",
  "author": "Muhammad Ardi Putra",
  "title_listed": "YOLOv2 & YOLO9000 Paper Walkthrough: Better, Faster, Stronger",
  "keywords": "",
  "domain": "图像处理",
  "content_type": "深度技术解析",
  "is_paid_flag": "否",
  "url": "https://towardsdatascience.com/yolov2-yolo9000-paper-walkthrough-better-faster-stronger/",
  "publish_date": "2026-02-03",
  "corpus_stage": "",
  "notes": "",
  "id": "4d82a4a37762",
  "collected_at": "2026-10-02T02:29:29",
  "title": "YOLOv2 & YOLO9000 Paper Walkthrough: Better, Faster, Stronger | Towards Data Science",
  "body_markdown": "![Revisit consent button](../images/body-df29beacd7496220cc94.svg)\nWe value your privacy\nWe use cookies to enhance your browsing experience, serve personalised ads or content, and analyse our traffic. By clicking \"Accept All\", you consent to our use of cookies.\nCustomise Reject All Accept All\nCustomise Consent Preferences ![](../images/body-2159bb67f3de8ad870eb.svg)\nWe use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below.\nThe cookies that are categorised as \"Necessary\" are stored on your browser as they are essential for enabling the basic functionalities of the site. ... Show more\nNecessaryAlways Active\nNecessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data.\n  * Cookie\nBCTempID\n  * Duration\n10 minutes\n  * Description\nNo description available.\n\n\n  * Cookie\n__cf_bm\n  * Duration\n1 hour\n  * Description\nThis cookie, set by Cloudflare, is used to support Cloudflare Bot Management. \n\n\n  * Cookie\nAWSALBCORS\n  * Duration\n7 days\n  * Description\nAmazon Web Services set this cookie for load balancing.\n\n\n  * Cookie\n_cfuvid\n  * Duration\nsession\n  * Description\nCloudflare sets this cookie to track users across sessions to optimize user experience by maintaining session consistency and providing personalized services\n\n\n  * Cookie\nli_gc\n  * Duration\n6 months\n  * Description\nLinkedin set this cookie for storing visitor's consent regarding using cookies for non-essential purposes.\n\n\n  * Cookie\n__hssrc\n  * Duration\nsession\n  * Description\nThis cookie is set by Hubspot whenever it changes the session cookie. The __hssrc cookie set to 1 indicates that the user has restarted the browser, and if the cookie does not exist, it is assumed to be a new session.\n\n\n  * Cookie\n__hssc\n  * Duration\n1 hour\n  * Description\nHubSpot sets this cookie to keep track of sessions and to determine if HubSpot should increment the session number and timestamps in the __hstc cookie.\n\n\n  * Cookie\nwpEmojiSettingsSupports\n  * Duration\nsession\n  * Description\nWordPress sets this cookie when a user interacts with emojis on a WordPress site. It helps determine if the user's browser can display emojis properly.\n\n\n  * Cookie\nBCSessionID\n  * Duration\n1 year 1 month 4 days\n  * Description\nBlueconic sets this cookie as a unique identifier for the BlueConic profile.\n\n\n  * Cookie\n_octo\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\nlogged_in\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\n__Secure-YEC\n  * Duration\npast\n  * Description\nYouTube sets this cookie to stores the user's video player preferences using embedded YouTube video\n\n\n  * Cookie\n__eoi\n  * Duration\n6 months\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nAWSALBTGCORS\n  * Duration\n7 days\n  * Description\nNo description available.\n\n\n  * Cookie\nlogin-status-p\n  * Duration\npast\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nAWSALBTG\n  * Duration\n7 days\n  * Description\nNo description available.\n\n\n  * Cookie\ncsrf_token\n  * Duration\nsession\n  * Description\nNo description available.\n\n\n  * Cookie\ntoken_v2\n  * Duration\n1 day\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nD\n  * Duration\n1 year\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nPHPSESSID\n  * Duration\nsession\n  * Description\nThis cookie is native to PHP applications. The cookie stores and identifies a user's unique session ID to manage user sessions on the website. The cookie is a session cookie and will be deleted when all the browser windows are closed.\n\n\n  * Cookie\nVISITOR_PRIVACY_METADATA\n  * Duration\n6 months\n  * Description\nYouTube sets this cookie to store the user's cookie consent state for the current domain. \n\n\n  * Cookie\ncookietest\n  * Duration\nsession\n  * Description\nThe cookietest cookie is typically used to determine whether the user's browser accepts cookies, essential for website functionality and user experience.\n\n\n  * Cookie\n__Host-airtable-session\n  * Duration\n1 year\n  * Description\nThis cookie is used to enable us to integrate the services of Airtable.\n\n\n  * Cookie\n__Host-airtable-session.sig\n  * Duration\n1 year\n  * Description\nThis cookie is used to enable us to integrate the services of Airtable.\n\n\n  * Cookie\nm\n  * Duration\n1 year 1 month 4 days\n  * Description\nStripe sets this cookie for fraud prevention purposes. It identifies the device used to access the website, allowing the website to be formatted accordingly.\n\n\n  * Cookie\nBIGipServer*\n  * Duration\nsession\n  * Description\nMarketo sets this cookie to collect information about the user's online activity and build a profile about their interests to provide advertisements relevant to the user. \n\n\n  * Cookie\n__cfruid\n  * Duration\nsession\n  * Description\nCloudflare sets this cookie to identify trusted web traffic.\n\n\n  * Cookie\n_GRECAPTCHA\n  * Duration\n6 months\n  * Description\nGoogle Recaptcha service sets this cookie to identify bots to protect the website against malicious spam attacks.\n\n\n  * Cookie\n__Secure-YNID\n  * Duration\n6 months\n  * Description\nGoogle cookie used to protect user security and prevent fraud, especially during the login process.\n\n\n  * Cookie\ncookieyes-consent\n  * Duration\n1 year\n  * Description\nCookieYes sets this cookie to remember users' consent preferences so that their preferences are respected on subsequent visits to this site. It does not collect or store any personal information about the site visitors.\n\n\nFunctional\nFunctional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features.\n  * Cookie\nlidc\n  * Duration\n1 day\n  * Description\nLinkedIn sets the lidc cookie to facilitate data center selection.\n\n\n  * Cookie\nbrw\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\nbrwConsent\n  * Duration\n5 minutes\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nWMF-Uniq\n  * Duration\n1 year\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nloom_anon_comment\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\nloom_referral_video\n  * Duration\nsession\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nVISITOR_INFO1_LIVE\n  * Duration\n6 months\n  * Description\nA cookie set by YouTube to measure bandwidth that determines whether the user gets the new or old player interface.\n\n\n  * Cookie\nyt-remote-connected-devices\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to store the user's video preferences using embedded YouTube videos.\n\n\n  * Cookie\nytidb::LAST_RESULT_ENTRY_KEY\n  * Duration\nNever Expires\n  * Description\nThe cookie ytidb::LAST_RESULT_ENTRY_KEY is used by YouTube to store the last search result entry that was clicked by the user. This information is used to improve the user experience by providing more relevant search results in the future.\n\n\n  * Cookie\nyt-remote-device-id\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to store the user's video preferences using embedded YouTube videos.\n\n\n  * Cookie\nyt-remote-session-name\n  * Duration\nsession\n  * Description\nThe yt-remote-session-name cookie is used by YouTube to store the user's video player preferences using embedded YouTube video.\n\n\n  * Cookie\nyt-remote-fast-check-period\n  * Duration\nsession\n  * Description\nThe yt-remote-fast-check-period cookie is used by YouTube to store the user's video player preferences for embedded YouTube videos.\n\n\n  * Cookie\nyt-remote-session-app\n  * Duration\nsession\n  * Description\nThe yt-remote-session-app cookie is used by YouTube to store user preferences and information about the interface of the embedded YouTube video player.\n\n\n  * Cookie\nyt-remote-cast-available\n  * Duration\nsession\n  * Description\nThe yt-remote-cast-available cookie is used to store the user's preferences regarding whether casting is available on their YouTube video player.\n\n\n  * Cookie\nyt-remote-cast-installed\n  * Duration\nsession\n  * Description\nThe yt-remote-cast-installed cookie is used to store the user's video player preferences using embedded YouTube video.\n\n\n  * Cookie\ncp_session\n  * Duration\n3 months\n  * Description\nCodepen sets this cookie for Help systems found in the website.\n\n\n  * Cookie\nloid\n  * Duration\n1 year 1 month 4 days\n  * Description\nThis cookie is set by the Reddit. The cookie enables the sharing of content from the website onto the social media platform.\n\n\nAnalytics\nAnalytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc.\n  * Cookie\n__hstc\n  * Duration\n6 months\n  * Description\nHubspot set this main cookie for tracking visitors. It contains the domain, initial timestamp (first visit), last timestamp (last visit), current timestamp (this visit), and session number (increments for each subsequent session).\n\n\n  * Cookie\nhubspotutk\n  * Duration\n6 months\n  * Description\nHubSpot sets this cookie to keep track of the visitors to the website. This cookie is passed to HubSpot on form submission and used when deduplicating contacts.\n\n\n  * Cookie\n_ga\n  * Duration\n1 year 1 month 4 days\n  * Description\nGoogle Analytics sets this cookie to calculate visitor, session and campaign data and track site usage for the site's analytics report. The cookie stores information anonymously and assigns a randomly generated number to recognise unique visitors.\n\n\n  * Cookie\n_ga_*\n  * Duration\n1 year 1 month 4 days\n  * Description\nGoogle Analytics sets this cookie to store and count page views.\n\n\n  * Cookie\n__Host-psifi.analyticsTrace\n  * Duration\n6 hours\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\n__Host-psifi.analyticsTraceV2\n  * Duration\n6 hours\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\n_gh_sess\n  * Duration\nsession\n  * Description\nGitHub sets this cookie for temporary application and framework state between pages like what step the user is on in a multiple step form.\n\n\n  * Cookie\nYSC\n  * Duration\nsession\n  * Description\nYSC cookie is set by Youtube and is used to track the views of embedded videos on Youtube pages.\n\n\n  * Cookie\najs_anonymous_id\n  * Duration\n1 year\n  * Description\nThis cookie is set by Segment to count the number of people who visit a certain site by tracking if they have visited before.\n\n\n  * Cookie\nvuid\n  * Duration\n1 year 1 month 4 days\n  * Description\nVimeo installs this cookie to collect tracking information by setting a unique ID to embed videos on the website. \n\n\nPerformance\nPerformance cookies are used to understand and analyse the key performance indexes of the website which helps in delivering a better user experience for the visitors.\n  * Cookie\nAWSALB\n  * Duration\n7 days\n  * Description\nAWSALB is an application load balancer cookie set by Amazon Web Services to map the session to the target.\n\n\n  * Cookie\nacq\n  * Duration\npast\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nacq.sig\n  * Duration\npast\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nptc\n  * Duration\n2 years\n  * Description\nNo description available.\n\n\nAdvertisement\nAdvertisement cookies are used to provide visitors with customised advertisements based on the pages you visited previously and to analyse the effectiveness of the ad campaigns.\n  * Cookie\nmuc_ads\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to collect user behaviour and interaction data to optimize the website.\n\n\n  * Cookie\nguest_id_marketing\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to identify and track the website visitor.\n\n\n  * Cookie\nguest_id_ads\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to identify and track the website visitor.\n\n\n  * Cookie\npersonalization_id\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to integrate and share features for social media and also store information about how the user uses the website, for tracking and targeting.\n\n\n  * Cookie\nguest_id\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to identify and track the website visitor. It registers if a user is signed in to the Twitter platform and collects information about ad preferences.\n\n\n  * Cookie\nbcookie\n  * Duration\n1 year\n  * Description\nLinkedIn sets this cookie from LinkedIn share buttons and ad tags to recognize browser IDs.\n\n\n  * Cookie\n__Secure-ROLLOUT_TOKEN\n  * Duration\n6 months\n  * Description\nYouTube sets this cookie to manage feature rollout and experimentation. It helps Google control which new features or interface changes are shown to users as part of testing and staged rollouts, ensuring consistent experience for a given user during an experiment.\n\n\n  * Cookie\nyt.innertube::nextId\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to register a unique ID to store data on what videos from YouTube the user has seen.\n\n\n  * Cookie\nyt.innertube::requests\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to register a unique ID to store data on what videos from YouTube the user has seen.\n\n\n  * Cookie\nsession_tracker\n  * Duration\nsession\n  * Description\nThis cookie is set by the Reddit. This cookie is used to identify trusted web traffic. It also helps in adverstising on the website.\n\n\n  * Cookie\nedgebucket\n  * Duration\nsession\n  * Description\nReddit sets this cookie to save the information about a log-on Reddit user, for the purpose of advertisement recommendations and updating the content.\n\n\n  * Cookie\ndid\n  * Duration\n1 year\n  * Description\nArbor sets this cookie to show targeted ads to site visitors.This cookie expires after 2 months or 1 year.\n\n\nUncategorised\nOther uncategorised cookies are those that are being analysed and have not been classified into a category as yet.\nNo cookies to display.\nReject All Save My Preferences Accept All\nToggle Search[](https://towardsdatascience.com/)Toggle Mobile Navigation\n[](https://towardsdatascience.com/)\nPublish AI, ML & data-science insights to a global community of data professionals.\nSign in[Submit an Article](https://write.insightmediagroup.io)\n[Latest](https://towardsdatascience.com/latest/)[Editor's Picks](https://towardsdatascience.com/tag/editors-pick/)[Newsletter](https://towardsdatascience.com/tag/the-variable/)[ShipAI](https://towardsdatascience.com/shipai/)\n* * *\n[Write For TDS](https://towardsdatascience.com/submissions/)\n[LinkedIn](https://www.linkedin.com/company/towards-data-science/)[X](https://x.com/TDataScience)Toggle Search\n[Artificial Intelligence](https://towardsdatascience.com/category/artificial-intelligence/)\n# YOLOv2 & YOLO9000 Paper Walkthrough: Better, Faster, Stronger\nFrom YOLOv1 to YOLOv2: prior box, k-means, Darknet-19, passthrough layer, and more\n[Muhammad Ardi Putra](https://towardsdatascience.com/author/muhammad_ardi/)\nFebruary 3, 202622 min read\n![](../images/000.jpg)\nPhoto by [Clay Banks](https://unsplash.com/@claybanks?utm_source=medium&utm_medium=referral) on Unsplash\n_Better, Faster, Stronger_ — that’s the ambitious title the authors chose for their paper introducing both YOLOv2 and YOLO9000. The title of the paper itself is “ _YOLO9000: Better, Faster, Stronger_ ” [1], which was published back in December 2016. The main focus of this paper is indeed to create YOLO9000. But let’s make things clear. Despite the title of the paper, the model proposed in the study is called YOLOv2. The name YOLO9000 is their proposed algorithm specialized to detect over 9000 object categories which is built on top of the YOLOv2 architecture.\nIn this article I am going to focus on how YOLOv2 works and how to implement the architecture from scratch with PyTorch. I will also talk a little bit about how the authors eventually ended up with YOLO9000.\n···\n## From YOLOv1 to YOLOv2\nAs the name suggests, YOLOv2 is the advancement of YOLOv1. Thus, in order to understand YOLOv2, I recommend you read my previous article about YOLOv1 [2] and its loss function [3] before reading this one.\nThere were two main problems raised by the authors on YOLOv1: first, the high localization error, or in other words the bounding box predictions made by the model is not quite accurate. Second, the low recall, which is a condition where the model is unable to detect all objects within the image. There were lots of modifications made by the authors on YOLOv1 to address the above issues, which in general the changes they made are summarized in Figure 1. We are going to discuss each of these modifications one by one in the subsequent sub-sections.\nLearn this step by step with the interactive [AI Engineer](https://roadmap.sh/ai-engineer) roadmap.\n![](../images/001.png)\nFigure 1. The changes the authors made on YOLOv1 to build YOLOv2 [1].\n### Batch Normalization\nThe first modification the authors did was applying batch normalization layer. Remember that YOLOv1 is quite old. It was first introduced back when BN layer was not quite popular just yet, which was the reason why YOLOv1 do not utilize this normalization mechanism in the first place. It is already proven that BN layer is able to stabilize training, speed up convergence, dan regularize model. Thanks to this reason, the dropout layer we previously have in YOLOv1 was omitted as we apply BN layers. It is mentioned in the paper that by attaching this type layer after each convolution they obtained 2.4% improvement in mAP from 63.4% to 65.8%.\n### Better Fine-Tuning\nNext, the authors proposed a better way to perform fine-tuning. Previously in YOLOv1 the backbone model was pretrained on ImageNet classification dataset which the images had the size of 224×224. Then, they replaced the classification head with detection head and directly fine-tune it on PASCAL VOC detection dataset which contains images of size 448×448. Here we can clearly see that there was something like a “jump” thanks to the different image resolutions in pretraining and fine-tuning. The pipeline used for training YOLOv2 is slightly modified, where the authors added an intermediate step, namely fine-tuning the model on 448×448 ImageNet before fine-tuning it again on PASCAL VOC of the same image resolution. This additional step allows the model to get adapted to the higher resolution image before being fine-tuned for detection, unlike in YOLOv1 which the model is forced to work on 448×448 images directly after being pretrained on 224×224 images. This new fine-tuning pipeline allowed the mAP to increase by 3.7% from 65.8% to 69.5%.\n![](../images/body-ab9e639b477bbecca790.png)\nFigure 2. The fine-tuning mechanism of YOLOv1 and YOLOv2 [4].\n### Anchor Box and Fully Convolutional Network\nThe next modification was related to the use of anchor box. If you’re not yet familiar with it, this is essentially a template bounding box (a.k.a. prior box) corresponding to a single grid cell, which is rescaled to match the actual object size. The model is then trained to predict the offset of the anchor box rather than the bounding box coordinates like YOLOv1. We can think of an anchor box as the starting point of the model to make bounding box prediction. According to the paper, predicting offset like this is easier than predicting coordinates, hence allowing the model to perform better. Figure 3 below illustrates 5 anchor boxes that correspond to the top-left grid cell. Later on, the same anchor boxes will be applied to all grid cells within the image.\n![](../images/body-98831c244b846040ecd1.png)\nFigure 3. Example of 5 anchor boxes applied to the top-left grid cell of an image [5].\nThe use of anchor boxes also changed the way we do the object classification. Previously in YOLOv1 we had each grid cell predicted two bounding boxes, yet it could only predict a single object class. YOLOv2 addresses this issue by attaching the object classification mechanism with the anchor box rather than the grid cell, allowing each anchor box from the same grid cell to predict different object classes. Mathematically speaking, the length of the prediction vector of YOLOv1 can be formulated as (B×5)+C for each grid cell, whereas in YOLOv2 this prediction vector length changed to B×(5+C), where _B_ is the number of bounding box to be generated, _C_ is the number of classes in the dataset, and 5 is the number of _xywh_ and the bounding box confidence value. With the mechanism introduced in YOLOv2, the prediction vector indeed becomes longer, but it allows each anchor box predicts its own class. The figure below illustrates the prediction vectors of YOLOv1 and YOLOv2, where we set _B_ to 2 and _C_ to 20. In this particular case, the length of the prediction vectors of both models are (2×5)+20=30 and 2×(5+20)=50, respectively.\n![](../images/body-b0f44cd340a48e45bce2.png)\nFigure 4. What the prediction vectors of YOLOv1 and YOLOv2 look like for 20-class PASCAL VOC object detection dataset [5].\nAt this point authors also replaced the fully-connected layers in YOLOv1 with a stack of convolution layers, causing the entire model to be a fully convolutional network which has the downsampling factor of 32. This downsampling factor causes an input tensor of size 448×448 to get reduced to 14×14. The authors argued that large objects are usually located in the middle of an image, so they made the output feature map to have odd dimensions, ensuring that there is a single center cell to predict such objects. In order to achieve this, the authors changed the input shape to 416×416 as the default configuration so that the output dimension has the spatial resolution of 13×13.\nInterestingly, the use of anchor box and fully convolutional network caused the mAP to decrease by 0.3% from 69.5% to 69.2% instead, yet at the same time the recall increased by 7% from 81% to 88%. This improvement in recall was particularly caused by the increase of the number of predictions made by the model. In the case of YOLOv1, the model could only predict 7×7=49 objects in total, and now YOLOv2 can predict up to 13×13×5=845 objects, where the number 5 comes from the default number of anchor boxes used. Meanwhile, the decrease in mAP indicated that there was a room for improvement on the anchor boxes.\n### Prior Box Clustering and Constrained Predictions\nThe authors indeed saw a problem in the anchor boxes, and so in the subsequent step they tried to modify the way it works. Previously in Faster R-CNN the anchor boxes were manually handpicked, which caused them to not optimally represent all object shapes in the dataset. To address this problem, authors used K-means to cluster the distribution of the bounding box size. They did it by taking the _w_ and _h_ values of the bounding boxes in the object detection dataset, putting them into two-dimensional space, and clustering the datapoints using K-means as usual. The authors decided to use _K_ =5, which essentially means that we will later have that number of clusters. \nThe illustration in Figure 5 below displays what the bounding box size distribution looks like, where each black datapoint represents a single bounding box in the dataset and the green circles are the centroids which will then act as the size of our anchor boxes. Note that this illustration is indeed created based on dummy data, but the idea here is that the datapoint located at the top-right represents a large square bounding box, the one in the top-left is a vertical rectangle box, and so on.\n![](../images/body-77328df372afa27d3905.png)\nFigure 5. Example of a bounding box distribution. The bounding box sizes are scaled to 0–1 relative to the image size [5].\nIf you’re familiar with K-means, we typically use Euclidean distance to measure the distance between datapoints and the centroids. But here the authors created a new distance metric specifically for this case, in which they used the complement of the IOU between the bounding boxes and the cluster centroids. See the equation below for the details.\n![](../images/body-c8e43c6818c300d9e3c6.png)\nFigure 6. The distance metric the authors use to measure distance between the bounding boxes in the dataset (black datapoints) and the anchor boxes (green centroids).\nUsing the distance metric above, we can see in the following table that the prior boxes generated using K-means clustering (highlighted in blue) have a greater average IOU compared to the prior boxes used in Faster R-CNN (highlighted in green) despite the smaller number of prior boxes (5 vs 9). This essentially indicates that the proposed clustering mechanism allows the resulting prior boxes to represent the bounding box size distribution in the dataset better as compared to the handpicked anchor boxes.\n![](../images/body-64c8f136a18d9fd73bc5.png)\nFigure 7. Comparison of different methods for generating prior box [1].\nStill related to prior box, the authors found that predicting anchor box offset like Faster R-CNN was actually still not quite optimal thanks to the unbounded equation. If we take a look at the Figure 8 below, there is a possibility that the box position could be shifted wildly throughout the entire image, causing the training difficult especially in earlier stages.\n![](../images/body-00e3eb8bf80f0801bfa2.png)\nFigure 8. The equations used in Faster R-CNN for transforming anchor box coordinates and size [1].\nInstead of being relative to the anchor box like Faster R-CNN, the authors solved this issue by adopting the idea of predicting location coordinates relative to the grid cell from YOLOv1. However, the authors further modify this by introducing sigmoid function to constrain the _xy_ coordinate prediction of the network, effectively bounds the value to the range of 0 to 1 hence causing the predicted location will never fall outside the corresponding grid cell, as shown in the first and the second rows in Figure 9. Next, the _w_ and _h_ of the bounding box are processed with exponential function (third and fourth row), which is useful to prevent negative values because it is just nonsense to have negative width or height. Meanwhile, the way to compute confidence score at the fifth row is the same as YOLOv1, namely by calculating the multiplication of objectness confidence and the IOU between the predicted and the target box.\n![](../images/body-196ebf93d4972ac2f35a.png)\nFigure 9. The equations used by YOLOv2 to make bounding box prediction [1].\nSo in simple words, we indeed adopt the concept of prior box introduced by Faster R-CNN, but instead of handpicking the box, we use clustering to automatically find the most optimal prior box sizes. The bounding box is created with additional sigmoid function for the _xy_ and exponential function for the _wh_. It is worth noting that now the _x_ and _y_ are relative to the grid cell while the _w_ and _h_ are relative to the prior box. The authors found that this method improved mAP from 69.6% to 74.4%.\n### Passthrough Layer\nThe final output feature map of YOLOv2 has the spatial dimension of 13×13, in which each element corresponds to a single grid cell. The information contained within each grid cell is considered coarse, which absolutely makes sense because maxpooling layers within the network indeed work by taking only the highest values from the earlier feature map. This might not be a problem if the objects to be detected are considerably large. But if the objects are small, our model might be having hard time in performing the detection due to the loss of information contained in the non-prominent pixels.\nTo address this problem, authors proposed to apply the so-called _passthrough layer_. The objective of this layer is to preserve fine-grained information from earlier feature map before being downsampled by maxpooling layer. In Figure 12, the part of the network referred to as passthrough layer is the connection that branches out from the network before eventually merging back to the main flow in the end. The idea of this layer is quite similar to identity mapping introduced in ResNet. However, the process done in that model is simpler because the tensor dimension from the original flow and the one in the skip-connection matches exactly, allowing them to be element-wise sumed. The case is different in passthrough layer, in which here the latter feature map has a smaller spatial dimension, hence we need to think a way to combine information from the two tensors. The authors came up with an idea where they divide the image in the passthrough layer and then stack the divided tensors in channel-wise manner as shown in Figure 10 below. By doing so, we will have the spatial dimension of the resulting tensor matches with the subsequent feature map, allowing them to be concatenated along the channel axis. The fine-grained information from the former layer will then be combined with the higher-level features from the latter layer using a convolution layer.\n![](../images/body-d89e884cbb51eecfd513.png)\nFigure 10. How the tensor is processed inside the passthrough layer to adapt the dimension to the subsequent layer [5].\n### Multi-Scale Training\nPreviously I’ve mentioned that in YOLOv2 all FC layers have been replaced with a stack of convolution layers. This essentially allows us to feed images of different scales within the same training process, considering that the weights of CNN-based model correspond to the trainable parameters in the kernel, which is independent of the input image dimension. In fact, this is actually the reason why the authors decided to remove the FC layers in the first place. During the training phase, authors changed the input resolution every 10 batches randomly from 320×320, 352×352, 384×384, and so on to 608×608, all with multiple of 32. This process can be thought of as their approach to augment the data so that the model can detect objects across varying input dimensions, which I believe it also allows the model to predict objects of different scales with better performance. This process boosted mAP to 76.8% on the default input resolution 416×416, and it got even higher to 78.6% when we they increased the image resolution further to 544×544.\n### Darknet-19\nAll modifications on YOLOv1 we discussed in the previous sub sections were all related to how the authors improve detection quality in terms of the mAP and recall. Now the focus of this sub section is to improve model performance in terms of the speed. It is mentioned in the paper that the authors use a model referred to as Darknet-19 as the backbone, which has less operations compared to the backbone of YOLOv1 (5.58 billion vs 8.52 billion), allowing YOLOv2 to run faster than its predecessor. The original version of this model consists of 19 convolution layers and 5 maxpooling layers, which the details can be seen in Figure 11 below.\n![](../images/body-234256f8b250cf50a925.png)\nFigure 11. The vanilla Darknet-19 architecture [1].\nIt is important to note that the above architecture is the vanilla Darknet-19 model, which is only suitable for classification task. To adapt it with the requirement of YOLOv2, we need to slightly modify it by adding passthrough layer and replacing the classification head with detection head. You can see the modified architecture in Figure 12 below.\n![](../images/body-f42b5924028e09693bf7.png)\nFigure 12. The complete YOLOv2 architecture [5].\nHere you can see that the passthrough layer is placed after the last 26×26 feature map. This passthrough layer will reduce the spatial dimension to 13×13, allowing it to be concatenated in channel-wise manner with the 13×13 feature map from the main flow. Later in the next section I am going to demonstrate how to implement this Darknet-19 architecture from scratch including the detection head as well as the passthrough layer.\n### 9000-Class Object Detection\nYOLOv2 model was initially trained on PASCAL VOC and COCO datasets which have 20 and 80 number of object classes, respectively. The authors saw this as a problem because they thought that this number is very limited for general case, and hence lack of versatility. Due to this reason, it is necessary to improve the model such that it can detect a wider variety of object classes. However, creating object detection dataset is very expensive and laborious, because not only the object classes but we are also required to annotate the bounding box information. \nThe authors came up with a very clever idea, where they combined ImageNet, which has over 22,000 classes, with COCO using class hierarchy mechanism which they refer to as WordTree as shown in Figure 13. You can see the illustration in the figure that blue nodes are the classes from COCO dataset, while the red ones are from ImageNet dataset. The object categories available in the COCO dataset are relatively general, whereas the ones in ImageNet are a lot more fine-grained. For instance, if in COCO we got _airplane_ , in ImageNet we got _biplane_ , _jet_ , _airbus_ , and _stealth fighter_. So using the idea of WordTree, the authors put these four airplane types as the subclass of _airplane_. You can think of the inference like this: the model works by predicting bounding box and the parent class, then it will check if it got subclasses. If so, the model will continue predicting from the smaller subset of classes. \nBy combining the two datasets like this, we eventually ended up with a model that is capable of predicting over 9000 object classes (9418 to be exact), hence the name YOLO9000.\n![](../images/body-e144b1f584071f97f8ba.png)\nFigure 13. The class grouping mechanism used in YOLO9000 [1].\n···\n## YOLOv2 Architecture Implementation\nAs I promised earlier, in this section I am going to demonstrate how to implement the YOLOv2 architecture from scratch so that you can get better understanding about how an input image eventually becomes a tensor containing bounding box and class predictions.\nNow what we need to do first is to import the required modules which is shown in Codeblock 1 below.\npython\n\n```\n# Codeblock 1\nimport torch\nimport torch.nn as nn\n```\n\nNext, we create the `ConvBlock` class, in which it is going to encapsulate the convolution layer itself, a batch normalization layer and a leaky ReLU activation function. The `negative_slope` parameter itself is set to 0.1 as shown at line `#(1)`, which is exactly the same as the one used in YOLOv1.\npython\n\n```\n# Codeblock 2\nclass ConvBlock(nn.Module):\n    def __init__(self, \n                 in_channels, \n                 out_channels, \n                 kernel_size, \n                 padding):\n        super().__init__()\n        \n        self.conv = nn.Conv2d(in_channels=in_channels,\n                              out_channels=out_channels, \n                              kernel_size=kernel_size, \n                              padding=padding)\n        self.bn = nn.BatchNorm2d(num_features=out_channels)\n        self.leaky_relu = nn.LeakyReLU(negative_slope=0.1)    #(1)\n        \n    def forward(self, x):\n        print(f'original\\t: {x.size()}')\n\n        x = self.conv(x)\n        print(f'after conv\\t: {x.size()}')\n        \n        x = self.leaky_relu(x)\n        print(f'after leaky relu: {x.size()}')\n        \n        return x\n```\n\nJust to check if the above class works properly, here I test it with a very simple test case, where I initialize a `ConvBlock` instance which accepts an RGB image of size 416×416. You can see in the resulting output that the image now has 64 channels, proving that our `ConvBlock` works properly.\npython\n\n```\n# Codeblock 3\nconvblock = ConvBlock(in_channels=3,\n                      out_channels=64,\n                      kernel_size=3,\n                      padding=1)\nx = torch.randn(1, 3, 416, 416)\nout = convblock(x)\n```\n\nmarkup\n\n```\n# Codeblock 3 Outputoriginal         : torch.Size([1, 3, 416, 416])after conv       : torch.Size([1, 64, 416, 416])after leaky relu : torch.Size([1, 64, 416, 416])\n```\n\n### Darknet-19 Implementation\nNow let’s use this `ConvBlock` class to construct the Darknet-19 architecture. The way to do so is pretty simple, as what we need to do is just to stack multiple `ConvBlock` instances followed by a maxpooling layer according to the architecture in Figure 12. See the details in Codeblock 4a below. Note that the maxpooling layer for `stage4` is placed at the beginning of `stage5` as shown at the line marked with `#(1)`. This is essentially done because the output of `stage4` will directly be fed into the passthrough layer without being downsampled. In addition to this, it is important to note that the term “stage” is not officially mentioned in the paper. Rather, this is just a term I personally use for the sake of this implementation.\npython\n\n```\n# Codeblock 4a\nclass Darknet(nn.Module):\n    def __init__(self):\n        super(Darknet, self).__init__()\n        \n        \n        self.stage0 = nn.ModuleList([\n            ConvBlock(3, 32, 3, 1),\n            nn.MaxPool2d(kernel_size=2, stride=2)\n        ])\n        \n        self.stage1 = nn.ModuleList([\n            ConvBlock(32, 64, 3, 1),\n            nn.MaxPool2d(kernel_size=2, stride=2)\n        ])\n            \n        self.stage2 = nn.ModuleList([\n            ConvBlock(64, 128, 3, 1), \n            ConvBlock(128, 64, 1, 0), \n            ConvBlock(64, 128, 3, 1),\n            nn.MaxPool2d(kernel_size=2, stride=2)\n        ])\n        \n        self.stage3 = nn.ModuleList([\n            ConvBlock(128, 256, 3, 1), \n            ConvBlock(256, 128, 1, 0), \n            ConvBlock(128, 256, 3, 1),\n            nn.MaxPool2d(kernel_size=2, stride=2)\n        ])\n        \n        self.stage4 = nn.ModuleList([\n            ConvBlock(256, 512, 3, 1), \n            ConvBlock(512, 256, 1, 0), \n            ConvBlock(256, 512, 3, 1), \n            ConvBlock(512, 256, 1, 0), \n            ConvBlock(256, 512, 3, 1), \n        ])\n        \n        self.stage5 = nn.ModuleList([\n            nn.MaxPool2d(kernel_size=2, stride=2),    #(1)\n            ConvBlock(512, 1024, 3, 1), \n            ConvBlock(1024, 512, 1, 0), \n            ConvBlock(512, 1024, 3, 1), \n            ConvBlock(1024, 512, 1, 0), \n            ConvBlock(512, 1024, 3, 1), \n        ])\n```\n\nAs all layers have been initialized, the next thing we do is to connect all these layers using the `forward()` method in Codeblock 4b below. Previously I said that we will take the output of `stage4` as the input for the passthrough layer. To do so, I store the feature map produced by the last layer of `stage4` in a separate variable which I refer to as `x_stage4` (`#(1)`). We then do the same thing for the output of `stage5` (`#(2)`) and return both `x_stage4` and `x_stage5` as the output of our `Darknet` (`#(3)`).\npython\n\n```\n# Codeblock 4b\n    def forward(self, x):\n        print(f'original\\t: {x.size()}')\n        \n        print()\n        for i in range(len(self.stage0)):\n            x = self.stage0[i](x)\n            print(f'after stage0 #{i}\\t: {x.size()}')\n        \n        print()\n        for i in range(len(self.stage1)):\n            x = self.stage1[i](x)\n            print(f'after stage1 #{i}\\t: {x.size()}')\n        \n        print()\n        for i in range(len(self.stage2)):\n            x = self.stage2[i](x)\n            print(f'after stage2 #{i}\\t: {x.size()}')\n        \n        print()\n        for i in range(len(self.stage3)):\n            x = self.stage3[i](x)\n            print(f'after stage3 #{i}\\t: {x.size()}')\n        \n        print()\n        for i in range(len(self.stage4)):\n            x = self.stage4[i](x)\n            print(f'after stage4 #{i}\\t: {x.size()}')\n            \n        x_stage4 = x.clone()        #(1)\n        \n        print()\n        for i in range(len(self.stage5)):\n            x = self.stage5[i](x)\n            print(f'after stage5 #{i}\\t: {x.size()}')\n        \n        x_stage5 = x.clone()        #(2)\n\n        return x_stage4, x_stage5   #(3)\n```\n\nNext, I test the Darknet-19 model above by passing the same dummy image as the one in our previous test case.\npython\n\n```\n# Codeblock 5\ndarknet = Darknet()\n\nx = torch.randn(1, 3, 416, 416)\nout = darknet(x)\n```\n\nmarkup\n\n```\n# Codeblock 5 Outputoriginal        : torch.Size([1, 3, 416, 416])after stage0 #0 : torch.Size([1, 32, 416, 416])after stage0 #1 : torch.Size([1, 32, 208, 208])after stage1 #0 : torch.Size([1, 64, 208, 208])after stage1 #1 : torch.Size([1, 64, 104, 104])after stage2 #0 : torch.Size([1, 128, 104, 104])after stage2 #1 : torch.Size([1, 64, 104, 104])after stage2 #2 : torch.Size([1, 128, 104, 104])after stage2 #3 : torch.Size([1, 128, 52, 52])after stage3 #0 : torch.Size([1, 256, 52, 52])after stage3 #1 : torch.Size([1, 128, 52, 52])after stage3 #2 : torch.Size([1, 256, 52, 52])after stage3 #3 : torch.Size([1, 256, 26, 26])after stage4 #0 : torch.Size([1, 512, 26, 26])after stage4 #1 : torch.Size([1, 256, 26, 26])after stage4 #2 : torch.Size([1, 512, 26, 26])after stage4 #3 : torch.Size([1, 256, 26, 26])after stage4 #4 : torch.Size([1, 512, 26, 26])after stage5 #0 : torch.Size([1, 512, 13, 13])after stage5 #1 : torch.Size([1, 1024, 13, 13])after stage5 #2 : torch.Size([1, 512, 13, 13])after stage5 #3 : torch.Size([1, 1024, 13, 13])after stage5 #4 : torch.Size([1, 512, 13, 13])after stage5 #5 : torch.Size([1, 1024, 13, 13])\n```\n\nHere we can see that our output matches exactly with the architectural details in Figure 12, indicating that our implementation of the Darknet-19 model is correct.\n### The Entire YOLOv2 Architecture\nBefore actually constructing the entire YOLOv2 architecture, we need to initialize the parameters for the model first. Here we want every single cell to generate 5 anchor boxes, hence we need to set the `NUM_ANCHORS` variable to that number. Next, I set `NUM_CLASSES` to 20 because we assume that we want to train the model on PASCAL VOC dataset.\npython\n\n```\n# Codeblock 6\nNUM_ANCHORS = 5\nNUM_CLASSES = 20\n```\n\nNow it’s time to define the `YOLOv2` class. In the Codeblock 7a below, we initially define the `__init__()` method, where we initialize the `Darknet `model (`#(1)`), a single `ConvBlock` for the passthrough layer (`#(2)`), a stack of two convolution layers which I refer to as `stage6` (`#(3)`), and another stack of two convolution layers which the last one is used to map the tensor into prediction vector with B×(5+C) number of channels (`#(4)`).\npython\n\n```\n# Codeblock 7a\nclass YOLOv2(nn.Module):\n    def __init__(self):\n        super().__init__()\n        \n        self.darknet = Darknet()                       #(1)\n        \n        self.passthrough = ConvBlock(512, 64, 1, 0)    #(2)\n        \n        self.stage6 = nn.ModuleList([                  #(3)\n            ConvBlock(1024, 1024, 3, 1), \n            ConvBlock(1024, 1024, 3, 1), \n        ])\n\n        self.stage7 = nn.ModuleList([\n            ConvBlock(1280, 1024, 3, 1),\n            ConvBlock(1024, NUM_ANCHORS*(5+NUM_CLASSES), 1, 0)    #(4)\n        ])\n```\n\nAfterwards, we define the so-called `reorder()` method, which we will use to process the feature map in the passthrough layer. The logic of the code below is quite complicated though, but the main idea is that it follows the principle given in Figure 10. Here I show you the output of each line so that you can get better understanding of how the process goes inside the function given an input tensor of shape 1×64×26×26, which represents a single image of size 26×26 with 64 channels. In the last step we can see that the final output tensor has the shape of 1×256×13×13. This shape matches exactly with our requirement, where the channel dimension becomes 4 times larger than that of the input while at the same time the spatial dimension halves.\npython\n\n```\n# Codeblock 7b\n    def reorder(self, x, scale=2):                      # ([1, 64, 26, 26])\n        B, C, H, W = x.shape\n        h, w = H // scale, W // scale\n\n        x = x.reshape(B, C, h, scale, w, scale)         # ([1, 64, 13, 2, 13, 2])     \n        x = x.transpose(3, 4)                           # ([1, 64, 13, 13, 2, 2])\n\n        x = x.reshape(B, C, h * w, scale * scale)       # ([1, 64, 169, 4])\n        x = x.transpose(2, 3)                           # ([1, 64, 4, 169])\n\n        x = x.reshape(B, C, scale * scale, h, w)        # ([1, 64, 4, 13, 13])\n        x = x.transpose(1, 2)                           # ([1, 4, 64, 13, 13])\n\n        x = x.reshape(B, scale * scale * C, h, w)       # ([1, 256, 13, 13])\n\n        return x\n```\n\nNext, the Codeblock 7c below shows how we create the flow of the network. We initially start from the `darknet` backbone, in which it returns `x_stage4` and `x_stage5` (`#(1)`). The `x_stage5` tensor will directly be processed with the subsequent convolution layers which I refer to as `stage6` (`#(2)`) whereas the `x_stage4` tensor will be passed to the passthrough layer (`#(3)`) and processed by the `reorder()` (`#(4)`) method we defined in Codeblock 7b above. Afterwards, we then concatenate both tensors in channel-wise manner at line `#(5)`. This concatenated tensor is then processed further with another stack of convolution layers called `stage7` (`#(6)`) which returns the prediction vector.\npython\n\n```\n# Codeblock 7c\n    def forward(self, x):\n        print(f'original\\t\\t\\t: {x.size()}')\n        \n        x_stage4, x_stage5 = self.darknet(x)              #(1)\n        print(f'\\nx_stage4\\t\\t\\t: {x_stage4.size()}')\n        print(f'x_stage5\\t\\t\\t: {x_stage5.size()}')\n        \n        print()\n        x = x_stage5\n        for i in range(len(self.stage6)):\n            x = self.stage6[i](x)                         #(2)\n            print(f'x_stage5 after stage6 #{i}\\t: {x.size()}')    \n        \n        x_stage4 = self.passthrough(x_stage4)             #(3)\n        print(f'\\nx_stage4 after passthrough\\t: {x_stage4.size()}')\n        \n        x_stage4 = self.reorder(x_stage4)                 #(4)\n        print(f'x_stage4 after reorder\\t\\t: {x_stage4.size()}')\n        \n        x = torch.cat([x_stage4, x], dim=1)               #(5)\n        print(f'\\nx after concatenate\\t\\t: {x.size()}')\n        \n        for i in range(len(self.stage7)):                 #(6)\n            x = self.stage7[i](x)\n            print(f'x after stage7 #{i}\\t: {x.size()}')    \n        \n        return x\n```\n\nAgain, to test the above code we will pass through a tensor of size 1×3×416×416.\npython\n\n```\n# Codeblock 8\nyolov2 = YOLOv2()\nx = torch.randn(1, 3, 416, 416)\n\nout = yolov2(x)\n```\n\nAnd below is what the output looks like after the code is run. The outputs referred to as `stage0` to `stage5` are the processes within the Darknet backbone, in which this is exactly the same as the one I showed you earlier in Codeblock 5 Output. Afterwards we can see in `stage6` that the shape of the `x_stage5` tensor does not change at all (`#(1–3)`). Meanwhile, the channel dimension of `x_stage4` increased from 64 to 256 after being processed by the `reorder()` operation (`#(4–5)`). The tensor from the main flow is then concatenated with the one from passthrough layer, which caused the number of channels in the resulting tensor became 1024+256=1280 (`#(6)`). Lastly, we pass the tensor to `stage7` which returns a prediction tensor of size 125×13×13, denoting that we have 13×13 grid cells where every single of those cells contains a prediction vector of length 125 (`#(7)`), storing the bounding box and the object class predictions.\nmarkup\n\n```\n# Codeblock 8 Outputoriginal        : torch.Size([1, 3, 416, 416])after stage0 #0 : torch.Size([1, 32, 416, 416])after stage0 #1 : torch.Size([1, 32, 208, 208])after stage1 #0 : torch.Size([1, 64, 208, 208])after stage1 #1 : torch.Size([1, 64, 104, 104])after stage2 #0 : torch.Size([1, 128, 104, 104])after stage2 #1 : torch.Size([1, 64, 104, 104])after stage2 #2 : torch.Size([1, 128, 104, 104])after stage2 #3 : torch.Size([1, 128, 52, 52])after stage3 #0 : torch.Size([1, 256, 52, 52])after stage3 #1 : torch.Size([1, 128, 52, 52])after stage3 #2 : torch.Size([1, 256, 52, 52])after stage3 #3 : torch.Size([1, 256, 26, 26])after stage4 #0 : torch.Size([1, 512, 26, 26])after stage4 #1 : torch.Size([1, 256, 26, 26])after stage4 #2 : torch.Size([1, 512, 26, 26])after stage4 #3 : torch.Size([1, 256, 26, 26])after stage4 #4 : torch.Size([1, 512, 26, 26])after stage5 #0 : torch.Size([1, 512, 13, 13])after stage5 #1 : torch.Size([1, 1024, 13, 13])after stage5 #2 : torch.Size([1, 512, 13, 13])after stage5 #3 : torch.Size([1, 1024, 13, 13])after stage5 #4 : torch.Size([1, 512, 13, 13])after stage5 #5 : torch.Size([1, 1024, 13, 13])x_stage4        : torch.Size([1, 512, 26, 26])x_stage5        : torch.Size([1, 1024, 13, 13])              #(1)x_stage5 after stage6 #0   : torch.Size([1, 1024, 13, 13])   #(2)x_stage5 after stage6 #1   : torch.Size([1, 1024, 13, 13])   #(3)x_stage4 after passthrough : torch.Size([1, 64, 26, 26])     #(4)x_stage4 after reorder     : torch.Size([1, 256, 13, 13])    #(5)x after concatenate        : torch.Size([1, 1280, 13, 13])   #(6)x after stage7 #0          : torch.Size([1, 1024, 13, 13])x after stage7 #1          : torch.Size([1, 125, 13, 13])\n```\n\n···\n## Ending\nI think that’s pretty much everything about YOLOv2 and its model architecture implementation from scratch. The code used in this article is also available on my GitHub repository [6]. Please let me know if you spot any mistake in my explanation or in the code. Thanks for reading, I hope you learn something new from this article. See ya in my next writing!\n···\n## References\n[1] Joseph Redmon and Ali Farhadi. YOLO9000: Better, Faster, Stronger. Arxiv. <https://arxiv.org/abs/1612.08242> [Accessed August 9, 2025].\n[2] [Muhammad Ardi](https://medium.com/u/9801a58700ac). YOLOv1 Paper Walkthrough: The Day YOLO First Saw the World. Medium. <https://medium.com/ai-advances/yolov1-paper-walkthrough-the-day-yolo-first-saw-the-world-ccff8b60d84b> [Accessed January 24, 2026].\n[3] [Muhammad Ardi](https://medium.com/u/9801a58700ac). YOLOv1 Loss Function Walkthrough: Regression for All. Towards Data Science. <https://towardsdatascience.com/yolov1-loss-function-walkthrough-regression-for-all/> [Accessed January 24, 2026].\n[4] Image originally created by author, partially generated with Gemini\n[5] Image originally created by author\n[6] MuhammadArdiPutra. Better, Faster, Stronger — YOLOv2 and YOLO9000. GitHub. <https://github.com/MuhammadArdiPutra/medium_articles/blob/main/Better%2C%20Faster%2C%20Stronger%20-%20YOLOv2%20and%20YOLO9000.ipynb> [Accessed August 9, 2025].\n## Register Now to Continue Reading\n### Unlock Towards Data Science with a Free Account\nAll articles on Towards Data Science are available to registered users. Create a free account today to access this article and thousands more.\nRegister for freeSign in to your account\n* * *\n![](../images/body-59e1c17daab1fcb582c5.jpeg)\nWritten By\n## [Muhammad Ardi Putra](https://towardsdatascience.com/author/muhammad_ardi/)\nDeep learning storyteller\n[See all from Muhammad Ardi Putra](https://towardsdatascience.com/author/muhammad_ardi/)\n[Editor's Picks](https://towardsdatascience.com/tag/editors-pick/)[Deep Learning](https://towardsdatascience.com/tag/deep-learning/)[Object Detection](https://towardsdatascience.com/tag/object-detection/)[Pytorch](https://towardsdatascience.com/tag/pytorch/)[Yolo](https://towardsdatascience.com/tag/yolo/)\nShare This Article\n  * [](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Ftowardsdatascience.com%2Fyolov2-yolo9000-paper-walkthrough-better-faster-stronger%2F&title=YOLOv2%20%26%20YOLO9000%20Paper%20Walkthrough%3A%20Better%2C%20Faster%2C%C2%A0Stronger)\n  * [](https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Ftowardsdatascience.com%2Fyolov2-yolo9000-paper-walkthrough-better-faster-stronger%2F&title=YOLOv2%20%26%20YOLO9000%20Paper%20Walkthrough%3A%20Better%2C%20Faster%2C%C2%A0Stronger)\n  * [](https://x.com/share?url=https%3A%2F%2Ftowardsdatascience.com%2Fyolov2-yolo9000-paper-walkthrough-better-faster-stronger%2F&text=YOLOv2%20%26%20YOLO9000%20Paper%20Walkthrough%3A%20Better%2C%20Faster%2C%C2%A0Stronger)\n\n\nTowards Data Science is a community publication. Submit your insights to reach our global audience and earn through the TDS Author Payment Program.\n[Write for TDS](https://towardsdatascience.com/submissions/)\n## Related Articles\n  * [![](../images/002.jpg)](https://towardsdatascience.com/creating-an-etch-a-sketch-app-using-python-turtle/)\n## [Creating an Etch A Sketch App Using Python and Turtle](https://towardsdatascience.com/creating-an-etch-a-sketch-app-using-python-turtle/)\n[Programming](https://towardsdatascience.com/category/programming/)\nA beginner-friendly Python tutorial\n[Mahnoor Javed](https://towardsdatascience.com/author/mahnoorjaved/)\nJanuary 30, 20266 min read\n  * [![](../images/003.png)](https://towardsdatascience.com/methods-for-modelling-customer-lifetime-value-the-good-stuff-and-the-gotchas-445f8a6587be/)\n## [Methods for Modelling Customer Lifetime Value: The Good Stuff and the Gotchas](https://towardsdatascience.com/methods-for-modelling-customer-lifetime-value-the-good-stuff-and-the-gotchas-445f8a6587be/)\n[Data Science](https://towardsdatascience.com/category/data-science/)\nPart three of a comprehensive, practical guide to CLV techniques and real-world use-cases\n[Katherine Munro](https://towardsdatascience.com/author/katherineamunro/)\nNovember 17, 202310 min read\n  * [![](../images/004.png)](https://towardsdatascience.com/wish-tackles-peeking-with-always-valid-p-values-8a0782ac9654/)\n## [Wish Tackles Peeking with Always Valid p-values](https://towardsdatascience.com/wish-tackles-peeking-with-always-valid-p-values-8a0782ac9654/)\n[Data Science](https://towardsdatascience.com/category/data-science/)\nPeek and conclude experiments adaptively without inflating the false-positive rate\n[Qike (Max) Li](https://towardsdatascience.com/author/qike_max_li/)\nAugust 24, 20229 min read\n  * [![](../images/005.gif)](https://towardsdatascience.com/clip-model-and-the-importance-of-multimodal-embeddings-1c8f6b13bf72/)\n## [CLIP Model and The Importance of Multimodal Embeddings](https://towardsdatascience.com/clip-model-and-the-importance-of-multimodal-embeddings-1c8f6b13bf72/)\n[Artificial Intelligence](https://towardsdatascience.com/category/artificial-intelligence/)\nCLIP, which stands for Contrastive Language-Image Pretraining, is a deep learning model developed by OpenAI in 2021. CLIP's embeddings for...\n[Fahim Rustamy, PhD](https://towardsdatascience.com/author/faheemrustamy/)\nDecember 11, 202310 min read\n  * [![](../images/006.jpeg)](https://towardsdatascience.com/how-does-python-garbage-collection-work-a5dc544d880d/)\n## [How Does Python Garbage Collection Work?](https://towardsdatascience.com/how-does-python-garbage-collection-work-a5dc544d880d/)\n[Artificial Intelligence](https://towardsdatascience.com/category/artificial-intelligence/)\nKeep your Python objects being referenced, or they will be released in memory.\n[Christopher Tao](https://towardsdatascience.com/author/christophertao/)\nAugust 29, 20217 min read\n  * [![](../images/007.png)](https://towardsdatascience.com/calvin-a-neural-network-that-can-learn-to-plan-and-navigate-unknown-environments-820a8444276f/)\n## [CALVIN - a neural network that can learn to plan and navigate unknown environments](https://towardsdatascience.com/calvin-a-neural-network-that-can-learn-to-plan-and-navigate-unknown-environments-820a8444276f/)\n[Deep Learning](https://towardsdatascience.com/category/artificial-intelligence/deep-learning/)\nCALVIN is a neural network that can plan, explore and navigate in novel 3D environments, provided expert demonstrations.\n[Shu Ishida](https://towardsdatascience.com/author/alacreme/)\nJune 1, 20225 min read\n  * [![](../images/008.jpg)](https://towardsdatascience.com/data-mining-market-basket-analysis-with-apriori-algorithm-970ff256a92c/)\n## [Data Mining: Market Basket Analysis with Apriori Algorithm](https://towardsdatascience.com/data-mining-market-basket-analysis-with-apriori-algorithm-970ff256a92c/)\n[Artificial Intelligence](https://towardsdatascience.com/category/artificial-intelligence/)\nUncovering the secret behind why breads are always conveniently placed beside butter in groceries\n[Yenwee Lim](https://towardsdatascience.com/author/limyenwee_19946/)\nApril 8, 20228 min read\n  * [![](../images/009.jpg)](https://towardsdatascience.com/artificial-intelligence-for-geospatial-analysis-with-pytorchs-torchgeo-part-2-ec3785fae284/)\n## [Artificial Intelligence for Geospatial Analysis with Pytorch's TorchGeo (part 2)](https://towardsdatascience.com/artificial-intelligence-for-geospatial-analysis-with-pytorchs-torchgeo-part-2-ec3785fae284/)\n[Artificial Intelligence](https://towardsdatascience.com/category/artificial-intelligence/)\nAn end-to-end deep learning geospatial segmentation project using Pytorch and TorchGeo packages\n[Maurício Cordeiro](https://towardsdatascience.com/author/cordmaur/)\nNovember 30, 20228 min read\n  * [![](../images/010.jpeg)](https://towardsdatascience.com/a-guide-to-building-an-image-duplicate-finder-system-4a46021410f1/)\n## [Build an Image Duplicate Finder System: A Guide](https://towardsdatascience.com/a-guide-to-building-an-image-duplicate-finder-system-4a46021410f1/)\n[Artificial Intelligence](https://towardsdatascience.com/category/artificial-intelligence/)\nYour zero-to-hero guide to detecting duplicate and near-duplicate images\n[Orjuwan Zaafarani](https://towardsdatascience.com/author/orjwan.zaafarani/)\nApril 30, 20225 min read\n\n\n  * [YouTube](https://www.youtube.com/c/TowardsDataScience)\n  * [X](https://x.com/TDataScience)\n  * [LinkedIn](https://www.linkedin.com/company/towards-data-science/)\n  * [Threads](https://www.threads.net/@towardsdatascience)\n  * [Bluesky](https://bsky.app/profile/towardsdatascience.com)\n\n\n[](https://towardsdatascience.com/)\nYour home for data science and AI. The world's leading publication for data science, data analytics, data engineering, machine learning, and artificial intelligence professionals.\nSubscribe to Our Newsletter[Write For TDS](https://towardsdatascience.com/submissions/)•[About](https://towardsdatascience.com/about-towards-data-science-d691af11cc2f/)•[Advertise](https://contact.towardsdatascience.com/advertise-with-towards-data-science)•[Privacy Policy](https://towardsdatascience.com/privacy-policy/)•[Terms of Use](https://towardsdatascience.com/website-terms-of-use/)\n© Insight Media Group, LLC 2026•[The New Stack](https://thenewstack.io)•[roadmap.sh](https://roadmap.sh)•[Creator Network](https://insightmediagroup.io/creator-network)\n####  Recommended Articles \nClose\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607686/image?etag=1782161464448&width=500&height=500) How Relevance Models Foreshadowed Transformers for NLP ](https://towardsdatascience.com/how-relevance-models-foreshadowed-transformers-for-nlp/ \"How Relevance Models Foreshadowed Transformers for NLP\")\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607639/image?etag=1781250125848&width=500&height=500) Javascript Fatigue: HTMX Is All You Need to Build ChatGPT — Part 1 ](https://towardsdatascience.com/javascript-fatigue-you-dont-need-js-to-build-chatgpt/ \"Javascript Fatigue: HTMX Is All You Need to Build ChatGPT — Part 1\")\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607930/image?etag=1782124566054&width=500&height=500) The Subset Sum Problem Solved in Linear Time for Dense Enough Inputs ](https://towardsdatascience.com/subset-sum-problem-solved-in-linear-time-for-dense-enough-inputs/ \"The Subset Sum Problem Solved in Linear Time for Dense Enough Inputs\")\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/3660/image?etag=1780176246070&width=500&height=500) Does Your Company Have a Data Strategy? ](https://towardsdatascience.com/does-your-company-have-a-data-strategy-e8944dbec4ae/ \"Does Your Company Have a Data Strategy?\")\n\n\n",
  "metadata": {
    "title": "YOLOv2 & YOLO9000 Paper Walkthrough: Better, Faster, Stronger | Towards Data Science",
    "description": "From YOLOv1 to YOLOv2: prior box, k-means, Darknet-19, passthrough layer, and more",
    "keywords": null,
    "author": "Muhammad Ardi Putra",
    "og:locale": "en_US",
    "og:type": "article",
    "og:title": "YOLOv2 & YOLO9000 Paper Walkthrough: Better, Faster, Stronger",
    "og:description": "From YOLOv1 to YOLOv2: prior box, k-means, Darknet-19, passthrough layer, and more",
    "og:url": "https://towardsdatascience.com/yolov2-yolo9000-paper-walkthrough-better-faster-stronger/",
    "og:site_name": "Towards Data Science",
    "og:image": "https://assets.insightmediagroup.io/media/wp-content/uploads/2026/02/YOLOv2-Cover-Page.jpg",
    "og:image:width": "1200",
    "og:image:height": "801",
    "og:image:type": "image/jpeg",
    "twitter:card": "summary_large_image",
    "twitter:site": "@TDataScience",
    "twitter:creator": "@TDataScience",
    "twitter:label1": "Written by",
    "twitter:data1": "Muhammad Ardi Putra",
    "twitter:label2": "Est. reading time",
    "twitter:data2": "22 min read",
    "article:published_time": "2026-02-03T10:00:06.000Z",
    "article:modified_time": "2026-02-03T10:00:06.000Z",
    "article:author": "https://towardsdatascience.com/author/muhammad_ardi/"
  },
  "paywall": {
    "listed_paid": false,
    "detected": false,
    "marker": "",
    "public_only": false,
    "policy": "付费/会员内容只保留页面公开可见部分，不绕过付费墙"
  },
  "crawl": {
    "success": true,
    "status_code": 202,
    "error": ""
  },
  "code_blocks": [
    {
      "language": "txt",
      "file": "attachments/4d82a4a37762/code/block_000.txt",
      "chars": 49
    },
    {
      "language": "txt",
      "file": "attachments/4d82a4a37762/code/block_001.txt",
      "chars": 824
    },
    {
      "language": "txt",
      "file": "attachments/4d82a4a37762/code/block_002.txt",
      "chars": 211
    },
    {
      "language": "txt",
      "file": "attachments/4d82a4a37762/code/block_003.txt",
      "chars": 164
    },
    {
      "language": "txt",
      "file": "attachments/4d82a4a37762/code/block_004.txt",
      "chars": 1438
    },
    {
      "language": "txt",
      "file": "attachments/4d82a4a37762/code/block_005.txt",
      "chars": 1158
    },
    {
      "language": "txt",
      "file": "attachments/4d82a4a37762/code/block_006.txt",
      "chars": 84
    },
    {
      "language": "txt",
      "file": "attachments/4d82a4a37762/code/block_007.txt",
      "chars": 1137
    },
    {
      "language": "txt",
      "file": "attachments/4d82a4a37762/code/block_008.txt",
      "chars": 47
    },
    {
      "language": "txt",
      "file": "attachments/4d82a4a37762/code/block_009.txt",
      "chars": 555
    },
    {
      "language": "txt",
      "file": "attachments/4d82a4a37762/code/block_010.txt",
      "chars": 736
    },
    {
      "language": "txt",
      "file": "attachments/4d82a4a37762/code/block_011.txt",
      "chars": 1078
    },
    {
      "language": "txt",
      "file": "attachments/4d82a4a37762/code/block_012.txt",
      "chars": 81
    },
    {
      "language": "txt",
      "file": "attachments/4d82a4a37762/code/block_013.txt",
      "chars": 1688
    }
  ],
  "images": [
    {
      "status": "http_404",
      "url": "https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607686/image?etag=1782161464448&width=500&height=500",
      "src": "https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607686/image?etag=1782161464448&width=500&height=500",
      "alt": "",
      "downloaded": false,
      "discovery": "saved_markdown",
      "retried_at": "2026-10-20T17:56:53Z"
    },
    {
      "status": "http_404",
      "url": "https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607639/image?etag=1781250125848&width=500&height=500",
      "src": "https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607639/image?etag=1781250125848&width=500&height=500",
      "alt": "",
      "downloaded": false,
      "discovery": "saved_markdown",
      "retried_at": "2026-10-20T17:56:53Z"
    },
    {
      "status": "http_404",
      "url": "https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607930/image?etag=1782124566054&width=500&height=500",
      "src": "https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607930/image?etag=1782124566054&width=500&height=500",
      "alt": "",
      "downloaded": false,
      "discovery": "saved_markdown",
      "retried_at": "2026-10-20T17:56:53Z"
    },
    {
      "status": "http_404",
      "url": "https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/3660/image?etag=1780176246070&width=500&height=500",
      "src": "https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/3660/image?etag=1780176246070&width=500&height=500",
      "alt": "",
      "downloaded": false,
      "discovery": "saved_markdown",
      "retried_at": "2026-10-20T17:56:53Z"
    }
  ],
  "audio": [],
  "videos": [
    {
      "url": "https://www.youtube.com/c/TowardsDataScience",
      "kind": "channel_reference",
      "status": "reference_only"
    }
  ],
  "links": [
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/latest/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/editors-pick/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/the-variable/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/shipai/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/submissions/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/category/artificial-intelligence/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/author/muhammad_ardi/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/yolov1-loss-function-walkthrough-regression-for-all/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/deep-learning/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/object-detection/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/pytorch/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/yolo/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/creating-an-etch-a-sketch-app-using-python-turtle/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/category/programming/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/author/mahnoorjaved/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/methods-for-modelling-customer-lifetime-value-the-good-stuff-and-the-gotchas-445f8a6587be/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/category/data-science/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/author/katherineamunro/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/wish-tackles-peeking-with-always-valid-p-values-8a0782ac9654/"
    },
    {
      "type": "external",
      "href": "https://write.insightmediagroup.io"
    },
    {
      "type": "external",
      "href": "https://www.linkedin.com/company/towards-data-science/"
    },
    {
      "type": "external",
      "href": "https://x.com/TDataScience"
    },
    {
      "type": "external",
      "href": "https://unsplash.com/@claybanks"
    },
    {
      "type": "external",
      "href": "https://roadmap.sh/ai-engineer"
    },
    {
      "type": "external",
      "href": "https://arxiv.org/abs/1612.08242"
    },
    {
      "type": "external",
      "href": "https://medium.com/u/9801a58700ac"
    },
    {
      "type": "external",
      "href": "https://medium.com/ai-advances/yolov1-paper-walkthrough-the-day-yolo-first-saw-the-world-ccff8b60d84b"
    },
    {
      "type": "external",
      "href": "https://github.com/MuhammadArdiPutra/medium_articles/blob/main/Better%2C%20Faster%2C%20Stronger%20-%20YOLOv2%20and%20YOLO9000.ipynb"
    },
    {
      "type": "external",
      "href": "https://www.facebook.com/sharer/sharer.php?title=YOLOv2+%26+YOLO9000+Paper+Walkthrough%3A+Better%2C+Faster%2C%C2%A0Stronger&u=https%3A%2F%2Ftowardsdatascience.com%2Fyolov2-yolo9000-paper-walkthrough-better-faster-stronger%2F"
    },
    {
      "type": "external",
      "href": "https://www.linkedin.com/shareArticle?mini=true&title=YOLOv2+%26+YOLO9000+Paper+Walkthrough%3A+Better%2C+Faster%2C%C2%A0Stronger&url=https%3A%2F%2Ftowardsdatascience.com%2Fyolov2-yolo9000-paper-walkthrough-better-faster-stronger%2F"
    },
    {
      "type": "external",
      "href": "https://x.com/share?text=YOLOv2+%26+YOLO9000+Paper+Walkthrough%3A+Better%2C+Faster%2C%C2%A0Stronger&url=https%3A%2F%2Ftowardsdatascience.com%2Fyolov2-yolo9000-paper-walkthrough-better-faster-stronger%2F"
    },
    {
      "type": "external",
      "href": "https://www.youtube.com/c/TowardsDataScience"
    },
    {
      "type": "external",
      "href": "https://www.threads.net/@towardsdatascience"
    },
    {
      "type": "external",
      "href": "https://bsky.app/profile/towardsdatascience.com"
    },
    {
      "type": "external",
      "href": "https://thenewstack.io"
    },
    {
      "type": "external",
      "href": "https://roadmap.sh"
    },
    {
      "type": "external",
      "href": "https://insightmediagroup.io/creator-network"
    }
  ],
  "repair_version": 2,
  "repaired_at": "2026-10-20T17:29:26Z",
  "source_url": "https://towardsdatascience.com/yolov2-yolo9000-paper-walkthrough-better-faster-stronger/",
  "delivery_status": "unverified",
  "discovery_status": "http_403",
  "missing_reason": "源页面未重新核验:http_403；已按保留正文补采图片",
  "repair_error": "",
  "actual_video_files": [],
  "expected_saved_body_images": 4,
  "image_discovery": "saved_markdown",
  "source_body_markdown": "![Revisit consent button](https://cdn-cookieyes.com/assets/images/revisit.svg)\nWe value your privacy\nWe use cookies to enhance your browsing experience, serve personalised ads or content, and analyse our traffic. By clicking \"Accept All\", you consent to our use of cookies.\nCustomise Reject All Accept All\nCustomise Consent Preferences ![](https://cdn-cookieyes.com/assets/images/close.svg)\nWe use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below.\nThe cookies that are categorised as \"Necessary\" are stored on your browser as they are essential for enabling the basic functionalities of the site. ... Show more\nNecessaryAlways Active\nNecessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data.\n  * Cookie\nBCTempID\n  * Duration\n10 minutes\n  * Description\nNo description available.\n\n\n  * Cookie\n__cf_bm\n  * Duration\n1 hour\n  * Description\nThis cookie, set by Cloudflare, is used to support Cloudflare Bot Management. \n\n\n  * Cookie\nAWSALBCORS\n  * Duration\n7 days\n  * Description\nAmazon Web Services set this cookie for load balancing.\n\n\n  * Cookie\n_cfuvid\n  * Duration\nsession\n  * Description\nCloudflare sets this cookie to track users across sessions to optimize user experience by maintaining session consistency and providing personalized services\n\n\n  * Cookie\nli_gc\n  * Duration\n6 months\n  * Description\nLinkedin set this cookie for storing visitor's consent regarding using cookies for non-essential purposes.\n\n\n  * Cookie\n__hssrc\n  * Duration\nsession\n  * Description\nThis cookie is set by Hubspot whenever it changes the session cookie. The __hssrc cookie set to 1 indicates that the user has restarted the browser, and if the cookie does not exist, it is assumed to be a new session.\n\n\n  * Cookie\n__hssc\n  * Duration\n1 hour\n  * Description\nHubSpot sets this cookie to keep track of sessions and to determine if HubSpot should increment the session number and timestamps in the __hstc cookie.\n\n\n  * Cookie\nwpEmojiSettingsSupports\n  * Duration\nsession\n  * Description\nWordPress sets this cookie when a user interacts with emojis on a WordPress site. It helps determine if the user's browser can display emojis properly.\n\n\n  * Cookie\nBCSessionID\n  * Duration\n1 year 1 month 4 days\n  * Description\nBlueconic sets this cookie as a unique identifier for the BlueConic profile.\n\n\n  * Cookie\n_octo\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\nlogged_in\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\n__Secure-YEC\n  * Duration\npast\n  * Description\nYouTube sets this cookie to stores the user's video player preferences using embedded YouTube video\n\n\n  * Cookie\n__eoi\n  * Duration\n6 months\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nAWSALBTGCORS\n  * Duration\n7 days\n  * Description\nNo description available.\n\n\n  * Cookie\nlogin-status-p\n  * Duration\npast\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nAWSALBTG\n  * Duration\n7 days\n  * Description\nNo description available.\n\n\n  * Cookie\ncsrf_token\n  * Duration\nsession\n  * Description\nNo description available.\n\n\n  * Cookie\ntoken_v2\n  * Duration\n1 day\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nD\n  * Duration\n1 year\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nPHPSESSID\n  * Duration\nsession\n  * Description\nThis cookie is native to PHP applications. The cookie stores and identifies a user's unique session ID to manage user sessions on the website. The cookie is a session cookie and will be deleted when all the browser windows are closed.\n\n\n  * Cookie\nVISITOR_PRIVACY_METADATA\n  * Duration\n6 months\n  * Description\nYouTube sets this cookie to store the user's cookie consent state for the current domain. \n\n\n  * Cookie\ncookietest\n  * Duration\nsession\n  * Description\nThe cookietest cookie is typically used to determine whether the user's browser accepts cookies, essential for website functionality and user experience.\n\n\n  * Cookie\n__Host-airtable-session\n  * Duration\n1 year\n  * Description\nThis cookie is used to enable us to integrate the services of Airtable.\n\n\n  * Cookie\n__Host-airtable-session.sig\n  * Duration\n1 year\n  * Description\nThis cookie is used to enable us to integrate the services of Airtable.\n\n\n  * Cookie\nm\n  * Duration\n1 year 1 month 4 days\n  * Description\nStripe sets this cookie for fraud prevention purposes. It identifies the device used to access the website, allowing the website to be formatted accordingly.\n\n\n  * Cookie\nBIGipServer*\n  * Duration\nsession\n  * Description\nMarketo sets this cookie to collect information about the user's online activity and build a profile about their interests to provide advertisements relevant to the user. \n\n\n  * Cookie\n__cfruid\n  * Duration\nsession\n  * Description\nCloudflare sets this cookie to identify trusted web traffic.\n\n\n  * Cookie\n_GRECAPTCHA\n  * Duration\n6 months\n  * Description\nGoogle Recaptcha service sets this cookie to identify bots to protect the website against malicious spam attacks.\n\n\n  * Cookie\n__Secure-YNID\n  * Duration\n6 months\n  * Description\nGoogle cookie used to protect user security and prevent fraud, especially during the login process.\n\n\n  * Cookie\ncookieyes-consent\n  * Duration\n1 year\n  * Description\nCookieYes sets this cookie to remember users' consent preferences so that their preferences are respected on subsequent visits to this site. It does not collect or store any personal information about the site visitors.\n\n\nFunctional\nFunctional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features.\n  * Cookie\nlidc\n  * Duration\n1 day\n  * Description\nLinkedIn sets the lidc cookie to facilitate data center selection.\n\n\n  * Cookie\nbrw\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\nbrwConsent\n  * Duration\n5 minutes\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nWMF-Uniq\n  * Duration\n1 year\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nloom_anon_comment\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\nloom_referral_video\n  * Duration\nsession\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nVISITOR_INFO1_LIVE\n  * Duration\n6 months\n  * Description\nA cookie set by YouTube to measure bandwidth that determines whether the user gets the new or old player interface.\n\n\n  * Cookie\nyt-remote-connected-devices\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to store the user's video preferences using embedded YouTube videos.\n\n\n  * Cookie\nytidb::LAST_RESULT_ENTRY_KEY\n  * Duration\nNever Expires\n  * Description\nThe cookie ytidb::LAST_RESULT_ENTRY_KEY is used by YouTube to store the last search result entry that was clicked by the user. This information is used to improve the user experience by providing more relevant search results in the future.\n\n\n  * Cookie\nyt-remote-device-id\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to store the user's video preferences using embedded YouTube videos.\n\n\n  * Cookie\nyt-remote-session-name\n  * Duration\nsession\n  * Description\nThe yt-remote-session-name cookie is used by YouTube to store the user's video player preferences using embedded YouTube video.\n\n\n  * Cookie\nyt-remote-fast-check-period\n  * Duration\nsession\n  * Description\nThe yt-remote-fast-check-period cookie is used by YouTube to store the user's video player preferences for embedded YouTube videos.\n\n\n  * Cookie\nyt-remote-session-app\n  * Duration\nsession\n  * Description\nThe yt-remote-session-app cookie is used by YouTube to store user preferences and information about the interface of the embedded YouTube video player.\n\n\n  * Cookie\nyt-remote-cast-available\n  * Duration\nsession\n  * Description\nThe yt-remote-cast-available cookie is used to store the user's preferences regarding whether casting is available on their YouTube video player.\n\n\n  * Cookie\nyt-remote-cast-installed\n  * Duration\nsession\n  * Description\nThe yt-remote-cast-installed cookie is used to store the user's video player preferences using embedded YouTube video.\n\n\n  * Cookie\ncp_session\n  * Duration\n3 months\n  * Description\nCodepen sets this cookie for Help systems found in the website.\n\n\n  * Cookie\nloid\n  * Duration\n1 year 1 month 4 days\n  * Description\nThis cookie is set by the Reddit. The cookie enables the sharing of content from the website onto the social media platform.\n\n\nAnalytics\nAnalytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc.\n  * Cookie\n__hstc\n  * Duration\n6 months\n  * Description\nHubspot set this main cookie for tracking visitors. It contains the domain, initial timestamp (first visit), last timestamp (last visit), current timestamp (this visit), and session number (increments for each subsequent session).\n\n\n  * Cookie\nhubspotutk\n  * Duration\n6 months\n  * Description\nHubSpot sets this cookie to keep track of the visitors to the website. This cookie is passed to HubSpot on form submission and used when deduplicating contacts.\n\n\n  * Cookie\n_ga\n  * Duration\n1 year 1 month 4 days\n  * Description\nGoogle Analytics sets this cookie to calculate visitor, session and campaign data and track site usage for the site's analytics report. The cookie stores information anonymously and assigns a randomly generated number to recognise unique visitors.\n\n\n  * Cookie\n_ga_*\n  * Duration\n1 year 1 month 4 days\n  * Description\nGoogle Analytics sets this cookie to store and count page views.\n\n\n  * Cookie\n__Host-psifi.analyticsTrace\n  * Duration\n6 hours\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\n__Host-psifi.analyticsTraceV2\n  * Duration\n6 hours\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\n_gh_sess\n  * Duration\nsession\n  * Description\nGitHub sets this cookie for temporary application and framework state between pages like what step the user is on in a multiple step form.\n\n\n  * Cookie\nYSC\n  * Duration\nsession\n  * Description\nYSC cookie is set by Youtube and is used to track the views of embedded videos on Youtube pages.\n\n\n  * Cookie\najs_anonymous_id\n  * Duration\n1 year\n  * Description\nThis cookie is set by Segment to count the number of people who visit a certain site by tracking if they have visited before.\n\n\n  * Cookie\nvuid\n  * Duration\n1 year 1 month 4 days\n  * Description\nVimeo installs this cookie to collect tracking information by setting a unique ID to embed videos on the website. \n\n\nPerformance\nPerformance cookies are used to understand and analyse the key performance indexes of the website which helps in delivering a better user experience for the visitors.\n  * Cookie\nAWSALB\n  * Duration\n7 days\n  * Description\nAWSALB is an application load balancer cookie set by Amazon Web Services to map the session to the target.\n\n\n  * Cookie\nacq\n  * Duration\npast\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nacq.sig\n  * Duration\npast\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nptc\n  * Duration\n2 years\n  * Description\nNo description available.\n\n\nAdvertisement\nAdvertisement cookies are used to provide visitors with customised advertisements based on the pages you visited previously and to analyse the effectiveness of the ad campaigns.\n  * Cookie\nmuc_ads\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to collect user behaviour and interaction data to optimize the website.\n\n\n  * Cookie\nguest_id_marketing\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to identify and track the website visitor.\n\n\n  * Cookie\nguest_id_ads\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to identify and track the website visitor.\n\n\n  * Cookie\npersonalization_id\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to integrate and share features for social media and also store information about how the user uses the website, for tracking and targeting.\n\n\n  * Cookie\nguest_id\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to identify and track the website visitor. It registers if a user is signed in to the Twitter platform and collects information about ad preferences.\n\n\n  * Cookie\nbcookie\n  * Duration\n1 year\n  * Description\nLinkedIn sets this cookie from LinkedIn share buttons and ad tags to recognize browser IDs.\n\n\n  * Cookie\n__Secure-ROLLOUT_TOKEN\n  * Duration\n6 months\n  * Description\nYouTube sets this cookie to manage feature rollout and experimentation. It helps Google control which new features or interface changes are shown to users as part of testing and staged rollouts, ensuring consistent experience for a given user during an experiment.\n\n\n  * Cookie\nyt.innertube::nextId\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to register a unique ID to store data on what videos from YouTube the user has seen.\n\n\n  * Cookie\nyt.innertube::requests\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to register a unique ID to store data on what videos from YouTube the user has seen.\n\n\n  * Cookie\nsession_tracker\n  * Duration\nsession\n  * Description\nThis cookie is set by the Reddit. This cookie is used to identify trusted web traffic. It also helps in adverstising on the website.\n\n\n  * Cookie\nedgebucket\n  * Duration\nsession\n  * Description\nReddit sets this cookie to save the information about a log-on Reddit user, for the purpose of advertisement recommendations and updating the content.\n\n\n  * Cookie\ndid\n  * Duration\n1 year\n  * Description\nArbor sets this cookie to show targeted ads to site visitors.This cookie expires after 2 months or 1 year.\n\n\nUncategorised\nOther uncategorised cookies are those that are being analysed and have not been classified into a category as yet.\nNo cookies to display.\nReject All Save My Preferences Accept All\nToggle Search[](https://towardsdatascience.com/)Toggle Mobile Navigation\n[](https://towardsdatascience.com/)\nPublish AI, ML & data-science insights to a global community of data professionals.\nSign in[Submit an Article](https://write.insightmediagroup.io)\n[Latest](https://towardsdatascience.com/latest/)[Editor's Picks](https://towardsdatascience.com/tag/editors-pick/)[Newsletter](https://towardsdatascience.com/tag/the-variable/)[ShipAI](https://towardsdatascience.com/shipai/)\n* * *\n[Write For TDS](https://towardsdatascience.com/submissions/)\n[LinkedIn](https://www.linkedin.com/company/towards-data-science/)[X](https://x.com/TDataScience)Toggle Search\n[Artificial Intelligence](https://towardsdatascience.com/category/artificial-intelligence/)\n# YOLOv2 & YOLO9000 Paper Walkthrough: Better, Faster, Stronger\nFrom YOLOv1 to YOLOv2: prior box, k-means, Darknet-19, passthrough layer, and more\n[Muhammad Ardi Putra](https://towardsdatascience.com/author/muhammad_ardi/)\nFebruary 3, 202622 min read\n![](https://assets.insightmediagroup.io/media/wp-content/uploads/2026/02/YOLOv2-Cover-Page.jpg)\nPhoto by [Clay Banks](https://unsplash.com/@claybanks?utm_source=medium&utm_medium=referral) on Unsplash\n_Better, Faster, Stronger_ — that’s the ambitious title the authors chose for their paper introducing both YOLOv2 and YOLO9000. The title of the paper itself is “ _YOLO9000: Better, Faster, Stronger_ ” [1], which was published back in December 2016. The main focus of this paper is indeed to create YOLO9000. But let’s make things clear. Despite the title of the paper, the model proposed in the study is called YOLOv2. The name YOLO9000 is their proposed algorithm specialized to detect over 9000 object categories which is built on top of the YOLOv2 architecture.\nIn this article I am going to focus on how YOLOv2 works and how to implement the architecture from scratch with PyTorch. I will also talk a little bit about how the authors eventually ended up with YOLO9000.\n···\n## From YOLOv1 to YOLOv2\nAs the name suggests, YOLOv2 is the advancement of YOLOv1. Thus, in order to understand YOLOv2, I recommend you read my previous article about YOLOv1 [2] and its loss function [3] before reading this one.\nThere were two main problems raised by the authors on YOLOv1: first, the high localization error, or in other words the bounding box predictions made by the model is not quite accurate. Second, the low recall, which is a condition where the model is unable to detect all objects within the image. There were lots of modifications made by the authors on YOLOv1 to address the above issues, which in general the changes they made are summarized in Figure 1. We are going to discuss each of these modifications one by one in the subsequent sub-sections.\nLearn this step by step with the interactive [AI Engineer](https://roadmap.sh/ai-engineer) roadmap.\n![](https://assets.insightmediagroup.io/media/wp-content/uploads/2026/01/1GuXvE998VEdtJEWtMMCojQ.png)\nFigure 1. The changes the authors made on YOLOv1 to build YOLOv2 [1].\n### Batch Normalization\nThe first modification the authors did was applying batch normalization layer. Remember that YOLOv1 is quite old. It was first introduced back when BN layer was not quite popular just yet, which was the reason why YOLOv1 do not utilize this normalization mechanism in the first place. It is already proven that BN layer is able to stabilize training, speed up convergence, dan regularize model. Thanks to this reason, the dropout layer we previously have in YOLOv1 was omitted as we apply BN layers. It is mentioned in the paper that by attaching this type layer after each convolution they obtained 2.4% improvement in mAP from 63.4% to 65.8%.\n### Better Fine-Tuning\nNext, the authors proposed a better way to perform fine-tuning. Previously in YOLOv1 the backbone model was pretrained on ImageNet classification dataset which the images had the size of 224×224. Then, they replaced the classification head with detection head and directly fine-tune it on PASCAL VOC detection dataset which contains images of size 448×448. Here we can clearly see that there was something like a “jump” thanks to the different image resolutions in pretraining and fine-tuning. The pipeline used for training YOLOv2 is slightly modified, where the authors added an intermediate step, namely fine-tuning the model on 448×448 ImageNet before fine-tuning it again on PASCAL VOC of the same image resolution. This additional step allows the model to get adapted to the higher resolution image before being fine-tuned for detection, unlike in YOLOv1 which the model is forced to work on 448×448 images directly after being pretrained on 224×224 images. This new fine-tuning pipeline allowed the mAP to increase by 3.7% from 65.8% to 69.5%.\n![](https://assets.insightmediagroup.io/media/wp-content/uploads/2026/01/1kq0-gxcZAjsyp6doKzi5mg.png)\nFigure 2. The fine-tuning mechanism of YOLOv1 and YOLOv2 [4].\n### Anchor Box and Fully Convolutional Network\nThe next modification was related to the use of anchor box. If you’re not yet familiar with it, this is essentially a template bounding box (a.k.a. prior box) corresponding to a single grid cell, which is rescaled to match the actual object size. The model is then trained to predict the offset of the anchor box rather than the bounding box coordinates like YOLOv1. We can think of an anchor box as the starting point of the model to make bounding box prediction. According to the paper, predicting offset like this is easier than predicting coordinates, hence allowing the model to perform better. Figure 3 below illustrates 5 anchor boxes that correspond to the top-left grid cell. Later on, the same anchor boxes will be applied to all grid cells within the image.\n![](https://assets.insightmediagroup.io/media/wp-content/uploads/2026/01/1NtWjCfAJo2ZQgJcrg4jH1A.png)\nFigure 3. Example of 5 anchor boxes applied to the top-left grid cell of an image [5].\nThe use of anchor boxes also changed the way we do the object classification. Previously in YOLOv1 we had each grid cell predicted two bounding boxes, yet it could only predict a single object class. YOLOv2 addresses this issue by attaching the object classification mechanism with the anchor box rather than the grid cell, allowing each anchor box from the same grid cell to predict different object classes. Mathematically speaking, the length of the prediction vector of YOLOv1 can be formulated as (B×5)+C for each grid cell, whereas in YOLOv2 this prediction vector length changed to B×(5+C), where _B_ is the number of bounding box to be generated, _C_ is the number of classes in the dataset, and 5 is the number of _xywh_ and the bounding box confidence value. With the mechanism introduced in YOLOv2, the prediction vector indeed becomes longer, but it allows each anchor box predicts its own class. The figure below illustrates the prediction vectors of YOLOv1 and YOLOv2, where we set _B_ to 2 and _C_ to 20. In this particular case, the length of the prediction vectors of both models are (2×5)+20=30 and 2×(5+20)=50, respectively.\n![](https://assets.insightmediagroup.io/media/wp-content/uploads/2026/01/1vqp5BcSrdnm3KbasBvR-2w.png)\nFigure 4. What the prediction vectors of YOLOv1 and YOLOv2 look like for 20-class PASCAL VOC object detection dataset [5].\nAt this point authors also replaced the fully-connected layers in YOLOv1 with a stack of convolution layers, causing the entire model to be a fully convolutional network which has the downsampling factor of 32. This downsampling factor causes an input tensor of size 448×448 to get reduced to 14×14. The authors argued that large objects are usually located in the middle of an image, so they made the output feature map to have odd dimensions, ensuring that there is a single center cell to predict such objects. In order to achieve this, the authors changed the input shape to 416×416 as the default configuration so that the output dimension has the spatial resolution of 13×13.\nInterestingly, the use of anchor box and fully convolutional network caused the mAP to decrease by 0.3% from 69.5% to 69.2% instead, yet at the same time the recall increased by 7% from 81% to 88%. This improvement in recall was particularly caused by the increase of the number of predictions made by the model. In the case of YOLOv1, the model could only predict 7×7=49 objects in total, and now YOLOv2 can predict up to 13×13×5=845 objects, where the number 5 comes from the default number of anchor boxes used. Meanwhile, the decrease in mAP indicated that there was a room for improvement on the anchor boxes.\n### Prior Box Clustering and Constrained Predictions\nThe authors indeed saw a problem in the anchor boxes, and so in the subsequent step they tried to modify the way it works. Previously in Faster R-CNN the anchor boxes were manually handpicked, which caused them to not optimally represent all object shapes in the dataset. To address this problem, authors used K-means to cluster the distribution of the bounding box size. They did it by taking the _w_ and _h_ values of the bounding boxes in the object detection dataset, putting them into two-dimensional space, and clustering the datapoints using K-means as usual. The authors decided to use _K_ =5, which essentially means that we will later have that number of clusters. \nThe illustration in Figure 5 below displays what the bounding box size distribution looks like, where each black datapoint represents a single bounding box in the dataset and the green circles are the centroids which will then act as the size of our anchor boxes. Note that this illustration is indeed created based on dummy data, but the idea here is that the datapoint located at the top-right represents a large square bounding box, the one in the top-left is a vertical rectangle box, and so on.\n![](https://assets.insightmediagroup.io/media/wp-content/uploads/2026/01/15aeNGeOzqT_Bdnun67rMJQ.png)\nFigure 5. Example of a bounding box distribution. The bounding box sizes are scaled to 0–1 relative to the image size [5].\nIf you’re familiar with K-means, we typically use Euclidean distance to measure the distance between datapoints and the centroids. But here the authors created a new distance metric specifically for this case, in which they used the complement of the IOU between the bounding boxes and the cluster centroids. See the equation below for the details.\n![](https://assets.insightmediagroup.io/media/wp-content/uploads/2026/01/1QWphSoJ0T-uaimVEwNw_rw.png)\nFigure 6. The distance metric the authors use to measure distance between the bounding boxes in the dataset (black datapoints) and the anchor boxes (green centroids).\nUsing the distance metric above, we can see in the following table that the prior boxes generated using K-means clustering (highlighted in blue) have a greater average IOU compared to the prior boxes used in Faster R-CNN (highlighted in green) despite the smaller number of prior boxes (5 vs 9). This essentially indicates that the proposed clustering mechanism allows the resulting prior boxes to represent the bounding box size distribution in the dataset better as compared to the handpicked anchor boxes.\n![](https://assets.insightmediagroup.io/media/wp-content/uploads/2026/01/1VmT6M7bYj1IJm5rP1N5VEg.png)\nFigure 7. Comparison of different methods for generating prior box [1].\nStill related to prior box, the authors found that predicting anchor box offset like Faster R-CNN was actually still not quite optimal thanks to the unbounded equation. If we take a look at the Figure 8 below, there is a possibility that the box position could be shifted wildly throughout the entire image, causing the training difficult especially in earlier stages.\n![](https://assets.insightmediagroup.io/media/wp-content/uploads/2026/01/1F27Ot_ZZFHZ7juLzopX2fA.png)\nFigure 8. The equations used in Faster R-CNN for transforming anchor box coordinates and size [1].\nInstead of being relative to the anchor box like Faster R-CNN, the authors solved this issue by adopting the idea of predicting location coordinates relative to the grid cell from YOLOv1. However, the authors further modify this by introducing sigmoid function to constrain the _xy_ coordinate prediction of the network, effectively bounds the value to the range of 0 to 1 hence causing the predicted location will never fall outside the corresponding grid cell, as shown in the first and the second rows in Figure 9. Next, the _w_ and _h_ of the bounding box are processed with exponential function (third and fourth row), which is useful to prevent negative values because it is just nonsense to have negative width or height. Meanwhile, the way to compute confidence score at the fifth row is the same as YOLOv1, namely by calculating the multiplication of objectness confidence and the IOU between the predicted and the target box.\n![](https://assets.insightmediagroup.io/media/wp-content/uploads/2026/01/1zETUJsTYRseKJKjS3E8Ueg.png)\nFigure 9. The equations used by YOLOv2 to make bounding box prediction [1].\nSo in simple words, we indeed adopt the concept of prior box introduced by Faster R-CNN, but instead of handpicking the box, we use clustering to automatically find the most optimal prior box sizes. The bounding box is created with additional sigmoid function for the _xy_ and exponential function for the _wh_. It is worth noting that now the _x_ and _y_ are relative to the grid cell while the _w_ and _h_ are relative to the prior box. The authors found that this method improved mAP from 69.6% to 74.4%.\n### Passthrough Layer\nThe final output feature map of YOLOv2 has the spatial dimension of 13×13, in which each element corresponds to a single grid cell. The information contained within each grid cell is considered coarse, which absolutely makes sense because maxpooling layers within the network indeed work by taking only the highest values from the earlier feature map. This might not be a problem if the objects to be detected are considerably large. But if the objects are small, our model might be having hard time in performing the detection due to the loss of information contained in the non-prominent pixels.\nTo address this problem, authors proposed to apply the so-called _passthrough layer_. The objective of this layer is to preserve fine-grained information from earlier feature map before being downsampled by maxpooling layer. In Figure 12, the part of the network referred to as passthrough layer is the connection that branches out from the network before eventually merging back to the main flow in the end. The idea of this layer is quite similar to identity mapping introduced in ResNet. However, the process done in that model is simpler because the tensor dimension from the original flow and the one in the skip-connection matches exactly, allowing them to be element-wise sumed. The case is different in passthrough layer, in which here the latter feature map has a smaller spatial dimension, hence we need to think a way to combine information from the two tensors. The authors came up with an idea where they divide the image in the passthrough layer and then stack the divided tensors in channel-wise manner as shown in Figure 10 below. By doing so, we will have the spatial dimension of the resulting tensor matches with the subsequent feature map, allowing them to be concatenated along the channel axis. The fine-grained information from the former layer will then be combined with the higher-level features from the latter layer using a convolution layer.\n![](https://assets.insightmediagroup.io/media/wp-content/uploads/2026/01/10trHMCYhgDVn_O5bPlaoow.png)\nFigure 10. How the tensor is processed inside the passthrough layer to adapt the dimension to the subsequent layer [5].\n### Multi-Scale Training\nPreviously I’ve mentioned that in YOLOv2 all FC layers have been replaced with a stack of convolution layers. This essentially allows us to feed images of different scales within the same training process, considering that the weights of CNN-based model correspond to the trainable parameters in the kernel, which is independent of the input image dimension. In fact, this is actually the reason why the authors decided to remove the FC layers in the first place. During the training phase, authors changed the input resolution every 10 batches randomly from 320×320, 352×352, 384×384, and so on to 608×608, all with multiple of 32. This process can be thought of as their approach to augment the data so that the model can detect objects across varying input dimensions, which I believe it also allows the model to predict objects of different scales with better performance. This process boosted mAP to 76.8% on the default input resolution 416×416, and it got even higher to 78.6% when we they increased the image resolution further to 544×544.\n### Darknet-19\nAll modifications on YOLOv1 we discussed in the previous sub sections were all related to how the authors improve detection quality in terms of the mAP and recall. Now the focus of this sub section is to improve model performance in terms of the speed. It is mentioned in the paper that the authors use a model referred to as Darknet-19 as the backbone, which has less operations compared to the backbone of YOLOv1 (5.58 billion vs 8.52 billion), allowing YOLOv2 to run faster than its predecessor. The original version of this model consists of 19 convolution layers and 5 maxpooling layers, which the details can be seen in Figure 11 below.\n![](https://assets.insightmediagroup.io/media/wp-content/uploads/2026/01/1k-r2W8e7ZiKZJHNkmnJU1Q.png)\nFigure 11. The vanilla Darknet-19 architecture [1].\nIt is important to note that the above architecture is the vanilla Darknet-19 model, which is only suitable for classification task. To adapt it with the requirement of YOLOv2, we need to slightly modify it by adding passthrough layer and replacing the classification head with detection head. You can see the modified architecture in Figure 12 below.\n![](https://assets.insightmediagroup.io/media/wp-content/uploads/2026/01/1KCoTnHNsgMJxhenF-xr5QA.png)\nFigure 12. The complete YOLOv2 architecture [5].\nHere you can see that the passthrough layer is placed after the last 26×26 feature map. This passthrough layer will reduce the spatial dimension to 13×13, allowing it to be concatenated in channel-wise manner with the 13×13 feature map from the main flow. Later in the next section I am going to demonstrate how to implement this Darknet-19 architecture from scratch including the detection head as well as the passthrough layer.\n### 9000-Class Object Detection\nYOLOv2 model was initially trained on PASCAL VOC and COCO datasets which have 20 and 80 number of object classes, respectively. The authors saw this as a problem because they thought that this number is very limited for general case, and hence lack of versatility. Due to this reason, it is necessary to improve the model such that it can detect a wider variety of object classes. However, creating object detection dataset is very expensive and laborious, because not only the object classes but we are also required to annotate the bounding box information. \nThe authors came up with a very clever idea, where they combined ImageNet, which has over 22,000 classes, with COCO using class hierarchy mechanism which they refer to as WordTree as shown in Figure 13. You can see the illustration in the figure that blue nodes are the classes from COCO dataset, while the red ones are from ImageNet dataset. The object categories available in the COCO dataset are relatively general, whereas the ones in ImageNet are a lot more fine-grained. For instance, if in COCO we got _airplane_ , in ImageNet we got _biplane_ , _jet_ , _airbus_ , and _stealth fighter_. So using the idea of WordTree, the authors put these four airplane types as the subclass of _airplane_. You can think of the inference like this: the model works by predicting bounding box and the parent class, then it will check if it got subclasses. If so, the model will continue predicting from the smaller subset of classes. \nBy combining the two datasets like this, we eventually ended up with a model that is capable of predicting over 9000 object classes (9418 to be exact), hence the name YOLO9000.\n![](https://assets.insightmediagroup.io/media/wp-content/uploads/2026/01/1lldyQ-VgYNgVnXYvm-wdWA.png)\nFigure 13. The class grouping mechanism used in YOLO9000 [1].\n···\n## YOLOv2 Architecture Implementation\nAs I promised earlier, in this section I am going to demonstrate how to implement the YOLOv2 architecture from scratch so that you can get better understanding about how an input image eventually becomes a tensor containing bounding box and class predictions.\nNow what we need to do first is to import the required modules which is shown in Codeblock 1 below.\npython\n\n```\n# Codeblock 1\nimport torch\nimport torch.nn as nn\n```\n\nNext, we create the `ConvBlock` class, in which it is going to encapsulate the convolution layer itself, a batch normalization layer and a leaky ReLU activation function. The `negative_slope` parameter itself is set to 0.1 as shown at line `#(1)`, which is exactly the same as the one used in YOLOv1.\npython\n\n```\n# Codeblock 2\nclass ConvBlock(nn.Module):\n    def __init__(self, \n                 in_channels, \n                 out_channels, \n                 kernel_size, \n                 padding):\n        super().__init__()\n        \n        self.conv = nn.Conv2d(in_channels=in_channels,\n                              out_channels=out_channels, \n                              kernel_size=kernel_size, \n                              padding=padding)\n        self.bn = nn.BatchNorm2d(num_features=out_channels)\n        self.leaky_relu = nn.LeakyReLU(negative_slope=0.1)    #(1)\n        \n    def forward(self, x):\n        print(f'original\\t: {x.size()}')\n\n        x = self.conv(x)\n        print(f'after conv\\t: {x.size()}')\n        \n        x = self.leaky_relu(x)\n        print(f'after leaky relu: {x.size()}')\n        \n        return x\n```\n\nJust to check if the above class works properly, here I test it with a very simple test case, where I initialize a `ConvBlock` instance which accepts an RGB image of size 416×416. You can see in the resulting output that the image now has 64 channels, proving that our `ConvBlock` works properly.\npython\n\n```\n# Codeblock 3\nconvblock = ConvBlock(in_channels=3,\n                      out_channels=64,\n                      kernel_size=3,\n                      padding=1)\nx = torch.randn(1, 3, 416, 416)\nout = convblock(x)\n```\n\nmarkup\n\n```\n# Codeblock 3 Outputoriginal         : torch.Size([1, 3, 416, 416])after conv       : torch.Size([1, 64, 416, 416])after leaky relu : torch.Size([1, 64, 416, 416])\n```\n\n### Darknet-19 Implementation\nNow let’s use this `ConvBlock` class to construct the Darknet-19 architecture. The way to do so is pretty simple, as what we need to do is just to stack multiple `ConvBlock` instances followed by a maxpooling layer according to the architecture in Figure 12. See the details in Codeblock 4a below. Note that the maxpooling layer for `stage4` is placed at the beginning of `stage5` as shown at the line marked with `#(1)`. This is essentially done because the output of `stage4` will directly be fed into the passthrough layer without being downsampled. In addition to this, it is important to note that the term “stage” is not officially mentioned in the paper. Rather, this is just a term I personally use for the sake of this implementation.\npython\n\n```\n# Codeblock 4a\nclass Darknet(nn.Module):\n    def __init__(self):\n        super(Darknet, self).__init__()\n        \n        \n        self.stage0 = nn.ModuleList([\n            ConvBlock(3, 32, 3, 1),\n            nn.MaxPool2d(kernel_size=2, stride=2)\n        ])\n        \n        self.stage1 = nn.ModuleList([\n            ConvBlock(32, 64, 3, 1),\n            nn.MaxPool2d(kernel_size=2, stride=2)\n        ])\n            \n        self.stage2 = nn.ModuleList([\n            ConvBlock(64, 128, 3, 1), \n            ConvBlock(128, 64, 1, 0), \n            ConvBlock(64, 128, 3, 1),\n            nn.MaxPool2d(kernel_size=2, stride=2)\n        ])\n        \n        self.stage3 = nn.ModuleList([\n            ConvBlock(128, 256, 3, 1), \n            ConvBlock(256, 128, 1, 0), \n            ConvBlock(128, 256, 3, 1),\n            nn.MaxPool2d(kernel_size=2, stride=2)\n        ])\n        \n        self.stage4 = nn.ModuleList([\n            ConvBlock(256, 512, 3, 1), \n            ConvBlock(512, 256, 1, 0), \n            ConvBlock(256, 512, 3, 1), \n            ConvBlock(512, 256, 1, 0), \n            ConvBlock(256, 512, 3, 1), \n        ])\n        \n        self.stage5 = nn.ModuleList([\n            nn.MaxPool2d(kernel_size=2, stride=2),    #(1)\n            ConvBlock(512, 1024, 3, 1), \n            ConvBlock(1024, 512, 1, 0), \n            ConvBlock(512, 1024, 3, 1), \n            ConvBlock(1024, 512, 1, 0), \n            ConvBlock(512, 1024, 3, 1), \n        ])\n```\n\nAs all layers have been initialized, the next thing we do is to connect all these layers using the `forward()` method in Codeblock 4b below. Previously I said that we will take the output of `stage4` as the input for the passthrough layer. To do so, I store the feature map produced by the last layer of `stage4` in a separate variable which I refer to as `x_stage4` (`#(1)`). We then do the same thing for the output of `stage5` (`#(2)`) and return both `x_stage4` and `x_stage5` as the output of our `Darknet` (`#(3)`).\npython\n\n```\n# Codeblock 4b\n    def forward(self, x):\n        print(f'original\\t: {x.size()}')\n        \n        print()\n        for i in range(len(self.stage0)):\n            x = self.stage0[i](x)\n            print(f'after stage0 #{i}\\t: {x.size()}')\n        \n        print()\n        for i in range(len(self.stage1)):\n            x = self.stage1[i](x)\n            print(f'after stage1 #{i}\\t: {x.size()}')\n        \n        print()\n        for i in range(len(self.stage2)):\n            x = self.stage2[i](x)\n            print(f'after stage2 #{i}\\t: {x.size()}')\n        \n        print()\n        for i in range(len(self.stage3)):\n            x = self.stage3[i](x)\n            print(f'after stage3 #{i}\\t: {x.size()}')\n        \n        print()\n        for i in range(len(self.stage4)):\n            x = self.stage4[i](x)\n            print(f'after stage4 #{i}\\t: {x.size()}')\n            \n        x_stage4 = x.clone()        #(1)\n        \n        print()\n        for i in range(len(self.stage5)):\n            x = self.stage5[i](x)\n            print(f'after stage5 #{i}\\t: {x.size()}')\n        \n        x_stage5 = x.clone()        #(2)\n\n        return x_stage4, x_stage5   #(3)\n```\n\nNext, I test the Darknet-19 model above by passing the same dummy image as the one in our previous test case.\npython\n\n```\n# Codeblock 5\ndarknet = Darknet()\n\nx = torch.randn(1, 3, 416, 416)\nout = darknet(x)\n```\n\nmarkup\n\n```\n# Codeblock 5 Outputoriginal        : torch.Size([1, 3, 416, 416])after stage0 #0 : torch.Size([1, 32, 416, 416])after stage0 #1 : torch.Size([1, 32, 208, 208])after stage1 #0 : torch.Size([1, 64, 208, 208])after stage1 #1 : torch.Size([1, 64, 104, 104])after stage2 #0 : torch.Size([1, 128, 104, 104])after stage2 #1 : torch.Size([1, 64, 104, 104])after stage2 #2 : torch.Size([1, 128, 104, 104])after stage2 #3 : torch.Size([1, 128, 52, 52])after stage3 #0 : torch.Size([1, 256, 52, 52])after stage3 #1 : torch.Size([1, 128, 52, 52])after stage3 #2 : torch.Size([1, 256, 52, 52])after stage3 #3 : torch.Size([1, 256, 26, 26])after stage4 #0 : torch.Size([1, 512, 26, 26])after stage4 #1 : torch.Size([1, 256, 26, 26])after stage4 #2 : torch.Size([1, 512, 26, 26])after stage4 #3 : torch.Size([1, 256, 26, 26])after stage4 #4 : torch.Size([1, 512, 26, 26])after stage5 #0 : torch.Size([1, 512, 13, 13])after stage5 #1 : torch.Size([1, 1024, 13, 13])after stage5 #2 : torch.Size([1, 512, 13, 13])after stage5 #3 : torch.Size([1, 1024, 13, 13])after stage5 #4 : torch.Size([1, 512, 13, 13])after stage5 #5 : torch.Size([1, 1024, 13, 13])\n```\n\nHere we can see that our output matches exactly with the architectural details in Figure 12, indicating that our implementation of the Darknet-19 model is correct.\n### The Entire YOLOv2 Architecture\nBefore actually constructing the entire YOLOv2 architecture, we need to initialize the parameters for the model first. Here we want every single cell to generate 5 anchor boxes, hence we need to set the `NUM_ANCHORS` variable to that number. Next, I set `NUM_CLASSES` to 20 because we assume that we want to train the model on PASCAL VOC dataset.\npython\n\n```\n# Codeblock 6\nNUM_ANCHORS = 5\nNUM_CLASSES = 20\n```\n\nNow it’s time to define the `YOLOv2` class. In the Codeblock 7a below, we initially define the `__init__()` method, where we initialize the `Darknet `model (`#(1)`), a single `ConvBlock` for the passthrough layer (`#(2)`), a stack of two convolution layers which I refer to as `stage6` (`#(3)`), and another stack of two convolution layers which the last one is used to map the tensor into prediction vector with B×(5+C) number of channels (`#(4)`).\npython\n\n```\n# Codeblock 7a\nclass YOLOv2(nn.Module):\n    def __init__(self):\n        super().__init__()\n        \n        self.darknet = Darknet()                       #(1)\n        \n        self.passthrough = ConvBlock(512, 64, 1, 0)    #(2)\n        \n        self.stage6 = nn.ModuleList([                  #(3)\n            ConvBlock(1024, 1024, 3, 1), \n            ConvBlock(1024, 1024, 3, 1), \n        ])\n\n        self.stage7 = nn.ModuleList([\n            ConvBlock(1280, 1024, 3, 1),\n            ConvBlock(1024, NUM_ANCHORS*(5+NUM_CLASSES), 1, 0)    #(4)\n        ])\n```\n\nAfterwards, we define the so-called `reorder()` method, which we will use to process the feature map in the passthrough layer. The logic of the code below is quite complicated though, but the main idea is that it follows the principle given in Figure 10. Here I show you the output of each line so that you can get better understanding of how the process goes inside the function given an input tensor of shape 1×64×26×26, which represents a single image of size 26×26 with 64 channels. In the last step we can see that the final output tensor has the shape of 1×256×13×13. This shape matches exactly with our requirement, where the channel dimension becomes 4 times larger than that of the input while at the same time the spatial dimension halves.\npython\n\n```\n# Codeblock 7b\n    def reorder(self, x, scale=2):                      # ([1, 64, 26, 26])\n        B, C, H, W = x.shape\n        h, w = H // scale, W // scale\n\n        x = x.reshape(B, C, h, scale, w, scale)         # ([1, 64, 13, 2, 13, 2])     \n        x = x.transpose(3, 4)                           # ([1, 64, 13, 13, 2, 2])\n\n        x = x.reshape(B, C, h * w, scale * scale)       # ([1, 64, 169, 4])\n        x = x.transpose(2, 3)                           # ([1, 64, 4, 169])\n\n        x = x.reshape(B, C, scale * scale, h, w)        # ([1, 64, 4, 13, 13])\n        x = x.transpose(1, 2)                           # ([1, 4, 64, 13, 13])\n\n        x = x.reshape(B, scale * scale * C, h, w)       # ([1, 256, 13, 13])\n\n        return x\n```\n\nNext, the Codeblock 7c below shows how we create the flow of the network. We initially start from the `darknet` backbone, in which it returns `x_stage4` and `x_stage5` (`#(1)`). The `x_stage5` tensor will directly be processed with the subsequent convolution layers which I refer to as `stage6` (`#(2)`) whereas the `x_stage4` tensor will be passed to the passthrough layer (`#(3)`) and processed by the `reorder()` (`#(4)`) method we defined in Codeblock 7b above. Afterwards, we then concatenate both tensors in channel-wise manner at line `#(5)`. This concatenated tensor is then processed further with another stack of convolution layers called `stage7` (`#(6)`) which returns the prediction vector.\npython\n\n```\n# Codeblock 7c\n    def forward(self, x):\n        print(f'original\\t\\t\\t: {x.size()}')\n        \n        x_stage4, x_stage5 = self.darknet(x)              #(1)\n        print(f'\\nx_stage4\\t\\t\\t: {x_stage4.size()}')\n        print(f'x_stage5\\t\\t\\t: {x_stage5.size()}')\n        \n        print()\n        x = x_stage5\n        for i in range(len(self.stage6)):\n            x = self.stage6[i](x)                         #(2)\n            print(f'x_stage5 after stage6 #{i}\\t: {x.size()}')    \n        \n        x_stage4 = self.passthrough(x_stage4)             #(3)\n        print(f'\\nx_stage4 after passthrough\\t: {x_stage4.size()}')\n        \n        x_stage4 = self.reorder(x_stage4)                 #(4)\n        print(f'x_stage4 after reorder\\t\\t: {x_stage4.size()}')\n        \n        x = torch.cat([x_stage4, x], dim=1)               #(5)\n        print(f'\\nx after concatenate\\t\\t: {x.size()}')\n        \n        for i in range(len(self.stage7)):                 #(6)\n            x = self.stage7[i](x)\n            print(f'x after stage7 #{i}\\t: {x.size()}')    \n        \n        return x\n```\n\nAgain, to test the above code we will pass through a tensor of size 1×3×416×416.\npython\n\n```\n# Codeblock 8\nyolov2 = YOLOv2()\nx = torch.randn(1, 3, 416, 416)\n\nout = yolov2(x)\n```\n\nAnd below is what the output looks like after the code is run. The outputs referred to as `stage0` to `stage5` are the processes within the Darknet backbone, in which this is exactly the same as the one I showed you earlier in Codeblock 5 Output. Afterwards we can see in `stage6` that the shape of the `x_stage5` tensor does not change at all (`#(1–3)`). Meanwhile, the channel dimension of `x_stage4` increased from 64 to 256 after being processed by the `reorder()` operation (`#(4–5)`). The tensor from the main flow is then concatenated with the one from passthrough layer, which caused the number of channels in the resulting tensor became 1024+256=1280 (`#(6)`). Lastly, we pass the tensor to `stage7` which returns a prediction tensor of size 125×13×13, denoting that we have 13×13 grid cells where every single of those cells contains a prediction vector of length 125 (`#(7)`), storing the bounding box and the object class predictions.\nmarkup\n\n```\n# Codeblock 8 Outputoriginal        : torch.Size([1, 3, 416, 416])after stage0 #0 : torch.Size([1, 32, 416, 416])after stage0 #1 : torch.Size([1, 32, 208, 208])after stage1 #0 : torch.Size([1, 64, 208, 208])after stage1 #1 : torch.Size([1, 64, 104, 104])after stage2 #0 : torch.Size([1, 128, 104, 104])after stage2 #1 : torch.Size([1, 64, 104, 104])after stage2 #2 : torch.Size([1, 128, 104, 104])after stage2 #3 : torch.Size([1, 128, 52, 52])after stage3 #0 : torch.Size([1, 256, 52, 52])after stage3 #1 : torch.Size([1, 128, 52, 52])after stage3 #2 : torch.Size([1, 256, 52, 52])after stage3 #3 : torch.Size([1, 256, 26, 26])after stage4 #0 : torch.Size([1, 512, 26, 26])after stage4 #1 : torch.Size([1, 256, 26, 26])after stage4 #2 : torch.Size([1, 512, 26, 26])after stage4 #3 : torch.Size([1, 256, 26, 26])after stage4 #4 : torch.Size([1, 512, 26, 26])after stage5 #0 : torch.Size([1, 512, 13, 13])after stage5 #1 : torch.Size([1, 1024, 13, 13])after stage5 #2 : torch.Size([1, 512, 13, 13])after stage5 #3 : torch.Size([1, 1024, 13, 13])after stage5 #4 : torch.Size([1, 512, 13, 13])after stage5 #5 : torch.Size([1, 1024, 13, 13])x_stage4        : torch.Size([1, 512, 26, 26])x_stage5        : torch.Size([1, 1024, 13, 13])              #(1)x_stage5 after stage6 #0   : torch.Size([1, 1024, 13, 13])   #(2)x_stage5 after stage6 #1   : torch.Size([1, 1024, 13, 13])   #(3)x_stage4 after passthrough : torch.Size([1, 64, 26, 26])     #(4)x_stage4 after reorder     : torch.Size([1, 256, 13, 13])    #(5)x after concatenate        : torch.Size([1, 1280, 13, 13])   #(6)x after stage7 #0          : torch.Size([1, 1024, 13, 13])x after stage7 #1          : torch.Size([1, 125, 13, 13])\n```\n\n···\n## Ending\nI think that’s pretty much everything about YOLOv2 and its model architecture implementation from scratch. The code used in this article is also available on my GitHub repository [6]. Please let me know if you spot any mistake in my explanation or in the code. Thanks for reading, I hope you learn something new from this article. See ya in my next writing!\n···\n## References\n[1] Joseph Redmon and Ali Farhadi. YOLO9000: Better, Faster, Stronger. Arxiv. <https://arxiv.org/abs/1612.08242> [Accessed August 9, 2025].\n[2] [Muhammad Ardi](https://medium.com/u/9801a58700ac). YOLOv1 Paper Walkthrough: The Day YOLO First Saw the World. Medium. <https://medium.com/ai-advances/yolov1-paper-walkthrough-the-day-yolo-first-saw-the-world-ccff8b60d84b> [Accessed January 24, 2026].\n[3] [Muhammad Ardi](https://medium.com/u/9801a58700ac). YOLOv1 Loss Function Walkthrough: Regression for All. Towards Data Science. <https://towardsdatascience.com/yolov1-loss-function-walkthrough-regression-for-all/> [Accessed January 24, 2026].\n[4] Image originally created by author, partially generated with Gemini\n[5] Image originally created by author\n[6] MuhammadArdiPutra. Better, Faster, Stronger — YOLOv2 and YOLO9000. GitHub. <https://github.com/MuhammadArdiPutra/medium_articles/blob/main/Better%2C%20Faster%2C%20Stronger%20-%20YOLOv2%20and%20YOLO9000.ipynb> [Accessed August 9, 2025].\n## Register Now to Continue Reading\n### Unlock Towards Data Science with a Free Account\nAll articles on Towards Data Science are available to registered users. Create a free account today to access this article and thousands more.\nRegister for freeSign in to your account\n* * *\n![](https://assets.insightmediagroup.io/media/1787657598287_taxhya.jpeg)\nWritten By\n## [Muhammad Ardi Putra](https://towardsdatascience.com/author/muhammad_ardi/)\nDeep learning storyteller\n[See all from Muhammad Ardi Putra](https://towardsdatascience.com/author/muhammad_ardi/)\n[Editor's Picks](https://towardsdatascience.com/tag/editors-pick/)[Deep Learning](https://towardsdatascience.com/tag/deep-learning/)[Object Detection](https://towardsdatascience.com/tag/object-detection/)[Pytorch](https://towardsdatascience.com/tag/pytorch/)[Yolo](https://towardsdatascience.com/tag/yolo/)\nShare This Article\n  * [](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Ftowardsdatascience.com%2Fyolov2-yolo9000-paper-walkthrough-better-faster-stronger%2F&title=YOLOv2%20%26%20YOLO9000%20Paper%20Walkthrough%3A%20Better%2C%20Faster%2C%C2%A0Stronger)\n  * [](https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Ftowardsdatascience.com%2Fyolov2-yolo9000-paper-walkthrough-better-faster-stronger%2F&title=YOLOv2%20%26%20YOLO9000%20Paper%20Walkthrough%3A%20Better%2C%20Faster%2C%C2%A0Stronger)\n  * [](https://x.com/share?url=https%3A%2F%2Ftowardsdatascience.com%2Fyolov2-yolo9000-paper-walkthrough-better-faster-stronger%2F&text=YOLOv2%20%26%20YOLO9000%20Paper%20Walkthrough%3A%20Better%2C%20Faster%2C%C2%A0Stronger)\n\n\nTowards Data Science is a community publication. Submit your insights to reach our global audience and earn through the TDS Author Payment Program.\n[Write for TDS](https://towardsdatascience.com/submissions/)\n## Related Articles\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2026/01/annie-spratt-MEKriXlIuag-unsplash-scaled-1.jpg)](https://towardsdatascience.com/creating-an-etch-a-sketch-app-using-python-turtle/)\n## [Creating an Etch A Sketch App Using Python and Turtle](https://towardsdatascience.com/creating-an-etch-a-sketch-app-using-python-turtle/)\n[Programming](https://towardsdatascience.com/category/programming/)\nA beginner-friendly Python tutorial\n[Mahnoor Javed](https://towardsdatascience.com/author/mahnoorjaved/)\nJanuary 30, 20266 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2023/11/1MtpnoTuT0pURs8E3MfHh6A.png)](https://towardsdatascience.com/methods-for-modelling-customer-lifetime-value-the-good-stuff-and-the-gotchas-445f8a6587be/)\n## [Methods for Modelling Customer Lifetime Value: The Good Stuff and the Gotchas](https://towardsdatascience.com/methods-for-modelling-customer-lifetime-value-the-good-stuff-and-the-gotchas-445f8a6587be/)\n[Data Science](https://towardsdatascience.com/category/data-science/)\nPart three of a comprehensive, practical guide to CLV techniques and real-world use-cases\n[Katherine Munro](https://towardsdatascience.com/author/katherineamunro/)\nNovember 17, 202310 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2022/08/0KPSst3HGdbklqW3F.png)](https://towardsdatascience.com/wish-tackles-peeking-with-always-valid-p-values-8a0782ac9654/)\n## [Wish Tackles Peeking with Always Valid p-values](https://towardsdatascience.com/wish-tackles-peeking-with-always-valid-p-values-8a0782ac9654/)\n[Data Science](https://towardsdatascience.com/category/data-science/)\nPeek and conclude experiments adaptively without inflating the false-positive rate\n[Qike (Max) Li](https://towardsdatascience.com/author/qike_max_li/)\nAugust 24, 20229 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2023/12/1WOYT7Jo_MUeqijgeiaEgrQ.gif)](https://towardsdatascience.com/clip-model-and-the-importance-of-multimodal-embeddings-1c8f6b13bf72/)\n## [CLIP Model and The Importance of Multimodal Embeddings](https://towardsdatascience.com/clip-model-and-the-importance-of-multimodal-embeddings-1c8f6b13bf72/)\n[Artificial Intelligence](https://towardsdatascience.com/category/artificial-intelligence/)\nCLIP, which stands for Contrastive Language-Image Pretraining, is a deep learning model developed by OpenAI in 2021. CLIP's embeddings for...\n[Fahim Rustamy, PhD](https://towardsdatascience.com/author/faheemrustamy/)\nDecember 11, 202310 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2021/08/1RQAOGhcNs3w2QWkI9cNy5w.jpeg)](https://towardsdatascience.com/how-does-python-garbage-collection-work-a5dc544d880d/)\n## [How Does Python Garbage Collection Work?](https://towardsdatascience.com/how-does-python-garbage-collection-work-a5dc544d880d/)\n[Artificial Intelligence](https://towardsdatascience.com/category/artificial-intelligence/)\nKeep your Python objects being referenced, or they will be released in memory.\n[Christopher Tao](https://towardsdatascience.com/author/christophertao/)\nAugust 29, 20217 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2022/06/1SzjGLtcmhOlrriCnyLpQ8Q.png)](https://towardsdatascience.com/calvin-a-neural-network-that-can-learn-to-plan-and-navigate-unknown-environments-820a8444276f/)\n## [CALVIN - a neural network that can learn to plan and navigate unknown environments](https://towardsdatascience.com/calvin-a-neural-network-that-can-learn-to-plan-and-navigate-unknown-environments-820a8444276f/)\n[Deep Learning](https://towardsdatascience.com/category/artificial-intelligence/deep-learning/)\nCALVIN is a neural network that can plan, explore and navigate in novel 3D environments, provided expert demonstrations.\n[Shu Ishida](https://towardsdatascience.com/author/alacreme/)\nJune 1, 20225 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2022/04/0qQ_AcNirSyLE_WD9-scaled.jpg)](https://towardsdatascience.com/data-mining-market-basket-analysis-with-apriori-algorithm-970ff256a92c/)\n## [Data Mining: Market Basket Analysis with Apriori Algorithm](https://towardsdatascience.com/data-mining-market-basket-analysis-with-apriori-algorithm-970ff256a92c/)\n[Artificial Intelligence](https://towardsdatascience.com/category/artificial-intelligence/)\nUncovering the secret behind why breads are always conveniently placed beside butter in groceries\n[Yenwee Lim](https://towardsdatascience.com/author/limyenwee_19946/)\nApril 8, 20228 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2022/11/0MMz-EotiFIIUgDB0-scaled.jpg)](https://towardsdatascience.com/artificial-intelligence-for-geospatial-analysis-with-pytorchs-torchgeo-part-2-ec3785fae284/)\n## [Artificial Intelligence for Geospatial Analysis with Pytorch's TorchGeo (part 2)](https://towardsdatascience.com/artificial-intelligence-for-geospatial-analysis-with-pytorchs-torchgeo-part-2-ec3785fae284/)\n[Artificial Intelligence](https://towardsdatascience.com/category/artificial-intelligence/)\nAn end-to-end deep learning geospatial segmentation project using Pytorch and TorchGeo packages\n[Maurício Cordeiro](https://towardsdatascience.com/author/cordmaur/)\nNovember 30, 20228 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2022/04/1g6FgPwIICQQrB3APnUsgRA.jpeg)](https://towardsdatascience.com/a-guide-to-building-an-image-duplicate-finder-system-4a46021410f1/)\n## [Build an Image Duplicate Finder System: A Guide](https://towardsdatascience.com/a-guide-to-building-an-image-duplicate-finder-system-4a46021410f1/)\n[Artificial Intelligence](https://towardsdatascience.com/category/artificial-intelligence/)\nYour zero-to-hero guide to detecting duplicate and near-duplicate images\n[Orjuwan Zaafarani](https://towardsdatascience.com/author/orjwan.zaafarani/)\nApril 30, 20225 min read\n\n\n  * [YouTube](https://www.youtube.com/c/TowardsDataScience)\n  * [X](https://x.com/TDataScience)\n  * [LinkedIn](https://www.linkedin.com/company/towards-data-science/)\n  * [Threads](https://www.threads.net/@towardsdatascience)\n  * [Bluesky](https://bsky.app/profile/towardsdatascience.com)\n\n\n[](https://towardsdatascience.com/)\nYour home for data science and AI. The world's leading publication for data science, data analytics, data engineering, machine learning, and artificial intelligence professionals.\nSubscribe to Our Newsletter[Write For TDS](https://towardsdatascience.com/submissions/)•[About](https://towardsdatascience.com/about-towards-data-science-d691af11cc2f/)•[Advertise](https://contact.towardsdatascience.com/advertise-with-towards-data-science)•[Privacy Policy](https://towardsdatascience.com/privacy-policy/)•[Terms of Use](https://towardsdatascience.com/website-terms-of-use/)\n© Insight Media Group, LLC 2026•[The New Stack](https://thenewstack.io)•[roadmap.sh](https://roadmap.sh)•[Creator Network](https://insightmediagroup.io/creator-network)\n####  Recommended Articles \nClose\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607686/image?etag=1782161464448&width=500&height=500) How Relevance Models Foreshadowed Transformers for NLP ](https://towardsdatascience.com/how-relevance-models-foreshadowed-transformers-for-nlp/ \"How Relevance Models Foreshadowed Transformers for NLP\")\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607639/image?etag=1781250125848&width=500&height=500) Javascript Fatigue: HTMX Is All You Need to Build ChatGPT — Part 1 ](https://towardsdatascience.com/javascript-fatigue-you-dont-need-js-to-build-chatgpt/ \"Javascript Fatigue: HTMX Is All You Need to Build ChatGPT — Part 1\")\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607930/image?etag=1782124566054&width=500&height=500) The Subset Sum Problem Solved in Linear Time for Dense Enough Inputs ](https://towardsdatascience.com/subset-sum-problem-solved-in-linear-time-for-dense-enough-inputs/ \"The Subset Sum Problem Solved in Linear Time for Dense Enough Inputs\")\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/3660/image?etag=1780176246070&width=500&height=500) Does Your Company Have a Data Strategy? ](https://towardsdatascience.com/does-your-company-have-a-data-strategy-e8944dbec4ae/ \"Does Your Company Have a Data Strategy?\")\n\n\n",
  "body_base_path": "attachments/4d82a4a37762/pages/",
  "body_markdown_path": "attachments/4d82a4a37762/pages/archived-body.md",
  "local_html": "attachments/4d82a4a37762/pages/archived-body.html",
  "body_source": "prior_capture"
}