Kidney Stone Detection From Ultra Sound Images by Using Canny Edge Detection and CNN Classification
Kidney Stone Detection From Ultra Sound Images by Using Canny Edge Detection and CNN Classification
BACHELOR OF TECHNOLOGY
IN
Submitted by
B.JYOTHIRMAYI 316126510065
M.SUSHMA 316126510027
A.SRIMANOJ 316126510061
BONAFIDE CERTIFICATE
This is to certify that the project report entitled “KIDNEY STONE DETECTION FROM ULTRA
SOUND IMAGES BY USING CANNY EDGE DETECTION AND CNN CLASSIFICATION”
submitted by N.Amruthalakshmi(316126510032), B.Jyothirmayi(316126510065),
M.Sushma(316126510027), A.Sri manoj(316126510061)in partial fulfillment of the requirements
for the award of the degree of Bachelor of Technology in Computer Science Engineering of Anil
Neerukonda Institute of technology and sciences (A), Visakhapatnam is a record of bonafide work
carried out under my guidance and supervision.
ANITS ANITS
(AUTONOMOUS) (AUTONOMOUS)
DECLARATION
This is to certify that the project work entitled “KIDNEY STONE DETECTION FROM
ULTRASOUND IMAGES BY USING CANNY EDGE DETECTION AND CNN
CLASSIFICATION” is a bonafide work carried out by N. AMRUTHA LAKSHMI,
M.SUSHMA 316126510027
The satisfaction and euphoria that accompany the successful completion of task would be
incomplete without the mention of the people who made it possible, whose constant guidance
and encouragement always boosted the morale. We take a great pleasure in presenting a project,
which is the result of a studied blend of both research and knowledge.
We first take the privilege to thank the Head of our Department, Dr.R.Sivaranjani, for
permitting us in laying the first stone of success and providing the lab facilities, we would also
like to thank the other staff in our department and lab assistants who directly or indirectly
helped us in successful completion of the project.
We feel great to thank Mrs.G.SANTOSHI , Assistant Professor, M.Tech department of
Computer Science and engineering, ANITS ,who are our project guides and who shared their
valuable knowledge with us and made us understand the real essence of the topic and created
interest in us to work day and night for the project. we also thank our B.Tech coordinator
Mr.K.SURESH, Assistant Professor, Department of Computer Science and Engineering,
ANITS for his support and encouragement.
We also thank Principal and supporting management for providing resources when required.
PROJECTSTUDENTS
B.JYOTHIRMAYI 316126510065
M.SUSHMA 316126510027
Key Words: Kidney stone detection, CNN classification, wavelet processing, ultrasound images,
Gaussian filter, canny edge detection.
i
LIST OF FIGURES
PAGE
S.NO FIGURE DESCRIPTION
NO
3.1 Methodology 13
3.1.1 Gaussian filter example 14
3.2.1 Steps involved in canny edge detection 16
3.2.2 Non-maximum suppression 17
3.2.3 Threshold representation 18
3.2.4 Edge detection example 18
3.4.1 CNN classification 20
3.5.1 Architecture 23
4.1.1 Dataset images 24
4.1.2 Dataset csv file 25
4.1.3 Pixel form of image 25
4.1.4 Convolution methodology 28
4.1.5 Maxpooling 28
4.1.6 Converting matrix into linear array form 29
4.1.7 Accuracy of stone detection 30
4.1.8 Output with label yes (presence of stone) 32
4.1.9 Output with label No (absence of stone) 32
4.3.1 Accuracy 42
4.3.2 Image Accuracies 43
4.3.3 Output 1 44
4.3.4 Output 2 44
4.3.5 Output 3 44
4.3.6 Output 4 45
4.3.7 Output 5 45
ii
LIST OF TABLES
iii
TABLE OF CONTENTS
ABSTRACT i
KEYWORDS i
LIST OF FIGURES ii
LIST OF TABLES iii
CHAPTER1: INTRODUCTION 1
1.1Title explanation 2
1.1.1 Medical Imaging Techniques 4
1.2 Motivation for the work 5
1.3 Problem statement 7
1.4 Organisation of thesis 7
CHAPTER 2: LITERATURE SURVEY 9
2.1 Level set segmentation 9
2.2 Seeded region growing based segmentation 10
2.3 Entropy based segmentation 10
2.4 Automated feature description 11
2.5 Existing system 11
CHAPTER 3: METHODOLOGY 13
3.1 Image Pre-Processing 13
3.2 Image Segmentation 15
3.3Wavelet Processing 19
3.4 CNN Classification 19
3.5 Proposed system 21
3.5.1 Architecture 22
CHAPTER 4: EXPERIMENTAL ANALYSIS AND RESULTS 24
4.1 System configurations 33
4.1.1 Software requirements 33
4.1.2 Hardware requirements 34
4.2 Sample code 34
4.2.1Data set generation code 34
4.2.2 Gaussian blur code 35
4.2.3 Canny edge detection code 37
4.2.4 CNN code 38
4.2.4 Main code 39
4.3 Screenshots 42
4.4 Testing 46
4.4.1 Test plan 48
4.5 Test report 51
CHAPTER 5: CONCLUSIONAND FUTURE WORK 52
CHAPTER 6: APPENDIX 53
CHAPTER 7: REFERENCES 56
1. INTRODUCTION
Digital Image Processing means processing digital image by means of a digital computer. We
can also say that it is a use of computer algorithms, in order to get enhanced image either to
extract some useful information. Digital image processing deals with manipulation of digital
images through a digital computer. It is a subfield of signals and systems but focus particularly
on images. DIP focuses on developing a computer system that is able to perform processing on
an image. The input of that system is a digital image and the system process that image using
efficient algorithms, and gives an image as an output.
3. Output in which result can be altered image or a report which is based on analyzing that
image.
Advantages:
1. Remove noises.
2. Correct image density and contrast.
3. Helps to easily store and retrieve in computers.
4. Image can be made available in any desired formats like black and white, negative
image.
Disadvantages:
1|Page
1.1 TITLE EXPLANATION
Kidney stone disease is one of the major life threatening ailments persisting worldwide. Kidney
stone, also known as a renal calculus is a solid piece of material which is formed in the kidneys
from minerals in urine. Kidney stones typically leave the body in the urine stream, and a small
stone may pass without causing symptoms. The stone diseases remain unnoticed in the initial
stage, which in turn damages the kidney as they develop. A majority of people are affected by
kidney failure due to diabetes mellitus, hypertension, glomerulonephritis, and so forth. Since
kidney malfunctioning can
be menacing, diagnosis of the problem in the initial stages is advisable. Ultrasound (US) image is
one of the currently available methods with non-invasive low cost and widely used imaging
techniques for analyzing kidney diseases.
A kidney stone may not cause symptoms until it moves around within your kidney or passes into
your ureter the tube connecting the kidney and bladder. At that point, you may experience these
signs and symptoms:
2|Page
Pain caused by a kidney stone may change for instance, shifting to a different location or
increasing in intensity as the stone moves through your urinary tract.
Kidney stones often have no definite, single cause, although several factors may increase your
risk. Kidney stones form when your urine contains more crystal-forming substances such as
calcium, oxalate and uric acid than the fluid in your urine can dilute. At the same time, your
urine may lack substances that prevent crystals from sticking together, creating an ideal
environment for kidney stones to form.
Knowing the type of kidney stone helps determine the cause and may give clues on how to
reduce your risk of getting more kidney stones. If possible, try to save your kidney stone if you
pass one so that you can bring it to your doctor for analysis.
Calcium stones: Most kidney stones are calcium stones, usually in the form of calcium
oxalate. Oxalate is a naturally occurring substance found in food and is also made daily
by your liver. Some fruits and vegetables, as well as nuts and chocolate, have high
oxalate content.
Dietary factors, high doses of vitamin D, intestinal bypass surgery and several metabolic
disorders can increase the concentration of calcium or oxalate in urine. Calcium stones may also
occur in the form of calcium phosphate. This type of stone is more common in metabolic
conditions, such as renal tubular acidosis. It may also be associated with certain migraine
headaches or with taking certain seizure medications, such as topiramate (Topamax).
Struvite stones: Struvite stones form in response to an infection, such as a urinary tract
infection. These stones can grow quickly and become quite large, sometimes with few
symptoms or little warning.
3|Page
Uric acid stones: Uric acid stones can form in people who don't drink enough fluids or
who lose too much fluid, those who eat a high-protein diet, and those who have gout.
Certain genetic factors also may increase your risk of uric acid stones.
Cystine stones: These stones form in people with a hereditary disorder that causes the
kidneys to excrete too much of certain amino acids (cystinuria).
Blood testing: Blood tests may reveal too much calcium or uric acid in your blood.
Blood test results help monitor the health of your kidneys and may lead your doctor to
check for other medical conditions.
Urine testing: The 24-hour urine collection test may show that you're excreting too many
stone-forming minerals or too few stone-preventing substances. For this test, your doctor
may request that you perform two urine collections over two consecutive days.
Imaging: Imaging tests may show kidney stones in your urinary tract. Options range
from simple abdominal X-rays, which can miss small kidney stones, to high-speed or
dual energy computerized tomography (CT) that may reveal even tiny stones.
Analysis of passed stones: You may be asked to urinate through a strainer to catch
stones that you pass. Lab analysis will reveal the makeup of your kidney stones. Your
doctor uses this information to determine what's causing your kidney stones and to form a
plan to prevent more kidney stones.
Other imaging options include an ultrasound, a noninvasive test, and intravenous urography,
which involves injecting dye into an arm vein and taking X-rays (intravenous pyelogram) or
obtaining CT images (CT urogram) as the dye travels through your kidneys and bladder.
X-rays: X-rays (radiographs) are the most common and widely available diagnostic
imaging technique. Even if you also need more sophisticated tests, you will probably get
4|Page
an x-ray first. X-rays may not show as much detail as an image produced with more
sophisticated techniques. They are, however, the most common imaging tool used to
evaluate an orthpaedic problem and are readily available in most doctors' offices.
Ultrasound: Ultrasound uses high-frequency sound waves that echo off the body. It
is painless and noninvasive, and does not require radiation. Ultrasound is used most
often to look for blood clots, but can also show other problems, such as a Baker's
cyst behind the knee or even a rotator cuff tear in the shoulder or for detection of
kidney stones.
Bone scan: A bone scan uses a small amount of radioactive material to identify areas
of increased bone activity. The material is injected into a vein and is absorbed by
areas that are forming new bone, such as a healing fracture, bone tumor, or bone
infection.
Almost in every field, digital image processing puts a live effect on things and is growing with
time to time and with new technologies. This lead us to think differently and made us to research
5|Page
in medical stream. By this we got to know about kidney stones and its effects when it is not
cured in early stage it may lead to surgery. We all have a saying “Prevention is better than cure”,
when stones are identified we can cure them without further delay in process.
It refers to the process in which we can modify the look and feel of an image. It basically
manipulates the images and achieves the desired output. It includes conversion, sharpening,
blurring, detecting edges, retrieval, and recognition of images.
2) Medical Field
There are several applications under medical field which depends on the functioning of digital
image processing.
o Gamma-ray imaging
o X-Ray Imaging
o Medical CT scan
o UV imaging
3) Robot vision
There are several robotic machines which work on the digital image processing. Through image
processing technique robot finds their ways, for example, hurdle detection root and line follower
robot.
4) Pattern recognition
It involves the study of image processing, it is also combined with artificial intelligence such that
computer-aided diagnosis, handwriting recognition and images recognition can be easily
implemented. Now a days, image processing is used for pattern recognition.
6|Page
5) Video processing
It is also one of the applications of digital image processing. A collection of frames or pictures
are arranged in such a way that it makes the fast movement of pictures. It involves frame rate
conversion, motion detection, reduction of noise and colour space conversion etc.
The kidney malfunctioning can be a life intimidating. Hence early detection of kidney
stone is essential and this can be done by image processing techniques. One of the
method to identify stones is by taking ultrasound images as an input. The
identification of stone in kidney using ultrasound images comprise of speckle noise
and are of low contrast. As a result , we use a filter to smoothen the image and CNN
algorithm is applied for the precise results of kidney stone identification.
Chapter-1 is about introduction which gives an idea about of our project domain i.e., Image
Processing and title is explained i.e., kidney stone detection using ultrasound images. How
stones are formed, what type of stones are present and its symptoms are explained.
Chapter-2 is about literature survey here all previous methods and existing models are
examined.
Chapter-3 contains methodology, in this we used Gaussian filter for filtering, canny edge
detection for segmentation, wavelet processing and at last CNN is applied. Even architecture of
the system is explained thoroughly.
7|Page
Chapter-4 consists experimental analysis and results in this sample code, testing results, system
configurations such as software and hardware requirements, input and output images are
displayed .
Chapter-5 explains Conclusion and future work about our project i.e., kidney stone detection
using ultrasound images.
8|Page
2. LITERATURE SURVEY
Literature survey is the most important step in software development process. Before
developing the tool it is necessary to determine the time factor, economy and company
strength. Once these things are satisfied, then next step is to determine which operating
system and language can be used for developing the tool. Once the programmers start
building the tool the programmers need lot of external support. This support can be
obtained from senior programmers, from book or from websites. Before building the
system the above consideration are taken into account for developing the proposed
system.
K.Viswanath and Dr.R.Gunasundari, 2015 used level set segmentation for identification of
Kidney abnormalities such as formation of stones, cysts, blockage of urine, congenital
anomalies, and cancerous cells. During surgical processes it is vital to recognize the true and
precise location of kidney stone. The detection of kidney stones using ultrasound imaging [1] is a
highly challenging task as they are of low contrast and contain speckle noise. This challenge is
overcome by employing suitable image processing techniques. The ultrasound image is first
preprocessed to get rid of speckle noise using the image restoration process. The restored image
is smoothened using Gabor filter and the subsequent image is enhanced by histogram
equalization. The preprocessed image is achieved with level set segmentation to detect the stone
region. Segmentation process is employed twice for getting better results; first to segment kidney
portion and then to segment the stone portion, respectively. In this work, the level set
segmentation uses two terms, namely, momentum and resilient propagation ( R prop ) to detect
the stone portion. After segmentation, the extracted region of the kidney stone is given to
Symlets, Biorthogonal (bio3.7, bio3.9, and bio4.4), and Daubechies lifting scheme wavelet
subbands to extract energy levels. These energy levels provide evidence about presence of stone,
by comparing them with that of the normal energy levels. They are trained by multilayer
perceptron (MLP) and back propagation (BP) ANN to classify and its type of stone with an
accuracy of 98.8%. The prosed work is designed and real time is implemented on both Filed
9|Page
Programmable Gate Array Vertex-2Pro FPGA using Xilinx System Generator (XSG) Verilog
and Matlab 2012a.
P.R Tamilselvi and P.Thangaraj ,2011 presented a scheme for ultrasound kidney image diagnosis
for stone and its early detection based on improved seeded region growing based segmentation
and classification of kidney images with stone sizes. With segmented portions of the images the
intensity threshold variation helps in identifying multiple classes to classify the images as
normal, stone and early stone stages. The improved semiautomatic Seeded Region Growing
(SRG) based image segmentation process homogeneous region depends on the image granularity
features, where the interested structures with dimensions comparable to the speckle size are
extracted. The shape and size of the growing regions depend on this look up table entries. The
region merging after the region growing also suppresses the high frequency artifacts. The
diagnosis process is done based on the intensity threshold variation obtained from the segmented
portions of the image and size of the portions compared to that of the standard stone sizes (less
than 2 mm absence of stone, 2-4 mm early stages and 5mm and above presence of kidney
stones). Results: The parameters of texture values, intensity threshold variation and stones sizes
are evaluated with experimentation of various Ultrasound kidney image samples taken from the
clinical laboratory. The texture extracted from the segmented portion of the kidney images
presented in our study precisely estimate the size of the stones and the position of the stones in
the kidney which was not done in the earlier studies. Conclusion: The integrated improved SRG
and classification mechanisms presented in this study diagnosis the kidney stones presence and
absence along with the early stages of stone formation.
Jyoti verma, Madhawendra nath, k.k saini and Priyanshu Tripati,2017 published a paper about
Kidney stone detection. There are various problem associates with this topic like low resolution
of image, similarity of kidney stone and prediction of stone in the new image of kidney.
Ultrasound images have low contrast and are difficult to detect and extract the region of interest.
Therefore, the image has to go through the preprocessing which normally contains image
10 | P a g e
enhancement. The aim behind this operation is to find the out the best quality, so that the
identification becomes easier. Medical imaging is one of the fundamental imaging, because they
are used in more sensitive field which is a medical field and it must be accurate. In this paper, we
first proceed for the enhancement of the image with the help of median filter, Gaussian filter and
un-sharp masking. After that we use morphological operations like erosion and dilation and then
entropy based segmentation is used to find the region of interest and finally we use KNN and
SVM classification techniques for the analysis of kidney stone images.
Nur Farhana Rosli, Musab Sahrim, Wan Zakiah Wan Ismail, Irneza Ismai,Juliza Jamaludin,
Sharma Rao Balakrishnan,2018 these authors have designed an automated feature description
about the renal size by using Ultrasonography (US) as it is one of the procedures to monitor the
growth of renal size in diagnose kidney disease. However considering the complexity of renal
size, this procedure leads to inter-observer variability and poor repeatability. Given images from
Abdominal CT scan, a level set thresholding and combination of logical and arithmetic operation
based method was developed to calculate the automated feature description of renal size. This is
achieved by applying 2D CT scan image into image segmentation and feature extraction where
thresholding and morphological segmentation method are conducted. Then, parameters of the
kidney such as perimeter, area, major axis and minor axis were measured and analyzed in
classification step. As a result, analysis on the kidney size between subjects who are normal and
the results from the studies has shown capability to classify correctly the size of kidneys about
accuracy of 80% to 81% in terms of the kidney’s relative axis which is the ratio of right kidney
and left kidneys. In addition, the method in measurement kidney size is compared between
manual method and automated method and results shows that the accuracy of the automated
method in terms of compactness is about 91% to 95.
The Present kidney stone detection system include Level set segmentation and Gabor filter for
smoothening. Due to the usage of level set segmentation we had a few drawbacks such as level
set techniques require considerable thought in order to construct appropriate velocities for
11 | P a g e
advancing the level set function. This means there should be huge data available to get the
accuracy rate which is sometimes may not be possible.
12 | P a g e
3. METHODOLOGY
Fig: 3.1Methodology
As the ultrasound consists of speckle noise and is of low contrast pre-processing needs to be
done. Pre-processing involves Image restoration, Smoothing & sharpening, Contrast
enhancement. Pre-processing is a common name for operations with images at the lowest level
of abstraction both input and output are intensity images. These iconic images are of the same
kind as the original data captured by the sensor, with an intensity image usually represented by a
13 | P a g e
matrix of image function values (brightness). The aim of pre-processing is an improvement of
the image data that suppresses unwilling distortions or enhances some image features important
for further processing, although geometric transformations of images (e.g. rotation, scaling,
translation) are classified among pre-processing methods here since similar techniques are used.
For this Gaussian Filtering is used Filtering is a technique for modifying or enhancing an image.
For example, you can filter an image to emphasize certain features or remove other features.
Image processing operations implemented with filtering include smoothing, sharpening, and
edge enhancement. Filtering is a neighborhood operation, in which the value of any given pixel
in the output image is determined by applying some algorithm to the values of the pixels in the
neighborhood of the corresponding input pixel. A pixel's neighborhood is some set of pixels,
defined by their locations relative to that pixel. In image processing, a Gaussian blur (also known
as Gaussian smoothing) is the result of blurring an image by a Gaussian function (named after
mathematician and scientist Carl Friedrich Gauss). It is a widely used effect in graphics software,
typically to reduce image noise and reduce detail. The visual effect of this blurring technique is a
smooth blur resembling that of viewing the image through a translucent screen. Gaussian
smoothing is also used as a pre-processing stage in computer vision algorithms in order to
enhance image structures at different scales—see scale space representation and scale space
implementation. Mathematically, applying a Gaussian blur to an image is the same
as convolving the image with a Gaussian function. This is also known as a two-
dimensional Weier strass transform. Since the Fourier transform of a Gaussian is another
Gaussian, applying a Gaussian blur has the effect of reducing the image's high-frequency
components; a Gaussian blur is thus a lowpass filter.
14 | P a g e
3.2 Image Segmentation
Segmentation is a vital aspect of medical imaging. It aids in the visualization of medical data and
diagnostics of various diseases. Canny edge detection, one of the level set segmentation
technique which is used for identifying and sharpening the edge of the kidney and the stone in
the kidney. Image segmentation is the process of partitioning a digital image into multiple
segments (sets of pixels, also known as image objects). The goal of segmentation is to simplify
and/or change the representation of an image into something that is more meaningful and easier
to analyze. Image segmentation is typically used to locate objects and boundaries (lines, curves,
etc.) in images. More precisely, image segmentation is the process of assigning a label to every
pixel in an image such that pixels with the same label share certain characteristics. The result of
image segmentation is a set of segments that collectively cover the entire image, or a set
of contours extracted from the image (see edge detection). Each of the pixels in a region are
similar with respect to some characteristic or computed property, such as color, intensity or
texture.
Canny edge detection is a technique to extract useful structural information from different vision
objects and dramatically reduce the amount of data to be processed. It has been widely applied in
various computer vision systems. Canny has found that the requirements for the application
of edge detection on diverse vision systems are relatively similar. Thus, an edge detection
solution to address these requirements can be implemented in a wide range of situations. The
general criteria for edge detection include:
Detection of edge with low error rate, which means that the detection should accurately
catch as many edges shown in the image as possible
The edge point detected from the operator should accurately localize on the center of the
edge.
A given edge in the image should only be marked once, and where possible, image noise
should not create false edges.
STEPS INVOVLED
15 | P a g e
2. Noise Reduction
Since edge detection is susceptible to noise in the image, first step is to remove the noise in
the image with a 5x5 Gaussian filter. We have already seen this in previous chapters.
Here the below diagram describes the steps involved in canny edge detection.
16 | P a g e
4. Non-maximum Suppression: After getting gradient magnitude and direction, a full scan of
image is done to remove any unwanted pixels which may not constitute the edge. For this, at
every pixel, pixel is checked if it is a local maximum in its neighborhood in the direction of
gradient. Check the image below:
Point A is on the edge (in vertical direction). Gradient direction is normal to the edge. Point B
and C are in gradient directions. So, point A is checked with point B and C to see if it forms a
local maximum. If so, it is considered for next stage, otherwise, it is suppressed (put to zero).
5. Hysteresis Thresholding
This stage decides which are all edges are really edges and which are not. For this, we need two
threshold values, minVal and maxVal. Any edges with intensity gradient more than maxVal are
sure to be edges and those below minVal are sure to be non-edges, so discarded. Those who lie
between these two thresholds are classified edges or non-edges based on their connectivity. If
they are connected to "sure-edge" pixels, they are considered to be part of edges. Otherwise, they
are also discarded.
17 | P a g e
Fig 3.2.3 Threshold representation
The edge A is above the maxVal, so considered as "sure-edge". Although edge C is below
maxVal, it is connected to edge A, so that also considered as valid edge and we get that full
curve. But edge B, although it is above minVal and is in same region as that of edge C, it is not
connected to any "sure-edge", so that is discarded. So it is very important that we have to select
minVal and maxVal accordingly to get the correct result.
18 | P a g e
3.3 Wavelet Processing
Wavelet transforms are a mathematical means for performing signal analysis when signal
frequency varies over time. For certain classes of signals and images, wavelet analysis provides
more precise information about signal data than other signal analysis techniques. Wavelets are
commonly used in image processing to detect and filter white Gaussian noise, due to their high
contrast of neighboring pixel intensity values. Using these wavelets a wavelet transformation is
performed on the two dimensional image. In this project, the segmented image from the input is
made to undergo wavelet transform to get compressed image. The image processed in this way
can be “cleaned up” without blurring or muddling the details.
The convolutional neural network (CNN) is a class of deep learning neural networks. CNNs
represent a huge breakthrough in image recognition. They’re most commonly used to analyze
visual imagery and are frequently working behind the scenes in image classification. They can be
found at the core of everything from facebook’s photo tagging to self-driving cars. They’re
working hard behind the scenes in everything from healthcare to security. Image classification is
the process of taking an input (like a picture) and outputting a class or a probability that the
input is a particular class (“there’s a 90% probability that this input is a image”). CNNs can be
thought of automatic feature extractors from the image. It effectively uses adjacent pixel
information to effectively down-sample the image. A CNN, in specific, has one or more layers of
convolution units. A convolution unit receives its input from multiple units from the previous
layer which together create a proximity. Therefore, the input units (that form a small
neighborhood) share their weights. In this project, the input to CNN classification is series of
images processed through wavelet transforms. Every image is given as input to neurons in input
layer. The software selects smaller matrix also known as filter. The filter produces convolution
and multiplies its values by original pixel values. All these multiplications are summed up to
obtain a single value. The convolution continues and a smaller matrix than input matrix is
obtained. The output matrix of CNN classification is compared with another image matrix (that
contains stone) and classification is done.
19 | P a g e
Fig: 3.4.1 CNN classification
20 | P a g e
K=size(width) of kernels used in the Conv layer.
N=number of kernels.
P=padding.
O=[(I-K+2P)/S]+1 (Eq:3.4)
The no. of channels in the output image is equal to the no. of kernels N.
In this project, we used canny edge detection methodology as it provides the presence of
Gaussian filter which allows removing of noise in an image.
This can be enhanced with respect to the noise ratio by non-maxima suppression method which
results in one pixel wide ridges as the output. This also detects the edges in a noisy state by
applying the thresholding method. The effectiveness can be adjusted by using parameters. It
gives good localization, response and is immune to a noisy environment. Later CNN
classification is introduced because more than ANN, CNN is suitable for image processing.
21 | P a g e
3.5.1 Architecture
In this architecture at first input is given, here we give ultrasound image of a kidney it may be
normal or abnormal kidney present with stones. As ultrasound images contain lot of speckle
noise it is difficult to deal with them, to overcome this image preprocessing is done i.e., Gaussian
filter is applied to remove noise. The next step is image segmentation, canny edge detection is
used and this contains five steps such as Noise reduction, Gradient classification, non maximum
suppression, Double threshold and Edge tracking at last we get an output with edges detected.
This segmented image is given for wavelet processing. Later CNN is applied, in this we have
Convolution layer, Max pooling layer, Activation layer and at last we find Fully connected layer.
Rectified linear unit is used to scale the parameters to non negative values. We get pixel values
as negative values too. In this layer we make them as 0’s. The purpose of applying the rectifier
function is to increase the non-linearity in our images. The reason we want to do that is that
images are naturally non-linear. The rectifier serves to break up the linearity even further in order
to make up for the linearity that we might impose an image when we put it through the
convolution operation. The pooling (POOL) layer reduces the height and width of the input. It
helps reduce computation, as well as helps make feature detectors more invariant to its position
in the input. The role of the artificial neural network is to take this data and combine the features
into a wider variety of attributes that make the convolutional network more capable of
classifying images, which is the whole purpose from creating a convolutional neural network.
Here we used Relu activation function this process is repeated two times and at last sigmoid is
used. Max pooling is done to get better image and flatten method is used .Dropout was used to
avoid overfitting. For identifying kidney stone network is fully connected. we obtain output with
labels yes or no which tells about the presence or absence of stone.
22 | P a g e
Fig: 3.5.1 Architecture
23 | P a g e
4. EXPERIMENTAL ANALYSIS AND RESULTS
The first phase involves the dataset preparation. In our case, we have collected some sample
ultrasound kidney images with and without stones and converted them into a csv file which can
be used as a dataset in our project during the implementation of CNN classification module.
A data set (or dataset) is a collection of data. In the case of tabular data, a data set corresponds to
one or more database tables, where every column of a table represents a particular variable, and
each row corresponds to a given record of the dataset in question. In this vast internet world,
there are ‘n’ number of images that can be used in this project but finding the best images is an
hectic task. We have collected images from Google and created a file containing images.
The above images collected as a dataset are contained into a csv file after conversion.
24 | P a g e
Fig: 4.1.2 Dataset csv file
In the above (fig 4.1.1) the images are given as input to dataset code and we obtain a csv file (fig
4.1.2) ,later these images are converted into pixels form (fig 4.1.3).
Initially, as the ultrasound kidney image contains the speckle noise and is of low contrast, one of
the image pre-processing technique is being applied to remove the speckle noise. In this project,
Gaussian filter technique is used to blur the image by using Gaussian function to remove the
25 | P a g e
noise. This pre-processing involves Image restoration, smoothing and sharpening. In the
implementation of image segmentation module, canny edge detection technique is used to extract
the useful information from the image by reducing or eliminating the information which is not
required thereby reducing the amount of data to be processed. This technique is used to detect
the edges which involves various steps. The first step is noise reduction using Gaussian blur in
which a 5x5 Gaussian filter is used to remove the noise from the obtained pre-processed image.
The second step is Gradient calculation in which the edge intensity and direction are detected by
calculating the gradient using edge detection operation. The output of this step involves image
containing thick edges. The third step is Non-maximum Suppression. As the output of the
algorithm should contain thin edges, the algorithm finds the pixels with maximum value in the
edge directions by going through the points on the gradient intensity. The fourth step is Double
threshold. In this step we aim at identifying three kinds of pixels: strong, weak, and non-relevant.
Pixels that contribute to the final edge are classified as strong edges. Pixels with intensity values
that are not sufficient to be classified as strong edges, but not small enough to be considered as
non-relevant are classified as weak pixels. The remaining pixels are considered as non-relevant
pixels. Double threshold is used for categorizing pixels based on the intensity. High threshold
identifies strong pixels, Low threshold identifies non-relevant pixels, and the other pixels are
marked as weak. The result of this step includes an image consisting only strong and weak
pixels. The fifth step is Edge Tracking, here transformation of weak pixels into strong pixels take
place if and only if the pixels around the one being processed is a strong one. The output of the
Image segmentation module is sent to the Wavelet Processing module. A wavelet decays swiftly
just like an oscillation which has zero mean. Unlike sinusoids which extend to infinity, a wavelet
exists for a finite duration.The image processed in this way can be “cleaned up” without blurring
the details. The output of this module is in matrix form containing pixel values of the image.
The fourth module is CNN Classification. The output from wavelet processing module is a
greyscale matrix of size 128*128*1. CNN Classification involves 4 steps namely Convolution
layer, Activation function, max Pooling, Fully connected network.
Relu layer: Rectified linear unit is used to scale the parameters to non negative values. We get
pixel values as negative values too. In this layer we make them as 0’s. The purpose of applying
the rectifier function is to increase the non-linearity in our images (fig 4.1.4). The reason we
26 | P a g e
want to do that is that images are naturally non-linear. The rectifier serves to break up the
linearity even further in order to make up for the linearity that we might impose an image when
we put it through the convolution operation. What the rectifier function does to an image like this
is remove all the black elements from it, keeping only those carrying a positive value (the grey
and white colors).The essential difference between the non-rectified version of the image and the
rectified one is the progression of colors. After we rectify the image, you will find the colors
changing more abruptly. The gradual change is no longer there. That indicates that the linearity
has been disposed of.
Pooling layer: The pooling (POOL) layer reduces the height and width of the input. It helps
reduce computation, as well as helps make feature detectors more invariant to its position in the
input.This process is what provides the convolutional neural network with the “spatial variance”
capability (fig 4.1.5). In addition to that, pooling serves to minimize the size of the images as
well as the number of parameters which, in turn, prevents an issue of “overfitting” from coming
up. Overfitting in a nutshell is when you create an excessively complex model in order to
account for the idiosyncracies we just mentioned. The result of using a pooling layer and creating
down sampled or pooled feature maps is a summarized version of the features detected in the
input. They are useful as small changes in the location of the feature in the input detected by the
convolutional layer will result in a pooled feature map with the feature in the same location. This
capability added by pooling is called the model’s invariance to local translation.
Fully Connected layer: The role of the artificial neural network is to take this data and combine
the features into a wider variety of attributes that make the convolutional network more capable
of classifying images, which is the whole purpose from creating a convolutional neural network.
It has neurons linked to each other, and activates if it identifies patterns and sends signals to
output layer .the output layer gives output class based on weight values.
In Convolution layer a 3*3 kernel is applied on the input matrix with stride 1, so that the size of
the image is reduced. The obtained matrix is sent to the activation function layer, here
ReLU(Rectified Linear Unit)activation function is used to eliminate negative values (fig 4.1.4).
The next step is max pooling, here the rectified map goes through a pooling layer, pooling is
down sampling operation that reduces the dimensionality of feature map. The output of this layer
is a matrix with reduced size containing all the features. These 3 steps are repeated for two times,
27 | P a g e
in which 32 filters are used each time. The next step is Flattering in which we convert the 2D
array from pooling into a long continuous linear vector to which a filter of size 64 is applied
followed by activation function. Later a Drop Out of size 0.5 is applied to prevent over-fitting. In
the next step ANN model is applied, in which sigmoid activation is used function to detect the
presence of stone.
28 | P a g e
Fig: 4.1.6 Converting matrix into linear array form
29 | P a g e
Fig: 4.1.7 Accuracy of stone detection
30 | P a g e
In the accuracy of stone detection (fig 4.1.7), the term ETA usually refers to estimated time of
arrival but in technology realm it refers as estimated completion time of a computation process in
general. The problem is to specific to estimating completion time of a batch of long scripts
running parallel to each other, processing data and preparing some lists. The running time for
each can be varied depending on the past data we considered.
The term Epoch is once all the images are processed one time individually of forward and
backward to the network. Usually, we feed a neural network the training data for more than one
epoch in different patterns by which a better generalization can be there when an unseen input
data is given. If there is a large but finite training dataset then it gives the network a chance to
see the previous data to readjust the model parameters so that the model is not biased towards the
last few data points during training.
The term Loss (fig 4.1.7), is nothing but a prediction error of neural network and the method to
calculate the loss is called loss function. A loss function is used to optimize the machine learning
algorithm. The loss is calculated on training and validation sets and its interpretation is based on
how well the model is doing in these two sets. It is the sum of errors made for each example in
training or validation sets. Loss value implies how poorly or well a model behaves after each
iteration of optimization .
31 | P a g e
Fig:4.1.8Output with label yes (presence of stone)
The above two images are our output images with presence and absence of stone in the kidney.
In the images (fig 4.1.8) and (fig 4.1.9), the first image is input and the next one is the
preprocessed image which is obtained after the completion of Gaussian filter and canny edge
detection.
The Gaussian filter is used to blur the image or to reduce noise by applying Gaussian function. It
is a widely used effect in graphics software, typically to reduce image noise and reduce detail.
The visual effect of this blurring technique is a smooth blur resembling that of viewing
the image through a translucent screen. Gaussian smoothing is also used as a pre-processing
stage in computer vision algorithms in order to enhance image structures at different scales—
see scale space representation and scale space implementation. Canny edge detection is a multi-
step algorithm that can detect edges with noise suppressed at the same time. Smooth the image
with a Gaussian filter to reduce noise and unwanted details and textures. Intensity Gradient of the
32 | P a g e
Image is calculated and non maximum suppression is applied to remove any unwanted pixels
which may not constitute the edge. Hysteresis Thresholding is applied in which are all edges are
really edges and which are not. For this, we need two threshold values, minVal and maxVal. Any
edges with intensity gradient more than maxVal are sure to be edges and those below minVal are
sure to be non-edges, so discarded.
The image produced is free from noise and all the edges of ultrasound image are identified and
these sent to CNN for further classification of stones.
IDE: Pycharm.
33 | P a g e
OpenCV: OpenCV (Open source computer vision) is a library of programming functions mainly
aimed at real-time computer vision. Originally developed by Intel, it was later supported by
willow garage then Itseez (which was later acquired by Intel). The library is cross platform and
free for use under the open source BSD license. OpenCV supports some models from deep
learning frameworks like TensorFlow, Torch, PyTorch (after converting to an ONNX model)
and Caffe according to a defined list of supported layers. It promotes Open Vision Capsules.
which is a portable format, compatible with all other formats.
HDD: 10 GB or higher
importos
import cv2
importcsv
defflatten_and_serialize(pixels):
flattened_pixels = []
forrow inpixels:
34 | P a g e
forpixel inrow:
flattened_pixels.append(int(pixel))
returnflattened_pixels
defprepare_dataset(src_folder, dest_file):
withopen(dest_file, "w") asdataset:
dataset_writer = csv.writer(dataset)
forfile inos.listdir(src_folder):
try:
pixels = cv2.imread(src_folder + "/" + file, cv2.IMREAD_GRAYSCALE)
ifpixels isNone:
continue
new_size = (128, 128)
pixels = cv2.resize(pixels, new_size)
serialized_pixels = flatten_and_serialize(pixels)
row = [file,None,]
dataset_writer.writerow(row)
exceptException asexp:
print(file, exp)
if__name__ == "__main__":
prepare_dataset("KidneyStones", "dataset.csv")
importos
importsys
importcv2 ascv
35 | P a g e
importnumpy asnp
frommatplotlib importpyplot asplt
importcanny
# [variables]
# [load]
defedgeFindWithGaussianBlurAndCanny(src):
ddepth = cv.CV_16S
kernel_size = 3
# Check if image is loaded fine
# [load]
# [reduce_noise]
# Remove noise by blurring with a Gaussian filter
src = cv.GaussianBlur(src, (3, 3), 0)
# [reduce_noise]
# [convert_to_gray]
# Convert the image to grayscale
src_gray = cv.cvtColor(src, cv.COLOR_BGR2GRAY)
# [convert_to_gray]
# Create Window
# [laplacian]
# Apply Laplace function
dst = cv.Laplacian(src_gray, ddepth, kernel_size)
# [laplacian]
# [convert]
# converting back to uint8
abs_dst = cv.convertScaleAbs(dst)
# [convert]
# [display]
plt.subplot(121),plt.imshow(src, cmap = 'gray')
plt.title('InputImage'), plt.xticks([]), plt.yticks([])
plt.subplot(122),plt.imshow(abs_dst, cmap = 'gray')
36 | P a g e
plt.title('MagnitudeSpectrum'), plt.xticks([]), plt.yticks([])
plt.show()
cann = canny.can(src)
returncann
importcv2
importsys
# np is an alias pointing to numpy library
importnumpy asnp# capture frames from a camera
# converting BGR to HSV
defcan(frame):
hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV)
# define range of red color in HSV
37 | P a g e
cv2.waitKey(0)
cv2.destroyAllWindows()
returnedges
import numpy as np
class CNN:
def __init__(self):
# self.model = Sequential()
# self.model.add(Flatten())
# self.model.compile (loss='binary_crossentropy',
# Optimizer='rmsprop',
# metrics=['accuracy'])
Model = Sequential ()
model.add(Activation('relu'))
model.add(Convolution2D(32, 3, 3))
38 | P a g e
model.add(Activation('relu'))
model.add(Convolution2D(64, 3, 3))
model.add(Activation('relu'))
model.add(MaxPooling2D(pool_size=(3, 3)))
model.add(Flatten())
model.add(Dense(64))
model.add(Activation('relu'))
model.add(Dropout(0.5))
model.add(Dense(1))
model.add(Activation('sigmoid'))
model.compile(loss='binary_crossentropy',
optimizer='rmsprop',
metrics=['accuracy'])
self.model = model
probabilities = self.model.predict(images)
return probabilities
import numpy as np
39 | P a g e
import matplotlib.pyplot as plt
import guassian
import deserialize
import cv2 as cv
cv.imshow(title, image)
cv.waitKey(0)
cv.destroyAllWindows()
def find_edge_and_normalize():
raw_images = []
processed_images = []
labels = []
edges = guassian.edgeFindWithGaussianBlurAndCanny(image)
# print(processed_image)
raw_images.append(image)
processed_images.append(processed_image)
labels.append(label)
40 | P a g e
return np.array(raw_images), np.array(processed_images), np.array(labels)
if __name__ == "__main__":
LIMIT = -5
model = CNN()
model.fit(processed_images[:LIMIT], labels[:LIMIT])
predictions = model.predict(processed_images[LIMIT:])
print(predictions, labels[LIMIT:])
result = 'yes'
else:
result = 'no'
output = raw.copy()
f, axarr = plt.subplots(1, 3)
axarr[0].imshow(raw)
axarr[1].imshow(processed, cmap='gray')
axarr[2].imshow(output)
plt.show()
41 | P a g e
4.3 SCREENSHOTS
This above figure indicates the code that is used to convert an input image which provides
accuarcy in the next stage that is shown below.
42 | P a g e
Fig: 4.3.2 Image Accuracies
After the above code is executed, the accuracy levels for each image given as an input is shown
in the above figure.
43 | P a g e
Fig: 4.3.3 Output 1
44 | P a g e
Fig: 4.3.6 Output 4
The above outputs depict the presence or absence of stones through processed images
from input images. As in figure 1 when given an input image, a processed image is produced
from which no presence of stone is depicted, and in figure 2 and so on when an input image is
given, a processed image is produced from which the presence of stone is depicted.
45 | P a g e
4.4 TESTING
The purpose of testing is to discover errors. Testing is the process of trying to discover every
conceivable fault or weakness in a work product. It provides a way to check the functionality of
components, subassemblies, assemblies and or/a finished product. It is the process of exercising
software with the intent of ensuring that the software system meets its requirements and user
expectations does not fail in unacceptable manner. There are various types of test. Each test type
addresses a specific requirement .
TYPES OF TESTINGS
1. Unit Testing
Unit testing involves the design of test cases that validate the internal program logic is
functioning properly, and that program inputs procedure valid outputs. All decision branches and
internal code flow should be validated. It is the testing of individual software units of the
application. It is done after the completion of an individual unit before integration. This is
structural testing that relies on knowledge of its construction and is invasive. Unit test perform
basic test at component level and and test a specific business, application and/or system
configuration Unit test ensures that each unique path of princess performs accurately to the
documented specifications and contains clearly defined inputs and expected results .
2. Integration Testing
lntegration tests are designed to test integrated software components to determine if they
actually run as one program. Testing in event driven and more concerened with the basic
outcome of screens or fields. Integration test demonstrate that although the components were
individually satisfaction, as shown successfully by unit testing the combination of components is
correct and consistent. Integration testing is specifically aimed at exposing the problems that
arise from the combination, of components
46 | P a g e
3. Functional Testing
Functional test provide systematic demonstrations that function tests are available as specified
by the business and technical requirements requiremments, system documentation and user
manuals.
4. System Test
System testing ensures that the entire integrated software system meets requirements. It tests a
configuration to ensure known and predictable results An example on site testing is
configuration oriented system integration test.
It is a testing in which the software tester has and of the inner workings, structure and language
of the software, or atleast its purpose. It is used to test areas that cannot be reached from a black
box level.
47 | P a g e
6. Black Box Testing
Black Box Testing a testing the software without any knowledge of the inner workings, structure
or language of the module being tested. Black box tests, as most other kind of tests must be
written from a definitive source document, such as specification requirements document. It is a
testing in which the software under test is treated as black box you cannot see into it. The test
provides inputs and responds to outputs without considering how the software works.
A document describing the scope, approach, resources and schedule of intended test activities. It
identifies amongst others test items, the features to be tested, the testing tasks, who will do each
task, degree of tester independence, the test environment the test design techniques and entry and
exit criteria to be used, and the rationale for their choice, and any risks requiring contingency
planning . It is a record of the test planning process. Follow the below steps to create a test plan
as per IEEE 829
Analyze the system: A system/product can be analyzed only when the tester has any
information about it i.e, how the system works, who the end users are, what software/hardware
the system uses, what the system is for etc.
Design the Test Strategy: Designing a test strategy for all different types of functioning,
hardware by determining the efforts and costs incurred to achieve the objectives of the system.
For any project, the test strategy can be prepared by
Define the Test Objectives: Test objective is the overall goal and achievement of the test
execution. Objectives are defined in such a way that the system is bug-free and is ready to use
48 | P a g e
by the end-users. Test objective can be defined by identifying the software features that are
needed to test and the goal of the test, these features need to achieve to be noted as successful.
Define Test Criteria: Test Criteria is a standard or rule on which a test procedure or test
judgment can be based. There are two such test criteria: Suspension criteria where if the specific
number of test cases are failed, then the tester should suspend all the active test cycle till the
criteria is resolved, Exit criteria which specifies the criteria that denote a successful completion
of a test phase.
Resource Planning: Resource plan is a detailed summary of all types of resources required to
complete the project task. Resource could be human, equipment and materials needed to
complete a project.
Plan Test Environment: A testing environment is a setup of software and hardware on which
the testing team is going to execute test cases.
Schedule & Estimation: Preparing a schedule for different testing stages and estimating the
time and man power needed to test the system is mandatory to mitigate the risk of completing
the project within the deadline. It includes creating the test specification, test execution, test
report, test delivery.
Determine Test Deliverables: Deliverables are the documents, tools and other components that
has to be developed and maintained in support of the testing effort. Test deliverables are
provided before, during and after the testing phase.
Test Plan and different scenarios to be considered for this project are as follows:
1. This project is developed at an aim to detect the stones in a kidney i.e to identify the
presence of stone in kidney.
2. Various modules of the project like the kidney detection with noise detection, edge
detection are all tested under unit and functional testing. After detecting the stone, check
if the system is able to extract required features of the kidney or not through functional
testing. Since this is project doesn’t have any form of api, API testing and database
testing are out of scope for test plan. Nonfunctional testing such as size of stone, type of
49 | P a g e
stone or logical database currently will not be tested. At last, the entire system is tested
through system testing for the alert of presence of stone.
3. To mitigate the risks of any team member not able to understand the testing, every team
member in the project group is made familiar to the testing process. To make the testing
faster, two members of this project group have been handled the responsibility to test
this system. N.Amrutha lakshmi and M.Sushma have performed the functional and
system testing of this system respectively.
4. The suspension criteria for this project is considered as 50% i.e, if whenever the 50% of
test cases failed then the testing cycle is suspended and the development team
comprising of B.Jyothirmayi and A.Srimanoj have made the required improvement in
the code. The exit criteria is that the 95% of the test cases should be successful. We
have achieved this success under less clarity ultra sound image conditions and good
light conditioned ultrasound images.
5. The resource planning for testing comprised of two members from the project team
namely, N.Amrutha lakshmi who identified different scenarios for testing amd can be
considered as the Developer in test cum Test Administrator, M.Sushma who executed
the given tests, logged the results and reported the defects to the project team.
6. The system resources and the test environment comprised of the Windows 10 PC run
under an i5 6th Gen processor and 8GB RAM with a 1TB HDD. The entire project is
run and tested under PyCharm IDE .
7. The schedule for this project is as follows:
The test specification for this project is created by N.Amrutha lakshmi which
comprised of testing the different modules of the project under different
conditions and excluding certain scenarios.
The test execution is performed by M.Sushma which included executing all
various test cases provided by N.Amrutha lakshmi. Logging the results and
reporting the outcomes along with defects is performed by her carefully.
The test reports are generated accordingly by both the members of the testing
team. Defects are dealt accordingly by the development team which included
B.Jyothirmayi and A.Srimanoj. Later again these test cases have been tested and
are proved successful in achieving the correct results.
50 | P a g e
4.5 TEST REPORT
The testing of the system is performed for various test cases under different conditions
considering most of the possible scenarios.
To list a few, some of the test reports have been listed below.
51 | P a g e
5. CONCLUSION AND FUTURE WORK
CONCLUSION:
In this project, the survey of different algorithms and classifications are analyzed followed by
the detection of stone present in the kidney. From this implementation, the existing system
limitations are inferred and a new design is proposed to address the limitations such as level
set techniques require considerable thought in order to construct velocities to get a perfect
advanced level set function. This means there should be a huge data available to get the
accuracy rate which is sometimes may not be possible. We planned to rectify these issues
using CNN classification. The energy levels extracted from the wavelet subbands i.e.,
Daubechies, Symlets and biorthogonal filters gives the clear indication of difference in the
energy levels compared to that of normal kidney image if there is stone. The CNN trained with
normal kidney image and classified input into normalor abnormal by considering extracted
energy levels from wavelet filters. By using CNN classification we obtained an accuracy in
between 70-85%. Python above 3.6 was used to implement and pycharm software tool was
used.
FUTURE WORK:
The work can be extended by identifying the region of kidney stone and also predicting the
size of the stone. The same can be utilized in an efficient way a possible victim can get
worried or just cautious depending on the results, contradicting to waiting for prolonged
periods without any closure.
52 | P a g e
6. APPENDIX
Python
PyCharm
OpenCV
OpenCV (Open source computer vision) is a library of programming functions mainly aimed at
real-time computer vision. Originally developed by Intel, it was later supported by willow garage
then Itseez (which was later acquired by Intel). The library is cross platform and free for use
under the open source BSD license. OpenCV supports some models from deep learning
frameworks like TensorFlow, Torch, PyTorch (after converting to an ONNX model) and Caffe
according to a defined list of supported layers. It promotes Open Vision Capsules which is a
portable format, compatible with all other formats.
53 | P a g e
SciPy
The scipy package contains various toolboxes dedicated to common issues in scientific
computing. Its different submodules correspond to different applications, such as interpolation,
integration, optimization, image processing, statistics, special functions, etc. The SciPy library
depends on NumPy, which provides convenient and fast Ndimensional array manipulation. The
SciPy library is built to work with NumPy arrays and provides many user-friendly and efficient
numerical practices such as routines for numerical integration and optimization. Together, they
run on all popular operating systems, are quick to install and are free of charge. NumPy and
SciPy are easy to u The basic data structure used by SciPy is a multidimensional array provided
by the NumPy module. NumPy provides some functions for Linear Algebra, Fourier Transforms
and Random Number Generation, but not with the generality of the equivalent functions in
SciPy. se, but powerful enough to depend on by some of the world's leading scientists and
engineers.
Numpy
NumPy is a library for the python programming language, adding support for large, multi-
dimensional arrays and matrices, along with a large collection of high level mathematical
functions to operate on these arrays. The ancestor of NumPy, Numeric, was originally created by
Jim with contributions from several other developers. In 2005, Travis created NumPy by
incorporating features of the competing Numarray into Numeric, with extensive modifications.
NumPy is open source software and has many contributors.
Dlib
Dlib is a modern C++ toolkit containing machine learning algorithms and tools for creating
complex software in C++ to solve real world problems. It is used in both industry and academia
in a wide range of domains including robotics, embedded devices, mobile phones, and large high
54 | P a g e
performance computing environments. Dlib's open source licensing allows you to use it in any
application, free of charge. There is no installation or configure step needed before you can use
the library. Among other applications of Dlib, this packge aslo contributes mostly to image
processing techniques such as
55 | P a g e
7. REFERENCES
[8] R.Kimmel, “Fast Edge Detection” in Geometric Level Set Methods in Imaging,
Vision and Graphics,Newyork : Springer –Verlag-2003.
56 | P a g e
[9] Thord Anderson, Gunnar Lathen, “Modified Gradient Search For Level Set based
image Segmentation”, IEEE Transactions on image processing ,February 2013
[10] William G Robertson, “Methods for diagnosing the risk factors of stone
formation” Arab Associatiom of Urology,2012.
[12] Nurul Aimi Shaharuddin, Wan Mahani Hafizah Wan Mahmud "Feature Analysis
of Kidney Ultrasound Image in Four Different Ultrasound using Gray Level Co-
occurrence Matrix (GLCM) and Intensity Histogram (IH)",2018.
57 | P a g e
[18] Rubbal Birdi, Jyoti Gill "3-D Tumor Detection from Kidneys using
UltrasoundImages",2014.
58 | P a g e
Design and analysis performance of Kidney Stone Detection from Ultrasound
Image by Level Set Segmentation and ANN Classification
K.Viswanath R. Gunasundari
Ph.D. Research Scholar Associate Professor, Deparhnent of ECE
Pondicherry Engineering College Pondicherry Engineering College
Pondicherry, India Pondicherry, India
Email: [email protected] Email: [email protected]
Abstract--The abnormalities of the kidney can be identified by for uncommon [15].Special cases. Hyaluronan is a large (>106
ultrasound imaging. The kidney may have structural Da) linear glycosaminoglycan composed of repeating units of
abnormalities like kidney swelling, change in its position and
glucuronic acid (GlcUA) and N-acetyl glucosamine (GlcNAc)
appearance. Kidney abnormality may also arise due to the
formation of stones, cysts, cancerous cells, congenital anomalies,
disaccharides [16]. Hyaluronan has a central role in a number
blockage of urine etc. For surgical operations it is very important of processes that can ultimately lead to renal stone disease,
to identify the exact and accurate location of stone in the kidney. including urine concentration, Uric acid, Salt form crystal,
The ultrasound images are of low contrast and contain speckle crystallization inhibition, crystal retention, Magnesium
noise. This makes the detection of kidney abnormalities rather ammonium phosphate and amino acid.
challenging task. Thus preprocessing of ultrasound images is
carried out to remove speckle noise. In preprocessing, first image
Tanzila Rahman, Mohammad Shorif Uddin proposed
restoration is done to reduce speckle noise then it is applied to
Gabor filter for smoothening. Next the resultant image is reduction of speckle noise and segmentation from US image is
enhanced using histogram equalization. The preprocessed discussed. It not only detect kidney region, but also enhance
ultrasound image is segmented using level set segmentation, since image quality [1]. The wan Mahani Hafizah proposed kidney
it yields better results. In level set segmentation two terms are US images were divided into four dissimilar categories:
used in our work. First term is using a momentum term and
normal, bacterial infection, cystic disease, kidney stones,
second term is based on resilient propagation (Rprop)' Extracted
region of the kidney after segmentation is applied to Symlets,
based on gray level co-occurrence matrix (GLCM). From
Biorthogonal (bi03.7, bi03.9 & bi04.4) and Daubechies wavelet these categories doctors identify that the kidney is normal or
subbands to extract energy levels. These energy level gives an abnormal [2]. Gladis Pushpa had proposed Hierarchical Self
indication about presence of stone in that particular location Organizing Map (HSOM) for brain tumours using
which significantly vary from that of normal energy level. These segmentation, wavelets packets, and the results were correct
energy levels are trained by Multilayer Perceptron (MLP) and
up to maximum 97% [3]. Norihiro Koizumi proposed high
Back Propagation (BP) ANN to identify the type of stone with an
accuracy of98.8%.
intensity focused ultrasound (HIFU) technique, used for
destroying tumours and stones [4, 13]. Bommanna Raja
Keywords- Kidney Stone detection, Level Set Segm entation, proposed content descriptive multiple features for disorder
Multilayer Perceptron (MLP) and Back Propagation (BP), Wavelet identification and artificial neural network (ANN) for
transform, and Ultrasound im aging. classification and the results says that the maximum efficiency
is 90.47%, and accuracy 86.66% only [5]. The MLP- BP
1. INTRODUCTION ANN is found as better performance in terms of accuracy
Kidney stone disease is one of the risks for the life in having 92%, speed is 0.44 sec and sensitivity [8, 24]. The
throughout the world, and majority people with stone Non-invasive combination of renal using pulsed cavitation US
formation in kidney initial do not notice it as disease and it therapy proposed shock wave lithotripsy (ESWL) has become
damages the limb (organ) slowly. Before viewing symptoms, a standard for the treatment of calculi located in the kidney
many people affected by continual kidney failure due to and ureter [10]. Mohammad E. Abou EI-Ghar projected
diabetes mellitus and hypertension, glomerulonephritis etc. location of urinary stones with unenhanced computed
Since kidney malfunctioning can be life threatening, diagnosis tomography (CT) using half-radiation (low) dose compared
of diseases in the earlier stages is cruciaL The currently with the standard dose and of the 50 patients, 35 patients had a
available options include Ultrasound (US) image which is one single stone while the rest of them had multiple stones[II]. In
of the non-invasive low cost, widely used imaging techniques order to solve the local minima and segmentation problem the
for diagnosing kidney diseases [l]. Shock wave lithotripsy thord Andersson, Gunnar Lathen proposed modified gradient
(SWL), percutaneous nephrolithotomy (PCNL), relative super search and level set segmentation [12]. For 3D detection of
saturation (RSS) are the techniques to test urine. The kidneys and their pathology in real time, the Emmanouil
Robertson Risk Factor Algorithms (RRFA) are open and are Skounakis proposed templates based technique with accuracy
used for laparoscopic surgery, these algorithms are reserved
individual adaptive step sizes and the signs of the gradient constant flow in the negative normal direction. The contour is
components. often implicitly represented by the zero level of a time
dependent signed distance function, known as the level set
I. Momentum term function. The level set method was introduced by Osher and
Spinning to gradient descent with Momentum will adopt Sethian [6]. Formally, a contour p is described by p {x: rp(x,
=
the machine learning community and choose a search vector t) O}. The contour p is evolved in time using a set of partial
=
at
Where '7 is the learning rate and OJ E [0, 1] is the momentum.
Note that w 0 gives standard gradient descent a, -'7Vft ,
the level set equation � =
Y Iv I
'P Eq. 2 gives the familiar
at
= =
in Rprop. The update rule considers only the signs of the partial
derivatives. Another advantage of Rprop, which is very
important in practical use, is the stoutness of its parameters;
Rprop will work out of the box in many applications using only
the standard values of its parameters [18, 20).
-
We will now describe the Rprop algorithm briefly, but for r-..__ _ .. __
2014 International Conference on Advances in Computing, Communications and Informatics (ICACCI) 409
VII. ANN CLASSIFICAnON B. Backward Phase
In ANN Classification two architectures are used namely, In this phase, the weights and biases are updated
Multilayer Perceptron and back propagation which are according to the error gradient-descent vector. After an input
described in detail in the following sections. vector is applied during the forward computation phase, a
network output vector is obtained. A target vector t is provided
1. Multilayer Perceptron (MLP)
to the network, to drive the network's output toward the
A multilayer perceptron is a feed forward artificial neural expected targeted value [10, 14].
network algorithm that maps sets of energy values obtained Starting with the output layer, and moving back towards the
from wavelets subbands energy extraction shown in the tablel. input layer, calculates the error terms and gradient as follows:
These energy values are fed to input layer and multiplied with
r(u-/'))
J
for I=L
(I)
initial weights as in equation (6). The back propagation is e - J
- - - - - -(7)
J 1" (I I) (I I)
for
- +
in equation (7). These error signals are used to calculate the Calculate the changes for all the weights as follows:
(I) (I) (I-I)
weight updates which represent power of knowledge learnt in �wij =1)SjXj .......... I=I,2,......... L ------ (9 )
the network [7]. Multilayer Perceptron with Back Propagation where 11 is the learning rate. Update all the weights as
(MLP-BP) are the main algorithms. Based on the literature follows:
survey, MLP-BP algorithm was found to be better than the (I) (/) (/)
wij (L+l)=wij (L)+!'.wij (L) (1 0 ) ------
J
membership , i.e., the probability that X belongs to Cj. Since
x
)
. =B(s.) )=8 "x .
L..J j
w
j
. + w
J
. ------
(6 )
i =O Naive Bayes assumes that the conditional probabilities of the
independent variables are statistically independent we can
Where D (L-l) is the number of neurons in layer (L-l),
decompose the likelihood to a product of terms:
(I - I) ·t th
Xi output of the Jh neuron in the (1-1) layer, Wij(i)
synaptic weight contained in the current neuron, Wij(i) current
(I) p x IeJ ( ) TI P(x 00
k=l
k
Ie)
J
- - - - - - - - - -(12)
neuron's bias weight, x . output of the current neuron.
J
410 2014 International Conference on Advances in Computing, Communications and Informatics (ICACCI)
11 millingui
Kidney Stone Detection from Ultrasound Image by Level Set Segmentation and ANN
Image processi ng---"========----_======_----"""'========_----"
BiOrthogonal(bi03.7} Q
Gray image
� �L-=====��
FEATURE EX"TRACTlON I
CLASSIFICATlON
LOAD IMAGE
III DBcla5.sifyguil
Energy values
1 0.0026 5.5953e-...
2. 0.0059 7.0192e-...
3 0.016.3 9.1629e-...
.. 0.0179 3.9806e-...
5 0.0093 2.7436e-.. .
6 0.0111 9.0GG0e-...
Fig.7. Naive bayes and MLP-BP Classifications for normal
Fig.6. Wavelets subbands energy extracted values normal is shown in Fig.7 and Fig.8. shows the abnormality of
another kidney image.
Table! shows the lists of energy levels extracted from energy level of each kidney images of database. The Columns
segmented image. This table is the enlarged version of the of the table shows energy level extracted from the images of
table shown in the GUI. The rows of the table are individual
412 2014 International Conference on Advances in Computing, Communications and Informatics (ICACCI)
database with respect to each wavelet filter. First two columns REFERENCES
are corresponding to Daubechies filter, the third and fourth
columns are corresponding to symletsl2. The fifth, sixth and [I] T.anzila Rahman, Mohammad Shorif Uddin, "Speckle Noise Reduction
and Segmentation of Kidney Regions from Ultrasound Image", 978-1-
seventh columns are corresponding to Biorthogonal filter 4799-0400-6113, 2013 IEEE.
(Bi03.7). The eighth, ninth and tenth columns are [2] Wan Mahani Hafizah, "Feature Extraction of Kidney Ultrasound Images
corresponding to Biorthogonal filter (Bi03.9). The eleventh based on Intensity Histogram and Gray Level Co-occurrence Matrix"
2012 sixth Asia Modeling Symposium, 978-0-7695-4730-5112, 2012
twelfth and thirty columns are corresponding to Biorthogonal IEEE.
filter (Bi04.4). [3] V. P. Gladis Pushpa Rathi, "Detection and Characterization of Brain
Tumor Using Segmentation based on HSOM, Wavelet packet feature
spaces and ANN", 978-1-4244-8679- 3111, 2011 IEEE.
The Bayes and MLP-BP classifications have given type of
[4] Norihiro Koizumi, "Robust Kidney Stone Tracking for a Non-invasive
stone with maximum accuracy of 79.1% and 98.8% Ultrasound Theragnostic System -Servoing Performance and Safety
Enhancement", 2011 IEEE International Conference on Robotics and
respectively.
Automation Shanghai International Conference Center May 9-13, 2011,
Shanghai, China.
[5] K. Bommanna Raja, "Analysis of ultrasound kidney Images using
content description multiple fearures for disorder identification and
ANN based classification", Proceedings of the international conference
on computing: Theory and applications (ICCTA'07) 0-7695-2770-1/07,
2007.
[6] S. Osher and J. A. Sethian, "Fronts propagating with curvature
dependent speed: Algorithms based on Hamilton- Jacobi formulations,"
J. Comput. Phys., vol. 79, no. I, pp. 12-49, Nov. 1988.
[7] M. Stevenson, R. Weinter, and B. Widow, "Sensitivity of Feedforward
Neural Networks to Weight Errors," IEEE Transactions on Neural
Networks, Vol. l, No. 2, pp 71-80, 1990.
[8] N.Dheepa "Automatic seizure detection using higher order moments &
ANN" IEEE- international conference on advance in Engineering
science and management (ICAESM-2012) march 30,31,2012 with
ISBN: 978-81-909042-2-3, 2012 IEEE.
[9] Joge Martinez- carballido, "Metamyelocyte nucleus classification uses a
set of morphologic templates", 2010 electronics, Robotics and
Fig.8. Naive bayes and MLP-BP for abnormal and identifying
Automatic Mechanics conference 978-0-7695-4204-1110, 2010 IEE.
type of stone [10] P. M. Morse and H. Feshbach, "The variational integral and the Euler
equations," in Proc. Meth. Theor. Phys., I, May 1953, pp. 276-280.
IX. CONCLUSION AND FUTURE WORK [II] Demetrius H. Bagly, Kelly A. Healy, "Ureteroscopic treatment of larger
renal calculi (>2cm)", Arab Journal of Urology (2012) 10, 296-300
production and hosting by Elsevier.
The level set segmentation with momentum and resilient
[12] William G. Robertson, "Methods for diagnosing the risk factors of stone
propagation are very effective in identifying the region of formation", Arab Journal of Urology (2012) 10, 296-300 production and
stones in the US kidney image. The energy levels extracted hosting by Elsevier.
from the wavelet subbands i.e. Daubechies (Db12), Symlets [13] Mohamed E. Abou EI-Ghar, "Low-dose unenhanced computed
tomography for diagnosing stone disease in obese patients". 2090-598X,
(sym I 2) and Biorthogonal filterers (bi03.7, bi03.9 & bi04.4), 2012 Arab Association of Urolog, Production and hosting by Elsevier
gives the clear indication of difference in the energy levels B.V, 10,279-283.
compared to that of normal kidney image if there is stone. The [14] M. Riedmiller and H. Braun, "A direct adaptive method for faster
backpropagation learning: The RPROP algorithm," in Froc. IEEE Int.
ANN trained with normal kidney image and classified image
Con! Neural Netw., vol. 1. Jun. 1993, pp. 586-591.
input into normal or abnormal by considering extracted energy
[15] William G Robertson, "Methods for diagnosing the risk factors of stone
levels from wavelets filters. The system is tested with different fonnation", 2090-598X, 2012 Arab Association of Urolog, Production
kidney images from database and has classified successfully and hosting by Elsevier B.V, 10,250-257.
with the accuracy of 98.8%. So this system can be readily used [16] Bernhard Hess, "Metabolic syndrome, obesity and kidney stone", 2090-
598X, 2012 Arab Association of Urolog, Production and hosting by
in the hospitals for detecting abnormality of individuals US Elsevier B.V, 10,258-264.
kidney image. Thus in this work it is proved that the [17] Hyun Wook Park, Todd Schoepflin, "Active Contour model with
combination level set segmentation, wavelet filters, multilayer gradient directional infonnation: Directional Snake", IEEE Transactions
Perceptron with back propagation the better approach for the on circuits and systems for video technology, VoUI, No.2, February
2001.
detection of stones in the kidney In the future work the
[18] Max W. K. Law and Albert C.S Chung, "Segmentation of Intracranial
system will be designed and implement on FPGA using Vessel and aneurysms in phase contrast magnetic resonance
hardware description language (HDL) to display kidney image angiography using multirange filters and local variances ", IEEE
Transactions on image processing, Vol. 22,No.3,March 2013.
and stone with colour for easily identification and visibility of
[19] Weidong Zhang, "Mesenteric Vasculature- Guided small Bowel
stone on monitor.
Segmentation on 3-D CT", IEEE Transactions on Medical image, Vol.
32,No.11,Novenber 2013.
2014 International Conference on Advances in Computing, Communications and Informatics (lCACCl) 413
[20] Yan Nei Law and Hwee Huan, "A multiresolution Stochastic Level set [23] Thord Anderrson, Gunnar Lathen, "Modified Gradient search for level
method for Mumford- shah image segmentation", IEEE Transactions on set based image segmentation". IEEE Transactions on image
image processing, Vol. 17,No.12, December 2013. processing, Vol. 22,No.2, February 2013.
[21] R. Kimmel, "Fast edge integration," in Geometric Level Set Methods in [24] Koushal Kumar "Artificial neural network for diagnosis of kidney stone
Imaging, Vision and Graphics. New York: Springer-Verlag, 2003. disease". U. Infonnation Technology and Computer Science, 2012,7,20-
[22] Shijian Lu, Member, IEEE "Automated layer segmentation of optical 25
coherence tomography images", IEEE Transactions on biomedical
engineering, Vo1.57, No. 10 October 2010.
Key Words: Kidney stone detection, CNN classification,wavelet processing,ultrasound images,Gaussian filter,canny edge
detection.
dark green vegetables and fruits like berries etc .Increase in
I. INTRODUCTION the concentration of calcium or oxalate in urine can be
Kidney stone diseases and its occurrence is alarming in caused because higher dosages of vitamin-D. Several
these days. Renal Calculus, also known as a kidney stone is metabolic disorders such as irregular intake of food can
a solid piece of material which is formed in the kidneys. even cause these. Calcium phosphate is the main content of
Minerals in the urine are primary cause for production of calcium stones. Renal tubular acidosis which is a metabolic
renal calculus in kidneys. Kidney stones usually pass in the reaction, is one of the major reason for the formation of
urine, a small stones may even pass without causing these stones. Seizure medications, such as to piramate may
symptoms. The initial stages of these kidney stone diseases even also produce these stones. Struvite stones-Frequent
are noticed latterly or which cannot be detected easily, in diagnosis with urinary tract infections usually cause this
turn damages the kidney as they grow to become larger. type of stones is found in recent studies. These stones are
Diabetesmellitus, hypertension, glomerulonephritis are alarming situations as they grow larger with the time which
major causes for kidney failures and yearly many people may lead to removal by surgery. Uric acid stones- Humans
are affected by these diseases. Initial stage diagnosis is who usually do not drink enough uids which are sufficient
advisable and can save many lives because after for the body and those who lose more fluids and high
malfunctioning of the kidney it may lead to some serious content of protein in their diet are more prone to this uric
issues and even to death. Ultrasound (US) image is one of acid stones as they produce more uric acid. Recent studies
the available low-cost methods and is widely used for show genetic dependency in the occurrence of uric acid
imaging kidneys for diagnosis of kidney diseases. stones. Cystine stones-A hereditary disorder that causes the
kidneys to excrete too much of certain amino acids may
1.1 Types of kidney stones include:
cause these stones (cystinuria).
Calcium stones- Calcium oxalate which is the prime
content of calcium stones. Oxalate is a naturally occurring
II. LITERATURE SURVEY
substance found in food. Even found in metabolic activities There has been many research carried in the fields of this
by liver. Foods high in oxalate include nuts, chocolates, image processing for kidney stone detection, researchers
used many kinds of algorithms for finding the stone in a matrix of brightness function has to made as the original
kidney.[2] In this paper they studied about the early stage images which are captured by some sensor may have low
detection of kidney stones by using improved seeded region intensity. The prime aim of image pre-processing is an
growing based segmentation and classified kidney images enhancement of the image data those image features
according to the stone size, intensity threshold change was important for further processing. Geometric transformations
extracted from the segmented parts of image and size of of images such as rotation, scaling, translation are done
stone was compared with normal standard stone size. (less among pre-processing methods which are quite similar
than 2 mm absence of stone, 2-4 mm early occurrence stage methods.
, 5mm and above presence of kidney stones) Ultrasound
kidney image samples taken from the clinical laboratory
their results included diagnosing the kidney stones by
varying the intensity threshold presence and absence along
with the early stages of stone formation. [3] In this system
kidney stone disease is diagnosed using two different neural
architectures, those are Learning Vector quantization (LVQ)
and Radial basis function(RBF) these are compared among
them to get the best result. They used Waikato Environment
for Knowledge analysis (WEKA) version 3.7.5 as simulator.
They took real world dataset with 1000 instances and 8
attributes.[4] In this paper, we first proceed for the
enhancement of the image with the help of median filter,
Gaussian filter and un-sharp masking.some operations like
erosion,dilation and entropy based segmentation employ to
discover the region of interest. At last KNN and SVM
classification methods are used for the survey of kidney
stones. [5]CAD algorithm based on FGPA was used for
Fig 1: Architecture
detection of abnormality in kidneys. Noise present in ultra
sound image is removed first and then segmented .Features 3.2 Image Segmentmaation
like intensive histogram and haralick were obtained from the Segmentation is an important and major aspect of medical
segmented image. Later classification was performed imaging and digital image processing. It helps in
following two process one is differentiating between healthy visualizing the data available by providing diagnostics for
kidney and unhealthy kidney by using lookup table approach, various diseases depending on the given dataset. Canny
if the abnormality in the kidney is confirmed further the edge detection, identifying and sharpening the edge of the
image is processed with the help of support vector kidney and the stone in the kidney are two major
machine(SVM) and MLP trained with specific features to functionalities of it. It is one of the level set segmentation
identify the presence of cyst or stone. [6]Developed a method technique. The process of dividing a digital image into
of automated feature description of renal size. Analysis on multiple segments is termed as segmentation of the image.
kidney size compared within a normal and abnormal are The image is divided into various sets of pixels which are
performed. The accuracy between manual method and called as image objects. Segmentation prime aim is to
automated method varied a lot i.e a difference of 10% manual simplifyand to represent given image into particular pattern
gave an accuracy of 81% and automated with 91%. which even can be used to analyze. The lines, curves,
III. PROPOSED ALGORITHM boundaries are located in the process of image
segmentation and even image objects. Assigning labels to
The project is divided into 4 modules every pixel of the image and segregating labels having
3.1. Image pre-processing. same labels which have common characteristics and this
3.2. Image segmentation. process is termed as image segmentation. The result
3.3. Wavelet processing. produced isimage segmentation, a set of segments which
3.4. CNN classification. cover the entire image or a set of contours of the image.
3.1 Image Pre-Processing The characteristic or property such as colour, intensity and
texture of each of the pixels in a region is similar.
Ultrasound images are prone to have some noise in their
initial stage because of its low contrast. Pre-processing 3.3 Wavelet Processing
consists of Image restoration, Smoothing, sharpening, Wavelet transforms are a mathematical procedure of
Contrast enhancement. Pre-processing is a operation with performing signal analysis when signal frequency varies
images at the lowest level of abstraction both input and over time. Wavelet Transform is particularly selected for
output images. The image which is usually represented by a this project as for certain classes and signals this provides
better precise results. Wavelets are commonly used in reducing the amount of data to be processed. This technique
image processing to detect and filter white Gaussian noise is used to detect the edgeswhich involves various steps. The
because of their high contrast of intensity values ofthe first stepis noise reduction using gaussian blur in which a
neighbouring pixel. The two-dimensional image in the form 5x5 gaussian filter is used to remove the noise from the
of the matrix is feed into wavelet transform. The segmented obtained pre-processed image. The second step is Gradient
image from the input opted to perform wavelet transform to calculation in which the edge intensity and direction are
get a compressed image. The image processed in this way detected by calculating the gradient using edge detection
can be cleaned without destroying the image quality such as operation. The output of this step involves image containing
blurring and muddling. thick edges. The third step is Non-maximum Suppression.
3.4 CNN Classification As the output of the algorithm should contain thin edges,the
algorithm finds the pixels with maximum value in the edge
The convolutional neural network (CNN) is a sub-part of
directions by going through the points on the gradient
deep learning neural networks. CNN is abundantly used in
intensity. The fourth step is Double threshold.In this step
image recognition and digital imageprocessing. Analysis of
we aim at identifying 3 kinds of pixels: strong, weak, and
visual imagery and image classification are major
non-relevant. Pixels that contribute to the final edge are
functionalities of CNN and are quite often used in these
classified as strong edges. Pixels with intensity values that
fields. Applications of CNN are be seen from social media
are not sufficient to be classified as strong edges, but not
to scientific research. Healthcare and security arefields
small enough to be considered as non-relevant are classified
where we can find CNN used majorly because of its
as weak pixels. The remaining pixels are considered as non-
functionalities. Image classification is the process of taking
relevant pixels. Double threshold is used for categorizing
an input and passing it through a black box and outputting a
pixels based on the intensity.High threshold identifies
class or to which probability that the input is a particular
strong pixels, Low threshold identifies non-relevant pixels,
class. CNN can be introspected as automatic feature
and the other pixels are marked as weak. The result of this
extraction from the image and using it further in pattern
step includes an image consisting only strong and weak
recognition. The adjacent pixel information is used
pixels. The fifth step is Edge Tracking, here transformation
productively down-sample the image. CNN has one or
of weak pixels into strong pixels take place if and only if
more layers of convolution units. A convolution unit id feed
the pixels around the one being processed is a strong
with input from multiple units from the previous layer
one.The output of the Image segmentation module is sent to
which together creates proximity. Therefore, the input
the Wavelet Processing module.A wavelet decays swiftly
unitsshare their weights. The input is in the form of wavelet
just like an oscillation which has zero mean. Unlike
transform by takinga series of input images. Each image is
sinusoids which extend to infinity, a wavelet exists for a
given as input in the form of a matrixto neurons in the input
finite duration.The image processed in this way can be
layer of the CNN. A smaller matrix termed as filter is
“cleaned up” without blurring the details. The output of this
selected for the filtering process. The filter multiplies its
module is in matrix form containing pixel values of the
values by original pixel values and produces another image
image.
matrix. These values are summed up. The convolution
continues. Finally, a smaller matrix than the input matrix is The fourth module is CNN Classification. The output from
obtained. The output matrix of CNN classification is wavelet processing module is a greyscale matrix of size
compared with another ground truth image matrix and 128*128*1. CNN Classification involves 4 steps namely
classification is performed. Convolution layer, Activation function, max Pooling, Fully
connected network. In Convolution layer a 3*3 kernel is
IV. EXPERIMENT AND RESULTS applied on the input matrix with stride 1, so that the size of
The first phase involves the dataset preparation. In our case, the image is reduced. The obtained matrix is sent to the
we have collected some sample ultrasound kidney images activation function layer, here ReLU(Rectified Linear
with and without stones and converted them into a csv file Unit)activation function is used to eliminate negative
which can be used as a dataset in our projectduring the values. The next step is max pooling, here the rectified map
implementation of CNN classification module. Initially, as goes through a pooling layer, pooling is down sampling
the ultrasound kidney image containsthe speckle noise and operation that reduces the dimensionality of feature
is of low contrast, one of the image pre-processing map.The output of this layer is a matrix with reduced size
technique is being applied to remove the speckle noise. In containing all the features. These 3 steps are repeated for
this project, Gaussian filtertechnique is used to blur the two times, in which 32 filters are used each time. The next
image by using gaussian function to remove the noise. This step is Flattering in which we convert the 2D array from
pre-processing involves Image restoration, smoothing and pooling into a long continuous linear vector to which a
sharpening.In the implementation of image segmentation filter of size 64 is applied followed by activation function.
module, canny edge detection technique is used toextract Later a Drop Out of size 0.5 is applied to prevent over-
the useful information from the image by reducing or fitting. In the next step ANN model is applied, in which
eliminating the information which is not requiredthereby
Fig: Converting matrix into linear array form V. CONCLUSION AND FUTURE SCOPE
In this project, the survey of different algorithms and
classifications are analyzed followed by the detection of
stone present in the kidney. From this implementation, the
existing system limitations are inferred and a new design is
Fig: convolution methodology proposed to address the limitations such as level set
techniques require considerable thought in order to
construct velocities to get a perfect advanced level set
function. This means there should be a huge data available
to get the accuracy rate which is sometimes may not be
possible. We planned to rectify these issues using CNN
classification. The energy levels extracted from the wavelet
subbands i.e., Daubechies, Symlets and biorthogonal filters
gives the clear indication of difference in the energy levels
compared to that of normal kidney image if there is stone.
fig: output with label yes (presence of stone) The CNN trained with normal kidney image and classified
input into normalor abnormal by considering extracted
energy levels from wavelet filters. By using CNN
classification we obtained an accuracy in between 70-85%.
Python above 3.6 was used to implement and pycharm
software tool was used.
REFERENCES
Fig: output with label No (absence of stone) [1] K.Viswanath, R.Gunasundari, “Design and Analysis
Performance of Kidney Stone Detection from Ultrasound
Image by Level Set Segmentation and ANN
Classification.”,2014.
[18] Rubbal Birdi, Jyoti Gill "3-D Tumor Detection from Kidneys
using UltrasoundImages",2014.