After learning Chapter 5 of deep learning with Python, deeply learn the thermodynamic diagram for computer vision
5.4.3 visualization class activation
when running the code in tensorflow 2.0 environment
grads = K.gradients(african_elephant_output, last_conv_layer.output)[0]
replace with
grads = tf.keras.backend.gradients(african_elephant_output, last_conv_layer.output)[0]
The following errors still occur
tf.gradients is not supported when eager execution is enabled. Use tf.GradientTape instead.
Solution
with tf.GradientTape() as gtape:
grads = gtape.gradient(african_elephant_output, last_conv_layer.output)
Full code reference
reference resources:
https://stackoverflow.com/questions/58322147/how-to-generate-cnn-heatmaps-using-built-in-keras-in-tf2-0-tf-keras
Read More:
- raise RuntimeError(“tf.placeholder() is not compatible with “ RuntimeError: tf.placeholder() is not
- The routine of benewake tfmini-s / tfmimi plus / tfluna / tf02 Pro / tf03 radar on Python
- tf.one_ How to use hot ()
- Inline JavaScript is not enabled. Is it set in your options?
- After the new video card rtx3060 arrives, configure tensorflow and run “TF. Test. Is”_ gpu_ The solution of “available ()” output false
- Tensorflow with tf.Session The usage of () as sess
- tf.contrib.layers .xavier_ Initializer function usage
- In tensorflow tf.reduce_ Mean function
- Tensorflow in function tf.Print Method of outputting intermediate value
- When react devtools is enabled, an error is reported for the project
- An error is reported when executing MVN. The diamond operator is not supported in source-1.5
- tf.layers.conv1d Function analysis (one dimensional convolution)
- The docker copies the win10 host file into the docker container. An error is reported: copying between containers is not supported
- The key “target densitydpi” is not supported
- fatal: protocol ‘https‘ is not supported
- Error starting day: SELinux is not supported with the overlay 2
- The Excel connection manager is not supported in the 64-bit version of SSIS [Switch]
- Assignment under multiple single edges is not supported for synthesis
- ERROR: pygame-1.9.2-cp35-cp35m-win32.whl is not a supported wheel on this platform.
- Not creating XLA devices, tf_xla_enable_xla_devices not set