{
  "source_file": "0930",
  "source_platform": "技术平台",
  "author": "Satya Mallick / LearnOpenCV",
  "title_listed": "YOLOv7: A Deep Dive",
  "keywords": "YOLOv7,目标检测,深度学习",
  "domain": "图像处理",
  "content_type": "教程",
  "is_paid_flag": "否",
  "url": "https://learnopencv.com/yolov7-object-detection-paper-explanation-and-inference/",
  "publish_date": "2022-07",
  "corpus_stage": "预训练/SFT",
  "notes": "YOLOv7目标检测深度解析",
  "id": "581f2af0f6fd",
  "collected_at": "2026-10-02T17:29:12",
  "title": "YOLOv7 Paper Explanation: Object Detection and YOLOv7 Pose",
  "body_markdown": "We use essential cookies to make our site work. With your consent, we may also use non-essential cookies to improve user experience and analyze website traffic. By clicking “Accept,” you agree to our website's cookie use as described in our Cookie Policy. You can change your cookie settings at any time by clicking “Preferences.” \nAccept\n[ ![](../images/000.png) ](https://learnopencv.com)\n  * [Getting Started](https://learnopencv.com/category/install/)\n    * [Subscribe](https://learnopencv.com/)\n    * [Installation](https://learnopencv.com/category/install/)\n    * [Getting Started with OpenCV](https://learnopencv.com/getting-started-with-opencv/)\n    * [PyTorch](https://learnopencv.com/getting-started-with-pytorch/)\n    * [Tensorflow & Keras](https://learnopencv.com/getting-started-with-tensorflow-keras/)\n  * [Free Courses](https://opencv.org/university/free-courses/?utm_source=lopcv&utm_medium=menu&utm_campaign=fcpage)\n    * [VLM Bootcamp](https://opencv.org/university/vision-language-model-bootcamp/?utm_source=lopcv&utm_medium=menu&utm_campaign=vlm)\n    * [PyTorch Bootcamp](https://opencv.org/university/free-pytorch-course/?utm_source=lopcv&utm_medium=menu&utm_campaign=ptbc)\n    * [TensorFlow Keras Course](https://opencv.org/university/free-tensorflow-keras-course/?utm_source=lopcv&utm_medium=menu&utm_campaign=tbc)\n    * [OpenCV Course](https://opencv.org/university/free-opencv-course/?utm_source=lopcv&utm_medium=menu&utm_campaign=obc)\n    * [Python for Beginners](https://opencv.org/university/python-for-beginners/?utm_source=lopcv&utm_medium=menu&utm_campaign=pbc)\n  * [AI Consulting](https://bigvision.ai/expert-ai-solution-builders/#talk?utm_source=locv&utm_medium=menu)\n  * [About](https://learnopencv.com/about/)\n\n\n  * [Getting Started](https://learnopencv.com/category/install/)\n    * [Subscribe](https://learnopencv.com/)\n    * [Installation](https://learnopencv.com/category/install/)\n    * [Getting Started with OpenCV](https://learnopencv.com/getting-started-with-opencv/)\n    * [PyTorch](https://learnopencv.com/getting-started-with-pytorch/)\n    * [Tensorflow & Keras](https://learnopencv.com/getting-started-with-tensorflow-keras/)\n  * [Free Courses](https://opencv.org/university/free-courses/?utm_source=lopcv&utm_medium=menu&utm_campaign=fcpage)\n    * [VLM Bootcamp](https://opencv.org/university/vision-language-model-bootcamp/?utm_source=lopcv&utm_medium=menu&utm_campaign=vlm)\n    * [PyTorch Bootcamp](https://opencv.org/university/free-pytorch-course/?utm_source=lopcv&utm_medium=menu&utm_campaign=ptbc)\n    * [TensorFlow Keras Course](https://opencv.org/university/free-tensorflow-keras-course/?utm_source=lopcv&utm_medium=menu&utm_campaign=tbc)\n    * [OpenCV Course](https://opencv.org/university/free-opencv-course/?utm_source=lopcv&utm_medium=menu&utm_campaign=obc)\n    * [Python for Beginners](https://opencv.org/university/python-for-beginners/?utm_source=lopcv&utm_medium=menu&utm_campaign=pbc)\n  * [AI Consulting](https://bigvision.ai/expert-ai-solution-builders/#talk?utm_source=locv&utm_medium=menu)\n  * [About](https://learnopencv.com/about/)\n\n\nSearch ...\nResults\nSee all results\n  * [Home](https://learnopencv.com \"Home\")\n  * >\n  * [CNN](https://learnopencv.com/category/cnn/ \"CNN\")\n  * >\n  * YOLOv7 Object Detection Paper Explanation & Inference\n\n\n[Kukil](https://learnopencv.com/author/kukil/), [Sovit Rath](https://learnopencv.com/author/sovit/)\n  * on  August 2, 2022\n\n\n# YOLOv7 Object Detection Paper Explanation & Inference\nA technical review of YOLOv7 paper along with inference report. YOLOv7 Pose detection code included.\n  * [CNN](https://learnopencv.com/category/cnn/), [Object Detection](https://learnopencv.com/category/object-detection/), [Pose Estimation](https://learnopencv.com/category/pose-estimation/), [YOLO](https://learnopencv.com/category/yolo/)\n\n\n![YOLOv7 Object Detection Paper Explanation and Inference](../images/006.gif)\n0%\n  *   *   * [ ](https://bigvision.ai/expert-ai-solution-builders?utm_source=lopcv&utm_medium=post-icon)\n\n\n## What is YOLOv7?\nYOLOv7 is a single-stage real-time object detector. It was introduced to the YOLO family in July’22. According to the YOLOv7 paper, it is the fastest and most accurate real-time object detector to date. YOLOv7 established a significant benchmark by taking its performance up a notch.\nThis article contains simplified **YOLOv7** paper explanation and inference tests. We will go through the YOLOv7 GitHub repository and test inference. We will also see how YOLOv7 compares with other object detectors of the YOLO family.  \n|  **What will be covered in the post?**  \n1. YOLOv7 architecture, What’s new?  \n2. Object Detection using YOLOv7  \n3. YOLOv7 models and comparative analysis  \n4. YOLOv7 Pose: Human Pose Estimation |  \n| --- |  \n  1. [YOLO Architecture in General](https://learnopencv.com/yolov7-object-detection-paper-explanation-and-inference/#YOLO-Architecture-in-General)\n  2. [What’s new in YOLOv7?](https://learnopencv.com/yolov7-object-detection-paper-explanation-and-inference/#What%E2%80%99s-new-in-YOLOv7?)\n  3. [YOLOv7 Architecture](https://learnopencv.com/yolov7-object-detection-paper-explanation-and-inference/#YOLOv7-Architecture)\n  4. [Trainable Bag of Freebies in YOLOv7](https://learnopencv.com/yolov7-object-detection-paper-explanation-and-inference/#Trainable-Bag-of-Freebies-in-YOLOv7)\n  5. [YOLOv7 Experiments and Results](https://learnopencv.com/yolov7-object-detection-paper-explanation-and-inference/#YOLOv7-Experiments-and-Results)\n    1. [mAP Comparison: YOLOv7 vs Others](https://learnopencv.com/yolov7-object-detection-paper-explanation-and-inference/#mAP-Comparison-YOLOv7-vs-Others)\n    2. [FPS Comparison: YOLOv7 vs Others](https://learnopencv.com/yolov7-object-detection-paper-explanation-and-inference/#FPS-Comparison-YOLOv7-vs-Others)\n  6. [YOLOv7 Object Detection Inference](https://learnopencv.com/yolov7-object-detection-paper-explanation-and-inference/#YOLOv7-Object-Detection-Inference)\n  7. [Comparison between YOLOv4, YOLOv5-Large and YOLOv7](https://learnopencv.com/yolov7-object-detection-paper-explanation-and-inference/#Comparison-between-YOLOv4,-YOLOv5-Large-and-YOLOv7)\n  8. [YOLOv7 Pose Estimation](https://learnopencv.com/yolov7-object-detection-paper-explanation-and-inference/#YOLOv7-Pose-Estimation)\n    1. [YOLOv7 Pose prerequisites](https://learnopencv.com/yolov7-object-detection-paper-explanation-and-inference/#YOLOv7-Pose-prerequisites)\n    2. [YOLOv7 Pose Code](https://learnopencv.com/yolov7-object-detection-paper-explanation-and-inference/#YOLOv7-Pose-Code)\n  9. [Summary of YOLOv7](https://learnopencv.com/yolov7-object-detection-paper-explanation-and-inference/#Summary-of-YOLOv7)\n\n\n## YOLO Master Post – Every Model Explained\nUnlock the full story behind all the YOLO models’ evolutionary journey: Dive into our extensive pillar post, where we unravel the evolution from YOLOv1 to YOLO-NAS. This essential guide is packed with insights, comparisons, and a deeper understanding that you won’t find anywhere else.  \nDon’t miss out on this comprehensive resource, Mastering [All Yolo Models](https://learnopencv.com/mastering-all-yolo-models/) for a richer, more informed perspective on the YOLO series.\n![](../images/body-582e7f1b1da09ec362b4.gif)\n## [Mastering All YOLO Models from YOLOv1 to YOLO-NAS: Papers Explained (2024)](https://learnopencv.com/mastering-all-yolo-models/)\n## **YOLO Architecture in General**\n**YOLO architecture** is FCNN(Fully Connected Neural Network) based. However, Transformer-based versions have also recently been added to the YOLO family. We will discuss Transformer based detectors in a separate post. For now, let’s focus on FCNN (Fully Convolutional Neural Network) based YOLO object detectors.\nThe YOLO framework has three main components. \n  * **Backbone**\n  * **Head**\n  * **Neck**\n\n\nThe **Backbone** mainly extracts essential features of an image and feeds them to the **Head** through **Neck**. The **Neck** collects feature maps extracted by the **Backbone** and creates feature pyramids. Finally, the head consists of output layers that have final detections. The following table shows the architectures of YOLOv4, YOLOv4, and YOLOv5.\n[![YOLO object detector architecture](../images/011.jpg)](https://cdn.learnopencv.com/wp-content/uploads/2022/08/04092446/model-architecture-yolo-summary.jpg)\nTable1: Model architecture summary of YOLOv3, YOLOv4, and [YOLOv5](https://learnopencv.com/custom-object-detection-training-using-yolov5/)\nApart from architectural modifications, there are several other improvements. Go through the [YOLO series](https://learnopencv.com/category/yolo/) for detailed information.\n## **What’s New in YOLOv7?**\nYOLOv7 improves speed and accuracy by introducing several architectural reforms. Similar to Scaled YOLOv4, YOLOv7 backbones do not use ImageNet pre-trained backbones. Rather, the models are trained using the COCO dataset entirely. The similarity can be expected because YOLOv7 is written by the same authors as Scaled YOLOv4, which is an extension of [YOLOv4](https://learnopencv.com/pothole-detection-using-yolov4-and-darknet/). The following major changes have been introduced in the YOLOv7 paper. We will go through them one by one.\n  * **Architectural Reforms**\n    * E-ELAN (Extended Efficient Layer Aggregation Network)\n    * Model Scaling for Concatenation-based Models \n  * **Trainable BoF (Bag of Freebies)**\n    * Planned re-parameterized convolution\n    * Coarse for auxiliary and Fine for lead loss\n\n\n## **YOLOv7 Architecture**\nThe architecture is derived from YOLOv4, Scaled YOLOv4, and YOLO-R. Using these models as a base, further experiments were carried out to develop new and improved YOLOv7.\n### E-ELAN (Extended Efficient Layer Aggregation Network) in YOLOv7 paper\nThe E-ELAN is the computational block in the YOLOv7 backbone. It takes inspiration from previous research on network efficiency. It has been designed by analyzing the following factors that impact speed and accuracy.\n  * Memory access cost\n  * I/O channel ratio\n  * Element wise operation\n  * Activations\n  * Gradient path\n\n  \n| _The proposed E-ELAN uses expand, shuffle, and merge cardinality to achieve the ability to continuously enhance the learning ability of the network without destroying the original gradient path._ |  \n| --- |  \nIn simple terms, E-ELAN architecture enables the framework to learn better. It is based on the ELAN computational block. The ELAN paper has not been published yet when writing this post. We will update the post by adding ELAN details when available.\n[![Yolov7 paper study E-ELAN](../images/016.png)](https://cdn.learnopencv.com/wp-content/uploads/2022/08/04092451/yolov7-architecture-e-elan.png)\nFig: E-ELAN and previous work on maximal layer efficiency\n### Compound Model Scaling in YOLOv7\nDifferent applications require different models. While some need highly accurate models, some prioritize speed. Model scaling is performed to suit these requirements and make it fit in various computing devices.\nWhile scaling a model size, the following parameters are considered.\n  * Resolution ( size of the input image)\n  * Width (number of channels)\n  * Depth (number of layers)\n  * Stage (number of feature pyramids)\n\n\nNAS (Network Architecture Search) is a commonly used model scaling method. It is used by researchers to iterate through the parameters to find the best scaling factors. However, methods like NAS do parameter-specific scaling. The **scaling factors are independent** in this case.\nThe authors of the YOLOv7 paper show that it can be further optimized with a **compound model scaling approach**. Here, width and depth are scaled in coherence for concatenation-based models.\n[![Yolov7 paper explanation compound scaling](../images/023.png)](https://cdn.learnopencv.com/wp-content/uploads/2022/08/04092445/yolov7-compound-model-scaling-yolov7-paper-1.png)\nFig: YOLOv7 compound scaling\n## **Trainable Bag of Freebies in YOLOv7**\nBoF or Bag of Freebies are methods that increase the performance of a model without increasing the training cost. YOLOv7 has introduced the following BoF methods.\n### Planned Re-parameterized Convolution\nRe-parameterization is a technique used after training to improve the model. It increases the training time but improves the inference results. Two types of re-parametrization are used to finalize models: Model**level** and **Module level** ensemble.\n**Model level re-parametrization** can be done in the following two ways.\n  * Using different training data but the same settings, train multiple models. Then average their weights to obtain the final model.\n  * Take the average of the weights of models at different epochs.\n\n\nRecently, **Module level re-parameterization** has gained a lot of traction in research. In this method, the model training process is split into multiple modules. The outputs are ensembled to obtain the final model. The authors in the YOLOv7 paper show the best possible ways to perform module-level ensemble (shown below).\n[![Yolov7 paper explanation module level reparameterization](../images/028.png)](https://cdn.learnopencv.com/wp-content/uploads/2022/08/04092448/yolov7-module-planned-re-parameterization.png)\nFig: Re-parameterization trials\nIn the diagram above, The 3×3 convolution layer of the E-ELAN computational block is replaced with the RepConvlayer. Experiments we carried out by switching or replacing the positions of RepConv, 3×3 Conv, and Identity connection. The residual bypass arrow shown above is an identity connection. It is nothing but a 1×1 convolutional layer. We can see the configurations that work and the ones that do not. Check out more about RepConv in the RepVGG paper.\nIncluding RepConv, YOLOv7 also performs re-parameterization on Conv-BN (Convolution Batch Normalization), **OREPA**(Online Convolutional Re-parameterization), and YOLO-R to get the best results. We will discuss the implementation part in a separate post.\n### Coarse for Auxiliary and Fine for Lead Loss\nAs you already know by now, YOLO architecture comprises a backbone, a neck, and a head. The head contains the predicted outputs. YOLOv7 does not limit itself to a single head. It has multiple heads to do whatever it wants. Interesting, isn’t it?\nHowever, it’s not the first time a multi-headed framework was introduced. **Deep Supervision,** a technique used by DL models, uses multiple heads**.** In YOLOv7, the head responsible for final output is called the **Lead Head.** And the head used to assist training in the middle layers is called the **Auxiliary Head**.\nWith the help of an**assistant loss** , the weights of the auxiliary heads are updated. It allows for **Deep Supervision,** and the model learns better. These concepts are closely coupled with the **Lead Head** and the **Label Assigner.**\n**Label Assigner** is a mechanism that considers the network prediction results together with the ground truth and then assigns **soft labels**. It’s important to note that the label assigner generates soft and coarse labels instead of hard ones.\n#### Lead Head Guided Label Assigner and Coarse-to-Fine Lead Head Guided Label Assigner\nThe Lead Head Guided Label Assigner encapsulates the following three concepts.\n  * Lead Head\n  * Auxiliary Head\n  * Soft Label Assigner\n\n[![Yolov7 paper explanation label assigner](../images/033.png)](https://cdn.learnopencv.com/wp-content/uploads/2022/08/04092449/yolov7-label-assigner.png)\nThe Lead Head in the YOLOv7 network predicts the final results. Soft labels are generated based on these final results. The important part is that the loss is calculated for both the lead head and the auxiliary head based on the same soft labels that are generated. Ultimately, both heads get trained using the soft labels. This is shown in the left image in the above figure. \nOne may ask here, **_“why soft labels?”._** The authors have put it quite well in the paper:\n“The reason to do this is that the lead head has a relatively strong learning capability. So the soft label generated from it should be more representative of the distribution and correlation between the source data and the target. By letting the shallower auxiliary head directly learn the information that the lead head has learned, the lead head will be more able to focus on learning residual information that has not yet been learned.”\nNow, coming to the **coarse-to-fine** labels as shown in the right image in the previous figure. In the above process, two sets of soft labels are generated.\n  * A **fine label** to train the lead head\n  * A set of **coarse labels** to train the auxiliary head.\n\n\nThe fine labels are the same as the directly generated soft labels. However, more grids are treated as positive targets to generate the coarse labels. This is done by relaxing the constraints of the positive sample assignment process.\n## YOLOv7 Experiments and Results\nAll the YOLOv7 models surpass the previous object detectors in speed and accuracy in the range of 5 FPS to 160 FPS. The following figure gives a pretty good idea about the Average Precision(AP) and speed of the YOLOv7 models compared to the others.\n[![Yolov7 paper explanation yolov7 benchmark](../images/038.png)](https://cdn.learnopencv.com/wp-content/uploads/2022/08/04092448/yolov7-ms-coco-speed-ap-comparison.png)\nIt is clear from the figure that starting from YOLOv7, there is no competition with YOLOv7 in terms of speed and accuracy.\n**_Note: The results discussed_** further are from the YOLOv7 paper,**_where all the inference experiments were done on a Tesla V100 GPU. All AP results were done either on the COCO validation or test set._**\n### mAP Comparison: YOLOv7 vs Others\nThe following table shows the comparison of YOLOv7 models with other baseline object detectors. \n[![Yolov7 paper explanation model comparison](../images/body-a5ccf186bcdaac978523.png)](https://cdn.learnopencv.com/wp-content/uploads/2022/08/04092450/yolov7-comparison.png)\nTable: YOLOv7 vs Other Baseline Models\nThe results shown above are mostly grouped together according to a range of parameters for a particular set of models.\n  * Starting with the YOLOv7-Tiny model, the smallest in the family with just over 6 million parameters. With a validation AP of 35.2%, it beats YOLOv4-Tiny models with similar parameters.\n\n\n  * The YOLOv7 normal model with almost 37 million parameters gives 51.2% AP. It beats variants of YOLOv4 and YOLOR, which have more parameters easily.\n\n\n  * The larger models in the YOLO7 family are YOLOv7-X, YOLOv7-E6, YOLOv7-D6, and YOLOv7-E6E. All of these beat the respective YOLOR models having either a similar or lesser number of parameters and giving APs of 52.9%, 55.9%, 56.3%, and 56.8%, respectively. \n\n\nNow, it is not only the YOLOv4 and YOLOR models that YOLOv7 surpasses. Comparing the validation APs with that of the [YOLOv5 ](https://learnopencv.com/object-detection-using-yolov5-and-opencv-dnn-in-c-and-python/)and YOLOv7 models, which have parameters in the same range, it is pretty clear that YOLOv7 also beats all of the YOLOv5 models. \n### FPS Comparison: YOLOv7 vs Others\nTable 2 in the YOLOv7 paper provides a comprehensive comparison of the FPS of YOLOv7 with other models. It also includes the COCO [mAP](https://learnopencv.com/mean-average-precision-map-object-detection-model-evaluation-metric/) comparison.\nIt is already established that the YOLOv7 has the highest FPS and mAP in the range of 5 FPS to 160 FPS. All the FPS comparisons were done on the Tesla V100 [GPU](https://learnopencv.com/demystifying-gpu-architectures-for-deep-learning/).\n[![yolov7 paper explanation model fps comparison](../images/body-7d96636d85e0f9af3aa1.png)](https://cdn.learnopencv.com/wp-content/uploads/2022/08/04092449/yolov7-models-inference-speed-chart.png)\n**Table:** YOLOv7 models FPS comparison\nIt is worth noting that **_none of the YOLOv7 models are meant for mobile devices/mobile CPUs_**(as mentioned in the YOLOv7 paper). \n  * YOLOv7-Tiny, YOLOv7, and YOLOv7-W6 are meant for edge GPU, normal (consumer) GPU, and cloud [GPU](https://learnopencv.com/demystifying-gpu-architectures-for-deep-learning-part-2/), respectively.\n\n\n  * YOLOv7-E6 and YOLOv7-D6, and YOLOv7-E6E are also meant for high-end cloud GPUs only.\n\n\nNonetheless, all of the YOLOv7 models run at more than 30 FPS on the Tesla V100 GPU, which is more than real-time FPS.\nThe experiments above prove that YOLOv7 models outperform the existing object detectors. Both in terms of speed and accuracy.\n???????? Skip to Training YOLOv7: [Training YOLOv7 on Custom Pothole Dataset](https://learnopencv.com/fine-tuning-yolov7-on-custom-dataset/)\n**Download Code** To easily follow along this tutorial, please download code by clicking on the button below. It's FREE!\n[Download Code](javascript:void\\(0\\))\n## YOLOv7 Object Detection Inference\nNow, let’s get into the exciting part of the blog post, that is, running inference on videos using YOLOv7. We will run the inference using the YOLOv7 and YOLOv7-Tiny models. Along with that, we will also compare the results with that of the YOLOv5 and YOLOv4 models.  \n|  **Note:** All the inference results shown here were run on a machine with**6 GB GTX 1060 (laptop GPU), 8th generation i7 CPU, and 16 GB of RAM.**  |  \n| --- |  \nIf you intend to run object detection inference experiments on your own videos, you have to clone the YOLOv7 GitHub repository using the following command.\n\n```\ngit clone https://github.com/WongKinYiu/yolov7.git\n\n```\n\nThen you can use the **detect.py** script to run inference on the videos of your choice. You will also need to download the [yolov7-tiny.pt](https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7-tiny.pt) and [yolov7.pt](https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7.pt) pre-trained model.\nHere, we will run inference on three videos depicting the following three different scenarios.\n  * The first video is to test how the YOLOv7 object detection models perform on small and far-off objects.\n  * The second video has a lot of people depicting a crowded scenario.\n  * And the third video is one where many YOLO models (v4, v5, and v7) make the same general mistake while detecting the objects.\n\n\nThe YOLOv7 results here are shown together for the **Tiny** and **Normal** models for all three videos. This will help us compare the results for each of the results in an easy manner.\nLet’s check the detection inference results on the first video using the YOLOv7-Tiny (top) and YOLOv7 (bottom) models. The following commands were used to run the inference using the Tiny and Normal models.\n\n```\npython detect.py --source ../inference_data/video_1.mp4 --weights yolov7-tiny.pt --name video_tiny_1 --view-img\n\n```\n\n\n```\npython detect.py --source ../inference_data/video_1.mp4 --weights yolov7.pt --name video_1 --view-img\n\n```\n\nYOLOv7-tiny\nYOLOv7-Normal\nWe can see the limitations of the YOLOv7-Tiny model right away. It cannot detect cars, motorcycles, and persons who are very far off and small. The YOLOv7 model can detect these objects better. But that’s not the entire story. Although YOLO7-Tiny is not performing that well, it is much faster than YOLOv7. While YOLOv7 gave around 19 FPS, YOLOv7-Tiny ran it at**around 42 FPS, which is well above real-time**.\nNow, let’s check out the results of the second video, which depicts a crowded scenario. We use the same command as above but change the values for the **–source** and **–name** flags depending on the video path and name.\nYOLOv7 tiny\nYOLOv7 Normal\nThe YOLOv7 model can detect persons with less fluctuation and more confidence compared to the YOLOv7-Tiny model. Not only that, but YOLOv7-Tiny is also missing out on some of the traffic lights and people who are far away.\nLet’s run the inference on a final video that shows some general failure cases across all the YOLOv7 models.\nYOLOv7 tiny\nYOLOv7 Normal\nWe can see some of the general mistakes across both models:\n  * Detecting other road signs as **stop signs.**\n  * Detecting the forbidden road symbols as **persons** wrongly.\n\n\nAs we will see later, the above two mistakes are common across YOLOv4 and YOLOv5.\nEven though the YOLO7-Tiny makes more mistakes than the YOLOv7 model, it is much faster. On average, the YOLOv7-Tiny runs at more than 40 FPS, while the YOLOv7 model runs at slightly above 20 FPS.\n## Comparison Between YOLOv4, YOLOv5-Large, and YOLOv7 Model\nThe following three videos show the comparison between the YOLOv4, YOLOv5-Large, and the YOLOv7 model (top to bottom) on one of the videos. This will give us a proper qualitative idea of how each model performs across various scenarios.\nYOLOv4\nYOLOv5-Large\nYOLOv7\nAnd the following table shows the FPS and run times for different variants of the three models on the three videos.\n[![yolov7 paper explanation inference speed comparison](../images/body-0155b7c5eb1fa369fe7e.png)](https://cdn.learnopencv.com/wp-content/uploads/2022/08/04092447/yolov7-vs-other-detectors-inference-speed.png)\nTable: YOLOv7 vs Other detectors inference speed chart\n## YOLOv7 Pose Estimation\nYOLOv7 is the first in the YOLO family to include a human pose estimation model. This is really interesting because there are very few real-time models out there. \nRecently, the official repository also got updated with a pre-trained pose estimation model. Hence, we will not cover the details in this post. A dedicated article on the internals of the YOLOv7 Pose Estimation model will be published later. In this section, we will discuss the application part and observe how it works.  \n|  **[Update: 18/10/22]:** We have kept our promise. Check out the detailed [YOLOv7 Pose Estimation](https://learnopencv.com/yolov7-pose-vs-mediapipe-in-human-pose-estimation/) article here. |  \n| --- |  \n### YOLOv7 Pose Prerequisites\nFirst, please ensure that you have cloned the YOLOv7 GitHub repository. Now, execute the following command within the cloned yolov7 directory to download the pre-trained pose estimation model.\n\n```\nwget https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7-w6-pose.pt\n\n```\n\n### YOLOv7 Pose Code\nWe will need a custom script to run pose estimation inference using the pre-trained model. Let’s write the code in a new **yolov7_keypoint.py** script inside the yolov7 directory. \n\n```\nimport matplotlib.pyplot as plt\nimport torch\nimport cv2\nimport numpy as np\nimport time\n\nfrom torchvision import transforms\nfrom utils.datasets import letterbox\nfrom utils.general import non_max_suppression_kpt\nfrom utils.plots import output_to_keypoint, plot_skeleton_kpts\n\ndevice = torch.device(\"cuda:0\" if torch.cuda.is_available() else \"cpu\")\nweigths = torch.load('yolov7-w6-pose.pt')\nmodel = weigths['model']\nmodel = model.half().to(device)\n_ = model.eval()\n\nvideo_path = '../inference_data/video_4.mp4'\n\n```\n\nWe import all the required modules and load the pre-trained **yolov7-w6-pose.pt** model, and initialize a **video_path** variable for the path to the source video. **_If you intend to run this inference on your own videos, please change the video_path accordingly._**\nNext, let’s read the video from the disk and create the **[VideoWriter](https://learnopencv.com/reading-and-writing-videos-using-opencv/)** object to save the resulting video on the disk.\n\n```\ncap = cv2.VideoCapture(video_path)\nif (cap.isOpened() == False):\n  print('Error while trying to read video. Please check path again')\n\n# Get the frame width and height.\nframe_width = int(cap.get(3))\nframe_height = int(cap.get(4))\n\n# Pass the first frame through `letterbox` function to get the resized image,\n# to be used for `VideoWriter` dimensions. Resize by larger side.\nvid_write_image = letterbox(cap.read()[1], (frame_width), stride=64, auto=True)[0]\nresize_height, resize_width = vid_write_image.shape[:2]\n\nsave_name = f\"{video_path.split('/')[-1].split('.')[0]}\"\n# Define codec and create VideoWriter object .\nout = cv2.VideoWriter(f\"{save_name}_keypoint.mp4\",\n                    cv2.VideoWriter_fourcc(*'mp4v'), 30,\n                    (resize_width, resize_height))\n\n\nframe_count = 0 # To count total frames.\ntotal_fps = 0 # To get the final frames per second.\n\n```\n\nFinally, we have a while loop running through each frame in the video.\n\n```\nwhile(cap.isOpened):\n  # Capture each frame of the video.\n  ret, frame = cap.read()\n  if ret:\n      orig_image = frame\n      image = cv2.cvtColor(orig_image, cv2.COLOR_BGR2RGB)\n      image = letterbox(image, (frame_width), stride=64, auto=True)[0]\n      image_ = image.copy()\n      image = transforms.ToTensor()(image)\n      image = torch.tensor(np.array([image.numpy()]))\n      image = image.to(device)\n      image = image.half()\n\n      # Get the start time.\n      start_time = time.time()\n      with torch.no_grad():\n          output, _ = model(image)\n        # Get the end time.\n      end_time = time.time()\n      # Get the fps.\n      fps = 1 / (end_time - start_time)\n      # Add fps to total fps.\n      total_fps += fps\n      # Increment frame count.\n      frame_count += 1\n\n      output = non_max_suppression_kpt(output, 0.25, 0.65, nc=model.yaml['nc'], nkpt=model.yaml['nkpt'], kpt_label=True)\n      output = output_to_keypoint(output)\n      nimg = image[0].permute(1, 2, 0) * 255\n      nimg = nimg.cpu().numpy().astype(np.uint8)\n      nimg = cv2.cvtColor(nimg, cv2.COLOR_RGB2BGR)\n      for idx in range(output.shape[0]):\n          plot_skeleton_kpts(nimg, output[idx, 7:].T, 3)\n\n          # Comment/Uncomment the following lines to show bounding boxes around persons.\n          xmin, ymin = (output[idx, 2]-output[idx, 4]/2), (output[idx, 3]-output[idx, 5]/2)\n          xmax, ymax = (output[idx, 2]+output[idx, 4]/2), (output[idx, 3]+output[idx, 5]/2)\n          cv2.rectangle(\n              nimg,\n              (int(xmin), int(ymin)),\n              (int(xmax), int(ymax)),\n              color=(255, 0, 0),\n              thickness=1,\n              lineType=cv2.LINE_AA\n          )\n\n      # Write the FPS on the current frame.\n      cv2.putText(nimg, f\"{fps:.3f} FPS\", (15, 30), cv2.FONT_HERSHEY_SIMPLEX,\n                  1, (0, 255, 0), 2)\n      # Convert from BGR to RGB color format.\n      cv2.imshow('image', nimg)\n      out.write(nimg)\n      # Press `q` to exit.\n      if cv2.waitKey(1) & 0xFF == ord('q'):\n          break\n  else:\n      break\n# Release VideoCapture().\ncap.release()\n# Close all frames and video windows.\ncv2.destroyAllWindows()\n# Calculate and print the average FPS.\navg_fps = total_fps / frame_count\nprint(f\"Average FPS: {avg_fps:.3f}\")\n\n```\n\nThe above code:\n  * Loops through each frame.\n  * Carries out the pose estimation.\n  * Creates the output frame.\n  * Writes the FPS on top of the current resulting frame.\n  * Shows the resulting frame on the screen and writes it to disk as well.\n\n\nNow, let’s execute the above code for YOLOv7 pose estimation.\n\n```\npython yolov7_keypoint.py\n\n```\n\nThe following is the output.\nThe results look pretty good given the high FPS that we get. But note that the 60 FPS that we get here is only for the forward pass of the model. The FPS will likely decrease if we include post-processing such as NMS (Non-Max Suppression), thresholding, and annotation. Still, it is impressively high.\n## Summary of YOLOv7\nWith this, we conclude the introduction to YOLOv7. I hope you enjoyed reading the article. In summary, we have covered the following.\n  * The general architecture of YOLO consists of Backbone, Neck, and Head.\n  * Architectural reforms of YOLOv7.\n    * E-ELAN\n    * Compound Model Scaling in YOLOv7\n  * Trainable Bag of Freebies in YOLOv7.\n    * Re-parameterization in YOLOv7\n    * Coarse for Auxiliary and Fine for Lead loss\n  * How to use the YOLOv7 GitHub repository to run object detection inference.\n  * YOLOv7 surpasses all real-time object detectors in speed and accuracy.\n  * FPS: 5 – 165\n  * mAP: 51.4% – 56.8%\n  * YOLOv7 reduced 40% of parameters and 50% of computation but improved performance. It’s a significant feat.\n  * How to use the YOLOv7 Pose estimation (keypoint detection) model.\n\n\n## References\n  1. [YOLOv7 Paper](https://arxiv.org/pdf/2207.02696.pdf)\n  2. [YOLOv7 GitHub](https://github.com/WongKinYiu/yolov7)\n  3. [REPVGG](https://arxiv.org/pdf/2101.03697.pdf)\n  4. [Pre-trained pose estimation model](https://github.com/WongKinYiu/yolov7#pose-estimation)\n  5. [OREPA(Online Convolutional Re-parameterization)](https://arxiv.org/pdf/2204.00826.pdf)\n\n\n### From idea to working model to real-time deployment\nBig Vision takes computer vision projects through the full journey, not just the easy parts.\n![Satya Mallick](../images/body-fe65e1f717d94c873fd9.jpg)\n**Satya Mallick** Founder - Big Vision & LearnOpenCV\n[ Talk to our Team ](https://bigvision.ai/expert-ai-solution-builders/)\n## Must Read Articles\n#### **We have crafted the following articles, especially for you, covering the YOLO series in-depth.**\n  * [YOLOv7 Object Detection Paper Explanation and Inference](https://learnopencv.com/yolov7-object-detection-paper-explanation-and-inference/)\n  * [Fine Tuning YOLOv7 on Custom Dataset](https://learnopencv.com/fine-tuning-yolov7-on-custom-dataset/)\n  * [YOLOv7 Pose vs. MediaPipe in Human Pose Estimation](https://learnopencv.com/yolov7-pose-vs-mediapipe-in-human-pose-estimation/)\n  * [YOLOv6 Object Detection – Paper Explanation and Inference](https://learnopencv.com/yolov6-object-detection/)\n  * [YOLOX Object Detector Paper Explanation and Custom Training](https://learnopencv.com/yolox-object-detector-paper-explanation-and-custom-training/)\n  * [Object Detection using YOLOv5 and OpenCV DNN in C++ and Python](https://learnopencv.com/object-detection-using-yolov5-and-opencv-dnn-in-c-and-python/)\n  * [Custom Object Detection Training using YOLOv5](https://learnopencv.com/custom-object-detection-training-using-yolov5/)\n  * [Pothole Detection using YOLOv4 and Darknet](https://learnopencv.com/pothole-detection-using-yolov4-and-darknet/)\n  * [Deep Learning based Object Detection using YOLOv3 with OpenCV](https://learnopencv.com/deep-learning-based-object-detection-using-yolov3-with-opencv-python-c/)\n  * [Training YOLOv3: Deep Learning-based Custom Object Detector](https://learnopencv.com/training-yolov3-deep-learning-based-custom-object-detector/)\n\n\nWas This Article Helpful?\nPost Views: 97\n## Subscribe & Download Code\nIf you liked this article and would like to download code (C++ and Python) and example images used in this post, please [click here](javascript:void\\(0\\)). In our newsletter, we share Computer Vision and AI tutorials and examples written in C++/Python, and Computer Vision and Machine Learning algorithms and news.  \n  \n\n[ Download Example Code](javascript:void\\(0\\))\n  \n  \n\n[PrevPreviousYOLOv4 and Darknet For Pothole Detection](https://learnopencv.com/pothole-detection-using-yolov4-and-darknet/)\n[NextMean Average Precision (mAP) in Object DetectionNext](https://learnopencv.com/mean-average-precision-map-object-detection-model-evaluation-metric/)\n###  [ Train RF-DETR for Instance Segmentation with GPT-6 Astra ](https://learnopencv.com/astra-rf-detr-microduck-segmentation/)\nBefore a flight, I left Astra a short prompt and a signed-in Roboflow account. It\n###  [ How 10x AI Engineers Train Models for Production: Lessons from PINTO’s Face Alignment Project ](https://learnopencv.com/how-10x-ai-engineers-train-models-for-production/)\nLearn a production model training playbook from PINTO’s face alignment project: reframe the task, engineer\n###  [ VGGT vs. VGGT-Ω (VGGT-Omega): A Complete Guide to Feed-Forward 3D Reconstruction ](https://learnopencv.com/vggt-vs-vggt-%cf%89-vggt-omega-a-complete-guide-to-feed-forward-3d-reconstruction/)\nHow VGGT and VGGT-Ω work, what changed, and real benchmark numbers, speed, GPU memory, depth,\n![Satya Mallick](../images/body-fe65e1f717d94c873fd9.jpg)\n#### Satya Mallick, Ph.D.\nFounder - Big Vision & LearnOpenCV\n#####  Are you struggling with your Computer Vision Product Development?\nHelping startups and enterprises build and deploy scalable solutions that work in the real world.\n[ Schedule a Call ](https://bigvision.ai/expert-ai-solution-builders?utm_source=lopcv&utm_medium=post)\n####  Table of Contents\n  1. [What is YOLOv7?](https://learnopencv.com/yolov7-object-detection-paper-explanation-and-inference/#elementor-toc__heading-anchor-0)\n  2. [YOLO Master Post – Every Model Explained](https://learnopencv.com/yolov7-object-detection-paper-explanation-and-inference/#elementor-toc__heading-anchor-1)\n  3. [Mastering All YOLO Models from YOLOv1 to YOLO-NAS: Papers Explained (2024)](https://learnopencv.com/yolov7-object-detection-paper-explanation-and-inference/#elementor-toc__heading-anchor-2)\n  4. [YOLO Architecture in General](https://learnopencv.com/yolov7-object-detection-paper-explanation-and-inference/#YOLO-Architecture-in-General)\n  5. [What’s New in YOLOv7?](https://learnopencv.com/yolov7-object-detection-paper-explanation-and-inference/#What%E2%80%99s-new-in-YOLOv7?)\n  6. [YOLOv7 Architecture](https://learnopencv.com/yolov7-object-detection-paper-explanation-and-inference/#YOLOv7-Architecture)\n  7. [Trainable Bag of Freebies in YOLOv7](https://learnopencv.com/yolov7-object-detection-paper-explanation-and-inference/#Trainable-Bag-of-Freebies-in-YOLOv7)\n  8. [YOLOv7 Experiments and Results](https://learnopencv.com/yolov7-object-detection-paper-explanation-and-inference/#YOLOv7-Experiments-and-Results)\n  9. [YOLOv7 Object Detection Inference](https://learnopencv.com/yolov7-object-detection-paper-explanation-and-inference/#YOLOv7-Object-Detection-Inference)\n  10. [Comparison Between YOLOv4, YOLOv5-Large, and YOLOv7 Model](https://learnopencv.com/yolov7-object-detection-paper-explanation-and-inference/#Comparison-between-YOLOv4,-YOLOv5-Large-and-YOLOv7)\n  11. [YOLOv7 Pose Estimation](https://learnopencv.com/yolov7-object-detection-paper-explanation-and-inference/#YOLOv7-Pose-Estimation)\n  12. [Summary of YOLOv7](https://learnopencv.com/yolov7-object-detection-paper-explanation-and-inference/#Summary-of-YOLOv7)\n  13. [References](https://learnopencv.com/yolov7-object-detection-paper-explanation-and-inference/#elementor-toc__heading-anchor-12)\n  14. [Must Read Articles](https://learnopencv.com/yolov7-object-detection-paper-explanation-and-inference/#elementor-toc__heading-anchor-13)\n\n\nWas This Article Helpful?\n  * [E-ELAN Architrcture](https://learnopencv.com/tag/e-elan-architrcture/), [new yolo](https://learnopencv.com/tag/new-yolo/), [YOLO](https://learnopencv.com/tag/yolo/), [yolo architecture](https://learnopencv.com/tag/yolo-architecture/), [yolov7](https://learnopencv.com/tag/yolov7/), [yolov7 detector](https://learnopencv.com/tag/yolov7-detector/), [yolov7 github](https://learnopencv.com/tag/yolov7-github/), [yolov7 inference](https://learnopencv.com/tag/yolov7-inference/), [yolov7 object detection](https://learnopencv.com/tag/yolov7-object-detection/), [yolov7 paper](https://learnopencv.com/tag/yolov7-paper/), [yolov7 paper explanation](https://learnopencv.com/tag/yolov7-paper-explanation/), [yolov7 pose](https://learnopencv.com/tag/yolov7-pose/), [yolov7 pytorch](https://learnopencv.com/tag/yolov7-pytorch/), [yolov7-tiny](https://learnopencv.com/tag/yolov7-tiny/)\n\n\n## Read Next\n[ ![Decoding Virat Kohli’s Flick Shot: AI-Based 3D Motion Reconstruction](../images/body-f3950ee9e907f51f83d3.png) ](https://learnopencv.com/decoding-virat-kohlis-flick-shot-ai-based-3d-motion-reconstruction/)\n[3D Computer Vision](https://learnopencv.com/category/3d-computer-vision/)[3D Reconstruction](https://learnopencv.com/category/3d-computer-vision/3d-reconstruction/)[Segmentation](https://learnopencv.com/category/segmentation/)[SpatialAI-Depth](https://learnopencv.com/category/3d-computer-vision/spatialai-depth/)[Video Analysis](https://learnopencv.com/category/video-analysis/)\n[Adnan Shaikh](https://learnopencv.com/author/adnan/) July 18, 2026 \n##  [ Decoding Virat Kohli’s Flick Shot: AI-Based 3D Motion Reconstruction ](https://learnopencv.com/decoding-virat-kohlis-flick-shot-ai-based-3d-motion-reconstruction/)\nReconstruct the 3D swing plane of Virat Kohli's flick shot from a single 2D video with off-the-shelf vision models. No…\n[ ![How to Run Object Detection with OpenCV 5](../images/body-6f304990249f37d13c7f.jpg) ](https://learnopencv.com/how-to-run-object-detection-with-opencv-5/)\n[Object Detection](https://learnopencv.com/category/object-detection/)[OpenCV 5](https://learnopencv.com/category/opencv/opencv-5/)[OpenCV DNN](https://learnopencv.com/category/opencv-dnn/)[YOLO](https://learnopencv.com/category/yolo/)\n[Sudip Chakrabarty](https://learnopencv.com/author/sudip/) July 9, 2026 \n##  [ How to Run Object Detection with OpenCV 5 ](https://learnopencv.com/how-to-run-object-detection-with-opencv-5/)\nLearn about the new OpenCV 5 and how to use its DNN engine to run object detection models on the…\n[ ![How to Fine-Tune YOLO26 for Safety Gear and Sign Language Detection](../images/body-6b014d4d46a21419f999.jpg) ](https://learnopencv.com/how-to-fine-tune-yolo26-for-safety-gear-and-sign-language-detection/)\n[Computer Vision](https://learnopencv.com/category/computer-vision/)[Object Detection](https://learnopencv.com/category/object-detection/)[YOLO](https://learnopencv.com/category/yolo/)\n[Sudip Chakrabarty](https://learnopencv.com/author/sudip/) June 18, 2026 \n##  [ How to Fine-Tune YOLO26 for Safety Gear and Sign Language Detection ](https://learnopencv.com/how-to-fine-tune-yolo26-for-safety-gear-and-sign-language-detection/)\nLearn how to fine-tune YOLO26 on your own data. We build a construction PPE safety detector and a sign-language reader…\n##  Subscribe to our Newsletter\nSubscribe to our email newsletter to get the latest posts delivered right to your email.\nName \nEmail \nSend\n![](../images/body-2dd5ce664c5fca7d56f8.png)\nEmpowering innovation through education, LearnOpenCV provides in-depth tutorials, code, and guides in AI, Computer Vision, and Deep Learning. Led by Dr. Satya Mallick, we're dedicated to nurturing a community keen on technology breakthroughs.\n[ Read More ](https://learnopencv.com/about/)\nCategories\n  * [Deep Learning](https://learnopencv.com/category/deep-learning/)\n  * [Object Detection](https://learnopencv.com/category/object-detection/)\n  * [Image Classification](https://learnopencv.com/category/image-classification)\n  * [YOLO](https://learnopencv.com/category/yolo/)\n  * [Image Processing](https://learnopencv.com/category/image-processing/)\n  * [Image Segmentation](https://learnopencv.com/category/image-segmentation/)\n\n\n  * [Deep Learning](https://learnopencv.com/category/deep-learning/)\n  * [Object Detection](https://learnopencv.com/category/object-detection/)\n  * [Image Classification](https://learnopencv.com/category/image-classification)\n  * [YOLO](https://learnopencv.com/category/yolo/)\n  * [Image Processing](https://learnopencv.com/category/image-processing/)\n  * [Image Segmentation](https://learnopencv.com/category/image-segmentation/)\n\n\nGetting Started\n  * [Installation](https://learnopencv.com/category/install/)\n  * [PyTorch](https://learnopencv.com/learn-pytorch/)\n  * [Getting Started with OpenCV](https://learnopencv.com/getting-started-with-opencv/)\n  * [Keras & Tensorflow](https://learnopencv.com/learn-keras-and-tensorflow/)\n\n\n  * [Installation](https://learnopencv.com/category/install/)\n  * [PyTorch](https://learnopencv.com/learn-pytorch/)\n  * [Getting Started with OpenCV](https://learnopencv.com/getting-started-with-opencv/)\n  * [Keras & Tensorflow](https://learnopencv.com/learn-keras-and-tensorflow/)\n\n\nBig Vision\n  * [AI Consulting](https://bigvision.ai/expert-ai-solution-builders/#talk?utm_source=locv&utm_medium=footer)\n  * [Case Studies](https://bigvision.ai/case-studies/?utm_source=locv&utm_medium=footer)\n  * [Get in Touch](https://bigvision.ai/contact-us/?utm_source=locv&utm_medium=footer)\n\n\n  * [AI Consulting](https://bigvision.ai/expert-ai-solution-builders/#talk?utm_source=locv&utm_medium=footer)\n  * [Case Studies](https://bigvision.ai/case-studies/?utm_source=locv&utm_medium=footer)\n  * [Get in Touch](https://bigvision.ai/contact-us/?utm_source=locv&utm_medium=footer)\n\n\nCopyright © 2026 – BIG VISION LLC [Privacy Policy](https://learnopencv.com/privacy-policy/) [Terms and Conditions](https://learnopencv.com/terms-and-conditions/)\n  * [ ](https://bit.ly/Facebook_LearnOpenCV)\n  * [ ](https://www.instagram.com/learnopencv/)\n  * [ ](https://www.linkedin.com/in/satyamallick/)\n  * [ ](https://x.com/LearnOpenCV)\n  * [ ](https://www.youtube.com/c/LearnOpenCV?utm_source=lopcv&utm_medium=footer&utm_campaign=yt)\n\n\n[ ![](../images/body-ab5d272e3cb213d5eb46.png) Click here to download the source code to this post ](javascript:void\\(0\\))\n",
  "metadata": {
    "title": "YOLOv7 Paper Explanation: Object Detection and YOLOv7 Pose",
    "description": "YOLOv7 paper explanation with object detection Inference test. Learn how to use YOLOv7 GitHub repository. YOLOv7 Pose detection included.",
    "keywords": "e-elan architrcture,new yolo,yolo,yolo architecture,yolov7,yolov7 detector,yolov7 github,yolov7 inference,yolov7 object detection,yolov7 paper,yolov7 paper explanation,yolov7 pose,yolov7 pytorch,yolov7-tiny",
    "author": "Kukil",
    "og:locale": "en_US",
    "og:site_name": "LearnOpenCV – Learn OpenCV, PyTorch, Keras, Tensorflow with code, & tutorials",
    "og:type": "article",
    "og:title": "YOLOv7 Paper Explanation: Object Detection and YOLOv7 Pose",
    "og:description": "YOLOv7 paper explanation with object detection Inference test. Learn how to use YOLOv7 GitHub repository. YOLOv7 Pose detection included.",
    "og:url": "https://learnopencv.com/yolov7-object-detection-paper-explanation-and-inference/",
    "og:image": "https://learnopencv.com/wp-content/uploads/2022/08/YOLOv7-Object-Detection-Paper-Explanation-and-Inference.gif",
    "og:image:secure_url": "https://learnopencv.com/wp-content/uploads/2022/08/YOLOv7-Object-Detection-Paper-Explanation-and-Inference.gif",
    "og:image:width": "880",
    "og:image:height": "495",
    "twitter:card": "summary",
    "twitter:site": "@AiOpencv",
    "twitter:title": "YOLOv7 Paper Explanation: Object Detection and YOLOv7 Pose",
    "twitter:description": "YOLOv7 paper explanation with object detection Inference test. Learn how to use YOLOv7 GitHub repository. YOLOv7 Pose detection included.",
    "twitter:creator": "@AiOpencv",
    "twitter:image": "https://cdn.learnopencv.com/wp-content/uploads/2022/08/04092443/YOLOv7-Object-Detection-Paper-Explanation-and-Inference.gif",
    "article:published_time": "2022-08-02T13:30:00+00:00",
    "article:modified_time": "2024-03-19T10:31:51+00:00",
    "article:publisher": "https://www.facebook.com/Learnopencv-277284889389059"
  },
  "paywall": {
    "listed_paid": false,
    "detected": false,
    "marker": "",
    "public_only": false,
    "policy": "付费/会员内容只保留页面公开可见部分，不绕过付费墙"
  },
  "crawl": {
    "success": true,
    "status_code": 200,
    "error": ""
  },
  "code_blocks": [
    {
      "language": "txt",
      "file": "attachments/581f2af0f6fd/code/block_000.txt",
      "chars": 52
    },
    {
      "language": "txt",
      "file": "attachments/581f2af0f6fd/code/block_001.txt",
      "chars": 113
    },
    {
      "language": "txt",
      "file": "attachments/581f2af0f6fd/code/block_002.txt",
      "chars": 103
    },
    {
      "language": "txt",
      "file": "attachments/581f2af0f6fd/code/block_003.txt",
      "chars": 84
    },
    {
      "language": "txt",
      "file": "attachments/581f2af0f6fd/code/block_004.txt",
      "chars": 509
    },
    {
      "language": "txt",
      "file": "attachments/581f2af0f6fd/code/block_005.txt",
      "chars": 874
    },
    {
      "language": "txt",
      "file": "attachments/581f2af0f6fd/code/block_006.txt",
      "chars": 2268
    },
    {
      "language": "txt",
      "file": "attachments/581f2af0f6fd/code/block_007.txt",
      "chars": 27
    }
  ],
  "images": [
    {
      "status": "ok",
      "url": "https://cdn.learnopencv.com/wp-content/uploads/2024/02/04103923/learnOpenCV_by_bigvision1.png",
      "bytes": 6527,
      "reused": true,
      "local_path": "attachments/581f2af0f6fd/images/000.png",
      "src": "https://cdn.learnopencv.com/wp-content/uploads/2024/02/04103923/learnOpenCV_by_bigvision1.png",
      "alt": "",
      "downloaded": true,
      "discovery": "saved_markdown"
    },
    {
      "status": "ok",
      "url": "https://cdn.learnopencv.com/wp-content/uploads/2022/08/04092443/YOLOv7-Object-Detection-Paper-Explanation-and-Inference-768x432.gif",
      "bytes": 61034,
      "reused": true,
      "local_path": "attachments/581f2af0f6fd/images/006.gif",
      "src": "https://cdn.learnopencv.com/wp-content/uploads/2022/08/04092443/YOLOv7-Object-Detection-Paper-Explanation-and-Inference-768x432.gif",
      "alt": "YOLOv7 Object Detection Paper Explanation and Inference",
      "downloaded": true,
      "discovery": "saved_markdown"
    },
    {
      "status": "ok",
      "url": "https://learnopencv.com/wp-content/uploads/2023/12/mastering-all-yolo-models-feature-image-150x150.gif",
      "bytes": 16691,
      "reused": false,
      "content_type": "image/gif",
      "local_path": "attachments/581f2af0f6fd/images/body-582e7f1b1da09ec362b4.gif",
      "src": "https://learnopencv.com/wp-content/uploads/2023/12/mastering-all-yolo-models-feature-image-150x150.gif",
      "alt": "",
      "downloaded": true,
      "discovery": "saved_markdown"
    },
    {
      "status": "ok",
      "url": "https://cdn.learnopencv.com/wp-content/uploads/2022/08/04092446/model-architecture-yolo-summary.jpg",
      "bytes": 23977,
      "reused": true,
      "local_path": "attachments/581f2af0f6fd/images/011.jpg",
      "src": "https://cdn.learnopencv.com/wp-content/uploads/2022/08/04092446/model-architecture-yolo-summary.jpg",
      "alt": "YOLO object detector architecture",
      "downloaded": true,
      "discovery": "saved_markdown"
    },
    {
      "status": "ok",
      "url": "https://cdn.learnopencv.com/wp-content/uploads/2022/08/04092451/yolov7-architecture-e-elan-1024x381.png",
      "bytes": 21037,
      "reused": true,
      "local_path": "attachments/581f2af0f6fd/images/016.png",
      "src": "https://cdn.learnopencv.com/wp-content/uploads/2022/08/04092451/yolov7-architecture-e-elan-1024x381.png",
      "alt": "Yolov7 paper study E-ELAN",
      "downloaded": true,
      "discovery": "saved_markdown"
    },
    {
      "status": "ok",
      "url": "https://cdn.learnopencv.com/wp-content/uploads/2022/08/04092445/yolov7-compound-model-scaling-yolov7-paper-1.png",
      "bytes": 8432,
      "reused": true,
      "local_path": "attachments/581f2af0f6fd/images/023.png",
      "src": "https://cdn.learnopencv.com/wp-content/uploads/2022/08/04092445/yolov7-compound-model-scaling-yolov7-paper-1.png",
      "alt": "Yolov7 paper explanation compound scaling",
      "downloaded": true,
      "discovery": "saved_markdown"
    },
    {
      "status": "ok",
      "url": "https://cdn.learnopencv.com/wp-content/uploads/2022/08/04092448/yolov7-module-planned-re-parameterization.png",
      "bytes": 11665,
      "reused": true,
      "local_path": "attachments/581f2af0f6fd/images/028.png",
      "src": "https://cdn.learnopencv.com/wp-content/uploads/2022/08/04092448/yolov7-module-planned-re-parameterization.png",
      "alt": "Yolov7 paper explanation module level reparameterization",
      "downloaded": true,
      "discovery": "saved_markdown"
    },
    {
      "status": "ok",
      "url": "https://cdn.learnopencv.com/wp-content/uploads/2022/08/04092449/yolov7-label-assigner.png",
      "bytes": 6222,
      "reused": true,
      "local_path": "attachments/581f2af0f6fd/images/033.png",
      "src": "https://cdn.learnopencv.com/wp-content/uploads/2022/08/04092449/yolov7-label-assigner.png",
      "alt": "Yolov7 paper explanation label assigner",
      "downloaded": true,
      "discovery": "saved_markdown"
    },
    {
      "status": "ok",
      "url": "https://cdn.learnopencv.com/wp-content/uploads/2022/08/04092448/yolov7-ms-coco-speed-ap-comparison.png",
      "bytes": 27424,
      "reused": true,
      "local_path": "attachments/581f2af0f6fd/images/038.png",
      "src": "https://cdn.learnopencv.com/wp-content/uploads/2022/08/04092448/yolov7-ms-coco-speed-ap-comparison.png",
      "alt": "Yolov7 paper explanation yolov7 benchmark",
      "downloaded": true,
      "discovery": "saved_markdown"
    },
    {
      "status": "ok",
      "url": "https://cdn.learnopencv.com/wp-content/uploads/2022/08/04092450/yolov7-comparison-1024x659.png",
      "bytes": 72037,
      "reused": false,
      "content_type": "image/png",
      "local_path": "attachments/581f2af0f6fd/images/body-a5ccf186bcdaac978523.png",
      "src": "https://cdn.learnopencv.com/wp-content/uploads/2022/08/04092450/yolov7-comparison-1024x659.png",
      "alt": "Yolov7 paper explanation model comparison",
      "downloaded": true,
      "discovery": "saved_markdown"
    },
    {
      "status": "ok",
      "url": "https://cdn.learnopencv.com/wp-content/uploads/2022/08/04092449/yolov7-models-inference-speed-chart-1024x481.png",
      "bytes": 16130,
      "reused": false,
      "content_type": "image/png",
      "local_path": "attachments/581f2af0f6fd/images/body-7d96636d85e0f9af3aa1.png",
      "src": "https://cdn.learnopencv.com/wp-content/uploads/2022/08/04092449/yolov7-models-inference-speed-chart-1024x481.png",
      "alt": "yolov7 paper explanation model fps comparison",
      "downloaded": true,
      "discovery": "saved_markdown"
    },
    {
      "status": "ok",
      "url": "https://learnopencv.com/wp-content/uploads/2022/08/yolov7-vs-other-detectors-inference-speed-chart.png",
      "bytes": 10947,
      "reused": false,
      "content_type": "image/png",
      "local_path": "attachments/581f2af0f6fd/images/body-0155b7c5eb1fa369fe7e.png",
      "src": "https://learnopencv.com/wp-content/uploads/2022/08/yolov7-vs-other-detectors-inference-speed-chart.png",
      "alt": "yolov7 paper explanation inference speed comparison",
      "downloaded": true,
      "discovery": "saved_markdown"
    },
    {
      "status": "ok",
      "url": "https://opencv.org/university/wp-content/uploads/sites/4/2023/04/Dr-Satya.jpg",
      "bytes": 17778,
      "reused": false,
      "content_type": "image/jpeg",
      "local_path": "attachments/581f2af0f6fd/images/body-fe65e1f717d94c873fd9.jpg",
      "src": "https://opencv.org/university/wp-content/uploads/sites/4/2023/04/Dr-Satya.jpg",
      "alt": "Satya Mallick",
      "downloaded": true,
      "discovery": "saved_markdown"
    },
    {
      "status": "ok",
      "url": "https://cdn.learnopencv.com/wp-content/uploads/2026/07/16015539/decoding-virat-kohli-flick-shot-3d-motion-reconstruction.png",
      "bytes": 1911733,
      "reused": false,
      "content_type": "image/png",
      "local_path": "attachments/581f2af0f6fd/images/body-f3950ee9e907f51f83d3.png",
      "src": "https://cdn.learnopencv.com/wp-content/uploads/2026/07/16015539/decoding-virat-kohli-flick-shot-3d-motion-reconstruction.png",
      "alt": "Decoding Virat Kohli’s Flick Shot: AI-Based 3D Motion Reconstruction",
      "downloaded": true,
      "discovery": "saved_markdown"
    },
    {
      "status": "ok",
      "url": "https://cdn.learnopencv.com/wp-content/uploads/2026/07/11002616/OpenCV_5_Blog_Thumbnail_final-scaled.jpg",
      "bytes": 516266,
      "reused": false,
      "content_type": "image/jpeg",
      "local_path": "attachments/581f2af0f6fd/images/body-6f304990249f37d13c7f.jpg",
      "src": "https://cdn.learnopencv.com/wp-content/uploads/2026/07/11002616/OpenCV_5_Blog_Thumbnail_final-scaled.jpg",
      "alt": "How to Run Object Detection with OpenCV 5",
      "downloaded": true,
      "discovery": "saved_markdown"
    },
    {
      "status": "ok",
      "url": "https://cdn.learnopencv.com/wp-content/uploads/2026/06/17235330/YOLO26_Finetuning_Thumbnail_image-768x512.jpg",
      "bytes": 85542,
      "reused": false,
      "content_type": "image/jpeg",
      "local_path": "attachments/581f2af0f6fd/images/body-6b014d4d46a21419f999.jpg",
      "src": "https://cdn.learnopencv.com/wp-content/uploads/2026/06/17235330/YOLO26_Finetuning_Thumbnail_image-768x512.jpg",
      "alt": "How to Fine-Tune YOLO26 for Safety Gear and Sign Language Detection",
      "downloaded": true,
      "discovery": "saved_markdown"
    },
    {
      "status": "ok",
      "url": "https://cdn.learnopencv.com/wp-content/uploads/2025/12/04080755/learnOpenCV_by_bigvision1.png",
      "bytes": 6316,
      "reused": false,
      "content_type": "image/png",
      "local_path": "attachments/581f2af0f6fd/images/body-2dd5ce664c5fca7d56f8.png",
      "src": "https://cdn.learnopencv.com/wp-content/uploads/2025/12/04080755/learnOpenCV_by_bigvision1.png",
      "alt": "",
      "downloaded": true,
      "discovery": "saved_markdown"
    },
    {
      "status": "ok",
      "url": "https://learnopencv.com/wp-content/uploads/2021/10/cropped-favicon-512x512-1.png",
      "bytes": 22729,
      "reused": false,
      "content_type": "image/png",
      "local_path": "attachments/581f2af0f6fd/images/body-ab5d272e3cb213d5eb46.png",
      "src": "https://learnopencv.com/wp-content/uploads/2021/10/cropped-favicon-512x512-1.png",
      "alt": "",
      "downloaded": true,
      "discovery": "saved_markdown"
    }
  ],
  "audio": [],
  "videos": [
    {
      "url": "https://cdn.learnopencv.com/wp-content/uploads/2022/08/04092451/yolov7-paper-explanation-feature-video.mp4",
      "kind": "direct_video",
      "status": "http_403",
      "title": "",
      "retried_at": "2026-10-20T17:38:36Z"
    },
    {
      "url": "https://cdn.learnopencv.com/wp-content/uploads/2022/08/04092441/video-1-1.mp4",
      "kind": "direct_video",
      "status": "http_403",
      "title": "",
      "retried_at": "2026-10-20T17:38:36Z"
    },
    {
      "url": "https://www.youtube.com/c/LearnOpenCV?utm_source=lopcv&utm_medium=footer&utm_campaign=yt",
      "kind": "channel_reference",
      "status": "reference_only"
    }
  ],
  "links": [
    {
      "type": "internal",
      "href": "https://learnopencv.com"
    },
    {
      "type": "internal",
      "href": "https://learnopencv.com/category/install/"
    },
    {
      "type": "internal",
      "href": "https://learnopencv.com/"
    },
    {
      "type": "internal",
      "href": "https://learnopencv.com/getting-started-with-opencv/"
    },
    {
      "type": "internal",
      "href": "https://learnopencv.com/getting-started-with-pytorch/"
    },
    {
      "type": "internal",
      "href": "https://learnopencv.com/getting-started-with-tensorflow-keras/"
    },
    {
      "type": "internal",
      "href": "https://learnopencv.com/about/"
    },
    {
      "type": "internal",
      "href": "https://learnopencv.com/category/cnn/"
    },
    {
      "type": "internal",
      "href": "https://learnopencv.com/author/kukil/"
    },
    {
      "type": "internal",
      "href": "https://learnopencv.com/author/sovit/"
    },
    {
      "type": "internal",
      "href": "https://learnopencv.com/category/object-detection/"
    },
    {
      "type": "internal",
      "href": "https://learnopencv.com/category/pose-estimation/"
    },
    {
      "type": "internal",
      "href": "https://learnopencv.com/category/yolo/"
    },
    {
      "type": "internal",
      "href": "https://learnopencv.com/yolov7-object-detection-paper-explanation-and-inference/"
    },
    {
      "type": "internal",
      "href": "https://learnopencv.com/mastering-all-yolo-models/"
    },
    {
      "type": "internal",
      "href": "https://cdn.learnopencv.com/wp-content/uploads/2022/08/04092446/model-architecture-yolo-summary.jpg"
    },
    {
      "type": "internal",
      "href": "https://learnopencv.com/custom-object-detection-training-using-yolov5/"
    },
    {
      "type": "internal",
      "href": "https://learnopencv.com/pothole-detection-using-yolov4-and-darknet/"
    },
    {
      "type": "internal",
      "href": "https://cdn.learnopencv.com/wp-content/uploads/2022/08/04092451/yolov7-architecture-e-elan.png"
    },
    {
      "type": "internal",
      "href": "https://cdn.learnopencv.com/wp-content/uploads/2022/08/04092445/yolov7-compound-model-scaling-yolov7-paper-1.png"
    },
    {
      "type": "external",
      "href": "https://opencv.org/university/free-courses/"
    },
    {
      "type": "external",
      "href": "https://opencv.org/university/vision-language-model-bootcamp/"
    },
    {
      "type": "external",
      "href": "https://opencv.org/university/free-pytorch-course/"
    },
    {
      "type": "external",
      "href": "https://opencv.org/university/free-tensorflow-keras-course/"
    },
    {
      "type": "external",
      "href": "https://opencv.org/university/free-opencv-course/"
    },
    {
      "type": "external",
      "href": "https://opencv.org/university/python-for-beginners/"
    },
    {
      "type": "external",
      "href": "https://bigvision.ai/expert-ai-solution-builders/"
    },
    {
      "type": "external",
      "href": "https://bigvision.ai/expert-ai-solution-builders"
    },
    {
      "type": "external",
      "href": "javascript:void(0)"
    },
    {
      "type": "external",
      "href": "https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7-tiny.pt"
    },
    {
      "type": "external",
      "href": "https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7.pt"
    },
    {
      "type": "external",
      "href": "https://arxiv.org/pdf/2207.02696.pdf"
    },
    {
      "type": "external",
      "href": "https://github.com/WongKinYiu/yolov7"
    },
    {
      "type": "external",
      "href": "https://arxiv.org/pdf/2101.03697.pdf"
    },
    {
      "type": "external",
      "href": "https://arxiv.org/pdf/2204.00826.pdf"
    },
    {
      "type": "external",
      "href": "https://bigvision.ai/case-studies/"
    },
    {
      "type": "external",
      "href": "https://bigvision.ai/contact-us/"
    },
    {
      "type": "external",
      "href": "https://bit.ly/Facebook_LearnOpenCV"
    },
    {
      "type": "external",
      "href": "https://www.instagram.com/learnopencv/"
    },
    {
      "type": "external",
      "href": "https://www.linkedin.com/in/satyamallick/"
    }
  ],
  "repair_version": 2,
  "repaired_at": "2026-10-20T17:24:01Z",
  "source_url": "https://learnopencv.com/yolov7-object-detection-paper-explanation-and-inference/",
  "delivery_status": "unverified",
  "discovery_status": "http_403",
  "missing_reason": "http_403",
  "repair_error": "",
  "actual_video_files": [],
  "expected_saved_body_images": 18,
  "image_discovery": "saved_markdown",
  "source_body_markdown": "We use essential cookies to make our site work. With your consent, we may also use non-essential cookies to improve user experience and analyze website traffic. By clicking “Accept,” you agree to our website's cookie use as described in our Cookie Policy. You can change your cookie settings at any time by clicking “Preferences.” \nAccept\n[ ![](https://cdn.learnopencv.com/wp-content/uploads/2024/02/04103923/learnOpenCV_by_bigvision1.png) ](https://learnopencv.com)\n  * [Getting Started](https://learnopencv.com/category/install/)\n    * [Subscribe](https://learnopencv.com/)\n    * [Installation](https://learnopencv.com/category/install/)\n    * [Getting Started with OpenCV](https://learnopencv.com/getting-started-with-opencv/)\n    * [PyTorch](https://learnopencv.com/getting-started-with-pytorch/)\n    * [Tensorflow & Keras](https://learnopencv.com/getting-started-with-tensorflow-keras/)\n  * [Free Courses](https://opencv.org/university/free-courses/?utm_source=lopcv&utm_medium=menu&utm_campaign=fcpage)\n    * [VLM Bootcamp](https://opencv.org/university/vision-language-model-bootcamp/?utm_source=lopcv&utm_medium=menu&utm_campaign=vlm)\n    * [PyTorch Bootcamp](https://opencv.org/university/free-pytorch-course/?utm_source=lopcv&utm_medium=menu&utm_campaign=ptbc)\n    * [TensorFlow Keras Course](https://opencv.org/university/free-tensorflow-keras-course/?utm_source=lopcv&utm_medium=menu&utm_campaign=tbc)\n    * [OpenCV Course](https://opencv.org/university/free-opencv-course/?utm_source=lopcv&utm_medium=menu&utm_campaign=obc)\n    * [Python for Beginners](https://opencv.org/university/python-for-beginners/?utm_source=lopcv&utm_medium=menu&utm_campaign=pbc)\n  * [AI Consulting](https://bigvision.ai/expert-ai-solution-builders/#talk?utm_source=locv&utm_medium=menu)\n  * [About](https://learnopencv.com/about/)\n\n\n  * [Getting Started](https://learnopencv.com/category/install/)\n    * [Subscribe](https://learnopencv.com/)\n    * [Installation](https://learnopencv.com/category/install/)\n    * [Getting Started with OpenCV](https://learnopencv.com/getting-started-with-opencv/)\n    * [PyTorch](https://learnopencv.com/getting-started-with-pytorch/)\n    * [Tensorflow & Keras](https://learnopencv.com/getting-started-with-tensorflow-keras/)\n  * [Free Courses](https://opencv.org/university/free-courses/?utm_source=lopcv&utm_medium=menu&utm_campaign=fcpage)\n    * [VLM Bootcamp](https://opencv.org/university/vision-language-model-bootcamp/?utm_source=lopcv&utm_medium=menu&utm_campaign=vlm)\n    * [PyTorch Bootcamp](https://opencv.org/university/free-pytorch-course/?utm_source=lopcv&utm_medium=menu&utm_campaign=ptbc)\n    * [TensorFlow Keras Course](https://opencv.org/university/free-tensorflow-keras-course/?utm_source=lopcv&utm_medium=menu&utm_campaign=tbc)\n    * [OpenCV Course](https://opencv.org/university/free-opencv-course/?utm_source=lopcv&utm_medium=menu&utm_campaign=obc)\n    * [Python for Beginners](https://opencv.org/university/python-for-beginners/?utm_source=lopcv&utm_medium=menu&utm_campaign=pbc)\n  * [AI Consulting](https://bigvision.ai/expert-ai-solution-builders/#talk?utm_source=locv&utm_medium=menu)\n  * [About](https://learnopencv.com/about/)\n\n\nSearch ...\nResults\nSee all results\n  * [Home](https://learnopencv.com \"Home\")\n  * >\n  * [CNN](https://learnopencv.com/category/cnn/ \"CNN\")\n  * >\n  * YOLOv7 Object Detection Paper Explanation & Inference\n\n\n[Kukil](https://learnopencv.com/author/kukil/), [Sovit Rath](https://learnopencv.com/author/sovit/)\n  * on  August 2, 2022\n\n\n# YOLOv7 Object Detection Paper Explanation & Inference\nA technical review of YOLOv7 paper along with inference report. YOLOv7 Pose detection code included.\n  * [CNN](https://learnopencv.com/category/cnn/), [Object Detection](https://learnopencv.com/category/object-detection/), [Pose Estimation](https://learnopencv.com/category/pose-estimation/), [YOLO](https://learnopencv.com/category/yolo/)\n\n\n![YOLOv7 Object Detection Paper Explanation and Inference](https://cdn.learnopencv.com/wp-content/uploads/2022/08/04092443/YOLOv7-Object-Detection-Paper-Explanation-and-Inference-768x432.gif)\n0%\n  *   *   * [ ](https://bigvision.ai/expert-ai-solution-builders?utm_source=lopcv&utm_medium=post-icon)\n\n\n## What is YOLOv7?\nYOLOv7 is a single-stage real-time object detector. It was introduced to the YOLO family in July’22. According to the YOLOv7 paper, it is the fastest and most accurate real-time object detector to date. YOLOv7 established a significant benchmark by taking its performance up a notch.\nThis article contains simplified **YOLOv7** paper explanation and inference tests. We will go through the YOLOv7 GitHub repository and test inference. We will also see how YOLOv7 compares with other object detectors of the YOLO family.  \n|  **What will be covered in the post?**  \n1. YOLOv7 architecture, What’s new?  \n2. Object Detection using YOLOv7  \n3. YOLOv7 models and comparative analysis  \n4. YOLOv7 Pose: Human Pose Estimation |  \n| --- |  \n  1. [YOLO Architecture in General](https://learnopencv.com/yolov7-object-detection-paper-explanation-and-inference/#YOLO-Architecture-in-General)\n  2. [What’s new in YOLOv7?](https://learnopencv.com/yolov7-object-detection-paper-explanation-and-inference/#What%E2%80%99s-new-in-YOLOv7?)\n  3. [YOLOv7 Architecture](https://learnopencv.com/yolov7-object-detection-paper-explanation-and-inference/#YOLOv7-Architecture)\n  4. [Trainable Bag of Freebies in YOLOv7](https://learnopencv.com/yolov7-object-detection-paper-explanation-and-inference/#Trainable-Bag-of-Freebies-in-YOLOv7)\n  5. [YOLOv7 Experiments and Results](https://learnopencv.com/yolov7-object-detection-paper-explanation-and-inference/#YOLOv7-Experiments-and-Results)\n    1. [mAP Comparison: YOLOv7 vs Others](https://learnopencv.com/yolov7-object-detection-paper-explanation-and-inference/#mAP-Comparison-YOLOv7-vs-Others)\n    2. [FPS Comparison: YOLOv7 vs Others](https://learnopencv.com/yolov7-object-detection-paper-explanation-and-inference/#FPS-Comparison-YOLOv7-vs-Others)\n  6. [YOLOv7 Object Detection Inference](https://learnopencv.com/yolov7-object-detection-paper-explanation-and-inference/#YOLOv7-Object-Detection-Inference)\n  7. [Comparison between YOLOv4, YOLOv5-Large and YOLOv7](https://learnopencv.com/yolov7-object-detection-paper-explanation-and-inference/#Comparison-between-YOLOv4,-YOLOv5-Large-and-YOLOv7)\n  8. [YOLOv7 Pose Estimation](https://learnopencv.com/yolov7-object-detection-paper-explanation-and-inference/#YOLOv7-Pose-Estimation)\n    1. [YOLOv7 Pose prerequisites](https://learnopencv.com/yolov7-object-detection-paper-explanation-and-inference/#YOLOv7-Pose-prerequisites)\n    2. [YOLOv7 Pose Code](https://learnopencv.com/yolov7-object-detection-paper-explanation-and-inference/#YOLOv7-Pose-Code)\n  9. [Summary of YOLOv7](https://learnopencv.com/yolov7-object-detection-paper-explanation-and-inference/#Summary-of-YOLOv7)\n\n\n## YOLO Master Post – Every Model Explained\nUnlock the full story behind all the YOLO models’ evolutionary journey: Dive into our extensive pillar post, where we unravel the evolution from YOLOv1 to YOLO-NAS. This essential guide is packed with insights, comparisons, and a deeper understanding that you won’t find anywhere else.  \nDon’t miss out on this comprehensive resource, Mastering [All Yolo Models](https://learnopencv.com/mastering-all-yolo-models/) for a richer, more informed perspective on the YOLO series.\n![](https://learnopencv.com/wp-content/uploads/2023/12/mastering-all-yolo-models-feature-image-150x150.gif)\n## [Mastering All YOLO Models from YOLOv1 to YOLO-NAS: Papers Explained (2024)](https://learnopencv.com/mastering-all-yolo-models/)\n## **YOLO Architecture in General**\n**YOLO architecture** is FCNN(Fully Connected Neural Network) based. However, Transformer-based versions have also recently been added to the YOLO family. We will discuss Transformer based detectors in a separate post. For now, let’s focus on FCNN (Fully Convolutional Neural Network) based YOLO object detectors.\nThe YOLO framework has three main components. \n  * **Backbone**\n  * **Head**\n  * **Neck**\n\n\nThe **Backbone** mainly extracts essential features of an image and feeds them to the **Head** through **Neck**. The **Neck** collects feature maps extracted by the **Backbone** and creates feature pyramids. Finally, the head consists of output layers that have final detections. The following table shows the architectures of YOLOv4, YOLOv4, and YOLOv5.\n[![YOLO object detector architecture](https://cdn.learnopencv.com/wp-content/uploads/2022/08/04092446/model-architecture-yolo-summary.jpg)](https://cdn.learnopencv.com/wp-content/uploads/2022/08/04092446/model-architecture-yolo-summary.jpg)\nTable1: Model architecture summary of YOLOv3, YOLOv4, and [YOLOv5](https://learnopencv.com/custom-object-detection-training-using-yolov5/)\nApart from architectural modifications, there are several other improvements. Go through the [YOLO series](https://learnopencv.com/category/yolo/) for detailed information.\n## **What’s New in YOLOv7?**\nYOLOv7 improves speed and accuracy by introducing several architectural reforms. Similar to Scaled YOLOv4, YOLOv7 backbones do not use ImageNet pre-trained backbones. Rather, the models are trained using the COCO dataset entirely. The similarity can be expected because YOLOv7 is written by the same authors as Scaled YOLOv4, which is an extension of [YOLOv4](https://learnopencv.com/pothole-detection-using-yolov4-and-darknet/). The following major changes have been introduced in the YOLOv7 paper. We will go through them one by one.\n  * **Architectural Reforms**\n    * E-ELAN (Extended Efficient Layer Aggregation Network)\n    * Model Scaling for Concatenation-based Models \n  * **Trainable BoF (Bag of Freebies)**\n    * Planned re-parameterized convolution\n    * Coarse for auxiliary and Fine for lead loss\n\n\n## **YOLOv7 Architecture**\nThe architecture is derived from YOLOv4, Scaled YOLOv4, and YOLO-R. Using these models as a base, further experiments were carried out to develop new and improved YOLOv7.\n### E-ELAN (Extended Efficient Layer Aggregation Network) in YOLOv7 paper\nThe E-ELAN is the computational block in the YOLOv7 backbone. It takes inspiration from previous research on network efficiency. It has been designed by analyzing the following factors that impact speed and accuracy.\n  * Memory access cost\n  * I/O channel ratio\n  * Element wise operation\n  * Activations\n  * Gradient path\n\n  \n| _The proposed E-ELAN uses expand, shuffle, and merge cardinality to achieve the ability to continuously enhance the learning ability of the network without destroying the original gradient path._ |  \n| --- |  \nIn simple terms, E-ELAN architecture enables the framework to learn better. It is based on the ELAN computational block. The ELAN paper has not been published yet when writing this post. We will update the post by adding ELAN details when available.\n[![Yolov7 paper study E-ELAN](https://cdn.learnopencv.com/wp-content/uploads/2022/08/04092451/yolov7-architecture-e-elan-1024x381.png)](https://cdn.learnopencv.com/wp-content/uploads/2022/08/04092451/yolov7-architecture-e-elan.png)\nFig: E-ELAN and previous work on maximal layer efficiency\n### Compound Model Scaling in YOLOv7\nDifferent applications require different models. While some need highly accurate models, some prioritize speed. Model scaling is performed to suit these requirements and make it fit in various computing devices.\nWhile scaling a model size, the following parameters are considered.\n  * Resolution ( size of the input image)\n  * Width (number of channels)\n  * Depth (number of layers)\n  * Stage (number of feature pyramids)\n\n\nNAS (Network Architecture Search) is a commonly used model scaling method. It is used by researchers to iterate through the parameters to find the best scaling factors. However, methods like NAS do parameter-specific scaling. The **scaling factors are independent** in this case.\nThe authors of the YOLOv7 paper show that it can be further optimized with a **compound model scaling approach**. Here, width and depth are scaled in coherence for concatenation-based models.\n[![Yolov7 paper explanation compound scaling](https://cdn.learnopencv.com/wp-content/uploads/2022/08/04092445/yolov7-compound-model-scaling-yolov7-paper-1.png)](https://cdn.learnopencv.com/wp-content/uploads/2022/08/04092445/yolov7-compound-model-scaling-yolov7-paper-1.png)\nFig: YOLOv7 compound scaling\n## **Trainable Bag of Freebies in YOLOv7**\nBoF or Bag of Freebies are methods that increase the performance of a model without increasing the training cost. YOLOv7 has introduced the following BoF methods.\n### Planned Re-parameterized Convolution\nRe-parameterization is a technique used after training to improve the model. It increases the training time but improves the inference results. Two types of re-parametrization are used to finalize models: Model**level** and **Module level** ensemble.\n**Model level re-parametrization** can be done in the following two ways.\n  * Using different training data but the same settings, train multiple models. Then average their weights to obtain the final model.\n  * Take the average of the weights of models at different epochs.\n\n\nRecently, **Module level re-parameterization** has gained a lot of traction in research. In this method, the model training process is split into multiple modules. The outputs are ensembled to obtain the final model. The authors in the YOLOv7 paper show the best possible ways to perform module-level ensemble (shown below).\n[![Yolov7 paper explanation module level reparameterization](https://cdn.learnopencv.com/wp-content/uploads/2022/08/04092448/yolov7-module-planned-re-parameterization.png)](https://cdn.learnopencv.com/wp-content/uploads/2022/08/04092448/yolov7-module-planned-re-parameterization.png)\nFig: Re-parameterization trials\nIn the diagram above, The 3×3 convolution layer of the E-ELAN computational block is replaced with the RepConvlayer. Experiments we carried out by switching or replacing the positions of RepConv, 3×3 Conv, and Identity connection. The residual bypass arrow shown above is an identity connection. It is nothing but a 1×1 convolutional layer. We can see the configurations that work and the ones that do not. Check out more about RepConv in the RepVGG paper.\nIncluding RepConv, YOLOv7 also performs re-parameterization on Conv-BN (Convolution Batch Normalization), **OREPA**(Online Convolutional Re-parameterization), and YOLO-R to get the best results. We will discuss the implementation part in a separate post.\n### Coarse for Auxiliary and Fine for Lead Loss\nAs you already know by now, YOLO architecture comprises a backbone, a neck, and a head. The head contains the predicted outputs. YOLOv7 does not limit itself to a single head. It has multiple heads to do whatever it wants. Interesting, isn’t it?\nHowever, it’s not the first time a multi-headed framework was introduced. **Deep Supervision,** a technique used by DL models, uses multiple heads**.** In YOLOv7, the head responsible for final output is called the **Lead Head.** And the head used to assist training in the middle layers is called the **Auxiliary Head**.\nWith the help of an**assistant loss** , the weights of the auxiliary heads are updated. It allows for **Deep Supervision,** and the model learns better. These concepts are closely coupled with the **Lead Head** and the **Label Assigner.**\n**Label Assigner** is a mechanism that considers the network prediction results together with the ground truth and then assigns **soft labels**. It’s important to note that the label assigner generates soft and coarse labels instead of hard ones.\n#### Lead Head Guided Label Assigner and Coarse-to-Fine Lead Head Guided Label Assigner\nThe Lead Head Guided Label Assigner encapsulates the following three concepts.\n  * Lead Head\n  * Auxiliary Head\n  * Soft Label Assigner\n\n[![Yolov7 paper explanation label assigner](https://cdn.learnopencv.com/wp-content/uploads/2022/08/04092449/yolov7-label-assigner.png)](https://cdn.learnopencv.com/wp-content/uploads/2022/08/04092449/yolov7-label-assigner.png)\nThe Lead Head in the YOLOv7 network predicts the final results. Soft labels are generated based on these final results. The important part is that the loss is calculated for both the lead head and the auxiliary head based on the same soft labels that are generated. Ultimately, both heads get trained using the soft labels. This is shown in the left image in the above figure. \nOne may ask here, **_“why soft labels?”._** The authors have put it quite well in the paper:\n“The reason to do this is that the lead head has a relatively strong learning capability. So the soft label generated from it should be more representative of the distribution and correlation between the source data and the target. By letting the shallower auxiliary head directly learn the information that the lead head has learned, the lead head will be more able to focus on learning residual information that has not yet been learned.”\nNow, coming to the **coarse-to-fine** labels as shown in the right image in the previous figure. In the above process, two sets of soft labels are generated.\n  * A **fine label** to train the lead head\n  * A set of **coarse labels** to train the auxiliary head.\n\n\nThe fine labels are the same as the directly generated soft labels. However, more grids are treated as positive targets to generate the coarse labels. This is done by relaxing the constraints of the positive sample assignment process.\n## YOLOv7 Experiments and Results\nAll the YOLOv7 models surpass the previous object detectors in speed and accuracy in the range of 5 FPS to 160 FPS. The following figure gives a pretty good idea about the Average Precision(AP) and speed of the YOLOv7 models compared to the others.\n[![Yolov7 paper explanation yolov7 benchmark](https://cdn.learnopencv.com/wp-content/uploads/2022/08/04092448/yolov7-ms-coco-speed-ap-comparison.png)](https://cdn.learnopencv.com/wp-content/uploads/2022/08/04092448/yolov7-ms-coco-speed-ap-comparison.png)\nIt is clear from the figure that starting from YOLOv7, there is no competition with YOLOv7 in terms of speed and accuracy.\n**_Note: The results discussed_** further are from the YOLOv7 paper,**_where all the inference experiments were done on a Tesla V100 GPU. All AP results were done either on the COCO validation or test set._**\n### mAP Comparison: YOLOv7 vs Others\nThe following table shows the comparison of YOLOv7 models with other baseline object detectors. \n[![Yolov7 paper explanation model comparison](https://cdn.learnopencv.com/wp-content/uploads/2022/08/04092450/yolov7-comparison-1024x659.png)](https://cdn.learnopencv.com/wp-content/uploads/2022/08/04092450/yolov7-comparison.png)\nTable: YOLOv7 vs Other Baseline Models\nThe results shown above are mostly grouped together according to a range of parameters for a particular set of models.\n  * Starting with the YOLOv7-Tiny model, the smallest in the family with just over 6 million parameters. With a validation AP of 35.2%, it beats YOLOv4-Tiny models with similar parameters.\n\n\n  * The YOLOv7 normal model with almost 37 million parameters gives 51.2% AP. It beats variants of YOLOv4 and YOLOR, which have more parameters easily.\n\n\n  * The larger models in the YOLO7 family are YOLOv7-X, YOLOv7-E6, YOLOv7-D6, and YOLOv7-E6E. All of these beat the respective YOLOR models having either a similar or lesser number of parameters and giving APs of 52.9%, 55.9%, 56.3%, and 56.8%, respectively. \n\n\nNow, it is not only the YOLOv4 and YOLOR models that YOLOv7 surpasses. Comparing the validation APs with that of the [YOLOv5 ](https://learnopencv.com/object-detection-using-yolov5-and-opencv-dnn-in-c-and-python/)and YOLOv7 models, which have parameters in the same range, it is pretty clear that YOLOv7 also beats all of the YOLOv5 models. \n### FPS Comparison: YOLOv7 vs Others\nTable 2 in the YOLOv7 paper provides a comprehensive comparison of the FPS of YOLOv7 with other models. It also includes the COCO [mAP](https://learnopencv.com/mean-average-precision-map-object-detection-model-evaluation-metric/) comparison.\nIt is already established that the YOLOv7 has the highest FPS and mAP in the range of 5 FPS to 160 FPS. All the FPS comparisons were done on the Tesla V100 [GPU](https://learnopencv.com/demystifying-gpu-architectures-for-deep-learning/).\n[![yolov7 paper explanation model fps comparison](https://cdn.learnopencv.com/wp-content/uploads/2022/08/04092449/yolov7-models-inference-speed-chart-1024x481.png)](https://cdn.learnopencv.com/wp-content/uploads/2022/08/04092449/yolov7-models-inference-speed-chart.png)\n**Table:** YOLOv7 models FPS comparison\nIt is worth noting that **_none of the YOLOv7 models are meant for mobile devices/mobile CPUs_**(as mentioned in the YOLOv7 paper). \n  * YOLOv7-Tiny, YOLOv7, and YOLOv7-W6 are meant for edge GPU, normal (consumer) GPU, and cloud [GPU](https://learnopencv.com/demystifying-gpu-architectures-for-deep-learning-part-2/), respectively.\n\n\n  * YOLOv7-E6 and YOLOv7-D6, and YOLOv7-E6E are also meant for high-end cloud GPUs only.\n\n\nNonetheless, all of the YOLOv7 models run at more than 30 FPS on the Tesla V100 GPU, which is more than real-time FPS.\nThe experiments above prove that YOLOv7 models outperform the existing object detectors. Both in terms of speed and accuracy.\n???????? Skip to Training YOLOv7: [Training YOLOv7 on Custom Pothole Dataset](https://learnopencv.com/fine-tuning-yolov7-on-custom-dataset/)\n**Download Code** To easily follow along this tutorial, please download code by clicking on the button below. It's FREE!\n[Download Code](javascript:void\\(0\\))\n## YOLOv7 Object Detection Inference\nNow, let’s get into the exciting part of the blog post, that is, running inference on videos using YOLOv7. We will run the inference using the YOLOv7 and YOLOv7-Tiny models. Along with that, we will also compare the results with that of the YOLOv5 and YOLOv4 models.  \n|  **Note:** All the inference results shown here were run on a machine with**6 GB GTX 1060 (laptop GPU), 8th generation i7 CPU, and 16 GB of RAM.**  |  \n| --- |  \nIf you intend to run object detection inference experiments on your own videos, you have to clone the YOLOv7 GitHub repository using the following command.\n\n```\ngit clone https://github.com/WongKinYiu/yolov7.git\n\n```\n\nThen you can use the **detect.py** script to run inference on the videos of your choice. You will also need to download the [yolov7-tiny.pt](https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7-tiny.pt) and [yolov7.pt](https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7.pt) pre-trained model.\nHere, we will run inference on three videos depicting the following three different scenarios.\n  * The first video is to test how the YOLOv7 object detection models perform on small and far-off objects.\n  * The second video has a lot of people depicting a crowded scenario.\n  * And the third video is one where many YOLO models (v4, v5, and v7) make the same general mistake while detecting the objects.\n\n\nThe YOLOv7 results here are shown together for the **Tiny** and **Normal** models for all three videos. This will help us compare the results for each of the results in an easy manner.\nLet’s check the detection inference results on the first video using the YOLOv7-Tiny (top) and YOLOv7 (bottom) models. The following commands were used to run the inference using the Tiny and Normal models.\n\n```\npython detect.py --source ../inference_data/video_1.mp4 --weights yolov7-tiny.pt --name video_tiny_1 --view-img\n\n```\n\n\n```\npython detect.py --source ../inference_data/video_1.mp4 --weights yolov7.pt --name video_1 --view-img\n\n```\n\nYOLOv7-tiny\nYOLOv7-Normal\nWe can see the limitations of the YOLOv7-Tiny model right away. It cannot detect cars, motorcycles, and persons who are very far off and small. The YOLOv7 model can detect these objects better. But that’s not the entire story. Although YOLO7-Tiny is not performing that well, it is much faster than YOLOv7. While YOLOv7 gave around 19 FPS, YOLOv7-Tiny ran it at**around 42 FPS, which is well above real-time**.\nNow, let’s check out the results of the second video, which depicts a crowded scenario. We use the same command as above but change the values for the **–source** and **–name** flags depending on the video path and name.\nYOLOv7 tiny\nYOLOv7 Normal\nThe YOLOv7 model can detect persons with less fluctuation and more confidence compared to the YOLOv7-Tiny model. Not only that, but YOLOv7-Tiny is also missing out on some of the traffic lights and people who are far away.\nLet’s run the inference on a final video that shows some general failure cases across all the YOLOv7 models.\nYOLOv7 tiny\nYOLOv7 Normal\nWe can see some of the general mistakes across both models:\n  * Detecting other road signs as **stop signs.**\n  * Detecting the forbidden road symbols as **persons** wrongly.\n\n\nAs we will see later, the above two mistakes are common across YOLOv4 and YOLOv5.\nEven though the YOLO7-Tiny makes more mistakes than the YOLOv7 model, it is much faster. On average, the YOLOv7-Tiny runs at more than 40 FPS, while the YOLOv7 model runs at slightly above 20 FPS.\n## Comparison Between YOLOv4, YOLOv5-Large, and YOLOv7 Model\nThe following three videos show the comparison between the YOLOv4, YOLOv5-Large, and the YOLOv7 model (top to bottom) on one of the videos. This will give us a proper qualitative idea of how each model performs across various scenarios.\nYOLOv4\nYOLOv5-Large\nYOLOv7\nAnd the following table shows the FPS and run times for different variants of the three models on the three videos.\n[![yolov7 paper explanation inference speed comparison](https://learnopencv.com/wp-content/uploads/2022/08/yolov7-vs-other-detectors-inference-speed-chart.png)](https://cdn.learnopencv.com/wp-content/uploads/2022/08/04092447/yolov7-vs-other-detectors-inference-speed.png)\nTable: YOLOv7 vs Other detectors inference speed chart\n## YOLOv7 Pose Estimation\nYOLOv7 is the first in the YOLO family to include a human pose estimation model. This is really interesting because there are very few real-time models out there. \nRecently, the official repository also got updated with a pre-trained pose estimation model. Hence, we will not cover the details in this post. A dedicated article on the internals of the YOLOv7 Pose Estimation model will be published later. In this section, we will discuss the application part and observe how it works.  \n|  **[Update: 18/10/22]:** We have kept our promise. Check out the detailed [YOLOv7 Pose Estimation](https://learnopencv.com/yolov7-pose-vs-mediapipe-in-human-pose-estimation/) article here. |  \n| --- |  \n### YOLOv7 Pose Prerequisites\nFirst, please ensure that you have cloned the YOLOv7 GitHub repository. Now, execute the following command within the cloned yolov7 directory to download the pre-trained pose estimation model.\n\n```\nwget https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7-w6-pose.pt\n\n```\n\n### YOLOv7 Pose Code\nWe will need a custom script to run pose estimation inference using the pre-trained model. Let’s write the code in a new **yolov7_keypoint.py** script inside the yolov7 directory. \n\n```\nimport matplotlib.pyplot as plt\nimport torch\nimport cv2\nimport numpy as np\nimport time\n\nfrom torchvision import transforms\nfrom utils.datasets import letterbox\nfrom utils.general import non_max_suppression_kpt\nfrom utils.plots import output_to_keypoint, plot_skeleton_kpts\n\ndevice = torch.device(\"cuda:0\" if torch.cuda.is_available() else \"cpu\")\nweigths = torch.load('yolov7-w6-pose.pt')\nmodel = weigths['model']\nmodel = model.half().to(device)\n_ = model.eval()\n\nvideo_path = '../inference_data/video_4.mp4'\n\n```\n\nWe import all the required modules and load the pre-trained **yolov7-w6-pose.pt** model, and initialize a **video_path** variable for the path to the source video. **_If you intend to run this inference on your own videos, please change the video_path accordingly._**\nNext, let’s read the video from the disk and create the **[VideoWriter](https://learnopencv.com/reading-and-writing-videos-using-opencv/)** object to save the resulting video on the disk.\n\n```\ncap = cv2.VideoCapture(video_path)\nif (cap.isOpened() == False):\n  print('Error while trying to read video. Please check path again')\n\n# Get the frame width and height.\nframe_width = int(cap.get(3))\nframe_height = int(cap.get(4))\n\n# Pass the first frame through `letterbox` function to get the resized image,\n# to be used for `VideoWriter` dimensions. Resize by larger side.\nvid_write_image = letterbox(cap.read()[1], (frame_width), stride=64, auto=True)[0]\nresize_height, resize_width = vid_write_image.shape[:2]\n\nsave_name = f\"{video_path.split('/')[-1].split('.')[0]}\"\n# Define codec and create VideoWriter object .\nout = cv2.VideoWriter(f\"{save_name}_keypoint.mp4\",\n                    cv2.VideoWriter_fourcc(*'mp4v'), 30,\n                    (resize_width, resize_height))\n\n\nframe_count = 0 # To count total frames.\ntotal_fps = 0 # To get the final frames per second.\n\n```\n\nFinally, we have a while loop running through each frame in the video.\n\n```\nwhile(cap.isOpened):\n  # Capture each frame of the video.\n  ret, frame = cap.read()\n  if ret:\n      orig_image = frame\n      image = cv2.cvtColor(orig_image, cv2.COLOR_BGR2RGB)\n      image = letterbox(image, (frame_width), stride=64, auto=True)[0]\n      image_ = image.copy()\n      image = transforms.ToTensor()(image)\n      image = torch.tensor(np.array([image.numpy()]))\n      image = image.to(device)\n      image = image.half()\n\n      # Get the start time.\n      start_time = time.time()\n      with torch.no_grad():\n          output, _ = model(image)\n        # Get the end time.\n      end_time = time.time()\n      # Get the fps.\n      fps = 1 / (end_time - start_time)\n      # Add fps to total fps.\n      total_fps += fps\n      # Increment frame count.\n      frame_count += 1\n\n      output = non_max_suppression_kpt(output, 0.25, 0.65, nc=model.yaml['nc'], nkpt=model.yaml['nkpt'], kpt_label=True)\n      output = output_to_keypoint(output)\n      nimg = image[0].permute(1, 2, 0) * 255\n      nimg = nimg.cpu().numpy().astype(np.uint8)\n      nimg = cv2.cvtColor(nimg, cv2.COLOR_RGB2BGR)\n      for idx in range(output.shape[0]):\n          plot_skeleton_kpts(nimg, output[idx, 7:].T, 3)\n\n          # Comment/Uncomment the following lines to show bounding boxes around persons.\n          xmin, ymin = (output[idx, 2]-output[idx, 4]/2), (output[idx, 3]-output[idx, 5]/2)\n          xmax, ymax = (output[idx, 2]+output[idx, 4]/2), (output[idx, 3]+output[idx, 5]/2)\n          cv2.rectangle(\n              nimg,\n              (int(xmin), int(ymin)),\n              (int(xmax), int(ymax)),\n              color=(255, 0, 0),\n              thickness=1,\n              lineType=cv2.LINE_AA\n          )\n\n      # Write the FPS on the current frame.\n      cv2.putText(nimg, f\"{fps:.3f} FPS\", (15, 30), cv2.FONT_HERSHEY_SIMPLEX,\n                  1, (0, 255, 0), 2)\n      # Convert from BGR to RGB color format.\n      cv2.imshow('image', nimg)\n      out.write(nimg)\n      # Press `q` to exit.\n      if cv2.waitKey(1) & 0xFF == ord('q'):\n          break\n  else:\n      break\n# Release VideoCapture().\ncap.release()\n# Close all frames and video windows.\ncv2.destroyAllWindows()\n# Calculate and print the average FPS.\navg_fps = total_fps / frame_count\nprint(f\"Average FPS: {avg_fps:.3f}\")\n\n```\n\nThe above code:\n  * Loops through each frame.\n  * Carries out the pose estimation.\n  * Creates the output frame.\n  * Writes the FPS on top of the current resulting frame.\n  * Shows the resulting frame on the screen and writes it to disk as well.\n\n\nNow, let’s execute the above code for YOLOv7 pose estimation.\n\n```\npython yolov7_keypoint.py\n\n```\n\nThe following is the output.\nThe results look pretty good given the high FPS that we get. But note that the 60 FPS that we get here is only for the forward pass of the model. The FPS will likely decrease if we include post-processing such as NMS (Non-Max Suppression), thresholding, and annotation. Still, it is impressively high.\n## Summary of YOLOv7\nWith this, we conclude the introduction to YOLOv7. I hope you enjoyed reading the article. In summary, we have covered the following.\n  * The general architecture of YOLO consists of Backbone, Neck, and Head.\n  * Architectural reforms of YOLOv7.\n    * E-ELAN\n    * Compound Model Scaling in YOLOv7\n  * Trainable Bag of Freebies in YOLOv7.\n    * Re-parameterization in YOLOv7\n    * Coarse for Auxiliary and Fine for Lead loss\n  * How to use the YOLOv7 GitHub repository to run object detection inference.\n  * YOLOv7 surpasses all real-time object detectors in speed and accuracy.\n  * FPS: 5 – 165\n  * mAP: 51.4% – 56.8%\n  * YOLOv7 reduced 40% of parameters and 50% of computation but improved performance. It’s a significant feat.\n  * How to use the YOLOv7 Pose estimation (keypoint detection) model.\n\n\n## References\n  1. [YOLOv7 Paper](https://arxiv.org/pdf/2207.02696.pdf)\n  2. [YOLOv7 GitHub](https://github.com/WongKinYiu/yolov7)\n  3. [REPVGG](https://arxiv.org/pdf/2101.03697.pdf)\n  4. [Pre-trained pose estimation model](https://github.com/WongKinYiu/yolov7#pose-estimation)\n  5. [OREPA(Online Convolutional Re-parameterization)](https://arxiv.org/pdf/2204.00826.pdf)\n\n\n### From idea to working model to real-time deployment\nBig Vision takes computer vision projects through the full journey, not just the easy parts.\n![Satya Mallick](https://opencv.org/university/wp-content/uploads/sites/4/2023/04/Dr-Satya.jpg)\n**Satya Mallick** Founder - Big Vision & LearnOpenCV\n[ Talk to our Team ](https://bigvision.ai/expert-ai-solution-builders/)\n## Must Read Articles\n#### **We have crafted the following articles, especially for you, covering the YOLO series in-depth.**\n  * [YOLOv7 Object Detection Paper Explanation and Inference](https://learnopencv.com/yolov7-object-detection-paper-explanation-and-inference/)\n  * [Fine Tuning YOLOv7 on Custom Dataset](https://learnopencv.com/fine-tuning-yolov7-on-custom-dataset/)\n  * [YOLOv7 Pose vs. MediaPipe in Human Pose Estimation](https://learnopencv.com/yolov7-pose-vs-mediapipe-in-human-pose-estimation/)\n  * [YOLOv6 Object Detection – Paper Explanation and Inference](https://learnopencv.com/yolov6-object-detection/)\n  * [YOLOX Object Detector Paper Explanation and Custom Training](https://learnopencv.com/yolox-object-detector-paper-explanation-and-custom-training/)\n  * [Object Detection using YOLOv5 and OpenCV DNN in C++ and Python](https://learnopencv.com/object-detection-using-yolov5-and-opencv-dnn-in-c-and-python/)\n  * [Custom Object Detection Training using YOLOv5](https://learnopencv.com/custom-object-detection-training-using-yolov5/)\n  * [Pothole Detection using YOLOv4 and Darknet](https://learnopencv.com/pothole-detection-using-yolov4-and-darknet/)\n  * [Deep Learning based Object Detection using YOLOv3 with OpenCV](https://learnopencv.com/deep-learning-based-object-detection-using-yolov3-with-opencv-python-c/)\n  * [Training YOLOv3: Deep Learning-based Custom Object Detector](https://learnopencv.com/training-yolov3-deep-learning-based-custom-object-detector/)\n\n\nWas This Article Helpful?\nPost Views: 97\n## Subscribe & Download Code\nIf you liked this article and would like to download code (C++ and Python) and example images used in this post, please [click here](javascript:void\\(0\\)). In our newsletter, we share Computer Vision and AI tutorials and examples written in C++/Python, and Computer Vision and Machine Learning algorithms and news.  \n  \n\n[ Download Example Code](javascript:void\\(0\\))\n  \n  \n\n[PrevPreviousYOLOv4 and Darknet For Pothole Detection](https://learnopencv.com/pothole-detection-using-yolov4-and-darknet/)\n[NextMean Average Precision (mAP) in Object DetectionNext](https://learnopencv.com/mean-average-precision-map-object-detection-model-evaluation-metric/)\n###  [ Train RF-DETR for Instance Segmentation with GPT-6 Astra ](https://learnopencv.com/astra-rf-detr-microduck-segmentation/)\nBefore a flight, I left Astra a short prompt and a signed-in Roboflow account. It\n###  [ How 10x AI Engineers Train Models for Production: Lessons from PINTO’s Face Alignment Project ](https://learnopencv.com/how-10x-ai-engineers-train-models-for-production/)\nLearn a production model training playbook from PINTO’s face alignment project: reframe the task, engineer\n###  [ VGGT vs. VGGT-Ω (VGGT-Omega): A Complete Guide to Feed-Forward 3D Reconstruction ](https://learnopencv.com/vggt-vs-vggt-%cf%89-vggt-omega-a-complete-guide-to-feed-forward-3d-reconstruction/)\nHow VGGT and VGGT-Ω work, what changed, and real benchmark numbers, speed, GPU memory, depth,\n![Satya Mallick](https://opencv.org/university/wp-content/uploads/sites/4/2023/04/Dr-Satya.jpg)\n#### Satya Mallick, Ph.D.\nFounder - Big Vision & LearnOpenCV\n#####  Are you struggling with your Computer Vision Product Development?\nHelping startups and enterprises build and deploy scalable solutions that work in the real world.\n[ Schedule a Call ](https://bigvision.ai/expert-ai-solution-builders?utm_source=lopcv&utm_medium=post)\n####  Table of Contents\n  1. [What is YOLOv7?](https://learnopencv.com/yolov7-object-detection-paper-explanation-and-inference/#elementor-toc__heading-anchor-0)\n  2. [YOLO Master Post – Every Model Explained](https://learnopencv.com/yolov7-object-detection-paper-explanation-and-inference/#elementor-toc__heading-anchor-1)\n  3. [Mastering All YOLO Models from YOLOv1 to YOLO-NAS: Papers Explained (2024)](https://learnopencv.com/yolov7-object-detection-paper-explanation-and-inference/#elementor-toc__heading-anchor-2)\n  4. [YOLO Architecture in General](https://learnopencv.com/yolov7-object-detection-paper-explanation-and-inference/#YOLO-Architecture-in-General)\n  5. [What’s New in YOLOv7?](https://learnopencv.com/yolov7-object-detection-paper-explanation-and-inference/#What%E2%80%99s-new-in-YOLOv7?)\n  6. [YOLOv7 Architecture](https://learnopencv.com/yolov7-object-detection-paper-explanation-and-inference/#YOLOv7-Architecture)\n  7. [Trainable Bag of Freebies in YOLOv7](https://learnopencv.com/yolov7-object-detection-paper-explanation-and-inference/#Trainable-Bag-of-Freebies-in-YOLOv7)\n  8. [YOLOv7 Experiments and Results](https://learnopencv.com/yolov7-object-detection-paper-explanation-and-inference/#YOLOv7-Experiments-and-Results)\n  9. [YOLOv7 Object Detection Inference](https://learnopencv.com/yolov7-object-detection-paper-explanation-and-inference/#YOLOv7-Object-Detection-Inference)\n  10. [Comparison Between YOLOv4, YOLOv5-Large, and YOLOv7 Model](https://learnopencv.com/yolov7-object-detection-paper-explanation-and-inference/#Comparison-between-YOLOv4,-YOLOv5-Large-and-YOLOv7)\n  11. [YOLOv7 Pose Estimation](https://learnopencv.com/yolov7-object-detection-paper-explanation-and-inference/#YOLOv7-Pose-Estimation)\n  12. [Summary of YOLOv7](https://learnopencv.com/yolov7-object-detection-paper-explanation-and-inference/#Summary-of-YOLOv7)\n  13. [References](https://learnopencv.com/yolov7-object-detection-paper-explanation-and-inference/#elementor-toc__heading-anchor-12)\n  14. [Must Read Articles](https://learnopencv.com/yolov7-object-detection-paper-explanation-and-inference/#elementor-toc__heading-anchor-13)\n\n\nWas This Article Helpful?\n  * [E-ELAN Architrcture](https://learnopencv.com/tag/e-elan-architrcture/), [new yolo](https://learnopencv.com/tag/new-yolo/), [YOLO](https://learnopencv.com/tag/yolo/), [yolo architecture](https://learnopencv.com/tag/yolo-architecture/), [yolov7](https://learnopencv.com/tag/yolov7/), [yolov7 detector](https://learnopencv.com/tag/yolov7-detector/), [yolov7 github](https://learnopencv.com/tag/yolov7-github/), [yolov7 inference](https://learnopencv.com/tag/yolov7-inference/), [yolov7 object detection](https://learnopencv.com/tag/yolov7-object-detection/), [yolov7 paper](https://learnopencv.com/tag/yolov7-paper/), [yolov7 paper explanation](https://learnopencv.com/tag/yolov7-paper-explanation/), [yolov7 pose](https://learnopencv.com/tag/yolov7-pose/), [yolov7 pytorch](https://learnopencv.com/tag/yolov7-pytorch/), [yolov7-tiny](https://learnopencv.com/tag/yolov7-tiny/)\n\n\n## Read Next\n[ ![Decoding Virat Kohli’s Flick Shot: AI-Based 3D Motion Reconstruction](https://cdn.learnopencv.com/wp-content/uploads/2026/07/16015539/decoding-virat-kohli-flick-shot-3d-motion-reconstruction.png) ](https://learnopencv.com/decoding-virat-kohlis-flick-shot-ai-based-3d-motion-reconstruction/)\n[3D Computer Vision](https://learnopencv.com/category/3d-computer-vision/)[3D Reconstruction](https://learnopencv.com/category/3d-computer-vision/3d-reconstruction/)[Segmentation](https://learnopencv.com/category/segmentation/)[SpatialAI-Depth](https://learnopencv.com/category/3d-computer-vision/spatialai-depth/)[Video Analysis](https://learnopencv.com/category/video-analysis/)\n[Adnan Shaikh](https://learnopencv.com/author/adnan/) July 18, 2026 \n##  [ Decoding Virat Kohli’s Flick Shot: AI-Based 3D Motion Reconstruction ](https://learnopencv.com/decoding-virat-kohlis-flick-shot-ai-based-3d-motion-reconstruction/)\nReconstruct the 3D swing plane of Virat Kohli's flick shot from a single 2D video with off-the-shelf vision models. No…\n[ ![How to Run Object Detection with OpenCV 5](https://cdn.learnopencv.com/wp-content/uploads/2026/07/11002616/OpenCV_5_Blog_Thumbnail_final-scaled.jpg) ](https://learnopencv.com/how-to-run-object-detection-with-opencv-5/)\n[Object Detection](https://learnopencv.com/category/object-detection/)[OpenCV 5](https://learnopencv.com/category/opencv/opencv-5/)[OpenCV DNN](https://learnopencv.com/category/opencv-dnn/)[YOLO](https://learnopencv.com/category/yolo/)\n[Sudip Chakrabarty](https://learnopencv.com/author/sudip/) July 9, 2026 \n##  [ How to Run Object Detection with OpenCV 5 ](https://learnopencv.com/how-to-run-object-detection-with-opencv-5/)\nLearn about the new OpenCV 5 and how to use its DNN engine to run object detection models on the…\n[ ![How to Fine-Tune YOLO26 for Safety Gear and Sign Language Detection](https://cdn.learnopencv.com/wp-content/uploads/2026/06/17235330/YOLO26_Finetuning_Thumbnail_image-768x512.jpg) ](https://learnopencv.com/how-to-fine-tune-yolo26-for-safety-gear-and-sign-language-detection/)\n[Computer Vision](https://learnopencv.com/category/computer-vision/)[Object Detection](https://learnopencv.com/category/object-detection/)[YOLO](https://learnopencv.com/category/yolo/)\n[Sudip Chakrabarty](https://learnopencv.com/author/sudip/) June 18, 2026 \n##  [ How to Fine-Tune YOLO26 for Safety Gear and Sign Language Detection ](https://learnopencv.com/how-to-fine-tune-yolo26-for-safety-gear-and-sign-language-detection/)\nLearn how to fine-tune YOLO26 on your own data. We build a construction PPE safety detector and a sign-language reader…\n##  Subscribe to our Newsletter\nSubscribe to our email newsletter to get the latest posts delivered right to your email.\nName \nEmail \nSend\n![](https://cdn.learnopencv.com/wp-content/uploads/2025/12/04080755/learnOpenCV_by_bigvision1.png)\nEmpowering innovation through education, LearnOpenCV provides in-depth tutorials, code, and guides in AI, Computer Vision, and Deep Learning. Led by Dr. Satya Mallick, we're dedicated to nurturing a community keen on technology breakthroughs.\n[ Read More ](https://learnopencv.com/about/)\nCategories\n  * [Deep Learning](https://learnopencv.com/category/deep-learning/)\n  * [Object Detection](https://learnopencv.com/category/object-detection/)\n  * [Image Classification](https://learnopencv.com/category/image-classification)\n  * [YOLO](https://learnopencv.com/category/yolo/)\n  * [Image Processing](https://learnopencv.com/category/image-processing/)\n  * [Image Segmentation](https://learnopencv.com/category/image-segmentation/)\n\n\n  * [Deep Learning](https://learnopencv.com/category/deep-learning/)\n  * [Object Detection](https://learnopencv.com/category/object-detection/)\n  * [Image Classification](https://learnopencv.com/category/image-classification)\n  * [YOLO](https://learnopencv.com/category/yolo/)\n  * [Image Processing](https://learnopencv.com/category/image-processing/)\n  * [Image Segmentation](https://learnopencv.com/category/image-segmentation/)\n\n\nGetting Started\n  * [Installation](https://learnopencv.com/category/install/)\n  * [PyTorch](https://learnopencv.com/learn-pytorch/)\n  * [Getting Started with OpenCV](https://learnopencv.com/getting-started-with-opencv/)\n  * [Keras & Tensorflow](https://learnopencv.com/learn-keras-and-tensorflow/)\n\n\n  * [Installation](https://learnopencv.com/category/install/)\n  * [PyTorch](https://learnopencv.com/learn-pytorch/)\n  * [Getting Started with OpenCV](https://learnopencv.com/getting-started-with-opencv/)\n  * [Keras & Tensorflow](https://learnopencv.com/learn-keras-and-tensorflow/)\n\n\nBig Vision\n  * [AI Consulting](https://bigvision.ai/expert-ai-solution-builders/#talk?utm_source=locv&utm_medium=footer)\n  * [Case Studies](https://bigvision.ai/case-studies/?utm_source=locv&utm_medium=footer)\n  * [Get in Touch](https://bigvision.ai/contact-us/?utm_source=locv&utm_medium=footer)\n\n\n  * [AI Consulting](https://bigvision.ai/expert-ai-solution-builders/#talk?utm_source=locv&utm_medium=footer)\n  * [Case Studies](https://bigvision.ai/case-studies/?utm_source=locv&utm_medium=footer)\n  * [Get in Touch](https://bigvision.ai/contact-us/?utm_source=locv&utm_medium=footer)\n\n\nCopyright © 2026 – BIG VISION LLC [Privacy Policy](https://learnopencv.com/privacy-policy/) [Terms and Conditions](https://learnopencv.com/terms-and-conditions/)\n  * [ ](https://bit.ly/Facebook_LearnOpenCV)\n  * [ ](https://www.instagram.com/learnopencv/)\n  * [ ](https://www.linkedin.com/in/satyamallick/)\n  * [ ](https://x.com/LearnOpenCV)\n  * [ ](https://www.youtube.com/c/LearnOpenCV?utm_source=lopcv&utm_medium=footer&utm_campaign=yt)\n\n\n[ ![](https://learnopencv.com/wp-content/uploads/2021/10/cropped-favicon-512x512-1.png) Click here to download the source code to this post ](javascript:void\\(0\\))\n",
  "body_base_path": "attachments/581f2af0f6fd/pages/",
  "body_markdown_path": "attachments/581f2af0f6fd/pages/archived-body.md",
  "local_html": "attachments/581f2af0f6fd/pages/archived-body.html",
  "body_source": "prior_capture"
}