0% found this document useful (0 votes)
25 views56 pages

Final Report

Download as docx, pdf, or txt
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1/ 56

CHAPTER 1

INTRODUCTION

1.1 IMAGE PROCESSING


Image processing is a method to perform some operations on an image, in order to
get an enhanced image or to extract some useful information from it. It is a type of
signal processing in which input is an image and output may be image or
characteristics/features associated with that image. Nowadays, image processing is
among rapidly growing technologies. It forms core research area within
engineering and computer science disciplines too.

Today, there is almost no area of technical endeavor that is not impacted in some
way by digital image processing. Medical Image processing has experienced
dramatic expansion and has been an interdisciplinary research field attracting
expertise from applied mathematics, computer science, engineering, statistics,
physics, biology, and medicine. Computer-Aided diagnostic processing has already
enhanced an important part of clinical routine, Accompanied by a rush of the new
development of high technology and use of various imaging modalities, more
challenges arise, for example how to process and analyze a significant volume of
the image so that high-quality information can be produced for disease diagnoses
and treatment.

Plant diseases affect the growth of their respective species, therefore their early
identification is very important. Many Machine Learning (ML) models have been
employed for the detection and classification of plant diseases but, after the
advancements in a subset of ML, that is, Deep Learning (DL), this area of research
appears to have great potential in terms of increased accuracy. Many
developed/modified DL architectures are implemented along with several
visualization techniques to detect and classify the symptoms of plant diseases.
Moreover, several performance metrics are used for the evaluation of these
architectures/techniques. This review provides a comprehensive explanation of DL
models used to visualize various plant diseases. In addition, some research gaps are
identified from which to obtain greater transparency for detecting diseases in
plants, even before their symptoms appear clearly

1.1.1 CHARACTERISTICS

1. Visualization –observe the objects that are not visible.

2. Image sharpening and restoration- To create a better image.

3. Image retrieval-Seek for the image of interest.

4. Measurement of pattern- Measures various objects in an image.

5. Image Recognition- Distinguish the objects in an image.

1.1.2 Types

The two types of methods used for Image Processing are Analog and Digital Image
Processing. Analog or visual techniques of image processing can be used for the
hard copies like printouts and photographs. Image analysts use various
fundamentals of interpretation while using these visual techniques. The image
processing is not just confined to the area that has to be studied but on the
knowledge of analyst. Association is another important tool in image processing
through visual techniques. So analysts apply a combination of personal knowledge
and collateral data to image processing.

Digital processing techniques help in the manipulation of digital images by using


computers. Raw data from imaging sensors from satellite platform contains
deficiencies. To get over such flaws and to get originality of information, it has to
undergo various phases of processing.

1.1.3 Phases

There are three general phases that all types of data have to undergo while using
digital technique that are pre-processing, enhancement and display.Selection of
training data is included in these phases.

1.1.4 Steps

Image processing basically includes the following three steps.

1. Importing the image with optical scanner or by digital photography.

2. Analyzing and manipulating the image which includes data compression and
image enhancement and spotting patterns that are not to human eyes like satellite
photograph.

3. Output is the last stage in which result can be altered image or report that is
based on image analysis.

1.2. Phytopathology

Plant pathology (also phytopathology) is the scientific study of diseases in plants


caused by pathogens (infectious organisms) and environmental conditions
(physiological factors). Organisms that cause infectious disease include fungi,
bacteria and virus-like organisms.

Tomatoes are produced commercially both in the field and in enclosed structures
(high tunnels and greenhouses). They are also a very popular garden plant among
homeowners. Tomato production, whether for commercial or personal use, is not
always an easy task. A variety of disorders, insects, diseases and pests may cause
problems during any given growing season and may damage a crop, leading to
reduced or poor-quality yields.

There are several pathogens that can cause tomato plant disease. Some tomato
disease pathogens are fungal organisms while others are bacterial or even viral.

Diagnosis is the first step in disease management. Identifying the cause of a


problem is necessary before appropriate management methods can be taken.

1.2.1 Types
Bacterial Spot

This disease is caused by the bacterium Xanthomonas vesicatoria, which attacks


green but not red tomatoes. Peppers are also attacked. The disease is more
prevalent during wet seasons. Damage to the plants includes leaf and fruit spots,
which result in reduced yields, defoliation and sun- scalded fruit. The symptoms
consist of numerous small, angular to irregular, water-soaked spots on the leaves
and slightly raised to scabby spots on the fruits. The leaf spots may have a yellow
halo. The centers dry out and frequently tear.

The bacteria survive the winter on volunteer tomato plants and on infected plant
debris. Moist weather is conducive to disease development. Most outbreaks of the
disease can be traced back to heavy rainstorms that occurred in the area. Infection
of leaves occurs through natural openings. Infection of fruits must occur through
insect punctures or other mechanical injury.

Bacterial spot is difficult to control once it appears in the field. Any water
movement from one leaf or plant to another, such as splashing rain drops, overhead
irrigation, and touching or handling wet plants, may spread the bacteria from
diseased to healthy plants.

Prevention & Treatment: Only use certified disease-free seed and plants. Avoid
areas that were planted with peppers or tomatoes during the previous year. Avoid
overhead watering by using drip or furrow irrigation. Remove all diseased plant
material. Prune plants to promote air circulation. Spraying with a copper fungicide
will give fairly good control the bacterial disease. Follow the instructions on the
label. See Table 1 for fungicide products for home garden use.

EARLY BLIGHT

This disease is caused by the fungi Alternaria linariae and A. solani and is first
observed on the plants as small, brown lesions mostly on the older foliage. Spots
enlarge and concentric rings in a bull’s-eye pattern may be seen in the center of the
diseased area. Tissue surrounding the spots may turn yellow. If high temperature
and humidity occur at this time, much of the foliage is killed. Lesions on the stems
are similar to those on leaves and sometimes girdle the plant if they occur near the
soil line (collar rot). On the fruits, lesions attain considerable size, usually
involving nearly the entire fruit. Concentric rings are also present on the fruit.
Infected fruit frequently drops.
The fungus survives on infected debris in the soil, on seed, on volunteer tomato
plants and other solanaceous hosts, such as Irish potato, eggplant, and black
nightshade.

Prevention & Treatment: Use resistant or tolerant tomato cultivars. Use


pathogen-free seed and do not set diseased plants in the field. Use crop rotation,
eradicate weeds and volunteer tomato plants, space plants to not touch, mulch
plants, fertilize properly, don’t wet tomato plants with irrigation water, and keep
the plants growing vigorously. Trim off and dispose of infected lower branches and
leaves.

To reduce disease severity, test the garden soil annually and maintain a sufficient
level of potassium. Side dress tomato plants monthly with calcium nitrate for
adequate growth.

If disease is severe enough to warrant chemical control, select one of the following
fungicides: mancozeb (very good); chlorothalonil or copper fungicides (good).
Follow the directions on the label. See Table 1 for examples of fungicide products
for home garden use.

