Classification of Fruits and Detection of Disease Using CNN: Bachelor of Engineering IN Information Technology

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

SAVITRIBAI PHULE PUNE UNIVERSITY

A PROJECT REPORT ON

Classification of Fruits and Detection of Disease using CNN

SUBMITTED TO THE SAVITRIBAI PHULE PUNE UNIVERSITY, PUNE


IN THE PARTIAL FULFILLMENT FOR THE AWARD OF THE DEGREE

OF

BACHELOR OF ENGINEERING
IN
INFORMATION TECHNOLOGY

BY

MS. SAKSHI PAWAR BEIT159


MR. DEVANSHU DAGAONKAR BEIT176
MR. SHUBHAM BHOSALE BEIT177
MR. RISHABH NABAR BEIT178

UNDER THE GUIDANCE OF


DR.PROF. ROSHANI RAUT

DEPARTMENT OF INFORMATION TECHNOLOGY


PCET’S PIMPRI CHINCHWAD COLLEGE OF ENGINEERING
SECTOR NO. 26, PRADHIKARAN, NIGDI, PUNE – 411044.

2020-21
CERTIFICATE

This is to certify that the project report entitled

Classification of Fruits and Detection of Disease using CNN

Submitted By

Ms. Sakshi Pawar


Mr. Devanshu Dagaonkar
Mr. Shubham Bhosale
Mr. Rishabh Nabar

is a bonafide work carried out by Students under the supervision of Dr.Prof. Roshani Raut and
it is submitted towards the partial fulfillment of the requirement of Bachelor of Engineering
(Information Technology) Project.

This project report has not been earlier submitted to any other Institute or University for the award
of any degree or Diploma.

Dr.Prof. Roshani Raut Dr. Sonali Patil

Internal Guide H.O.D.


Dept. of Information Technology. Dept. of Information Technology

External Examiner
Date:

Place:
Date:
Classification of Fruits and Detection of Disease using CNN

Acknowledgment
It gives us great pleasure in presenting the preliminary project report on
Classification of Fruits and Detection of Disease using CNN
I would like to take this opportunity to thank my internal guide Prof. Ramkrishna Vadali
for giving me all the help and guidance I needed. I am really grateful to them for their
kind support. Their valuable suggestions were very helpful.
I am also grateful to Dr. Sonali Patil, Head of Information Technology Department, Pimpri
Chinchwad College of Engineering for her indispensable support, suggestions.
In the end our special thanks to Other Person Name for providing various resources such
as laboratories with all needed software platforms, continuous Internet connection, for Our
Project.

Ms. Sakshi Pawar BEIT159


Mr. Devanshu Dagaonkar BEIT176
Mr. Shubham Bhosale BEIT177
Mr. Rishabh Nabar BEIT178

(B.E. Information Technology.)

Pimpri Chinchwad College of Engineering - INFORMATION TECHNOLOGY - 2020-21

1
Classification of Fruits and Detection of Disease using CNN

LIST OF FIGURES
FIGURE ILLUSTRATION PAGE NO.

1 Mathematical Modeling 13
2 Waterfall Model 20
3 System Architecture 24
4 DFD Level – 0 24
5 DFD Level – 1 25
6 DFD Level – 2 26
7 ER Diagram 27
8 Use case Diagram 28
9 Sequence Diagram 29
10 Collaborative Diagram 30
11 Deployment Diagram 31
12 Component Diagram 32
13 Class Diagram 33
14 State Chart Diagram 34
15 State Chart Diagram 35
16 Stages of CNN 36
17 CNN Steps 38
18 CNN Layers 39
19 Fruit Classification 42

Pimpri Chinchwad College of Engineering - INFORMATION TECHNOLOGY - 2020-21

2
Classification of Fruits and Detection of Disease using CNN

20 Apple Dataset 42
21 Banana DataSet 42
22 Results 45
23 Results 45
24 Results 46
25 Fresh Apple 47
26 Rotten Apple 47
27 Fresh Banana 48
28 Rotten Banana 48
29 Banana Grade A 49
30 Banana Grade B 49
31 Banana Grade A 50
32 Banana Grade B 50
33 Problem Classifications 56
34 Risk Analysis 58

Pimpri Chinchwad College of Engineering - INFORMATION TECHNOLOGY - 2020-21

3
Classification of Fruits and Detection of Disease using CNN

LIST OF TABLES
TABLE ILLUSTRATION PAGE NO.

4.1 Project Plan 29


8.1 Comparison Table 51
8.2 Summary Table 52,53

Pimpri Chinchwad College of Engineering - INFORMATION TECHNOLOGY - 2020-21

4
Classification of Fruits and Detection of Disease using CNN

Sr.No. Title of Chapter Page No.


1. Introduction 8
1.1 Motivation 8
1.2 Problem Definition 9
2. Literature Survey 10
3. Software Requirements Specification 12
3.1 Introduction 15
3.1.1 Project Scope
3.1.2 User Classes and Characteristics
3.1.3 Assumptions and Dependencies
3.1.4 Mathematical Modeling
3.2 Functional Requirements 17
3.2.1 System Feature 1(Functional Requirement)
3.2.2 System Feature2 (Functional Requirement)
3.3 External Interface Requirements (If Any) 19
3.3.1 User Interfaces
3.3.2 Hardware Interfaces
3.3.3 Software Interfaces
3.3.4 Communication Interfaces
3.4 Nonfunctional Requirements 20
3.4.1 Performance Requirements
3.4.2 Safety Requirements

Pimpri Chinchwad College of Engineering - INFORMATION TECHNOLOGY - 2020-21

5
Classification of Fruits and Detection of Disease using CNN

3.4.3 Security Requirements


