Residual network , YOLO

YOLO之boxes小记 【代码】YOLO之boxes小记。 阅读详情

Residual Network:https://blog.youkuaiyun.com/koala_tree/article/details/78583979

以下是YOLO部分:

1、模型细节:(来自:https://blog.youkuaiyun.com/koala_tree/article/details/78690396)

- The input is a batch of images of shape (m, 608, 608, 3) 
- The output is a list of bounding boxes along with the recognized classes. Each bounding box is represented by 6 numbers (p_{c}, b_{x}, b_{y}, b_{h}, b_{w},c) as explained above. If you expand c into an 80-dimensional vector, each bounding box is then represented by 85 numbers.(在这里,一共有80个不同的类别)

We will use 5 anchor boxes. So you can think of the YOLO architecture as the following: IMAGE (m, 608, 608, 3) -> DEEP CNN -> ENCODING (m, 19, 19, 5, 85).

If the center/midpoint of an object falls into a grid cell, that grid cell is responsible for detecting that object.

Anchor boxes are defined only by their width and height.

 

For simplicity, we will flatten the last two last dimensions of the shape (19, 19, 5, 85) encoding. So the output of the Deep CNN is (19, 19, 425).

Now, for each box (of each cell) we will compute the following elementwise product and extract a probability that the box contains a certain class.(softmax)

Here’s one way to visualize what YOLO is predicting on an image: 
- For each of the 19x19 grid cells, find the maximum of the probability scores (taking a max across both the 5 anchor boxes and across different classes). 
- Color that grid cell according to what object that grid cell considers the most likely.

Doing this results in this picture:

IOU:

- In this exercise only, we define a box using its two corners (upper left and lower right): (x1, y1, x2, y2) rather than the midpoint and height/width. 
- To calculate the area of a rectangle you need to multiply its height (y2 - y1) by its width (x2 - x1) 
- You’ll also need to find the coordinates (xi1, yi1, xi2, yi2) of the intersection of two boxes. Remember that: 
- xi1 = maximum of the x1 coordinates of the two boxes 
- yi1 = maximum of the y1 coordinates of the two boxes 
- xi2 = minimum of the x2 coordinates of the two boxes 
- yi2 = minimum of the y2 coordinates of the two boxes

we use the convention that (0,0) is the top-left corner of an image, (1,0) is the upper-right corner, and (1,1) the lower-right corner.

def iou(box1, box2):
    """Implement the intersection over union (IoU) between box1 and box2

    Arguments:
    box1 -- first box, list object with coordinates (x1, y1, x2, y2)
    box2 -- second box, list object with coordinates (x1, y1, x2, y2)
    """

    # Calculate the (y1, x1, y2, x2) coordinates of the intersection of box1 and box2. Calculate its Area.
    xi1 = max(box1[0], box2[0])
    yi1 = max(box1[1], box2[1])
    xi2 = min(box1[2], box2[2])
    yi2 = min(box1[3], box2[3])
    inter_area = (xi2 - xi1) * (yi2 - yi1) 

    # Calculate the Union area by using Formula: Union(A,B) = A + B - Inter(A,B)
    box1_area = (box1[2] - box1[0]) * (box1[3] - box1[1])
    box2_area = (box2[2] - box2[0]) * (box2[3] - box2[1])
    union_area = box1_area + box2_area - inter_area

    # compute the IoU
    iou = inter_area / union_area


    return iou

非极大值抑制函数:

def yolo_non_max_suppression(scores, boxes, classes, max_boxes = 10, iou_threshold = 0.5):
    """
    Applies Non-max suppression (NMS) to set of boxes

    Arguments:
    scores -- tensor of shape (None,), output of yolo_filter_boxes()
    boxes -- tensor of shape (None, 4), output of yolo_filter_boxes() that have been scaled to the image size (see later)
    classes -- tensor of shape (None,), output of yolo_filter_boxes()
    max_boxes -- integer, maximum number of predicted boxes you'd like
    iou_threshold -- real value, "intersection over union" threshold used for NMS filtering

    Returns:
    scores -- tensor of shape (, None), predicted score for each box
    boxes -- tensor of shape (4, None), predicted box coordinates
    classes -- tensor of shape (, None), predicted class for each box

    Note: The "None" dimension of the output tensors has obviously to be less than max_boxes. Note also that this
    function will transpose the shapes of scores, boxes, classes. This is made for convenience.
    """

    max_boxes_tensor = K.variable(max_boxes, dtype='int32')     # tensor to be used in tf.image.non_max_suppression()
    K.get_session().run(tf.variables_initializer([max_boxes_tensor])) # initialize variable max_boxes_tensor

    # Use tf.image.non_max_suppression() to get the list of indices corresponding to boxes you keep
    ### START CODE HERE ### (≈ 1 line)
    nms_indices = tf.image.non_max_suppression(boxes, scores, max_boxes, iou_threshold, name=None)
    ### END CODE HERE ###

    # Use K.gather() to select only nms_indices from scores, boxes and classes
    ### START CODE HERE ### (≈ 3 lines)
    scores = K.gather(scores, nms_indices)
    boxes = K.gather(boxes, nms_indices)
    classes = K.gather(classes, nms_indices)
    ### END CODE HERE ###

    return scores, boxes, classes

一个步骤的整合:

def yolo_eval(yolo_outputs, image_shape = (720., 1280.), max_boxes=10, score_threshold=.6, iou_threshold=.5):
    """
    Converts the output of YOLO encoding (a lot of boxes) to your predicted boxes along with their scores, box coordinates and classes.

    Arguments:
    yolo_outputs -- output of the encoding model (for image_shape of (608, 608, 3)), contains 4 tensors:
                    box_confidence: tensor of shape (None, 19, 19, 5, 1)
                    box_xy: tensor of shape (None, 19, 19, 5, 2)
                    box_wh: tensor of shape (None, 19, 19, 5, 2)
                    box_class_probs: tensor of shape (None, 19, 19, 5, 80)
    image_shape -- tensor of shape (2,) containing the input shape, in this notebook we use (608., 608.) (has to be float32 dtype)
    max_boxes -- integer, maximum number of predicted boxes you'd like
    score_threshold -- real value, if [ highest class probability score < threshold], then get rid of the corresponding box
    iou_threshold -- real value, "intersection over union" threshold used for NMS filtering

    Returns:
    scores -- tensor of shape (None, ), predicted score for each box
    boxes -- tensor of shape (None, 4), predicted box coordinates
    classes -- tensor of shape (None,), predicted class for each box
    """

    ### START CODE HERE ### 

    # Retrieve outputs of the YOLO model (≈1 line)
    box_confidence, box_xy, box_wh, box_class_probs = yolo_outputs

    # Convert boxes to be ready for filtering functions 
    boxes = yolo_boxes_to_corners(box_xy, box_wh)

    # Use one of the functions you've implemented to perform Score-filtering with a threshold of score_threshold (≈1 line)
    scores, boxes, classes = yolo_filter_boxes(box_confidence, boxes, box_class_probs, score_threshold)

    # Scale boxes back to original image shape.
    boxes = scale_boxes(boxes, image_shape)

    # Use one of the functions you've implemented to perform Non-max suppression with a threshold of iou_threshold (≈1 line)
    scores, boxes, classes = yolo_non_max_suppression(scores, boxes, classes, max_boxes, iou_threshold)

    ### END CODE HERE ###

    return scores, boxes, classes

最终返回scores,boxes, classes的信息。

相当于是通过已经训练好到YOLO网络,我们来做一个后期到非极大值抑制的处理,最终得到想要的boxes信息。并且输出,以及在原始图片上将box绘制出来。

summary for YOLO:

- Input image (608, 608, 3) 
- The input image goes through a CNN, resulting in a (19,19,5,85) dimensional output. 
- After flattening the last two dimensions, the output is a volume of shape (19, 19, 425): 
- Each cell in a 19x19 grid over the input image gives 425 numbers. 
- 425 = 5 x 85 because each cell contains predictions for 5 boxes, corresponding to 5 anchor boxes, as seen in lecture. 
- 85 = 5 + 80 where 5 is because (P_{c}, b_{x}, b_{y}, b_{h}, b_{w}) has 5 numbers, and and 80 is the number of classes we’d like to detect 
- You then select only few boxes based on: 
- Score-thresholding: throw away boxes that have detected a class with a score less than the threshold 
- Non-max suppression: Compute the Intersection over Union and avoid selecting overlapping boxes 
- This gives you YOLO’s final output.

 

 

 

【Pruning系列:二】Learning Efficient Convolutional Networks through Network Slimming|YOLOv3实践 |Pytorch 总结 YOLOv3-model-pruning https://github.com/Lam1360/YOLOv3-model-pruning YOLOv3模型剪枝,瘦身80%,提速100%,精度基本不变 Introduction 以 eriklindernoren/PyTorch-YOLOv3(https://github.com/eriklindernoren/PyTorch-YOLOv3)为Y... 阅读详情

相关推荐

YOLO-World核心模块T-CSPLayer:视觉-文本融合机制全解析

开放词汇目标检测是当前计算机视觉的热门方向,允许模型识别任意类别而不需要重新训练。YOLO-World作为该领域的代表性工作,通过引入文本编码器实现视觉-语言跨模态融合,其核心组件T-CSPLayer负责将文本语义注入视觉特征。不同于简单的特征拼接,T-CSPLayer采用通道级调制机制,利用可学习的投影层生成缩放和偏移系数,在不改变特征图尺寸的前提下激活对应语义通道,从而保证推理时词表可动态变化。同时,得益于重参数化设计,训练完成后的文本分支可被合并进卷积权重,使部署模型保持原生YOLO的高效推理速度。该

weixin_29081163的博客 327

YOLO的bounding boxes

并且为 S x S(S = 7)个grid,如果物体的中心落入该grid中,那么该grid就需要负责检测该物体。YOLO使用了 7×7 网格 (S×S)、2 个bounding boxes (B=2) 和 20 个类别 ©。网络输出就是一个 S × S × (5×B+C)。3.每个框还要负责预测这个框中的物体是什么。4.综上,S×S 个网格,每个网格要预测。1.YOLO将输入的图片resize成。3.2.2 预测形状。

weixin_55035144的博客 1169

一[3.7] YOLO系列基础(3)- “残差网络(Residual network,ResNet)到C3层”

C3层在自己的多层瓶颈层的外面,构建了一个仅有一个conv层的残差结构。相比于ResNet的残差结构,C3层将原始数据进行了一次卷积操作。正常参数流动是从上到下每层都跑不掉,残差网络用了一个shortcut来为不相邻的网络层之间开辟了一条高速路,也就是说,此外,多增加的一个Conv层大大提高了模型的拟合速度,因为不管怎么说,好歹是做了一次特征提取的操作。这是因为:退化现象的本质在于数据特征在深度网络中逐渐丢失,而我们希望的现象是:直接将。显然,C3层借鉴了残差层的设计理念。,以达成上诉的目标!

努力努力努力 147

jupyter安装使用,yolo预测结果可视化与Boxes信息

确保已经正确安装VScode,并已经安装python插件。

weixin_45819759的博客 2161

YOLO26核心模块深度解析:HDRAB的层次化空洞卷积与注意力融合机制

HDRAB(Hierarchical Dilated Residual Attention Block)是来自"Dual residual attention network for image denoising"论文的核心组件,是一个专门设计用于图像去噪任务的高效残差注意力模块。该模块通过层次化的膨胀卷积结构和通道注意力机制,实现了多尺度特征提取和自适应特征增强,在保持计算效率的同时显著提升了图像去噪的性能。HDRAB的设计灵感来源于图像去噪任务的核心挑战:如何在去除噪声的同时保持图像的细节信息。

know_F0727的博客 2617

【YOLO26多模态创新改进】全网独家复现创新 | TGRS 2025 | 引入MROD-YOLO的 MJRNet 多模态联合表征网络模块,对可见光与红外信息的早期深度融合、充分发挥多模态互补优势

🔥本文提出了MJRNet多模态联合表征网络模块,用于改进YOLO26多模态目标检测模型。MJRNet通过全局上下文注意力机制和掩膜增强策略,实现可见光与红外信息的早期深度融合,提升特征语义一致性和细节保留能力。该模块结构轻量,计算开销低,显著改善了复杂环境下小目标和弱目标的检测效果。实验表明,改进后的模型在mAP50指标上达到77.9%准确率,较现有方法提升4.2%,同时保持良好的实时性与工程可部署性。文章详细介绍了模块原理、优势及完整实现代码,并提供了手把手的配置指导。

Ai缝合怪、助力小伙伴高效发论文 24

Yolo算法检测之Anchor Boxes原理详解

刚开始yolo系列的目标检测算法,在一个网格中只能检测一个对象,但是我们在实验中发现,一个网格中很多时候存在不仅一个目标,可能存在多个目标,类似如下图所示,下面中间的网格中就存在人和车辆两个目标的中心点,因此如何检测出一个网格中存在的多个目标就成了我们需要研究的问题。Anchor Boxes的出现帮我们解决了这个问题。 对于如上图的情况我们输出向量的时候C1 C2 C3种类这块没法输出,因为里面有两个,人和车。 因此 Anchor Boxes的做法是我们建立两个Anchor Box,如下图所示: 当然目标

爱吃橘子的小翟 2868

【YOLO26创新改进】CVPR 2024 | Backbone主干网络改进篇 | 使用RMT主干网络改进YOLO26,全局感知、空间先验与局部增强,适合目标检测、遥感目标检测、图像分割、图像分类任务

本文提出将RMT主干网络引入YOLO26目标检测框架的创新改进方案。RMT通过曼哈顿自注意力机制为特征提取引入明确的空间距离先验,使模型在建立全局联系时能更关注目标附近区域,同时保留远距离背景信息。其核心创新点包括:(1)将RetNet的时间衰减机制扩展至空间域,基于曼哈顿距离构建空间衰减矩阵;(2)采用横向和纵向分解注意力降低计算复杂度;(3)通过局部上下文增强模块补充边缘和纹理特征。实验表明,该改进能有效提升模型对小目标、遮挡目标及复杂背景目标的检测能力。

AI魔改博士-中大博士 207

【yolov5】改进系列——特征图可视化

六行代码实现:特征图提取与特征图可视化,可以实现分类网络的特征图可视化最近忙论文,想在yolov5上面做一些改进,看源码看了一段时间,动手改改代码做一些改进,所以做个一系列改进的记录。六行代码实现:特征图提取与特征图可视化,可以实现分类网络得特征图可视化。

capsule的博客 9586

AHRS互补滤波(Mahony)算法及开源代码

AHRS(Attitude and heading ref AHRS(Attitude and heading reference system,也就是航姿参考系统。在互补滤波算法中传感器主要采用了IMU(陀螺仪、加速度计)和磁力计。 AHRS的基本思想是,在载体没有平移运动的情况下,通过加速度感知重力分量,可以计算出载体的俯仰(Pitch)和横滚(Pitch);磁力计可以感知磁北方向,因此可以计算载体的磁北航向;而陀螺仪测量输出载体的旋转角速度,通过积分可以计算得到横滚、俯仰、航向增量,但由于陀螺输出值含

weixin_42918498的博客 3万+

uses ARM-Compiler ‘Default Compiler Version 5‘ which is not available. MDK5.37安装ARM_Compiler_5

MDK5.37安装ARM_Compiler_5 最后一个AC5编译器,从MDK5.37开始,不再默认安装,需要独立安装 ARMCompiler_506_Windows_x86_b960.zip (80.94MB) 否则使用AC5编译代码报错如下: Build started: Project: Project *** Target 'STM3210C_EVAL' uses ARM-Compiler 'Default Compiler Version 5' which is not available. *

mowwwcom的专栏 2万+

【论文阅读】Detection of Airplanes on the Ground Using YOLO Neural Network

0.摘要 本文主要在从无人机和卫星从空中拍摄的照片中,探究使用艺术方法进行物体检测的算法的表现。主要研究了YOLO系列中YOLOv3和Tiny YOLOv3两种算法。用于物体检测的网络架构已经针对目标训练集进行过训练和适应。实验结论证明了他们有很高的检测能力和位置预测能力,以及具有实时处理速度的图形化处理单元。这个方法可以简单的用于地面上许多不同类的物体检测。 1.简介 无人机在人类活动的许多领域...

skiery的博客 340

瑞萨 RL78 开发环境实战:从 CS+ for CC 到 e² studio 高效开发

本文详细介绍了瑞萨RL78单片机开发环境的选择与配置,对比分析了CS+ for CC和e² studio的特点及适用场景。内容涵盖环境安装、工程创建、调试技巧、外设驱动开发和低功耗设计等实战经验,为开发者提供全面的RL78入门指南,帮助快速上手并高效开发。

4k5l6j7h8的博客 249

YOLOV11|YOLO12改进系列指南

YOLOV11V12改进系列指南,仅仅69.9包含YOLOV11V12模型改进方案、含有440+种改进的集合,且含有多种二次创新和原创改进!

qq_37706472的博客 15万+

Linux安装MinIO(图文解说详细版)

最近开个新坑,就是在linux环境中操作开发环境,带大家玩转Linux,会整理出一篇Linux的专栏,欢迎大家订阅!! 富贵同学linux环境为CentOS7.8 版本。 上期跟大家说了一下OpenJDK的安装,这次说一下minio的安装 第一步,进入/opt 目录,创建minio文件夹 cd /opt mkdir minio 第二步,wget下载安装包: wget https://dl.minio.io/server/minio/release/linux-amd64/minio 第三步,进入m

编码人生 5万+

【SCADA】KingSCADA将数据插入SQLServer的方法

1、创建数据库及数据表格;2、配置ODBC数据源。3、通过KingSCADA与数据库建立连接,将数据写入数据库对应表格。

做有价值的事,积累有价值的笔记! 4969

Residual Network - python01

Residual Networks Andrew Ng deeplearning courese-4:Convolutional Neural Network Convolutional Neural Networks: Step by Step Convolutional Neural Networks: Application Residual Networks Autonomous...

Xwei1226的博客 495

55、宇宙微波背景辐射望远镜及其光学系统解析

本文详细解析了宇宙微波背景辐射(CMB)望远镜及其光学系统的设计与优化。内容涵盖折射与反射光学系统的特性、旁瓣控制技术、气球与地面观测系统的对比、探测器阵列的发展、光学系统设计流程以及不同观测场景下的光学系统选择。同时,文章展望了CMB望远镜光学系统的未来发展趋势,包括技术创新、多频段观测、国际合作与大型项目等。通过系统性的分析与对比,为CMB研究提供了全面的技术支持与理论基础。

f9g0h的博客 146

怎么理解layui里的data_深入理解YOLO v3实现细节 - 第2篇 backbone&network

深入理解YOLO v3实现细节系列文章,是本人根据自己对YOLO v3原理的理解,结合开源项目tensorflow-yolov3,写的学习笔记。如有不正确的地方,请大佬们指出,谢谢!目录第1篇 数据预处理第2篇 backbone&network第3篇 构建v3的 Loss_layer 今天来讲讲YOLO v3的backbone——darknet53。YOLO每一代的提升很大一部...

weixin_39533742的博客 418

FC7300 Clock介绍

FC7300的时钟架构包括一个高级时钟图和内部时钟需求。它有5个CMU,使用SIRC监控FIRC/SOSC/FOSC,并使用FIRC监控SIRC。此外,CMU4还使用FOSC监Slow Clock。

舊梦的博客 329

C-Lodop打印服务系统存在任意文件读取

C-Lodop打印服务系统存在任意文件读取

weixin_43567873的博客 2880

检测模型设计准则 | YOLO系列的设计源头是什么?

作者|小书童 编辑| 集智书童点击下方卡片,关注“自动驾驶之心”公众号ADAS巨卷干货,即可获取点击进入→自动驾驶之心【目标检测】技术交流群后台回复【2D检测综述】获取鱼眼检测、实时检测、通用2D检测等近5年内所有综述!设计高效、高质量的表达性网络架构一直是深度学习领域最重要的研究课题。当今的大多数网络设计策略都集中于如何集成从不同层提取的特征,以及如何设计计算单元来有效地提取这些特征,从而...

CV_Autobot的博客 390

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

NFNet与YOLO26集成:无归一化目标检测实践

目标检测作为计算机视觉的核心任务,其性能瓶颈常源于特征提取的稳定性。传统方法依赖批量归一化(BN)来加速训练,但存在批次依赖性和计算开销等问题。NFNet通过残差分支缩放和自适应梯度裁剪(AGC)技术,实现了无需归一化层的高效训练。这种架构特别适合工业场景中的小目标检测和复杂背景处理,与YOLO26框架结合后,在COCO和VisDrone数据集上分别实现了2.3%和4.7%的mAP提升。关键技术包括SWS卷积和SiLU激活函数,这些设计既保持了模型稳定性,又提升了训练效率。

weixin_33850890的博客 416

lwip-2.0.3

lwip是瑞典计算机科学院(SICS)的Adam Dunkels 开发的一个小型开源的TCP/IP协议栈。实现的重点是在保持TCP协议主要功能的基础上减少对RAM 的占用。

Outlook Express 6 (OE6) for Win7/Win8/Win10

英文版 Outlook Express6.0, 兼容Win7/Win10/WinXP,解压就可用。

【深度学习】计算机视觉(CV)-图像分类-ResNet(Residual Network,残差网络)

ResNet(Residual Network,残差网络)是一种深度卷积神经网络(CNN)架构,由 何恺明(Kaiming He)等人 在 2015 年提出,最初用于 ImageNet 竞赛,并在分类任务上取得了 冠军。ResNet 的核心思想是残差学习(Residual Learning),它通过跳跃连接(Skip Connections) 解决了深度神经网络训练中的梯度消失和梯度爆炸问题,使得非常深的网络(如 50 层、101 层甚至 152 层)仍能有效训练。

IT古董 2963

深度学习剖根问题:梯度消失/爆炸

一、梯度消失/梯度爆炸的问题首先来说说梯度消失问题产生的原因吧,虽然是已经被各大牛说烂的东西。不如先看一个简单的网络结构, 可以看到,如果输出层的值仅是输入层的值与权值矩阵W的线性组合,那么最终网络最终的输出会变成输入数据的线性组合。这样很明显没有办法模拟出非线性的情况。记得神经网络是可以拟合任意函数的。好了,既然需要非线性函数,那干脆加上非线性变换就好了。一般会使用sigmoid函数,得到,这个...

BigCowPeking 1575

DeepStack源码解析:揭秘边缘AI引擎的核心架构与实现原理

DeepStack作为全球领先的跨平台边缘AI引擎,专为边缘设备设计,能够在资源受限的环境中高效运行多种AI任务。本文将深入剖析DeepStack的核心架构与实现原理,帮助开发者理解其内部工作机制,从而更好地应用和扩展这一强大的边缘AI工具。 ## 一、整体架构概览 DeepStack的架构采用了分层设计,主要包含应用层、智能层和平台层三个部分。这种架构设计使得DeepStack能够在不同的硬

gitblog_00032的博客 686
上一篇: 【Faster RCNN】Faster R-CNN笔记
下一篇: 【ResNet】Deep Residual Learning for Image Recognition笔记
One__Coder
博客等级 码龄10年 59粉丝 55原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值