<!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>Cards recognition on a set of skat deck by the use of convolution neural network</article-title>
      </title-group>
      <contrib-group>
        <aff id="aff0">
          <label>0</label>
          <institution>Michalina Owczarek, Roman Kluger, Łukasz Ryziewicz Institute of Mathematics Silesian University of Technology Kaszubska 23</institution>
          ,
          <addr-line>44-100 Gliwice</addr-line>
          ,
          <country country="PL">Poland</country>
        </aff>
      </contrib-group>
      <fpage>15</fpage>
      <lpage>20</lpage>
      <abstract>
        <p>-In this article we present a model based on convolution neural network for object recognition on a photo. Neural network model was trained on two sets of photos which contain two different patterns of cards in first (larger) set and one card pattern in the second data set. The systems works well to verify images and recognize card on the image.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>I. INTRODUCTION</title>
      <p>
        Information processing makes many possibilities for
development of smart systems. New technologies work in various
places from industry to computer. We can find applications
of methods and models in many places. Neural networks
are very often used as detectors for different data types.
In technical systems neural networks serve as controllers of
geometric features [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ], optimization techniques for safe energy
[
        <xref ref-type="bibr" rid="ref2">2</xref>
        ], simulation methods for complex dynamic systems [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ] or
control in smart environments [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ].
      </p>
      <p>
        Another important field of application is image processing.
Here we can find a wide variety of approaches but applied
neural network constructions are much more sophisticated. We
can use advanced image processing to search for interesting
shapes of bacteria to enable faster recognition in medical
laboratories [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ]. Other approaches use neural networks to
solve problems of identification [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ]. However among neural
networks used for image processing most efficient results are
reported by the use of convolutional neural networks. These
structures are devoted to image processing, since first steps
are for image filtering and pooling what extracts the set of
important information for further processing. A study over
many important recent methods by the use of convolutional
neural networks was presented in [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ]. Recently an important
results from convolutional neural networks were also reported
in recognition of objects by adjusting these constructions to
special conditions of input images [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ] or using their deep
constructions for complex image reasoning [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ].
      </p>
      <p>In this article we present an approach to use neural networks
as classification for card game. In our idea convolutional neural
network was trained and used to recognize cards from images.
The construction we have used is based on classic approach
from python language libraries. We have implemented a
system which takes an image from smart phone camera and
©2019 for this paper by its authors. Use permitted under Creative Commons
License Attribution 4.0 International (CC BY 4.0).
forwards it to server, where a python program works for
classification. The results show our idea is interesting and
works well.</p>
      <sec id="sec-1-1">
        <title>A. History of neural networks</title>
        <p>Neural networks originate in idea of using methods
developed by millenia of evolution. Their development became
possible because of deepened research in field of neurobiology
and also rapid growth of calculation power of electronic
devices.</p>
        <p>One of the first scientific description concerning operation
of human brain came up in the beginning of 20. century. It
was written by Ramn y Cajal who made an assumption that the
brain consists of interconnected autonomic parts. Each of these
is responsible for different actions. He also wrote about special
cells which are processing signals received from senses and
also produce signals controlling parts of human body. These
cells are called neurons.</p>
        <p>About 50 years later another explorer, John Eccles prooved
that very important role is played by connections between
neurons mentioned above. These are called synapses. Synapses
enhance useful signals end decrease another. This part of
information processing plays important role in process of
learning.</p>
        <p>First model of neuron was made by Macculloch and Pitts
