keras-team / keras-applications

Reference implementations of popular deep learning models.
Other
2k stars 913 forks source link

ValueError: The last dimension of the inputs to `Dense` should be defined. Found `None`. #156

Closed zubairahmed-ai closed 4 years ago

zubairahmed-ai commented 4 years ago

Summary

Receiving this error trying to Fine-tune a EfficientNetB0 using Tensorflow 2.0

Environment

Logs or source codes for reproduction

ValueError: The last dimension of the inputs toDenseshould be defined. FoundNone.

When fine-tuning a EfficientNetB0 with my own fully connected layer I get the above error

my import looks like this import efficientnet.tfkeras as efn

and

baseModel = efn.EfficientNetB0(weights="imagenet", include_top=False) headModel = FCHeadNet.build(baseModel, len(classNames), 256)

But the error is shown in this line

headModel = Dense(D, activation="relu")(headModel)

zubairahmed-ai commented 4 years ago

Fixed

limapedro commented 4 years ago

How did you fixed it?