Yolov5 Detect 的前向传播过程

2023-12-22 19:01
文章标签 过程 yolov5 传播 detect

本文主要是介绍Yolov5 Detect 的前向传播过程,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

目录

模型的搭建过程

数据的导入过程

数据的前向推理过程

Detect中的处理过程

 网络结构


模型的搭建过程

其实都在训练好的pt文件中加载进来的。所以推理时没有搭建整个网络的类实例对象过程,但是相应的模块的类的定义都在common.py文件中定义的,包括各个模块的结构,前向传播过程。

。pt文件中还包含了数据应有的类别标签信息

model = DetectMultiBackend(weights, device=device, dnn=dnn, data=data, fp16=half)
1. model = attempt_load(weights if isinstance(weights, list) else w, device=device, inplace=True, fuse=fuse)    # common.py--356
2. model = Ensemble()   #  experiments.py--77  nn.ModuleList对象
3. ckpt = torch.load(attempt_download(w), map_location='cpu')   # 从pt加载模型本身,注意ckpt是 DetectionModel 类对象
4. model.append(ckpt.fuse().eval() if fuse and hasattr(ckpt, 'fuse') else ckpt.eval())  # model in eval mode  主要是将训练时得到的模型中 Conv2d 和 Bn 层混合到了一起

可以结合着后面末尾打印的网络结构参数,各个基本模块的构成以及前向传播流程如下所示

基本模块整合完毕后,可以结合下面的 前向推理过程 推导出整个模型的结构,并且self.add=True

数据的导入过程

YOLOv5 image/video dataloader, i.e. `python detect.py --source image.jpg/vid.mp4`

图片和视频都能处理。将图片和视频放在同一路径下它也能自动处理。

dataset = LoadImages(source, img_size=imgsz, stride=stride, auto=pt, vid_stride=vid_stride)  #  detect.py -- 115

LoadImages单独定义的类对象,没有继承任何父类。最终加载输入图片。

数据的前向推理过程

1. pred = model(im, augment=augment, visualize=visualize)  # detect.py -- 132
2. y = self.model(im, augment=augment, visualize=visualize) if augment or visualize else self.model(im)  # common.py--527
3. return self._forward_once(x, profile, visualize)  # yolo.py--209

前向推理

 def _forward_once(self, x, profile=False, visualize=False):y, dt = [], []  # outputsfor m in self.model:if m.f != -1:  # if not from previous layerprint('number{}, m.f is {}'.format(m.i, m.f))x = y[m.f] if isinstance(m.f, int) else [x if j == -1 else y[j] for j in m.f]  # from earlier layersif profile:self._profile_one_layer(m, x, dt)x = m(x)  # runy.append(x if m.i in self.save else None)  # save outputif visualize:feature_visualization(x, m.type, m.i, save_dir=visualize)return x  # to --209

 打印m.f!=-1时的情况,如下所示

number12, m.f is [-1, 6]
number16, m.f is [-1, 4]
number19, m.f is [-1, 14]
number22, m.f is [-1, 10]
number24, m.f is [17, 20, 23]

其中number 是 该模块的序号,对应打印的网络结构中的括号中的序号(0)~(24),总体的流程为

Detect中的处理过程

 从上图中可以看到,送入Detect头中的输入包含3个尺度。yolov5是基于anchor的检测器,它事先对锚框设定了一些参数,在yaml文件中

anchors:- [10,13, 16,30, 33,23]  # P3/8- [30,61, 62,45, 59,119]  # P4/16- [116,90, 156,198, 373,326]  # P5/32

 上述的锚框是在输入的尺度下的锚框的参数设定,映射到特征图上的参数设定需要除以各个尺度下的步长,其中的参数每一对为anchor的w和h。