3.4.4 Software Quality Attributes
3.5 System Requirements 21
3.3.1 Database Requirements
3.3.2 Software Requirements(Platform Choice)
5.3.3 Hardware Requirements
3.6 Analysis Models: SDLC Model to be applied 23
3.7 System Implementation Plan
4. System Design 24
4.1 System Architecture 24
4.3 Entity Relationship Diagrams 27
4.4 UML Diagrams 28
5. Other Specification 36
6. Dataset 41
7. Results 44
8. Comparison 51
9. Other Specification 54
10. Conclusion and Future Work 56
11. Reference 61

Pimpri Chinchwad College of Engineering - INFORMATION TECHNOLOGY - 2020-21

6
Classification of Fruits and Detection of Disease using CNN

Abstract

This project demonstrates the method for detection of fruit


disease and grade(accuracy).Diseases in fruits and plants are the
main reasons for the agricultural loss. This work focuses on
developing a user-friendly tool which recognizes the level of the
disease and grades them accordingly. This model uses convolution
neural networks (CNN) for the classification, which is again
retrained using transfer learning technique. Identification and
classification of diseases of fruits are done through various
algorithms. The main focus of our work is obtaining the analysis
of different fruit disease detection techniques and also provides an
overview of these techniques. Research on detection of disease and
fruit grading is useful for agriculture and farmers. By identifying
the type of disease in fruits and also grading of fruit based on its
quality. For detection of disease required different features of fruit
and classifiers classified these features. For the fruit grading
segment the image after segmentation calculates the infected and
healthy portion of fruit and grading based on percentage of
infection on fruit.The classification accuracy for the proposed
solution is achieved up to 98.41%.

Pimpri Chinchwad College of Engineering - INFORMATION TECHNOLOGY - 2020-21

7
Classification of Fruits and Detection of Disease using CNN

1. INTRODUCTION

India is agricultural country and Indian farmer select wide range of fruit and vegetable
crops. The cultivation of crops can be improved by the technological support.India is the
agricultural land, India produces 44.04 million tons of fruit and it is a second largest
producer of fruits. India contributes 10% in world fruit production. Indian farmers grow
variety of fruits those are apple, banana, citrus, grape, mango, guava, papaya, watermelon.
Fruit industry contributes around 20% of the country's development. In India, crop yield is
declined due to the post-recognition of diseases in fruits/vegetables by the farmers.
Farmers face great economic loss. Diseases in fruits and plants are the main reasons for
the agricultural loss. Consuming such diseased fruit is harmful to human health. To detect
the infections and diseases in fruits, convolution neural networks techniques are used as
per size and color. CNN or Convolution neural network is leading technology used in for
classifying the images and object recognition.

1.1. MOTIVATION

Fruit industry is one of the major drivers to grow the economy of the country. There
is possibility of erroneous sorting and packaging of fruits due to manual inspection and
lack of knowledge of quality evaluation. The farmers are under pressure for demand of
rapid supply due to shortage of skilled workers and rising labour costs.

Pimpri Chinchwad College of Engineering - INFORMATION TECHNOLOGY - 2020-21

8
Classification of Fruits and Detection of Disease using CNN

In such a scenario, automation can reduce the costs by promoting production


efficiency. There are various kinds of fruits cultivated in our country, but the major
fruits are apple, mango, orange etc. Thus to save farmers from enormous losses while
cultivating fruits we need to find an efficient, effective, easy methodology. Therefore
to detect infections and diseases in fruits we have used CNN model which will
classify good fruits on bad ones by means of the shape and color etc.

1.2. PROBLEM DEFINITION


There is a large amount of detection and identification of disease in fruits which are
recorded and data is generated. Different types of fruits are yielded at different areas
in different times. But there is no system which will detect the disease in live fruit
which will help farmers to find necessary solutions. So our problem is to build a
mechanism which will help the user to detect the fruit according to the image dataset.

Pimpri Chinchwad College of Engineering - INFORMATION TECHNOLOGY - 2020-21

9
Classification of Fruits and Detection of Disease using CNN

2. LITERATURE SURVEY

● “Fruit Recognition and Grade of Disease Detection using Inception V3 Model”


Author: Nikhitha M, Roopa Sri S, Uma Maheswari B, 2019 3rd International
conference on Electronics, Communication and Aerospace Technology (ICECA).
In India, crop yield is declined due to the post recognition of diseases in
fruits/vegetables by the farmers.Farmers face great economic loss worldwide.
Diseases in fruits and plants are the main reasons for the agricultural loss.Knowing
the health status fruits/vegetables helps farmers to improve their productivity.

● “Detection and Classification of Apple Fruit Diseases Using Complete Local


Binary Patterns” Author: Shiv Ram Dubey, Anand Singh Jalal, 2012 Third
International Conference on Computer and Communication Technology. Diseases
in fruit cause devastating problem in economic losses and production in
agricultural industry worldwide. The image processing based proposed approach is
composed of the following main steps, in the first step K-Means clustering
technique is used for the image segmentation, in the second step some state of the
art features are extracted from the segmented image, and finally images are
classified into one of the classes by using a Multi-class Support Vector Machine.
The classification accuracy for the proposed solution is achieved up to 93%.

Pimpri Chinchwad College of Engineering - INFORMATION TECHNOLOGY - 2020-21

10
Classification of Fruits and Detection of Disease using CNN

● “Identification of Artificially Ripened Fruits using Machine Learning“ Author:


Harshad Vaviya , Ajay Kumar Yadav, Vijaykumar Vishwakarma, Nasim Shah, 2nd
International Conference on Advances in Science & Technology (ICAST) 2019 .
Ripening of fruit is a natural process. Ethylene is responsible for ripening process
which is produced naturally in fruit. But dealers and sellers often use chemicals
like CaC2 (Calcium carbide) to quicken this process so their product will enter the
market early and they can maximize profit. Fruits are kept in storage with
chemicals. The proposed system gets an image of fruit under the test and compare
it with the features of naturally ripened fruit and artificially ripened fruit and give
the output with the probability.

