original_docstring: 
              16-layered VGG model implemented in Keras' Functional API
          
docstring: 16-layered VGG model implemented in Keras' Functional API
docstring_tokens: 16 - layered VGG model implemented in Keras ' Functional API
code: def VGG_16_FunctionalAPI(self, nOutput, input_shape):
          """
              16-layered VGG model implemented in Keras' Functional API
          """
          if len(input_shape) == 3:
              input_shape = tuple([input_shape[2]] + input_shape[0:2])
          else:
              input_shape = tuple(input_shape)
  
          vis_input = Input(shape=input_shape, name="vis_input")
  
          x = ZeroPadding2D((1, 1))(vis_input)
          x = Conv2D(64, (3, 3), activation='relu')(x)
          x = ZeroPadding2D((1, 1))(x)
          x = Conv2D(64, (3, 3), activation='relu')(x)
          x = MaxPooling2D((2, 2), strides=(2, 2))(x)
  
          x = ZeroPadding2D((1, 1))(x)
          x = Conv2D(128, (3, 3), activation='relu')(x)
          x = ZeroPadding2D((1, 1))(x)
          x = Conv2D(128, (3, 3), activation='relu')(x)
          x = MaxPooling2D((2, 2), strides=(2, 2))(x)
  
          x = ZeroPadding2D((1, 1))(x)
          x = Conv2D(256, (3, 3), activation='relu')(x)
          x = ZeroPadding2D((1, 1))(x)
          x = Conv2D(256, (3, 3), activation='relu')(x)
          x = ZeroPadding2D((1, 1))(x)
          x = Conv2D(256, (3, 3), activation='relu')(x)
          x = MaxPooling2D((2, 2), strides=(2, 2))(x)
  
          x = ZeroPadding2D((1, 1))(x)
          x = Conv2D(512, (3, 3), activation='relu')(x)
          x = ZeroPadding2D((1, 1))(x)
          x = Conv2D(512, (3, 3), activation='relu')(x)
          x = ZeroPadding2D((1, 1))(x)
          x = Conv2D(512, (3, 3), activation='relu')(x)
          x = MaxPooling2D((2, 2), strides=(2, 2))(x)
  
          x = ZeroPadding2D((1, 1))(x)
          x = Conv2D(512, (3, 3), activation='relu')(x)
          x = ZeroPadding2D((1, 1))(x)
          x = Conv2D(512, (3, 3), activation='relu')(x)
          x = ZeroPadding2D((1, 1))(x)
          x = Conv2D(512, (3, 3), activation='relu')(x)
          x = MaxPooling2D((2, 2), strides=(2, 2),
                           name='last_max_pool')(x)
  
          x = Flatten()(x)
          x = Dense(4096, activation='relu')(x)
          x = Dropout(0.5)(x)
          x = Dense(4096, activation='relu')(x)
          x = Dropout(0.5, name='last_dropout')(x)
          x = Dense(nOutput, activation='softmax', name='output')(x)  # nOutput=1000 by default
  
          self.model = Model(inputs=[vis_input], outputs=[x])
code_tokens: def VGG_16_FunctionalAPI ( self , nOutput , input_shape ) : if len ( input_shape ) == 3 : input_shape = tuple ( [ input_shape [ 2 ] ] + input_shape [ 0 : 2 ] ) else : input_shape = tuple ( input_shape ) vis_input = Input ( shape = input_shape , name = "vis_input" ) x = ZeroPadding2D ( ( 1 , 1 ) ) ( vis_input ) x = Conv2D ( 64 , ( 3 , 3 ) , activation = 'relu' ) ( x ) x = ZeroPadding2D ( ( 1 , 1 ) ) ( x ) x = Conv2D ( 64 , ( 3 , 3 ) , activation = 'relu' ) ( x ) x = MaxPooling2D ( ( 2 , 2 ) , strides = ( 2 , 2 ) ) ( x ) x = ZeroPadding2D ( ( 1 , 1 ) ) ( x ) x = Conv2D ( 128 , ( 3 , 3 ) , activation = 'relu' ) ( x ) x = ZeroPadding2D ( ( 1 , 1 ) ) ( x ) x = Conv2D ( 128 , ( 3 , 3 ) , activation = 'relu' ) ( x ) x = MaxPooling2D ( ( 2 , 2 ) , strides = ( 2 , 2 ) ) ( x ) x = ZeroPadding2D ( ( 1 , 1 ) ) ( x ) x = Conv2D ( 256 , ( 3 , 3 ) , activation = 'relu' ) ( x ) x = ZeroPadding2D ( ( 1 , 1 ) ) ( x ) x = Conv2D ( 256 , ( 3 , 3 ) , activation = 'relu' ) ( x ) x = ZeroPadding2D ( ( 1 , 1 ) ) ( x ) x = Conv2D ( 256 , ( 3 , 3 ) , activation = 'relu' ) ( x ) x = MaxPooling2D ( ( 2 , 2 ) , strides = ( 2 , 2 ) ) ( x ) x = ZeroPadding2D ( ( 1 , 1 ) ) ( x ) x = Conv2D ( 512 , ( 3 , 3 ) , activation = 'relu' ) ( x ) x = ZeroPadding2D ( ( 1 , 1 ) ) ( x ) x = Conv2D ( 512 , ( 3 , 3 ) , activation = 'relu' ) ( x ) x = ZeroPadding2D ( ( 1 , 1 ) ) ( x ) x = Conv2D ( 512 , ( 3 , 3 ) , activation = 'relu' ) ( x ) x = MaxPooling2D ( ( 2 , 2 ) , strides = ( 2 , 2 ) ) ( x ) x = ZeroPadding2D ( ( 1 , 1 ) ) ( x ) x = Conv2D ( 512 , ( 3 , 3 ) , activation = 'relu' ) ( x ) x = ZeroPadding2D ( ( 1 , 1 ) ) ( x ) x = Conv2D ( 512 , ( 3 , 3 ) , activation = 'relu' ) ( x ) x = ZeroPadding2D ( ( 1 , 1 ) ) ( x ) x = Conv2D ( 512 , ( 3 , 3 ) , activation = 'relu' ) ( x ) x = MaxPooling2D ( ( 2 , 2 ) , strides = ( 2 , 2 ) , name = 'last_max_pool' ) ( x ) x = Flatten ( ) ( x ) x = Dense ( 4096 , activation = 'relu' ) ( x ) x = Dropout ( 0.5 ) ( x ) x = Dense ( 4096 , activation = 'relu' ) ( x ) x = Dropout ( 0.5 , name = 'last_dropout' ) ( x ) x = Dense ( nOutput , activation = 'softmax' , name = 'output' ) ( x ) self . model = Model ( inputs = [ vis_input ] , outputs = [ x ] )
short_docstring: 16-layered VGG model implemented in Keras' Functional API
short_docstring_tokens: 16 - layered VGG model implemented in Keras ' Functional API
comment: """
              16-layered VGG model implemented in Keras' Functional API
          """$SEP$# nOutput=1000 by default