## 2 Structure of Quality Grading System  
This study has been applied and put into practice to experiment in many orchards in Vietnam. The hardware of the grading system is shown in Figure 1. To acquire the data from captured images and evaluate geometric parameters of mangoes, several models are employed. The signal of weight is taken from the load-cell and processed to give weight shown in Figure 2. The signal from the load-cell is eliminated noise by Kalman filter. A system in Figure 1 is designed and developed for this study. The sorting system consists of two main parts. The first part is the image processing system that implements conventional image processing using a series of algorithms that convert unstructured data into structured data to extract three external features such as length, width, and defect. The external features of mangoes can be extracted by various methods such as image processing, ML, and deep learning. In this study, the image processing is more efficient, because of its fast processing time without a large training dataset. This method changes processing parameters, which are determined more difficult in both ML and deep learning. The extracted features of the captured image are combined with weight to generate a full data set in order to leverage machine learning models. The second part is the weighting and grading system to classify mango into \(G_{1}\), \(G_{2}\), and \(G_{3}\). In the sorting system, the mangoes enter the vision chamber by a roller conveyor system. During movement, the mango is rotated around the roller axis and captured at different positions by a camera to accurately predict its external features. The mangoes then move into the tray conveyor to weigh and sort them based on the central processing signal. After that, in the central processing unit, the mangoes' weight and external features are combined to generate a data set which prepared for the training in ML models. The unstructured data is converted to structured data, then it is put into models of ML to predict the grades. Last but not least, the data transmission is carried out on the server to ensure all processed data in the best. Figure 1: Mango grading and sorting system used in the study. Figure 2: The process of weight system. (**a**) The load-cell in system; (**b**) flowchart of load-cell signal processing. The density depends on weight and volume which is a function of size. The change in weight and size of mangoes gradually increases with the mango's quality. The quality parameters such as size, shape, color, total soluble solids (\(TSS\)), acidity, pH, physiological weight, juice, pulp, and moisture content are important for evaluating the external and internal qualities. They are determined by various parameters, which involve \(NDT\) techniques. However, the most important parameter is sweetness from evaluating the internal quality. The sweetness of mango depends on its density. Mango of high density has the better quality in the range of more than 1.0. The most sort after mangoes have characteristics such as bright yellow skin and sweetness. In contrast, a mango with a lower density than 1.0 is of poor quality; it could be sour because of lack of nutrients in the maturity stage. Figure 3 shows relationship between sweetness and density. Therefore, weight a factor to classify quality along with size and defect. The operating procedure of the system is summarized in Figure 4. Input data is processed and then ML is applied to classify mango simultaneously by the central processor. The input data undergoes several image processing algorithms to achieve structured data including length, width, defects, and weight, then saves all this data to the server. At the same time, the central processor takes data from the server to train the model and then gives predictions whether the mango is \(G_{1}\), \(G_{2}\), or \(G_{3}\).