The added layer must be an instance of class Layer. Found:

后端 未结 3 623
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-15 18:15

I am new to machine learning. I was following this tutorial on fine-tuning VGG16 models.

The model loaded fine with this code:

vgg_model = tensorflow.k         


        
3条回答
  •  隐瞒了意图╮
    2020-12-15 18:35

    You do not need to create an InputLayer, you simply must import the BatchNormalization layer in the same manner as your Conv2D/other layers, e.g:

    from tensorflow.keras.layers import Conv2D, Flatten, MaxPooling2D, Dropout, BatchNormalization
    

    Instead of importing it as an independent Keras layer, i.e:

    from tensorflow.keras.layers import Conv2D, Flatten, MaxPooling2D, Dropout
    from keras.layers import BatchNormalization
    

提交回复
热议问题