def __call__(self, x, is_training=False): x = self.st1_1(x, is_training) x = self.st1_2(x, is_training) x = maxpool2d(x, 2, 2) x = self.st2_1(x, is_training) x = self.st2_2(x, is_training) x = maxpool2d(x, 2, 2) x = self.st3_1(x, is_training) x = self.st3_2(x, is_training) x = self.st3_3(x, is_training) x = maxpool2d(x, 2, 2) x = self.st4_1(x, is_training) x = self.st4_2(x, is_training) x = self.st4_3(x, is_training) x = maxpool2d(x, 2, 2) x = self.st5_1(x, is_training) x = self.st5_2(x, is_training) x = self.st5_3(x, is_training) x = maxpool2d(x, 2, 2) return x
def __call__(self, x, is_training=False): x = self.c1( x, is_training ) x = self.c2( x, is_training ) x = self.c3( x, is_training ) x1 = self.c4( x, is_training ) x2 = maxpool2d( x, 2, 2, padding="VALID" ) x = concat( [ x1, x2 ], axis = 3, name = "{}_concat1".format( self.name ) ) x1 = self.c5_0( x, is_training ) x2 = self.c6_0( x, is_training ) x1 = self.c5_1( x1, is_training ) x1 = self.c5_2( x1, is_training ) x1 = self.c5_3( x1, is_training ) x2 = self.c6_1( x2, is_training ) x = concat( [ x1, x2 ], axis = 3, name = "{}_concat2".format( self.name ) ) x1 = self.c7( x, is_training ) x2 = maxpool2d( x, 2, 2, padding="VALID" ) x = concat( [ x1, x2 ], axis = 3, name = "{}_concat3".format( self.name ) ) print(x) return x
def __call__(self, x, is_training=False): #===========ENTRY FLOW============== # Block 1 x = self.b1c1(x, is_training) x = self.b1c2(x, is_training) res = self.b1r1(x, is_training) # Block 2 x = self.b2c1(x, is_training) x = self.b2c2(x, is_training) x = maxpool2d(x, 3, 2) x = tf.add(x, res) res = self.b2r1(x, is_training) # Block 3 x = self.act(x) x = self.b3c1(x, is_training) x = self.b3c2(x, is_training) x = maxpool2d(x, 3, 2) x = tf.add(x, res) res = self.b3r1(x, is_training) # Block 4 x = self.act(x) x = self.b4c1(x, is_training) x = self.b4c2(x, is_training) x = maxpool2d(x, 3, 2) x = tf.add(x, res) #===========MIDDLE FLOW=============== for i in range(8): res = x for n in self.block[i]: x = self.act(x) x = n(x, is_training) x = tf.add(x, res) #========EXIT FLOW============ res = self.er0(x, is_training) x = self.act(x) x = self.ec0(x, is_training) x = self.ec1(x, is_training) x = maxpool2d(x, 3, 2) x = tf.add(x, res) x = self.ec2(x, is_training) x = self.ec3(x, is_training) print(x) return x
def __call__(self, x, is_training=False): # stage 1 x = zero_padding2d(x, (4, 4)) x = self.st1_c(x, is_training) x1 = maxpool2d(x, 2, 2, padding='VALID') # stage 2 x = self.st2_b(x1, is_training) x = self.st2_i1(x, is_training) x2 = self.st2_i2(x, is_training) # stage 3 x = self.st3_b(x2, is_training) x = self.st3_i1(x, is_training) x = self.st3_i2(x, is_training) x3 = self.st3_i3(x, is_training) # stage 4 x = self.st4_b(x3, is_training) x = self.st4_i1(x, is_training) x = self.st4_i2(x, is_training) x = self.st4_i3(x, is_training) x = self.st4_i4(x, is_training) x4 = self.st4_i5(x, is_training) # stage 5 x = self.st5_b(x4, is_training) x = self.st5_i1(x, is_training) x5 = self.st5_i2(x, is_training) return x1, x2, x3, x4, x5
def __call__(self, x, is_training=False): x0 = self.c0_0( x, is_training ) x = maxpool2d( x0, 2, 2 ) x = self.c1_0( x, is_training ) x1 = self.c1_1( x, is_training ) x = maxpool2d( x1, 2, 2 ) x = self.c2_0( x, is_training ) x2 = self.c2_1( x, is_training ) x = maxpool2d( x2, 2, 2 ) x = self.c3_0( x, is_training ) x3 = self.c3_1( x, is_training ) x = maxpool2d( x3, 2, 2 ) x = self.c4_0( x, is_training ) x4 = self.c4_1( x, is_training ) x = maxpool2d( x4, 2, 2 ) x = self.c5_0( x, is_training ) x = self.c5_1( x, is_training ) x = self.d0_0( x, is_training ) x = tf.concat( [ x, x4 ], axis = 3 ) x = self.d0_1( x, is_training ) x = self.d1_0( x, is_training ) x = tf.concat( [ x, x3 ], axis = 3 ) x = self.d1_1( x, is_training ) x = self.d2_0( x, is_training ) x = tf.concat( [ x, x2 ], axis = 3 ) x = self.d2_1( x, is_training ) x = self.d3_0( x, is_training ) x = tf.concat( [ x, x1 ], axis = 3 ) x = self.d3_1( x, is_training ) x = self.d4_0( x, is_training ) x = tf.concat( [ x, x0 ], axis = 3 ) x = self.d4_1( x, is_training ) print(x) return x
def __call__(self, x, h, is_training=False): x, xu = self.blockx(x, is_training=is_training) h, hu = self.blockh(h, is_training=is_training) if not self.polling is None: x = maxpool2d(x, self.polling) h = maxpool2d(h, self.polling) x = flatten(x) h = flatten(h) xh = tf.concat([x, h], axis=1) m, mu = self.blockm(xh, is_training=is_training) print(m) if is_training: return x, h, m, (*xu, *hu, *mu) return x, h, m
def __call__(self, x, is_training=False): # stage 1 x = zero_padding2d(x, (3, 3)) x = self.st1_c(x, is_training) x = maxpool2d(x, 3, 2, padding='VALID') # stage 2 x = self.st2_b(x, is_training) x = self.st2_i1(x, is_training) x = self.st2_i2(x, is_training) # stage 3 x = self.st3_b(x, is_training) x = self.st3_i1(x, is_training) x = self.st3_i2(x, is_training) x = self.st3_i3(x, is_training) # stage 4 x = self.st4_b(x, is_training) x = self.st4_i1(x, is_training) x = self.st4_i2(x, is_training) x = self.st4_i3(x, is_training) x = self.st4_i4(x, is_training) x = self.st4_i5(x, is_training) x = self.st4_i6(x, is_training) x = self.st4_i7(x, is_training) x = self.st4_i8(x, is_training) x = self.st4_i9(x, is_training) x = self.st4_i10(x, is_training) x = self.st4_i11(x, is_training) x = self.st4_i12(x, is_training) x = self.st4_i13(x, is_training) x = self.st4_i14(x, is_training) x = self.st4_i15(x, is_training) x = self.st4_i16(x, is_training) x = self.st4_i17(x, is_training) x = self.st4_i18(x, is_training) x = self.st4_i19(x, is_training) x = self.st4_i20(x, is_training) x = self.st4_i21(x, is_training) x = self.st4_i22(x, is_training) # stage 5 x = self.st5_b(x, is_training) x = self.st5_i1(x, is_training) x = self.st5_i2(x, is_training) x = avgpool2d(x, 2, 2, padding='VALID') return x
def __call__(self, x, is_training=False): x0 = maxpool2d( x, 3, 2, padding="SAME" ) x1 = self.c0_0( x, is_training ) x2 = self.c1_0( x, is_training ) x2 = self.c1_1( x2, is_training ) x2 = self.c1_2( x2, is_training ) x = concat( [ x0, x1, x2 ], 3, name = "{}_concat".format( self.name ) ) print(x) return x
def __call__(self, x, is_training=False): # Initial convolution x = self.c1( x, is_training ) x = bn( x, is_training ) x = self.act( x ) x = maxpool2d( x, 3, 2 ) # Add dense blocks for block_idx in range( self.nb_dense_block - 1 ): x = self.d_blocks[block_idx]( x, is_training ) # Add transition_block x = self.transition_block[block_idx]( x, is_training ) x = self.sne[block_idx]( x, is_training ) x = self.d_blocks[-1]( x, is_training ) self.sne[-1]( x, is_training ) x = bn( x, is_training ) x = self.act( x ) return x