● “Assessment of Fruit using Digital Image Processing,” Author: K. Raut, V. Bora,


International journal of Science technology & Engineering, 2016. In recent years
automatic vision based technology has become more powerful and more efficient
to many areas including agricultural fields and food industry. An automatic vision
based system for sorting and grading of fruit like cherry and strawberry based on
their maturity level discussed here. The most common property to measure quality
of any fruit is its appearance which includes colour, shape, size and surface
conditions. The analysis of colour is especially an important consideration when
determining the efficiency of fruit. This study used an inexpensive method to
predict cherry and strawberry color parameters by combining image processing
and artificial neural network (ANN) technique.

Pimpri Chinchwad College of Engineering - INFORMATION TECHNOLOGY - 2020-21

11
Classification of Fruits and Detection of Disease using CNN

3. SOFTWARE REQUIREMENTS SPECIFICATION

3.1. INTRODUCTION

3.1.1. Project Scope

Fruit disease detection strategy would likewise elevate Indian Farmers to


do smart cultivating which sets aside opportunity to time choices which
additionally spare time and lessen loss of fruit because of diseases. This
research can be extended to increase the accuracy using soft computing
technique and validate with more number of sample

3.1.2. Use Classes And Characteristics


Our system is divided into two class/modules:
1) user
2) system

3.1.3. Assumptions And Dependencies


1. User must have the knowledge of web based application.
2. User must have the knowledge of English.
3. User must have all required software to run the application.

Pimpri Chinchwad College of Engineering - INFORMATION TECHNOLOGY - 2020-21

12
Classification of Fruits and Detection of Disease using CNN
3.1.4. Mathematical Modeling

figure no. 1 Mathematical Modeling


Where,
Q = User entered input
CB = Check fruit
C = fruit detect
PR = Recommend
UB = Recommend fresh,rotten,grade

Set Theory
1) Let S be as system which input image

S = {In, P, Op, Φ}

2) Identify Input In as

In = {Q}
Where,
Q = User entered input image(dataset)
3) Identify Process P as

P = {CB, C, PR}

CB = System check fruit


Pimpri Chinchwad College of Engineering - INFORMATION TECHNOLOGY - 2020-21

13
Classification of Fruits and Detection of Disease using CNN

C = Detect fruit
PR = Preprocess request
4) Identify Output Op as

Op = {UB}
Where,
UB = Update Result
Φ=Failures and Success conditions.

Failures:
1. Huge database can lead to more time consumption to get the information.
2. Hardware failure.
3. Software failure.
Success:
1. Search the required information from available in Datasets.
2. User gets result very fast according to their needs.

Space Complexity:
The space complexity depends on Presentation and visualization of discovered
patterns. More the storage of data more is the space complexity.

Time Complexity:
Check No. of patterns available in the datasets= n

Pimpri Chinchwad College of Engineering - INFORMATION TECHNOLOGY - 2020-21

14
Classification of Fruits and Detection of Disease using CNN

If (n>1) then retrieving of information can be time consuming. So the time complexity of

( )
this algorithm is O 𝑛𝑛 .

3.2. FUNCTIONAL REQUIREMENTS


● It should be able to detect fruit..
● It should be able to detect the presence of intruders.
● Performance of the functions and every module must be well. The overall
performance of the software will enable the users to work efficiently.
● The application is designed in modules where errors can be detected and
fixed easily. This makes it easier to install and update new functionality if
required.
● User information can only view by user himself/herself.

3.3. EXTERNAL INTERFACE REQUIREMENTS

1. User Interfaces
The requirements section of hardware includes a minimum of 180 GB
hard disk and 4 GB RAM with 2 GHz or higher speed. The primary

Pimpri Chinchwad College of Engineering - INFORMATION TECHNOLOGY - 2020-21

15
Classification of Fruits and Detection of Disease using CNN

requirements include a memory of 4GB for the Android Application


development and MySQL.
2. Hardware Interface
As this is an online application for product management we are not
enabling or installing any hardware components for user interface.

It’s not an embedded system


● Processor - Pentium IV 2.4 GHZ
● Speed - 1.5 Ghz and Above
● RAM - 8 GB (min)
● Hard Disk - 220 GB
● Key Board - Standard Windows Keyboard
● Mouse - Two or Three Button Mouse

3. SOFTWARE INTERFACES
This is the software configuration in which the project was shaped. The
programming language used, tools used, etc are described here.
● Operating System : Windows
● Front End : html,css,bootstrap,javascript
● Tool : Sublimetext3,pycharm
● Database : MySQL

Pimpri Chinchwad College of Engineering - INFORMATION TECHNOLOGY - 2020-21

16
Classification of Fruits and Detection of Disease using CNN

4. COMMUNICATION INTERFACES
● User can access the web application from remote location.
● Standard internet connection is required.
● TCP/UDP connection will be required.
3.4. NON-FUNCTIONAL REQUIREMENTS 1.
PERFORMANCE REQUIREMENTS
● High Speed:

System should process requested task in parallel for various action


to give quick response. Then system must wait for process
completion.

● Accuracy:

System should correctly execute process, display the result


accurately. System output should be in user required format.

2. SAFETY REQUIREMENTS
The data safety must be ensured by arranging for a secure and reliable
transmission media. The source and destination information must be
entered correctly to avoid any misuse or malfunctioning. Password
generated by user is consisting of characters, special character & number
so that password is difficult to hack. So, that user account is safe.

3. SECURITY REQUIREMENTS
Secure access of confidential data (user’s details).
Pimpri Chinchwad College of Engineering - INFORMATION TECHNOLOGY - 2020-21

17
Classification of Fruits and Detection of Disease using CNN

● Information security means protecting information and information


systems from unauthorized access, use, disclosure, disruption,
modification or destruction.