in 1943. It consists of many input signals activation function
and one output signal. In that model a simple Heavisides
function was used as an activation function. This model was
later developed in 1957 by Frank Rosenblatt and Charles
Wightman. They used 8 neurons with 512 connections and
build an electromechanical device for image classification.
Their device was called Perceptron. In 1960 Bernard Widrow
built an Adaptive linear element also called Adaline. It was
about ten times faster than the Perceptron. It was also more
popular in use, because it could analyze signals from radars
and other sensors. It had a large drawback, because it was
a linear classifier. It could only recognize linear separable
elements. For example a simple xor function is beyond
possibilities of these. This problem can be solved by usage of
multiple layers of neurons. The fast development of neural
networks was unfortunately stopped, because Marvin Minsky
and Seymour Papert in 1969 showed in their book, that
perceptrons and similar neural networks have limited
possibilities of application. Despite this, there wree some examples
of interesting neural networks in 1970s. One of them was
Brain state in a box built by James Anderson in 1977. It
was one of the first examples of neural network used for
extracting information from database. In 1982 John Hopfield
developed a recurrent neural network for solving problems
like traveling salesman problem. Recurrent neural networks
are used for making associative memory. The network can
learn some patterns and then can associate parts of these
patterns to create whole picture. In 1986 David Rumelhart
wrote a paper which popularized algorithm of backpropagation
of errors. This algorithm allows us to change weights of
singular connections between neurons proportionally to error
caused by them.</p>
      </sec>
    </sec>
    <sec id="sec-2">
      <title>II. DATA SET In this section we would like to present our data used for system implementation.</title>
      <sec id="sec-2-1">
        <title>A. What the Skat actually is</title>
        <p>Skat is a card game for 3 or more players (3 players are
active players, others passes hand). To play skat is used skat
deck which consist of 32 cards from As to 7th in each suit.
There are 4 suits: Acorns, Leaves, Hearts, Bells. Our goal
was to create the neural network which could detect card
on the photo and recognize which card (or cards) are on the
photograph. We were also curious what is the accuracy of the
network and how the size of dataset and number of computed
steps of network affect on its accuracy.</p>
      </sec>
      <sec id="sec-2-2">
        <title>B. Appropriate data</title>
        <p>We assumed that our Convultional Neural Network will be
recognizing objects on photos, so as well as test set, also
teaching set consist of photos on which we can see cards and
because of program which was used to tagging those cards,
laying parallel to edge of the picture.</p>
      </sec>
      <sec id="sec-2-3">
        <title>C. Sets of data</title>
        <p>First of all we prepared two data sets using two different
deck patterns.</p>
        <p>First data set (the larger one) contains all images of both
deck, which is about 300 images and the second set consist
only of photos of the first deck counting about 190 pictures.</p>
        <p>All cards on every photo was labeled by rectangle box and
than all of labels were collected in one file as tensor vector,
which neural network could take to compute each weights for
all cards.</p>
      </sec>
      <sec id="sec-2-4">
        <title>D. Data conversion</title>
        <p>After completing set of images and labeling it, we collected
whole labels in one text file and exported to vector of tensors,
which can be read and used by TensorFlow. Data prepared
like this could be used now for training convolutional neural
network.</p>
        <p>We used Faster RCNN with Inception v2 configured for
Oxford-IIIT Pets Dataset, which was created to recognize cats
and dogs. That was the pretrained model which we have used
and retrain on our dataset.</p>
      </sec>
      <sec id="sec-2-5">
        <title>A. The Oxford-IIIT Pet Dataset</title>
        <p>Its a collection of 7,349 images of cats and dogs . Theres
25 different dog breeds and 12 cat breeds. Each breed has
about 200 images. Images are divided into following sets:
50 images for training, 50 for validation, 100 for test. Each
image is annotated with breed label, a pixel level segmentation
marking the body, and a tight bounding box about the label.
The segmentation is trimap with regions corresponding to:
foreground (the pet body), background, and ambiguous (the
pet body boundary and any accessory such as collars).</p>
      </sec>
      <sec id="sec-2-6">
        <title>B. Evaluation protocol</title>
        <p>Three tasks are defined: pet family classification (Cat vs
Dog, a two class problem), breed classification given the
family (a 12 class problem for cats and a 25 class problem for
dogs), and breedand family classification (a 37 class problem).
1) A model for breed discrimination:
1) Shape model An object is given by a root part connected
with springs to eight smaller parts at a finer scale. The
appearance of each part is represented by a HOG filter,
capturing the local distribution of the images edges;
inference (detection) uses dynamic programming to find
the best trade-off between matching well each part to
the image and not deforming the springs too much.
2) Appearance model
a) Image layout-consists of five spatial bins
organized as 1x1 and 2x2 grids covering the entire
image area. This results in a 20,000 dimensional
feature vector.
b) Image + head layout-adds to the image layout just
described a spatial bin in correspondence of the
head bounding box (as detected by the deformable</p>
        <p>part model of the pet face) as well as one for
the complement of this box. These two regions
do not contains further spatial subdivisions.
Concatenating the histograms for all the spatial bins in
this layout results in a 28,000 dimensional feature
vector.
c) Image + head + body layout- combines the spatial
tiles in the image layout with an additional spatial
bin in correspondence of the pet head (as for the
image+head layout) as well as other spatial bins
computed on the foreground object region and its
complement (as described next). The foreground
region is obtained either from the automatic
segmentation of the pet body of from the ground-truth
segmentation to obtain a best-case baseline. The
foreground region is subdivided into five spatial
bins, similar to the image layout. An additional bin
obtained from the foreground region with the head
region removed and no further spatial subdivisions
is also used. Concatenating the histogram for all
the spatial bins in this layout results in a 48,000
dimensional feature vector.</p>
        <p>The foreground (pet) and background regions needed for
