Classification of Fruits and Detection of Disease Using CNN: Bachelor of Engineering IN Information Technology
Classification of Fruits and Detection of Disease Using CNN: Bachelor of Engineering IN Information Technology
Classification of Fruits and Detection of Disease Using CNN: Bachelor of Engineering IN Information Technology
A PROJECT REPORT ON
OF
BACHELOR OF ENGINEERING
IN
INFORMATION TECHNOLOGY
BY
2020-21
CERTIFICATE
Submitted By
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.
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.
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
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
3
Classification of Fruits and Detection of Disease using CNN
LIST OF TABLES
TABLE ILLUSTRATION PAGE NO.
4
Classification of Fruits and Detection of Disease using CNN
5
Classification of Fruits and Detection of Disease using CNN
6
Classification of Fruits and Detection of Disease using CNN
Abstract
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.
8
Classification of Fruits and Detection of Disease using CNN
9
Classification of Fruits and Detection of Disease using CNN
2. LITERATURE SURVEY
10
Classification of Fruits and Detection of Disease using CNN
11
Classification of Fruits and Detection of Disease using CNN
3.1. INTRODUCTION
12
Classification of Fruits and Detection of Disease using CNN
3.1.4. Mathematical Modeling
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}
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
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 𝑛𝑛 .
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
15
Classification of Fruits and Detection of Disease using CNN
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
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:
● Accuracy:
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
18
Classification of Fruits and Detection of Disease using CNN
2. SOFTWARE REQUIREMENTS
Operating system : Windows 7 and above.
Coding Language : Python,
IDE : Sublimetext3 Pychar
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
20
Classification of Fruits and Detection of Disease using CNN
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.
22
Classification of Fruits and Detection of Disease using CNN
3.8 PROJECT PLANNING
NO TASK DURATION(Days)
1 Group Formation 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
14 Technical Specification 2
15 PPT 6
23
Classification of Fruits and Detection of Disease using CNN
4. SYSTEM DESIGN
24
Classification of Fruits and Detection of Disease using CNN
25
Classification of Fruits and Detection of Disease using CNN
26
Classification of Fruits and Detection of Disease using CNN
4.3. ENTITY RELATIONSHIP DIAGRAMS
27
Classification of Fruits and Detection of Disease using CNN
4.4. UML DIAGRAM
28
Classification of Fruits and Detection of Disease using CNN
29
Classification of Fruits and Detection of Disease using CNN
30
Classification of Fruits and Detection of Disease using CNN
31
Classification of Fruits and Detection of Disease using CNN
32
Classification of Fruits and Detection of Disease using CNN
33
Classification of Fruits and Detection of Disease using CNN
34
Classification of Fruits and Detection of Disease using CNN
35
Classification of Fruits and Detection of Disease using CNN
5. IMPLEMENTATION
● 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.
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
37
Classification of Fruits and Detection of Disease using CNN
● 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.
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
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.
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.
41
Classification of Fruits and Detection of Disease using CNN
figure no. 19
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.
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.
44
Classification of Fruits and Detection of Disease using CNN
Figure no. 22
Figure no. 23
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.
46
Classification of Fruits and Detection of Disease using CNN
47
Classification of Fruits and Detection of Disease using CNN
● We have used Grading system to detect the fruits with diseases. Accordingly as
48
Classification of Fruits and Detection of Disease using CNN
49
Classification of Fruits and Detection of Disease using CNN
● 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.
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.
51
Classification of Fruits and Detection of Disease using CNN
Here is the summary of the Algorithms with their Merits and Demerits.
52
Classification of Fruits and Detection of Disease using CNN
53
Classification of Fruits and Detection of Disease using CNN
9.OTHER SPECIFICATION
9.1. ADVANTAGES
9.2. DISADVANTAGES
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 .
55
Classification of Fruits and Detection of Disease using CNN
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
What is P?
P is a set of all decision problems which can be solved in polynomial time by a
deterministic solution.
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.
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'.
58
Classification of Fruits and Detection of Disease using CNN
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 monitored on a continuous basis to check if any change is made. New risks
can be identified through the constant monitoring and assessing mechanisms.
● Each person involved in the process of planning needs to identify and understand
the risks pertaining to the project.
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.
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.
61
Classification of Fruits and Detection of Disease using CNN
11. REFERENCES
62
Classification of Fruits and Detection of Disease using CNN
63