# Deep Machine Learning for Path Length Characterization Using Acoustic Diffraction
## 2 Materials and Methods
### Convolutional Neural Networks
#### 2.3.2 Amplitude CNN  
The CNNs created for this data each have a similar ten-layer design. The amplitude model trains on the SDFTs representing the change in amplitude. As seen in the preprocessing analysis, the amplitude relationship does not look as complex as the phase relationship; therefore, this model has a decreased complexity in comparison with the phase model. The model design includes an input layer, four convolutional layers, two max-pooling layers, a flattening layer, two fully connected layers, and an output layer. All input data (pixels and acoustic path lengths) are normalized between zero and one. This section details the layers of this model.  
**Input**: The CNN takes in 51 \(\times\) 17 \(\times\) 1 images in the form of SDFTs. This means images which are 51 pixels tall, 17 pixels wide, and in grayscale. The values in the SDFTs are normalized between 0 and 1. Examples of the SDFTs are shown in Figure 8.  
**Convolution Layer 1 & 2**: The first two convolution layers apply 64 kernels which are sized 7\(\times\) 7 and use a stride of 1 with the same size padding. The same size padding will pad 0's around the exterior of the image so that the kernel can be applied to all pixels of the image without reducing the size of the image. This is important in this model as the images are very narrow, but the relationships are fairly complex.  
**Max Pooling 1**: The first two convolution layers are followed by a max pooling layer with a kernel-sized 2 \(\times\) 2. The use of such a max pooling layer allows us to reduce the dimensionality of the model while maintaining the most important features from each kernel. Max pooling also increases the generalizations made by the model to reduce noise in the image.  
**Convolution Layer 3**: This convolution layer applies 64 5 \(\times\) 5 kernels with a stride of 1 and same size padding.  
**Convolution Layer 4**: This convolution layer applies 96 kernels which are sized 5 \(\times\) 5 and use a stride of 1 with the same size padding.  
**Max Pooling 2**: The second two convolution layers are followed by a max pooling layer with a kernel sized 2 \(\times\) 2 to once again reduce the dimensionality and allow generalization of the extracted features.  
**Flattening**: Flattening layers take the resulting feature maps from the final max pooling layer and flatten them into a feature vector to allow connection to a dense layer. Immediately after flattening, 40% of the features are dropped to avoid overfitting the features in the feature vector.  
**Fully Connected Layers**: The flattening layer connects to a fully connected, or dense, layer with 400 nodes.  
**Output**: The fully connected features are connected to a single node which uses a regression with the hyperbolic tangent function to determine the acoustic path length of the input sample. This function works best for the Amplitude model as the relationship between the transfer function amplitude and the normalized acoustic path length is a nonlinear relationship which is increasing between 0 and 1.  
The architecture for the amplitude model is depicted in Figure 10.