欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

一些测试结果

程序员文章站 2024-03-17 11:29:04
...
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from layers import *
from data import voc, coco
import torchvision
import os
# ssd.py
cfg = [256, 'S', 512, 128, 'S', 256, 128, 256, 128, 256]
flag = False
layers=[]
in_channels=1024
for k, v in enumerate(cfg):
    print(k,v)
    if in_channels != 'S':
        if v == 'S':
            layers += [nn.Conv2d(in_channels=in_channels, out_channels=cfg[k+1],
                                    kernel_size=(1, 3)[flag], stride=2, padding=1)]
        else:
            layers += [nn.Conv2d(in_channels=in_channels, out_channels=v,
                                    kernel_size=(1, 3)[flag])]
        flag = not flag
        in_channels = v
        print(v)
        print(layers)

一些测试结果

这样基本明白这个模块的作用。但是不知道为什么到第三个卷积层就中断循环?

相关标签: SSD