Hi,
I am doing Course 3, Week 3, Exercise 1: grad_cam of AI for medicine.
I got the Type Error of the image.
I appreciated that anyone could tell me what was wrong in my script.
screenshot removed as it contains codes that grades your assignment and posting codes is against community guidelines, you can always post screenshot of error encountered or your failed submission.
Thank you so much,
Loan Nguyen,
hi @ThanhLoanNguyen95
can you DM me screenshot of the codes for the exercise you got error by personal DM. click on my name and the message.
hi @ThanhLoanNguyen95
You have written codes quite right just at two places there is conflicting function use.
- for code line
Put in the image to calculate the values of the spatial_maps (selected layer) and values of the gradients
spatial_map_all_dims, grads_val_all_dims = None
for this code the function you used get map and gradient which is incorrect, instead use spatial_map_and_gradient_function to the image.
- For code line
Compute weights using global average pooling on gradient
You have used K.mean and K.constant where as you needed to just use np.mean to the grad values with the axis you already have mentioned.
all other of your grade function codes are correct.
Good luck!!!
Regards
Dr. Deepti
Yay.!!! It works.!!! Thank you so much.!
great keep learning.
closing this thread as you marked a response as solution to your query.
regards
dr.deepti