# Machine Learning-Based Classification of Mushrooms Using a Smartphone Application
## 4 Discussion  
A large number of established machine learning algorithms were previously tested against the standard datasets from the UCI machine learning repository [22]. Among the available datasets exists one for mushrooms; this dataset could be used to train and test newly developed applications. One of the limitations of utilizing this database is that the \begin{table}
\begin{tabular}{c c c c c c} \hline \hline  & & **Pixel 2** & **Nexus 5** & **Galaxy s8** & **Galaxy Note 20** \\ \hline \multirow{3}{*}{_Cantharellus_} & sensitivity & 0.875 & 0.8936 & 0.8936 & 0.8936 \\ \cline{2-6}  & specificity & 0.9882 & 0.9883 & 0.9883 & 0.9882 \\ \cline{2-6}  & accuracy & 0.9633 & 0.9679 & 0.9679 & 0.9677 \\ \hline \multirow{3}{*}{_Pleurotus_} & sensitivity & 0.9792 & 0.9792 & 0.9792 & 0.9792 \\ \cline{2-6}  & specificity & 0.9824 & 0.9824 & 0.9824 & 0.9822 \\ \cline{2-6}  & accuracy & 0.9817 & 0.9817 & 0.9817 & 0.9816 \\ \hline \multirow{3}{*}{_Tricholoma_} & sensitivity & 0.8444 & 0.8636 & 0.8636 & 0.8636 \\ \cline{2-6}  & specificity & 0.9653 & 0.9655 & 0.9655 & 0.9653 \\ \cline{1-1} \cline{2-6}  & accuracy & 0.9404 & 0.945 & 0.945 & 0.9447 \\ \hline \hline \end{tabular}
\end{table} 
Table 4: _Cont._  
Figure 7: Comparison of relative accuracy when image sizes are varied. (**A**) For 3-class model (**B**) 5-class model. When image size falls below 20–25%, overall accuracy decreases to ~80% range. image features used by machine learning have already been extracted. While this works fine in some experimental settings, it is not trivial to consistently extract those morphological features of mushrooms in the real-life mushroom foraging situation. Additionally, relying on the phenotypic mushroom characteristics alone would ignore informative descriptors indicative of the mushrooms' growth environments, such as surrounding nature. Additionally, various mushroom orientations (top view, front view, under the cap view), and different sizes (zooming) effects, into a single machine learning platform. Therefore, users could simply take images with their smartphones, and a pre-trained library (for remote locations with unreliable network access) or a server-based library could be used to provide accurate classification of the mushroom species. Our training data accurately reflect the reality of mushroom foraging. The data includes various image perspectives (photographs from various angles, photographs under the cap, images displaying the front, top, and side, etc. ), and the surrounding environment. In addition, as shown in Figure 2, the collection of mushroom images may involve taking a large number of consecutive photographs and sorting them by collection identification numbers. At the earlier stage of the app development, we added to the data input a collection identification feature so that all the images on the phone were classified with their unique collection numbers (Figure 5C). Since the offline classification was conducted on the spot, all the longitude and latitude information was also saved for easy tracking of the geographical location of each collected sample. We have previously discussed the advantages and disadvantages of server-based and mobile testing [4]. While the server-based method is more flexible and constantly refreshes the up-to-date models for better accuracy, smartphone-based testing conducts the classification without any network service present. Most wild-mushroom foraging happens in remote areas of the natural habitat lacking reliable network service. Therefore, offline, on-phone training was a critical feature to implement in this study. However, training deep neural networks on a smartphone is so difficult that implementing this feature would be impractical. Consequently, transferring the pre-trained model from the server was the most logical course of action. The results were dependent on the classifier and the number of classes.