Late Blight
Late blight is a potentially serious disease of potato and tomato, caused by the
fungus Phytophthora infestans. Late blight is especially damaging during cool, wet
weather. The fungus can affect all plant parts. Young leaf lesions are small and
appear as dark, water-soaked spots. These leaf spots will quickly enlarge and a
white mold will appear at the margins of the affected area on the lower surface of
leaves. Complete defoliation (browning and shriveling of leaves and stems) can
occur within 14 days from the first symptoms. Infected tomato fruits develop
shiny, dark or olive-colored lesions, which may cover large areas. Fungal spores
are spread between plants and gardens by rain and wind. A combination of daytime
temperatures in the upper 70s °F with high humidity is ideal for infection.

Prevention & Treatment: The following guidelines should be followed to


minimize late blight problems:
 Keep foliage dry. Locate your garden where it will receive morning sun.

 Allow extra room between the plants, and avoid overhead watering,
especially late in the day.

 Purchase certified disease-free seeds and plants.

 Destroy volunteer tomato and potato plants and nightshade family weeds,
which may harbor the fungus.
 Do not compost rotten, store-bought potatoes.

 Pull out and destroy diseased plants.

 If disease is severe enough to warrant chemical control, select one of the


following fungicides: chlorothalonil (very good); copper fungicide, or
mancozeb (good). See Table 1 for examples of fungicide products for home
garden use. Follow the directions on the label.

 Plant resistant cultivars. See Table 3 for tomato cultivars with resistance to
late blight.

Leaf Mold

The fungus Fulvia fulva causes leaf mold. It is first observed on older leaves near
the soil where air movement is poor and humidity is high. The initial symptoms are
pale green or yellowish spots on the upper leaf surface, which enlarge and turn a
distinctive yellow.

Under humid conditions the spots on the lower leaf surfaces become covered with
a gray, velvety growth of the spores produced by the fungus. When infection is
severe, the spots coalesce, and the foliage is killed. Occasionally, the fungus
attacks stems, blossoms and fruits. Green and mature fruit can have a black,
leathery rot on the stem end.

The fungus survives on crop residue and in the soil. Spores are spread by rain,
wind or tools. Seeds can be contaminated. The fungus is dependent on high relative
humidity and high temperature for disease development.
Prevention & Treatment: Crop residue should be removed from the field.
Staking and pruning to increase air circulation helps to control the disease. Avoid
wetting leaves when watering. Rotate with vegetables other than tomatoes. Using a
preventative fungicide program with chlorothalonil, mancozeb or copper fungicide,
can control the disease.

Septoria Leaf Spot


This destructive disease of tomato foliage, petioles and stems (fruit is not infected)
is caused by the fungus Septoria lycopersici. Infection usually occurs on the lower
leaves near the ground, after plants begin to set fruit. Numerous small, circular
spots with dark borders surrounding a beige-colored center appear on the older
leaves. Tiny black specks, which are spore-producing bodies, can be seen in the
center of the spots. Severely spotted leaves turn yellow, die and fall off the plant.
The fungus is most active when temperatures range from 68 to 77° F, the humidity
is high, and rainfall or over-head irrigation wets the plants. Defoliation weakens
the plant, reduces the size and quality of the fruit, and exposes the fruit to sunscald
(see below). The fungus is not soil-borne, but can overwinter on crop residue from
previous crops, decaying vegetation and some wild hosts related to tomato.
Prevention & Treatment: Currently grown tomato cultivars are susceptible to
Septoria leaf spot. Crop rotation of 3 years and sanitation (removal of crop debris)
will reduce the amount of inoculum. Do not use over-head irrigation. Repeated
fungicide applications with chlorothalonil (very good) or copper fungicide, or
mancozeb (good) will keep the disease in check. See Table 1 for examples of
fungicide products for home garden use.

Two Spotted spider mites

Leaves stippled with yellow; leaves may appear bronzed; webbing covering leaves;
mites may be visible as tiny moving dots on the webs or underside of leaves, best
viewed using a hand lens; usually not spotted until there are visible symptoms on
the plant; leaves turn yellow and may drop from plant. Arachnid are the main cause
for this disease. Spider mites thrive in dusty conditions; water-stressed plants are
more susceptible to attack.
Prevention and Treatment
In the home garden, spraying plants with a strong jet of water can help reduce
buildup of spider mite populations; if mites become problematic apply insecticidal
soap to plants; certain chemical insecticides may actually increase mite populations
by killing off natural enemies and promoting mite reproduction.

Target Spot Corynespora cassiicola

The fungus infects all parts of plant. Infected leaves shows small, pinpoint, water
soaked spots initially. As the disease progress the spots enlarge to become necrotic
lesions with conspicuous concentric circles, dark margins and light brown centers.
Whereas the fruits exhibit brown, slightly sunken flecks in the beginning but later
the lesions become large pitted appearance.

The pathogen infects cucumber, pawpaw , ornamental plants, some weed species
etc. The damaged fruits are susceptible for this disease.
Prevention and Treatment:

Remove the plant debris and burn them. Avoid over application of nitrogen
fertilizer. If the disease is severe spray suitable fungicides.

Tomato mosaic virus Tomato mosaic virus

Symptoms can occur at any growth stage and any part of the plant can be affected;
infected leaves generally exhibit a dark green mottling or mosaic; some strains of
the virus can cause yellow mottling on the leaves; young leaves may be stunted or
distorted; severely infected leaves may have raised green areas; fruit yields are
reduced in infected plants; green fruit may have yellow blotches or necrotic spots;
dark necrotic streaks may appear on the stems, petioles leaves and fruit.
ToMV is a closely related strain of Tobacco mosaic virus (TMV), it enters fields
via infected weeds, peppers or potato plants; the virus may also be transmitted to
tomato fields by grasshoppers, small mammals and birds.

Tomato Yellow Leaf Curl

Tomato yellow leaf curl virus (TYLCV) is not seed-borne, but is transmitted by
whiteflies. This disease is extremely damaging to fruit yield in both tomato and
pepper crops. Whiteflies may bring the disease into the garden from infected weeds
nearby, such as various nightshades and jimsonweed. After infection, tomato plants
may be symptomless for as long as 2 – 3 weeks.

Symptoms in tomato plants are the upward curling of leaves, yellow (chlorotic)
leaf margins, smaller leaves than normal, plant stunting, and flower drop. If tomato
plants are infected early in their growth, there may be no fruit formed. Infected
plants may appear randomly throughout the garden. Pepper plants may also
become infected, but will show no symptoms.

Prevention & Treatment: Removal of plants with initial symptoms may slow the
spread of the disease. Rogued (pulled out) infected plants should be immediately
bagged to prevent the spread of the whiteflies feeding on those plants. Keep weeds
controlled within and around the garden site, as these may be alternate hosts for
whiteflies. Reflective mulches (aluminum or silver-colored) can be used in the
rows to reduce whitefly feeding.

