Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/335.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/cmake/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 我已经运行了很多次,但它表明路径是正确的_Python_Conv Neural Network - Fatal编程技术网

Python 我已经运行了很多次,但它表明路径是正确的

Python 我已经运行了很多次,但它表明路径是正确的,python,conv-neural-network,Python,Conv Neural Network,代码错误 train_image_gen = image_gen.flow_from_directory ('D:/Semesters/Final Year Project/Images--Datasets/' target_size = image_shape,batch_size = 64,color_mode= 'grayscale') test_image_gen = image_gen.flow_from_directory ('D:/Semesters/Final Year Pro

代码错误

train_image_gen = image_gen.flow_from_directory ('D:/Semesters/Final Year Project/Images--Datasets/'  target_size = image_shape,batch_size = 64,color_mode= 'grayscale')
test_image_gen = image_gen.flow_from_directory ('D:/Semesters/Final Year Project/Images--Datasets/' target_size = image_shape,color_mode= 'grayscale',shuffle= False,batch_size = 64,class_mode = 'categorical')
输出

File "C:\Users\DELL\.spyder-py3\train.py", line 26
    train_image_gen = image_gen.flow_from_directory ('D:/Semesters/Final Year Project/Images--Datasets/'  target_size = image_shape,batch_size = 64,color_mode= 'grayscale')
                                                                                                          ^
SyntaxError: invalid syntax

我认为您在路径之后/目标大小之前缺少一个逗号

应该是:

train_image_gen = image_gen.flow_from_directory ('D:/Semesters/Final Year Project/Images--Datasets/', target_size = image_shape, batch_size = 64, color_mode= 'grayscale')
test_image_gen = image_gen.flow_from_directory ('D:/Semesters/Final Year Project/Images--Datasets/', target_size = image_shape,color_mode= 'grayscale',shuffle= False,batch_size = 64,class_mode = 'categorical')