● The terms information security, computer security and information


assurance are frequently incorrectly used interchangeably. These
fields are interrelated often and share the common goals of
protecting the confidentiality, integrity and availability of
information; however, there are some subtle differences between
them.
● User password must be stored in encrypted form for the security
reason
● All the user details shall be accessible to only high authority
persons.
● Access will be controlled with usernames and passwords.

4. SOFTWARE QUALITY ASSURANCE
● Availability [related to Reliability]
● Modifiability [includes portability, reusability, scalability]
● Performance
● Security
● Testability
● Usability[includes self-adaptability and user adaptability]

Pimpri Chinchwad College of Engineering - INFORMATION TECHNOLOGY - 2020-21

18
Classification of Fruits and Detection of Disease using CNN

3.5. SYSTEM REQUIREMENTS


1. DATABASE REQUIREMENTS
MySQL : MySQL is an open-source relational database management
system (RDBMS). Its name is a combination of "My", the name of
co-founder Michael Widenius's daughter, and "SQL", the abbreviation for
Structured Query Language.
MySQL is free and open-source software under the terms of the GNU
General Public License, and is also available under a variety of proprietary
licenses. MySQL was owned and sponsored by the Swedish company
MySQL AB, which was bought by Sun Microsystems (now Oracle
Corporation). In 2010, when Oracle acquired Sun, Widenius forked the
open-source MySQL project to create MariaDB.
MySQL is a component of the LAMP web application software stack (and
others), which is an acronym for Linux, Apache, MySQL,
Perl/PHP/Python. MySQL is used by many database-driven web
applications, including Drupal, Joomla, phpBB, and WordPress. MySQL is
also used by many popular websites, including Facebook, Flickr,
MediaWiki, Twitter, and YouTube.

2. SOFTWARE REQUIREMENTS
Operating system : Windows 7 and above.
Coding Language : Python,
IDE : Sublimetext3 Pychar

Pimpri Chinchwad College of Engineering - INFORMATION TECHNOLOGY - 2020-21

19
Classification of Fruits and Detection of Disease using CNN

3.HARDWARE REQUIREMENTS
System : Intel I5 Processor and above.
Hard Disk : 200 GB.
Monitor : 15 VGA Color.
Ram : 8GB.
Mobile : ANDROID
3.6. ANALYSIS MODELS : SDLC MODEL TO BE APPLIED

figure no. 2 Waterfall Model


Pimpri Chinchwad College of Engineering - INFORMATION TECHNOLOGY - 2020-21

20
Classification of Fruits and Detection of Disease using CNN

3.7. SYSTEM IMPLEMENTATION PLAN


1. Requirement gathering and analysis:
In this step of waterfall we identify what are various requirements are need for our
project such are software and hardware required, database, and interfaces.

2. System Design:
In this system design phase we design the system which is easily understood for
end user i.e. user friendly.
We design some UML diagrams and data flow diagram to understand the system
flow and system module and sequence of execution.

3. Implementation:
In implementation phase of our project we have implemented various module
required of successfully getting expected outcome at the different module levels.
With inputs from system design, the system is first developed in small programs called
units, which are integrated in the next phase. Each unit is developed and tested for its
functionality which is referred to as Unit Testing.

4. Testing:
The different test cases are performed to test whether the project module are giving
expected outcome in assumed time.
All the units developed in the implementation phase are integrated into a system after
testing of each unit. Post integration the entire system is tested for any faults and
failures.
Pimpri Chinchwad College of Engineering - INFORMATION TECHNOLOGY - 2020-21

21
Classification of Fruits and Detection of Disease using CNN

5. Deployment of System:
Once the functional and nonfunctional testing is done, the product is deployed in the
customer environment or released into the market.

6. Maintenance:
There are some issues which come up in the client environment. To fix those issues
patches are released. Also to enhance the product some better versions are released.
Maintenance is done to deliver these changes in the customer environment.
All these phases are cascaded to each other in which progress is seen as flowing
steadily downwards like a waterfall through the phases. The next phase is started only
after the defined set of goals are achieved for previous phase and it is signed off, so the
name "Waterfall Model". In this model phases do not overlap.

Pimpri Chinchwad College of Engineering - INFORMATION TECHNOLOGY - 2020-21

22
Classification of Fruits and Detection of Disease using CNN
3.8 PROJECT PLANNING

NO TASK DURATION(Days)

1 Group Formation 4

2 Decide Area Of Interest 4

3 Search Topic 5

4 Topic Selection 5

5 Sanction Topic 5

6 Search Related 12
Information

7 Understanding Concept 7

8 Search Essential
Document(IEEE & 6
White Paper, Software)

9 Problem Definition 2

10 Literature Survey 5

11 SRS 14

12 Project Planning 2

13 Modeling & design 10

14 Technical Specification 2

15 PPT 6

Pimpri Chinchwad College of Engineering - INFORMATION TECHNOLOGY - 2020-21

23
Classification of Fruits and Detection of Disease using CNN
4. SYSTEM DESIGN

4.1. SYSTEM ARCHITECTURE

Figure no. 3 System Architecture


4.2. DATA FLOW DIAGRAMS

Pimpri Chinchwad College of Engineering - INFORMATION TECHNOLOGY - 2020-21

24
Classification of Fruits and Detection of Disease using CNN

Figure no. 4 DFD level 0

Figure no. 5 DFD level 1

Pimpri Chinchwad College of Engineering - INFORMATION TECHNOLOGY - 2020-21

25
Classification of Fruits and Detection of Disease using CNN

Figure no. 6 DFD level 2

Pimpri Chinchwad College of Engineering - INFORMATION TECHNOLOGY - 2020-21

26
Classification of Fruits and Detection of Disease using CNN
4.3. ENTITY RELATIONSHIP DIAGRAMS

Figure no. 7 Entity Relationship Diagram

