在Keras中)如果使用加载的模型作为基础,加载的模型是否可以训练?

时间:2019-12-04 02:09:23

标签: python keras deep-learning

我有一个问题。

如果我加载模型并将该模型用作大模型的基础,那么当我训练大模型时,该加载的模型是否受过训练?

例如...

    baseModel = load_trained_model_from_checkpoint(
        config_file=paths.config,
        checkpoint_file=paths.checkpoint,
        output_layer_num=1
    )
    inputFormat = baseModel.input + [baseMask]
    maskedBase = keras.layers.dot([baseMask, baseModel.output], axes=1)
    _POSBatchNormed = keras.layers.BatchNormalization()(maskedBase)
    _POS1stConv = keras.layers.Conv1D(pos1FilterNum, pos1FilterSize,activation=tf.nn.relu)(_POSBatchNormed)
    _POSGlobalMaxPooled = keras.layers.GlobalMaxPool1D()(_POS1stConv)
    _POSDropOuted = keras.layers.Dropout(posDropOut)(_POSGlobalMaxPooled)
    _POS_CNN = keras.layers.Dense(2 * classNum, activation=tf.nn.relu)(_POSDropOuted)  # _POSDropOuted)

    concatenated = keras.layers.concatenate([_CNN_FCN1, _POS_CNN])  # CNN_out])

    deepDeepOut = keras.layers.Dense(1*classNum, activation=tf.nn.softmax)(concatenated)
    deepDeepModel = keras.Model(inputFormat, deepDeepOut)

如果我训练deepDeepModel,是否会更改baseModel的参数?

0 个答案:

没有答案