<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Extensible Disease Classification Tool that can be Dynamically Trained by the End User</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Nikos Petrellis</string-name>
          <email>npetrellis@uop.gr</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>University of Peloponnese, Electrical and Computer Engineering Dept.</institution>
          ,
          <addr-line>Patras</addr-line>
          ,
          <country country="GR">Greece</country>
        </aff>
      </contrib-group>
      <fpage>382</fpage>
      <lpage>387</lpage>
      <abstract>
        <p>The Disease Classifier tool that is capable of classifying images displaying sick plant parts as well as human or animal skin disorders is presented in this paper. It is based on earlier applications (Plant Disease and Skin Disease) and classification techniques developed by the author for Windows Phones. These tools have been redesigned using Microsoft Xamarin platform and thus they can be deployed on Android or iOS smartphones. Images displaying either plant or skin disorders can be classified in the Disease Classifier environment based on the features of the lesions appearing on a plant leaves or fruits or the skin. New useful services have also been integrated in the Disease Classifier tool: a) the diagnosis rules are dynamically loaded without requiring recompilation and b) the features extracted when a new photograph is analyzed can be used automatically to train the tool on new diseases using a relatively small training set. These services, in conjunction with the employed simple but efficient classification algorithm, make the Disease Classifier a powerful assistant for end users such as agronomists since they can extend the tool for the support of new diseases. Plant disease, skin disorders, dynamic configuration, trained by the end user, Xamarin</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <sec id="sec-1-1">
        <title>Several mobile applications have been recently presented for plant disease diagnosis [1]. Maize</title>
        <p>diseases are diagnosed using a smartphone application in [2]. Crop diseases are recognized using an
intelligent mobile application based on fuzzy inference in [3]. Artificial Intelligence (AI) methods based
on Convolutional Neural Networks (CNN) have been extensively used to classify plant diseases. A</p>
      </sec>
      <sec id="sec-1-2">
        <title>CNN learning algorithm performing early plant disease diagnosis and classification with 98% success</title>
        <p>rate is demonstrated in [4]. Twelve plant diseases are recognized by a CNN network as described in [5].</p>
      </sec>
      <sec id="sec-1-3">
        <title>Similar image processing techniques have also been recently presented e.g., for hand, foot and mouth</title>
        <p>diseases [6]. Several medical image processing techniques have been simulated and compared in [7].
Various image processing techniques that have been applied both for plant disease diagnosis and
medical imaging are discussed in [8]. A simple but efficient classification method has been proposed
by the author initially for plant disease diagnosis. It was implemented as a Windows Phone application
(Plant Disease) since it was developed using Microsoft Visual Studio 2015. The classification method
employed in this application is based on grading the supported diseases according to whether the
extracted features fall within strict or loose limits that have been defined during training. The training
can be performed using a small fraction of photographs from the available dataset [9]. The same
classification method has been also applied for skin disorders in the Skin Disease application described
in [10]. One of the drawbacks of the Plant and Skin Disease applications was the practically abandoned
target platform (Windows Phone). Moreover, the limits of the features in each disease had to be
estimated
manually, converted to</p>
      </sec>
      <sec id="sec-1-4">
        <title>C# classes and embedded to the application source code.</title>
      </sec>
      <sec id="sec-1-5">
        <title>Consequently, the application had to be rebuilt for a different set of supported diseases.</title>
        <p>2022 Copyright for this paper by its authors.</p>
        <p>The Disease Classifier application described was developed using Microsoft Xamarin platform thus,
