def _conv_layers(self,x): conv_layers = Layers(x) # Convolutional layers res_blocks = [1,3,4,23,3] output_channels = [64,256,512,1024,2048] with tf.variable_scope('scale0'): conv_layers.conv2d(filter_size=7,output_channels=output_channels[0],stride=2,padding='SAME',b_value=None) conv_layers.maxpool(k=3) with tf.variable_scope('scale1'): conv_layers.res_layer(filter_size=3, output_channels=output_channels[1], stride=2) for block in range(res_blocks[1]-1): conv_layers.conv_layers.res_layer(filter_size=3, output_channels=output_channels[1], stride=1) with tf.variable_scope('scale2'): conv_layers.res_layer(filter_size=3, output_channels=output_channels[2], stride=2) for block in range(res_blocks[2]-1): conv_layers.conv_layers.res_layer(filter_size=3, output_channels=output_channels[2], stride=1) with tf.variable_scope('scale3'): conv_layers.res_layer(filter_size=3, output_channels=output_channels[3], stride=2) for block in range(res_blocks[3]-1): conv_layers.conv_layers.res_layer(filter_size=3, output_channels=output_channels[3], stride=1) with tf.variable_scope('scale4'): conv_layers.res_layer(filter_size=3, output_channels=output_channels[4], stride=2) for block in range(res_blocks[4]-1): conv_layers.conv_layers.res_layer(filter_size=3, output_channels=output_channels[4], stride=1) conv_layers.avgpool(globe=True) # Fully Connected Layer conv_layers.fc(output_nodes=10) return conv_layers.get_output()
def _conv_layers(self, x): conv_layers = Layers(x) # Convolutional layers res_blocks = [1, 3, 4, 23, 3] output_channels = [64, 256, 512, 1024, 2048] with tf.variable_scope('scale0'): conv_layers.conv2d(filter_size=7, output_channels=output_channels[0], stride=2, padding='SAME', b_value=None) conv_layers.maxpool(k=3) with tf.variable_scope('scale1'): conv_layers.res_layer(filter_size=3, output_channels=output_channels[1], stride=2) for block in range(res_blocks[1] - 1): conv_layers.conv_layers.res_layer( filter_size=3, output_channels=output_channels[1], stride=1) with tf.variable_scope('scale2'): conv_layers.res_layer(filter_size=3, output_channels=output_channels[2], stride=2) for block in range(res_blocks[2] - 1): conv_layers.conv_layers.res_layer( filter_size=3, output_channels=output_channels[2], stride=1) with tf.variable_scope('scale3'): conv_layers.res_layer(filter_size=3, output_channels=output_channels[3], stride=2) for block in range(res_blocks[3] - 1): conv_layers.conv_layers.res_layer( filter_size=3, output_channels=output_channels[3], stride=1) with tf.variable_scope('scale4'): conv_layers.res_layer(filter_size=3, output_channels=output_channels[4], stride=2) for block in range(res_blocks[4] - 1): conv_layers.conv_layers.res_layer( filter_size=3, output_channels=output_channels[4], stride=1) conv_layers.avgpool(globe=True) # Fully Connected Layer conv_layers.fc(output_nodes=10) return conv_layers.get_output()
def _network(self, x): conv_layers = Layers(x) # Convolutional layers with tf.variable_scope('resnet101'): res_blocks = [1, 3, 4, 23, 3] output_channels = [64, 256, 512, 1024, 2048] with tf.variable_scope('scale0'): conv_layers.conv2d(filter_size=7, output_channels=output_channels[0], stride=2, padding='SAME', b_value=None) conv_layers.maxpool(k=3) with tf.variable_scope('scale1'): conv_layers.res_layer(filter_size=3, output_channels=output_channels[1], stride=2) for block in range(res_blocks[1] - 1): conv_layers.conv_layers.res_layer( filter_size=3, output_channels=output_channels[1], stride=1) with tf.variable_scope('scale2'): conv_layers.res_layer(filter_size=3, output_channels=output_channels[2], stride=2) for block in range(res_blocks[2] - 1): conv_layers.conv_layers.res_layer( filter_size=3, output_channels=output_channels[2], stride=1) with tf.variable_scope('scale3'): conv_layers.res_layer(filter_size=3, output_channels=output_channels[3], stride=2) for block in range(res_blocks[3] - 1): conv_layers.conv_layers.res_layer( filter_size=3, output_channels=output_channels[3], stride=1) with tf.variable_scope('scale4'): conv_layers.res_layer(filter_size=3, output_channels=output_channels[4], stride=2) for block in range(res_blocks[4] - 1): conv_layers.conv_layers.res_layer( filter_size=3, output_channels=output_channels[4], stride=1) return conv_layers
def _network(self, x): conv_layers = Layers(x) # Convolutional layers scope = 'resnet' + str(self.depth) with tf.variable_scope(scope): res_blocks = self.architectures[self.depth] output_channels = [64, 256, 512, 1024, 2048] with tf.variable_scope('scale0'): conv_layers.conv2d(filter_size=7, output_channels=output_channels[0], stride=2, padding='SAME', b_value=None) # Downsample conv_layers.maxpool(k=3, s=2) # Downsample with tf.variable_scope('scale1'): for block in range(res_blocks[1]): conv_layers.res_layer(filter_size=3, output_channels=output_channels[1], stride=1) with tf.variable_scope('scale2'): conv_layers.res_layer(filter_size=3, output_channels=output_channels[2], stride=2) # Downsample for block in range(res_blocks[2] - 1): conv_layers.res_layer(filter_size=3, output_channels=output_channels[2], stride=1) with tf.variable_scope('scale3'): conv_layers.res_layer(filter_size=3, output_channels=output_channels[3], stride=2) # Downsample for block in range(res_blocks[3] - 1): conv_layers.res_layer(filter_size=3, output_channels=output_channels[3], stride=1) with tf.variable_scope('scale4'): conv_layers.res_layer(filter_size=3, output_channels=output_channels[4], stride=2) # Downsample for block in range(res_blocks[4] - 1): conv_layers.res_layer(filter_size=3, output_channels=output_channels[4], stride=1) return conv_layers