[英]Deep learning cannot run model.fit function
I am using the Cifar-10 dataset and I am trying to proceed with transfer learnin by using keras library. 我正在使用Cifar-10数据集,并且正在尝试通过使用keras库进行转移学习。 My code is here - https://github.com/YanaNeykova/Cifar-10 Upon running line 我的代码在这里-https://github.com/YanaNeykova/Cifar-10在运行时
model.fit(X_train, y_train, batch_size=32, epochs=10,
verbose=1, callbacks=[checkpointer],validation_split=0.2, shuffle=True)
I get an error ( visible in the file), and therefore I cannot proceed further. 我收到错误消息(在文件中可见),因此无法继续进行操作。 I tried it also with importing additionally the model function from keras , but I get again the same result - function model is not recognized. 我还尝试了另外从keras导入模型函数,但是我再次得到了相同的结果-无法识别函数模型。 Can someone advise how I can proceed ? 有人可以建议我如何进行吗? Many thanks in advance! 提前谢谢了!
Error 错误
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-11-977cb2a1e5d6> in <module>()
1 model.fit(X_train, y_train, batch_size=32, epochs=10,
----> 2 verbose=1, callbacks=[checkpointer],validation_split=0.2, shuffle=True)
/usr/local/lib/python3.6/dist-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)
1008 else:
1009 ins = x + y + sample_weights
-> 1010 self._make_train_function()
1011 f = self.train_function
1012
/usr/local/lib/python3.6/dist-packages/keras/engine/training.py in _make_train_function(self)
517 updates=updates,
518 name='train_function',
--> 519 **self._function_kwargs)
520
521 def _make_test_function(self):
/usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py in function(inputs, outputs, updates, **kwargs)
2742 msg = 'Invalid argument "%s" passed to K.function with TensorFlow backend' % key
2743 raise ValueError(msg)
-> 2744 return Function(inputs, outputs, updates=updates, **kwargs)
2745
2746
/usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py in __init__(self, inputs, outputs, updates, name, **session_kwargs)
2573 raise ValueError('Some keys in session_kwargs are not '
2574 'supported at this '
-> 2575 'time: %s', session_kwargs.keys())
2576 self._callable_fn = None
2577 self._feed_arrays = None
ValueError: ('Some keys in session_kwargs are not supported at this time: %s', dict_keys(['metric']))
You have a typo error, try replaceing metric
with metrics
你有一个错字错误,请尝试保换metric
与metrics
Also you should correct loss binary_crossentropy
to caegorical_crossentropy
另外,您还应将损失binary_crossentropy
纠正为caegorical_crossentropy
model.compile(loss='caegorical_crossentropy', optimizer='adam',
metrics=['accuracy'])
You are using metric keyword argument that seems to be unsupported in the following line: 您正在使用以下行似乎不支持的度量关键字参数:
model.compile(loss='binary_crossentropy', optimizer='adam',
metric=['accuracy'])
Try to remove it and see if it works. 尝试将其删除,看看是否可行。 It may be unsupported in your model. 您的模型可能不支持它。
Also, I have noticed that you may have a typo in the name of the loss function loss='caegorical_crossentropy'
... but I guess that is another issue. 另外,我注意到您可能在损失函数loss='caegorical_crossentropy'
的名称中有错别字...但是我想这是另一个问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.