Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

max pooling in cnn

1.  def pooling(feature_map, size=2, stride=2):  
2.      #Preparing the output of the pooling operation.  
3.      pool_out = numpy.zeros((numpy.uint16((feature_map.shape[0]-size+1)/stride),  
4.                              numpy.uint16((feature_map.shape[1]-size+1)/stride),  
5.                              feature_map.shape[-1]))  
6.      for map_num in range(feature_map.shape[-1]):  
7.          r2 = 0  
8.          for r in numpy.arange(0,feature_map.shape[0]-size-1, stride):  
9.              c2 = 0  
10.             for c in numpy.arange(0, feature_map.shape[1]-size-1, stride):  
11.                 pool_out[r2, c2, map_num] = numpy.max(feature_map[r:r+size,  c:c+size])  
12.                 c2 = c2 + 1  
13.             r2 = r2 +1
Comment

PREVIOUS NEXT
Code Example
Python :: make a gif with images python 
Python :: django now template tag 
Python :: pyspark print a column 
Python :: Python3 boto3 put and put_object to s3 
Python :: nested loop in list comprehension 
Python :: how to find highest number in list without using max function python 
Python :: python create venv 
Python :: cassandra python 
Python :: python sort array by value 
Python :: types of dict comprehension 
Python :: how to use function in python 
Python :: finding path of a module in python 
Python :: numpy int64 to int 
Python :: how to do a mac vendor lookup in python 
Python :: copy only some columns to new dataframe in r 
Python :: python panda append rows to csv python 
Python :: Python program to print even numbers in a list 
Python :: how to update sklearn 
Python :: how to setup django ionos hostig 
Python :: python sort the values in a dictionary 
Python :: play video in colab 
Python :: django active link 
Python :: PhoneNumberField django forms 
Python :: python make string one line 
Python :: numpy moving average 
Python :: django admin override save 
Python :: jupyter notebook show full dataframe cell 
Python :: python - calculate the value range on a df 
Python :: python message from teams 
Python :: extract nonzero array elements python 
ADD CONTENT
Topic
Content
Source link
Name
1+8 =