it can be deployed either on Android or iOS smart phones. Moreover, feature extraction from
photographs displaying a non-supported disease can be used to automatically train the system on new
diseases. In the Disease Classifier application, the disease recognition rule files cab be loaded
dynamically and the application can switch between different sets of supported diseases. In this way,
the end user (e.g., an agriculture research institute or an agronomist) can customize the tool for the
requirements of his customers (pricing policy, supported diseases).</p>
      </sec>
      <sec id="sec-1-6">
        <title>The classification method and the early Plant and Skin Disease applications are described in Section</title>
      </sec>
      <sec id="sec-1-7">
        <title>2. The new Disease Classifier application and its use are discussed in Section 3.</title>
      </sec>
    </sec>
    <sec id="sec-2">
      <title>2. The Plant and Skin Disease applications</title>
      <sec id="sec-2-1">
        <title>Rules’ File</title>
      </sec>
      <sec id="sec-2-2">
        <title>Select Image</title>
      </sec>
      <sec id="sec-2-3">
        <title>Segmentation</title>
      </sec>
      <sec id="sec-2-4">
        <title>Feature Extraction</title>
      </sec>
      <sec id="sec-2-5">
        <title>Disease Grading</title>
      </sec>
      <sec id="sec-2-6">
        <title>Disease Classification</title>
      </sec>
      <sec id="sec-2-7">
        <title>Statistical Processing</title>
      </sec>
      <sec id="sec-2-8">
        <title>The Plant Disease and Skin Disease applications described in [9] and [10], respectively are based</title>
        <p>
          on the operations shown in Figure 1. Initially the Rules file has to be selected that contains the feature
ranges for each disease. Then the image is selected and segmented, followed by feature extraction. The
feature values are compared with the ranges in the Rules file to grade each disease. The image is
classified as the disease with the highest grade. Before giving more details on the steps displayed in
Figure 1, the features used in the employed classification method have to be described. Table 1, lists all
the classification features that represent meaningful aspects of the image such as the number of spots
and their area. When a new image is selected in the second step of Figure 1, it is segmented in 4 regions
using appropriate thresholds. For the sake of simplicity, it was assumed that the background was white.
The rest of the image it is assumed to display the plant or skin part. Pixels in this part, that are darker
than another threshold are assumed to belong to the lesion spots. In some diseases, the lesion spots are
brighter than the normal part and in this case they are marked as spots if their color is brighter than the
threshold. Finally, a halo with a configurable pixel thickness (e.g., 5 pixels) is defined around the spots
since in most diseases the spots are surrounded by a region of distinct color. As shown in Table 1, the
number of recognized spots, their relative area, and the gray level of the spot, the normal part and the
halo regions are some of the features used in the classification process. Then, for each one the three
regions of interest, a histogram is constructed for each color [9]. These histograms indicate how many
pixels exist with a specific color level (
          <xref ref-type="bibr" rid="ref1 ref2 ref3 ref4 ref5 ref6">0-255</xref>
          ) in one the three regions. It has been experimentally shown
that in most cases these histograms are single lobes. It is expected that the histogram lobes extracted
from pictures displaying the same disease would be similar. However, instead of using a complicated
pattern matching method for histogram similarity, we simply compare the start, the end and the peak of
the lobes. In this way, an overall number of 32 features are used as shown in Table 1.
        </p>
        <sec id="sec-2-8-1">
          <title>Features used in the employed classification method</title>
        </sec>
        <sec id="sec-2-8-2">
          <title>Feature</title>
        </sec>
        <sec id="sec-2-8-3">
          <title>Spots</title>
        </sec>
        <sec id="sec-2-8-4">
          <title>Spot Area</title>
        </sec>
        <sec id="sec-2-8-5">
          <title>Spot gray level</title>
        </sec>
        <sec id="sec-2-8-6">
          <title>Normal part gray level</title>
        </sec>
        <sec id="sec-2-8-7">
          <title>Halo gray level</title>
        </sec>
        <sec id="sec-2-8-8">
          <title>Histogram lobe start</title>
        </sec>
        <sec id="sec-2-8-9">
          <title>Histogram lobe end</title>
        </sec>
        <sec id="sec-2-8-10">
          <title>Histogram lobe peak</title>
        </sec>
        <sec id="sec-2-8-11">
          <title>Description noise</title>
        </sec>
        <sec id="sec-2-8-12">
          <title>Number of lesion spots (islands). Very small spots can be considered as</title>
        </sec>
        <sec id="sec-2-8-13">
          <title>The fraction of the lesion spot pixels in the displayed plant or skin part</title>
        </sec>
        <sec id="sec-2-8-14">
          <title>The average gray level of the spot pixels</title>
        </sec>
        <sec id="sec-2-8-15">
          <title>The average gray level of the normal part pixels</title>
        </sec>
        <sec id="sec-2-8-16">
          <title>The average gray level of the halo pixels</title>
        </sec>
        <sec id="sec-2-8-17">
          <title>The color (red, green or blue) level where the histogram lobe (spot, normal, halo) starts (9 parameters)</title>
        </sec>
        <sec id="sec-2-8-18">
          <title>The color (red, green or blue) level where the histogram lobe (spot, normal, halo) ends (9 parameters)</title>
        </sec>
        <sec id="sec-2-8-19">
          <title>The histogram lobe peak position (9 parameters)</title>
        </sec>
      </sec>
      <sec id="sec-2-9">
        <title>After the segmentation of the image, the extraction of the 32 features listed in Table 1 takes place</title>
        <p>(4th step of Figure 1). During training on a new disease d, the feature f values of the training photographs
