1. 程式人生 > 其它 >人工智慧部分視訊學習內容報錯未解決

人工智慧部分視訊學習內容報錯未解決

garbage_classify專案報錯沒有解決:

48/49 [============================>.] - ETA: 9s - loss: 3.7486 - accuracy: 0.0365 Traceback (most recent call last):
  File "C:\Workspace\python3.7\lib\site-packages\tensorflow_core\python\ops\gen_resource_variable_ops.py", line 569, in read_variable_op
    "dtype", dtype)
tensorflow.python.eager.core._FallbackException: This function does not handle the case of the path where all inputs are not already EagerTensors.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:/Workspace/4_cv/第四章 Tensorflow框架/garbage_classify/train.py", line 119, in <module>
    train_model(args)
  File "C:/Workspace/4_cv/第四章 Tensorflow框架/garbage_classify/train.py", line 113, in train_model
    shuffle=True
  File "C:\Workspace\python3.7\lib\site-packages\tensorflow_core\python\keras\engine\training.py", line 1297, in fit_generator
    steps_name='steps_per_epoch')
  File "C:\Workspace\python3.7\lib\site-packages\tensorflow_core\python\keras\engine\training_generator.py", line 332, in model_iteration
    callbacks.on_epoch_end(epoch, epoch_logs)
  File "C:\Workspace\python3.7\lib\site-packages\tensorflow_core\python\keras\callbacks.py", line 298, in on_epoch_end
    callback.on_epoch_end(epoch, logs)
  File "C:\Workspace\python3.7\lib\site-packages\tensorflow_core\python\keras\callbacks.py", line 1614, in on_epoch_end
    self._log_weights(epoch)
  File "C:\Workspace\python3.7\lib\site-packages\tensorflow_core\python\keras\callbacks.py", line 1693, in _log_weights
    weight = K.get_value(weight)
  File "C:\Workspace\python3.7\lib\site-packages\tensorflow_core\python\keras\backend.py", line 3267, in get_value
    return x.numpy()
  File "C:\Workspace\python3.7\lib\site-packages\tensorflow_core\python\ops\resource_variable_ops.py", line 577, in numpy
    return self.read_value().numpy()
  File "C:\Workspace\python3.7\lib\site-packages\tensorflow_core\python\ops\resource_variable_ops.py", line 630, in read_value
    value = self._read_variable_op()
  File "C:\Workspace\python3.7\lib\site-packages\tensorflow_core\python\ops\resource_variable_ops.py", line 608, in _read_variable_op
    self._dtype)
  File "C:\Workspace\python3.7\lib\site-packages\tensorflow_core\python\ops\gen_resource_variable_ops.py", line 574, in read_variable_op
    resource, dtype=dtype, name=name, ctx=_ctx)
  File "C:\Workspace\python3.7\lib\site-packages\tensorflow_core\python\ops\gen_resource_variable_ops.py", line 612, in read_variable_op_eager_fallback
    attrs=_attrs, ctx=_ctx, name=name)
  File "C:\Workspace\python3.7\lib\site-packages\tensorflow_core\python\eager\execute.py", line 76, in quick_execute
    raise e
  File "C:\Workspace\python3.7\lib\site-packages\tensorflow_core\python\eager\execute.py", line 61, in quick_execute
    num_outputs)
TypeError: An op outside of the function building code is being passed
a "Graph" tensor. It is possible to have Graph tensors
leak out of the function building context by including a
tf.init_scope in your function building code.
For example, the following function will fail:
  @tf.function
  def has_init_scope():
    my_constant = tf.constant(1.)
    with tf.init_scope():
      added = my_constant * 2
The graph tensor has name: conv2d/kernel:0

Process finished with exit code 1