CN7023 Assignment Sample – Artificial Intelligence & Machine Vision 2022

Classification of fruits – data set images using Convolutional Neural Network

Abstract

Agriculture is considered as essential economical as well as social sectors for everyone. Application of innovative technology is being great importance in the field of agri-food. Recently Deep Learning supported classifications are having the potential to identity the images of the fruits. Artificial Intelligence –AI is also an essential tool which is widely applied in recent days.

Convolutional Neural Networks is primary DL architecture for the classification of images. In this research CNN is utilized towards different automation process of tasks such as classification, detection as well as control. There are various image types are applied in the datasets as per the execution of the tasks. This paper describes the sorting fruits as well quality control by the use of CNN.

The application of CNN in this fruit image recognition are raised to obtain best results in recent days either with the application of novel models else networks of pre-trained towards the learning transfer.

Keywords: Convolutional network, Deep Learning, fruit data sets, image classification, python

 

  1. Introduction

Computer vision is widely utilized technical tool in the field of agro-industrial such as automation in harvesting the fruit, machineries for sorting of fruits, scanning of fruits in the supermarkets. The entire vision schemes are includes variety of data which was generated through the sensors and cameras. Because of numerous algorithms as well as computational techniques the desired features are extracted as well processed to execute the respective task in the industrial sector.

For instance there is a requirement in the super market to accurate fruit detection. The systems of AI should have the capability towards acquiring the knowledge, pattern extraction which is otherwise called as machine learning. Hence the techniques of AI are helpful in resolving the complex issues where the conventional techniques are not adequate.

DL is also widely applied ML-based techniques. Its essential feature is that it possess huge abstraction level as well ability towards automatic learning patterns of the images. CNN is a type of ANN- Artificial Neural Network which uses the operations of convolution in one of its layers. It has gained huge popularity as excellent technique for classification of images. In this research fruit classification, detection using Hopfield Neural Network architecture is used along with the confusion matrix and the models are tested for the accuracy of training as well testing.  (José Naranjo-Torres, 2020).

The expected output accuracy is more than 94 % from the proposed Hopfield Neural Network. The research questions will help to support the research in progressive modes.

  • Justify the proposed methodology opted for the image classification
  • What is the implementing procedure when done in MATLAB and Python?
  • How will you describe this proposed architecture provides best results on what background?
  • Describe about different types of datasets available for image classification and give the reason for selecting this fruit data set for image classification.

These types of research questions will help to motivate to find the answers and gives the in-depth knowledge in the classification process.

  1. Literature Review

In this article, the author proposes deep learning methods for the classification. Here the data sets used was Fruits-360 for the purpose of evaluation. (Shadman Sakib, 2019). This research used the images of 17823 from various categories of about 25. The images were divided as training as well test dataset. In order to the accuracy in classification, the author used several combinations of epochs as well hidden layer for separate  cases as well comparison was made betwixt them.

This model uses Adam optimizer, of 0.002 learning rate, and batch size of 15 with 15 epochs. To decrease the error in the training model, little learning rate is essential. This optimization algorithm of Adam is easy to incorporate, needs less memory, proper for issues with gradients of sparse as well effective in computation. It is widely used in the application of DL such as computer vision and processing of natural language.

This article explores the recognition of fruit classifier supported algorithm of CNN, the loss as well as accuracy curves are generated by applying different hidden layer combinations for  about 5 using the data set fruit-360.The greater accuracy cooperates towards simulating the entire performance of machine in recognition of fruit adequately.

In this article, (Shawon Ashraf, 2019), the author describes CNN as the famous class model for recognition of image as well classification. This system proposes a trained dataset of fruit image, detects the fruit whether it is fresh else rotten from the image. This system is built using the model of Inception V3as well trained dataset using the transfer learn. The convolution layers and its features are described and all uses the activation of ReLu.

 For the classification of images to categories this systems applies regression of SoftMax through SoftMax tensor in the flow. This model used for the classification of multiclass as well VGGNet16 to the classification of binary. This system provides solutions to numerous real-time issues such as vegetables, packed items of groceries in the supermarket or stores. Many stores use this automation system to eliminate the human errors as well to decrease the cost of inspection by manual.

