<!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>Valery Grishkin a, Alexander Ebral b, Nikolai Stepenko c, Jean Sene d</article-title>
      </title-group>
      <contrib-group>
        <aff id="aff0">
          <label>0</label>
          <institution>Saint Petersburg State University</institution>
          ,
          <addr-line>7-9 Universitetskaya nab., Saint Petersburg, 199034</addr-line>
          ,
          <country country="RU">Russia</country>
        </aff>
      </contrib-group>
      <pub-date>
        <year>2018</year>
      </pub-date>
      <fpage>369</fpage>
      <lpage>373</lpage>
      <abstract>
        <p>The paper proposes an algorithm for segmentation of text, applied or presented in photorealistic images, characterized by a complex background. The algorithm is able to determine the exact location of image regions containing text. It implements the method for semantic segmentation of images, while the text symbols serve as detectable objects. The original images are pre-processed and fed to the input of the pre-trained convolutional neural network. The paper proposes a network architecture for text segmentation, describes the procedure for the formation of the training set, and considers the algorithm for pre-processing images, reducing the amount of processed data and simplifying the segmentation of the object "background". The network architecture is a modification of well-known ResNet network and takes into account the specifics of text character images. The convolutional neural network is implemented using CUDA parallel computing technology at the GPU. The experimental results for evaluating quality of text segmentation with IoU (Intersection over Union) criterion have proved effectiveness of the proposed method.</p>
      </abstract>
      <kwd-group>
        <kwd>text segmentation</kwd>
        <kwd>semantic segmentation</kwd>
        <kwd>convolution neural network</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <p>Photorealistic images containing text information comprise a large part of the multimedia
content presented on the Internet. These include real pictures with the text applied to them later, the
video in which there are titles, pictures with inscriptions, signs, ads, etc. For high-quality text
recognition in such images, it is necessary to separate the text from a rather complex background, in
other words, to segment the image. Two approaches to segmentation are possible.</p>
      <p>
        The first approach is based on finding the image areas containing text and defining, for these
areas, the parameters of the minimum bounding rectangles. Within this approach, classifiers using
heuristic features are constructed [
        <xref ref-type="bibr" rid="ref1 ref2 ref3">1-3</xref>
        ]. Commonly classifiers like SVM and Random Forest is used.
The second approach is based on semantic segmentation methods that localize regions containing
objects that are present in the image. These methods use classifiers based on convolutional neural
networks [
        <xref ref-type="bibr" rid="ref4 ref5 ref6">4 - 6</xref>
        ].
      </p>
      <p>In this paper, we propose to use the second approach for text segmentation. It allows to
achieve high quality segmentation of various objects on a complex background. The methods of
semantic segmentation are good in localizing objects representing closed and sufficiently large areas
of the image. However, text characters in most cases consist of relatively thin lines and occupy a small
area. Therefore, it is not possible to use neural networks designed for segmentation of large objects
directly for text segmentation. However, it is possible to modify the architecture of well-proven deep
convolutional neural networks for working with images containing text characters.</p>
    </sec>
    <sec id="sec-2">
      <title>2. Convolutional neural network for text segmentation</title>
      <p>
        Quality of segmentation of objects is estimated by criterion of IoU (Intersection over Union)
Currently, the DeepLabV3 neural network [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ] shows the best segmentation results. For this network,
IoU criterion reaches 77% on the PASCAL VOC 2012 data set [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ]. Therefore, we chose architecture
of this network as the basis for developing a new network for symbol segmentation.
      </p>
      <sec id="sec-2-1">
        <title>2.1. Network topology</title>
        <p>features. These low-level features are obtained by processing the output of the convolutional block
using global average pooling. The result of the pooling is then processed by convolution 1x1. Output
features of all five branches are combined and passed through a 1x1 convolution. The resulting image
at the output of the ASP block is the segmentation mask.</p>
        <p>Convolution of the original DeepLabv3 network is configured so that output stride i.e. the
value of the ratio of the resolution of the input image to the resolution of the output image equals 16.
This approach is not valid for text segmentation because the geometric structure of text symbols is not
preserved. Considering these differences, as well as the fact that the text symbols are of a simpler
geometric structure than the objects of the PASCAL VOC 2012 dataset, we suggest reducing the
output stride to 4.</p>
        <p>Each convolutional block of the original DeepLabv3 network contains two paths of image
passage: short and long — through several consecutive convolutions. This allows us not to lose the
data that turned into 0 at convolutions. This property is useful for presenting text, since the loss of part
of the fine lines that make up the text can affect the overall quality of segmentation. Usually for
segmentation of complex objects of many classes several blocks of the structure shown in Figure 2 are
used. To ensure the output stride value of 4, we suggest using only one block of this type. The
proposed block contains two consecutive convolutions, to the outputs of which the activation function
ReLu is applied, followed by averaging pooling with a 4x4 window and a shift parameter of two.</p>
        <p>The ASPP block is similar to the same DeepLab V3 block. It consists of four parallel
