## 3 Results and Discussion
### Convolutional Neural Network (CNN) for Image Segmentation  
The CNN used in this work was an adaptation from the U-Net architecture [26]. Initial efforts to use the original U-Net architecture resulted in over-fitting. Over-fitting in machine learning models occurs when the training dataset accuracy is greater than the testing dataset accuracy [39]. For CNNs, over-fitting indicates that the model has more filters than needed [39]. To avoid over-fitting, the total network size was decreased by reducing the number of feature maps calculated in each layer by 50% as compared to the original U-Net architecture, which also reduced the number of weights and biases from 31 million to 7.7 million. This reduction resulted in training and testing datasets with similar levels of accuracy. The modified network retained the identical sequences of layers as U-Net and was composed of a contracting path, a bottleneck, and an expansive path (Figure 5). Each successive layer doubled the number of feature maps in the contracting path but halved the resolution of those feature maps by employing convolution and max-pooling operators. The modified network started with calculating 32 feature maps in the first layer, then increased in each successive layer until reaching a maximum of 512 feature maps at the bottleneck. Conversely, in the expansive path the number of feature maps was halved in each successive layer, but the feature map resolution doubled. This path contained convolution and transposed convolution operations. The U-Net CNN architecture made use of high-resolution and low-resolution feature maps to classify the pixels. High-resolution feature maps helped the network identify the context related to each class, while low-resolution maps helped the network better locate those classes. For the CNN training and validation, 78 images were randomly chosen from early-wood and latewood samples at different RH to create ground-truth images. A combination of traditional threshold and manual segmentation using ImageJ [37] was used to create ground-truth images. The number of training images was increased by partitioning the ground-truth images into 588 \(\times\) 588-pixel sub-images and employing data augmentation. The training data augmentation was achieved by rotating each sub-image in five different directions. These operations increased the number of training images from 78 full-size images to 14,010 sub-images with 588 \(\times\) 588-pixel dimensions. Seventy percent of the total sub-images were used for training, while the remaining 30% were used for the model validation. The network was trained using a stochastic gradient descent algorithm [40] for a total of 30 iterations. The training algorithm worked by extracting feature maps from the training images using convolution operators and assigning a weight to each. An error was then calculated using the cross-entropy loss function. The weights were adjusted in every iteration to lower the loss value between the predicted result and the ground-truth image. The result of this training was a CNN that took a single-channel gray-scale image with size 588 \(\times\) 588 pixels and outputted a resulting two-channel CNN image with size of 404 \(\times\) 404 pixels. The two channels corresponded to the probability of the pixel belonging to the cell wall or air class. Because there are only two classes in this segmentation problem, all the segmentation information is included in one channel and the cell wall probability channel was chosen for further analysis. Because the CNN output size was smaller than the input size, partitioning the images into overlapping tiles was necessary to offset information loss. The overlap-tile strategy worked by partitioning the full image into multiple overlapping sub-images with dimensions equal to the CNN 588 \(\times\) 588 pixels input size. The sub-images overlapped sufficiently such that there was no information loss when the smaller 404 \(\times\) 404 pixels output sub-images were pieced back together.