robbebluecp / tf2-yolov4

yolov4 base on keras of tf2+, tf2 support perfectly
14 stars 10 forks source link

The following Variables were created within a Lambda layer (yolo_loss) error #8

Open Medicmind opened 2 years ago

Medicmind commented 2 years ago

I have installed everything as per requirements.txt but when I run

python train.py

I get the following error message:

Traceback (most recent call last):
  File "train.py", line 38, in <module>
    model_loss = keras.layers.Lambda(function=loss.yolo4_loss, output_shape=(1,), name='yolo_loss')([*model_yolo.output, *y_true])
  File "/home/skinhat/tf2-yolov4-online/tensorflow/lib/python3.8/site-packages/tensorflow/python/keras/engine/base_layer.py", line 922, in __call__
    outputs = call_fn(cast_inputs, *args, **kwargs)
  File "/home/skinhat/tf2-yolov4-online/tensorflow/lib/python3.8/site-packages/tensorflow/python/keras/layers/core.py", line 889, in call
    self._check_variables(created_variables, tape.watched_variables())
  File "/home/skinhat/tf2-yolov4-online/tensorflow/lib/python3.8/site-packages/tensorflow/python/keras/layers/core.py", line 916, in _check_variables
    raise ValueError(error_str)
ValueError: 
The following Variables were created within a Lambda layer (yolo_loss)
but are not tracked by said layer:
  <tf.Variable 'yolo_loss/conv2d/kernel:0' shape=(3, 3, 3, 32) dtype=float32>
  <tf.Variable 'yolo_loss/batch_normalization/gamma:0' shape=(32,) dtype=float32>
  <tf.Variable 'yolo_loss/batch_normalization/beta:0' shape=(32,) dtype=float32>
  <tf.Variable 'yolo_loss/batch_normalization/moving_mean:0' shape=(32,) dtype=float32>
  <tf.Variable 'yolo_loss/batch_normalization/moving_variance:0' shape=(32,) dtype=float32>
Ohou-csu commented 2 years ago

您的来信王堃已收到,谢谢