<!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>CNN-powered body and face detection for intelligent people counting in Covid-19 restricted places</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Michał Wieczorek</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Faculty of Applied Mathematics, Silesian University of Technology</institution>
          ,
          <addr-line>Kaszubska 23, 44-100 Gliwice</addr-line>
          ,
          <country country="PL">Poland</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>In the reality of 2021's Covid-19 pandemic there are a lot of government's restrictions made to reduce the virus spread speed in the society. One of the examples of such restrictions are the people per square meter limit in public places and shopping malls. Because manual counting of each person in such places is not possible due to limited time and money resources, this limit restriction is widely abused making the pandemic outbreak more dangerous. To face this problem author has presented a novel face and body detection model for the CCTV (Closed Circuit Television) monitoring systems, that automatically counts the amount of people in the monitored area by the use of Deep Learning.</p>
      </abstract>
      <kwd-group>
        <kwd>eol&gt;Convolutional Neural Network</kwd>
        <kwd>Detection</kwd>
        <kwd>Recognition</kwd>
        <kwd>Image processing</kwd>
        <kwd>Deep Learning</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <p>
        and Kim [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ] was proposed a model of neural network evaluating actions of body to recognize
the state in which human was. The model proposed in Winnicka, Kęsik, Połap, Woźniak, and
Marszałek [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ] was oriented on Convolutional Neural Networks working as a part of intelligent
home infrastructure, in which actions of humans were evaluated from images. In Barra, Barra,
Bisogni, De Marsico, and Nappi [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ] was proposed web-shaped model, where pose detection was
based on sampling comparisons. Important part of each training process is data augmentation.
From this part we can get better data for training. When initial images are not well fitted for
the model we can perform modification to improve the set. In Abayomi-Alli, Damaševičius,
Wieczorek, and Woźniak [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ] was proposed a model of based on principal resampling. The
images were analyzed and for the key features repetionions were proposed. In Woźniak and
Połap [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ] was proposed a composition of neural networks with soft sets. The model was giving
classes of detected objects from image, while comparisons and decisions were based on soft set
classifier. The model proposed in Bin, Chen, Wei, Chen, Gao, and Sang [
        <xref ref-type="bibr" rid="ref13">13</xref>
        ] was developed by
using Graph Convolutional Neural Networks. This complex structure was able to recognize
variants of human body structure.
      </p>
      <p>In this paper a model of a Lightweight Convolutional Neural Network is proposed. The model
is focused on fast detection of human upper-body and faces to roughly count the amount of
people in the desired area.</p>
    </sec>
    <sec id="sec-2">
      <title>2. Neural Network Architecture</title>
      <p>The final network model was developed with an intention to be as light-weight as possible,
maintaining the high accuracy. In order to achieve this the number of layers, as well as, the
synapse count was kept at a bare minimum. The final model can be seen in Fig. 1.</p>
      <p>As presented, the developed CNN (Convolutional Neural Network) contains 3 main
convolutional segments followed by max polling. In the first, and third segment the kernel size is set to
5x5. In the middle segment however the filter sizes are varying and are set to 7x7, 5x5 and 3x3
in order to extract as many features as possible. All convolutional layers are followed by the
ReLU (Rectified Linear Unit) activation function.</p>
      <p>The pooling layers were set to reduce the image by a factor of 2.</p>
    </sec>
    <sec id="sec-3">
      <title>3. System Model</title>
      <p>• body,
• no-body.</p>
      <p>And the second one:
• face,
• no-face.</p>
      <p>In presented detection model two neural networks were used for the final prediction. The first
one was detecting 2 abstract classes:
This approach, despite the fact of being slower, have the advantage over the classical one-network
models in terms of the final customization. Because these two main classes are separated we
can fine-tune the detection system after the training and set diferent detection thresholds for
bodies and faces which can lead to much more accurate people count predictions.</p>
    </sec>
    <sec id="sec-4">
      <title>4. Model’s performance</title>
      <p>Presented neural network model has achieved a high accuracy of over 99.94% for both the face
and the body detection. Final metrics are shown in Tab. 2 and the training plots can be found in
Fig. 2. The final confusion matrices are in Fig. 3 and Fig. 4.</p>
      <p>Used metrics are:
• Accuracy,
• Precision,
• Recall,
• F1,
• Specificity,
• FDR (False Discovery Rate),
• FPR (False Positive Rate),
• FNR (False Negative Rate),
• FOR (False Omission Rate),
• NPV (Negative Predictive Value).</p>
    </sec>
    <sec id="sec-5">
      <title>5. Results</title>
      <p>The results of the final system are shown in Fig. 6. In all examples the system was set with the
