簡體   English   中英

Google Colab TensorFlow model.fit() 錯誤

[英]Google Colab TensorFlow model.fit() error

嗨,我是 Stack 溢出的新手。 我的代碼有問題,我在 model.fit() 中,當我在 epochs 輸入一個值並運行代碼時出現錯誤。 這是model.fit的代碼:

model.fit(train_ds,validation_data = valid_ds,epochs = 10)

下面是我得到的錯誤:

ValueError Traceback (最近一次調用最后一次) in () 2 train_ds, 3 validation_data = valid_ds, ----> 4 epochs = 10 5 )

1 幀 /usr/local/lib/python3.7/dist-packages/tensorflow/python/framework/func_graph.py 在 autograph_handler(*args, **kwargs) 1145 例外為 e:# pylint:disable=broad-except 1146 if hasattr(e, "ag_error_metadata"): -> 1147 raise e.ag_error_metadata.to_exception(e) 1148 else: 1149 raise

ValueError:在用戶代碼中:

File "/usr/local/lib/python3.7/dist-packages/keras/engine/training.py", line 1021, in train_function  *
    return step_function(self, iterator)
File "/usr/local/lib/python3.7/dist-packages/keras/engine/training.py", line 1010, in step_function  **
    outputs = model.distribute_strategy.run(run_step, args=(data,))
File "/usr/local/lib/python3.7/dist-packages/keras/engine/training.py", line 1000, in run_step  **
    outputs = model.train_step(data)
File "/usr/local/lib/python3.7/dist-packages/keras/engine/training.py", line 859, in train_step
    y_pred = self(x, training=True)
File "/usr/local/lib/python3.7/dist-packages/keras/utils/traceback_utils.py", line 67, in error_handler
    raise e.with_traceback(filtered_tb) from None
File "/usr/local/lib/python3.7/dist-packages/keras/layers/convolutional.py", line 305, in compute_output_shape
    f'One of the dimensions in the output is <= 0 '

ValueError: Exception encountered when calling layer "sequential_3" (type Sequential).

One of the dimensions in the output is <= 0 due to downsampling in conv2d_280. Consider increasing the input size. Received input shape [None, 32, 32, 3] which would produce output shape with a zero or negative value in a dimension.

Call arguments received:
  • inputs=tf.Tensor(shape=(None, 32, 32, 3), dtype=float32)
  • training=True
  • mask=None

有人可以幫助我嗎? 提前致謝

可能您需要放大您輸入 CNN 的圖像的大小。 360x360x3 是標准的。 您的圖像尺寸太小,因此無法完全構建模型。

***您可能需要放大您輸入 CNN 的圖像的大小。 360x360x3 是標准的。 您的圖像尺寸太小,因此無法完全構建模型。


暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM