Nothing Special   »   [go: up one dir, main page]

Fruit-Classification Report

Download as pdf or txt
Download as pdf or txt
You are on page 1of 17

VISVESVARAYA TECHNOLOGICAL UNIVERSITY

“JnanaSangama”, Belgaum -590014, Karnataka.

PROJECT WORK-4 REPORT


on

“Fruit Classification using CNN”


Submitted by

Varun Urs (1BM20CS182)


Vinay Kulkarni (1BM20CS188)
Tushar B T (1BM20CS174)
Aditya Basavaraj Nagathan (1BM20CS193)

Under the Guidance of


Lohith JJ
Asst. Professor, BMSCE

in partial fulfillment for the award of the degree of


BACHELOR OF ENGINEERING
in
COMPUTER SCIENCE AND ENGINEERING

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.

Signature of the Guide Signature of the HOD


Lohith JJ Dr. Jyothi S Nayak
Assistant Professor Professor & Head, Dept. of CSE
BMSCE, Bengaluru BMSCE, Bengaluru

External Viva

Name of the Examiner Signature with date

1.

2.

2
B. M. S. COLLEGE OF ENGINEERING
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

DECALARATION

We, Varun Urs (1BM20CS182), Vinay Kulkarni (1BM20CS188), Tushar B T (1BM20CS174),


Aditya Basavaraj Nagathan (1BM20CS193), students of 6th Semester, B.E, Department of Computer
Science and Engineering, B. M. S. College of Engineering, Bangalore, here by declare that, this
Project Work-4 entitled "Fruit Classification using CNN " has been carried out by us under the
guidance of Lohith JJ, Assistant Professor, Department of CSE, B. M. S. College of Engineering,
Bangalore. During the academic semester April-2023-July-2023

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.

1.3 Problem statement:


The problem at hand is the lack of an efficient and accurate fruit classification system.
Traditional methods rely on manual labor and subjective expertise, leading to inconsistencies
and inefficiencies. The challenge lies in developing an automated solution that can identify
and categorize fruits based on their visual characteristics, considering variations in shape, size,
color, and texture. The solution needs to leverage advanced techniques such as CNN
algorithms to achieve high classification accuracy across diverse fruit species. By addressing
this problem, we aim to streamline fruit classification processes, improve productivity, and
enable better decision-making in industries such as agriculture, food processing, and retail.

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.

2. DeepFruits: A Fruit Detection System Using Deep Neural Networks


The paper presents DeepFruits, a fruit detection system based on deep neural networks. The
model is designed to accurately detect fruits in images, utilizing deep learning techniques.
The system demonstrates promising results in fruit detection and can be applied in various
fruit-related applications.

3. Automated Visual Yield Estimation in Vineyards


This paper focuses on automated visual yield estimation in vineyards. It discusses the use of
image analysis and machine learning methods for detecting and estimating the yield of intact
tomato fruits. The approach offers potential benefits for improving efficiency and accuracy
in vineyard management.

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.

5. ImageNet Large Scale Visual Recognition Challenge


This paper introduces the ImageNet Large Scale Visual Recognition Challenge, which
focuses on large-scale image recognition tasks. It presents the dataset and evaluation metrics
used in the challenge, providing a benchmark for testing and comparing different image
recognition algorithms and models.

6. Understanding Logical Reasoning Through Computer Systems


The paper discusses logical reasoning in computer systems, focusing on the understanding
and application of logical principles. It explores the role of computer systems in logical
reasoning and highlights the potential impact of this understanding on various domains.

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.

8. Machine Learning Based Approach on Food Recognition and Nutrition Estimation


This paper explores a machine learning-based approach for food recognition and nutrition
estimation. It discusses the utilization of machine learning techniques in recognizing food
items and estimating their nutritional content, offering potential benefits in dietary
assessment and monitoring.

9. A Deep Multi-Modal CNN for Multi-Instance Multi-Label Image Classification


The paper presents a deep multi-modal convolutional neural network (CNN) for multi-
instance multi-label image classification. The proposed model combines different modalities
of information to classify images with multiple labels, demonstrating its effectiveness in
handling complex classification tasks.

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.

11. Bi-Modal Learning With Channel-Wise Attention for Multi-Label Image


Classification
The paper presents a bi-modal learning approach with channel-wise attention for multi-label
image classification. The proposed model combines visual and textual information and
applies attention mechanisms at the channel level to capture relevant features for accurate
multi-label classification.

12. CNN: Single-label to Multi-label


This paper discusses the transition from single-label to multi-label classification using
convolutional neural networks (CNNs). It explores the challenges and techniques involved
in adapting CNNs to handle multiple labels, opening up possibilities for more
comprehensive image classification tasks.

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.

14. DELTA: A Deep Dual-Stream Network for Multi-Label Image Classification


This paper introduces DELTA, a deep dual-stream network for multi-label image
classification. The model incorporates two streams, one for visual information and the other
for textual information, to capture comprehensive features for accurate classification of
images with multiple labels.

15. Double Attention for Multi-Label Image Classification


The paper presents a double attention mechanism for multi-label image classification. The
proposed model incorporates both global and local attention mechanisms to capture global
context and fine-grained details, enhancing the performance of multi-label classification
tasks.

16. Label Specific Features-Based Classifier Chains for Multi-Label Classification


This paper proposes a label-specific features-based classifier chains approach for multi-label
classification. The model leverages label-specific features to build classifier chains, enabling
effective handling of inter-label dependencies and improving the accuracy of multi-label
classification.

8
3. Design

3.1 High Level Design

Fig 3.1 High Level Design

9
3.2 Detailed Design

Fig 3.2 Detailed Design

3.3 Sequence Diagram

Fig 3.3 Sequence Diagram

10
3.4 Use Case Diagram

Fig 3.4 Use Case

11
4. Implementation

4.1 Proposed methodology


To address the fruit classification problem, we propose the implementation of a Convolutional
Neural Network (CNN) architecture that leverages convolutional layers, max-pooling layers,
dense layers, and a flatten layer. Our model architecture is as follows:

• 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.

4.2 Algorithm used for implementation


The algorithm used in the proposed fruit classification implementation is a Convolutional
Neural Network (CNN). CNNs are a type of deep neural network that have shown remarkable
performance in image classification tasks. They are specifically designed to extract and learn
spatial hierarchies of features from images.

In the context of fruit classification, CNNs excel at automatically learning discriminative


features from raw fruit images, such as shape, color, and texture. The architecture of a CNN
typically consists of convolutional layers, pooling layers, and fully connected (dense) layers.

12
4.3 Tools and technologies used
• Google Colab for model training.

• Flask API for model integration into web.

• Tensorflow for model backend

• Fruits image dataset from Kaggle

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.

[18] H. Hu, Z. Cui, J. Wu and K. Wang, "Metric Learning-Based Multi-Instance Multi-Label


Classification With Label Correlation," in IEEE Access, vol. 7, pp. 109899-109909, 2019, doi:
10.1109/ACCESS.2019.2928218.

[19] Wu B, Ji X, He M, Yang M, Zhang Z, Chen Y, Wang Y, Zheng X. Mineral Identification Based


on Multi-Label Image Classification. Minerals. 2022; 12(11):1338. doi: 10.3390/min12111338

[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

You might also like