computing the appearance descriptors are obtained
automatically using the grab-cut segmentation technique.</p>
      </sec>
      <sec id="sec-2-7">
        <title>C. Experiments</title>
        <p>The models are evaluated first on the task of discriminating
the family of the pet, then on the one of the discriminating
their breed given the family, and finally discriminating both
the family and the breded. For the third task, both hierarchical
classification (i.e, determining the family and the breed
simultaneously) are evaluated. Training uses the the Oxford-IIIT Pet
train and validation data and testing uses the Oxford-IIIT Pet
test data.</p>
        <p>1) Pet family discrimination:
1) Shape only- The maximum response of the cat face
detector on an image is used as an image-level score for
the cat class. The same is done to obtain a score for the
dog class. Then a linear SVM is learned to discriminate
between cats and dogs based on these two scores. The
classification accuracy of this model on the Oxford-IIIT
Pet test data is 94.21%.
2) Appearance only- Spatial histograms of visual words
are used in a non-linear SVM to discriminate between
cats and dogs. The accuracy depends on the type of
spatial histograms consider, which in turn depends on
the layout of the spatial bins. On the Oxford-IIIT Pet test
data, the image layout obtains an accuracy of 82,56%;
adding head information using image+head layout yields
an accuracy of 85.06%. Using image+head+body layout
improves accuracy by further 2.7% to 87.78%. An
improvement of 1% was observed when the
groundtruth segmentation were used i place of the segmentation
estimated by grab-cut. The progression indicates the
more accurate the localization of the pet body, the better
is the classification accuracy.
3) Shape and appearance- The appearance and shape
information are combined by summing the exp 2
kernel for the appearance part with linear kernel on the
cat scores and a linear kernel on the dog scores. The
combination boosts the performance by an additional
7% over that of using appearance alone, yielding
approximately 95.37% accuracy, with all the variants of
the appearance model performing similarly
when the ground truth segmentations are used.</p>
        <p>2) Breed discrimination: This section evaluates the model
on the task of discriminating the different breeds of cats and
dogs given their family.This is done by learning a
multiclass SVM by using the !-Vs-rest decomposition (this mean
learning 12 binary classifiers for cats and 25 for dogs). The
relative performance of the different models is similar to
that observed for pet family classification. The best breed
classification accuracies for cats and dogs are 63.48% and
55.68% respectively, which improve to 66.07% and 59.18%
3) Family and breed discrimination: This section
investigates classifying both the family and the breed. Two
approaches are explored: hierarchical classification, in which the
family is decided first and then the breed is decided and flat
classification, in which a 37-class SVM is learned directly,
using the same method discussed. The relative performance
of the different models is similar to that observed. Flat
classification is better that hierarchical, but the latter requires less
work at test time, due to the fact that fewer SVM classifiers
need to be evaluated. Form example, using the appearance
model with the image, head, image-head layouts for 37 class
classification yields an accuracy of 51.23%, adding the shape
information hierarchically improves the accuracy to 52.78%,
and using shape and appearance together in flat classification
approach achieves an accuracy 54.03%.</p>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>IV. RESULTS</title>
      <p>We have been training our network for 7000 and 9000
steps and results as we can see on confusion matrices are
as following in figure 6 - figure 9. It is worth to mention that
all tests were made on pattern A deck.</p>
      <sec id="sec-3-1">
        <title>A. Conclusions</title>
        <p>As we can see, there are small but important differences,
which tell us that better results can be reached by increasing
teaching time or by reducing the variety of objects in dataset.</p>
        <p>In our future research we want to investigate other methods
