Check whether a variable is instance of ResNet50

Question:

I am checking whether

model = ResNet50(weights='imagenet', include_top=False, pooling="avg")

is instance of

keras.applications.ResNet50

What I have done is:

isinstance(model, ResNet50)

but unfortunately this is raising me the following exception:

TypeError: isinstance() arg 2 must be a type, a tuple of types, or a union

Moreover, I have tried:

isinstance(model, keras.applications.ResNet50())

but, again, this is raising me the same exception.

  • What am I missing?
Asked By: tail

||

Answers:

keras.applications.ResNet50 is a function that returns an instance of keras.models.Model.

Try:

if model.name == "resnet50":
    ...
Answered By: Yevhen Kuzmovych
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.