YOLOv7目标检测-网络结构1-网络结构配置文件解读

models/yolo.py

打开models文件夹,
yolo.py文件夹中是核心的大组件,common.py中是小的组件。
结合cfg/training当中的yolov7.yaml配置文件看网络结构。

    def forward_once(self, x, profile=False):
        y, dt = [], []  # outputs
        for m in self.model:    # model是根据配置文件生成的,m就是走每一层
            if m.f != -1:  # if not from previous layer
                x = y[m.f] if isinstance(m.f, int) else [x if j == -1 else y[j] for j in m.f]  # from earlier layers

            if not hasattr(self, 'traced'):
                self.traced=False

            if self.traced:
                if isinstance(m, Detect) or isinstance(m, IDetect) or isinstance(m, IAuxDetect) or isinstance(m, IKeypoint):
                    break

            if profile:
                c = isinstance(m, (Detect, IDetect, IAuxDetect, IBin))
                o = thop.profile(m, inputs=(x.copy() if c else x,), verbose=False)[0] / 1E9 * 2 if thop else 0  # FLOPS
                for _ in range(10):
                    m(x.copy() if c else x)
                t = time_synchronized()
                for _ in range(10):
                    m(x.copy() if c else x)
                dt.append((time_synchronized() - t) * 100)
                print('%10.1f%10.0f%10.1fms %-40s' % (o, m.np, dt[-1], m.type))

            x = m(x)  # run,x得到的特征图
            
            y.append(x if m.i in self.save else None)  # save output

        if profile:
            print('%.1fms total' % sum(dt))
        return x

yolov7.yaml配置文件

结合cfg/training当中的yolov7.yaml配置文件看网络结构。
首先是backbone提取特征的模块,head是输出的模块。

from指的是前面接哪一层,这一层的输入是第多少层的输出,-1表示上一层,-2表示上两层。
number指这一层重复几次。
module该模块做什么。
args参数中是特征图的个数,卷积大小,stride步长。
p几相当于在下采样过程中特征图是原来的几分之一。
并且注释了层数。
在这里插入图片描述
在这里插入图片描述
第一列75、88、101指的是第75、88、101层。

concat拼接层
在这里插入图片描述

在这里插入图片描述

  • 3
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值