Low concentration sprays of a horticultural oil or canola oil will act as a whitefly
repellent, reduce feeding and possibly transmission of the virus. Use a 0.25 to 0.5%
oil spray (2 to 4 teaspoons horticultural or canola oil & a few drops of dish soap
per gallon of water) weekly. Examples of products containing horticultural oil are
Ferti-lome Horticultural Oil Spray and Bonide All Seasons Spray Oil. Example of
a product containing canola oil is Espoma Earth-tone Horticultural Oil Ready to
Spray.

At the end of the season, remove all susceptible plants and burn or dispose of them.
See Table 6 for tomato cultivars with resistance to Tomato yellow leaf curl virus.

1.4 OBJECTIVE

2 LITERATURE SURVEY
Food Image Recognition Based on Densely Connected Convolutional Neural Networks
(2020)
Convolutional neural networks have been widely used for image recognition as they are capable
of extracting features with high accuracy. In this paper, we propose a DenseFood model based
on densely connected convolutional neural network architecture, which consists of multiple
layers. A combination of softmax loss and center loss is used during the training process to
minimize the variation within the same category and maximize the variation across different
ones. For performance comparison, three models, namely, DenseFood, DenseNet121, and
ResNet50 are trained using VIREO-172 dataset. In addition, we fine tune pre-trained
DenseNet121 and ResNet50 models to extract features from the dataset. Experimental results
show that the proposed DenseFood model achieves an accuracy of 81.23% and outperforms the
other models in comparison.

A Review on Pomegranate Disease Classification Using Machine Learning and Image


Segmentation Techniques (2020)
The paramount motive of farming is to yield good crops without any disease present. The role of
digital image processing along with image analysis is indispensable in the sector of agriculture.
Preprogrammed awareness of plant malady and production of good plants is of substantial
significance in agriculture industrialization. To prevent the loss of agricultural yield one has to
recognize the malady. Manually, detection of plants malady is quite difficult, it required huge
time for analyzing the malady present on the fruit. To tame this problem, a machine learning-
based approach is recommended which can evaluate the image of the fruit to detect the disease.
Image processing is the method which is successfully used for the recognition of plant malady.
This paper, contribute a review on approach evolve for detection of diseases in plants using their
images.

Plant disease analysis using image processing in MATLAB (2019)


—Recognizable proof of plant ailment is troublesome in horticulture field. In the event that
recognizable proof is mistaken, at that point there is an enormous misfortune on the generation
of yield and efficient estimation of market. Leaf infection recognition requires tremendous sum
of work, information in the plant sicknesses, and furthermore require the additionally preparing
time. So we can utilize picture handling for recognizable proof of leaf infection in MATLAB.
Recognizable proof of ailment pursues the means like stacking the picture, differentiate upgrade,
changing over RGB to HSI, extricating of highlights and SVM.

A Facial Pore Aided Detection System using CNN Deep Learning Algorithm (2018)
Many people are concerned about their facial skin maintenance. Rough pore is one of the facial
skin problems which annoyed many people. The size of facial pore is tiny, and it has various
shapes. Therefore, it is difficult to recognize facial pore by using traditional image processing. In
this paper, we propose an approach based on convolutional neural networks (CNNs) to develop a
facial pore aided detection system. We use the LeNet-5 model as our benchmark architecture,
and investigate the performance of different depths network on our facial pore dataset. The facial
pore aided detection system will help people understand more about their facial skin problems
and properly keep their facial skin well.

WHEAT DISEASE DETECTION IN IMAGE PROCESSING USING KNN CLASSIFIER


FOR MORE ACCURATE RESULTS (2018)
The image processing is the technique which can propose the information stored in the form of
pixels. The plant disease detection is the technique which can detect the disease from the leaf.
The plant disease detection algorithms has various steps like pre-processing, feature extraction,
segmentation and classification. The KNN classifier technique is applied which can classify
input data into certain classes. The performance of KNN classifier is analyzed that KNN
classifier has high accuracy, less fault detection as compared to other techniques.
BONE CANCER DETECTION USING K-MEANS SEGMENTATION AND KNN
CLASSIFICATION (2019)
From couple of years image processing techniques are extensively utilized for different
therapeutic image modalities in which to distinguish infection as in brief period time factor
assumes an extremely critical job. The most ideal approach to depict bone malignancy in all
stages utilizing image processing. Identifying cancer in the bone is a testing issue because of its
complex structure. Here, past analysts have given far reaching survey of bone malignant growth
recognition using image processing strategies. A decent research work has been made to the
CAD framework behind distinguishing proof of bone malignant growth by images. In this paper
we proposed a bone malignant growth identification utilizing kmeans segmentation and KNN
classifier to recognize the bone disease utilizing image processing strategy for ultra sound
images of bones. The proposed outcomes are promising with more exactness up to 98.14%
accuracy.

A Leaf Recognition Approach to Plant Classification Using Machine Learning (2018)


The identification of plants is a very important component of workflows in plant ecological
research. This paper presents an automated leaf recognition method for plant identification. The
proposed technique is simple and computationally efficient. It is based on a combination of two
types of texture features, named Bag-of-features (BOF) and Local Binary Pattern (LBP). These
features are utilized as inputs to a decision-making model that is based on a multiclass Support
Vector Machine (SVM) classifier. The introduced method is evaluated on a publicly available
leaf image database. The experimental results demonstrate that our proposed method is the
highly efficient technique for plant recognition.

Survey on Face Expression Recognition using CNN (2019)


Recognition of facial expressions plays a major role in many automated system applications like
robotics, education, artificial intelligence, and security. Recognizing facial expressions
accurately is challenging. Approaches for solving FER (Facial Expression Recognition) problem
can be categorized into 1) Static single images and 2) Image sequences. Traditionally, different
techniques like Multi-layer Perceptron Model, k-Nearest Neighbours, Support Vector Machines
were used by researchers for solving FER. These methods extracted features like Local Binary
Patterns, Eigenfaces, Face-landmark features, and Texture features. Among all these methods,
Neural Networks have gained very much popularity and they are extensively used for FER.
Recently, CNNs (Convolutional Neural Networks) have gained popularity in field of deep
learning because of their casual architecture and ability to provide good results without
requirement of manual feature extraction from raw image data. This paper focuses on survey of
various face expression recognition techniques based on CNN. It includes state-of-the-art
methods suggested by different researchers. The paper also shows steps needed for usage of
CNN for FER. This paper also includes analysis of CNN based approaches and issues requiring
attention while choosing CNN for solving FER.
3 SYSTEM ANALYSIS
3.1 EXISITNG SYSTEM

The existing system is based on the segmentation method simple linear iterative clustering to
detect disease in plant leaves. It also shows visual attributes such as color, gradient, texture,
and shape to describe the features of leaves

