keras model.fit_generator错误。如何解决此问题?

时间:2019-02-16 20:17:06

标签: python-3.x numpy machine-learning keras deep-learning

我已经检查了keras.fit_generator函数的文档,仍然找不到问题  我的笔记本电脑中的图书馆工作正常 我的代码:

# train the network
print("training network...")
sys.stdout.flush()
#class_mode ='categorical', # 2D one-hot encoded labels
H = model.fit_generator(aug.flow(Xtrain, trainY,batch_size=BS),
                    validation_data=(Xval, valY),
                    steps_per_epoch=len(trainX) // BS,
                    epochs=EPOCHS, verbose=1)

# save the model to disk
print("Saving model to disk")
sys.stdout.flush()
model.save("/tmp/mymodel")

我的代码出现以下错误:

Traceback (most recent call last):File 
"C:\Users\user\AppData\Local\conda\conda\envs\my_root\lib\site- 
 packages\IPython\core\interactiveshell.py", line 3267, in run_code
File "<ipython-input-80-935b20410c11>", line 8, in <module>
epochs=EPOCHS, verbose=1)
File "C:\Users\user\AppData\Local\conda\conda\envs\my_root\lib\site- 
packages\keras\legacy\interfaces.py", line 91, in wrapper

File "C:\Users\user\AppData\Local\conda\conda\envs\my_root\lib\site- 
packages\keras\engine\training.py", line 1418, in fit_generator

File "C:\Users\user\AppData\Local\conda\conda\envs\my_root\lib\site- 
packages\keras\engine\training_generator.py", line 162, in fit_generator

File "C:\Users\user\AppData\Local\conda\conda\envs\my_root\lib\site- 
packages\keras\utils\data_utils.py", line 647, in __init__

File "C:\Users\user\AppData\Local\conda\conda\envs\my_root\lib\site- 
packages\keras\utils\data_utils.py", line 433, in __init__


File"C:\Users\user\AppData\Local\conda\conda\envs\
my_root\lib\multiprocessing\context.py", line 133, in Value

File "C:\Users\user\AppData\Local\conda\conda\envs\
my_root\lib\multiprocessing\sharedctypes.py", line 182 
exec template % ((name,)*7) in d
            ^
SyntaxError: invalid syntax

0 个答案:

没有答案