示例#1
0
    def initialize(self, outchn, stride):
        self.stride = stride
        self.outchn = outchn
        self.bn0 = M.BatchNorm()
        self.c1 = M.ConvLayer(3,
                              outchn,
                              activation=M.PARAM_PRELU,
                              usebias=False,
                              batch_norm=True)
        self.c2 = M.ConvLayer(3,
                              outchn,
                              stride=stride,
                              usebias=False,
                              batch_norm=True)

        # se module
        #self.c3 = M.ConvLayer(1, outchn//16, activation=M.PARAM_PRELU)
        #self.c4 = M.ConvLayer(1, outchn, activation=M.PARAM_SIGMOID)

        # shortcut
        self.sc = M.ConvLayer(1,
                              outchn,
                              stride=stride,
                              usebias=False,
                              batch_norm=True)
示例#2
0
	def initialize(self, channel_list, blocknum_list, embedding_size, embedding_bn=True):
		self.head = HeadBlock(channel_list[0])
		self.body = nn.ModuleList()
		for num, chn in zip(blocknum_list, channel_list[1:]):
			for i in range(num):
				self.body.append(ResBlock_v1(chn, 2 if i==0 else 1))

		self.emb_bn = M.BatchNorm()
		self.embedding = M.Dense(embedding_size, batch_norm=embedding_bn, affine=False)
示例#3
0
 def initialize(self,
                channel_list,
                blocknum_list,
                embedding_size,
                embedding_bn=True):
     self.c1 = M.ConvLayer(3,
                           channel_list[0],
                           1,
                           usebias=False,
                           activation=M.PARAM_PRELU,
                           batch_norm=True)
     # self.u1 = ResBlock_v1(channel_list[1], stride=2)
     self.stage1 = Stage(channel_list[1], blocknum_list[0])
     self.stage2 = Stage(channel_list[2], blocknum_list[1])
     self.stage3 = Stage(channel_list[3], blocknum_list[2])
     self.stage4 = Stage(channel_list[4], blocknum_list[3])
     self.bn1 = M.BatchNorm()
     self.fc1 = M.Dense(512, usebias=False, batch_norm=True)