Pimpri Chinchwad College of Engineering - INFORMATION TECHNOLOGY - 2020-21

27
Classification of Fruits and Detection of Disease using CNN
4.4. UML DIAGRAM

Figure no. 8 Use Case Diagram

Pimpri Chinchwad College of Engineering - INFORMATION TECHNOLOGY - 2020-21

28
Classification of Fruits and Detection of Disease using CNN

Figure no. 9 Sequence Diagram

Pimpri Chinchwad College of Engineering - INFORMATION TECHNOLOGY - 2020-21

29
Classification of Fruits and Detection of Disease using CNN

Figure no. 10 Collaborative Diagram

Pimpri Chinchwad College of Engineering - INFORMATION TECHNOLOGY - 2020-21

30
Classification of Fruits and Detection of Disease using CNN

Figure no. 11 Deployment Diagram

Pimpri Chinchwad College of Engineering - INFORMATION TECHNOLOGY - 2020-21

31
Classification of Fruits and Detection of Disease using CNN

Figure no. 12 Component Diagram

Pimpri Chinchwad College of Engineering - INFORMATION TECHNOLOGY - 2020-21

32
Classification of Fruits and Detection of Disease using CNN

Figure no. 13 Class Diagram

Pimpri Chinchwad College of Engineering - INFORMATION TECHNOLOGY - 2020-21

33
Classification of Fruits and Detection of Disease using CNN

Figure no. 14 State Chart Diagram

Pimpri Chinchwad College of Engineering - INFORMATION TECHNOLOGY - 2020-21

34
Classification of Fruits and Detection of Disease using CNN

Figure no. 15 State Chart Diagram

Pimpri Chinchwad College of Engineering - INFORMATION TECHNOLOGY - 2020-21

35
Classification of Fruits and Detection of Disease using CNN
5. IMPLEMENTATION

This model works on the principle of Convolutional Neural Networks(CNN) ; it consists


of many stages.

Figure no. 16 Stages of CNN

● This model involves stages as follows firstly data collection which will serve as
input to the machine. Then secondly RGB to Grayscale conversion of the image
will take place.

● This step is needed as an RGB Image consists of 3 layers R,G,B. It’s a 3


dimensional matrix, where the grayscale image is of only 2 dimensions, and the
values range between 0–255 (8-bit unsigned integers).

Pimpri Chinchwad College of Engineering - INFORMATION TECHNOLOGY - 2020-21

36
Classification of Fruits and Detection of Disease using CNN

● Therefore, some algorithms can only be applied on 2-D image rather than 3-D,
hence we convert an RGB image into a grayscale image, for instance, Black and
White conversion of an image, convolution of an image, etc. Thus the algorithm
can process faster, and can involve more complex operations.

● The next step is Image Segmentation wherein the digital image is partitioned into
multiple segments also called as Pixels or Image Objects. This helps simplify the
image into something meaningful and easier to analyze.

● Following this the next step is Feature Extraction where the initial set of the raw
data is divided and reduced to more manageable groups. It helps to get the best
feature from those big data sets by selecting and combining variables into features,
thus, effectively reducing the amount of data. This helps to reduce the amount of
redundant data from the data set with extracting relevant data.

● The next step is the Convolutional Neural Network Classifier. Those steps are as
follows shown in fig. 17

Pimpri Chinchwad College of Engineering - INFORMATION TECHNOLOGY - 2020-21

37
Classification of Fruits and Detection of Disease using CNN

Figure no. 17 CNN Steps

● It takes an input image, processes it and classifies it.

● This step also has sub layers Convolution Layer; this is the first layer to extract
features from an input image. Convolution preserves the relationship between
pixels by learning image features using small squares of input data.

● It is a mathematical operation that takes two inputs such as image matrix and a
filter or kernel. It also involves Padding where the picture is padded with the
zero(0) so that it fits, Non Linearity (ReLU) which has the purpose to introduce
non-linearity in ConvNet. Since, the real world data would want ConvNet to learn
would be non-negative linear values.

Pimpri Chinchwad College of Engineering - INFORMATION TECHNOLOGY - 2020-21

38
Classification of Fruits and Detection of Disease using CNN

● The next layer in CNN is the Pooling Layer which helps reduce the number of
parameters when the images are too large.
● Spatial pooling is also called subsampling or downsampling which reduces the
dimensionality of each map but retains important information.

● There are various types of pooling Max pooling takes the largest element from the
rectified feature map. Taking the largest element could also take the average
pooling. Sum of all elements in the feature map is called sum pooling.

● The further layer in CNN is Fully Connected Layer or Flatten Layer wherein the
matrix is flattened into a vector and fed in a neural network as shown in fig. 16

Figure no. 18 CNN layers


● The feature map matrix will be converted as a vector (x1, x2, x3, …).
Pimpri Chinchwad College of Engineering - INFORMATION TECHNOLOGY - 2020-21

39
Classification of Fruits and Detection of Disease using CNN

● With the fully connected layers, we combined these features together to create a
model.
● And the last step in this model is final output which is extracted after following all
the above stages.

Pimpri Chinchwad College of Engineering - INFORMATION TECHNOLOGY - 2020-21

40
Classification of Fruits and Detection of Disease using CNN

6. DATASET
● Dataset:
For training and testing, all the images were selected from Kaggle. This dataset
contains 9747 images. These images contain different fruits. This dataset contains
the following:
● Training set size: 7840 images.
● Test set size: 1907 images Number of classes: 2 (fruits) ● Image size: 100x100
pixels.
● Filename format: image_index_100.jpg (e.g. 32_100.jpg) or
r_image_index_100.jpg (e.g. r_32_100.jpg) or
r2_image_index_100.jpg. "r" stands for rotated fruit. "r2" means
that the fruit was rotated around the 3rd axis. "100" comes from
image size (100x100 pixels).
● The fruit images were reaped by recording the fruits while they are revolved by a
motor and then producing frames.
● A white paper is placed behind the fruits as a background. Due to the disparity in
the lighting a flood fill type algorithm was developed which extracted the fruit
from the background.
● After removing the background all the fruits were scaled down to 100×100 pixels
of standard RGB fruit images.
● From the dataset, we picked images from different categories.
● Among them to create the training set we used (80%) images and the rest (20%)
images used for testing the model. The network model is trained for 10 epochs.

