notes

Personal notes
git clone git://git.laack.co/notes.git
Log | Files | Refs

CNN.md (1793B)


      1 # Convolutional Neural Network (CNN)
      2 
      3 ML SS
      4 
      5 **Definition:** A convolutional neural network is a neural network that has convolutional layers that perform filtering functions upon the input data.
      6 
      7 A convolution is the process of moving a filter across some data and calculating the current values based on the surrounding values multiplied by the values in the filter and then summing them for the final result. 
      8 
      9 CNNs are good for image detection because they retain information about pixels and what surrounds them. This allows them to pick up edges, curves, and higher level concepts. 
     10 
     11 When using CNNs it is a good idea to start at around 32 filters (or higher) and increase (often double) the number of filters as the layers progress. 
     12 
     13 Additionally, don't forget to add [MaxPooling](MaxPooling.md) to ensure features are compressed and complexity of the model is minimized.
     14 
     15 ### Typical Form
     16 
     17 Early on have few filters and later more. This is to capture general stuff early and more complex stuff later.
     18 
     19 Use 'same' dimension instead of 'valid' when trying to maintain dimensions (small images) and normally use it early on.
     20 
     21 Double filters after each pooling layer (generally)
     22 
     23 General Form:
     24 
     25 Conv
     26 Relu
     27 Conv
     28 Relu 
     29 Pooling
     30 Conv
     31 Relu
     32 Conv
     33 Relu
     34 Pooling
     35 ...
     36 ...
     37 ...
     38 Flatten
     39 Dense
     40 (DROPOUT???)
     41 Dense
     42 (DROPOUT???)
     43 Dense (output)
     44 
     45 You can have a few more convs stacked together before pooling, but the idea is a few convs with relus right after then pooling. At the end there should then be a few dense layers.
     46 
     47 It is a good idea to have a larger kernel early on to decrease dimensionallity early on. Then later use smaller kernels that require less computations and have better fine grained accuracy.
     48 
     49 NOTE:
     50 
     51 When using keras you should specify relu in line with the conv for the activation.