本帖最后由 djqlyy2922 于 2023-4-26 14:25 编辑
书python深度学习第2版,8.2.4节中的一个例子,狗和猫图片训练的一个实例:在运行到以下代码是报错!刚接触,不知道怎么定位查找问题!提示说什么输入为空,输入不为空啊,图片都有啊!
callbacks = [keras.callbacks.ModelCheckpoint(filepath = "convnet_from_scratch.keras", save_best_only = True,monitor="val_loss")]
history = model.fit(train_dataset, epochs=30, validation_data=validation_dataset, callbacks=callbacks)
Epoch 1/30WARNING:tensorflow:AutoGraph could not transform <function Model.make_train_function.<locals>.train_function at 0x0000000013876A68> and will run it as-is.Please report this to the TensorFlow team. When filing the bug, set the verbosity to 10 (on Linux, `export AUTOGRAPH_VERBOSITY=10`) and attach the full output.Cause: 'arguments' object has no attribute 'posonlyargs'To silence this warning, decorate the function with @tf.autograph.experimental.do_not_convertWARNING: AutoGraph could not transform <function Model.make_train_function.<locals>.train_function at 0x0000000013876A68> and will run it as-is.Please report this to the TensorFlow team. When filing the bug, set the verbosity to 10 (on Linux, `export AUTOGRAPH_VERBOSITY=10`) and attach the full output.Cause: 'arguments' object has no attribute 'posonlyargs'To silence this warning, decorate the function with @tf.autograph.experimental.do_not_convert46/63 [====================>.........] - ETA: 16s - loss: 0.8032 - accuracy: 0.4891
---------------------------------------------------------------------------InvalidArgumentError Traceback (most recent call last)C:\Users\ADMINI~1\AppData\Local\Temp/ipykernel_4604/3772824337.py in <module> 4 epochs=30, 5 validation_data=validation_dataset,----> 6 callbacks=callbacks)D:\RGZN\Anaconda\lib\site-packages\keras\utils\traceback_utils.py in error_handler(*args, **kwargs) 65 except Exception as e: # pylint: disable=broad-except 66 filtered_tb = _process_traceback_frames(e.__traceback__)---> 67raise e.with_traceback(filtered_tb) from None 68 finally: 69 del filtered_tbD:\RGZN\Anaconda\lib\site-packages\tensorflow\python\eager\execute.py in quick_execute(op_name, num_outputs, inputs, attrs, ctx, name) 57 ctx.ensure_initialized() 58 tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name,---> 59 inputs, attrs, num_outputs) 60 except core._NotOkStatusException as e: 61 if name is not None:InvalidArgumentError: Input is empty. [[{{node decode_image/DecodeImage}}]] [[IteratorGetNext]] [Op:__inference_train_function_1358]
|