**CamPauh: Image Recognition for Mango Type Detection**

**Mohamad Shahmil Saari<sup>1</sup>, Romiza Md Nor<sup>2\*</sup>**

*<sup>1,2</sup> Faculty of Computer and Mathematical Sciences, Universiti Teknologi MARA, 02600 Arau, Perlis, Malaysia*

***<sup>2</sup>romiza@uitm.edu.my***

**ABSTRACT**

*Convolutional neural networks are popular today because of their specialty in the recognition of the image. It also can be thought of as an automatic feature extractor from the image. Therefore, this project is developed to recognize the mango type based on its texture. In this project, the framework that is used is TensorFlow and Keras and it is written using Python language. This project will use Mobile Net architecture model because it consumes less computational power and it also can provide efficiency of the accuracy. CamPauh is developed to recognize four classes of mango which are Harumanis, apple mango, other type of mangoes and not mango. CamPauh is a web-based where users ca recognized the mango and the result will be stored into the database and it will appear on the website. In this paper evaluation on the accuracy is discussed to support users’ satisfaction in identifying the correct mango type.*

***Keywords**: image recognition, fruit texture**,** convolutional neural networks*

**NTRODUCTION**

Today, mango is an important commercial crop not only in India but also in Indonesia, Thailand, and Malaysia. In Peninsular Malaysia, there are over three hundred cultivars with fruits considerably in size, shape color, flavor and fiber content. For example, Harumanis mango cultivar is special to Perlis (north state of Malaysia) and has been declared in the national agenda as a specialty fruit from Perlis for the world (Farook et al., 2013). Perlis has exported Japan 3.1 tons and the export market was targeted at increasing to 100 metric tons, by 2020. According to Ramli (2017), some dishonest traders claim other mango types to be the iconic Harumanis which they will sell other mango varieties at a premium price. Some trader also put false labels where many visitors or tourists will think that they are purchasing Harumanis mangoes.

Therefore, in order to know the physical characteristics of Harumanis mango is through the shape where it is like an elevated ventricle shoulder, an oval shape, around top, dark green colors and an aromatic smell were important for the public to learn and aware.

Recently, the recognition process of Harumanis mangoes are being done manually. As a result, this image recognition for mango type detection is build up to reduce the time of farmers and plantation agencies. Besides that, more profit cab be gained by reducing detection time and result is more accurate. Harumanis mangoes tree can produce many tons of mangoes and it brings a problem to plantation agencies to grade them. Harumanis and it is difficult to tell the distinction to those who are not acquainted with aromatic mango. Next, by using image recognition customers do not need to know about Harumanis feature details because image recognition technique would come out with the algorithm to recognize the mango.

The purpose of this study is to solve customers’ problems instead of buying fake mango by developing image recognition application to identify the accuracy of mango type based on their texture. In this project, image recognition is applied because it could deal with large number of database and automatically identify objects. Hence, with this technique, it can help humans by identifying objects more precisely.

**RELATED WORKS**

Image recognition is an important task of computer vision where it will provide the algorithm to a computer to understand images. Image recognition is the potential of systems or code to identify images objects, individuals, places, and behaviour, using artificial intelligence vision technologies and qualified algorithms for camera-based image recognition (Gupta, 2019). In many fields and areas, including the agricultural sector, image recognition technology has become possible and more important. Intermittent weights on the neural networks are modified to enhance the accuracy of the system to identify images in order to increase the exactness of the systems. The essential analysis technique or model of this project is convolutional neural network. According to Basri et al (2019), this method is particularly suitable for the creation of a multi-fruit in real-time classification sorter with the camera and for the detection of moving fruit. Furthermore, the accuracy of the image classification can be improved by increasing the number of datasets, the distance of images from the camera, and the labelling process. The software or framework that being chosen is TensorFlow because of being easily learned and worked with and provides easy ways to express how high-level abstractions can be connected. TensorFlow applications can be run at most convenient goals, iOS and Android phones, local computers, clusters in the cloud, CPUs or GPUs**.**

