# A Low-Cost Automated Digital Microscopy Platform for Automatic Identification of Diatoms
## 2 Materials and Methods
### Deep Leaning Applied
#### 2.6.2 Automatic Classification  
Diatoms' classification--deciding the specific taxon for a diatom--constitutes a big challenge even for expert diatomists. The countless number of unknown species and the subtle differences among specimens belonging to the same taxon make the task of classifying diatoms a bottleneck in many research endeavors that depend on it [58]. Thus, automatic classification becomes a very interesting topic with a worthwhile reward. The application of machine learning algorithms like Decision tree ensembles has produced very promising results [45] with average accuracies ranging from 96.17%--in studies with 55 taxa distributed into 1098 samples--to 97.97%--for 38 taxa distributed into 837 samples. In works carried out by the authors [52], these results were improved to 98.11%--for 80 taxa distributed into 24,000 samples--after an exhaustive study of 273 features including morphological, statistical, textural, and space-frequency descriptors. As mentioned in the results of these previous studies, the performance of classification relies strongly on a convenient handcrafted selection of image descriptors followed by a smart reduction to the most discriminant ones. One of the great advantages of applying neural networks to classification tasks derives from their capacity to discover features by learning (i.e., generalization). Thus, we decided to carry out a study using convolutional neural networks (CNNs) to classify diatoms and to compare its performance against the noted classical methods that require the selection of handcrafted descriptors. The dataset was obtained by the annotation of sample images--labeled with locations and corresponding diatom taxa also used for automatic detection--using the VGG Image Annotator (VIA) [64]. VIA is an image annotator tool with a web interface that generates a JSON file for modelling the ground truth (GT) image set. After image annotation, every single diatom specimen is cropped from its original image to obtain the 8000 annotated images--with 100 images on average per each of the 80 included taxa--that constitute the public AQUALITAS dataset [18]. Several data augmentation techniques (e.g., rotation and flipping) have been applied to get bigger datasets and to analyze the influence of samples per class--with 300, 700, and 1000 images per class. Moreover, other influences have been tested (e.g., illumination conditions) including diversity in the dataset by:  
* Image segmentation for background elimination and
* Histogram normalization by histogram matching based on specific samples with good contrast. Table 2 summarizes the 80 diatom taxa classified, including the number of samples for each taxon in the initial (i.e., original) dataset. Therefore, several datasets were obtained to perform the experiments and to study the classification performance reached under the influence of the number of samples per class--images per taxon--in different datasets: (A) original, (B) segmented, (C) normalized, and (D) original plus normalized. Note that each dataset was augmented to obtain several distributions of images per class. To achieve the automatic classification of diatoms over the 80 possible taxa in the previously mentioned datasets, the CNN architecture AlexNet [73] was selected. This network is well established as a baseline for experimentation in the deep learning field [51]. Moreover, it provides the advantageous possibility of using transfer leaning--starting with a pretrained net--to drastically reduce the time for the training stage, also known in this case as fine-tuning the CNN. Since AlexNet was pretrained with ImageNet [74], it was tuned by training with an initial leaning rate of 0.001, decreasing by a factor of 0.1 and a period of eight. The selected optimizer was SGD with L2-regularization of 0.004 to prevent overfitting. Moreover, AlexNet allows additional strategies to cope with overfitting like dropout and the previously mentioned data augmentation. The final layer of AlexNet has a node corresponding to each class.