【发布时间】:2018-07-22 09:43:16
【问题描述】:
尝试在 Keras 中拟合模型,初始化和编译如下,但得到 None ValueErrors。调试此类错误的推荐方法是什么?我是 Keras 的新手。
我可以更早发现问题吗,即在初始化或编译模型时?
model = Model((64,64,3))
opt = keras.optimizers.Adam(lr=0.001, beta_1=0.9, beta_2=0.999, epsilon=None, decay=0.0)
binLoss = "binary_crossentropy"
model.compile(optimizer = opt, loss = binLoss, metrics = ["accuracy"])
ValueError Traceback (most recent call last)
<ipython-input-15-5b61099068d8> in <module>()
1 ### START CODE HERE ### (1 line)
----> 2 happyModel.fit(x = X_train, y = Y_train, epochs = 100, batch_size = 32)
3 ### END CODE HERE ###
/opt/conda/lib/python3.6/site-packages/keras/engine/training.py in fit(self, x, y, batch_size, epochs, verbose, callbacks, validation_split, validation_data, shuffle, class_weight, sample_weight, initial_epoch, steps_per_epoch, validation_steps, **kwargs)
1574 else:
1575 ins = x + y + sample_weights
-> 1576 self._make_train_function()
1577 f = self.train_function
1578
...
/opt/conda/lib/python3.6/site-packages/tensorflow/python/framework/tensor_util.py in make_tensor_proto(values, dtype, shape, verify_shape)
362 else:
363 if values is None:
--> 364 raise ValueError("None values not supported.")
365 # if dtype is provided, forces numpy array to be the type
366 # provided if possible.
ValueError: None values not supported.
【问题讨论】:
-
这种情况下的模型是什么?可以附上它的源代码吗?