This paper deals about the automation in classification of fruits by utilizing computer vision. (Mehenag Khatun, 2020). Recently this computer vision as well as image processing methods is used increasingly in the industry o fruit, particularly in the inspection of quality, color, shape, size, and sorting.

This deals regarding several techniques of image processing utilized for the classification of fruits. While doing shopping, this automation system in classification of fruits will connected to the database information to support the customer towards selecting the good or healthier fruit in addition with the details of nutrition. It uses the process of receiving samples, pre-processing of images and filtration, segmentation, extraction of features, comparison with knowledge-based and the process of decision making.

CNN provides excellent performance towards the classification of fruits in terms of its condition such as healthier or not, along with the details of nutrition.

This article deals with pre as well as post analysis of harvest using the algorithm of machine vision, machine learning. (Aaron Don M. Africa, 2020). Verification of training is will be done to ensure the process is generalized. The model of training will be checked in the phase of test if it is able to predict the dataset with input values. The test as well as train datasets are almost similar to each other.

The execution of prediction in the phase of testing will be regularly compared with the execution of training process for the evaluation. There are varieties of CNN models have been used to detect the fruit such as Faster R-CNN, Mask R-CNN etc. The general program of deep learning involves three stages like training, testing as well as evaluating.

This article, describes classification of image supported on lightweight CNN. (Jose Luis Rojas-Aranda, 2020) It has the goals to speed up the process of check out in the stores. A novel dataset images are initiated which considers three kinds of classes of fruits, inner else without bags.

To raise the accuracy of the classification, various features of input are joined to the architecture of CNN. The inputs are like single color RGB, histogram, as well centroid RGB got from K-means clustering. This scheme uses the TensorFlow with the incorporation of Mobile NetV2 offered by Keras. Standard optimizer of RMSPropOptimizer was applied. The models are trained by applying iMac with 3.5 GHz, 8 GB RAM, DDR3. The author described that, some of the features of the input enhanced the accuracy by joining the data regarding the fruit color.

This system takes 725 images for training as well 342 images for testing. This system offers higher accuracy of the range 0.95.

  1. Methodology

CNN-Frameworks –Fruit classification

It is well known that CNN is a model of DL, and DL is the element or component of ML. There are different frameworks as interface, tool which permits to generate the ML models easily. They are namely TensorFlow, Caffe, PyTorch, MatConvNet, Theano; Matlab Deep Learning Tool Box etc. are referred as best frameworks.  In addition, these must be considered the running as well as hosting platforms of ML establishments, which could be applied to incorporate training model in the environment of external.

The famous platforms are known as Google Cloud, Amazon Web services, Microsoft Azure. These are permits restricted access as free in terms of space and time.

  • Fruit Classification

The classification is to be implemented applying models of pre-trained to give the solution of another perspective in transfer learning. The implementations are coded in Python as well as Matlab, by the application of TensorFlow as well Deep Learning ToolBox. For the purpose of classification, the dataset Fruit -360 was utilized. These are downloaded from Kaggle.com.

It contains the images of 82,213 with the pixels of 100 x 100 of fruits as well as vegetables of classes 120.  These are previously sub divided to test as well training sets. In this research we selected three categories such as Apple fruit, Fig fruit and Lemon Fruit category. . After the categorization, architecture has to be designed. The architecture is comprised of the layers of input, convolution, flattening, fully linked and output.

The model is trained by number of epochs as well as applying Adam optimizer. Initially entire filters are initialized randomly from distribution as well all biases are zero. The dataset are downloaded from Kaggle and that will be imported to using the Google CoLab with Keras as well deep learning.

Architecture of Hopfield is best image classifier for the CNN. It contains two pairs of convolutional, activation as well as pooling layers which is seceded by fully-connected layer, next fully connected, and lastly softmax classifier. This architecture will be incorporated with Keras with Python.  This evaluated from deep learning –computer vision using python.

