Skip to content

Problem with tutorial #192

@tombinic

Description

@tombinic

I'm trying to replicate the tutorial

`model = tf.keras.applications.vgg16.VGG16(weights="imagenet", include_top=True)

img = tf.keras.preprocessing.image.load_img(IMAGE_PATH, target_size=(224, 224))
img = tf.keras.preprocessing.image.img_to_array(img)
data = ([img], None)

explainer = GradCAM()
grid = explainer.explain(data, model, class_index=281) # 281 is the tabby cat index in ImageNet

explainer.save(grid, ".", "grad_cam.png")`

it gives me an error

"AttributeError: 'Dense' object has no attribute 'output_shape'"
How can I fix it? Thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions