报错解决:alueError: When using data tensors as input to a model, you should specify the `steps_per_epoch

报错解决:valueError: When using data tensors as input to a model, you should specify the steps_per_epoch argument.

晚上在使用tensorflow时报错如下:

  File "C:\Users\peter\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 786, in runfile
    execfile(filename, namespace)

  File "C:\Users\peter\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 110, in execfile
    exec(compile(f.read(), filename, 'exec'), namespace)

    callbacks = [cp_callback])  # pass callback to training

  File "C:\Users\peter\Anaconda3\lib\site-packages\tensorflow\python\keras\engine\training.py", line 880, in fit
    validation_steps=validation_steps)

  File "C:\Users\peter\Anaconda3\lib\site-packages\tensorflow\python\keras\engine\training_arrays.py", line 202, in model_iteration
    steps_per_epoch)

  File "C:\Users\peter\Anaconda3\lib\site-packages\tensorflow\python\keras\engine\training_arrays.py", line 76, in _get_num_samples_or_steps
    'steps_per_epoch')

  File "C:\Users\peter\Anaconda3\lib\site-packages\tensorflow\python\keras\engine\training_utils.py", line 230, in check_num_samples
    if check_steps_argument(ins, steps, steps_name):

  File "C:\Users\peter\Anaconda3\lib\site-packages\tensorflow\python\keras\engine\training_utils.py", line 960, in check_steps_argument
    input_type=input_type_str, steps_name=steps_name))

ValueError: When using data tensors as input to a model, you should specify the `steps_per_epoch` argument.

解决方法是model.fit中增加参数steps_per_epoch=1。

如果解决不了,我的一个奇淫技巧是把model.fit中的validation_data和validation_split都删了。

你可能感兴趣的:(python,机器学习,行走的问题解决机)