Fruit-Classification Report
Fruit-Classification Report
Fruit-Classification Report
B. M. S. COLLEGE OF ENGINEERING
(Autonomous Institution under VTU)
BENGALURU-560019
April-2023 to July-2023
1
B. M. S. College of Engineering,
Bull Temple Road, Bangalore 560019
(Affiliated To Visvesvaraya Technological University, Belgaum)
Department of Computer Science and Engineering
CERTIFICATE
This is to certify that the project work entitled “Fruit Classification using CNN” carried out by
Varun Urs (1BM20CS182), Vinay Kulkarni (1BM20CS188), Tushar BT (1BM20CS174)
and Aditya B N (1BM20CS193) who are bonafide students of B. M. S. College of Engineering.
It is in partial fulfillment for the award of Bachelor of Engineering in Computer Science and
Engineeringof the Visvesveraiah Technological University, Belgaum during the year 2023. The
project report has been approved as it satisfies the academic requirements in respect of Project
Work-4 (20CS6PWPW4) work prescribed for the said degree.
External Viva
1.
2.
2
B. M. S. COLLEGE OF ENGINEERING
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
DECALARATION
We also declare that to the best of our knowledge and belief, the development reported here is not
from part of any other report by any other students.
Signature
Varun Urs(1BM20CS182)
Vinay Kulkarni(1BM20CS188)
Tushar B T(1BM20CS174)
Aditya Basavaraj Nagathan(1BM20CS193)
3
1. Introduction
Advancements in computer vision, coupled with the rise of deep learning algorithms, have
transformed the landscape of pattern recognition. CNNs, a class of deep neural networks
specifically designed to analyze visual data, have emerged as a dominant force in image
classification tasks. These networks mimic the complex workings of the human visual system,
enabling machines to extract intricate features and patterns from raw images with remarkable
accuracy.
Our project harnesses the potential of CNNs to build a robust fruit classification system capable
of accurately identifying a wide array of fruits. By training the network on vast datasets
comprising various fruit species, shapes, colors, and textures, we empower our model to learn
and generalize the distinguishing characteristics of each fruit class. As a result, our system can
swiftly analyze fruit images and assign them to their respective categories, assisting in tasks such
as quality control, inventory management, and crop yield estimation.
Through our fruit classification project, we aim to unlock a multitude of potential applications.
From assisting farmers in automating fruit grading and sorting processes to aiding consumers in
making informed nutritional choices, our CNN-based system holds the promise of transforming
the way we interact with fruits. Join us on this captivating journey as we explore the intersection
of technology and nature, unraveling the sweet secrets hidden within the vast world of fruits.
we aim to streamline fruit classification processes, improve productivity, reduce human errors,
and enhance decision-making capabilities in the fruit-related industries. Additionally, the
development of an automated fruit classification system will pave the way for advancements in
quality control, inventory management, crop yield estimation, and enable consumers to make
informed nutritional choices based on accurate fruit identification.
1.1 Motivation:
• Automated Identification: The project aims to automate fruit classification using CNN
technology, enabling rapid and accurate identification based on visual features.
• Efficiency and Cost Reduction: By reducing labor costs and streamlining supply chains, the
system offers optimized processes for farmers and distributors.
• Improved Quality and Consistency: Consumers benefit from higher quality fruits with
precise grading, ensuring consistent results and enhanced satisfaction.
• Technological Advancement: The project represents an advancement in agricultural
technology, utilizing deep learning and CNNs to revolutionize fruit production and
distribution.
• Sustainable Practices: By promoting automation and reducing dependency on manual labor,
the system contributes to a more sustainable approach in the fruit industry.
4
1.2 Scope of the Project:
The project "Fruit Classification System using CNN" encompasses several key components.
It involves collecting and preprocessing a diverse dataset of fruit images. A specialized CNN
model will be developed, trained, and evaluated for accurate fruit classification. A user-
friendly interface will be created, integrating the trained model to provide real-time fruit
classification results. Rigorous testing and optimization will be performed to ensure accuracy,
efficiency, and scalability. Comprehensive documentation will be maintained, including
dataset details and model architecture. The project aims to deliver a robust Fruit Classification
System using CNN technology for practical use.
5
2. Literature Survey
1. A Comprehensive Survey of Image-Based Food Recognition and Volume Estimation
Methods for Dietary Assessment
The paper provides a comprehensive overview of image-based food recognition and volume
estimation methods used in dietary assessment. It covers various techniques, including deep
learning-based approaches, segmentation algorithms, and 3D reconstruction. The survey
highlights the strengths and limitations of each method, offering insights into the current
state-of-the-art in this field.
4. On Plant Detection of Intact Tomato Fruits Using Image Analysis and Machine
Learning Methods
The paper explores the use of image analysis and machine learning methods for on-plant
detection of intact tomato fruits. It investigates techniques for accurately identifying and
localizing tomatoes on plants, contributing to the automation and efficiency of fruit detection
processes.
6
7. Automatic Fruit Detection System using Multilayer Deep Convolution Neural
Network
The paper presents an automatic fruit detection system based on a multilayer deep
convolutional neural network. The model is designed to accurately detect and classify fruits
in images, showcasing its potential applications in fruit-related industries and processes.
10. A Deep Multi-Attention Driven Approach for Multi-Label Remote Sensing Image
Classification
This paper introduces a deep multi-attention driven approach for multi-label remote sensing
image classification. The model utilizes attention mechanisms to focus on informative
regions and extract discriminative features for accurate classification of remote sensing
images with multiple labels.
7
13. Deep Convolution Neural Network Sharing for the Multi-Label Images
Classification
The paper presents a deep convolutional neural network (CNN) sharing approach for multi-
label image classification. It proposes a framework that allows CNNs to share knowledge
across multiple label spaces, improving the performance and efficiency of multi-label
classification tasks.
8
3. Design
9
3.2 Detailed Design
10
3.4 Use Case Diagram
11
4. Implementation
• Input Layer: The input image size is set to 100x100 pixels with three color channels (RGB).
• Convolutional Layers: We apply three pairs of 2D convolutional layers with a kernel size of
3x3. These layers are responsible for learning spatial features from the input images.
• Max-Pooling Layers: Following each convolutional layer, we apply a max-pooling layer with
a pool size of 2x2. Max-pooling reduces the spatial dimensions of the feature maps, helping
to extract more robust and invariant features.
• Flatten Layer: After the last max-pooling layer, we flatten the feature maps into a 1-
dimensional vector. This step allows us to connect the CNN's convolutional and pooling layers
to the subsequent fully connected (dense) layers.
• Dense Layers: We introduce two dense layers in our model. The first dense layer has 128
number of neurons, Activation functions like ReLU is applied to introduce non-linearity and
improve model performance.
• Output Layer: The final dense layer consists of neurons equal to the number of fruit classes we
want to classify which is 36. We apply a softmax activation function to normalize the output
into a probability distribution, indicating the likelihood of each class.
12
4.3 Tools and technologies used
• Google Colab for model training.
4.4 Testing
In the fruit classification project using the Kaggle dataset, the testing of the model is
performed based on a separate testing dataset. Here's an overview of how the testing is
conducted:
1. Dataset Split: Initially, the original Kaggle dataset is divided into two main subsets: the
training set and the testing set. The training set is used to train the CNN model, while the
testing set is kept separate and used exclusively for evaluation purposes.
2. Training Phase: During the training phase, the CNN model is trained using the training
dataset. The model learns to extract relevant features from the fruit images and make
predictions based on the provided labels. The training process involves iterations (epochs)
where the model's parameters are adjusted to minimize the training loss and improve accuracy.
3. Testing Set: After the model is trained, the testing set comes into play. The testing set
contains fruit images that the model has not encountered during the training phase. These
unseen images are used to evaluate the performance and generalization ability of the trained
model.
4. Prediction: The testing set is fed into the trained CNN model. The model generates
predictions or class probabilities for each image in the testing set. The predictions indicate the
fruit class that the model believes the image belongs to.
5. Evaluation: The predicted fruit classes are compared to the ground truth labels of the testing
set. Evaluation metrics, such as accuracy, precision, recall, and F1 score, are calculated to
assess the performance of the model on the unseen data. These metrics provide insights into
how well the model generalizes and accurately classifies the fruits in the testing set.
13
5. Results and Discussion
14
6. Conclusion and Future Work
The CNN fruit detection model has shown promising results in accurately identifying and
classifying fruits. Future enhancements can involve expanding the dataset, leveraging
transfer learning, applying augmentation techniques, incorporating fruit quality assessment,
and focusing on deployment and integration. These improvements will enhance the model's
performance, generalizability, and usability in various industries. By collecting a larger and
more diverse dataset, the model can handle variations in fruit appearance. Transfer learning
and fine-tuning on pre-trained models can accelerate convergence and improve overall
performance. Augmentation techniques aid in robustness and reduce overfitting.
Incorporating fruit quality assessment allows for automated quality control. User-friendly
interfaces and APIs facilitate seamless integration. These enhancements will unlock new
opportunities for the model in agriculture, food processing, retail, and other sectors.
To summarize, future enhancements for the CNN fruit detection model include expanding
the dataset, leveraging transfer learning, applying augmentation techniques, incorporating
fruit quality assessment, focusing on deployment and integration, utilizing ensemble
methods, enabling real-time implementation, considering scalability and advanced
technologies, addressing biases, and fostering collaborations. These improvements will
further enhance the model's accuracy, reliability, and relevance in fruit-related industries and
applications.
15
References:
[1] Ghalib Ahmed Tahir and Chu Kiong Loo “A Comprehensive Survey of Image-Based Food
Recognition and Volume Estimation Methods for Dietary Assessment” Published online 2021 Dec
3. Doi: 10.3390/healthcare9121676
[2] Sa, I.; Ge, Z.; Dayoub, F.; Upcroft, B.; Perez, T.; McCool, C. DeepFruits: A Fruit Detection
System Using Deep Neural Networks. Sensors 2016, 16, 1222. https://doi.org/10.3390/s16081222
[3] Nuske, S.; Wilshusen, K.; Achar, S.; Yoder, L.; Narasimhan, S.; Singh, S. Automated visual
yield estimation in vineyards. J. Field Robot. 2014, 31, 837–860. [Google Scholar] [CrossRef]
[4] Yamamoto, K.; Guo, W.; Yoshioka, Y.; Ninomiya, S. On plant detection of intact tomato fruits
using image analysis and machine learning methods. Sensors 2014, 14, 12191–12206. [Google
Scholar] [CrossRef] [PubMed]
[5] Russakovsky, O.; Deng, J.; Su, H.; Krause, J.; Satheesh, S.; Ma, S.; Huang, Z.; Karpathy, A.;
Khosla, A.; Bernstein, M.; et al. Imagenet large scale visual recognition challenge. Int. J. Comput.
Vis. 2015, 115, 211–252. [Google Scholar] [CrossRef]
[6] Africa, T. Dolores, M. Lim, L. Miguel, and V. Sayoc. “Understanding logical reasoning
through computer systems.” International Journal of Emerging Trends in Engineering Research.
Vol. 8, No. 4, pp 1187-1191, 2020.
[7] R. S. Latha et al., "Automatic Fruit Detection System using Multilayer Deep Convolution
Neural Network," 2021 International Conference on Computer Communication and Informatics
(ICCCI), Coimbatore, India, 2021, pp. 1-5, doi: 10.1109/ICCCI50826.2021.9402513.
[8] Zhidong Shen Adnan Shehzad Si Chen “Machine Learning Based Approach on Food
Recognition and Nutrition Estimation” 2019 International Conference on Identification, Information
and Knowledge in the Internet of Things IIKI.
[9] L. Song et al., "A Deep Multi-Modal CNN for Multi-Instance Multi-Label Image Classification,"
in IEEE Transactions on Image Processing, vol. 27, no. 12, pp. 6025-6038, Dec. 2018, doi:
10.1109/TIP.2018.2864920.
[10] G. Sumbul and B. Demİr, "A Deep Multi-Attention Driven Approach for Multi-Label Remote
Sensing Image Classification," in IEEE Access, vol. 8, pp. 95934-95946, 2020, doi:
10.1109/ACCESS.2020.2995805.
[11] P. Li, P. Chen, Y. Xie and D. Zhang, "Bi-Modal Learning With Channel-Wise Attention for
Multi-Label Image Classification," in IEEE Access, vol. 8, pp. 9965-9977, 2020, doi:
10.1109/ACCESS.2020.2964599.
16
[12] Yunchao Wei, Wei Xia, Junshi Huang, Bingbing Ni, Jian Dong, Yao Zhao, Shuicheng Yan,
”CNN: Single-label to Multi-label ”, arXiv:1406.5726, doi:10.48550/arXiv.1406.5726
[13] Solemane Coulibaly, Bernard Kamsu-Foguem, Dantouma Kamissoko, Daouda Traore, Deep
Convolution Neural Network sharing for the multi-label images classification, Machine Learning
with Applications, Volume 10, 2022, 100422, ISSN 2666-8270, doi:10.1016/j.mlwa.2022.100422.
[14] Wan-Jin Yu, Zhen-Duo Chen, Xin Luo, Wu Liu, Xin-Shun Xu, DELTA: A deep dual-stream
network for multi-label image classification, Pattern Recognition, Volume 91, 2019, Pages 322-331,
ISSN 0031-3203,doi:10.1016/j.patcog.2019.03.006.
[15] H. Zhao, W. Zhou, X. Hou and H. Zhu, "Double Attention for Multi-Label Image Classification,"
in IEEE Access, vol. 8, pp. 225539-225550, 2020, doi: 10.1109/ACCESS.2020.3044446.
[16] W. Weng, D. -H. Wang, C. -L. Chen, J. Wen and S. -X. Wu, "Label Specific Features-Based
Classifier Chains for Multi-Label Classification," in IEEE Access, vol. 8, pp. 51265-51275, 2020,
doi: 10.1109/ACCESS.2020.2980551.
[17] J. -Y. Park, Y. Hwang, D. Lee and J. -H. Kim, "MarsNet: Multi-Label Classification Network
for Images of Various Sizes," in IEEE Access, vol. 8, pp. 21832-21846, 2020, doi:
10.1109/ACCESS.2020.2969217.
[20] Zenghai Chen, Zheru Chi, Hong Fu, Dagan Feng, Multi-instance multi-label image
classification: A neural approach, Neurocomputing, Volume 99, 2013, Pages 298-306, ISSN 0925-
2312, doi:10.1016/j.neucom.2012.08.001
17