# A Real-Time Nut-Type Classifier Application Using Transfer Learning
## 1 Introduction
[10] develops a mobile application that analyzes the nutritional value of a food item captured via a camera to help people to live a healthy life. The authors state that their framework can achieve 85% accuracy for food recognition. Ref. [11] aims to recognize Korean foods offered in restaurants and stores. The authors propose a custom learning model based on CNN and state that the model achieves 91.3% accuracy for food prediction. It can be argued that the classification of ready-to-eat food or unpackaged products of larger sizes becomes more straightforward using basic image processing techniques, as applied in [12; 13]. On the other hand, smaller products such as nuts are somewhat more difficult to classify. In addition, there might be some customer-related issues when paying for unpackaged products. For example, a customer may inadvertently select the wrong product to pay for (or maliciously quote a lower price for another product) during the payment process at existing retail payment terminals [14]. Therefore, a smart solution is needed to digitize the process of purchasing unpackaged products. Nuts are a product used in many industries, as well as being widely consumed as unpackaged products sold in nut stores and shopping centers [15; 16; 17]. The digitalization of society has also generated AI solutions for classifying different nut types for daily routines. There have been attempts in the literature to classify different nuts or determine the species and maturity level of a specific kind of nut by utilizing image-processing techniques and AI models. Ref. [18] classifies the cashew species into five categories based on adulteration. The authors propose to use DCNN and utilize a transfer learning (TL) architecture for model training. Eventually, they state that an accuracy of 98% is achieved in classifying first-class cashews. Ref. [19] classifies different species of pine nuts by utilizing spectroscopy and image analysis for a dataset of pine nuts. The authors state that an accuracy of 95% is achieved when NIR spectroscopy is used. In [20], the authors classify 11 different types of nuts and obtain 97% accuracy using the ResNet architecture. Moreover, they achieve an accuracy rate of 97% using ResNet-50 and 98% using DesNet-201. The study can be criticized for only representing theoretical results rather than a practical implementation. Even though the studies in the literature produce satisfactory results with high accuracy values for different unpackaged products marketed in the studied shops, most of them are not validated through real-time application by end-users. In a real-world solution, a practical application should continuously capture images from a video stream and classify the content according to the learning model. Moreover, the classification effort is intensive in the existing studies, which try to provide proper image processing techniques and convenient learning models. On the other hand, the TL can be consulted to reduce the effort for both owing to its capability to exploit existing knowledge. More specifically, there are known TL architectures including thousands of image samples and an underlying learning architecture. Hence, considering the aforementioned motivations, in this study, a nut-type classifier based on the TL is proposed to provide a practical smart application for nut sellers. The main contributions presented in the study are stated as follows:  
* A dataset of 1250 images of 5 different nut types is constructed by providing nut images from both online sources and manually taken pictures. * The TL is applied to the nut-type classification problem, and four different TL architectures are consulted to train classifier models on the dataset. Moreover, a custom CNN model is trained to compare the success of TL models. * A practical application developed using the Python language is presented to detect and recognize nuts in real time.