CN7023 Assignment Sample

Figure 1 Fruit data set – classification of fruit

The architecture design will be import the desired packages of python. The class conv2D is taking care of executing the convolution. The class MaxPooling 2D for the operations of max-pooling, class activation used to specific function of activation. If we prepared to flatten the topology of the network to fully-connected, then dense layers will use the corresponding names of the class.

The function build suggests many parameters like width, height, and depth of the input images. The depth value is 1 for single images and 3 for the RGB images. Classes’ means the required classes we wish to recognize, here it is 3

  • Data sets

 

Total images: 82,213 images (Chris, 2020)

Training set size: 61,488 images;

Test set size: 20,622 images;

Image size: 100 x100 pixels,

 RGB; Number of classes: 120 fruits and vegetables

Later downloading as well as unpacking dataset, there are two folders namely training data as well testing data

  • Network Architecture

CN7023 Assignment Sample

Figure 2: Hopfield Neural network

This network is special type of NN which differs from other networks due to its converging process of iteration. It posses one layer of neurons associated toe the size of input as well as output should be the same. It works like human brain. The condition of a neuron is +1 or 0. It is prepared to save the several patterns else memory, then it will be ready towards recognizing the any of the learned patterns though uncovering corrupted information regarding the pattern.

It has stability in the recognition of pattern. (JavaTpoint, 2019). This framework is created by TensorFlow; initially we need to import the models by using of sequential API. (Russakovsky O, 2015)This permits to stack entire NN layer over the top of one another easily. As already said, imports of Dense, Flatten, Conv2D – these are the layers which are default in the network.

Later, import the sparse categorical crossnetropy towards computing the loss, Adam to optimization as well IDG-Image Data Generator to load the images from the folder. This network serves as content-addressable – associative systems of memory with the threshold of binary nodes. It is a best model for understanding the memory of human kind.

  • Simulations

According to the image representation mapping is done with every pixels of the image the figure 3 shows the training curve of this fruit classification with no. of epochs. The simulation from MATLAB was taken for the training curve.

CN7023 Assignment Sample

Figure 3 Hopfield Neural Network Training Curve

The training as well as validation results are seems to be proper because of the less variability of the utilized dataset. The x-axis indicates the epoch number of training. The models are compiled and the process of training will be initiated.  The configuration choices are both for instantiation as well as training. After the process of training, the evaluation of the model over testing images.

The figure4 shows the Accuracy of the each epoch in the process of classification of fruit. From the image it is clear that the overall training accuracy is 94.21 % It is gradually increases from 93% to 94.21 % of the epochs from 0 to 200. While processing the extra images we have in the data sets will be removed for making the analysis easier. In any datasets we have so many images, according to our requirement we need to take and classify the data for the analysis.

CN7023 Assignment Sample

Figure 4: Accuracy per each epoch- Training

The figure 4 shows the training accuracy of image classification process using the Hopfield NN with MATLAB simulation.

CN7023 Assignment Sample

Figure 5: Accuracy per each epoch- Testing

The figure 5 shows the accuracy of testing as 91.87 %.From the graph it is clear that the graph is increasing gradually from 91 percentages to 91.87 percentages from the epochs 0 to 200. The x-axis represents the number of epochs and the y axis represents the Accuracy in percentage. We know that in neural networks the data sets are separated into training as well testing and a few percentages for validation also.

Hence we need to find the accuracy in training as well as testing. If we observe the two graphs, noticed that almost the accuracy of the training as well as testing is nearer. The accuracy is determined based on the dataset of fruit-360 and the information containments of each epoch in the network. Since the accuracy is more than 94%. The classification of the fruit will be giving accurate results when compared with other traditional methods. Confusion matrix is shown below

CN7023 Assignment Sample

 Figure 6: confusion matrix