are examined to find its range in terms of strict limits (fds_min, fds_max). Loose limits (fdl_min, fdl_max) are
arbitrary defined by extending the strict limits either by a constant number or by a fraction. The strict
and loose limits for each disease form the rules file required when a new photograph is analyzed (1st
step of Figure 1).</p>
        <p>Each feature f can participate in the disease d grade with a different weight wfd. When a new
photograph has to be classified in one of the supported diseases, its extracted feature values are
compared with the strict and loose limits of each disease d and a grade Gd is estimated as follows:
  = ∑     _</p>
        <p>+ ∑     _ ,</p>
        <p>= 1, 
  = 1,</p>
        <p>_
  _
≤ 
≤</p>
        <p>
          ≤ 
≤   _
 _
, otherwise 0
, otherwise 0
(
          <xref ref-type="bibr" rid="ref1">1</xref>
          )
(
          <xref ref-type="bibr" rid="ref2">2</xref>
          )
(
          <xref ref-type="bibr" rid="ref3">3</xref>
          )
(a)
(b)
(c)
ver. 1.0, a Threshold in gray level was used to segment the lesion spots and a second threshold for the
        </p>
      </sec>
      <sec id="sec-2-10">
        <title>Background. The field Min Spot Area determines the minimum number of pixels, a spot has to consist</title>
        <p>of, in order to be taken into consideration (otherwise it is recognized as noise and ignored). In Plant</p>
      </sec>
      <sec id="sec-2-11">
        <title>Disease ver. 2.6 different spot and background thresholds are determined for each one of the red, green</title>
        <p>and blue colors. More sophisticated automatic segmentation methods can also be tested by checking
the Altern checkbox instead of Manually. If the spots are brighter than the normal plant or skin part,
then the Invert checkbox has to be ticked. In the segmented image shown in Fig. 2c, the background is
displayed in white, the spots in black, the halo in gray and the normal part in darker gray. The histograms
for each one of these regions can be previewed from the corresponding buttons (Spot Col, Norm Col,
Halo Col).</p>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>3. The Disease Classification Application</title>
      <sec id="sec-3-1">
        <title>The Disease Classification application presented in this paper has been developed using Microsoft</title>
      </sec>
      <sec id="sec-3-2">
        <title>Xamarin platform in Visual Studio 2019. Porting the older Plant and Skin Disease applications from</title>
      </sec>
      <sec id="sec-3-3">
        <title>Visual Studio 2015 to Xamarin is not straight forward. Thus, the interface of the new application had</title>
        <p>to be developed from scratch, incorporating the necessary improvements. The development of the</p>
      </sec>
      <sec id="sec-3-4">
        <title>Device Classification in Xamarin allowed its deployment as an Android or iOS mobile application. (a) (b) (c)</title>
        <p>Figure 3: The entry page (a) of the Disease Classification application, the main page for photograph
selection and analysis (b) and the page displaying the extracted feature values (c).</p>
      </sec>
      <sec id="sec-3-5">
        <title>The most important advantage of the new application that has been developed, is the support of the</title>
        <p>dynamic loading of the disease recognition rules (step 1 in Figure 1). This step required a new project