3.1.1 Disadvantages
3.2 PROPOSED SYSTEM
• Machine learning is applied to detect diseases in plant leaves as it analyzes the data from
different aspects, and classifies it into one of the predefined set of classes.
• The morphological features and properties like color, intensity and dimensions of the plant
leaves are taken into consideration for classification.
• It presents an overview on various types of plant diseases and different classification
techniques in machine learning that are used for identifying leaf diseases.
• It focuses on identifying the tomato plant leaf diseases with machine learning
approach and not uses CNN as classifier . So the accuracy in prediction of plant leaf
disease is average.

3.2.1 Advantages
It is fast to process new input data.
Features automatically deduced and optimally tuned for the desired outcome.
It provides more accuracy while compared to PNN.

CHAPTER 4
SYSTEM REQUIREMENTS

4.1 REQUIREMENTS
The software requirements specification is the most important document in the software
development process. User requirements are expressed in natural language.
 Anaconda Navigator(Jupyter Notebook)
 Windows XP/7/8
4.1.1 Anaconda Navigator
Anaconda Navigator is a desktop graphical user interface (GUI) included in Anaconda
distribution that allows you to launch applications and easily manage conda packages,
environments, and channels without using command-line commands. Navigator can search for
packages on Anaconda Cloud or in a local Anaconda Repository. It is available for Windows,
macOS, and Linux.

In order to run, many scientific packages which despond’s on specific versions of other packages.
Data scientists often use multiple versions of many packages and use multiple environments to
separate these different versions. The command-line program conda is both a package manager
and an environment manager. This helps data scientists ensure that each version of each package
has all the dependencies it requires and works correctly. Navigator is an easy, point-and-click
way to work with packages and environments without needing to type conda commands in a
terminal window.

4.1.2 Applications
The following applications are available by default in Navigator:

JupyterLab
Jupyter Notebook
Spyder
PyCharm
VSCode
Glueviz
Orange 3 App
RStudio
Anaconda Prompt (Windows only)
Anaconda PowerShell (Windows only)

4.1.3 CONDA

CONDA is an open source package management system and environment management


system that runs on Windows, macOS and Linux. CONDA quickly installs runs and updates
packages and their dependencies. CONDA easily creates, saves, loads and switches between
environments on your local computer. It was created for Python programs, but it can package and
distribute software for any language.

CONDA as a package manager helps you find and install packages. If you need a package
that requires a different version of Python, you do not need to switch to a different environment
manager, because CONDA is also an environment manager. With just a few commands, you can
set up a totally separate environment to run that different version of Python, while continuing to
run your usual version of Python in your normal environment.

4.1.4Anaconda Cloud

Anaconda Cloud is a package management service by Anaconda.Anaconda Cloud makes it easy


to find, access, store and share public notebooks, environments, and conda PyPI packages. Cloud
also makes it easy to stay with current updates made to the packages and environments you are
using. Cloud hosts hundreds of useful Python packages, notebooks and environments for a wide
variety of applications. You do not need to log in, or even to have a Cloud account, to search for
public packages, download and install them.

4.2 Jupyter Notebook


Jupyter Notebook(formerly IPython Notebooks) is a web-based interactive computational
environment for creating Jupyter notebook documents. The "notebook" term can colloquially
make reference to many different entities, mainly the Jupyter web application, Jupyter Python
web server, or Jupyter document format depending on context. A Jupyter Notebook document is
a JSON document, following a versioned schema, and containing an ordered list of input/output
cells which can contain code, text (using Markdown), mathematics, plots and rich media, usually
ending with the ".ipynb" extension.
4.2.1Jupyter Lab
JupyterLab is the next-generation user interface for Project Jupyter. It offers all the familiar
building blocks of the classic Jupyter Notebook (notebook, terminal, text editor, file browser, rich
outputs, etc.) in a flexible and powerful user interface.

4.3 Getting Started


1. Sign up for the Anaconda Enterprise Innovator Program. After sign up, you receive an email
with instructions on how to register and log in.
2. Click the link in your Innovator Program registration email, or in your browser, type the
address to Enterprise.
3. On the Enterprise registration page, create your Enterprise account:
4. On the Enterprise Home page, you can view the list of projects available to you: Projects that
have already been deployed as apps are located in the top navigation bar in Deployments.
5. Familiarize yourself with Enterprise key concepts.
6. To learn by doing, go through the tutorials.

4.3.1 Run Code in Navigator


The simplest way is with Spyder. From the Navigator Home tab, click Spyder, and write and
execute your code.

You can also use Jupyter Notebooks the same way. Jupyter Notebooks are an increasingly
popular system that combines your code, descriptive text, output, images, and interactive
interfaces into a single notebook file that is edited, viewed, and used in a web browser.
4.4 Keras

Keras is a high-level neural networks API, written in Python and capable of running on top
of TensorFlow, CNTK, or Theano. It was developed with a focus on enabling fast
experimentation. Being able to go from idea to result with the least possible delay is the key to
performing good research.

4.4.1 Why Keras

Keras is an API designed for human beings, not machines. It offers consistent & simple
APIs, it minimizes the number of user actions required for common use cases, and it provides
clear and actionable feedback upon user error.

4.5 TensorFlow

TensorFlow is free and opensource softwarelibrary for dataflow and differentiable programming
across a range of tasks. It is a symbolic math library, and is also used for machine
learning applications such as neural networks.[4] It is used for both research and production
at Google.‍

4.5.1 Why TensorFlow

TensorFlow is an end-to-end open source platform for machine learning. It has a comprehensive,
flexible ecosystem of tools, libraries and community resources that lets researchers push the
state-of-the-art in ML and developers easily build and deploy ML powered applications.
4.6 Quitting the Anaconda Navigator
 To end your session, Open Navigator.
 Select default environment.
 Click 'anaconda' for updating.
 Click 'apply'. ...
 Click 'apply' to accept. ...
 On navigator menu, click 'file>quit'
Each time NAVIGATOR quits that, for example, does not executes functions to save the
work.

4.7 REQUIREMENT SPECIFICATION


The requirements specification is a technical specification of requirements for the software
products. It is the first step in the requirements analysis process. It lists the requirements of a
particular software system including functional, performance and security requirements. The
requirements also provide usage scenarios from a user, an operational and an administrative
perspective. The purpose of software requirements specification is to provide a detailed overview
of the software project, its parameters and goals. This describes the project target audience and its
user interface, hardware and software requirements. It defines how the client, team and audience
see the project and its functionality.
4.7.1 Hardware
 Hard Disk : 1 TB

 RAM : 4.00 GB

 Processor : Intel® core™ i3-6006U CPU

4.7.2 Software
 Anaconda Navigator(Jupyter Notebook)
Windows XP/7/8
Chapter 5
5.1 Architecture diagram