convolutions — one convolution with a 1 × 1 core, three expanded convolutions with a 3 × 3 core, and
has an image level features calculation unit. The difference is that for extended convolutions, the
spatial steps between the convolution weights have been reduced. We chose the following values of
atrous rates - 2, 4, and 6, while in the original network their values were - 6, 12, and 18. We apply
triple reduction in rate because the text consists of relatively thin lines. Note that convolution with a
3×3 kernel and a maximum rate of six covers a line width of 15 pixels, which seems sufficient for text
segmentation. Like in the original network, we combine the resulting feature maps and pass them
through convolution 1x1.</p>
      </sec>
      <sec id="sec-2-2">
        <title>2.2. Dataset</title>
        <p>
          To train the proposed network, a pre-marked set of photo-realistic images containing text is
required. Currently, only one public dataset is known that is suitable for the subject area - Chars74K
[
          <xref ref-type="bibr" rid="ref9">9</xref>
          ]. However, the quantity and quality of images, as well as annotations of the text in it, are quite low.
Therefore, we have created our own data set to solve the problem. This set is generated on the basis of
a collection of a sufficiently large number of existing fonts that take into account the various options
for displaying the characters of an alphabet. When generating a set, we formed the text, which was
then superimposed, with a certain level of transparency, on the photorealistic image. The text itself can
be of any size, color, and angle of inclination, displayed in one or several fonts, and located anywhere
in the image.
        </p>
        <p>To generate text, we used lower case letters of the Russian alphabet, numbers, and common
punctuation marks ('.', ',', ';', '-', ':', '!') – 49 characters overall. The algorithm randomly selects
characters from this alphabet and then picks nouns of the Russian language from the dictionary. Then
it applies the text to the image using one of 30 free TrueType fonts. The font type and its size and
color are all selected randomly. As background images, 5,000 photorealistic images that do not
contain text are used. The algorithm of applying text to the original image is like the following: we
divide the image into 4 blocks and apply the pre-shaped text to each image block. Again, the position
and orientation of the text in the block is randomly selected.</p>
        <p>When applying text to a background image, two masks are also formed that serve to mark up
the dataset being created. The first mask is a binary image of white text on a black background. The
second mask is a grayscale image of the same text, where the brightness of the symbol corresponds to
the position of the symbol in the alphabet. We use the first mask for binary segmentation between the
text and the background, and the other mask for multi-class segmentation of character type vs.
background.</p>
      </sec>
      <sec id="sec-2-3">
        <title>2.3. Preprocessing</title>
        <p>Before serving to the input of the neural network, we convert the original color image to
grayscale. Then, using the Canny operator on this halftone image, the boundaries of the brightness
differences are searched. Since the text is different in brightness from the background, this allows to
highlight the borders of the characters. At the same time, all other rather sharp differences in
brightness in the halftone image are also highlighted. The generated binary image of all boundaries is
processed using the morphological dilation operation. Then, element-wise multiplication of the
resulting binary mask by a halftone image is performed. This processing allows for filtering out most
of the background, leaving just information about the brightness near the borders, which simplifies the
task of separating the background borders from the text borders. Figure 3 shows the structure of the
preprocessing algorithm.</p>
        <p>The proposed preprocessing algorithm simplifies the segmentation of the “background” class,
which is usually diverse and therefore requires large computational costs for network training. For
segmentation of the background consisting of pixels of zero brightness, less computation effort is.</p>
      </sec>
      <sec id="sec-2-4">
        <title>3. Experimental results</title>
        <p>The proposed neural network implemented in the Python language using the TenorFlov
machine learning library for the GPU platform. Software for generating the necessary dataset is also
implemented in the Python language. We trained our network model on 4000 training images and
evaluated it on 1000 verification images from the generated dataset. The segmentation quality is
evaluated by the metric IoU. Figure 4 shows the results of the background - text segmentation, and in
Fig 5 the results of the background - symbols segmentation. All of these graphs show the dependence
of the IoU metric value during network training.</p>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>5. Acknowledgement References</title>
      <p>The authors acknowledge Saint-Petersburg State University for a research grant 11756691.
Note that in the case of background – symbols segmentation, the accuracy is significant falls.
However, both approaches can be combined and used for clarify the results of each other.</p>
    </sec>
    <sec id="sec-4">
      <title>4. Conclusion</title>
      <p>We propose the algorithm for segmentation of text regions on photorealistic images. It consists