tensor([[[ 1.25000,  1.62500],  # 例如 10/8, 13/8[ 2.00000,  3.75000],  # 16/8  , 30/8[ 4.12500,  2.87500]],[[ 1.87500,  3.81250],[ 3.87500,  2.81250],[ 3.68750,  7.43750]],[[ 3.62500,  2.81250],[ 4.87500,  6.18750],[11.65625, 10.18750]]])
    def _make_grid(self, nx=20, ny=20, i=0, torch_1_10=check_version(torch.__version__, '1.10.0')):d = self.anchors[i].devicet = self.anchors[i].dtypeshape = 1, self.na, ny, nx, 2  # grid shape  (1,3,4,4,2)y, x = torch.arange(ny, device=d, dtype=t), torch.arange(nx, device=d, dtype=t)  # [0,1,2,3]yv, xv = torch.meshgrid(y, x, indexing='ij') if torch_1_10 else torch.meshgrid(y, x)  # torch>=0.7 compatibilitygrid = torch.stack((xv, yv), 2).expand(shape) - 0.5  # add grid offset, i.e. y = 2.0 * x - 0.5  anchor 的中心点坐标,加补偿了anchor_grid = (self.anchors[i] * self.stride[i]).view((1, self.na, 1, 1, 2)).expand(shape)  # (1,3,4,4,2)return grid, anchor_grid

 Detect每一个尺度的输出经过sigmoid映射到0~1.其中的远离参考这里

xy, wh, conf = x[i].sigmoid().split((2, 2, self.nc + 1), 4)  # 按第4通道划分 (1,3,4,4,2) (1,3,4,4,2) (1,3,4,4,81)
xy = (xy * 2 + self.grid[i]) * self.stride[i]  # xy
wh = (wh * 2) ** 2 * self.anchor_grid[i]  # wh
y = torch.cat((xy, wh, conf), 4)

根据上式,逆推标签与groundTruth的关系,为

\frac{​{​{X_g}{Y_g} - {X_a}{Y_a}}}{2} = {X_l}{Y_l}

\frac{1}{2}\sqrt {\frac{​{​{W_g}{H_g}}}{​{​{W_a}{H_a}}}} = {W_l}{H_l}

至此 ,最终的返回值为

return x if self.training else (torch.cat(z, 1), ) if self.export else (torch.cat(z, 1), x)  # yolo.py--79

 这里的 self.export=False,所以返回

(torch.cat(z, 1), x)

得到预测后,经NMS处理,筛选过程

1、 根据置信度阈值筛选, 即可能是包围目标的矩形框  xc = prediction[..., 4] > conf_thres  # candidates  挑选置信度大于阈值的x = x[xc[xi]]
2、 计算新的用来比较的分类得分  x[:, 5:] *= x[:, 4:5]  # conf = obj_conf * cls_conf
3、 预测的候选框坐标转换成角坐标形式box = xywh2xyxy(x[:, :4])  # center_x, center_y, width, height) to (x1, y1, x2, y2)
4、 对之前按置信度筛选后的,拿出每个目标的分类得分最大值的索引,即每个目标的类别conf, j = x[:, 5:mi].max(1, keepdim=True)
5、 矩形框角坐标,分类得分最大值,类别序号拼接一起,并挑选分类得分大于阈值的x = torch.cat((box, conf, j.float(), mask), 1)[conf.view(-1) > conf_thres]
6、 按分类得分排序x = x[x[:, 4].argsort(descending=True)[:max_nms]]
7、 按不同的类别根据IoU进行筛选,先把box按不同的类别映射到不同的尺度范围c = x[:, 5:6] * (0 if agnostic else max_wh)  # classesboxes, scores = x[:, :4] + c, x[:, 4]  # boxes (offset by class), scores
8、 进行NMSi = torchvision.ops.nms(boxes, scores, iou_thres)  # NMS
9、 返回最终的预测结果output[xi] = x[i]  #  (n, 6)  n为目标数, 6 为步骤5中的拼接

接下来就是在原图上标注预测结果,以及保存结果。

 网络结构

DetectionModel((model): Sequential((0): Conv((conv): Conv2d(3, 80, kernel_size=(6, 6), stride=(2, 2), padding=(2, 2))(act): SiLU(inplace=True))(1): Conv((conv): Conv2d(80, 160, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1))(act): SiLU(inplace=True))(2): C3((cv1): Conv((conv): Conv2d(160, 80, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(160, 80, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(cv3): Conv((conv): Conv2d(160, 160, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(m): Sequential((0): Bottleneck((cv1): Conv((conv): Conv2d(80, 80, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(80, 80, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))(act): SiLU(inplace=True)))(1): Bottleneck((cv1): Conv((conv): Conv2d(80, 80, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(80, 80, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))(act): SiLU(inplace=True)))(2): Bottleneck((cv1): Conv((conv): Conv2d(80, 80, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(80, 80, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))(act): SiLU(inplace=True)))(3): Bottleneck((cv1): Conv((conv): Conv2d(80, 80, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(80, 80, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))(act): SiLU(inplace=True)))))(3): Conv((conv): Conv2d(160, 320, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1))(act): SiLU(inplace=True))(4): C3((cv1): Conv((conv): Conv2d(320, 160, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(320, 160, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(cv3): Conv((conv): Conv2d(320, 320, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(m): Sequential((0): Bottleneck((cv1): Conv((conv): Conv2d(160, 160, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(160, 160, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))(act): SiLU(inplace=True)))(1): Bottleneck((cv1): Conv((conv): Conv2d(160, 160, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(160, 160, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))(act): SiLU(inplace=True)))(2): Bottleneck((cv1): Conv((conv): Conv2d(160, 160, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(160, 160, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))(act): SiLU(inplace=True)))(3): Bottleneck((cv1): Conv((conv): Conv2d(160, 160, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(160, 160, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))(act): SiLU(inplace=True)))(4): Bottleneck((cv1): Conv((conv): Conv2d(160, 160, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(160, 160, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))(act): SiLU(inplace=True)))(5): Bottleneck((cv1): Conv((conv): Conv2d(160, 160, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(160, 160, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))(act): SiLU(inplace=True)))(6): Bottleneck((cv1): Conv((conv): Conv2d(160, 160, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(160, 160, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))(act): SiLU(inplace=True)))(7): Bottleneck((cv1): Conv((conv): Conv2d(160, 160, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(160, 160, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))(act): SiLU(inplace=True)))))(5): Conv((conv): Conv2d(320, 640, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1))(act): SiLU(inplace=True))(6): C3((cv1): Conv((conv): Conv2d(640, 320, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(640, 320, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(cv3): Conv((conv): Conv2d(640, 640, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(m): Sequential((0): Bottleneck((cv1): Conv((conv): Conv2d(320, 320, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(320, 320, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))(act): SiLU(inplace=True)))(1): Bottleneck((cv1): Conv((conv): Conv2d(320, 320, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(320, 320, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))(act): SiLU(inplace=True)))(2): Bottleneck((cv1): Conv((conv): Conv2d(320, 320, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(320, 320, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))(act): SiLU(inplace=True)))(3): Bottleneck((cv1): Conv((conv): Conv2d(320, 320, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(320, 320, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))(act): SiLU(inplace=True)))(4): Bottleneck((cv1): Conv((conv): Conv2d(320, 320, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(320, 320, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))(act): SiLU(inplace=True)))(5): Bottleneck((cv1): Conv((conv): Conv2d(320, 320, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(320, 320, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))(act): SiLU(inplace=True)))(6): Bottleneck((cv1): Conv((conv): Conv2d(320, 320, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(320, 320, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))(act): SiLU(inplace=True)))(7): Bottleneck((cv1): Conv((conv): Conv2d(320, 320, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(320, 320, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))(act): SiLU(inplace=True)))(8): Bottleneck((cv1): Conv((conv): Conv2d(320, 320, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(320, 320, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))(act): SiLU(inplace=True)))(9): Bottleneck((cv1): Conv((conv): Conv2d(320, 320, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(320, 320, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))(act): SiLU(inplace=True)))(10): Bottleneck((cv1): Conv((conv): Conv2d(320, 320, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(320, 320, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))(act): SiLU(inplace=True)))(11): Bottleneck((cv1): Conv((conv): Conv2d(320, 320, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(320, 320, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))(act): SiLU(inplace=True)))))(7): Conv((conv): Conv2d(640, 1280, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1))(act): SiLU(inplace=True))(8): C3((cv1): Conv((conv): Conv2d(1280, 640, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(1280, 640, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(cv3): Conv((conv): Conv2d(1280, 1280, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(m): Sequential((0): Bottleneck((cv1): Conv((conv): Conv2d(640, 640, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(640, 640, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))(act): SiLU(inplace=True)))(1): Bottleneck((cv1): Conv((conv): Conv2d(640, 640, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(640, 640, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))(act): SiLU(inplace=True)))(2): Bottleneck((cv1): Conv((conv): Conv2d(640, 640, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(640, 640, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))(act): SiLU(inplace=True)))(3): Bottleneck((cv1): Conv((conv): Conv2d(640, 640, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(640, 640, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))(act): SiLU(inplace=True)))))(9): SPPF((cv1): Conv((conv): Conv2d(1280, 640, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(2560, 1280, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(m): MaxPool2d(kernel_size=5, stride=1, padding=2, dilation=1, ceil_mode=False))(10): Conv((conv): Conv2d(1280, 640, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(11): Upsample(scale_factor=2.0, mode='nearest')(12): Concat()(13): C3((cv1): Conv((conv): Conv2d(1280, 320, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(1280, 320, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(cv3): Conv((conv): Conv2d(640, 640, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(m): Sequential((0): Bottleneck((cv1): Conv((conv): Conv2d(320, 320, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(320, 320, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))(act): SiLU(inplace=True)))(1): Bottleneck((cv1): Conv((conv): Conv2d(320, 320, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(320, 320, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))(act): SiLU(inplace=True)))(2): Bottleneck((cv1): Conv((conv): Conv2d(320, 320, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(320, 320, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))(act): SiLU(inplace=True)))(3): Bottleneck((cv1): Conv((conv): Conv2d(320, 320, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(320, 320, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))(act): SiLU(inplace=True)))))(14): Conv((conv): Conv2d(640, 320, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(15): Upsample(scale_factor=2.0, mode='nearest')(16): Concat()(17): C3((cv1): Conv((conv): Conv2d(640, 160, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(640, 160, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(cv3): Conv((conv): Conv2d(320, 320, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(m): Sequential((0): Bottleneck((cv1): Conv((conv): Conv2d(160, 160, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(160, 160, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))(act): SiLU(inplace=True)))(1): Bottleneck((cv1): Conv((conv): Conv2d(160, 160, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(160, 160, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))(act): SiLU(inplace=True)))(2): Bottleneck((cv1): Conv((conv): Conv2d(160, 160, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(160, 160, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))(act): SiLU(inplace=True)))(3): Bottleneck((cv1): Conv((conv): Conv2d(160, 160, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(160, 160, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))(act): SiLU(inplace=True)))))(18): Conv((conv): Conv2d(320, 320, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1))(act): SiLU(inplace=True))(19): Concat()(20): C3((cv1): Conv((conv): Conv2d(640, 320, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(640, 320, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(cv3): Conv((conv): Conv2d(640, 640, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(m): Sequential((0): Bottleneck((cv1): Conv((conv): Conv2d(320, 320, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(320, 320, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))(act): SiLU(inplace=True)))(1): Bottleneck((cv1): Conv((conv): Conv2d(320, 320, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(320, 320, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))(act): SiLU(inplace=True)))(2): Bottleneck((cv1): Conv((conv): Conv2d(320, 320, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(320, 320, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))(act): SiLU(inplace=True)))(3): Bottleneck((cv1): Conv((conv): Conv2d(320, 320, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(320, 320, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))(act): SiLU(inplace=True)))))(21): Conv((conv): Conv2d(640, 640, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1))(act): SiLU(inplace=True))(22): Concat()(23): C3((cv1): Conv((conv): Conv2d(1280, 640, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(1280, 640, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(cv3): Conv((conv): Conv2d(1280, 1280, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(m): Sequential((0): Bottleneck((cv1): Conv((conv): Conv2d(640, 640, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(640, 640, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))(act): SiLU(inplace=True)))(1): Bottleneck((cv1): Conv((conv): Conv2d(640, 640, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(640, 640, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))(act): SiLU(inplace=True)))(2): Bottleneck((cv1): Conv((conv): Conv2d(640, 640, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(640, 640, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))(act): SiLU(inplace=True)))(3): Bottleneck((cv1): Conv((conv): Conv2d(640, 640, kernel_size=(1, 1), stride=(1, 1))(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(640, 640, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))(act): SiLU(inplace=True)))))(24): Detect((m): ModuleList((0): Conv2d(320, 255, kernel_size=(1, 1), stride=(1, 1))(1): Conv2d(640, 255, kernel_size=(1, 1), stride=(1, 1))(2): Conv2d(1280, 255, kernel_size=(1, 1), stride=(1, 1)))))
)

ckpt中的内容

其中ckpt中的model

Sequential((0): Conv((conv): Conv2d(3, 80, kernel_size=(6, 6), stride=(2, 2), padding=(2, 2), bias=False)(bn): BatchNorm2d(80, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(1): Conv((conv): Conv2d(80, 160, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), bias=False)(bn): BatchNorm2d(160, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(2): C3((cv1): Conv((conv): Conv2d(160, 80, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(80, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(160, 80, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(80, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(cv3): Conv((conv): Conv2d(160, 160, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(160, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(m): Sequential((0): Bottleneck((cv1): Conv((conv): Conv2d(80, 80, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(80, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(80, 80, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)(bn): BatchNorm2d(80, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True)))(1): Bottleneck((cv1): Conv((conv): Conv2d(80, 80, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(80, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(80, 80, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)(bn): BatchNorm2d(80, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True)))(2): Bottleneck((cv1): Conv((conv): Conv2d(80, 80, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(80, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(80, 80, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)(bn): BatchNorm2d(80, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True)))(3): Bottleneck((cv1): Conv((conv): Conv2d(80, 80, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(80, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(80, 80, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)(bn): BatchNorm2d(80, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True)))))(3): Conv((conv): Conv2d(160, 320, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), bias=False)(bn): BatchNorm2d(320, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(4): C3((cv1): Conv((conv): Conv2d(320, 160, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(160, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(320, 160, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(160, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(cv3): Conv((conv): Conv2d(320, 320, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(320, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(m): Sequential((0): Bottleneck((cv1): Conv((conv): Conv2d(160, 160, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(160, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(160, 160, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)(bn): BatchNorm2d(160, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True)))(1): Bottleneck((cv1): Conv((conv): Conv2d(160, 160, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(160, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(160, 160, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)(bn): BatchNorm2d(160, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True)))(2): Bottleneck((cv1): Conv((conv): Conv2d(160, 160, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(160, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(160, 160, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)(bn): BatchNorm2d(160, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True)))(3): Bottleneck((cv1): Conv((conv): Conv2d(160, 160, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(160, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(160, 160, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)(bn): BatchNorm2d(160, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True)))(4): Bottleneck((cv1): Conv((conv): Conv2d(160, 160, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(160, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(160, 160, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)(bn): BatchNorm2d(160, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True)))(5): Bottleneck((cv1): Conv((conv): Conv2d(160, 160, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(160, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(160, 160, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)(bn): BatchNorm2d(160, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True)))(6): Bottleneck((cv1): Conv((conv): Conv2d(160, 160, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(160, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(160, 160, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)(bn): BatchNorm2d(160, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True)))(7): Bottleneck((cv1): Conv((conv): Conv2d(160, 160, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(160, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(160, 160, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)(bn): BatchNorm2d(160, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True)))))(5): Conv((conv): Conv2d(320, 640, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), bias=False)(bn): BatchNorm2d(640, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(6): C3((cv1): Conv((conv): Conv2d(640, 320, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(320, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(640, 320, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(320, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(cv3): Conv((conv): Conv2d(640, 640, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(640, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(m): Sequential((0): Bottleneck((cv1): Conv((conv): Conv2d(320, 320, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(320, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(320, 320, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)(bn): BatchNorm2d(320, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True)))(1): Bottleneck((cv1): Conv((conv): Conv2d(320, 320, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(320, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(320, 320, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)(bn): BatchNorm2d(320, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True)))(2): Bottleneck((cv1): Conv((conv): Conv2d(320, 320, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(320, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(320, 320, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)(bn): BatchNorm2d(320, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True)))(3): Bottleneck((cv1): Conv((conv): Conv2d(320, 320, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(320, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(320, 320, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)(bn): BatchNorm2d(320, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True)))(4): Bottleneck((cv1): Conv((conv): Conv2d(320, 320, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(320, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(320, 320, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)(bn): BatchNorm2d(320, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True)))(5): Bottleneck((cv1): Conv((conv): Conv2d(320, 320, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(320, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(320, 320, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)(bn): BatchNorm2d(320, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True)))(6): Bottleneck((cv1): Conv((conv): Conv2d(320, 320, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(320, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(320, 320, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)(bn): BatchNorm2d(320, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True)))(7): Bottleneck((cv1): Conv((conv): Conv2d(320, 320, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(320, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(320, 320, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)(bn): BatchNorm2d(320, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True)))(8): Bottleneck((cv1): Conv((conv): Conv2d(320, 320, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(320, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(320, 320, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)(bn): BatchNorm2d(320, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True)))(9): Bottleneck((cv1): Conv((conv): Conv2d(320, 320, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(320, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(320, 320, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)(bn): BatchNorm2d(320, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True)))(10): Bottleneck((cv1): Conv((conv): Conv2d(320, 320, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(320, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(320, 320, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)(bn): BatchNorm2d(320, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True)))(11): Bottleneck((cv1): Conv((conv): Conv2d(320, 320, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(320, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(320, 320, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)(bn): BatchNorm2d(320, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True)))))(7): Conv((conv): Conv2d(640, 1280, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), bias=False)(bn): BatchNorm2d(1280, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(8): C3((cv1): Conv((conv): Conv2d(1280, 640, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(640, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(1280, 640, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(640, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(cv3): Conv((conv): Conv2d(1280, 1280, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(1280, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(m): Sequential((0): Bottleneck((cv1): Conv((conv): Conv2d(640, 640, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(640, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(640, 640, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)(bn): BatchNorm2d(640, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True)))(1): Bottleneck((cv1): Conv((conv): Conv2d(640, 640, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(640, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(640, 640, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)(bn): BatchNorm2d(640, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True)))(2): Bottleneck((cv1): Conv((conv): Conv2d(640, 640, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(640, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(640, 640, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)(bn): BatchNorm2d(640, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True)))(3): Bottleneck((cv1): Conv((conv): Conv2d(640, 640, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(640, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(640, 640, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)(bn): BatchNorm2d(640, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True)))))(9): SPPF((cv1): Conv((conv): Conv2d(1280, 640, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(640, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(2560, 1280, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(1280, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(m): MaxPool2d(kernel_size=5, stride=1, padding=2, dilation=1, ceil_mode=False))(10): Conv((conv): Conv2d(1280, 640, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(640, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(11): Upsample(scale_factor=2.0, mode='nearest')(12): Concat()(13): C3((cv1): Conv((conv): Conv2d(1280, 320, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(320, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(1280, 320, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(320, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(cv3): Conv((conv): Conv2d(640, 640, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(640, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(m): Sequential((0): Bottleneck((cv1): Conv((conv): Conv2d(320, 320, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(320, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(320, 320, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)(bn): BatchNorm2d(320, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True)))(1): Bottleneck((cv1): Conv((conv): Conv2d(320, 320, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(320, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(320, 320, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)(bn): BatchNorm2d(320, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True)))(2): Bottleneck((cv1): Conv((conv): Conv2d(320, 320, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(320, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(320, 320, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)(bn): BatchNorm2d(320, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True)))(3): Bottleneck((cv1): Conv((conv): Conv2d(320, 320, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(320, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(320, 320, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)(bn): BatchNorm2d(320, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True)))))(14): Conv((conv): Conv2d(640, 320, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(320, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(15): Upsample(scale_factor=2.0, mode='nearest')(16): Concat()(17): C3((cv1): Conv((conv): Conv2d(640, 160, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(160, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(640, 160, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(160, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(cv3): Conv((conv): Conv2d(320, 320, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(320, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(m): Sequential((0): Bottleneck((cv1): Conv((conv): Conv2d(160, 160, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(160, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(160, 160, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)(bn): BatchNorm2d(160, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True)))(1): Bottleneck((cv1): Conv((conv): Conv2d(160, 160, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(160, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(160, 160, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)(bn): BatchNorm2d(160, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True)))(2): Bottleneck((cv1): Conv((conv): Conv2d(160, 160, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(160, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(160, 160, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)(bn): BatchNorm2d(160, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True)))(3): Bottleneck((cv1): Conv((conv): Conv2d(160, 160, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(160, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(160, 160, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)(bn): BatchNorm2d(160, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True)))))(18): Conv((conv): Conv2d(320, 320, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), bias=False)(bn): BatchNorm2d(320, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(19): Concat()(20): C3((cv1): Conv((conv): Conv2d(640, 320, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(320, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(640, 320, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(320, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(cv3): Conv((conv): Conv2d(640, 640, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(640, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(m): Sequential((0): Bottleneck((cv1): Conv((conv): Conv2d(320, 320, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(320, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(320, 320, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)(bn): BatchNorm2d(320, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True)))(1): Bottleneck((cv1): Conv((conv): Conv2d(320, 320, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(320, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(320, 320, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)(bn): BatchNorm2d(320, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True)))(2): Bottleneck((cv1): Conv((conv): Conv2d(320, 320, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(320, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(320, 320, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)(bn): BatchNorm2d(320, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True)))(3): Bottleneck((cv1): Conv((conv): Conv2d(320, 320, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(320, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(320, 320, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)(bn): BatchNorm2d(320, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True)))))(21): Conv((conv): Conv2d(640, 640, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), bias=False)(bn): BatchNorm2d(640, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(22): Concat()(23): C3((cv1): Conv((conv): Conv2d(1280, 640, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(640, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(1280, 640, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(640, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(cv3): Conv((conv): Conv2d(1280, 1280, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(1280, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(m): Sequential((0): Bottleneck((cv1): Conv((conv): Conv2d(640, 640, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(640, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(640, 640, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)(bn): BatchNorm2d(640, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True)))(1): Bottleneck((cv1): Conv((conv): Conv2d(640, 640, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(640, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(640, 640, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)(bn): BatchNorm2d(640, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True)))(2): Bottleneck((cv1): Conv((conv): Conv2d(640, 640, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(640, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(640, 640, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)(bn): BatchNorm2d(640, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True)))(3): Bottleneck((cv1): Conv((conv): Conv2d(640, 640, kernel_size=(1, 1), stride=(1, 1), bias=False)(bn): BatchNorm2d(640, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True))(cv2): Conv((conv): Conv2d(640, 640, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)(bn): BatchNorm2d(640, eps=0.001, momentum=0.03, affine=True, track_running_stats=True)(act): SiLU(inplace=True)))))(24): Detect((m): ModuleList((0): Conv2d(320, 255, kernel_size=(1, 1), stride=(1, 1))(1): Conv2d(640, 255, kernel_size=(1, 1), stride=(1, 1))(2): Conv2d(1280, 255, kernel_size=(1, 1), stride=(1, 1))))
)

这篇关于Yolov5 Detect 的前向传播过程的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/525099

相关文章

浅析Spring Security认证过程

类图 为了方便理解Spring Security认证流程,特意画了如下的类图,包含相关的核心认证类 概述 核心验证器 AuthenticationManager 该对象提供了认证方法的入口,接收一个Authentiaton对象作为参数; public interface AuthenticationManager {Authentication authenticate(Authenti

作业提交过程之HDFSMapReduce

作业提交全过程详解 (1)作业提交 第1步:Client调用job.waitForCompletion方法,向整个集群提交MapReduce作业。 第2步:Client向RM申请一个作业id。 第3步:RM给Client返回该job资源的提交路径和作业id。 第4步:Client提交jar包、切片信息和配置文件到指定的资源提交路径。 第5步:Client提交完资源后,向RM申请运行MrAp

【机器学习】高斯过程的基本概念和应用领域以及在python中的实例

引言 高斯过程(Gaussian Process,简称GP)是一种概率模型,用于描述一组随机变量的联合概率分布,其中任何一个有限维度的子集都具有高斯分布 文章目录 引言一、高斯过程1.1 基本定义1.1.1 随机过程1.1.2 高斯分布 1.2 高斯过程的特性1.2.1 联合高斯性1.2.2 均值函数1.2.3 协方差函数(或核函数) 1.3 核函数1.4 高斯过程回归(Gauss

基于 YOLOv5 的积水检测系统:打造高效智能的智慧城市应用

在城市发展中,积水问题日益严重,特别是在大雨过后,积水往往会影响交通甚至威胁人们的安全。通过现代计算机视觉技术,我们能够智能化地检测和识别积水区域,减少潜在危险。本文将介绍如何使用 YOLOv5 和 PyQt5 搭建一个积水检测系统,结合深度学习和直观的图形界面,为用户提供高效的解决方案。 源码地址: PyQt5+YoloV5 实现积水检测系统 预览: 项目背景

Solr 使用Facet分组过程中与分词的矛盾解决办法

对于一般查询而言  ,  分词和存储都是必要的  .  比如  CPU  类型  ”Intel  酷睿  2  双核  P7570”,  拆分成  ”Intel”,”  酷睿  ”,”P7570”  这样一些关键字并分别索引  ,  可能提供更好的搜索体验  .  但是如果将  CPU  作为 Facet  字段  ,  最好不进行分词  .  这样就造成了矛盾  ,  解决方法

Python:豆瓣电影商业数据分析-爬取全数据【附带爬虫豆瓣,数据处理过程,数据分析,可视化,以及完整PPT报告】

**爬取豆瓣电影信息,分析近年电影行业的发展情况** 本文是完整的数据分析展现,代码有完整版,包含豆瓣电影爬取的具体方式【附带爬虫豆瓣,数据处理过程,数据分析,可视化,以及完整PPT报告】   最近MBA在学习《商业数据分析》,大实训作业给了数据要进行数据分析,所以先拿豆瓣电影练练手,网络上爬取豆瓣电影TOP250较多,但对于豆瓣电影全数据的爬取教程很少,所以我自己做一版。 目

用einsum实现MultiHeadAttention前向传播

einsum教程网站Einstein Summation in Numpy | Olexa Bilaniuk's IFT6266H16 Course Blog 编写训练模型 import tensorflow as tfclass Model(tf.keras.Model):def __init__(self, num_heads, model_dim):super().__init__

ORACLE语法-包(package)、存储过程(procedure)、游标(cursor)以及java对Result结果集的处理

陈科肇 示例: 包规范 CREATE OR REPLACE PACKAGE PACK_WMS_YX IS-- Author : CKZ-- Created : 2015/8/28 9:52:29-- Purpose : 同步数据-- Public type declarations,游标 退休订单TYPE retCursor IS REF CURSOR;-- RETURN vi_co_co

[yolov5] --- yolov5入门实战「土堆视频」

1 项目介绍及环境配置 下载yolov5 tags 5.0源码,https://github.com/ultralytics/yolov5/tree/v5.0,解压 Pycharm 中创建conda虚拟环境 激活conda虚拟环境 根据作者提供的requirements.txt文件,pip install -r requirements.txt 如果作者没有提供requirement.txt文件

OpenStack创建虚拟机过程

OpenStack创建虚拟机过程 一、在分析OpenStack创建虚拟机的过程之前,先来梳理一下需要用用到哪些组件。 二、每一步都需要去keystone去进行验证,下图有详细的流程。 登录界面或命令行通过RESTful API向keystone获取认证信息。keystone通过用户请求认证信息,并生成auth-token返回给对应的认证请求。界面或命令行通过RESTful API