The proposed method consists of a CNN layer and a Pooling layer .Collecting the datasets
is one of the most tedious process as the collected dataset must be collected from an authentic
and reliable source. Data set Collection process involves collection of datasets from various
authentic sources and splitting the datasets into train and test data images. And the next step is
data preprocessing, data preprocessing is one of the data techniques that is used to transform raw
unformatted data into a desired and formatted data. The Pre-processing involves scaling of
images, reshaping of images to specific width and height. Data preprocessing involves steps like
splitting the dataset into training and testing dataset, rescaling and reshaping the images. The
training and testing datasets are used to train and test the module. some images may be of higher
pixel contrast and some image may be of lower pixel contrast The high range image tends to
create stronger loss while low range create weak loss, the sum of them will all contribute the
back propagation update so scaling of image to the same range [0 to 1] allows the images to
contribute evenly to the total loss here. The description of CNNs so far suggests a simple
architecture corresponding to a single stack of several convolutional layers. This configuration is
the most commonly implemented architecture in the computer vision literature. However, one
could imagine other architectures that might be more appropriate for the task at hand.

Fig 5.1 Architecture diagram

The next step is implementation of CNN, a deep learning algorithm that takes an image as input
and used to assign weights and bias to various aspects of the image and differentiate the images
from one other. The architecture of CNN is comparable to many aspects of the human brain, A
convolution neural network stars with an input image. The input image is broken into pixels. The
pixels are interrupted as 2D array (2*2 pixels).Random pixels are taken into account and
maximum pooling is done. The pooling layer is added after the CNN layer

Fig 5.2Working of CNN

The CNN model consists of single input and single output node, it contains many hidden
layers and each hidden layer consists of many neurons. Each neuron of a hidden layer is
connected to all the neurons of another hidden layer. Activation functions are added in the neural
network in order to introduce the non linear properties into the neural network. Activation
functions are necessary for the Non-linear complex functional mappings between the inputs and
response variables.
As training the neural network is an iterative process, so we have to minimize the loss
function in order to increase the accuracy of the module. The optimizers are used to update the
weight parameters in order to minimize the loss function. The CNN model is trained by changing
the activation functions and optimizers for every epoch of an image, the model is trained with
many epochs for an single imge

5.2 DEEP NEURAL NETWORK


A deep neural network is a neural network with a certain level of complexity, a neural
network with more than two layers. Deep neural networks use sophisticated mathematical
modeling to process data in complex ways. Many experts define deep neural networks as
networks that have an input layer, an output layer and at least one hidden layer in between. Each
layer performs specific types of sorting and ordering in a process that some refer to as “feature
hierarchy.” One of the key uses of these sophisticated neural networks is dealing with unlabeled
or unstructured data. The phrase “deep learning” is also used to describe these deep neural
networks, as deep learning represents a specific form of machine learning where technologies
using aspects of artificial intelligence seek to classify and order information in ways that go
beyond simple input/output protocols.
5.2.1 Application

Large-scale automatic speech recognition is the first and most convincing successful case
of deep learning. LSTM RNNs can learn "Very Deep Learning" tasks that involve multi-second
intervals containing speech events separated by thousands of discrete time steps, where one time
step corresponds to about 10 ms. LSTM with forget gates is competitive with traditional speech
recognizers on certain tasks.

 Automatic speech recognition

 Main article: Speech recognition

The initial success in speech recognition was based on small-scale recognition tasks based
on TIMIT. The data set contains 630 speakers from eight major dialects of American English,
where each speaker reads 10 sentences. Its small size lets many configurations be tried. More
importantly, the TIMIT task concerns phone-sequence recognition, which, unlike word-sequence
recognition, allows weak language models (without a strong grammar). This lets the weaknesses
in acoustic modeling aspects of speech recognition be more easily analyzed. The error rates
listed below, including these early results and measured as percent phone error rates (PER), have
been summarized over the past 20 years.
5.3 TECHOPEDIA EXPLAINS DEEP NEURAL NETWORK

A neural network, in general, is a technology built to simulate the activity of the human
brain – specifically, pattern recognition and the passage of input through various layers of
simulated neural connections.