Arivazhagan (2010) in his project has recognized the fruit's intensity, color, shape, and texture of four fundamental properties. This work is involved in two sections which are training and classification. The number of datasets per class taken is between 75 to 264. According to Arivazhagan (2010) stated that the recognition system shape and size features can be combined with colors and texture features to enhance usability and versatility. The increase number of images in the database also can increase the recognition rate. Furthermore, Basri (2019) in his research in detecting multi-fruit classification. The input used is a mango and pitaya fruit. The real dataset is taken from a farmer at harvest time and then create in two-class, the classification of train objects is mango and pitaya. The analysis technique used is Faster R-CNN. It is a completion of R-CNN and Fast R-CNN techniques for solving problems of image classification. The resulting accuracy of this analysis technique can reach 99%. The appropriate labeling process in the image and the randomly selected image will ensure the accuracy of the data. The analysis technique is useful for developing in real-time with the camera a sorting system for the identification and detection of moving fruits. Therefore, in this paper the essential technique or model of this project is convolutional neural network. According to Basri et al.,(2019) that this method is particularly suitable for the creation of a multi-fruit in real-time classification sorter with the camera and for the detection of moving fruit. Furthermore, the accuracy of the image classification can be improving by increase the number of datasets, the distance of images from the camera, and the labelling process. The software or framework that being chosen is TensorFlow because of being easily learned and worked with and provides easy ways to express how high-level abstractions can be connected.

**METHODOLOGY**

Figure 1 shows the experimental design that illustrated the flow and operation of CamPauh Firstly is preparation of dataset which consist of the images of different type of mangoes such as Harumanis, apple and others and other type of fruits that is not in mango family are also collected. Four types of this mango are defined as class in this project. Each class need 400 images. The increase of number image collected enhance the accuracy of this project. Next is training images and saved model using TensorFlow and Keras by applying Mobile Net model or architectures. This is important step where to enhance the degree of accuracy, number of training steps also need to be increased. Following is creating GUI using Tkinter using Python. Tkinter load the model and labels of saved images. Classification are also created to allow users to select the image that they would like to classify or recognize. Besides that, stored result to database also written to enable the website to provide information to the user. Lastly is creating website (Figure 2) for CamPauh to let users to view the history of recognized images and to provide a graph to help users identify the mango type.

> ![](153-1-385-1-2-20200902_media/media/image1.png)
> 
> Figure 1: Experimental design of CamPauh
> 
> ![](153-1-385-1-2-20200902_media/media/image2.png)
> 
> Figure 2: CamPauh website

**FINDINGS AND DISCUSSION**

In this project, functionality testing, usability testing and accuracy evaluation have been done by 30 respondents. In this paper, only accuracy testing result is discussed.

![](153-1-385-1-2-20200902_media/media/image3.png)

Figure 2: Result is accurate

Figure 2 shows that most of the respondents agreed on the CamPauh accuracy. This is proven when every time users recognize the mango types it provides the accurate result. This is due to CamPauh has collected many images to the dataset to make sure that result is accurate and to increase number of training steps which can enhance the accuracy of the result.

![](153-1-385-1-2-20200902_media/media/image4.png)

Figure 3: CamPauh accurate mango type

Figure 3 shows the result that most respondents agree that CamPauh managed to give accurate result on mango types. This is because during the training data, CamPauh has met the range of training data process of no overfitting and underfitting. Overfitting means that the dataset is training too long where underfitting is the model is not enough training. Overfitting training can be solved by increasing the number of data and underfitting can be solved by training the dataset in a longer time range.

In this project, to calculate the accuracy of CamPauh is using confusion matric technique. The confusion matrix is a table that is used to define the output of a classification model on a collection of test data for which the true values are known. It enables the visualization of the output of an algorithm. Figure 4 shows the number of samples from every class that is used to calculate the accuracy of CamPauh. Each class has six samples. Every sample is renamed from 1 to 6 in the JPEG format images. The actual images is sort in the correct folder before it is recognized using CamPauh. There are 24 images selected as a sample to calculate the accuracy of CamPauh. CamPauh will recognize the images and provide the result such as prediction name or label and the accuracy score. The acceptable accuracy score from the system is 0.8 to 1.0.

![](153-1-385-1-2-20200902_media/media/image5.png)

Figure 4: Testing sample from CamPauh

Every single result is recorded as shown in Table 1. The green highlight in Table 1 means the accurate prediction of the images. The correct prediction means that the images that the system predict is correct and correct labels is provided with the accuracy percentage is 0.8 and above. There are 21 images that get accurate prediction where three of the images are not accurate prediction. Not accurate prediction images are highlighted in red. The incorrect prediction will have the lowest accuracy score.

Table 1: Prediction table

![](153-1-385-1-2-20200902_media/media/image6.emf)Table 2: Confusion matrix table

|        | **Predicted** | **Predicted** | **Predicted** | **Predicted** | **Predicted** |
| ------ | ------------- | ------------- | ------------- | ------------- | ------------- |
| Actual |               | Harumanis     | Apple Mango   | Other Mango   | Not Mango     |
| Actual | Harumanis     | 5.8836        |               |               |               |
| Actual | Apple Mango   |               | 5.7423        |               |               |
| Actual | Other Mango   | 0.4893        |               | 4.7376        |               |
| Actual | Not Mango     |               | 1.1841        |               | 3.9122        |