of a preprocessing step, a recognition step, and a localization step. The second step uses the modified
convolutional network DeepLabV3 for recognition. Unlike the original network, the modified neural
network saves the geometric structure of text characters into the feature maps. The third step
determines the exact localization of recognized text characters and finds areas of the image containing
text. Experimental results show the effectiveness of the proposed algorithm. The segmentation quality
is evaluated by the metric IoU and reaches 78%, which is sufficient for further processing of the image
text using OCR systems. The use of parallel processing technology significantly reduces the
processing time of large series of images</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>Zhang</given-names>
            <surname>Jing</surname>
          </string-name>
          , Dong Wei,
          <string-name>
            <given-names>Zhang</given-names>
            <surname>Youhui</surname>
          </string-name>
          .
          <article-title>An Algorithm for Scanned Document Image Segmentation Based on</article-title>
          Voronoi Diagram // Computer Science and Electronics Engineering (ICCSEE),
          <source>2012 International Conference on(Volume:1)</source>
          ,
          <year>2012</year>
          , pp.
          <fpage>156</fpage>
          -
          <lpage>159</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>H. S.</given-names>
            <surname>Baird</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M. A.</given-names>
            <surname>Moll</surname>
          </string-name>
          ,
          <string-name>
            <surname>Chang</surname>
            <given-names>An</given-names>
          </string-name>
          ,
          <source>Document Image Content Inventories // Proc. of SPIE/IS&amp;T Document Recognition &amp; Retrieval</source>
          ,
          <year>2007</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <surname>Grishkin</surname>
          </string-name>
          , V.
          <source>Document Image Segmentation Based on Wavelet Features // CSIT 2015 - 10th International Conference on Computer Science and Information Technologies</source>
          . pp.
          <fpage>82</fpage>
          -
          <lpage>84</lpage>
          .
          <year>2015</year>
          . - DOI::
          <volume>10</volume>
          .1109/CSITechnol.
          <year>2015</year>
          .7358255
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>S.</given-names>
            <surname>Chandra</surname>
          </string-name>
          and
          <string-name>
            <given-names>I.</given-names>
            <surname>Kokkinos</surname>
          </string-name>
          .
          <article-title>Fast, exact and multi-scale inference for semantic image segmentation with deep Gaussian CRFs</article-title>
          . Available at: https://arxiv.org/abs/1603.08368 (accessed
          <year>11</year>
          .05.
          <year>2018</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>L.-C.</given-names>
            <surname>Chen</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J. T.</given-names>
            <surname>Barron</surname>
          </string-name>
          , G. Papandreou,
          <string-name>
            <given-names>K.</given-names>
            <surname>Murphy</surname>
          </string-name>
          ,
          <article-title>and</article-title>
          <string-name>
            <given-names>A. L.</given-names>
            <surname>Yuille</surname>
          </string-name>
          .
          <article-title>Semantic image segmentation with task-specific edge detection using cnns and a discriminatively trained domain transform</article-title>
          .
          <source>In CVPR</source>
          ,
          <year>2016</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>L.-C.</given-names>
            <surname>Chen</surname>
          </string-name>
          , G. Papandreou, I. Kokkinos,
          <string-name>
            <given-names>K.</given-names>
            <surname>Murphy</surname>
          </string-name>
          ,
          <article-title>and</article-title>
          <string-name>
            <given-names>A. L.</given-names>
            <surname>Yuille</surname>
          </string-name>
          .
          <article-title>Semantic image segmentation with deep convolutional nets and fully connected crfs</article-title>
          .
          <source>In ICLR</source>
          ,
          <year>2015</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>L.-C.</given-names>
            <surname>Chen</surname>
          </string-name>
          ,
          <string-name>
            <given-names>G.</given-names>
            <surname>Papandreou</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Schroff</surname>
          </string-name>
          , and
          <string-name>
            <given-names>H.</given-names>
            <surname>Adam</surname>
          </string-name>
          .
          <article-title>Rethinking Atrous Convolution for Semantic Image Segmentation</article-title>
          . Available at: https://arxiv.org/abs/1706.05587 (accessed
          <year>18</year>
          .04.
          <year>2018</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <surname>Pascal</surname>
            <given-names>VOC</given-names>
          </string-name>
          <article-title>data set mirror</article-title>
          . Available at: https://pjreddie.com/projects/pascal-voc
          <string-name>
            <surname>-</surname>
          </string-name>
          dataset-mirror
          <source>/ (accessed 19.04</source>
          .
          <year>2018</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          <article-title>[9] The Chars74K dataset</article-title>
          . Available at: http://www.ee.surrey.ac.uk/CVSSP/demos/chars74k/ (accessed 20.03.
          <year>2018</year>
          )
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>