keract: NameError: name 'k' is not defined

Hi,

I’ve been getting below issue trying to visualize activation heatmaps . I can’t seem to understand why, since as I understand is just the channels_last format from keras backend.

I can see that in below line of keract.py the K is capital and in data_format = k.image_data_format() is not?

https://github.com/philipperemy/keract/blob/722d2588ac588d2ef6f9832758020deba7e70b3f/keract/keract.py#L5

I didn’t have an issue with display_activations and first meets what display_heatmaps requires as input.

Am I missing something?

first = np.array(activations.get('bAct-1/Relu:0'))
keract.display_activations(activations, save=False)
first.shape, k.image_data_format()
((1, 20, 40, 8), 'channels_last')

keract.display_heatmaps(activations, first, save=False)

---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-74-ebed9f04da1c> in <module>()
----> 1 keract.display_heatmaps(activations, first, save=False)

~/anaconda3/envs/tensorflow_p36/lib/python3.6/site-packages/keract/keract.py in display_heatmaps(activations, input_image, directory, save, fix)
    194     import math
    195 
--> 196     data_format = k.image_data_format()
    197     if fix:
    198         # fixes common errors made when passing the image

NameError: name 'k' is not defined

DV

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 25 (12 by maintainers)

Most upvoted comments

@danvargg thanks we are working hard to make a good lib 😃 Good luck!!