Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,149,972 members, 7,806,821 topics. Date: Wednesday, 24 April 2024 at 02:11 AM

Error Using Grad-cam For Image Classification And Visualization - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Error Using Grad-cam For Image Classification And Visualization (427 Views)

Using OPENAI Api For Image Generation And Language Translation / Data Visualization Challenge: Which Of These Dashboards Can I Submit? / Please Rate This: My First Data Visualization Project (2) (3) (4)

(1) (Reply)

Error Using Grad-cam For Image Classification And Visualization by milkytins(m): 4:15pm On Nov 19, 2020
Good day my people, pls I having error in using GRAD-CAM with a fine-tuned VGG16.

First code error:
ValueError: Input 0 of layer dense_1 is incompatible with the layer: expected axis -1 of input shape to have value 64 but received input with shape [None, 14, 14, 512]

Second code error:
ValueError: `decode_predictions` expects a batch of predictions (i.e. a 2D array of shape (samples, 1000)). Found array with shape: (1, 3)

I will appreciate your help and contribution.
Whatsapp contact if there is need for me to share my code: 08068998735

Thank you.
Re: Error Using Grad-cam For Image Classification And Visualization by ibromodzi: 7:42pm On Nov 19, 2020
milkytins:
Good day my people, pls I having error in using GRAD-CAM with a fine-tuned VGG16.

First code error:
ValueError: Input 0 of layer dense_1 is incompatible with the layer: expected axis -1 of input shape to have value 64 but received input with shape [None, 14, 14, 512]

Second code error:
ValueError: `decode_predictions` expects a batch of predictions (i.e. a 2D array of shape (samples, 1000)). Found array with shape: (1, 3)

I will appreciate your help and contribution.
Whatsapp contact if there is need for me to share my code: 08068998735

Thank you.

Providing more codes might help in getting to the root of these errors. Although I have not used Grad-cam before but the errors you are getting already point to where the problem is.

Firstly, the error says your input isn't compatible with the first dense layer of VGG16, so you should look at your preprocessing pipeline (if you have any in your code, perhaps the size). In other words, your input image is not compatible with the model.

Secondly, Grad-cam needs to decode the top three predictions from the output of the model but since the input image is not compatible, you are getting the second error. Intuitively, solving the first error should address the second one.

1 Like

Re: Error Using Grad-cam For Image Classification And Visualization by mothrbworld: 6:34am On Nov 20, 2020
The motherboard has many gaming availability alternatives, that is the reason it's the best motherboard for AMD Ryzen 5 2600. With PCI-E 4, HDMI 2.0, and double M.2 uphold, motherboards for ryzen 2600 you can associate it with nearly anything. This motherboard for amd ryzen 5 2600 has the best presentation in the greater part of the motherboards. The highlights push the ability of the motherboard to energizing statures.

(1) (Reply)

This App Is Ideal For Thrift And Cooperative Business / Online Remote Job Opening — For Web Programmer Or Web Designer / Creating A Start-up In Nigeria Or Abroad

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 12
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.