import CNN as cnn # Load image img = skimage.data.chelsea() #img = skimage.data.camera() # Converting the image into gray. img = skimage.color.rgb2gray(img) # 1st convolution layer l1Filter = numpy.zeros((2, 3, 3)) l1Filter[0, :, :] = numpy.array([[[-1, 0, 1], [-1, 0, 1], [-1, 0, 1]]]) l1Filter[1, :, :] = numpy.array([[[1, 1, 1], [0, 0, 0], [-1, -1, -1]]]) print("\nWorking with conv layer 1") l1FeatureMap = cnn.Conv(img, l1Filter) print("\nReLU") l1FeatureMapRelu = cnn.Relu(l1FeatureMap) print("\nPooling") l1FeatureMapReluPool = cnn.Pooling(l1FeatureMapRelu, 2, 2) print("End of conv layer 1\n") # 2nd convolution layer l2Filter = numpy.random.rand(3, 5, 5, l1FeatureMapReluPool.shape[-1]) print("\nWorking with conv layer 2") l2FeatureMap = cnn.Conv(l1FeatureMapReluPool, l2Filter) print("\nReLU") l2FeatureMapRelu = cnn.Relu(l2FeatureMap) print("\nPooling")