Many experts define deep neural networks as networks that have an input layer, an output
layer and at least one hidden layer in between. Each layer performs specific types of sorting and
ordering in a process that some refer to as “feature hierarchy.” One of the key uses of these
sophisticated neural networks is dealing with unlabeled or unstructured data. The phrase “deep
learning” is also used to describe these deep neural networks, as deep learning represents a
specific form of machine learning where technologies using aspects of artificial intelligence seek
to classify and order information in ways that go beyond simple input/output protocols.
Neural networks are a set of algorithms, modeled loosely after the human brain, that are
designed to recognize patterns. They interpret sensory data through a kind of machine
perception, labeling or clustering raw input. The patterns they recognize are numerical,
contained in vectors, into which all real-world data, be it images, sound, text or time series, must
be translated. Neural networks help us cluster and classify. You can think of them as a clustering
and classification layer on top of data you store and manage. They help to group unlabeled data
according to similarities among the example inputs, and they classify data when they have a
labeled dataset to train on. (To be more precise, neural networks extract features that are fed to
other algorithms for clustering and classification; so you can think of deep neural networks as
components of larger machine-learning applications involving algorithms for reinforcement
learning, classification and regression.

5.4 TYPES OF NEURAL NETWORKS

A neural network is a system of hardware and / or software patterned after the operation of
neurons in the human brain. These are the varieties of deep learning technologies.

 Feedforward
 Regulatory feedback
 Radial basis function (RBF)
 Recurrent neural network
 Modular
 Physical
 Convolutional
5.4.1 Feedforward
The feedforward neural network was the first and simplest type. In this network the
information moves only from the input layer directly through any hidden layers to the output
layer without cycles/loops. Feedforward networks can be constructed with various types of units,
such as binary McCulloch-Pitts neurons, the simplest of which is the perceptron. Continuous
neurons, frequently with sigmoidal activation, are used in the context of backpropagation.

5.4.2 Regulatory feedback


Regulatory feedback networks started as a model to explain brain phenomena found
during recognition including network-wide bursting and difficulty with similarity found
universally in sensory recognition. This approach can also perform mathematically equivalent
classification as feedforward methods and is used as a tool to create and modify networks.
5.4.3 Radial basis function (RBF)
Radial basis functions are functions that have a distance criterion with respect to a center.
Radial basis functions have been applied as a replacement for the sigmoidal hidden layer transfer
characteristic in multi-layer perceptrons. RBF networks have two layers: In the first, input is
mapped onto each RBF in the 'hidden' layer. The RBF chosen is usually a Gaussian.
5.4.4 Recurrent neural network
Recurrent neural networks (RNNs) propagate data forward, but also backwards, from later
processing stages to earlier stages. RNNs can be used as general sequence processors.
5.4.5 Modular neural network
Biological studies have shown that the human brain operates as a collection of small
networks. This realization gave birth to the concept of modular neural networks, in which
several small networks cooperate or compete to solve problems.

5.4.6 Physical neural network


A physical neural network includes electrically adjustable resistance material to simulate
artificial synapses. Examples include the ADALINE memristor-based neural network.
[45]
An optical neural network is a physical implementation of an artificial neural
network with components. The ADALINE circuitry was briefly commercialized by the
Memistor Corporation enabling some applications in pattern recognition. However, since the
memistor were not fabricated using integrated circuit fabrication technique the technologies was
scalable and was eventually abandoned as solid state.
5.4.7 Convolutional Neural Network

A Convolutional Neural Network (ConvNet/CNN) is a Deep Learning algorithm which can


take in an input image, assign importance (learnable weights and biases) to various
aspects/objects in the image and be able to differentiate one from the other. The pre-processing
required in a ConvNet is much lower as compared to other classification algorithms. While in
primitive methods filters are hand-engineered, with enough training, ConvNets have the ability to
learn these filters/characteristics.

The architecture of a ConvNet is analogous to that of the connectivity pattern of Neurons in the
Human Brain and was inspired by the organization of the Visual Cortex. Individual neurons
respond to stimuli only in a restricted region of the visual field known as the Receptive Field. A
collection of such fields overlap to cover the entire visual area.

In cases of extremely basic binary images, the method might show an average precision score
while performing prediction of classes but would have little to no accuracy when it comes to
complex images having pixel dependencies throughout.

A ConvNet is able to successfully capture the Spatial and Temporal dependencies in an


image through the application of relevant filters. The architecture performs a better fitting to the
image dataset due to the reduction in the number of parameters involved and reusability of
weights. In other words, the network can be trained to understand the sophistication of the image
better.
An RGB image which has been separated by its three color planes — Red, Green, and Blue.
There are a number of such color spaces in which images exist — Grayscale, RGB, HSV,
CMYK, etc. The role of the ConvNet is to reduce the images into a form which is easier to
process, without losing features which are critical for getting a good prediction. This is important
when we are to design an architecture which is not only good at learning features but also is
scalable to massive datasets. The objective of the Convolution Operation is to extract the high-
level features such as edges, from the input image. ConvNets need not be limited to only one
Convolutional Layer. Conventionally, the first ConvLayer is responsible for capturing the Low-
Level features such as edges, color, gradient orientation, etc. With added layers, the architecture
adapts to the High-Level features as well, giving us a network which has the wholesome
understanding of images in the dataset.

5.4.8 Key concept of deep neural network


Deep-learning networks are distinguished from the more commonplace single-hidden-
layer neural networks by their depth; that is, the number of node layers through which data
passes in a multistep process of pattern recognition.

Traditional machine learning relies on shallow nets, composed of one input and one
output layer, and at most one hidden layer in between. More than three layers (including input
and output) qualifies as “deep” learning. So deep is a strictly defined, technical term that means
more than one hidden layer.

In deep-learning networks, each layer of nodes trains on a distinct set of features based on
the previous layer’s output. The further you advance into the neural net, the more complex the
features your nodes can recognize, since they aggregate and recombine features from the
previous lay.

Fig 5.3Successive model layers learn deeper intermediate representations


This is known as feature hierarchy, and it is a hierarchy of increasing complexity and
abstraction. It makes deep-learning networks capable of handling very large, high-dimensional
data sets with billions of parameters that pass through nonlinear functions.

Above all, these nets are capable of discovering latent structures within unlabeled,
unstructured data, which is the vast majority of data in the world. Another word for
unstructured data is raw media; i.e. pictures, texts, video and audio recordings. Therefore, one of
the problems deep learning solves best is in processing and clustering the world’s raw, unlabeled
media, discerning similarities and anomalies in data that no human has organized in a relational
database or ever put a name to.

For example, deep learning can take a million images, and cluster them according to their
similarities: cats in one corner, ice breakers in another, and in a third all the photos of your
grandmother. This is the basis of so-called smart photo albums.

Now apply that same idea to other data types: Deep learning might cluster raw text such
as emails or news articles. Emails full of angry complaints might cluster in one corner of the
vector space, while satisfied customers, or spambot messages, might cluster in others. This is the
basis of various messaging filters, and can be used in customer-relationship management
(CRM). The same applies to voice messages. With time series, data might cluster around
normal/healthy behavior and anomalous/dangerous behavior. If the time series data is being
generated by a smart phone, it will provide insight into users’ health and habits; if it is being
generated by an auto part, it might be used to prevent catastrophic breakdowns.

Deep-learning networks perform automatic feature extraction without human


intervention, unlike most traditional machine-learning algorithms. Given that feature extraction
is a task that can take teams of data scientist’s years to accomplish, deep learning is a way to
circumvent the chokepoint of limited experts. It augments the powers of small data science
teams, which by their nature do not scale.

When training on unlabeled data, each node layer in a deep network learns features
automatically by repeatedly trying to reconstruct the input from which it draws its samples,
attempting to minimize the difference between the network’s guesses and the probability
distribution of the input data itself. Restricted Boltzmann machines, for examples, create so-
called reconstructions in this manner.

In the process, these networks learn to recognize correlations between certain relevant
features and optimal results – they draw connections between feature signals and what those
features represent, whether it is a full reconstruction, or with labeled data.

A deep-learning network trained on labeled data can then be applied to unstructured data,
giving it access to much more input than machine-learning nets. This is a recipe for higher
performance: the more data a net can train on, the more accurate it is likely to be. (Bad
algorithms trained on lots of data can outperform good algorithms trained on very little.) Deep
learning’s ability to process and learn from huge quantities of unlabeled data give it a distinct
advantage over previous algorithms. Figure 5.3 illustrates successive model layers learn deeper
intermediate representation.

Deep-learning networks end in an output layer: a logistic, or softmax, classifier that


assigns likelihood to a particular outcome or label. We call that predictive, but it is predictive in
a broad sense. Given raw data in the form of an image, a deep-learning network may decide, for
example, that the input data is 90 percent likely to represent a person.

5.5 DEEP NEURAL NETWORK AS GAUSSIAN PROCESS

A deep fully-connected neural network with an I’d prior over its parameters is
equivalent to a Gaussian process (GP) in the limit of infinite network width. This
correspondence enables exact Bayesian inference for neural networks on regression tasks by
means of straightforward matrix computations. For single hidden-layer networks, the covariance
function of this GP has long been known. Recently, kernel functions for multi-layer random
neural networks have been developed, but only outside of a Bayesian framework.
As such, previous work has not identified the correspondence between using these
kernels as the covariance function for a GP and performing fully Bayesian prediction with a
deep neural network. In this work, we derive this correspondence and develop a computationally
efficient pipeline to compute the covariance functions. We then use the resulting GP to perform
Bayesian inference for deep neural networks on MNIST (Modified National Institute of Standard
and Technology Database) and CIFAR-10. We find that the GP-based predictions are
competitive and can outperform neural networks trained with stochastic gradient descent. We
observe that the trained neural network accuracy approaches that of the corresponding GP-based
computation with increasing layer width, and that the GP uncertainty is strongly correlated with
prediction error. We connect our observations to the recent development of signal propagation in
random neural networks. This correspondence enables exact Bayesian inference for neural
networks on regression tasks by means of straightforward matrix computations.
5.6 Pooling
Similar to the Convolutional Layer, the Pooling layer is responsible for reducing the
spatial size of the Convolved Feature. This is to decrease the computational power required to
process the data through dimensionality reduction. Furthermore, it is useful for extracting
dominant features which are rotational and positional invariant, thus maintaining the process of
effectively training of the model.
There are two types of Pooling: Max Pooling and Average Pooling. Max
Pooling returns the maximum value from the portion of the image covered by the Kernel. On the
other hand, Average Pooling returns the average of all the values from the portion of the image
covered by the Kernel.
Max Pooling also performs as a Noise Suppressant. It discards the noisy activations
altogether and also performs de-noising along with dimensionality reduction. On the other hand,
Average Pooling simply performs dimensionality reduction as a noise suppressing mechanism.
Hence, we can say that Max Pooling performs a lot better than Average Pooling.
The Convolutional Layer and the Pooling Layer, together form the i-th layer of a Convolutional
Neural Network. Depending on the complexities in the images, the number of such layers may be
increased for capturing low-levels details even further, but at the cost of more computational
power.
CHAPTER 6
MODULES DESCRIPTION
6.1 MODULES
A module is a separate unit of software or hardware. Typical characteristic of modular
components include portability, which allows them to be used in variety of systems, and
interoperability, which allows them to function with the components of other systems. The
modules used in the detecting Skin cancer are,
 Preprocessing
 Filtering
 Histogram Equalization
 Anisotropic diffusion
 Random Walk Segmentation
 Feature extraction
 Classification
 Post processing
6.1.1 Preprocessing
In signal processing, it is often desirable to be able to perform some kind of noise
reduction on an image or signal. The median filter is a nonlinear digital filteringtechnique, often
used to remove noise. Such noise reduction is a typical pre-processing step to improve the results
of later processing (for example, edge detectionon an image). Median filtering is very widely
used in digital image processing because, under certain conditions, it preserves edges while
removing noise.
6.1.2 Filtering

Median filtering follows this basic prescription. The median filter is normally used to reduce
noise in an image, somewhat like the mean filter. Fig 6. 1 illustrates an example of median
filtering
Fig 6.1 Example of median filter
Like the mean filter, the median filter considers each pixel in the image in turn and looks at its
nearby neighbors to decide whether or not it is representative of its surroundings. Instead of
simply replacing the pixel value with the mean of neighboring pixel values, it replaces it with the
median of those values. The median is calculated by first sorting all the pixel values from the
surrounding neighborhood into numerical order and then replacing the pixel being considered
with the middle pixel value. (If the neighborhood under consideration contains an even number
of pixels, the average of the two middle pixel values is used. Fig 6.2 illustrates an example
calculation
Fig 6.2 Calculation of pixel values
Fig 6.2 Calculating the median value of a pixel neighborhood. As can be seen, the central pixel
value of 150 is rather unrepresentative of the surrounding pixels and is replaced with the median
value: 124. A 3×3 square neighborhood is used here --- larger neighborhoods will produce more
severe smoothing.
6.1.3 Histogram Equalization
Histogram equalization is a method in image processing of contrast adjustment using
the image's histogram.This method usually increases the global contrast of many images,
especially when the usable data of the image is represented by close contrast values. Through
this adjustment, the intensities can be better distributed on the histogram. This allows for areas
of lower local contrast to gain a higher contrast. Histogram equalization accomplishes this by
effectively spreading out the most frequent intensity values.
Histogram equalization is a specific case of the more general class of histogram
remapping methods. These methods seek to adjust the image shows in Fig 6.3 to make it
easier to analyze or improve visual quality (e.g., retinex)
6.1.3.1Back projection
The back projection (or "project") of a histogram image is the re-application of the
modified histogram to the original image, functioning as a look-up table for pixel brightness
values.
For each group of pixels taken from the same position from all input single-channel
images, the function puts the histogram bin value to the destination image, where the coordinates
of the bin are determined by the values of pixels in this input group. In terms of statistics, the
value of each output image pixel characterizes the probability that the corresponding input pixel
group belongs to the object whose histogram is used.
6.1.3.2 Histogram equalization of color images
However it can also be used on color images by applying the same method separately to
the Red, Green and Blue components of the RGB color values of the image. However, applying
the same method on the Red, Green, and Blue components of an RGB image Fig 6.4 defines the
black and red images may yield dramatic changes in the image's color balance since the relative
distributions of the color channels change as a result of applying the algorithm. However, if the
image is first converted to another color space, Lab color space, or HSL/HSV color space in
particular, then the algorithm can be applied to the luminance or value channel without resulting
in changes to the hue and saturation of the image. There are several histogram equalization
methods in 3D space. Trahanias and Venetsanopoulos applied histogram equalization in 3D
color space However, it results in "whitening" Fig 6.5 explains the histogram where the
probability of bright pixels are higher than that of dark ones. Han et al. proposed to use a new
CDF defined by the Iso-luminance plane, which results in uniform gray distribution.

Fig 6.3Before Histogram Equalization


Fig 6.4 Corresponding histogram (red) and cumulative histogram (black)

Fig 6.5 After Histogram Equalization


Graph 6.6 Corresponding histogram (red) and cumulative histogram (black)
6.1.4Anisotropic Diffusion
In image processing and computer vision, anisotropic diffusion, also called Perona–Malik
diffusion, is a technique aiming at reducing image noise without removing significant parts of
the image content, typically edges, lines or other details that are important for the interpretation
of the image.Anisotropic diffusion resembles the process that creates a scale space, where an
image generates a parameterized family of successively more and more blurred images based on
a diffusion process. Each of the resulting images in this family are given as
a convolution between the image and a 2D isotropicGaussian filter, where the width of the filter
increases with the parameter. This diffusion process is a linear and space-invarianttransformation
of the original image. Anisotropic diffusion is a generalization of this diffusion process: it
produces a family of parameterized images, but each resulting image is a combination between
the original image and a filter that depends on the local content of the original image. As a
consequence, anisotropic diffusion is a non-linear and space-variant transformation of the
original image.

6.1.5 Random Walk Segmentation


The random walker algorithm is an algorithm for image segmentation. In the first
description of the algorithm, a user interactively labels a small number of pixels with known
labels (called seeds), e.g., "object" and "background". The unlabeled pixels are each imagined to
release a random walker, and the probability is computed that each pixel's random walker first
arrives at a seed bearing each label, i.e., if a user places K seeds, each with a different label, then
it is necessary to compute, for each pixel, the probability that a random walker leaving the pixel
will first arrive at each seed. These probabilities may be determined analytically by solving a
system of linear equations. After computing these probabilities for each pixel, the pixel is
assigned to the label for which it is most likely to send a random walker. The image is modeled
as a graph, in which each pixel corresponds to a node which is connected to neighboring pixels
by edges, and the edges are weighted to reflect the similarity between the pixels. Therefore, the
random walk occurs on the weighted graph (see Doyle and Snell for an introduction to random
walks on graphs).
Although the initial algorithm was formulated as an interactive method for image
segmentation, it has been extended to be a fully automatic algorithm, given a data fidelity term
(e.g., an intensity prior).It has also been extended to other applications.
6.1.6 Feature Extraction
Many Features are extracted from the input image and all those provides shape measurements.
The properties listed in the Pixel Value Measurements are only valid when you specify a
grayscale image. If you specify 'all', regionprops computes all the shape measurements and, if
you specified a grayscale image, the pixel value measurements. If you specify the string 'basic',
or do not specify the properties argument, regionprops computes only the 'Area','Centroid',
and 'BoundingBox' measurements. You can calculate the following properties on N-D
inputs: 'Area','BoundingBox', 'Centroid', 'FilledArea', 'FilledImage', 'Image', 'PixelIdxList',
'PixelList', and'SubarrayIdx'
Intensity, symmetry and texture features are also extracted.
6.1.7 Classification
Classification of remotely sensed data is used to assign corresponding levels with respect
to groups with homogeneous characteristics, with the aim of discriminating multiple objects
from each other within the image. Classification will be executed on the base of spectral or
spectrally defined features, such as density, texture etc. in the feature space.
6.1.7.1 Neural Network
A neural network is a system of interconnected artificial “neurons” that exchange
messages between each other. The connections have numeric weights that are tuned during the
training process, so that a properly trained network will respond correctly when presented with
an image or pattern to recognize. The network consists of multiple layers of feature-detecting
“neurons”. Each layer has many neurons that respond to different combinations of inputs from
the previous layers. As shown in Figure 6.6, the layers are built up so that the first layer detects a
set of primitive patterns in the input, the second layer detects patterns of patterns, and the third
layer detects patterns of those patterns, and so on. Typical CNNs use 5 to 25 distinct layers of
pattern recognition.

Fig 6.6 Artificial neural network


6.1.7.2 Deep neural netwok
A deep neural network is a neural network with a certain level of complexity, a neural
network with more than two layers. Deep neural networks use sophisticated mathematical
modeling to process data in complex ways Fig 6.7 illustrate the hidden layers.s
A deep neural network (DNN) is an artificial neural network (ANN) with multiple hidden
layers between the input and output layers. DNNs can model complex non-linear relationships.
DNN architectures generate compositional models where the object is expressed as a layered
composition of primitives.
Fig6.7 Illustration of a DNN with hidden layers.

CHAPTER 7
CONCLUSION
The model obtained an accuracy of 80.2% will using the Relu ,Tanh and Sigmoid
activation functions together while the model gave about 50 percent accuracy while using only
Relu activation function and less than 50 percent while using Tanh function and the highest
accuracy was obtained by using these activation functions together.The model was able to
predict more accuratelywhile combining the functions then using these functions separately.

APPENDICES
SAMPLE CODING

from keras.preprocessing.image import ImageDataGenerator


from keras.models import Sequential
from keras.layers import Conv2D, MaxPooling2D
from keras.layers import Activation, Dropout, Flatten, Dense
from keras import backend as K
train_data_dir = 'train'
validation_data_dir = 'test'

img_width, img_height = 150,150


nb_train_samples = 70
nb_validation_samples = 10
epochs = 20
batch_size = 10

if K.image_data_format() == 'channels_first':
input_shape = (3, img_width, img_height)
else:
input_shape = (img_width, img_height, 3)

model = Sequential()
model.add(Conv2D(32, (2, 2), input_shape = input_shape))
model.add(Activation('tanh'))
model.add(MaxPooling2D(pool_size =(2, 2)))

model.add(Conv2D(32, (2, 2)))


model.add(Activation('tanh'))
model.add(MaxPooling2D(pool_size =(2, 2)))

model.add(Conv2D(64, (2, 2)))


model.add(Activation('tanh'))
model.add(MaxPooling2D(pool_size =(2, 2)))

model.add(Dense(64))
model.add(Activation('relu'))
model.add(Dropout(0.1))
model.add(Flatten())
model.add(Dense(1))
model.add(Activation('sigmoid'))

model.summary()
model.compile(loss ='binary_crossentropy',
optimizer ='adam',
metrics =['accuracy'])
train_datagen = ImageDataGenerator(
rescale = 1. / 255,
shear_range = 0.2,
zoom_range = 0.2,
horizontal_flip = True)
test_datagen = ImageDataGenerator(rescale = 1. / 255)

train_generator = train_datagen.flow_from_directory(train_data_dir,
target_size =(img_width, img_height),
batch_size = batch_size, class_mode ='binary')

validation_generator = test_datagen.flow_from_directory(
validation_data_dir,
target_size =(img_width, img_height),
batch_size = batch_size, class_mode ='binary')

from keras import callbacks


early_stopping_monitor = callbacks.EarlyStopping(monitor='val_loss', patience=3, mode='min')
model_checkpoint = callbacks.ModelCheckpoint('model.h5', monitor='val_loss', mode='min', ve
rbose=1, save_best_only=True)

history = model.fit_generator(train_generator,
steps_per_epoch = nb_train_samples // batch_size,
epochs = epochs, validation_data = validation_generator,
validation_steps = nb_validation_samples // batch_size,verbose=1,callbacks=[early_stopping_
monitor, model_checkpoint])

# Accuracy Graph
import matplotlib.pyplot as plt
plt.figure()
plt.plot(history.history['acc'], color='green')
plt.plot(history.history['val_acc'], color='blue')
plt.title('Accuracy ', pad=25)
plt.xlabel('Epoch')
plt.ylabel('Accuracy')
plt.legend(['Train', 'Test'], loc='lower right')
plt.show()

# Accuracy Graph
import matplotlib.pyplot as plt
plt.figure()
plt.plot(history.history['loss'], color='green')
plt.plot(history.history['val_loss'], color='blue')
plt.title('Accuracy ', pad=25)
plt.xlabel('Epoch')
plt.ylabel('Accuracy')
plt.legend(['Train', 'Test'], loc='lower right')
plt.show()

print("Train Data Accuracy",np.mean(history.history['acc']))


print("Train Data Loss",np.mean(history.history['loss']))
print("Test Data Accuracy",np.mean(history.history['val_acc']))
print("Test Data Loss",np.mean(history.history['val_loss']))
from keras.models import load_model
import cv2
import numpy as np
from keras.preprocessing import image

obj = load_model('model.h5')

obj.compile(loss='binary_crossentropy',
optimizer='rmsprop',
metrics=['accuracy'])

img = cv2.imread('train/diseases/fifth.jpg')
img = cv2.resize(img,(150,150))
img = np.reshape(img,[1,150,150,3])

classes = obj.predict_classes(img)

print(classes)

obj = load_model('model.h5')

obj.compile(loss='binary_crossentropy',
optimizer='rmsprop',
metrics=['accuracy'])

img = cv2.imread('test/cancer/cancer6.jpg')
img = cv2.resize(img,(150,150))
img = np.reshape(img,[1,150,150,3])

classes = obj.predict_classes(img)

print(classes)
SAMPLE OUTPUT:

You might also like