Coder Social home page Coder Social logo

Comments (10)

leoffx avatar leoffx commented on May 28, 2024 1

@liuxingbaoyu fix worked for me! thanks!

from keract.

philipperemy avatar philipperemy commented on May 28, 2024

@liuxingbaoyu update to the latest tensorflow and tell me if it solves the issue.

from keract.

liuxingbaoyu avatar liuxingbaoyu commented on May 28, 2024

@philipperemy Still exists, I am using tf-nightly-gpu 2.2.0-dev20200418.

from keract.

philipperemy avatar philipperemy commented on May 28, 2024

@liuxingbaoyu I found why. You're using the nightly version and it seems that this function was removed in the 2.2+ version. Currently, when you pip install tensorflow, it fetches the 2.1.0 and it works with this version (which is the latest version).

With pip install tf-nightly it fails:

Traceback (most recent call last):
  File "vgg16.py", line 38, in <module>
    activations = keract.get_activations(model, image)
  File "/Users/premy/PycharmProjects/keract/keract/keract.py", line 153, in get_activations
    activations = _evaluate(model, layer_outputs, x, y=None, auto_compile=auto_compile)
  File "/Users/premy/PycharmProjects/keract/keract/keract.py", line 47, in _evaluate
    return eval_fn(model._feed_inputs)
  File "/Users/premy/PycharmProjects/keract/keract/keract.py", line 42, in eval_fn
    return K.function(k_inputs, nodes_to_evaluate)(model._standardize_user_data(x, y))
AttributeError: 'Model' object has no attribute '_standardize_user_data'

I have no clear idea how to fix it.

Try to use TF 2.1.0 for now. When it becomes official, I'll check more in depth.

from keract.

liuxingbaoyu avatar liuxingbaoyu commented on May 28, 2024

@philipperemy
This seems to work.

outputs = [
    layer.output for layer in model.layers
]

activations_model = tf.keras.models.Model(model.inputs, outputs=outputs)
activations_model.compile(optimizer='adam', loss='categorical_crossentropy')
activations = activations_model.predict(np.array(sample[0][:1]))

m={}

for i in range(len(activations)):
    m[model.layers[i].name]=activations[i]

keract.display_activations(m)

Quoted from: https://www.sicara.ai/blog/2019-08-28-interpretability-deep-learning-tensorflow

from keract.

philipperemy avatar philipperemy commented on May 28, 2024

@liuxingbaoyu cool thanks for sharing!

from keract.

liuxingbaoyu avatar liuxingbaoyu commented on May 28, 2024

@philipperemy Glad to help you!

from keract.

theowoo avatar theowoo commented on May 28, 2024

@philipperemy

Try to use TF 2.1.0 for now. When it becomes official, I'll check more in depth.

pip install tensorflow now fetches the 2.2.0 and the error described above persists.

from keract.

sixsamuraisoldier avatar sixsamuraisoldier commented on May 28, 2024

To add to @theowoo I'm getting the same issue

from keract.

philipperemy avatar philipperemy commented on May 28, 2024

@theowoo @sixsamuraisoldier I've added a constraint to use 2.1.0 at most for now.
I'll have to look more into it when I have time.

from keract.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.