Skip to content

Instantly share code, notes, and snippets.

@agnesmm

agnesmm/a3g4.py Secret

Created September 19, 2017 11:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save agnesmm/4927ecbe8f2726643f2bfba8d202f805 to your computer and use it in GitHub Desktop.
Save agnesmm/4927ecbe8f2726643f2bfba8d202f805 to your computer and use it in GitHub Desktop.
import numpy as np
import skimage.measure
x = np.random.randint(5, size=(10, 10))
def max_pooling(x, n_patch=2):
return skimage.measure.block_reduce(x, (n_patch,n_patch), np.max)
print(x)
print(max_pooling(x))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment