fine-tune.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:DeepLearningSandbox 作者: DeepLearningSandbox 项目源码 文件源码
def add_new_last_layer(base_model, nb_classes):
  """Add last layer to the convnet

  Args:
    base_model: keras model excluding top
    nb_classes: # of classes

  Returns:
    new keras model with last layer
  """
  x = base_model.output
  x = GlobalAveragePooling2D()(x)
  x = Dense(FC_SIZE, activation='relu')(x) #new FC layer, random init
  predictions = Dense(nb_classes, activation='softmax')(x) #new softmax layer
  model = Model(input=base_model.input, output=predictions)
  return model
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号