you can still usecontrol_dependencies
def mean_iou(y_true, y_pred):
score, up_opt = tf.metrics.mean_iou(y_true, y_pred, NUM_CLASSES)
K.get_session().run(tf.local_variables_initializer())
with tf.control_dependencies([up_opt]):
score = tf.identity(score)
return score
More Related Contents:
- Keras, How to get the output of each layer?
- Tensorflow – ValueError: Failed to convert a NumPy array to a Tensor (Unsupported object type float)
- Deep-Learning Nan loss reasons
- Failed to get convolution algorithm. This is probably because cuDNN failed to initialize,
- Why is TensorFlow 2 much slower than TensorFlow 1?
- Can Keras with Tensorflow backend be forced to use CPU or GPU at will?
- What is the difference between tf.keras and tf.python.keras?
- TypeError: __array__() takes 1 positional argument but 2 were given (Image classification Keras)
- Tensorflow 2.0 – AttributeError: module ‘tensorflow’ has no attribute ‘Session’
- Can I run Keras model on gpu?
- Keras custom loss function: Accessing current input pattern
- Negative dimension size caused by subtracting 3 from 1 for ‘conv2d_2/convolution’
- Dimension of shape in conv1D
- How to know if underfitting or overfitting is occuring?
- Loading a trained Keras model and continue training
- Keras: .predict returns percentages instead of classes
- Keras Custom loss function to pass arguments other than y_true and y_pred
- Unknown initializer: GlorotUniform when loading Keras model
- Tensorflow : logits and labels must have the same first dimension
- Multiple outputs in Keras
- ValueError: Input 0 of layer sequential is incompatible with the layer: : expected min_ndim=4, found ndim=3. Full shape received: [8, 28, 28]
- How to implement Grad-CAM on a trained network
- NotImplementedError: Cannot convert a symbolic Tensor (2nd_target:0) to a numpy array
- How to fix “AttributeError: module ‘tensorflow’ has no attribute ‘get_default_graph'”?
- How to fix “ResourceExhaustedError: OOM when allocating tensor”
- How do I plot a Keras/Tensorflow subclassing API model?
- TensorFlow 2.0 Keras: How to write image summaries for TensorBoard
- How to visualize RNN/LSTM gradients in Keras/TensorFlow?
- How is the Keras Conv1D input specified? I seem to be lacking a dimension
- Multi-input Multi-output Model with Keras Functional API