same, default parameters to present the accuracy "out of the box". Because of the dual-CNN
model there is a possibility to better fit the parameters to the specific camera and view making
the predictions even more accurate.</p>
      <p>In Fig. 5 there is one of the examples of the system in action. As we can see in most cases
the CNN correctly detects human silhouettes on the image and draws a bounding box around
them. In some cases, however, especially on the dark background the system has a problem to
correctly detect the body and the certainty is too low to recognize this batch as a human. In
some other regions of the image (especially on the left top) there are some inverted examples,
when batches of the image are falsely recognized as the body.</p>
      <p>This problems are mostly due to the fact that the model was made to be more general and to
work in most common scenarios. To improve the classification and to better fit the specific
camera, the fine-tuning of detection parameters, as well as, some post-training would be
necessary.
1–9</p>
      <p>
        Detection Model
This work
Hsu, Abdel-Mottaleb, and Jain [
        <xref ref-type="bibr" rid="ref14">14</xref>
        ]
Wu, Yin, Wang, and Xu [
        <xref ref-type="bibr" rid="ref15">15</xref>
        ]
Cuimei, Zhiliang, Nan, and Jianhua [
        <xref ref-type="bibr" rid="ref16">16</xref>
        ]
Chi, Zhang, Xing, Lei, Li, and Zou [
        <xref ref-type="bibr" rid="ref17">17</xref>
        ]
Zhang, Chi, Lei, and Li [
        <xref ref-type="bibr" rid="ref18">18</xref>
        ]
Rowley, Baluja, and Kanade [
        <xref ref-type="bibr" rid="ref19">19</xref>
        ]
      </p>
    </sec>
    <sec id="sec-6">
      <title>6. Discussion</title>
      <p>Because of the global Covid-19 pandemic many governments prepared restrictions to the amount
of people per square meter in public places such as shops and shopping malls. This approach,
except of allowing shops to be run at all, created a huge logistical problem of counting the
amount of people inside the desired area. To follow this restrictions every shop owner had
to create some way of dealing with this problem. In smaller, regional shops the problem is
almost non visible due to the fact that there are only allowed 2-3 people for entire building
and the shop owner can easily count the people manually. In bigger shops however, where
limits are much bigger, the problem starts to occur because the shop personnel has to serve the
clients and have no time and possibility to count every new guest. Some owners deal with it by
hiring additional personnel just for this purpose, however it is very expensive and especially in
times of global pandemic, when the income is much smaller, this method is far from optimal.
Even worse situation is in much bigger places such as shopping malls and other big, public
places. Because there are many entrances and exits the manual counting even with additional
personnel would be near impossible from the financial and logistical point of view, so in most
places government restrictions are violated.</p>
      <p>Presented system was made to address these problems with a minimal financial footprint,
allowing shop owners to eficiently control the number of people in the monitored area and
because of that respect the oficial restrictions and actively fight with the pandemic outbreak.</p>
    </sec>
    <sec id="sec-7">
      <title>7. Conclusion</title>
      <p>As we can see presented Lightweight-CNN solution allows the user to quickly count people
located in a store, in a shopping mall or in any open public space with small resource, money
and power consumption. Because of the high efectiveness of face and body detection the
presented system counts the amount of people with high accuracy and due to the light-weighted
architecture it does it in real-time even on high resolution cameras. What’s more the small
architecture allows the system to run even on smaller and less powerful devices such as laptops
or, for example, Raspberry Pie. Because of that it reduces the need of more expensive and much
more power hungry PCs making it more environment friendly.</p>
    </sec>
    <sec id="sec-8">
      <title>Acknowledgments</title>
      <p>Author would like to acknowledge contribution to this research from the Rector of the Silesian