build in the earlier applications. The strict/loose limits estimated from the training phase are now stored
in a plain text file that can be picked in the first page of the application (see Figure 3a).</p>
        <p>The format of the rules file is relatively simple: the number of diseases D is listed in the first line
followed by D pairs of lines. Each pair contains the disease name (first line) and a message in the next
line. This message can be displayed if the image is classified to the corresponding disease. Then, D
more pairs of lines follow with the strict/loose limits and the weights of each feature. More specifically,
in the first line of the pair for a specific disease d, the features limits are listed in the order: fdl_min, fds_min,
fds_max, fdl_max (4×32 features=128 values in a single line separated with commas). In the following line
of the pair, a weight is listed for the specific feature loose limits and one for the feature strict limits (64
values). The next page (Figure 3b) is similar to the main page of the Plant Disease ver. 2.6.</p>
        <p>After successfully segmenting the input image, the feature extraction takes place and the feature
values are displayed in the page shown in Figure 3c. Although, the feature values were also listed in the
earlier Plant and Skin Disease applications, the administrator had to copy the feature values to a
spreadsheet in order to extract manually their ranges. Then, the strict and loose limits of these feature
ranges had to be transformed in C# classes, incorporated in the source code of the applications (the path
with the dash-line in Figure 1). In the Disease Classification application, the button Train has been
added that accumulates the feature values from the training images in a single file that is processed
automatically in order to generate the rules file that is now loaded dynamically after the training is
finished.</p>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>4. Conclusions</title>
      <sec id="sec-4-1">
        <title>A mobile application for disease classification, developed in Microsoft Xamarin for Android and</title>
        <p>iOS, was presented in this paper. It is based on earlier Windows Phone applications that have been
developed by the author for plant and skin disease diagnosis. The Disease Classification tool allows the
dynamic disease rule definition. This service in conjunction with the automatic training that is
performed using a small image set, allow the extension of the supported diseases by an end user that is
not necessarily qualified in computer science.</p>
      </sec>
      <sec id="sec-4-2">
        <title>Future work will focus on experimenting with plant and skin diseases using publically available datasets and testing extensions of the employed classification algorithm.</title>
      </sec>
    </sec>
    <sec id="sec-5">
      <title>5. Acknowledgements</title>
      <p>This work is protected by the patents 1009346/13-8-2018 and 1008484/12-5-2015 (Greek Patent</p>
      <sec id="sec-5-1">
        <title>Office).</title>
      </sec>
    </sec>
    <sec id="sec-6">
      <title>6. References</title>
      <p>[7] P. Salehi, N. Behzadfar, and H. Movahedi-Nasab. “Investigation and Simulation of Different</p>
      <sec id="sec-6-1">
        <title>Medical Image Processing Algorithms to Improve Image Quality Using Simulink-Matlab.” Journal</title>
        <p>
          of Novel Researches on Electrical Power, 10(
          <xref ref-type="bibr" rid="ref3">3</xref>
          ), 33-42 (2021).
[8] N. Petrellis. "A Review of Image Processing Techniques Common in Human and Plant Disease
        </p>
        <p>Diagnosis" Symmetry 10, no. 7: 270 (2018). https://doi.org/10.3390/sym10070270
[9] N. Petrellis. "Plant Disease Diagnosis for Smart Phone Applications with Extensible Set of</p>
        <p>Diseases" Applied Sciences 9, no. 9: 1952 (2019). doi: https://doi.org/10.3390/app9091952