Table 2, it shows the confusion matrix table for CamPauh. It shows the calculation on the accuracy of CamPauh where the number of total correct prediction is sum up and divided with the total number of classifications. The green highlight indicates the correct number prediction where red is incorrect prediction.

Table 3: Accuracy result from prediction result and confusion matrix

<table>
<thead>
<tr class="header">
<th>Total correct prediction:</th>
<th><ul>
<li><p>Harumanis = 5.8836</p></li>
<li><p>Apple Mango = 5.7423‬</p></li>
<li><p>Other Mango = 4.7376</p></li>
<li><p>Not Mango = 3.9122</p></li>
</ul>
<p>Total=<strong>20.2757‬</strong></p></th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>Total incorrect prediction:</td>
<td><ul>
<li><p>Harumanis = 0</p></li>
<li><p>Apple Mango = 0</p></li>
<li><p>Other Mango = 0.4893</p></li>
<li><p>Apple Mango = 1.1841</p></li>
</ul>
<p>Total=<strong>1.6734</strong></p></td>
</tr>
<tr class="even">
<td><p>Total number of predictions = total correct prediction + total incorrect prediction</p>
<p>20.2757+1.6732</p>
<p><strong>21.9491</strong></p></td>
<td></td>
</tr>
<tr class="odd">
<td><p>Accuracy = Sum of correct prediction / Total number of predictions</p>
<p>20.2757‬ / 21.9491</p>
<p><strong>Accuracy = 0.9238 =&gt; 92%</strong></p></td>
<td></td>
</tr>
</tbody>
</table>

Table 3 shows the accuracy result that is determined by prediction results where it is clearly shown the accuracy is 92%. The result shows that user is aware and confirmed the type of mango and this will decrease of possibility for user to buy the type of mango that they prefer, Harumanis for example.

**CONCLUSION**

Image recognition is a technique to identify images objects, individuals, places, and behavior, using artificial intelligence vision technologies and qualified algorithms for camera-based image recognition. In this project, image recognition is aimed to predict the actual mango types and reduce the time of users to choose the right mango type. This project also aimed to provide the high accuracy of result where it is satisfied the user. In CamPauh, there are four mango class created as Harumanis, apple mango, other mango types and not mango. The simple graphical user interface created to help the users understand and easy to use this system. This project managed to complete and achieved the objectives which are to develop and to evaluate the accuracy of mango type based on their texture properties. The accuracy of the system has been tested using a confusion matric algorithm with accuracy that reached 92percent.

Nevertheless, there are also recommendations for this project for future study. Firstly, his system can be improved their accuracy by increase the number of datasets. Secondly, for more efficiency of the system, researcher can deploy recognition system into the mobile application by using TensorFlow Lite. This will allow users to use directly from their smartphones. Lastly, this system should allow user to recognize many images at a time. This will reduce users' time to detect their mango types.

**REFERENCES**

Arivazhagan. (2010). Fruit Recognition using Color and Texture Features. Journal of Emerging Trends in Computing and Information Sciences, (October), 1–5.

Basri, R., Jacobs, D., Kasten, Y. and Kritchman, S. (2019). The convergence rate of neural networks for learned functions of different frequencies. In Advances in Neural Information Processing Systems.

Farook, R. S. M., Ali, H., Harun, A., Ndzi, D. L., Shakaff, A. Y. M., Nor Jaafar, M., Aziz, A. H. A. (2013). Harumanis Mango Flowering Stem Prediction using Machine Learning Techniques. Research Notes in Information Science (RNIS), 13(May), 46–51. https://doi.org/10.4156/rnis.vol13.10

Gupta S. (2018). Understanding Image Recognition and Its Uses. Retrieved from <https://www.einfochips.com/blog/understanding-image-recognition-and-its-uses/>

Jalled, F., & Voronkov, I. (2016). Object Detection using Image Processing, 1–6. Retrieved from http://arxiv.org/abs/1611.07791

Mustakim Ramli. (2017, April 11). Fake 'Harumanis': Perlis to work with Domestic Trade Ministry to Monitor Traders. Retrieved from https://www.nst.com.my/news/nation/2017/04/229549/fake-harumanis-perlis-work-domestic-trade-ministry-monitor-traders

Singh, R. (2019, June 10). Computer Vision? An Introduction. Retrieved from https://towardsdatascience.com/computer-vision-an-introduction-bbc81743a2f7
