Comments (10)
@liuxingbaoyu fix worked for me! thanks!
from keract.
@liuxingbaoyu update to the latest tensorflow and tell me if it solves the issue.
from keract.
@philipperemy Still exists, I am using tf-nightly-gpu 2.2.0-dev20200418.
from keract.
@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.
@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.
@liuxingbaoyu cool thanks for sharing!
from keract.
@philipperemy Glad to help you!
from keract.
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.
To add to @theowoo I'm getting the same issue
from keract.
@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)
- Plans to enable eager execution from TF 2.0? HOT 10
- Error when using model.add_loss HOT 5
- Regression CNN HOT 19
- Visualization on image sequence HOT 2
- Layer Import HOT 1
- Keras symbolic input/outputs and layer_names issue HOT 8
- Using an input other than the one provided by the pre-trained model fails. HOT 20
- get_activations: AttributeError when nested=True HOT 6
- Any plans for Pytorch implementation? HOT 2
- Heatmaps - ValueError: X has 20 features, but MinMaxScaler is expecting 1 features as input. HOT 17
- Can not convert a odict_values into a Tensor or Operation HOT 1
- custom loss not working any more
- Example in the README: 'Functional' object has no attribute '_layers' HOT 2
- display_heatmaps() ValueError: X has 28 features, but MinMaxScaler is expecting 1 features as input. HOT 2
- Interaction with submodels? HOT 5
- Trying to use keract.get_activations() for days, keep getting stuck HOT 3
- Implement with GradientTape
- Help with get_activations HOT 4
- display_heatmap error
- Scikit-learn requirement HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from keract.