Pimpri Chinchwad College of Engineering - INFORMATION TECHNOLOGY - 2020-21

41
Classification of Fruits and Detection of Disease using CNN

figure no. 19

figure no. 20 Apple dataset

figure no. 21 Banana Dataset

Pimpri Chinchwad College of Engineering - INFORMATION TECHNOLOGY - 2020-21

42
Classification of Fruits and Detection of Disease using CNN

● From the dataset, we picked images from different categories. Among them to
create the training set we used (80%) images and the rest (20%) images used for
testing the model. The network model is trained for 10 epochs.

Pimpri Chinchwad College of Engineering - INFORMATION TECHNOLOGY - 2020-21

43
Classification of Fruits and Detection of Disease using CNN

` 7. RESULTS

● In this paper, we have applied a convolutional neural network on the fruits dataset
in order to find the better classification performance of the network.
● For determining the overall classification accuracies, we have taken cases where
we applied different combinations of hidden layers (convolution and pool) for 10
epochs and calculated the accuracies on the test and training set. The accuracies
were obtained using the tensorflow library in python.
● The highest classification accuracy on the test images was found (Conv1, pool1,
Conv2, pool2 with dropout)to be 98%. This shows the greatest performance of
the network on the test set which consecutively occurred at 7 up to 10 epochs.
● Training the CNN by various combinations of hidden layers and increasing the
number of epochs resulted in the highest test accuracy than the training accuracy.

Pimpri Chinchwad College of Engineering - INFORMATION TECHNOLOGY - 2020-21

44
Classification of Fruits and Detection of Disease using CNN

Figure no. 22

Figure no. 23

Pimpri Chinchwad College of Engineering - INFORMATION TECHNOLOGY - 2020-21

45
Classification of Fruits and Detection of Disease using CNN

Figure no. 24

● The losses for different epochs for different combinations of convolution and
pool. Different responses were found in different combinations.
● The loss curve responded in a downward direction in the start. The loss was the
most for the early epochs and gradually decreased up to 10 epochs. The loss
soothed approximately at 0.0793 from 8 epochs up to 10 epochs.
● Following are the output figures for Training and Testing which classify Good
Fruit from Rotten Fruit.

Pimpri Chinchwad College of Engineering - INFORMATION TECHNOLOGY - 2020-21

46
Classification of Fruits and Detection of Disease using CNN

Figure no 25.Fresh Apple (Good Fruit)

Figure no.26 Rotten Apple (Bad Fruit)

Pimpri Chinchwad College of Engineering - INFORMATION TECHNOLOGY - 2020-21

47
Classification of Fruits and Detection of Disease using CNN

Figure no.27 Fresh Banana (Good Fruit)

Figure no.28 Rotten Banana (Bad Fruit)

● We have used Grading system to detect the fruits with diseases. Accordingly as

Pimpri Chinchwad College of Engineering - INFORMATION TECHNOLOGY - 2020-21

48
Classification of Fruits and Detection of Disease using CNN

Grade A and Grade B. Grade A as non-diseased fruit; Grade B as diseased


fruit.

Figure no.29 Grading A

Figure no.30 Grading B

Pimpri Chinchwad College of Engineering - INFORMATION TECHNOLOGY - 2020-21

49
Classification of Fruits and Detection of Disease using CNN

Figure no.31Grade A (Not


Diseased Fruit)

Figure no.32 Grade B


(Diseased Fruit)

● It is shown that CNN behaves differently for different combinations of layers.


● However, from our result, we have found that the classification performance gets
better if the convolution and pool are used in a repeated order with dropout.

● For fruit image detection, CNN also showed significantly higher accuracy than a
conventional method did. Besides, this approach is also quicker to deploy for new
fruits.

Pimpri Chinchwad College of Engineering - INFORMATION TECHNOLOGY - 2020-21

50
Classification of Fruits and Detection of Disease using CNN
8.COMPARISON

Here we will evaluate this paper with respect to several other algorithms and compare
with each other.
Following is the table created with several ML Algorithms that have been used in the
space of Fruit Classification. This will enable us to acknowledge the various techniques by
which Fruits can be classified and by means further the disease can be detected.

Fruits Features Classifiers Accuracy(%) References

Orange Color,Texture ANN 88% G.Capizzi,et al


2016

Tomato Color, Shape PNN 84.4% O.O.Arjenki,


2013

Apple Color, Size Naive Bayes 91% M.Ronald et.


al, 2016

Mango Maturity, Size Thermal 90% S. Naik et. al,


Imaging 2017

Strawberry Color, Shape Cluster >68% K Yamamoto


Analysis, DA et. al, 2015

Tomato Color, Texture SVM 92% N.A. Semary et


al.,2015

Kiwi Shape MLR 98.3% L. Fu et al.,


2016

Apple, Banana Color, Shape CNN 98.41% Dr Roshani


Raut et. al,
2021
Comparison Table 8.1

Pimpri Chinchwad College of Engineering - INFORMATION TECHNOLOGY - 2020-21

51
Classification of Fruits and Detection of Disease using CNN

Here is the summary of the Algorithms with their Merits and Demerits.

Classifier Merits Demerits

Naive Bayes 1. Naive Bayes classifiers 1. It can’t learn interaction


require only a small amount between different features
of training data for because its dependency
classification. exists among variables.

PNN 1. PNNs are much faster, 1. PNN are slower than


accurate than multilayer multilayer perceptron
perceptron networks. networks at classifying new
2. PNN networks generate cases.
accurate predicted target 2. PNN requires more
probability scores. memory space to store the
model.

SVM 1. SVM is well suited to 1. Selection of kernel


work with high dimensional function and kernel
data. parameters for mapping
2. Classification accuracy is original data into higher
more as compared to other dimensional data is
conventional classification difficult.
techniques. 2. Learning process can be
3. SVM is robust enough, time consuming
even when training samples
have some distortion.

Pimpri Chinchwad College of Engineering - INFORMATION TECHNOLOGY - 2020-21

52
Classification of Fruits and Detection of Disease using CNN

Classifier Merits Demerits

ANN 1. Robust and user 1. Scalability problem.


friendliness and can handle 2. Require large number
noisy data. training samples.
2. Well suited to analyze 3. Requires more
complex problem. processing time

CNN 1. Very High accuracy in 1. Time consuming process.


image recognition 2. Lack of ability to be
problems. 2. Automatically spatially invariant to the
detects the important
input data. 3. Lots of
features without any human
supervision. 3. Weight training data is required.
sharing.

Summary Table 8.2

Pimpri Chinchwad College of Engineering - INFORMATION TECHNOLOGY - 2020-21

53
Classification of Fruits and Detection of Disease using CNN

9.OTHER SPECIFICATION

9.1. ADVANTAGES

● Very High accuracy in image recognition problems.


● Automatically detects the important features without any human supervision.
● Weight sharing.
● It would promote Indian Farmers to do smart farming which helps to take time
to time decisions which also save time and reduce loss of fruit due to diseases.
● The leading objective of our paper is to enhance the value of fruit disease
detection.

9.2. DISADVANTAGES

● Time consuming process.

● Not user friendly system

● CNN does not encode the position and orientation of objects.

● Lack of ability to be spatially invariant to the input data.

● Lots of training data is required.

Pimpri Chinchwad College of Engineering - INFORMATION TECHNOLOGY - 2020-21

54
Classification of Fruits and Detection of Disease using CNN

9.3. APPLICATIONS

● Gives an effective savvy cultivating method which will help for better yield
and development with less human endeavors.

● With brilliant cultivating the present agriculturist can utilize choice instruments
and mechanization strategies which flawlessly coordinate item, learning and
administrations for better efficiency, evaluating and surplus yield .

● It would likewise elevate Indian Farmers to do smart cultivating which sets


aside opportunity to time choices which additionally spare time and lessen loss
of fruit because of diseases

Pimpri Chinchwad College of Engineering - INFORMATION TECHNOLOGY - 2020-21

55
Classification of Fruits and Detection of Disease using CNN

10. CONCLUSION AND FUTURE WORK

This project provides an efficient and accessible technique to detect fruit disease
using a web application. This system uses the ordinary web app with a dataset to
capture fruit and detect .Fruit disease detection strategy would likewise elevate Indian
Farmers to do smart cultivating which sets aside opportunity to time choices which
additionally spare time and lessen loss of fruit because of diseases. This research can
be extended to increase the accuracy using soft computing technique and validate with
more number of sample

Appendix A:
Risk Management w.r.t. NP Hard analysis

Risk is inevitable in a business organization when undertaking projects. However, the


project manager needs to ensure that risks are kept to a minimum. Risks can be mainly
divided between two types, negative impact risk and positive impact risk. Not all the time
would project managers be facing negative impact risks as there are positive impact risks
too. Once the risk has been identified, project managers need to come up with a mitigation
plan or any other solution to counter attack the risk.

What is P?
P is a set of all decision problems which can be solved in polynomial time by a
deterministic solution.

Pimpri Chinchwad College of Engineering - INFORMATION TECHNOLOGY - 2020-21

56
Classification of Fruits and Detection of Disease using CNN
Since it can be solved in polynomial time, it can be verified in polynomial time.
Therefore P is a subset of NP.
P:
Handling of large data and deploying data on cloud by VMs.

Figure no. 33

What is NP?
"NP" means "we can solve it in polynomial time if we can break the normal rules of
step-by-step computing".
What is NP Hard? A problem is NP-hard if an algorithm for solving it can be translated
into one for solving any NP-problem (nondeterministic polynomial time) problem.
NP-hard therefore means "at least as hard as any NP-problem," although it might, in fact,
be harder.

Pimpri Chinchwad College of Engineering - INFORMATION TECHNOLOGY - 2020-21

57
Classification of Fruits and Detection of Disease using CNN
Risk Identification
Any unauthorized user should be prevented from accessing the system. Password
authentication can be introduced. To ensure the safety of the system, perform regular
monitoring of the system so as to trace the proper working of the system. An internal staff

has to be trained to ensure the safety of the system. He has to be trained to handle extreme
error cases.

Risk Analysis
Risks can be evaluated based on quantity. Project managers need to analyze the likely
chances of a risk occurring with the help of a matrix.

Figure no.34
Using the matrix, the project manager can categorize the risk into four categories as Low,
Medium, High and Critical. The probability of occurrence and the impact on the project
are the two parameters used for placing the risk in the matrix categories. As an example, if
a risk occurrence is low (probability = 2) and it has the highest impact (impact = 4), the
risk can be categorized as 'High'.

Pimpri Chinchwad College of Engineering - INFORMATION TECHNOLOGY - 2020-21

58
Classification of Fruits and Detection of Disease using CNN

Overview of Risk Mitigation, Monitoring, Management

Risk Response

When it comes to risk management, it depends on the project manager to choose strategies
that will reduce the risk to minimal. Project managers can choose between the four risk
response strategies, which are outlined below.

● Risks can be avoided


● Pass on the risk
● Take corrective measures to reduce the impact of risks
● Acknowledge the risk

Risk Monitoring and Control

Risks can be monitored on a continuous basis to check if any change is made. New risks
can be identified through the constant monitoring and assessing mechanisms.

Risk Management Process

● Each person involved in the process of planning needs to identify and understand
the risks pertaining to the project.

Pimpri Chinchwad College of Engineering - INFORMATION TECHNOLOGY - 2020-21

59
Classification of Fruits and Detection of Disease using CNN

● Once the team members have given their list of risks, the risks should be
consolidated to a single list in order to remove the duplications.

● Assessing the probability and impact of the risks involved with the help of a
matrix.
● Split the team into subgroups where each group will identify the triggers that lead
to project risks.
● The teams need to come up with a contingency plan whereby to strategically
eliminate the risks involved or identified.
● Plan the risk management process. Each person involved in the project is assigned
a risk in which he/she looks out for any triggers and then finds a suitable solution
for it.

Risk Register

Often project managers will compile a document, which outlines the risks involved and
the strategies in place. This document is vital as it provides a huge deal of information.

Risk register will often consists of diagrams to aid the reader as to the types of risks that
are dealt by the organization and the course of action taken. The risk register should be
freely accessible for all the members of the project team.

Project Risk; an Opportunity or a Threat?

Pimpri Chinchwad College of Engineering - INFORMATION TECHNOLOGY - 2020-21

60
Classification of Fruits and Detection of Disease using CNN

As mentioned above, risks contain two sides. It can be either viewed as a negative element
or a positive element. Negative risks can be detrimental factors that can haphazard
situations for a project.

Therefore, these should be curbed once identified. On the other hand, positive risks can
bring about acknowledgements from both the customer and the management. All the risks
need to be addressed by the project manager.

Pimpri Chinchwad College of Engineering - INFORMATION TECHNOLOGY - 2020-21

61
Classification of Fruits and Detection of Disease using CNN

11. REFERENCES

1. Ashwini Awate, Damini Deshmankar, Prof. Samadhan Sonavane “Fruit Disease


Detection using Color, Texture Analysis and ANN” IEEE International Conference
on Green Computing and Internet of Things (ICGCIoT), pp. 978-1-4673-7910,
2015.
2. H. Cheng, L. Damerow, Y. Sun, and M. Blanke, "Early yield prediction using
image analysis of apple fruit and tree canopy features with neural networks,"
3. Sergio Cubero et al., “Advances in Machine Vision Applications for Automatic
Inspection and Quality Evaluation of Fruits and Vegetables”, doi
10.1007/s11947-010-0411-8, Food Bioprocess Technol 4:487–504, 2011.
4. Downey, G. () "Review and assessment of food and nutrition policies." Food,
Health and the Consumer pp 121-212
5. Haiwei Dong and Nikolaos Mavridis Abdulhamid Haidar, "Image-Based Date
Fruit Classification," International Congress on Ultra Modern Telecommunications
and Control Systems, vol. IV, 2012.
6. C. Hung, J. Nieto, Z. Taylor, J. Underwood, and S. Sukkarieh, "Orchard fruit
segmentation using multi-spectral feature learning," in 2013 IEEE/RSJ
International Conference on Intelligent Robots and Systems, 2013, pp. 5314-5320.
Journal of Imaging, vol. 3, p. 6, 2017.
7. J. Hemming, J. Ruizendaal, J. Hofstee, and E. van Henten, "Fruit detectability
analysis for different camera positions in sweet pepper," Sensors, vol. 14, pp.
6032-6044, 2014. [14] T. F. Chan and L. A. Vese, "Active contours without edges,"
IEEE Transactions on image processing, vol. 10, pp. 266-277, 2001.
8. Jana, Susovan, and Ranjan Parekh. "Intra-class Recognition of Fruits using Color
and Texture Features with Neural Classifiers." International Journal of Computer
Applications 148.11, 2016.
9. R. Karthika, K. V. M. Ragadevi and N. Asvini “Detection of Artificially Ripened
Fruit using Image Processing,” International journal of Advanced Science and
Engineering research, vol. 2, no. 1, pp. 576-582, 2017.

Pimpri Chinchwad College of Engineering - INFORMATION TECHNOLOGY - 2020-21

62
Classification of Fruits and Detection of Disease using CNN

10. “Identification of Artificially Ripened Fruits Using Smart Phones” by


Dr.S.Maheswaran in 2017 International Conference on Intelligent Computing and
Control (I2C2), IEEE2017.
11. Ghulam Muhammad, “Date fruits classification using texture descriptors and
shape-size features”, Engineering Applications of Artificial Intelligence, 37,
361–367, 2015.
12. Sapan Naik and Bankim Patel, “Thermal imaging with fuzzy classifier for maturity
and size based non-destructive Mango (Mangifera Indica L.) grading”, 2017
International Conference on Emerging Trends & Innovation in ICT (ICEI), 978-1-
5090-3404-8/17, 2017.
13. K. Raut, V. Bora “Assessment of Fruit using Digital Image Processing,”
International journal of Science technology & Engineering, vol. 3, no. 1, pp.
273-279, 2016.
14. “Assessment of Fruit using Digital Image Processing,” Author: K. Raut, V. Bora,
International journal of Science technology & Engineering, 2016.
15. Wasserman, Anthony I. (2016) "Software engineering issues for mobile application
development." Proceedings of the FSE/SDP workshop on Future of software
engineering research. ACM.
16. Yudong Zhang et al., “Fruit classification using computer vision and feedforward
neural network”, Journal of Food Engineering Volume 143, Pages 167–177,
December 2014.
17. k-means Clustering and Segmentation Techniques” IOSR Journal of Computer
Engineering (IOSR-JCE), pp. 37-41, 2018.

Pimpri Chinchwad College of Engineering - INFORMATION TECHNOLOGY - 2020-21

63

You might also like