[10] N. Petrellis, Using color signatures for the classification of skin disorders, in: Proceedings of the</p>
      </sec>
      <sec id="sec-6-2">
        <title>7th International Conference on Modern Circuits and Systems Technologies (MOCAST),</title>
        <p>Thessaloniki, Greece, 7-9 May 2018, pp. 1-4, doi: 10.1109/MOCAST.2018.8376573</p>
      </sec>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>I.N.</given-names>
            <surname>Oteyo</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Marra</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Kimani</surname>
          </string-name>
          , W. De Meuter and
          <string-name>
            <given-names>E. Gonzalez</given-names>
            <surname>Boix</surname>
          </string-name>
          .
          <article-title>“A Survey on Mobile Applications for Smart Agriculture</article-title>
          .”
          <source>SN COMPUT. SCI. 2</source>
          ,
          <issue>293</issue>
          (
          <year>2021</year>
          ). https://doi.org/10.1007/s42979-021-00700-x.
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>N.</given-names>
            <surname>Moawad</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Elsayed</surname>
          </string-name>
          ,
          <article-title>Smartphone Application for Diagnosing Maize Diseases in Egypt</article-title>
          ,
          <source>in: Proceedings of the 14th IEEE International Conference on Innovations in Information Technology (IIT) Al Ain, United Arab Emirates</source>
          , pp.
          <fpage>24</fpage>
          -
          <lpage>28</lpage>
          ,
          <year>2020</year>
          . doi: https://doi.org/10.1109/IIT50501.
          <year>2020</year>
          .9299067
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>M.</given-names>
            <surname>Toseef</surname>
          </string-name>
          and
          <string-name>
            <surname>M. J. Khan. “</surname>
          </string-name>
          <article-title>An intelligent mobile application for diagnosis of crop diseases in Pakistan using fuzzy inference system." Computers and</article-title>
          Electronics in Agriculture,
          <volume>153</volume>
          (
          <year>2018</year>
          ):
          <fpage>1</fpage>
          -
          <lpage>11</lpage>
          . doi: https://doi.org/10.1016/j.compag.
          <year>2018</year>
          .
          <volume>07</volume>
          .034.
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>A.</given-names>
            <surname>Xenakis</surname>
          </string-name>
          ,
          <string-name>
            <given-names>G.</given-names>
            <surname>Papastergiou</surname>
          </string-name>
          ,
          <string-name>
            <given-names>V. C.</given-names>
            <surname>Gerogiannis</surname>
          </string-name>
          and
          <string-name>
            <given-names>G.</given-names>
            <surname>Stamoulis</surname>
          </string-name>
          ,
          <article-title>Applying a Convolutional Neural Network in an IoT Robotic System for Plant Disease Diagnosis</article-title>
          ,
          <source>in: Proceedings of the 11th IEEE International Conference on Information, Intelligence, Systems and Applications (IISA)</source>
          , Piraeus, Greece, Dec.
          <volume>11</volume>
          ,
          <year>2020</year>
          , pp.
          <fpage>1</fpage>
          -
          <lpage>8</lpage>
          , doi: 10.1109/IISA50023.
          <year>2020</year>
          .9284356
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>G.</given-names>
            <surname>Shrestha</surname>
          </string-name>
          , Deepsikha,
          <string-name>
            <given-names>M.</given-names>
            <surname>Das</surname>
          </string-name>
          and
          <string-name>
            <given-names>N.</given-names>
            <surname>Dey</surname>
          </string-name>
          ,
          <source>Plant Disease Detection Using CNN, in: Proceedings of the IEEE Applied Signal Processing Conference (ASPCON)</source>
          , Kolkata, India, Dec,
          <volume>7</volume>
          ,
          <year>2020</year>
          , pp.
          <fpage>109</fpage>
          -
          <lpage>113</lpage>
          , doi: 10.1109/ASPCON49795.
          <year>2020</year>
          .
          <volume>9276722</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>M.</given-names>
            <surname>Farhad Aryan</surname>
          </string-name>
          ,
          <string-name>
            <given-names>W.</given-names>
            <surname>Krathu</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Arpnikanondt</surname>
          </string-name>
          , and
          <string-name>
            <given-names>B.</given-names>
            <surname>Tassaneetrithep</surname>
          </string-name>
          .
          <article-title>Image Recognition for Detecting Hand Foot and Mouth Disease</article-title>
          ,
          <source>in: Proceedings of the 11th International Conference on Advances in Information Technology (IAIT2020)</source>
          .
          <article-title>Association for Computing Machinery</article-title>
          , New York, NY, USA,
          <year>2020</year>
          , Article
          <issue>35</issue>
          ,
          <fpage>1</fpage>
          -
          <lpage>11</lpage>
          . DOI:https://doi.org/10.1145/3406601.3406640
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>