of image processing for pattern recognition. We are interested
in other architectures of convolutional neural networks and
other python libraries developed for classification.</p>
      </sec>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>G. L.</given-names>
            <surname>Sciuto</surname>
          </string-name>
          , G. Capizzi,
          <string-name>
            <given-names>C.</given-names>
            <surname>Salvatore</surname>
          </string-name>
          , and
          <string-name>
            <given-names>R.</given-names>
            <surname>Shikler</surname>
          </string-name>
          , “
          <article-title>Geometric shape optimization of organic solar cells for efficiency enhancement by neural networks,” in Advances on Mechanics, Design Engineering</article-title>
          and Manufacturing. Springer,
          <year>2017</year>
          , pp.
          <fpage>789</fpage>
          -
          <lpage>796</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>G.</given-names>
            <surname>Capizzi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>G. L.</given-names>
            <surname>Sciuto</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Napoli</surname>
          </string-name>
          , and E. Tramontana, “
          <article-title>Advanced and adaptive dispatch for smart grids by means of predictive models</article-title>
          ,
          <source>” IEEE Transactions on Smart Grid</source>
          , vol.
          <volume>9</volume>
          , no.
          <issue>6</issue>
          , pp.
          <fpage>6684</fpage>
          -
          <lpage>6691</lpage>
          ,
          <year>2017</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>U. R.</given-names>
            <surname>Acharya</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H.</given-names>
            <surname>Fujita</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S. L.</given-names>
            <surname>Oh</surname>
          </string-name>
          ,
          <string-name>
            <given-names>U.</given-names>
            <surname>Raghavendra</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J. H.</given-names>
            <surname>Tan</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Adam</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Gertych</surname>
          </string-name>
          , and
          <string-name>
            <given-names>Y.</given-names>
            <surname>Hagiwara</surname>
          </string-name>
          , “
          <article-title>Automated identification of shockable and non-shockable life-threatening ventricular arrhythmias using convolutional neural network,” Future Generation Computer Systems</article-title>
          , vol.
          <volume>79</volume>
          , pp.
          <fpage>952</fpage>
          -
          <lpage>959</lpage>
          ,
          <year>2018</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>M.</given-names>
            <surname>Woz</surname>
          </string-name>
          <article-title>´niak and D. Połap, “Intelligent home systems for ubiquitous user support by using neural networks and rule based approach</article-title>
          ,
          <source>” IEEE Transactions on Industrial Informatics</source>
          ,
          <year>2019</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>M.</given-names>
            <surname>Woz</surname>
          </string-name>
          ´niak,
          <string-name>
            <given-names>D.</given-names>
            <surname>Połap</surname>
          </string-name>
          , L. Kos´mider, and T. Cłapa, “
          <article-title>Automated fluorescence microscopy image analysis of pseudomonas aeruginosa bacteria in alive and dead stadium</article-title>
          ,
          <source>” Engineering Applications of Artificial Intelligence</source>
          , vol.
          <volume>67</volume>
          , pp.
          <fpage>100</fpage>
          -
          <lpage>110</lpage>
          ,
          <year>2018</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>D.</given-names>
            <surname>Połap</surname>
          </string-name>
          , M. Woz´niak, R. Damasˇevicˇius, and R. Maskeliu¯nas, “
          <article-title>Bioinspired voice evaluation mechanism</article-title>
          ,” Applied Soft Computing, vol.
          <volume>80</volume>
          , pp.
          <fpage>342</fpage>
          -
          <lpage>357</lpage>
          ,
          <year>2019</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>J.</given-names>
            <surname>Gu</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Z.</given-names>
            <surname>Wang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Kuen</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Ma</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Shahroudy</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Shuai</surname>
          </string-name>
          ,
          <string-name>
            <given-names>T.</given-names>
            <surname>Liu</surname>
          </string-name>
          ,
          <string-name>
            <given-names>X.</given-names>
            <surname>Wang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>G.</given-names>
            <surname>Wang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Cai</surname>
          </string-name>
          et al.,
          <source>“Recent advances in convolutional neural networks,” Pattern Recognition</source>
          , vol.
          <volume>77</volume>
          , pp.
          <fpage>354</fpage>
          -
          <lpage>377</lpage>
          ,
          <year>2018</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>M.</given-names>
            <surname>Buda</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Maki</surname>
          </string-name>
          , and
          <string-name>
            <given-names>M. A.</given-names>
            <surname>Mazurowski</surname>
          </string-name>
          , “
          <article-title>A systematic study of the class imbalance problem in convolutional neural networks</article-title>
          ,
          <source>” Neural Networks</source>
          , vol.
          <volume>106</volume>
          , pp.
          <fpage>249</fpage>
          -
          <lpage>259</lpage>
          ,
          <year>2018</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>S. R.</given-names>
            <surname>Kheradpisheh</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Ganjtabesh</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S. J.</given-names>
            <surname>Thorpe</surname>
          </string-name>
          , and T. Masquelier, “
          <article-title>Stdp-based spiking deep convolutional neural networks for object recognition,” Neural Networks</article-title>
          , vol.
          <volume>99</volume>
          , pp.
          <fpage>56</fpage>
          -
          <lpage>67</lpage>
          ,
          <year>2018</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>