def __init__(self, phase, base, extras, head, num_classes): super(SSD, self).__init__() self.phase = phase self.num_classes = num_classes # TODO: implement __call__ in PriorBox self.priorbox = PriorBox(v2) self.priors = Variable(self.priorbox.forward(), volatile=True) self.size = 512 # SSD network self.vgg = nn.ModuleList(base) # Layer learns to scale the l2 normalized features from conv4_3 self.L2Norm = L2Norm(512, 20) self.extras = nn.ModuleList(extras) # fused conv4_3 and conv5_3 self.conv3_3 = nn.Conv2d(256, 256, 3, 1, 1) self.conv4_3 = nn.Conv2d(512, 512, 3, 1, 1) self.deconv = nn.ConvTranspose2d(512, 512, 2, 2) self.deconv2 = nn.ConvTranspose2d(512, 256, 2, 2) self.conv5_3 = nn.Conv2d(512, 512, 3, 1, 1) self.L2Norm5_3 = L2Norm(512, 10) self.L2Norm3_3 = L2Norm(256, 20) self.loc = nn.ModuleList(head[0]) self.conf = nn.ModuleList(head[1]) if self.phase == 'test': self.softmax = nn.Softmax() self.detect = Detect(num_classes, 0, 300, 0.01, 0.45)
def __init__(self, phase, size, num_classes): super(S3FD, self).__init__() self.phase = phase self.num_classes = num_classes self.size = size vgg_cfg = [ 64, 64, 'M', 128, 128, 'M', 256, 256, 256, 'C', 512, 512, 512, 'M', 512, 512, 512 ] self.vgg = nn.ModuleList(vgg(vgg_cfg, 3)) extras_cfg = [256, 'S', 512, 128, 'S', 256] self.extras = nn.ModuleList(add_extras(extras_cfg, 1024)) self.conv3_3_L2Norm = L2Norm(256, 10) self.conv4_3_L2Norm = L2Norm(512, 8) self.conv5_3_L2Norm = L2Norm(512, 5) self.loc, self.conf = self.multibox(self.num_classes) if self.phase == 'test': self.softmax = nn.Softmax(dim=-1) if self.phase == 'train': for m in self.modules(): if isinstance(m, nn.Conv2d): if m.bias is not None: nn.init.xavier_normal_(m.weight.data) m.bias.data.fill_(0.02) else: m.weight.data.normal_(0, 0.01) elif isinstance(m, nn.BatchNorm2d): m.weight.data.fill_(1) m.bias.data.zero_()
def __init__(self, phase, base, head, num_classes): super(MSC, self).__init__() self.phase = phase self.num_classes = num_classes self.priorbox = PriorBox(v2) self.priors = Variable(self.priorbox.forward(), volatile=True) self.size = 512 self.vgg = nn.ModuleList(base) self.L2Norm4_3 = L2Norm(512, 20) self.L2Norm5_3 = L2Norm(512, 10) self.deconv7 = nn.ConvTranspose2d(2048, 2048, 2, 2) self.deconv6 = nn.ConvTranspose2d(2048, 512, 2, 2) self.deconv5 = nn.ConvTranspose2d(512, 512, 2, 2) self.conv_fc6 = nn.Conv2d(2048, 2048, 3, 1, 1) self.conv5_3 = nn.Conv2d(512, 512, 3, 1, 1) self.conv4_3 = nn.Conv2d(512, 512, 3, 1, 1) self.loc = nn.ModuleList(head[0]) self.conf = nn.ModuleList(head[1]) if self.phase == 'test': self.softmax = nn.Softmax() self.detect = Detect(num_classes, 0, 300, 0.01, 0.45)
def __init__(self, phase, base, extras, head, num_classes): super(SSD, self).__init__() self.phase = phase self.num_classes = num_classes # TODO: implement __call__ in PriorBox self.priorbox = PriorBox(v2) # PyTorch 1.5.1 # self.priors = Variable(self.priorbox.forward(), volatile=True) self.priors = self.priorbox.forward() self.size = 300 # SSD network self.vgg = nn.ModuleList(base) # Layer learns to scale the l2 normalized features from conv4_3 self.L2Norm = L2Norm(512, 20) self.extras = nn.ModuleList(extras) self.loc = nn.ModuleList(head[0]) self.conf = nn.ModuleList(head[1]) if phase == 'test': # PyTorch 1.5.1 # self.softmax = nn.Softmax() # self.detect = Detect(num_classes, 0, 200, 0.01, 0.45) self.softmax = nn.Softmax(dim=-1) self.detect = Detect()
def __init__(self, phase, size, base, extras, head, num_classes): super(SSD, self).__init__() self.phase = phase self.num_classes = num_classes self.cfg = { 'num_classes': 21, 'lr_steps': (80000, 100000, 120000), 'max_iter': 120000, 'feature_maps': [38, 19, 10, 5, 3, 1], 'min_dim': 300, 'steps': [8, 16, 32, 64, 100, 300], 'min_sizes': [30, 60, 111, 162, 213, 264], 'max_sizes': [60, 111, 162, 213, 264, 315], 'aspect_ratios': [[2], [2, 3], [2, 3], [2, 3], [2], [2]], 'variance': [0.1, 0.2], 'clip': True, 'name': 'VOC', } self.priorbox = PriorBox(self.cfg) with torch.no_grad(): self.priors = Variable(self.priorbox.forward()) self.size = size # SSD network self.vgg = nn.ModuleList(base) self.L2Norm = L2Norm(512, 20) self.extras = nn.ModuleList(extras) self.loc = nn.ModuleList(head[0]) self.conf = nn.ModuleList(head[1]) if phase == 'test': self.softmax = nn.Softmax(dim=-1) self.detect = Detect(num_classes, 0, 200, 0.01, 0.45)
def __init__(self, phase, size, num_classes): super(S3FD_FairNAS_B, self).__init__() self.phase = phase self.num_classes = num_classes self.size = size self.base_net = FairNasB().features self.source_layer_indexes = [ GraphPath(8, 'conv', 3), GraphPath(16, 'conv', 3), 22, ] # print(self.base_net) self.extras = nn.ModuleList([ InvertedResidual(1280, 512, stride=2, expand_ratio=0.2), InvertedResidual(512, 256, stride=2, expand_ratio=0.25), InvertedResidual(256, 256, stride=2, expand_ratio=0.5) ]) # self.expand = InvertedResidual(120, 192, stride=1, expand_ratio=1) self.conv3_3_L2Norm = L2Norm(120, 10) self.conv4_3_L2Norm = L2Norm(576, 8) self.conv5_3_L2Norm = L2Norm(1280, 5) self.loc, self.conf = self.multibox(self.num_classes) if self.phase == 'test': self.softmax = nn.Softmax(dim=-1) if self.phase == 'train': for m in self.modules(): if isinstance(m, nn.Conv2d): if m.bias is not None: nn.init.xavier_normal_(m.weight.data) m.bias.data.fill_(0.02) else: m.weight.data.normal_(0, 0.01) elif isinstance(m, nn.BatchNorm2d): m.weight.data.fill_(1) m.bias.data.zero_()
def __init__(self, phase, size, num_classes): super().__init__() self.fo = 64 self.fi = 512 self.arch = 'resnet18' self.phase = phase self.num_classes = num_classes self.base = getattr(models, self.arch)(pretrained=False) self.featuremap = nn.ModuleList([ self.base.layer2, self.base.layer3, self.base.layer4, self.base._make_layer(BasicBlock, self.fi, self.fo, stride=2), self.base._make_layer(BasicBlock, self.fo, self.fo, stride=2), self.base._make_layer(BasicBlock, self.fo, self.fo, stride=2) ]) self.conv2_2_L2Norm = L2Norm(128, 10) self.conv3_2_L2Norm = L2Norm(256, 8) self.conv4_2_L2Norm = L2Norm(512, 5) self.loc, self.conf = self.multibox(self.num_classes) if self.phase == 'test': self.softmax = nn.Softmax(dim=-1) # we load pretrained model from outside if self.phase == 'train': for m in self.modules(): if isinstance(m, nn.Conv2d): if m.bias is not None: nn.init.xavier_normal_(m.weight.data) m.bias.data.fill_(0.02) else: m.weight.data.normal_(0, 0.01) elif isinstance(m, nn.BatchNorm2d): m.weight.data.fill_(1) m.bias.data.zero_()
def __init__(self, phase, size, base, extras, head, num_classes): super(SSD, self).__init__() self.phase = phase self.num_classes = num_classes self.cfg = VOC_300_1 self.priorbox = PriorBox(self.cfg) self.priors = Variable(self.priorbox.forward(), volatile=True) self.size = size # SSD network self.vgg = nn.ModuleList(base) # Layer learns to scale the l2 normalized features from conv4_3 self.L2Norm = L2Norm(512, 20) self.extras = nn.ModuleList(extras) self.loc = nn.ModuleList(head[0]) self.conf = nn.ModuleList(head[1]) if phase == 'test': self.softmax = nn.Softmax()
def __init__(self, base, extras, head, num_classes, ver): super(Sph_SSD, self).__init__() self.num_classes = num_classes # TODO: implement __call__ in PriorBox self.priorbox = SphPriorBox(ver) with torch.no_grad(): self.priors = self.priorbox.forward().cuda() self.num_priors = self.priors.size(0) self.size = 512 # SSD network self.vgg = nn.ModuleList(base) # Layer learns to scale the l2 normalized features from conv4_3 self.L2Norm = L2Norm(512, 20) self.extras = nn.ModuleList(extras) self.loc = nn.ModuleList(head[0]) self.conf = nn.ModuleList(head[1]) self.softmax = nn.Softmax(dim=1).cuda()
def __init__(self, phase, size, base, extras, head, num_classes): super(SSD, self).__init__() self.phase = phase self.num_classes = num_classes self.cfg = voc # (coco, voc)[num_classes == 21] self.priorbox = PriorBox(self.cfg) self.priors = self.priorbox.forward( ) # Generate default boxes (anchors) self.size = size # SSD network self.vgg = nn.ModuleList(base) # Layer learns to scale the l2 normalized features from conv4_3 self.L2Norm = L2Norm(512, 20) self.extras = nn.ModuleList(extras) self.loc = nn.ModuleList(head[0]) self.conf = nn.ModuleList(head[1]) if phase == 'test': self.softmax = nn.Softmax(dim=-1) self.detect = Detect(num_classes, 0, 200, 0.01, 0.45)
def __init__(self, opts, phase, num_classes, base, extras, head): super(SSD, self).__init__() self.opts = opts self.phase = phase self.num_classes = num_classes self.priorbox = PriorBox(opts.prior_config, opts.ssd_dim) # for ssd300, priors: [8732 x 4] boxes/anchors self.priors = Variable(self.priorbox.forward(), volatile=True) # SSD network self.vgg = nn.ModuleList(base) # Layer learns to scale the l2 normalized features from conv4_3 self.L2Norm = L2Norm(512, 20) self.extras = nn.ModuleList(extras) self.loc = nn.ModuleList(head[0]) self.conf = nn.ModuleList(head[1]) if phase == 'test': self.softmax = nn.Softmax() # num_classes, bkg_label, top_k, conf_thresh, nms_thresh self.detect = Detect(num_classes, 0, opts.top_k, opts.conf_thresh, opts.nms_thresh, opts.soft_nms)
def __init__(self, phase, size, base, extras, head, num_classes,resnet18): super(SSD, self).__init__() self.phase = phase self.num_classes = num_classes self.cfg = VOC_300_2 # self.priorbox = PriorBox(self.cfg) # self.priors = Variable(self.priorbox.forward(), volatile=True) self.size = size self.conv1 = resnet18.conv1 self.bn1 = resnet18.bn1 self.relu = resnet18.relu self.maxpool = resnet18.maxpool self.layer1 = resnet18.layer1 self.layer2 = resnet18.layer2 self.layer3 = resnet18.layer3 self.layer4 = resnet18.layer4 # self.vgg = nn.ModuleList(base) # Layer learns to scale the l2 normalized features from conv4_3 self.L2Norm = L2Norm(256, 20) self.L2Norm2 = L2Norm(512, 20) self.upsample_300_10_19 = torch.nn.UpsamplingBilinear2d(size=(19,19)) self.upsample_300_3_5 = torch.nn.UpsamplingBilinear2d(size=(5,5)) self.upsample_512_16_32= torch.nn.UpsamplingBilinear2d(size=(32,32)) self.upsample_512_4_8 = torch.nn.UpsamplingBilinear2d(size=(8,8)) self.upsample_512_4_6 = torch.nn.UpsamplingBilinear2d(size=(6,6)) self.vgg1 = nn.ModuleList(base[0]) self.vgg2 = nn.ModuleList(base[1]) #self.vgg3 = nn.ModuleList(base[2]) #self.vgg4 = nn.ModuleList(base[3]) self.vgg5 = nn.ModuleList(base[4]) self.vgg6 = nn.ModuleList(base[5]) self.vgg7 = nn.ModuleList(base[6]) self.vgg8 = nn.ModuleList(base[7]) self.de1 = nn.ModuleList(base[8]) self.de2 = nn.ModuleList(base[9]) self.de3 = nn.ModuleList(base[10]) self.de4 = nn.ModuleList(base[11]) self.d19sample1 = nn.Sequential( nn.Conv2d(1024, 64, kernel_size=1, stride=1, bias=False), nn.BatchNorm2d(64), nn.ReLU(inplace=True)) self.d19sample2 = nn.Sequential( nn.Conv2d(1024, 64, kernel_size=1, stride=2, bias=False), nn.BatchNorm2d(64), nn.ReLU(inplace=True)) self.d19sample3 = nn.Sequential( nn.Conv2d(1024, 64, kernel_size=2, stride=4, bias=False), nn.BatchNorm2d(64), nn.ReLU(inplace=True)) self.ds38_19 = nn.Sequential( nn.Conv2d(512, 128, kernel_size=(1, 1), stride=2), nn.BatchNorm2d(128), nn.ReLU(inplace=True)) self.ds19_10 = nn.Sequential( nn.Conv2d(1024, 128, kernel_size=(1, 1), stride=2), nn.BatchNorm2d(128), nn.ReLU(inplace=True)) self.ds10_5 = nn.Sequential( nn.Conv2d(512, 128, kernel_size=(1, 1), stride=2), nn.BatchNorm2d(128), nn.ReLU(inplace=True)) self.ds5_3 = nn.Sequential( nn.Conv2d(512, 128, kernel_size=(1, 1), stride=2), nn.BatchNorm2d(128), nn.ReLU(inplace=True)) ''' self.de5_19 = nn.Sequential( nn.ConvTranspose2d(512, 512, kernel_size=3, stride=4, padding=0, output_padding=0), nn.BatchNorm2d(512), nn.Conv2d(512, 1024, kernel_size=(1, 1), stride=(1, 1)), nn.BatchNorm2d(1024), nn.ReLU(inplace=True)) self.de10_38 = nn.Sequential( nn.ConvTranspose2d(512, 256, kernel_size=3, stride=2, padding=1, output_padding=0), nn.BatchNorm2d(256), nn.ConvTranspose2d(256, 256, kernel_size=3, stride=2, padding=1, output_padding=1), nn.BatchNorm2d(256), nn.Conv2d(256, 128, kernel_size=(1, 1), stride=(1, 1)), nn.BatchNorm2d(128), nn.ReLU(inplace=True)) ''' self.extras = nn.ModuleList(extras) self.loc = nn.ModuleList(head[0]) self.conf = nn.ModuleList(head[1]) self.con_press38= nn.Sequential(nn.Conv2d(512, 128, kernel_size=(1, 1), stride=(1, 1)), nn.BatchNorm2d(128)) ''' self.con_press19 = nn.Sequential(nn.Conv2d(1024, 128, kernel_size=(1, 1), stride=(1, 1)), nn.BatchNorm2d(128)) self.con_press10 = nn.Sequential(nn.Conv2d(512, 128, kernel_size=(1, 1), stride=(1, 1)), nn.BatchNorm2d(128)) ''' if phase == 'test': self.softmax = nn.Softmax()
def __init__(self, phase, size, base, extras, head, num_classes, resnet18): super(SSD, self).__init__() self.phase = phase self.num_classes = num_classes self.cfg = VOC_300_2 self.priorbox = PriorBox(self.cfg) self.priors = Variable(self.priorbox.forward(), volatile=True) self.size = size self.conv1 = resnet18.conv1 self.bn1 = resnet18.bn1 self.relu = resnet18.relu self.maxpool = resnet18.maxpool self.layer1 = resnet18.layer1 self.layer2 = resnet18.layer2 self.layer3 = resnet18.layer3 self.layer4 = resnet18.layer4 # self.vgg = nn.ModuleList(base) # Layer learns to scale the l2 normalized features from conv4_3 self.L2Norm2 = L2Norm(512, 20) self.vgg1 = nn.ModuleList(base[0]) self.vgg2 = nn.ModuleList(base[1]) # self.vgg3 = nn.ModuleList(base[2]) # self.vgg4 = nn.ModuleList(base[3]) ''' self.de5_19 = nn.Sequential( nn.ConvTranspose2d(512, 512, kernel_size=3, stride=4, padding=0, output_padding=0), nn.BatchNorm2d(512), nn.Conv2d(512, 1024, kernel_size=(1, 1), stride=(1, 1)), nn.BatchNorm2d(1024), nn.ReLU(inplace=True)) self.de10_38 = nn.Sequential( nn.ConvTranspose2d(512, 256, kernel_size=3, stride=2, padding=1, output_padding=0), nn.BatchNorm2d(256), nn.ConvTranspose2d(256, 256, kernel_size=3, stride=2, padding=1, output_padding=1), nn.BatchNorm2d(256), nn.Conv2d(256, 128, kernel_size=(1, 1), stride=(1, 1)), nn.BatchNorm2d(128), nn.ReLU(inplace=True)) ''' self.extras = nn.ModuleList(extras) self.loc = nn.ModuleList(head[0]) self.conf = nn.ModuleList(head[1]) #self.con_press1 = nn.Conv2d(1024, 512, kernel_size=(1, 1), stride=(1, 1)) self.con_press2 = nn.Sequential(nn.Conv2d(2048, 256, kernel_size=(1, 1), stride=(1, 1)), nn.Conv2d(256, 512, kernel_size=(1, 1), stride=(1, 1)), nn.ReLU(inplace=True)) ''' self.con_press19 = nn.Sequential(nn.Conv2d(1024, 128, kernel_size=(1, 1), stride=(1, 1)), nn.BatchNorm2d(128)) self.con_press10 = nn.Sequential(nn.Conv2d(512, 128, kernel_size=(1, 1), stride=(1, 1)), nn.BatchNorm2d(128)) ''' if phase == 'test': self.softmax = nn.Softmax()
def __init__(self, phase, size, base, extras, head, num_classes): super(SSD, self).__init__() self.phase = phase self.num_classes = num_classes # TODO: implement __call__ in PriorBox self.priorbox = PriorBox(cfg["640_480_base512"]) self.priors = Variable(self.priorbox.forward(), volatile=True) self.size = size self.vgg = nn.ModuleList(base) self.L2Norm1 = L2Norm(512, 20) self.L2Norm2 = L2Norm(512, 20) self.L2Norm3 = L2Norm(1024, 20) self.extras = nn.ModuleList(extras) self.conv_1 = nn.ModuleList(head[0]) self.conv_2 = nn.ModuleList(head[1]) self.conv_3 = nn.ModuleList(head[2]) self.conv_4 = nn.ModuleList(head[3]) self.loc = nn.ModuleList(head[4]) self.conf = nn.ModuleList(head[5]) self.loc_vis = nn.ModuleList(head[6]) self.conf_vis = nn.ModuleList(head[7]) if self.phase == 'test': self.softmax1 = nn.Softmax() self.softmax2 = nn.Softmax() self.detect_seg = DetectSeg(num_classes, self.size, 0, 600, 0.0001, 0.55) self.detect_vis = Detect_v(num_classes, self.size, 0, 600, 0.0001, 0.55) self.score_fr = nn.Conv2d(1024, 1024, 1) self.score_pool3 = nn.Conv2d(256, 1024, 1) self.score_pool4 = nn.Conv2d(512, 1024, 1) self.upscore8 = nn.ConvTranspose2d( 1024, self.num_classes, 16, stride=8, padding=4, bias=False) self.upscore_pool4 = nn.ConvTranspose2d( 1024, 1024, 4, stride=2, padding=1, bias=False) self.score_fr_vis = nn.Conv2d(1024, 1024, 1) self.score_pool3_vis = nn.Conv2d(256, 1024, 1) self.score_pool4_vis = nn.Conv2d(512, 1024, 1) self.upscore8_vis = nn.ConvTranspose2d( 1024, self.num_classes, 16, stride=8, padding=4, bias=False) self.upscore_pool4_vis = nn.ConvTranspose2d( 1024, 1024, 4, stride=2, padding=1, bias=False) self.upscore16 = nn.ConvTranspose2d( 1024, self.num_classes, (32,32), stride=16, padding=8, bias=False) self.upscore16_vis = nn.ConvTranspose2d( 1024, self.num_classes, (32,32), stride=16, padding=8, bias=False) self.resume_channel = nn.Conv2d(1024, 512, 1) self.downscale_8_16 = nn.Conv2d(1024, 1024, kernel_size=3, stride=2, padding=1) self.resume_channel_vis = nn.Conv2d(1024, 512, 1) self.downscale_8_16_vis = nn.Conv2d(1024, 1024, kernel_size=3, stride=2, padding=1)
def __init__(self, num_classes, size, use_refine=True): super(RefineDet, self).__init__() self.num_classes = num_classes self.size = size # SSD network #self.base = get_vgg16_fms(fm_ids=[22,29,34], pool5=True, conv6_dilation=3) self.base = get_vgg16_fms(fm_ids=[22, 29, 34], pool5=True) self.use_refine = use_refine self.L2Norm_4_3 = L2Norm(512, 10) self.L2Norm_5_3 = L2Norm(512, 8) self.last_layer_trans = nn.Sequential( nn.Conv2d(512, 256, kernel_size=3, stride=1, padding=1), nn.ReLU(inplace=True), nn.Conv2d(256, 256, kernel_size=3, stride=1, padding=1), nn.ReLU(inplace=True), nn.Conv2d(256, 256, kernel_size=3, stride=1, padding=1), nn.ReLU(inplace=True)) self.extras = nn.Sequential(nn.Conv2d(1024, 256, kernel_size=1, stride=1, padding=0), nn.ReLU(inplace=True), \ nn.Conv2d(256, 512, kernel_size=3, stride=2, padding=1), nn.ReLU(inplace=True)) if use_refine: self.arm_loc = nn.ModuleList([nn.Conv2d(512, 12, kernel_size=3, stride=1, padding=1), \ nn.Conv2d(512, 12, kernel_size=3, stride=1, padding=1), \ nn.Conv2d(1024, 12, kernel_size=3, stride=1, padding=1), \ nn.Conv2d(512, 12, kernel_size=3, stride=1, padding=1), \ ]) self.arm_conf = nn.ModuleList([nn.Conv2d(512, 6, kernel_size=3, stride=1, padding=1), \ nn.Conv2d(512, 6, kernel_size=3, stride=1, padding=1), \ nn.Conv2d(1024, 6, kernel_size=3, stride=1, padding=1), \ nn.Conv2d(512, 6, kernel_size=3, stride=1, padding=1), \ ]) self.odm_loc = nn.ModuleList([nn.Conv2d(256, 12, kernel_size=3, stride=1, padding=1), \ nn.Conv2d(256, 12, kernel_size=3, stride=1, padding=1), \ nn.Conv2d(256, 12, kernel_size=3, stride=1, padding=1), \ nn.Conv2d(256, 12, kernel_size=3, stride=1, padding=1), \ ]) self.odm_conf = nn.ModuleList([nn.Conv2d(256, 3*num_classes, kernel_size=3, stride=1, padding=1), \ nn.Conv2d(256, 3*num_classes, kernel_size=3, stride=1, padding=1), \ nn.Conv2d(256, 3*num_classes, kernel_size=3, stride=1, padding=1), \ nn.Conv2d(256, 3*num_classes, kernel_size=3, stride=1, padding=1), \ ]) self.trans_layers = nn.ModuleList([nn.Sequential(nn.Conv2d(1024, 256, kernel_size=3, stride=1, padding=1), nn.ReLU(inplace=True), nn.Conv2d(256, 256, kernel_size=3, stride=1, padding=1)), \ nn.Sequential(nn.Conv2d(512, 256, kernel_size=3, stride=1, padding=1), nn.ReLU(inplace=True), nn.Conv2d(256, 256, kernel_size=3, stride=1, padding=1)), \ nn.Sequential(nn.Conv2d(512, 256, kernel_size=3, stride=1, padding=1), nn.ReLU(inplace=True), nn.Conv2d(256, 256, kernel_size=3, stride=1, padding=1)), \ ]) self.up_layers = nn.ModuleList([ nn.ConvTranspose2d(256, 256, kernel_size=2, stride=2, padding=0), nn.ConvTranspose2d(256, 256, kernel_size=2, stride=2, padding=0), nn.ConvTranspose2d(256, 256, kernel_size=2, stride=2, padding=0), ]) self.latent_layrs = nn.ModuleList([ nn.Conv2d(256, 256, kernel_size=3, stride=1, padding=1), nn.Conv2d(256, 256, kernel_size=3, stride=1, padding=1), nn.Conv2d(256, 256, kernel_size=3, stride=1, padding=1), ]) self.softmax = nn.Softmax()