The figure 6 shows the confusion matrix of the fruit classification.  It was drawn betwixt the target class and output class. It denotes the mapping of the classification. The first category is mapped with the data sets of 5104 with the accuracy rate of 90.1 % . The second category is mapped with the samples of data set 5092 with the accuracy of 90.5 %.

  Similarly the third category is mapped with the samples of 5101 with the accuracy percentage of 92.5 %. It is the kind of the specification process with different set of data samples and accuracy analysis.

  1. Results and Discussion

 The results are obtained from the MAT LAB simulation, the training and testing accuracy was 94.21 and 91.87 percentages respectively. Similarly confusion matrix results are mapped with different and many data samples with target and output class. For each category of mapping with certain samples the accuracy is 90.1 % , 90.5 % , 92.5 % for the category 1,2,3 and respectively.

From the results it is clear that by making different classes and categories of the samples   the training as well testing accuracy is checked against the classification. The convolution Neural Networks based Hopfield Neural network gives better results than any other networks. Almost more than 5000 images are analyzed in this process of fruit classification. Also it is noted that highly complex models are highly proper for complicated tasks as well data, rather shallow architecture will be proposed.

  1. Conclusion

In this project, the classification of fruits as well as classification of fruit quality are analyzed and implemented using Python, and CNN- supported approaches like Hopfield neural network architecture.  All the approaches of NN always producing the best results, we cannot define the superiority over one another. The evaluation as well as study reveals that this NN approaches for image classification produces up 100 % in few cases.

This research shows that the NN approaches are possible towards using pre-training NN by altering some of the layers as well parameters towards destining the another model. This system will have tremendous growth in the applications of robotics.

  1. References

Aaron Don M. Africa, A. R. V. T. M. A. A. T., 2020. Ripe Fruit Detection and Classification using Machine Learning. International Journal of Emerging Trends in Engineering Research, 8(5), pp. 1-5.

Chris, 2020. How to Perform Fruit Classification with Deep Learning in Keras, s.l.: Machinecurve.

Ismail A, I. M. A. M. ,. P. L., 2019. Investigation of Fusion Features for Apple Classification in Smart Manufacturing. Symmetry, 11(1194), p. doi:10.3390/sym11101194.

JavaTpoint, 2019. Hopfield Netwrok, s.l.: JavaTpoint.

Jose Luis Rojas-Aranda, J. I. N.-V. J. C. C.-T. G. R.-R., 2020. Fruit Classification for Retail Stores Using Deep Learning. Mexican conference on Pattern Recognition, springer.

José Naranjo-Torres, M. M. R. H.-G. ,. R. J. B. C. F. 2. a. A. V., 2020. A Review of Convolutional Neural Network. Applied Sciences, 10(3443), pp. 1-31.

Mehenag Khatun, F. A. N. A. T. J. N. P. S., 2020. Fruits Classification using Convolutional Neural Network. GRD Journals- Global Research and Development Journal for Engineering, 5(8), pp. 1-7.

Mureşan H, O. M., 2018. Fruit recognition from images using deep learning. Acta Universitatis Sapientiae Informatica , 10(1), pp. 26-42.

Rosebrcok, A., 2017. Image classification with Keras and deep learning, s.l.: Puimagesearch.

Russakovsky O, D. J. ,. e. a., 2015. Imagenet large scale visual recognition challenge.. Int. J. Comput. Vis., 115(3), pp. 211-252.

Shadman Sakib, Z. A. M. A. B. S., 2019. Implementation of Fruits Recognition Classifier using Convolutional Neural Network Algorithm for Observation of Accuracies for Various Hidden Layers. ArXiv e-Journal, Volume https://arxiv.org/ftp/arxiv/papers/1904/1904.00783.pdf, pp. 1-4.

Shawon Ashraf, I. K. M. A. A. C. T. Z. M. R. M. R., 2019. Fruit Image Classification Using Convolutional Neural Networks. International Journal of Software Innovation, 7(4), pp. 51-70.

Know more about UniqueSubmission’s other writing services:

Assignment Writing Help

Essay Writing Help

Dissertation Writing Help

Case Studies Writing Help

MYOB Perdisco Assignment Help

Presentation Assignment Help

Proofreading & Editing Help

Leave a Comment