text: import tensorflow as tf
  
  out_num = 125
  def net(input_shape, emb_size=4):
      input_image = tf.keras.Input(input_shape,name='image_input')
      
      x = tf.keras.layers.Conv2D(32, (3,3), padding='same')(input_image)
      x = tf.keras.layers.BatchNormalization()(x)
      x = tf.keras.layers.Activation('relu')(x)
      x = tf.keras.layers.Concatenate()([input_image]*11 + [x])
      
      x = tf.keras.layers.MaxPooling2D((3,3))(x)
      
      im = tf.keras.layers.MaxPooling2D((3,3))(input_image)
      
      r = tf.keras.layers.Dropout(0.25)(x)
      
      x = tf.keras.layers.Conv2D(128, (3,3), padding='same')(r)
      x = tf.keras.layers.BatchNormalization()(x)
      x = tf.keras.layers.Activation('relu')(x)
  
      x = tf.keras.layers.Concatenate()([im]*21 + [r,x])
      
      x = tf.keras.layers.MaxPooling2D((3,3))(x)
      
      im = tf.keras.layers.MaxPooling2D((3,3))(im)
      
      r = tf.keras.layers.Dropout(0.25)(x)
      
      x = tf.keras.layers.Conv2D(256, (3,3), padding='same')(r)
      x = tf.keras.layers.BatchNormalization()(x)
      x = tf.keras.layers.Activation('relu')(x)
      
      x = tf.keras.layers.Concatenate()([r,x])
      
      x = tf.keras.layers.MaxPooling2D((3,3))(x)
      x = tf.keras.layers.Dropout(0.25)(x)
      
      x = tf.keras.layers.Flatten()(x)
      x = tf.keras.layers.Dense(512, activation='relu')(x)
      x = tf.keras.layers.Dropout(0.5)(x)
      
  #     emb = tf.keras.layers.Dense(10, activity_regularizer='l2')(x)
  #     out = tf.keras.layers.Dense(out_num, kernel_regularizer='l2', use_bias=False, name='output')(emb)
      
      out = tf.keras.layers.Dense(out_num, activation='softmax', name='output')(x)
      
      model = tf.keras.Model(inputs=[input_image], outputs=out)
      return model
  
  # dogfacenet_v13
  emb_size = 16
  
  from tensorflow.keras import Model
  from tensorflow.keras.layers import Input, Conv2D, MaxPooling2D, Add, GlobalAveragePooling2D
  from tensorflow.keras.layers import Activation, Dropout, Flatten, Dense, Lambda, BatchNormalization
  
  inputs = Input(shape=(104, 104, 3))
  
  x = Conv2D(16, (7, 7), use_bias=False, activation='relu', padding='same')(inputs)
  x = BatchNormalization()(x)
  
  for layer in [16,32,64,128,512]:
      # Batch normalization layer
      x = Conv2D(layer, (3, 3), strides=(2,2), use_bias=False, activation='relu', padding='same')(x)
      r = BatchNormalization()(x)
      r = Dropout(0.25)(r)
      
      x = Conv2D(layer, (3, 3), use_bias=False, activation='relu', padding='same')(r)
      x = BatchNormalization()(x)
      r = Add()([r,x])
      r = Dropout(0.25)(r)
      
      x = Conv2D(layer, (3, 3), use_bias=False, activation='relu', padding='same')(r)
      x = BatchNormalization()(x)
      x = Add()([r,x])
      x = Dropout(0.25)(x)
      
      #model.add(Dropout(0.25))
  
  x = GlobalAveragePooling2D()(x)
  x = Flatten()(x)
  x = Dropout(0.5)(x)
  x = Dense(512, activation='relu')(x)
  x = Dropout(0.5)(x)
  x = Dense(emb_size, use_bias=False)(x)
  outputs = Lambda(lambda x: tf.nn.l2_normalize(x,axis=-1))(x)
  
  model = tf.keras.Model(inputs,outputs)
  
  model.compile(loss=triplet,
                optimizer='adam',
                metrics=[triplet_acc])
  model.summary()
  
  # dogfacenet_v14
  emb_size = 32
  
  from tensorflow.keras import Model
  from tensorflow.keras.layers import Input, Conv2D, MaxPooling2D, Add, GlobalAveragePooling2D
  from tensorflow.keras.layers import Activation, Dropout, Flatten, Dense, Lambda, BatchNormalization
  
  inputs = Input(shape=(104, 104, 3))
  
  x = Conv2D(16, (7, 7), use_bias=False, activation='relu', padding='same')(inputs)
  x = BatchNormalization()(x)
  
  x = Conv2D(16, (3, 3), strides=(2,2), activation='relu', padding='same')(x)
  x = BatchNormalization()(x)
  x = Dropout(0.25)(x)
  
  x = Conv2D(16, (3, 3), activation='relu', padding='same')(x)
  x = BatchNormalization()(x)
  x = Dropout(0.25)(x)
  
  x = Conv2D(16, (3, 3), activation='relu', padding='same')(x)
  x = BatchNormalization()(x)
  x = Dropout(0.25)(x)
  
  
  for layer in [32,64]:
      x = Conv2D(layer, (3, 3), strides=(2,2), activation='relu', padding='same')(x)
      x = BatchNormalization()(x)
      x = Dropout(0.25)(x)
      
      x = Conv2D(layer, (3, 3), activation='relu', padding='same')(x)
      x = BatchNormalization()(x)
      x = Dropout(0.25)(x)
      
      x = Conv2D(layer, (3, 3), activation='relu', padding='same')(x)
      x = BatchNormalization()(x)
      x = Dropout(0.25)(x)
  
  for layer in [128,512]:
      # Batch normalization layer
      x = Conv2D(layer, (3, 3), strides=(2,2), use_bias=False, activation='relu', padding='same')(x)
      r = BatchNormalization()(x)
      r = Dropout(0.25)(r)
      
      x = Conv2D(layer, (3, 3), use_bias=False, activation='relu', padding='same')(r)
      x = BatchNormalization()(x)
      r = Add()([r,x])
      r = Dropout(0.25)(r)
      
      x = Conv2D(layer, (3, 3), use_bias=False, activation='relu', padding='same')(r)
      x = BatchNormalization()(x)
      x = Add()([r,x])
      x = Dropout(0.25)(x)
  
  x = GlobalAveragePooling2D()(x)
  x = Flatten()(x)
  x = Dropout(0.5)(x)
  x = Dense(emb_size, use_bias=False)(x)
  outputs = Lambda(lambda x: tf.nn.l2_normalize(x,axis=-1))(x)
  
  model = tf.keras.Model(inputs,outputs)
  
  model.compile(loss=triplet,
                optimizer='adam',
                metrics=[triplet_acc])
  model.summary()
  
  # dogfacenet_v15
  emb_size = 32
  
  from tensorflow.keras import Model
  from tensorflow.keras.layers import Input, Conv2D, MaxPooling2D, Add, GlobalAveragePooling2D
  from tensorflow.keras.layers import Activation, Dropout, Flatten, Dense, Lambda, BatchNormalization
  
  inputs = Input(shape=(104, 104, 3))
  
  x = Conv2D(32, (5, 5), use_bias=False, activation='relu', padding='same')(inputs)
  x = BatchNormalization()(x)
  
  for layer in [32,64,128,512,1024]:
      # Batch normalization layer
      x = Conv2D(layer, (3, 3), strides=(2,2), use_bias=False, activation='relu', padding='same')(x)
      r = BatchNormalization()(x)
      r = Dropout(0.25)(r)
      
      x = Conv2D(layer, (3, 3), use_bias=False, activation='relu', padding='same')(r)
      x = BatchNormalization()(x)
      r = Add()([r,x])
      r = Dropout(0.25)(r)
      
      x = Conv2D(layer, (3, 3), use_bias=False, activation='relu', padding='same')(r)
      x = BatchNormalization()(x)
      x = Add()([r,x])
      x = Dropout(0.25)(x)
      
      #model.add(Dropout(0.25))
  
  x = GlobalAveragePooling2D()(x)
  x = Flatten()(x)
  #model.add(Dense(1024, activation='relu'))
  x = Dropout(0.5)(x)
  x = Dense(emb_size, use_bias=False)(x)
  outputs = Lambda(lambda x: tf.nn.l2_normalize(x,axis=-1))(x)
  
  model = tf.keras.Model(inputs,outputs)
  
  model.compile(loss=triplet,
                optimizer='adam',
                metrics=[triplet_acc])
  model.summary()
  
  
  # dogfacenet_v17
  emb_size = 32
  
  from tensorflow.keras import Model
  from tensorflow.keras.layers import Input, Conv2D, MaxPooling2D, Add, GlobalAveragePooling2D
  from tensorflow.keras.layers import Activation, Dropout, Flatten, Dense, Lambda, BatchNormalization
  
  inputs = Input(shape=(104, 104, 3))
  
  x = Conv2D(32, (7, 7), use_bias=False, activation='relu', padding='same')(inputs)
  x = BatchNormalization()(x)
  
  layers = [32,32,64,128,512,1024]
  for i in range(len(layers)-1):
      layer = layers[i]
      layer2 = layers[i+1]
      # Batch normalization layer
      x = Conv2D(layer, (1, 1), use_bias=False, padding='same')(x)
      x = Conv2D(layer, (3, 3), strides=(2,2), use_bias=False, activation='relu', padding='same')(x)
      x = Conv2D(layer2, (1, 1), use_bias=False, padding='same')(x)
      r = BatchNormalization()(x)
      r = Dropout(0.25)(r)
      
      x = Conv2D(layer, (1, 1), use_bias=False, padding='same')(x)
      x = Conv2D(layer, (3, 3), use_bias=False, activation='relu', padding='same')(r)
      x = Conv2D(layer2, (1, 1), use_bias=False, padding='same')(x)
      x = BatchNormalization()(x)
      r = Add()([r,x])
      r = Dropout(0.25)(r)
      
      x = Conv2D(layer, (1, 1), use_bias=False, padding='same')(x)
      x = Conv2D(layer, (3, 3), use_bias=False, activation='relu', padding='same')(r)
      x = Conv2D(layer2, (1, 1), use_bias=False, padding='same')(x)
      x = BatchNormalization()(x)
      x = Add()([r,x])
      x = Dropout(0.25)(x)
      
      #model.add(Dropout(0.25))
  
  x = GlobalAveragePooling2D()(x)
  x = Flatten()(x)
  #model.add(Dense(1024, activation='relu'))
  x = Dropout(0.5)(x)
  x = Dense(emb_size, use_bias=False)(x)
  outputs = Lambda(lambda x: tf.nn.l2_normalize(x,axis=-1))(x)
  
  model = tf.keras.Model(inputs,outputs)
  
  model.compile(loss=triplet,
                optimizer='adam',
                metrics=[triplet_acc])
  model.summary()