python
from keras.layers import MaxPooling2D from keras.layers import Dense from Keras.layers import Flatten from keras.optimizers import SGD from keras.preprocessing.image import ImageDataGenerator def define_model(): model=Sequential() model.add(Conv2D(32,(3,3),activation='relu',kernel_intializer='he unifrom',padding='same',input_shape=(256,256,1))) model.add(MaxPooling2D((2,2))) model.add(Flatten()) model.add(Dense(128,activation='relu',kernel_intializer='he unifrom')) model.add(Dense(1,activation='sigmoid')) opt=SGD(lr=0.001,momentum=0.9) model.compile(optimizer=opt,loss='binary_crossentrophy',metrices=['accuracy']) return model def summarize_diagnostics(history): pyplot.subplot(211) pyplot.title('cross Entropy Loss') pyplot.plot(history.history['loss'],color='blue',label='train') pyplot.plot(history.history['val-acc'],color='orange',label='test') filename=sys.argv[0].split('/'[-1]) pyplot.savefig(filename+'-plot.png') pyplot.close() def run_test_harness(): model=define_model() datagen=ImageDataGenerator(rescale=1.0/255.0) train_it=datagen.flow_from_directory('dataset_dogs_vs_cats/train/',class_mode='binary',batch_size=64,target_size=(200,200)) test_it=datagen.flow_from_directory('dataset_dogs_vs_cats/test/',class_mode='binary',batch_size=64,target_size=(200,200)) history=model.flit_generator(train_it,steps_per_epoch=len(train_it),validation_data=test_it,validation_steps=len(test_it),epochs=20,verbose=0) _, acc=model.evaluate_generator(test_it,steps=len(test_it), verbose=0) print('> %.3f' % (acc * 100.0)) summarize_diagnostics(history) run_test_harness() bro....i run this program on anaconda spyder...the error is line 7, in <module> from Keras.layers import Flatten ModuleNotFoundError: No module named 'Keras'