deep learning for computer vision train_images train_images reshape(( )train_images train_images astype('float ' test_images test_images reshape(( )test_images test_images astype('float ' train_labels to_categorical(train_labelstest_labels to_categorical(test_labelsmodel compile(optimizer='rmsprop'loss='categorical_crossentropy'metrics=['accuracy']model fit(train_imagestrain_labelsepochs= batch_size= let' evaluate the model on the test datatest_losstest_acc model evaluate(test_imagestest_labelstest_acc whereas the densely connected network from had test accuracy of %the basic convnet has test accuracy of %we decreased the error rate by (relativenot badbut why does this simple convnet work so wellcompared to densely connected modelto answer thislet' dive into what the conv and maxpooling layers do the convolution operation the fundamental difference between densely connected layer and convolution layer is thisdense layers learn global patterns in their input feature space (for examplefor mnist digitpatterns involving all pixels)whereas convolution layers learn local patterns (see figure )in the case of imagespatterns found in small windows of the inputs in the previous examplethese windows were all figure images can be broken int local pat terns such as edgestext uresand so on licensed to