computer_vision.pooling_functions ================================= .. py:module:: computer_vision.pooling_functions Attributes ---------- .. autoapisummary:: computer_vision.pooling_functions.image Functions --------- .. autoapisummary:: computer_vision.pooling_functions.avgpooling computer_vision.pooling_functions.maxpooling Module Contents --------------- .. py:function:: avgpooling(arr: numpy.ndarray, size: int, stride: int) -> numpy.ndarray This function is used to perform avgpooling on the input array of 2D matrix(image) Args: arr: numpy array size: size of pooling matrix stride: the number of pixels shifts over the input matrix Returns: numpy array of avgpooled matrix Sample Input Output: >>> avgpooling([[1,2,3,4],[5,6,7,8],[9,10,11,12],[13,14,15,16]], 2, 2) array([[ 3., 5.], [11., 13.]]) >>> avgpooling([[147, 180, 122],[241, 76, 32],[126, 13, 157]], 2, 1) array([[161., 102.], [114., 69.]]) .. py:function:: maxpooling(arr: numpy.ndarray, size: int, stride: int) -> numpy.ndarray This function is used to perform maxpooling on the input array of 2D matrix(image) Args: arr: numpy array size: size of pooling matrix stride: the number of pixels shifts over the input matrix Returns: numpy array of maxpooled matrix Sample Input Output: >>> maxpooling([[1,2,3,4],[5,6,7,8],[9,10,11,12],[13,14,15,16]], 2, 2) array([[ 6., 8.], [14., 16.]]) >>> maxpooling([[147, 180, 122],[241, 76, 32],[126, 13, 157]], 2, 1) array([[241., 180.], [241., 157.]]) .. py:data:: image