University of Technology, Gliwice, Poland, under program “Initiative of Excellence—Research
University” grant no. 08/IDUB/2019/84.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>S.</given-names>
            <surname>Li</surname>
          </string-name>
          ,
          <article-title>Global face pose detection based on an improved pso-svm method</article-title>
          ,
          <source>in: Proceedings of the 2020 International Conference on Aviation Safety and Information Technology</source>
          ,
          <year>2020</year>
          , pp.
          <fpage>549</fpage>
          -
          <lpage>553</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>C.</given-names>
            <surname>Chen</surname>
          </string-name>
          ,
          <string-name>
            <given-names>T.</given-names>
            <surname>Wang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Li</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Hong</surname>
          </string-name>
          ,
          <article-title>Repetitive assembly action recognition based on object detection and pose estimation</article-title>
          ,
          <source>Journal of Manufacturing Systems</source>
          <volume>55</volume>
          (
          <year>2020</year>
          )
          <fpage>325</fpage>
          -
          <lpage>333</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>W.</given-names>
            <surname>Wang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>X.</given-names>
            <surname>Chen</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Zheng</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H.</given-names>
            <surname>Li</surname>
          </string-name>
          ,
          <article-title>Fast head pose estimation via rotation-adaptive facial landmark detection for video edge computation</article-title>
          ,
          <source>IEEE Access 8</source>
          (
          <year>2020</year>
          )
          <fpage>45023</fpage>
          -
          <lpage>45032</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>Y.</given-names>
            <surname>Zhao</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Z.</given-names>
            <surname>Luo</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Quan</surname>
          </string-name>
          , D. Liu, G. Wang,
          <article-title>Cluster-wise learning network for multi-person pose estimation</article-title>
          ,
          <source>Pattern Recognition</source>
          <volume>98</volume>
          (
          <year>2020</year>
          )
          <fpage>107074</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>M.</given-names>
            <surname>Woźniak</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Wieczorek</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Siłka</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Połap</surname>
          </string-name>
          ,
          <article-title>Body pose prediction based on motion sensor data and recurrent neural network</article-title>
          ,
          <source>IEEE Transactions on Industrial Informatics</source>
          <volume>17</volume>
          (
          <year>2020</year>
          )
          <fpage>2101</fpage>
          -
          <lpage>2111</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>K.</given-names>
            <surname>Yun</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Park</surname>
          </string-name>
          , J. Cho,
          <article-title>Robust human pose estimation for rotation via self-supervised learning</article-title>
          ,
          <source>IEEE Access 8</source>
          (
          <year>2020</year>
          )
          <fpage>32502</fpage>
          -
          <lpage>32517</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>B.</given-names>
            <surname>Huang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Chen</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Q.</given-names>
            <surname>Zhou</surname>
          </string-name>
          , W. Xu,
          <article-title>Eye landmarks detection via weakly supervised learning</article-title>
          ,
          <source>Pattern Recognition</source>
          <volume>98</volume>
          (
          <year>2020</year>
          )
          <fpage>107076</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>A.</given-names>
            <surname>Nadeem</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Jalal</surname>
          </string-name>
          ,
          <string-name>
            <given-names>K.</given-names>
            <surname>Kim</surname>
          </string-name>
          ,
          <article-title>Human actions tracking and recognition based on body parts detection via artificial neural network</article-title>
          ,
          <source>in: 2020 3rd International Conference on Advancements in Computational Sciences (ICACS)</source>
          , IEEE,
          <year>2020</year>
          , pp.
          <fpage>1</fpage>
          -
          <lpage>6</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>A.</given-names>
            <surname>Winnicka</surname>
          </string-name>
          ,
          <string-name>
            <given-names>K.</given-names>
            <surname>Kęsik</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Połap</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Woźniak</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Z.</given-names>
            <surname>Marszałek</surname>
          </string-name>
          ,
          <article-title>A multi-agent gamification system for managing smart homes</article-title>
          ,
          <source>Sensors</source>
          <volume>19</volume>
          (
          <year>2019</year>
          )
          <fpage>1249</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <given-names>P.</given-names>
            <surname>Barra</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Barra</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Bisogni</surname>
          </string-name>
          ,
          <string-name>
            <surname>M. De Marsico</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          <string-name>
            <surname>Nappi</surname>
          </string-name>
          ,
          <article-title>Web-shaped model for head pose estimation: An approach for best exemplar selection</article-title>
          ,
          <source>IEEE Transactions on Image Processing</source>
          <volume>29</volume>
          (
          <year>2020</year>
          )
          <fpage>5457</fpage>
          -
          <lpage>5468</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [11]
          <string-name>
            <given-names>O. O.</given-names>
            <surname>Abayomi-Alli</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Damaševičius</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Wieczorek</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Woźniak</surname>
          </string-name>
          ,
          <article-title>Data augmentation using principal component resampling for image recognition by deep learning</article-title>
          ,
          <source>in: International Conference on Artificial Intelligence and Soft Computing</source>
          , Springer,
          <year>2020</year>
          , pp.
          <fpage>39</fpage>
          -
          <lpage>48</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          [12]
          <string-name>
            <given-names>M.</given-names>
            <surname>Woźniak</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Połap</surname>
          </string-name>
          ,
          <article-title>Soft trees with neural components as image-processing technique for archeological excavations</article-title>
          ,
          <source>Personal and Ubiquitous Computing</source>
          <volume>24</volume>
          (
          <year>2020</year>
          )
          <fpage>363</fpage>
          -
          <lpage>375</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          [13]
          <string-name>
            <given-names>Y.</given-names>
            <surname>Bin</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Z.-M.</given-names>
            <surname>Chen</surname>
          </string-name>
          ,
          <string-name>
            <given-names>X.-S.</given-names>
            <surname>Wei</surname>
          </string-name>
          ,
          <string-name>
            <given-names>X.</given-names>
            <surname>Chen</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Gao</surname>
          </string-name>
          ,
          <string-name>
            <given-names>N.</given-names>
            <surname>Sang</surname>
          </string-name>
          ,
          <article-title>Structure-aware human pose estimation with graph convolutional networks</article-title>
          ,
          <source>Pattern Recognition</source>
          <volume>106</volume>
          (
          <year>2020</year>
          )
          <fpage>107410</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          [14]
          <string-name>
            <surname>R.-L. Hsu</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          <string-name>
            <surname>Abdel-Mottaleb</surname>
            ,
            <given-names>A. K.</given-names>
          </string-name>
          <string-name>
            <surname>Jain</surname>
          </string-name>
          ,
          <article-title>Face detection in color images</article-title>
          ,
          <source>IEEE transactions on pattern analysis and machine intelligence</source>
          <volume>24</volume>
          (
          <year>2002</year>
          )
          <fpage>696</fpage>
          -
          <lpage>706</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          [15]
          <string-name>
            <given-names>W.</given-names>
            <surname>Wu</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Y.</given-names>
            <surname>Yin</surname>
          </string-name>
          ,
          <string-name>
            <given-names>X.</given-names>
            <surname>Wang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Xu</surname>
          </string-name>
          ,
          <article-title>Face detection with diferent scales based on faster r-cnn</article-title>
          ,
          <source>IEEE Transactions on Cybernetics</source>
          <volume>49</volume>
          (
          <year>2019</year>
          )
          <fpage>4017</fpage>
          -
          <lpage>4028</lpage>
          . doi:
          <volume>10</volume>
          .1109/TCYB.
          <year>2018</year>
          .
          <volume>2859482</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref16">
        <mixed-citation>
          [16]
          <string-name>
            <given-names>L.</given-names>
            <surname>Cuimei</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Q.</given-names>
            <surname>Zhiliang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Nan</surname>
          </string-name>
          , W. Jianhua,
          <article-title>Human face detection algorithm via haar cascade classifier combined with three additional classifiers</article-title>
          ,
          <source>in: 2017 13th IEEE International Conference on Electronic Measurement &amp; Instruments (ICEMI)</source>
          , IEEE,
          <year>2017</year>
          , pp.
          <fpage>483</fpage>
          -
          <lpage>487</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref17">
        <mixed-citation>
          [17]
          <string-name>
            <given-names>C.</given-names>
            <surname>Chi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Zhang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Xing</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Z.</given-names>
            <surname>Lei</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S. Z.</given-names>
            <surname>Li</surname>
          </string-name>
          ,
          <string-name>
            <given-names>X.</given-names>
            <surname>Zou</surname>
          </string-name>
          ,
          <article-title>Selective refinement network for high performance face detection</article-title>
          ,
          <source>in: Proceedings of the AAAI Conference on Artificial Intelligence</source>
          , volume
          <volume>33</volume>
          ,
          <year>2019</year>
          , pp.
          <fpage>8231</fpage>
          -
          <lpage>8238</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref18">
        <mixed-citation>
          [18]
          <string-name>
            <given-names>S.</given-names>
            <surname>Zhang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Chi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Z.</given-names>
            <surname>Lei</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S. Z.</given-names>
            <surname>Li</surname>
          </string-name>
          ,
          <article-title>Refineface: Refinement neural network for high performance face detection</article-title>
          ,
          <source>IEEE Transactions on Pattern Analysis and Machine Intelligence</source>
          (
          <year>2020</year>
          )
          <fpage>1</fpage>
          -
          <lpage>1</lpage>
          . doi:
          <volume>10</volume>
          .1109/TPAMI.
          <year>2020</year>
          .
          <volume>2997456</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref19">
        <mixed-citation>
          [19]
          <string-name>
            <given-names>H. A.</given-names>
            <surname>Rowley</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Baluja</surname>
          </string-name>
          , T. Kanade,
          <article-title>Neural network-based face detection</article-title>
          ,
          <source>IEEE Transactions on pattern analysis and machine intelligence</source>
          <volume>20</volume>
          (
          <year>1998</year>
          )
          <fpage>23</fpage>
          -
          <lpage>38</lpage>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>