Submission Template for IET Research Journal Papers

# Crowd counting with segmentation attention convolutional neural network

Jiwei Chen1,2 Zengfu Wang ${}^{1,2\corr}$<EMAIL_ADDRESS>1Institute of
Intelligent Machines, Chinese Academy of Sciences, Hefei, Anhui, People’s
Republic of China 2Department of Automation, University of Science and
Technology of China, Hefei, Anhui, People’s Republic of China

###### Abstract

Deep learning occupies an undisputed dominance in crowd counting. In this
paper, we propose a novel convolutional neural network (CNN) architecture
called SegCrowdNet. Despite the complex background in crowd scenes, the
proposed SegCrowdNet still adaptively highlights the human head region and
suppresses the non-head region by segmentation. With the guidance of an
attention mechanism, the proposed SegCrowdNet pays more attention to the human
head region and automatically encodes the highly refined density map. The
crowd count can be obtained by integrating the density map. To adapt the
variation of crowd counts, SegCrowdNet intelligently classifies the crowd
count of each image into several groups. In addition, the multi-scale features
are learned and extracted in the proposed SegCrowdNet to overcome the scale
variations of the crowd. To verify the effectiveness of our proposed method,
extensive experiments are conducted on four challenging datasets. The results
demonstrate that our proposed SegCrowdNet achieves excellent performance
compared with the state-of-the-art methods.

##  1 Introduction

Recently, crowd counting has become a research hotspot owing to its wide
applications including public safety management gao2017crowd , crowd analysis
ma2018scene , and urban planning zhan2008crowd . Besides, the methods of crowd
counting have important references in vehicle counting, cell counting, and
other objects counting marsde2018people . However, due to the crowd’s
complexity such as severe occlusion, high diversity, scale variation, view-
point variation, and non-uniform distribution, the accuracy of crowd counting
still has significant room for improvement.

Lots of efforts have been done in crowd counting. We generally classify these
methods into detection-based methods and regression-based methods. The
detection-based methods dalal2005histograms ; pham2015count ; viola2004robust
; benenson2014ten  obtain the crowd count by counting the number of positive
detections. The regression-based methods chan2009bayesian ;
lempitsky2010learning ; idrees2013multi ; pham2015count  utilize the mapping
between extracted features and cropped patches to regress the crowd count.
However, the aforementioned methods are complex, because their features need
to be extracted by extremely numerous and cumbersome designs. In recent years,
deep learning has obtained breakthroughs in many fields walach2016learning ;
long2015fully ; ren2015faster . Many CNN-based methods zhang2016single ;
sam2017switching ; sindagi2017generating  have been proposed in crowd
counting. They learn the non-linear mapping between training images and crowd
counts. Researchers employ these CNN models to generate a density map that
records the count and spatial information of the crowd at each pixel location,
then the density map is integrated to get the crowd count.

Figure 1: Two challenges for crowd counting. (1) Only the human head
(highlight area) belongs to the foreground. The background is extremely
complex. (2) The crowd count in each image varies greatly. GT represents the
crowd count of the image.

Although deep learning has achieved great improvement in crowd counting, we
find that the background is extremely complex in the crowd scene, and we
believe that the accuracy of crowd counting can be further improved with the
segmentation attention mechanism which highlights the foreground, suppresses
the background and makes the proposed SegCrowdNet pay more attention to the
foreground. Some example images are shown in Fig. 1. Let’s carefully
distinguish the foreground and background in crowd counting. We obtain the
crowd counting result by counting the number of the human head. The human head
belongs to the foreground. Everything apart from the human head belongs to the
background. Therefore, the background is extremely complicated. In Fig. 1, we
can also observe that the crowd count changes dramatically across images,
which is the second challenging problem. To address these two challenging
problems, firstly, we predict a segmentation map to adaptively highlight the
human head region and suppress the non-head region. With the guidance of the
segmentation results, the adaptive attention weights are used in the
estimation of the density map to guide our network called SegCrowdNet to pay
more attention to the human head region and generate a highly refined density
map. Integrating the refined density map can get the crowd counting result.
Unfortunately, the present datasets don’t provide the ground truth of
segmentation. We propose a simple but effective method in which the ones
template is pasted on a binary map to encode the ground truth of segmentation.
Secondly, to adapt the large variation of crowd counts, we utilized a
classification task where the crowd count of each image is classified
automatically. Meanwhile, to extract the multi-scale features to adapt the
multi-scale crowd, our proposed SegCrowdNet not only utilizes different
convolution kernels to encode the image but also fuses rich hierarchies from
different depths of convolutional layers where the lower layer can extract
discriminative features of the pedestrian and the higher layer can learn
semantic concepts of the same pedestrian.

In this paper, we propose a novel end-to-end framework called SegCrowdNet. To
the best of our knowledge, the proposed SegCrowdNet is the first network to
utilize the segmentation attention mechanism in crowd counting. It adaptively
highlights the human head region and suppresses the non-head region by way of
optimizing a novel loss. With the guidance of the segmentation attention
mechanism, the proposed SegCrowdNet pays more attention to the human head
region and automatically encodes the highly refined density map. Our proposed
SegCrowdNet can also automatically adapt the variation of crowd counts by
learning a classification function. Extensive experiments are conducted on
ShanghaiTech Part_A dataset zhang2016single , ShanghaiTech Part_B dataset
zhang2016single , UCF_CC_50 dataset idrees2013multi  and WorldExpo’10 dataset
zhang2015cross . The results demonstrate that our proposed method outperforms
many state-of-the-art methods.

Figure 2: The proposed architecture of our SegCrowdNet. It is a multi-task
model including the classification task (Cla-task), segmentation task (Seg-
task), and density estimation task (Des-task). The convolutional layers’
parameters are represented as “Con(kernel size)-(number of filters)- (dilation
rate)”. $\bigoplus$ represents the element-wise add. The estimated density map
(outlined in blue) is encoded in the intermediate supervision process. Figure
3: The proposed architecture of the backbone. The convolutional layers’
parameters are represented as “Conv(kernel size)-(number of filters)-
(dilation rate)”. The kernel size of the max pool is $2\times 2$ with stride
2.

##  2 Related work

The researches sindagi2018survey ; li2015crowded ; Xu2019 ; Sajid2017Crowd ;
Mahmood2017 ; SivaScene  about crowd counting are too rich to elaborate all of
them. Next, we briefly review some of them.

###  2.1 Counting by detection

In early researches, many kinds of detection frameworks are proposed in crowd
counting. The pivotal features from human body are extracted by the well-
trained classifiers such as HOG dalal2005histograms , Random Forest
pham2015count , and Haar wavelets viola2004robust , then the classifier
outputs the positive samples. The total number of positive samples represents
the crowd count. li2008estimating ; zeng2010robust ; lin2010shape  complete
the crowd counting task by using the aforementioned method. And Sajid2017Crowd
leverages adaptive thresholds to binarize the image to detect the crowd. They
can get a good result in the sparse crowd scene. However, when the crowd
density becomes high, some persons are too small to be detected.

###  2.2 Counting by regression

In the highly congested crowd scene, the regression-based methods are usually
chosen. They have two important stages. The low-level features are first
extracted from the input image, then the crowd count is regressed according to
the low-level features. To record the space information of the crowd,
Lempitsky et al. lempitsky2010learning  proposed a good method that could
learn a linear mapping between local area features and corresponding density
maps. Based on Lempitsky’s work, Pham et al. pham2015count  proposed a more
applicable method. The linear mapping was replaced with a non-linear mapping
based on random forest regression. In SivaScene , SVM is proposed to map the
features extracted by AdaBoost Freund1999A  to the crowd counting result.

###  2.3 Counting by CNN

In recent years, CNN has achieved great success in the computer vision task
including crowd counting. Boominathan et al. boominathan2016crowdnet  combined
the deep and shallow CNN to extract large scale features to overcome the scale
variation. Zhang et al. zhang2016single  proposed a three-branch convolutional
neural network to encode the density map with different scales. Based on
Zhang’s work, Sam et al. sam2017switching  designed a classifier to select the
most appropriate branch to generate the density map according to the density
variation in each image. Similarly, Hossain et al. hossain2019crowd  proposed
a scale-aware method to make each branch in their model focus on a particular
scale. Mahmood et al. Mahmood2017  designed an Encoder-Decoder CNN to learn
the head heatmap where human heads can be segmented. Shen et al. shen2018crowd
introduced the scale-consistency model to alleviate the blurry effects in the
estimated density map. Sam et al. sam2018top  designed the TDF-CNN which
contains the bottom-up and top-down CNNs to obtain initial accurate
predictions. Marsden et al. marsde2018people  proposed a CNN model that can
count the crowd, wildlife, vehicles, and cells. Wang et al. Wang_2019_CVPR
designed a collector and labeler to generate the crowd data with corresponding
labels to reduce the overfitting caused by limited training crowd data. Xu et
al. Xu2019  proposed a segmentation branch based on the probability to guide
their framework to encode the final density map. In this paper, we propose a
novel segmentation attention mechanism to guide the end-to-end architecture
called SegCrowdNet to pay more attention to the human head region. Our
segmentation is based on the dice coefficient and we employ the CNN and
ground-truth density map to finetune the final density map. Moreover, our
proposed SegCrowdNet can adapt the variation of crowd counts by a
classification task.

##  3 Methodology

###  3.1 SegCrowdNet Architecture

An overview of the proposed SegCrowdNet can be seen in Fig. 2. The backbone is
designed to extract multi-scale features. The proposed SegCrowdNet contains
the classification task, the segmentation task, and the density estimation
task.

The configurations of the backbone are shown in Fig. 3. To extract multi-scale
features to overcome the scale variations of the crowd, firstly, four
different receptive fields are inserted into our system at the beginning of
this backbone. Each of them has 16 filters. The input image is mapped at
different scales by them synchronously, then the results are fed to the
following modules. Secondly, inside this module, we design several 2x2 max-
pooling layers to extract multi-scale features. Thirdly, we fuse the feature
maps with complementary information from different depths of convolutional
layers. Every convolutional layer is followed by ReLU. In order to increase
the depth of the network to enhance its learning ability without introducing
too many parameters, the parameters of the shared module are shared to
alleviate overfitting caused by excessive parameters. Since the dilated
convolution yu2015multi  can increase the receptive field with fewer
parameters, the dilated convolution is widely used in our SegCrowdNet.

In Table 1, it can be observed that the crowd count changes greatly across
images in the ’Range’ column. For example, the UCF_CC_50 dataset only contains
50 images. However, the crowd counts range from 94 to 4,543. So the
classification task is employed. The classifier can automatically learn the
crowd count distribution to adapt the variation of crowd counts. Inspired by
sindagi2017cnn , the crowd count of each image in the crowd dataset is
quantized into several groups. As shown in Fig 2, the fully connected (FC)
layers are connected at the end of the backbone. The two fully connected
layers followed by PReLU separately have 64 neurons and 5 neurons. The 5
neurons represent five count groups. To avoid the distortion of images and
maintain the original distribution of the crowd, we do not resize the input
image. The Spatial Pyramid Pooling (SPP) he2015spatial  layers are placed
between convolutional layers and FC layers. Arbitrarily sized feature map
extracted from the input image can be fed to the SPP layer, and the SPP layer
produces fixed size outputs to feed the FC layers. In the classification task,
the crowd counts of each dataset are classified into five count groups to
adapt the variation of crowd counts. We choose to minimize the cross-entropy
loss to optimize this process.

Two other tasks are also shown in Fig. 2. In the segmentation task, the
segmentation map which adaptively emphasizes the head region and suppresses
the non-head region is encoded with the supervision of ground-truth
segmentation. In the density estimation task, the estimated density map
(outlined in blue) and the final estimated density map are predicted with the
supervision of ground-truth density map. Integrating the final estimated
density map can get the crowd count. As shown in Fig 2, we add the
segmentation map to the estimated density map (outlined in blue) and the
results are fed to the following convolution layers and ReLU layers to
automatically encode the final estimated density map. With the guidance of the
segmentation map where the human head regions have higher weights, more
attention is paid to the human head region in the density estimation task. In
the segmentation task, a novel loss based on the dice coefficient is employed.
The novel loss and the ground truth of segmentation will be elaborated in Sec
3.2. In the density estimation task, the Euclidean distance loss is employed
to optimize the estimated density map and the final estimated density map.

###  3.2 Model Learning

Ground truth generation: The ground-truth density map is extremely important
for the supervised methods. For any training image, the 2D point $p$ located
at the center of each human head is provided. The ground-truth density map is
encoded by employing a normalized Gaussian kernel centered on each point $p$,
which is defined as:

$D(c)=\sum_{p\in A_{j}}N(p;\mu,\sigma),$ (1)

where $c$ represents the pixel location. $A_{j}$ represents a series of 2D
points annotated in the image $j$. $N(p;\mu,\sigma)$ represents the normalized
Gaussian kernel with mean $\mu=0$ and isotropic variance $\sigma=4$. The
window size of the Gaussian kernel is 15$\times$15\. We utilize the above
simple method to generate the ground-truth density map to ensure that the
improvement of the result comes from our novel method instead of the
innovation of generating a ground-truth density map.

It is extremely expensive to manually label the ground truth of segmentation,
owing to the huge amount of people in datasets. For example, there are 330,165
people in the ShanghaiTech dataset. So a simple but effective method is
proposed to encode the ground-truth segmentation map which should have the
same foreground and background with the ground-truth density map. First, we
construct the ones template that keeps the same size with the Gaussian kernel,
which is set to 15$\times$15\. Second, the ground truth of segmentation is
encoded by pasting the ones template that is centered on each annotated point
$p$ on a binary map. They are visualized in Fig. 4. The experiments using
different scale templates are conducted on the challenging ShanghaiTech
Part_A. Results are given in Table 2. It can be found that performance with
15$\times$15 is the best. We use the same scale template (15$\times$15) on all
four datasets to show the robustness of our proposed method.

Table 1: Statistics of the training datasets: Num represents the number of images; Range represents the range of crowd count in each image; Average represents the average crowd count; Total represents the total number of labeled people. Dataset | Resolution | Color | Num | Range | Average | Total
---|---|---|---|---|---|---
ShanghaiTech Part_A | different | RGB,Grey | 482 | [33, 3139] | 501.4 | 241,677
ShanghaiTech Part_B | 768 x 1024 | RGB | 716 | [9, 578] | 123.6 | 88,488
UCF_CC_50 | different | Grey | 50 | [94, 4543] | 1279.5 | 63,974
WorldExpo’10 | 576 x 720 | RGB | 3980 | [1, 253] | 50.2 | 199,923
Figure 4: Some visualized results of ground-truth density map and ground-truth
segmentation.

Model Optimization: The proposed SegCrowdNet is a multi-task model including
classification task, segmentation task, and density estimation task. The
multi-task learning collobert2008unified  can serve as a regularization to
alleviate overfitting, which requires our proposed SegCrowdNet to consider
every task synchronously, not only one of them. The proposed SegCrowdNet is
optimized by minimizing four loss functions in a synergistic manner, including
an intermediate supervision loss. In the density estimation task, the
Euclidean loss is utilized to optimize the estimated density map (outlined in
blue) and the final estimated density map,

$L_{int}=\frac{1}{2U}\sum_{i=1}^{U}\left\|\hat{d}_{i}-D_{i}\right\|^{2}_{2},$
(2)

$L_{den}=\frac{1}{2U}\sum_{i=1}^{U}\left\|\hat{D}_{i}-D_{i}\right\|^{2}_{2},$
(3)

where $\hat{d}_{i}$ represents the estimated density in the intermediate
supervision process. $\hat{D}_{i}$ represents the final estimated density.
$D_{i}$ represents the ground-truth density. $U$ represents the number of
pixels in the ground-truth density map.

Table 2: Estimation errors of the template with different sizes on
ShanghaiTech
Part_A. Template size | MAE | MSE
---|---|---
5$\times$5 | 110.1 | 160.7
10$\times$10 | 101.3 | 139.0
15$\times$15 | 68.3 | 104.1
20$\times$20 | 74.8 | 114.5
25$\times$25 | 68.5 | 106.7

In the segmentation task, inspired by milletari2016v ; zettinig2015multimodal
, we introduce a novel loss in crowd counting which is based on the dice
coefficient. The loss is optimized to predict the segmentation map for the
human head. The dice coefficient $D(\hat{s_{i}},s_{i})$ is between 0 and 1. In
the process of optimization, $D(\hat{s_{i}},s_{i})$ is expected to maximize,
and the loss $L_{seg}$ is expected to minimize. They are formulated as;

$D(\hat{s_{i}},s_{i})=\frac{2\sum_{i}^{U}\hat{s_{i}}s_{i}}{\sum_{i}^{U}\hat{s_{i}}^{2}+\sum_{i}^{U}s_{i}^{2}},$
(4) $L_{seg}=1-D(\hat{s_{i}},s_{i}),$ (5)

where U represents the total number of pixels in the ground truth segmentation
map. $s_{i}$ represents the $i^{th}$ value in the ground truth segmentation
map. $\hat{s_{i}}$ represents the $i^{th}$ value in the predicted segmentation
map.

In the classification task, the crowd counts are quantized into five groups.
For example, if the crowd counts of a dataset range from 1 to 500 and they are
quantized into five classes, the images with populations between 1 and 100
belong to the first class, and the images with populations between 401 and 500
belong to the fifth class. The cross-entropy loss function is utilized,

$L_{cla}=-\frac{1}{M}\sum^{M}_{a=1}\sum^{K}_{b=1}\left[\left(y^{a}_{b}\right)log(\hat{y}^{a})\right],$
(6)

where $M$ represents the total number of training samples. $K$ represents the
total number of classes. $y^{a}_{b}$ represents the ground-truth class.
$\hat{y}^{a}$ represents the output of classification. The final weighted loss
is given by equation (7). Empirically, we set $\lambda_{1}$ as 0.01.

$L_{fin}=L_{den}+L_{int}+L_{seg}+\lambda_{1}L_{cla},$ (7)

Figure 5: The crowd count comparisons of different configurations about the
Seg-task on ShanghaiTech Part_A. X-axis: the ID of images, Y-axis: the crowd
counts of images. Figure 6: Some example frames from training datasets.

##  4 Experiments

###  4.1 Experiment setting

We conduct extensive experiments on four challenging datasets. The statistics
of the four challenging datasets are summarized in Table 1. Some example
frames from these four datasets are shown in Fig. 6. In the process of
creating training data, 9 patches are cropped from each original image
randomly, and the size of each patch is 1/4 of the original image. Horizontal
flipping and noise addition are also used in the training data. We utilize
Adam optimization with a fixed constant momentum of 0.9 to train our model.
And we set the learning rate as 1e-6.

Table 3: Estimation errors of different configurations about the Cla-task
on ShanghaiTech Part_A. Method | MAE | MSE
---|---|---
Without Cla-task | 80.7 | 124.0
With Cla-task | 68.3 | 104.1
Table 4: Estimation errors of different categories about the crowd counts
on ShanghaiTech Part_A. categories | 3 | 5 | 7 | 10 | 15
---|---|---|---|---|---
MAE | 71.3 | 68.3 | 77.8 | 78.4 | 70.4
Table 5: Estimation errors of different configurations about the Seg-task
on ShanghaiTech Part_A. Method | MAE | MSE
---|---|---
Without Seg-task | 85.8 | 128.6
With Seg-task | 68.3 | 104.1

###  4.2 Evaluation Metric

The mean absolute error (MAE) and the mean squared error (MSE) are widely used
to measure the crowd counting error on different methods zhang2016single ;
sam2017switching ; sam2018top ; Wang_2019_CVPR . They are defined as follows:

$MAE=\frac{1}{V}\sum_{i=1}^{V}\left|z_{i}-\hat{z_{i}}\right|,$ (8)

$MSE=\sqrt{\frac{1}{V}\sum^{V}_{i=1}\left(z_{i}-\hat{z_{i}}\right)^{2}}.$ (9)

Where $z_{i}$ represents the ground-truth crowd count. $\hat{z_{i}}$
represents the estimated crowd count. $V$ represents the number of test
images,

###  4.3 Ablation study using ShanghaiTech Part_A

To verify the effectiveness of each task in the proposed SegCrowdNet, we
perform ablation studies on ShanghaiTech Part_A zhang2016single  which is a
large scale and high-density dataset, the dataset contains 482 images with
241,667 annotated persons. In other datasets, similar results can be observed.

To investigate the ability of this classification task where the crowd count
of each image is classified, we conduct a set of comparative experiments. In
one experiment, the classification task can function normally. In the second
experiment, the classification task is removed. The estimation errors are
given in Table 3. We can observe that the performance with Cla-task is better,
with MAE/MSE 12.4/19.9 lower than that without Cla-task. We think that the
proposed SegCrowdNet can learn the crowd count distribution to adapt the
variation of crowd counts, which contributes to reducing the crowd counting
errors. In the proposed SegCrowdNet, we classify the crowd counts of images in
each dataset into five categories according to extensive experiments. From
Table 4, we find that our proposed SegCrowdNet with five categories perform
best. We think that the crowd counting data are limited and five categories
are most suitable. Last but not least, we can further observe that adopting
the classification task with different categories in Table 4, the MAE is
further alleviated compared with the performance without Cla-task in Table 3,
which further indicates that the Cla-task can assist in reducing the
estimation error of crowd counting.

Figure 7: Several visualization results of the ShanghaiTech Part_A. Top
Column: Some input images from the ShanghaiTech Part_A dataset. Second Column:
The ground-truth segmentation. Third Column: The predicted segmentation map.
Fourth Column: The ground-truth density map. Fifth Column: The final estimated
density map. GT: The crowd count of the ground-truth density map. Est: The
crowd count of the estimated density map.

The proposed segmentation attention mechanism is the most important idea in
this paper. It is included in the segmentation task. To demonstrate the
effectiveness of the segmentation task, we also conduct a set of comparative
experiments. In one experiment, the segmentation task can function normally.
In the second experiment, the segmentation task is removed from our proposed
SegCrowdNet and the segmentation attention mechanism is subsequently removed.
The qualitative results are illustrated in Table 5. We can observe that the
SegCrowdNet greatly reduces the error of crowd counting with the guidance of
segmentation results, with MAE/MSE 17.5/24.5 lower than that without Seg-task,
which reveals the power of the segmentation attention mechanism. In Fig. 5, we
demonstrate the estimated crowd count of each image in the comparative
experiment. It can be observed that the blue circle (predicted crowd counts
with the guidance of the Seg-task) is closer to the red triangle (actual crowd
counts) than the green pentagram (predicted crowd counts without Seg-task) in
most images, which indicates that the segmentation attention mechanism plays a
vital role in alleviating the errors of crowd counting.

We visualize the effectiveness of the Seg-task in Fig. 7. In the third column,
it can be observed that the human head regions are highlighted and the non-
head regions are suppressed excellently in the estimated segmentation map,
which is important to guide our proposed SegCrowdNet to focus on the human
head region. In the fourth and fifth columns, we can observe that with the
guidance of the segmentation results, the proposed SegCrowdNet pays more
attention to the human head region and the crowd counts are predicted
beautifully. Similar results can be found in Fig. 8. From these results, we
can see that every task in the proposed SegCrowdNet is necessary. They work
collaboratively to better accomplish the task of crowd counting.

Figure 8: Several visualization results of the ShanghaiTech Part_B. Top
Column: Some input images from the ShanghaiTech Part_B dataset. Second Column:
The ground-truth segmentation. Third Column: The predicted segmentation map.
Fourth Column: The ground-truth density map. Fifth Column: The final estimated
density map. GT: The crowd count of the ground-truth density map. Est: The
crowd count of the estimated density map.

###  4.4 ShanghaiTech dataset

The ShanghaiTech dataset zhang2016single  is highly challenging because of its
large-scale crowds. It contains 1,198 annotated images with a total number of
330,165 persons. So far the dataset contains the richest annotated crowd
information and it is composed of two parts: Part_A with 300 training images
and 182 test images, Part_B with 400 training images and 316 test images.
Part_A consists of the high-density crowd images downloaded from the internet.
Part_B consists of the relatively low-density crowd images collected from
Shanghai streets.

As shown in Table 6, we compare our proposed method with the other fourteen
state-of-the-art methods. In the LBP+RR method, the LBP features were
extracted by hand to regress the crowd count. Owing to the scale variation in
the crowd, the work of MCNN zhang2016single , CAFN fan2018cafn , TDF-CNN
sam2018top , Switch-CNN sam2017switching , and CP-CNN sindagi2017generating
employed multi-column CNNs to extract the multi-scale features to cope with
the scale variation in the crowd. Instead of using the multi-column CNN, in
hossain2019crowd , Hossain et al. proposed the scale-aware attention network
to encode the multi-scale density maps. In babu2018divide , IG-CNN adapted the
multi-scale crowd scenes by increasing its capacity. The work of Cascaded-MTL
sindagi2017cnn , Marsden et al.marsde2018people , DecideNet+R3
liu2018decidenet , and DDCN wang2019removing  introduced the multi-task
learning to assist in reducing the count estimation errors. The work of SE
Cycle GAN Wang_2019_CVPR  designed the data collector and labeler to generate
the crowd data with the corresponding labels to alleviate the overfitting
caused by limited data for training. In shi2018crowd , the deep negative
correlation learning was utilized to extract the general feature
representation. The estimation errors are illustrated in Table 6. It can be
observed that, firstly, the performance of deep learning is far better than
the hand-crafted features. Secondly, lots of efforts are done to extract the
multi-scale features of the crowd, which is very important to reduce the
estimation errors to some extent. Finally, our proposed SegCrowdNet achieves
the best performance in MAE and MSE on both datasets.

Table 6: Estimation errors on the ShanghaiTeach dataset. Method | Part_A | Part_B
---|---|---
| MAE | MSE | MAE | MSE
LBR + RR | 303.2 | 371.0 | 59.1 | 81.7
SE Cycle GAN Wang_2019_CVPR  | 123.4 | 193.4 | 19.9 | 28.3
MCNN zhang2016single  | 110.2 | 173.5 | 26.4 | 41.3
Cascaded-MTL sindagi2017cnn  | 101.3 | 152.4 | 20.0 | 31.1
CAFN fan2018cafn  | 100.8 | 152.3 | 21.5 | 33.4
TDF-CNN sam2018top  | 97.5 | 145.1 | 20.7 | 32.8
Switch-CNN sam2017switching  | 90.4 | 135.0 | 21.6 | 33.4
Marsden et al.marsde2018people  | 85.7 | 131.1 | 17.7 | 28.6
DecideNet+R3 liu2018decidenet  | \- 111’-’ represents that the result of this dataset is not reported in that paper. | - | 20.8 | 29.4
CP-CNN sindagi2017generating  | 73.6 | 106.4 | 20.1 | 30.1
D-ConvNet-V1 shi2018crowd  | 73.5 | 112.3 | 18.7 | 26.0
Hossain et al. hossain2019crowd  | - | - | 16.9 | 28.4
IG-CNN babu2018divide  | 72.5 | 118.2 | 13.6 | 21.2
DDCN wang2019removing  | 71.5 | 110.4 | 13.8 | 20.1
OURS | 68.3 | 104.1 | 12.1 | 19.3

###  4.5 UCF_CC_50 dataset

The UCF_CC_50 dataset idrees2013multi  contains 50 crowd images collected from
the internet. The number of people in each image ranges from 94 to 4,543.
There are only 50 images in this dataset. We follow the standard protocol
discussed in idrees2013multi . The 5-fold cross-validation is utilized to
evaluate the performance on this dataset.

Table 7: Estimation errors on the WorldExpo’10 dataset.

Method | S1 | S2 | S3 | S4 | S5 | Average
---|---|---|---|---|---|---
LBP+RR | 13.6 | 58.9 | 37.1 | 21.8 | 23.4 | 31.9
SE Cycle GAN Wang_2019_CVPR  | 4.3 | 59.1 | 43.7 | 17.0 | 7.6 | 26.3
MCNN zhang2016single  | 3.4 | 20.6 | 12.9 | 13.0 | 8.1 | 11.6
TDF-CNN sam2018top  | 2.7 | 23.4 | 10.7 | 17.6 | 3.3 | 11.5
IG-CNN babu2018divide  | 2.6 | 16.1 | 10.2 | 20.2 | 7.6 | 11.3
DDCN wang2019removing  | 4.8 | 16.2 | 12.4 | 10.9 | 4.9 | 9.8
Switch-CNN sam2017switching  | 4.4 | 15.7 | 10.0 | 11.0 | 5.9 | 9.4
DecideNet liu2018decidenet  | 2.0 | 13.1 | 8.9 | 17.4 | 4.8 | 9.2
D-ConvNet-V1 shi2018crowd  | 1.9 | 12.1 | 20.7 | 8.3 | 2.6 | 9.1
CP-CNN sindagi2017generating  | 2.9 | 14.7 | 10.5 | 10.4 | 5.8 | 8.9
OURS | 2.3 | 11.9 | 11.8 | 11.2 | 2.4 | 7.9

Table 8: Estimation errors on the UCF_CC_50 dataset. Method | MAE | MSE
---|---|---
Rodriguez et al. rodriguez2011density  | 655.7 | 697.8
Lempitsky et al. idrees2013multi  | 419.5 | 541.6
MCNN zhang2016single  | 377.6 | 509.1
SE Cycle GAN Wang_2019_CVPR  | 373.4 | 528.8
TDF-CNN sam2018top  | 354.7 | 491.4
Cascaded-MTL sindagi2017cnn  | 322.8 | 397.9
Switch-CNN sam2017switching  | 318.1 | 439.2
CAFN fan2018cafn  | 305.3 | 429.4
CP-CNN sindagi2017generating  | 295.8 | 320.9
IG-CNN babu2018divide  | 291.4 | 349.4
D-ConvNet-V1 shi2018crowd  | 288.4 | 404.7
DDCN wang2019removing  | 286.2 | 479.6
Hossain et al. hossain2019crowd  | 271.6 | 391.0
OURS | 233.6 | 352.6

In Table 8, we compare our method with other recent state-of-the-art methods.
The hand-crafted features were extracted in rodriguez2011density ;
idrees2013multi . The methods which have been compared on the ShanghaiTech are
still compared in this dataset. The detailed comparison results are shown in
Table 8. In the same way, it can be observed that all of the CNN-based methods
outperform the methods of traditional feature extraction rodriguez2011density
; idrees2013multi  significantly. The proposed SegCrowdNet leads the best
performance in MAE. More specifically, its MAE is 38.0 lower than the second
best method. However, the MSE which indicates the robustness of a method is
not the best. We think that the root of causing this result lies in the
limited data, as there are only 50 images in this dataset.

###  4.6 WorldExpo’10 dataset

The WorldExpo’10 dataset zhang2015cross  contains 1,132 video sequences that
are captured from 108 scenarios and it consists of 3,982 annotated frames with
a size of 576$\times$720\. The frames with the region of interest (ROI) are
divided into a training set with 3380 frames and a test set with 600 frames.
The test set consists of 5 five different scenes (S1-S5) and each scene
contains 120 frames. For fair comparisons, we followed the methods in
zhang2015cross  to generate the density map.

The results of recent state-of-the-art methods are summarized in Table 7. The
MAE is utilized to evaluate these methods. We can observe that the CNN-based
methods are still superior to traditional methods. Our proposed SegCrowdNet
obtains the best result on the S2, S5, and Average. While it achieves
comparable performance on the other three scenes. By reviewing the test images
of these three scenes, we find that some people are majorly gathered in these
three scenes, which is challenging for our proposed SegCrowdNet to further
improve their accuracy.

##  5 Conclusions

In this paper, an end-to-end architecture named SegCrowdNet is designed in
crowd counting. We propose a novel segmentation attention mechanism to guide
our SegCrowdNet to pay more attention to the human head regions. The proposed
SegCrowdNet can also automatically adapt the variation of crowd counts by
optimizing a classification task. Moreover, the proposed novel four-loss
optimization improves the generalization ability of the SegCrowdNet. We verify
our method on four popular crowd counting datasets (ShanghaiTech Part_A
dataset, ShanghaiTech Part_B dataset, UCF_CC_50 dataset, and WorldExpo’10
dataset). Extensive experimental results demonstrate that our proposed method
outperforms many state-of-the-art methods.

##  6 Acknowledgments

This work was supported by the National Natural Science Foundation of China
(No.61472393).

Please cite @article{chen2021crowd, title={Crowd counting with segmentation
attention convolutional neural network}, author={Chen, Jiwei and Wang,
Zengfu}, journal={IET Image Processing}, volume={15}, number={6},
pages={1221–1231}, year={2021}, publisher={Wiley Online Library} }

## References

  * [1] Gao, L., Wang, Y., Ye, X., Wang, J.: ‘Crowd counting considering network flow constraints in videos’, _IET Image Processing_ , 2017, 12, (1), pp. 11–19
  * [2] Ma, T., Ji, Q., Li, N.: ‘Scene invariant crowd counting using multi-scales head detection in video surveillance’, _IET Image Processing_ , 2018, 12, (12), pp. 2258–2263
  * [3] Zhan, B., Monekosso, D.N., Remagnino, P., Velastin, S.A., Xu, L.Q.: ‘Crowd analysis: a survey’, _Machine Vision and Applications_ , 2008, 19, (5-6), pp. 345–357
  * [4] Marsde, M., McGuinness, K., Little, S., Keogh, C.E., O’Connor, N.E.: ‘People, penguins and petri dishes: adapting object counting models to new visual domains and object types without forgetting’, , 2018,
  * [5] Dalal, N., Triggs, B.  ‘Histograms of oriented gradients for human detection’.  In: Computer Vision and Pattern Recognition, 2005. IEEE Computer Society Conference on. vol. 1. (IEEE, 2005. pp. 886–893
  * [6] Pham, V.Q., Kozakaya, T., Yamaguchi, O., Okada, R.  ‘Count forest: Co-voting uncertain number of targets using random forest for crowd density estimation’.  In: Proceedings of the IEEE International Conference on Computer Vision. (, 2015. pp. 3253–3261
  * [7] Viola, P., Jones, M.J.: ‘Robust real-time face detection’, _International journal of computer vision_ , 2004, 57, (2), pp. 137–154
  * [8] Benenson, R., Omran, M., Hosang, J., Schiele, B.  ‘Ten years of pedestrian detection, what have we learned?’.  In: European Conference on Computer Vision. (Springer, 2014. pp. 613–627
  * [9] Chan, A.B., Vasconcelos, N.  ‘Bayesian poisson regression for crowd counting’.  In: Computer Vision, 2009 IEEE 12th International Conference on. (IEEE, 2009. pp. 545–551
  * [10] Lempitsky, V., Zisserman, A.  ‘Learning to count objects in images’.  In: Advances in neural information processing systems. (, 2010. pp. 1324–1332
  * [11] Idrees, H., Saleemi, I., Seibert, C., Shah, M.  ‘Multi-source multi-scale counting in extremely dense crowd images’.  In: Proceedings of the IEEE conference on computer vision and pattern recognition. (, 2013. pp. 2547–2554
  * [12] Walach, E., Wolf, L.  ‘Learning to count with cnn boosting’.  In: European Conference on Computer Vision. (Springer, 2016. pp. 660–676
  * [13] Long, J., Shelhamer, E., Darrell, T.  ‘Fully convolutional networks for semantic segmentation’.  In: Proceedings of the IEEE conference on computer vision and pattern recognition. (, 2015. pp. 3431–3440
  * [14] Ren, S., He, K., Girshick, R., Sun, J.  ‘Faster r-cnn: Towards real-time object detection with region proposal networks’.  In: Advances in neural information processing systems. (, 2015. pp. 91–99
  * [15] Zhang, Y., Zhou, D., Chen, S., Gao, S., Ma, Y.  ‘Single-image crowd counting via multi-column convolutional neural network’.  In: Proceedings of the IEEE conference on computer vision and pattern recognition. (, 2016. pp. 589–597
  * [16] Sam, D.B., Surya, S., Babu, R.V.  ‘Switching convolutional neural network for crowd counting’.  In: Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition. vol. 1. (, 2017. p. 6
  * [17] Sindagi, V.A., Patel, V.M.  ‘Generating high-quality crowd density maps using contextual pyramid cnns’.  In: 2017 IEEE International Conference on Computer Vision. (IEEE, 2017\. pp. 1879–1888
  * [18] Zhang, C., Li, H., Wang, X., Yang, X.  ‘Cross-scene crowd counting via deep convolutional neural networks’.  In: Proceedings of the IEEE conference on computer vision and pattern recognition. (, 2015. pp. 833–841
  * [19] Sindagi, V.A., Patel, V.M.: ‘A survey of recent advances in cnn-based single image crowd counting and density estimation’, _Pattern Recognition Letters_ , 2018, 107, pp. 3–16
  * [20] Li, T., Chang, H., Wang, M., Ni, B., Hong, R., Yan, S.: ‘Crowded scene analysis: A survey’, _IEEE transactions on circuits and systems for video technology_ , 2015, 25, (3), pp. 367–386
  * [21] Xu, H., Zheng, C., Nie, Y., Xia, S.  ‘Crowd counting with segmentation map guidance’.  In: Chinese Control Conference. (, 2019.
  * [22] Sajid, M., Hassan, A., Khan, S.A.  ‘Crowd counting using adaptive segmentation in a congregation’.  In: IEEE International Conference on Signal and Image Processing. (, 2017\.
  * [23] Shaban, M., Mahmood, A., Al.Maadeed, S., Rajpoot, N.  ‘Multi-person head segmentation in low resolution crowd scenes using convolutional encoder-decoder framework’.  In: International Workshop on Representations. (, 2017.
  * [24] Siva, P., Shafiee, M.J., Jamieson, M., Wong, A.: ‘Scene invariant crowd segmentation and counting using scale-normalized histogram of moving gradients (homg)’, _arXiv preprint arXiv:160200386_ , 2016,
  * [25] Li, M., Zhang, Z., Huang, K., Tan, T.  ‘Estimating the number of people in crowded scenes by mid based foreground segmentation and head-shoulder detection’.  In: 2008 19th International Conference on Pattern Recognition. (IEEE, 2008\. pp. 1–4
  * [26] Zeng, C., Ma, H.  ‘Robust head-shoulder detection by pca-based multilevel hog-lbp detector for people counting’.  In: 2010 20th International Conference on Pattern Recognition. (IEEE, 2010\. pp. 2069–2072
  * [27] Lin, Z., Davis, L.S.: ‘Shape-based human detection and segmentation via hierarchical part-template matching’, _IEEE Transactions on Pattern Analysis and Machine Intelligence_ , 2010, 32, (4), pp. 604–618
  * [28] Freund, Y., Schapire, R.E.: ‘A decision-theoretic generalization of on-line learning and an application to boosting’, _Journal of Computer and System Sciences_ , 1999, 55, pp. 119–139
  * [29] Boominathan, L., Kruthiventi, S.S., Babu, R.V.  ‘Crowdnet: A deep convolutional network for dense crowd counting’.  In: Proceedings of the 24th ACM international conference on Multimedia. (ACM, 2016. pp. 640–644
  * [30] Hossain, M., Hosseinzadeh, M., Chanda, O., Wang, Y.  ‘Crowd counting using scale-aware attention networks’.  In: 2019 IEEE Winter Conference on Applications of Computer Vision. (IEEE, 2019. pp. 1280–1288
  * [31] Shen, Z., Xu, Y., Ni, B., Wang, M., Hu, J., Yang, X.  ‘Crowd counting via adversarial cross-scale consistency pursuit’.  In: Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition. (, 2018. pp. 5245–5254
  * [32] Sam, D.B., Babu, R.V.  ‘Top-down feedback for crowd counting convolutional neural network’.  In: Thirty-Second AAAI Conference on Artificial Intelligence. (, 2018\.
  * [33] Wang, Q., Gao, J., Lin, W., Yuan, Y.  ‘Learning from synthetic data for crowd counting in the wild’.  In: The IEEE Conference on Computer Vision and Pattern Recognition. (, 2019.
  * [34] Yu, F., Koltun, V.: ‘Multi-scale context aggregation by dilated convolutions’, _arXiv preprint arXiv:151107122_ , 2015,
  * [35] Sindagi, V.A., Patel, V.M.  ‘Cnn-based cascaded multi-task learning of high-level prior and density estimation for crowd counting’.  In: 2017 14th IEEE International Conference on Advanced Video and Signal Based Surveillance. (IEEE, 2017. pp. 1–6
  * [36] He, K., Zhang, X., Ren, S., Sun, J.: ‘Spatial pyramid pooling in deep convolutional networks for visual recognition’, _IEEE transactions on pattern analysis and machine intelligence_ , 2015, 37, (9), pp. 1904–1916
  * [37] Collobert, R., Weston, J.  ‘A unified architecture for natural language processing: Deep neural networks with multitask learning’.  In: Proceedings of the 25th international conference on Machine learning. (, 2008. pp. 160–167
  * [38] Milletari, F., Navab, N., Ahmadi, S.A.  ‘V-net: Fully convolutional neural networks for volumetric medical image segmentation’.  In: 2016 Fourth International Conference on 3D Vision. (IEEE, 2016. pp. 565–571
  * [39] Zettinig, O., Shah, A., Hennersperger, C., Eiber, M., Kroll, C., Kübler, H., et al.: ‘Multimodal image-guided prostate fusion biopsy based on automatic deformable registration’, _International journal of computer assisted radiology and surgery_ , 2015, 10, (12), pp. 1997–2007
  * [40] Fan, L., Tong, M., Li, M.  ‘Cafn: The combination of atrous and fractionally strided convolutional neural networks for understanding the densely crowded scenes’.  In: Chinese Conference on Pattern Recognition and Computer Vision. (Springer, 2018. pp. 297–307
  * [41] Babu.Sam, D., Sajjan, N.N., Venkatesh.Babu, R., Srinivasan, M.  ‘Divide and grow: Capturing huge diversity in crowd images with incrementally growing cnn’.  In: Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition. (, 2018. pp. 3618–3626
  * [42] Liu, J., Gao, C., Meng, D., Hauptmann, A.G.  ‘Decidenet: Counting varying density crowds through attention guided detection and density estimation’.  In: Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition. (, 2018. pp. 5197–5206
  * [43] Wang, L., Yin, B., Tang, X., Li, Y.: ‘Removing background interference for crowd counting via de-background detail convolutional network’, _Neurocomputing_ , 2019, 332, pp. 360–371
  * [44] Shi, Z., Zhang, L., Liu, Y., Cao, X., Ye, Y., Cheng, M.M., et al.  ‘Crowd counting with deep negative correlation learning’.  In: Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition. (, 2018. pp. 5382–5390
  * [45] Rodriguez, M., Laptev, I., Sivic, J., Audibert, J.Y.  ‘Density-aware person detection and tracking in crowds’.  In: 2011 International Conference on Computer Vision. (IEEE, 2011. pp. 2423–2430


# FitAct: Error Resilient Deep Neural Networks via Fine-Grained Post-Trainable
Activation Functions

Behnam Ghavami, Mani Sadati, Zhenman Fang, Lesley Shannon  Simon Fraser
University, Burnaby, BC, Canada
Emails: {behnam_ghavami, zhenman<EMAIL_ADDRESS>
###### Abstract

Deep neural networks (DNNs) are increasingly being deployed in safety-critical
systems such as personal healthcare devices and self-driving cars. In such
DNN-based systems, error resilience is a top priority since faults in DNN
inference could lead to mispredictions and safety hazards. For latency-
critical DNN inference on resource-constrained edge devices, it is nontrivial
to apply conventional redundancy-based fault tolerance techniques.

In this paper, we propose FitAct, a low-cost approach to enhance the error
resilience of DNNs by deploying fine-grained post-trainable activation
functions. The main idea is to precisely bound the activation value of each
individual neuron via neuron-wise bounded activation functions, so that it
could prevent the fault propagation in the network. To avoid complex DNN model
re-training, we propose to decouple the accuracy training and resilience
training, and develop a lightweight post-training phase to learn these
activation functions with precise bound values. Experimental results on widely
used DNN models such as AlexNet, VGG16, and ResNet50 demonstrate that FitAct
outperform state-of-the-art studies such as Clip-Act and Ranger in enhancing
the DNN error resilience for a wide range of fault rates, while adding
manageable runtime and memory space overheads.

##  I Introduction

Recently, Deep Neural Networks (DNNs) have brought some promising results into
safety-critical applications such as cyber-physical systems, personal
healthcare devices [1] and self-driving vehicles [2]. However, to realize
successful deployment of DNNs in real-world safety-critical systems, in
addition to their inference accuracy and latency, one also needs to consider
the error resilience of DNNs under environmental noises and hardware memory
faults [3][4]. In this paper, the error resilience of a DNN is defined as its
ability to maintain the model accuracy in the presence of random faults; under
random faults, the higher the model accuracy, the better the model resilience.

Traditionally, the error resilience of a system is usually enhanced by
redundancy-based fault tolerance techniques, where one of more dimensions of
hardware, software, data, and time are duplicated to tolerate the faults [5,
6, 7, 8, 9, 10, 11]. Such techniques usually entail significant cost, latency
and/or resource overheads, which are often not suitable for latency-critical
DNN inference on resource-constrained edge devices. More related work will be
discussed in Section II.

To overcome the above challenge, one appealing direction is to enhance the
error resilience of DNNs via simple network architecture modifications [12,
13, 14, 15, 16, 17, 18, 19]. More specifically, one promising solution is to
bound the activation values of neurons in the network to help prevent the
fault propagation by making simple changes to the activation functions in a
DNN model [16, 17, 18]. However, as we will present in Section III-C, we
observe that prior studies [16, 17, 18] use a global bound value for all
neurons in a network layer and become ineffective when the fault rate becomes
$10^{-6}$ and higher. The reason is that the (normal) maximum activation
values of neurons vary wildly.

Inspired by the above observation, in this paper, we propose to employ a fine-
grained neuron-wise activation function in the DNN model, which has an
adjustable upper-bound for each neuron to better enhance the model error
resilience. One challenge behind this simple idea is that it introduces a huge
number of different bound values for users to figure out. To address this
challenge, in Section IV, we propose a trainable fine-grained activation
function, called FitReLU, based on the most widely used ReLU (Rectified Linear
Unit) [14] activation function. To avoid retraining a DNN model from scratch
and complicating the training process, in Section V, we propose to decouple
the accuracy training (conventional training) and resilience training (post-
training), and develop a two-stage framework called FitAct to enhance the
model resilience. In FitAct, we develop a lightweight post-training phase to
learn those fine-grained activation functions with precise bound values.

In our experiments, we perform fault simulations on three widely used DNN
models, AlexNet, VGG16, and ResNet50, on two datasets, CIFAR-10 and CIFAR-100,
under various fault rates ranging from $10^{-7}$ to $3\times 10^{-5}$.
Compared to state-of-the-art studies Clip-Act [18] and Ranger [16] that use a
global bound for all neurons in a network layer, FitAct achieves better error
resilience, especially at higher fault rates that go beyond $10^{-6}$. For
example, at the fault rate of $3\times 10^{-6}$, FitAct can still achieve a
high accuracy of 84.81% and 90.28% for ResNet50 and VGG16 models on CIFAR-10
dataset, while Clip-Act can only achieve an accuracy of 52.47% and 61.63%, and
Ranger almost provides no protection. In general, compared to the original DNN
model with regular ReLU activation function, FitAct adds less than 7% extra
runtime overhead for the post-training step, less than 12% extra runtime
overhead and less than 6% memory space overhead for the inference step.

##  II Related Work

In general, the proposed techniques to enhance the error resilience of DNNs
can be classified into the following categories.

###  II-A Traditional Hardware Redundancy-based Fault Mitigation

Redundancy-based fault detection and mitigation techniques are commonly used
for mitigating faults in machine learning hardware. For example, Tesla’s self-
driving cars used expensive Dual Modular Redundancy (DMR) to mitigate the
impact of faults [20]. A more efficient technique is selective node hardening,
which often suffers from limited fault coverage though. For example, Mahmoud
et al. [5] used statistical fault study to identify vulnerable regions in
DNNs, and selectively duplicate the vulnerable computations for fault
detection. Li et al. [6] leveraged the value spikes in the neural responses as
the symptoms for fault detection. However, program re-execution is required to
restore the correct output. A relaxed version of Triple Modular Redundancy
(TMR) was deployed for FPGA-based DNN accelerators in [7]. Sabih et. al. [8]
utilized explainable deep learning techniques to make DNNs more robust by
identifying vulnerable parts and selectively protecting them using Error
Correction Codes (ECC) and TMR.

Although these approaches offer improved resilience against faults, they have
high time or resource overheads and are not preferable for latency-critical
DNN inference on edge devices.

###  II-B Traditional Algorithm Redundancy-based Fault Tolerance

Algorithm-Based Fault Tolerance (ABFT) has also been proposed to detect (and
tolerate) faults in some particular layers of DNNs (e.g., convolutional layer
[9] or fully-connected layer [10]) by inserting checksums for layer operations
in the algorithm. To compensate the execution time overhead, Kosaian et. al.
[11] investigated thread-level ABFT schemes for GPUs that exploit an adaptive
arithmetic intensity guided approach.

However, these techniques do not protect DNNs against faults occurring in
other layers of a DNN or fault propagation into multiple neurons (in multiple
layers). In addition, they also have remarkable time overhead.

###  II-C Fault-Aware Training

Some studies account for the fault patterns of the inference accelerator
during the training itself [21]. For example, a research in [22] performed
retraining to reduce the impact of errors in analog domains. Common
regularizing techniques via training process, such as dropout, may improve the
general error resilience of models as well [23]. Zahid et al. [24] introduced
a fault-aware training that includes permanent fault modeling during training
of FPGA-based DNN accelerators.

However, these approaches complicate the training process, since fault
injections need to be performed by embedding inference hardware in the
training procedure or through exhaustive fault simulations, both of which are
impractical.

###  II-D Modifications of the Network Architecture

Another common approach is to modify the neural network architecture to
increase its error resilience, which can be done either during training or
outside training. For example, Dias et al. [12] suggested a resilience
optimization procedure by changing the architecture in order to diminish the
impact of the faults. However, they used exhaustive simulations to determine
critically values, which is impractical for large DNNs. Schorn et al. [13]
introduced a resilience enhancement procedure by the replication of critical
layers and features to achieve a more homogeneous resilience distribution
within the network. Nevertheless, no automated design flow was introduced to
jointly optimize the error resilience and accuracy of DNNs.

Recently, Hong et al. [17] introduced an efficient approach to mitigate memory
faults in DNNs by modifying their architectures using Tanh [14] as the
activation function. To mitigate errors, based on the analysis and the
observations from [15], Hoang et al. [18] presented a new version of the ReLU
activation function to squash high-intensity activation values to zero, which
is called Clip-Act. Ranger [16] used value restriction in different DNN layers
as a way to rectify the faulty outputs caused by transient faults. An error
correction technique based on the complementary robust layer (redundancy
mechanism) and activation function modification (removal mechanism) has been
recently introduced in [19]. However, these methods, such as [16, 17, 18, 19],
suffer from low fault coverage, since it is challenging to find a single
global bound value for all neurons in a network layer. In Section III-C, we
will further demonstrate the limitations of such a globally bounded activation
function used in [16, 17, 18]. Motivated by this, in this paper, we introduce
a fine-grained post-trainable activation function to improve the error
resilience of DNNs under a wide range of fault rates.

##  III DNN Activation Function and Motivation

###  III-A DNN Model and Activation Function

Generally, we consider a DNN of depth $D$ corresponding to a neural network
with an input layer, ${D-1}$ hidden layers, and an output layer. We denote the
number of neurons as $N$. The $k^{th}$ hidden layer receives an output
$\bm{z}^{k-1}$ from the prior layer where an affine transformation is
performed as the form of:

$\mathscr{L}_{k}(\bm{z}^{k-1})=\bm{w}^{k}\bm{z}^{k-1}+\bm{b}^{k}$ (1)

where the network weights $\bm{w}^{k}$ and bias term $\bm{b}^{k}$ associated
with the $k^{th}$ layer are chosen from independent and identically
distributed samplings.

A nonlinear activation function $\xi(.)$ is applied to each component of the
transformed vector, before it is sent as an input to the next layer. The
activation function is an identity function after an output layer.

Therefore, the final neural network representation is given by the
composition:

$\bm{u}_{\Theta}(\bm{z})=(\mathscr{L}_{D}\circ\xi(\cdot)\circ\mathscr{L}_{D-1}\circ\xi(\cdot)\circ\dots\xi(\cdot)\circ\mathscr{L}_{1})(\bm{z})$
(2)

where the operator $\circ$ is the composition operator, $\Theta$ =
${\bm{w}^{k},\bm{b}^{k}}:$ ${k=1,...,D}$, represents the trainable parameters
in the network.

###  III-B ReLU Activation Function

The choice of an activation function plays an important role in determining
how a DNN learns and behaves. Many hand-engineered activation functions exist
[14], but only a small number of them are widely used in modern DNN models.
Among them, the Rectified Linear Unit (ReLU) function is the most widely used
one in recent DNN models as it allows faster training convergence and less
complex gradient computation [25]. The ReLU function, $\xi_{ReLU}(x)$, follows
as [26]:

$\xi_{ReLU}(x)=max(0,x)$ (3)

where $x$ is the input of the activation on all the input channels.

###  III-C Bounded ReLU: Remaining Issue and Motivation

Some recent studies [16, 17, 18] revealed that bounding the output values of
the activation function helps prevent the faults propagation in the network.
In this regard, a constrained range ReLU activation function could be deployed
to enhance the resilience of DNN as [16, 17, 18]:

$\xi_{GBReLU}(x)=\begin{cases}0&\text{if $x>\lambda$}\\\ x&\text{if
$0<x\leq\lambda$}\\\ 0&\text{if $x\leq 0$}\end{cases}$ (4)

where $\lambda$ is a bound value. It indicates that values greater than
$\lambda$ are most likely faulty and need to be controlled by the activation
function. The value of $\lambda$ is determined by observing the maximum
activation in all neurons of each layer [16, 17, 18]; we call the approach
used in [16, 17, 18] as the globally bounded ReLU (GBReLU) and illustrate its
limitation as below.

To evaluate the impact of GBReLU on the resilience of DNNs, we characterize
the accuracy of the VGG16 network on the CIFAR-10 dataset under a fault rate
of $10^{-5}$. In this case study, we insert faults into the input layer and
the second layer (convolutional layer) of the VGG16 network, and use GBReLU to
replace the original ReLU in the second layer with a global bound value to
restrict activation values of all neurons in this layer. The detailed
experimental setup is in Section VI-A. The results are shown in Figure 1.

First, there is a large accuracy gap between the baseline model without fault
(called accuracy) and the model with GBReLU under a high fault rate of
$10^{-5}$ (called resilience). Second, choosing a lower global activation
bound ($\lambda$) could lead to a higher resilience (i.e., model accuracy
under fault) until a certain threshold when the baseline accuracy without
fault starts to drop significantly. More results on the accuracy of the GBReLU
approach for different DNN models under different fault rates are presented in
Section VI-B. In general, when the fault rate goes higher beyond $10^{-6}$,
the GBReLU approach has a significant accuracy loss and is no longer effective
in protecting the DNN model against faults.

Figure 1: Accuracy of the VGG16 network on CIFAR-10 dataset under a fault rate
of $10^{-5}$, with regard to different global bound values of GBReLU in the
second network layer.

To better understand the source of this accuracy drop, we perform a
statistical study on all neurons’ output values in the second layer of the
VGG16 network. Figure 2 shows the distribution of the maximum output values
for all neurons in the layer. We observe that the neurons across the layer
have different maximum values; a similar trend is observed for other layers
and other networks. However, the GBReLU approach [16, 17, 18] chooses a fixed
upper bound value for all neurons in the layer, which may not remove some
faulty output values (if $\lambda$ is too big) or may eliminate some non-
faulty output values (if $\lambda$ is too small). This motivates us to explore
the fine-grained bounded activation function where we can set a bound for the
activation function for each neuron in the network.

Figure 2: Distribution of the maximum output values of all neurons in VGG16’s
second layer on the CIFAR-10 dataset.

##  IV FitReLU: Trainable Fine-Grained Bounded ReLU Activation Function

In light of our findings in Section III-C, instead of defining a bounded
activation function globally, we propose to define a fine-grained bounded
activation function for each neuron.

###  IV-A Neuron-Wise Bounded Activation Function

Neuron-wise activation function acts as a vector of activation functions in
each hidden-layer, where every neuron has its own activation function, as
opposed to a single global activation function shared by all neurons. In this
paper, we introduce a parametric neuron-wise bounded ReLU (FitReLU-Naive) as:

$\xi_{FitReLU-Naive}(x)=\begin{cases}0&\text{if $x>\lambda_{i}$}\\\ x&\text{if
$0<x\leq\lambda_{i}$}~{}~{}~{}~{}\forall{i\in\\{1,...,N\\}}\\\ 0&\text{$x\leq
0$}\end{cases}$ (5)

where $N$ denotes the number of neurons in the network and $\lambda_{i}$
denotes the bound value for neuron $i$. It indicates that values bigger than
$\lambda_{i}$ are probably faulty for neuron $i$ and need to be controlled by
its activation function.

###  IV-B Issue with FitReLU-Naive

To deploy the proposed FitReLU-Naive in a DNN model, we need to adjust $N$
parameters, i.e., $\lambda_{1}$ to $\lambda_{N}$, so as to improve the
resilience of the model. To find the best values of $\lambda_{1}$ to
$\lambda_{N}$, we will introduce a post-training phase in Section V to fine
tune these values, in order to minimize the loss function and maximize the
resilience. Most learning algorithms are based on the backward propagation of
the error gradients. However, the derivative of the FitReLU-Naive activation
function at point $x=\alpha$ cannot be computed, since it has different terms
in each segment as presented in Equation 5. Therefore, it is nontrivial to
learn the FitReLU-Naive activation functions (i.e., $\lambda_{1}$ to
$\lambda_{N}$) via the post-training process.

###  IV-C Trainable FitReLU

To solve the above problem in Section IV-B, we introduce a new activation
function (called FitReLU) that can be trained during the learning process [27]
and has a behavior similar to FitReLU-Naive. Inspired by the sigmoid
mathematical function [14], we reformulate FitReLU into a trainable one as:

$\xi_{FitReLU}(x)=max(0,\
x-\frac{x}{1+e^{k(x-\lambda_{i})}})~{}~{}~{}\forall{i\in\\{1,...,N\\}}$ (6)

where $N$ and $\lambda_{i}$ are the same as those in Equation 5, and $k$ is a
coefficient to control the decent slope of the function and is empirically
computed. The illustrations of both FitReLU-Naive and trainable FitReLU, as
well as the original ReLU and GBReLU are presented in Figure 3.

Figure 3: Representation of original ReLU [26], GBReLU (globally bounded ReLU)
[18], naive FitReLU and trainable FitReLU activation functions.

##  V FitAct: The Proposed Resilient DNN Framework

To avoid retraining the DNN model from scratch and complicating the DNN
training process, we divide our workflow (called FitAct) of building an error
resilient DNN with the proposed FitReLU activation function into two separate
stages. As shown in Figure 4, in the first stage, FitAct trains a DNN model
with the original ReLU activation function using the conventional training
process. Its goal is to learn the weight and bias parameters ($\bm{w}^{1}$ to
$\bm{w}^{D}$, $\bm{b}^{1}$ to $\bm{b}^{D}$) to improve the model accuracy,
without the consideration of error resilience. In the second stage, FitAct
first replaces the ReLU activation function in the trained DNN model with our
proposed FitReLU variants. Then it post-trains the modified DNN model to tune
the fine-grained bound values ($\lambda_{1}$ to $\lambda_{N}$) of FitReLU
functions to improve the model resilience against faults.

Figure 4: FitAct: our two-stage workflow to enhance the resilience of DNNs by
post-training FitReLU activation functions.

Formally, the final error resilient DNN model can be represented using two
separable groups of learning parameters as:

$\bm{u}_{\Theta_{A},\Theta_{R}}(\bm{z})=(\mathscr{L}_{D}\circ\xi_{D-1}(\cdot)\circ\mathscr{L}_{D-1}\circ\xi_{D-2}(\cdot)\circ\dots\xi_{1}(\cdot)\circ\mathscr{L}_{1})(\bm{z})$
(7)

where the set of trainable parameters $\Theta_{A}$ consists of
${\bm{w}^{k},\bm{b}^{k}}:$ ${k=1,...,D}$, which indicate the accuracy goal,
and $\Theta_{R}$ denotes the post-trainable parameters, i.e.,
${\lambda_{i}}:{i=1,...,N}$, which indicate the resilience goal.

Conventional Training for Accuracy: A typical learning algorithm for the
training stage updates $\Theta_{A}$ through gradient computations, and
calculates the errors on training dataset $\mathbb{D}$ via an accuracy loss
function $\mathcal{L}(\mathbb{D};\Theta_{A})$. We denote the accuracy of the
trained network as $\mathcal{A}(\Theta_{A})$.

DNN Architecture Modification: We modify the trained DNN model by replacing
the original ReLU function for each neuron with our FitReLU variants, and
initialize the bound parameters $\Theta_{R}$ for each neuron to their maximum
values over the training dataset $\mathbb{D}$. Note that by applying this
modification, the accuracy of the obtained model,
$\mathcal{A}(\Theta_{A},\Theta_{R})$, would be changed.

Post-Training for Resilience Enhancement: To enhance the error resilience of
the modified DNN architecture, we perform a post-training phase detailed in
the following subsections.

###  V-A Resilience Enhancement as an Optimization Problem

The main goals of our post-training phase could be expressed as: 1) maximizing
the resilience of the model, and 2) maintaining the accuracy of the model.
Using goal 1 as the objective and goal 2 as the constraint, we can formulate
the model resilience enhancement as the following optimization problem:

$\begin{split}&max_{~{}\bm{{\Theta_{R}}}}(\mathcal{R}(\Theta_{A},\Theta_{R}))\\\
&s.t.\quad\quad\mathcal{A}(\Theta_{A})-\mathcal{A}(\Theta_{A},\Theta_{R})<\delta\end{split}$
(8)

where $\mathcal{R}(\Theta_{A},\Theta_{R})$ is the resilience of the model,
which represents the accuracy of the modified network under faults.
$\mathcal{A}(\Theta_{A},\Theta_{R})$ is the accuracy of the modified network
without faults. And the threshold $\delta$ can be adjusted based on how much
accuracy loss we are willing to accept for resilience boosting.

As discussed in Section III-C, having lower values of $\Theta_{R}$ could
increase the chance of fault removing and thus increase the resilience.
However, when the values of $\Theta_{R}$ become lower than a certain level,
the accuracy loss could also increase. Therefore, we can maximize the
resilience by minimizing $\Theta_{R}$ values until the accuracy loss is not
acceptable. The optimization problem in Equation 8 can be reformulated as:

$\begin{split}min({\Theta_{R}})\quad\quad s.t.\ \
\mathcal{A}(\Theta_{A})-\mathcal{A}(\Theta_{A},\Theta_{R})<\delta\end{split}$
(9)

###  V-B Post-Training Algorithm

In order to minimize $\Theta_{R}$ while maintaining the accuracy (i.e.,
Equation 9), we introduce a post-training algorithm with a new loss function
$\mathcal{L}(\mathbb{D};\Theta_{A},\Theta_{R}$). It is the same as that in the
conventional training step except that it has an extra regularization
restriction over the $\Theta_{R}$ parameters to penalize the increasing upper
bounds. That is:

$\mathcal{L}(\mathbb{D};\Theta_{A},\Theta_{R})=\mathcal{L}(\mathbb{D};\Theta_{A})+\frac{\zeta}{N}\sum_{i=1}^{N}\lambda_{i}^{2}$
(10)

where $\zeta$ is a hyper parameter. Note that only bound values $\Theta_{R}$
would be adjusted and none of $\Theta_{A}$ will be changed in this step.

The solution to this problem can be approximated using an iterative gradient
descent algorithm. In this work, we use the ADAM optimizer [28] to solve it,
which is a widely used variant of the stochastic gradient descent algorithm.

##  VI Experimental Results

###  VI-A Experimental Setup

####  VI-A1 DNN Model and Dataset

We test FitAct on three widely used DNN models: AlexNet, VGG16 and ResNet50.
We use 32-bit fixed-point representation (1 sign bit, 15 integeral bits and 16
fractional bits) rather than floating-point for model parameters, since it is
more energy efficient. These models are trained on two different datasets:
CIFAR-10 and CIFAR-100. All experiments are performed on an Intel Core<EMAIL_ADDRESS>GHz processor with 32 GB memory and an NVIDIA TITAN V GPU.

To validate the efficacy of our approach, we compute the top-1 classification
accuracy. The baseline (top-1) accuracy values without fault for CIFAR-10
dataset are 95.03%, 93.57% and 87.08%, for ResNet50, VGG16 and AlexNet models,
respectively. The baseline accuracy values of CIFAR-100 dataset are 78.43%,
73.67% and 87.08% for the three models, respectively.

####  VI-A2 Fault Simulation

In this paper, we consider memory faults to analyze the error resilience of
DNNs, where the model parameters may be affected under the injection of random
bit-flips in the memory blocks that store these parameters. The weights and
biases of different layers, as well as parameters of activation functions, are
considered as the fault space. To simulate random fault injections, we develop
a fault injection tool based on the PyTorch framework. We assume that the
fault space would be distributed uniformly over random locations in the target
units and throughout the inference period, which is in line with prior studies
[29, 18, 16]. We perform fault injections on different fault rates ranging
from $10^{-7}$ to $3\times 10^{-5}$.

###  VI-B Resilience Results

To demonstrate the efficacy of FitAct, we compare the model resilience under
different fault rates, between our FitAct, state-of-the-art studies Clip-Act
[18] and Ranger [16] that use a layer-wise globally bounded ReLU activation
function to improve model resilience, as well as unprotected DNNs.

Figure 5 compares the model accuracy distribution between different approaches
under different fault rates, using the VGG16 network on CIFAR-10 dataset as a
case study. The accuracy of the unprotected DNN model has a huge drop to
around 10% under fault injection, which clearly calls for resilience
enhancement. In general, as the fault rate increases, the accuracy of the
three protected DNNs decreases, because the protection becomes less effective
and faults are more likely to be injected in critical bits, having a more
substantial impact on the output classification. As shown in Figure 5, FitAct
can keep the accuracy within an acceptable range even at a high fault rate of
$10^{-5}$, whereas Clip-Act [18] and Ranger [16] experience a significant
accuracy drop at fault rates higher than $10^{-6}$ and $10^{-7}$,
respectively.

Figure 6 compares the average accuracy between FitAct, Clip-Act [18], Ranger
[16] and unprotected model under different fault rates, for various DNN
architectures and datasets. First, all three protection methods boost the
accuracy under fault compared to the unprotected one, and FitAct achieves the
best accuracy (i.e., resilience) among all. Second, compared to Clip-Act [18],
when the fault rate becomes $3\times 10^{-6}$ or higher, FitAct achieves a
significantly higher accuracy. For example, at the fault rate of $3\times
10^{-6}$, FitAct can still achieve a high accuracy of 84.81% and 90.28% for
ResNet50 and VGG16 models on CIFAR-10 dataset, while Clip-Act can only achieve
an accuracy of 52.47% and 61.63%. Third, Ranger [16] performs much worse than
Clip-Act [18] and FitAct, even at a low fault rate of $10^{-7}$. At a higher
fault rate than $10^{-7}$, Ranger is no longer effective in the protection
against faults. This is because Ranger truncates an output faulty value to a
big positive bound, which still propagates in the network.

Figure 5: Model accuracy distribution for FitAct, Clip-Act [18], Ranger [16]
and unprotected DNN, using the VGG16 network on CIFAR-10 dataset, under
different fault rates. Figure 6: Average model accuracy for FitAct, Clip-Act
[18], Ranger [16] and unprotected DNN models, including ResNet50, VGG16, and
AlexNet models on CIFAR-10 and CAFIR-100 datasets, under different fault
rates.

###  VI-C Time and Memory Space Overhead

####  VI-C1 Training Step

Since FitAct separates the conventional training for accuracy and post-
training for resilience, it can maintain a small computational overhead. For
example, the whole process of post-training for ResNet50, VGG16 and AlexNet
models on CIFAR-10 dataset take about 21, 4 and 1 minutes, respectively.
Considering the long runtime for conventional training of these models (340,
60, and 17 minutes), FitAct only adds around 5.9% to 6.7% extra runtime
overhead.

TABLE I: Runtime and memory space overheads (O/H) when deploying resilient DNN
with FitAct in the inference stage.

| Runtime (ms) | Memory (Mb)
---|---|---
| ReLU | FitAct | O/H | ReLU | FitAct | O/H
CIFAR-10 | ResNet50 | 9.820 | 10.869 | 10.68% | 156.69 | 165.05 | 5.34%
VGG16 | 5.324 | 5.600 | 5.18% | 29.60 | 30.46 | 2.91%
AlexNet | 3.037 | 3.175 | 4.54% | 23.53 | 23.68 | 0.64%
CIFAR-100 | ResNet50 | 9.877 | 10.974 | 11.11% | 156.70 | 165.10 | 5.36%
VGG16 | 5.178 | 5.487 | 5.97% | 29.65 | 30.47 | 2.77%
AlexNet | 3.001 | 3.224 | 7.43 % | 23.53 | 23.69 | 0.68%

####  VI-C2 Inference Step

Compared to the original ReLU, FitReLU (Equation 6) costs more computation and
needs extra memory space to store the bound values $\lambda_{1}$ to
$\lambda_{N}$. Table I presents the time and memory space overheads of FitAct
for various models and datasets in the inference step. Since most of the
computations and memory storage happen in the convolutional and fully
connected layers, the overheads introduced by FitAct is manageable. Shown in
Table I, the runtime overheads are less than 12% and the memory space
overheads are less than 6%.

##  VII Conclusion

In this paper, we have proposed FitAct, a framework to build low-overhead
error-resilient DNNs by deploying fine-grained post-trainable activation
functions. First, we have proposed a fine-grained, trainable, neuron-wise
activation function called FitReLU to precisely bound the activation value of
each neuron, so as to prevent the fault propagation in the network. Second, we
have developed a lightweight post-training phase to learn all these activation
functions with precise bound values, which is decoupled from the conventional
training for model accuracy. Finally, we have conducted a wide range of
experiments using fault simulation and confirmed the effectiveness and
advantages of our FitAct framework in enhancing the error resilience for
widely used DNN models.

## Acknowledgements

We acknowledge the support from Government of Canada Technology Demonstration
Program and MDA Systems Ltd; NSERC Discovery Grant RGPIN341516,
RGPIN-2019-04613, DGECR-2019-00120, Alliance Grant ALLRP-552042-2020, COHESA
(NETGP485577-15), CWSE PDF (470957); CFI John R. Evans Leaders Fund; Simon
Fraser University New Faculty Start-up Grant.

## References

  * [1] Miotto et al., “Deep learning for healthcare: review, opportunities and challenges,” _Briefings in bioinformatics_ , vol. 19, no. 6, pp. 1236–1246, 2018.
  * [2] Grigorescuet al., “A survey of deep learning techniques for autonomous driving,” _Journal of Field Robotics_ , vol. 37, no. 3, pp. 362–386, 2020\.
  * [3] Shafique et al., “Robust machine learning systems: Challenges, current trends, perspectives, and the road ahead,” _IEEE Design & Test_, vol. 37, no. 2, pp. 30–57, 2020.
  * [4] S. Mittal, “A survey on modeling and improving reliability of dnn algorithms and accelerators,” _JSA_ , vol. 104, p. 101689, 2020.
  * [5] Mahmoud et al., “Hardnn: Feature map vulnerability evaluation in cnns,” _arXiv preprint arXiv:2002.09786_ , 2020.
  * [6] Li et al., “Understanding error propagation in deep learning neural network (dnn) accelerators and applications,” in _SC 2017_ , pp. 1–12.
  * [7] Libano et al., “Selective hardening for neural networks in fpgas,” _IEEE TNS_ , vol. 66, no. 1, pp. 216–222, 2018.
  * [8] Sabih et al., “Fault-tolerant low-precision dnns using explainable ai,” in _DSN-W 2021_. IEEE, pp. 166–174.
  * [9] Hari et al., “Making convolutions resilient via algorithm-based error detection techniques,” _IEEE TDSC 2021_.
  * [10] Dos et al., “Analyzing and increasing the reliability of convolutional neural networks on gpus,” _IEEE TR_ , vol. 68, no. 2, pp. 663–677, 2018\.
  * [11] Kosaian et al., “Arithmetic-intensity-guided fault tolerance for neural network inference on gpus,” _arXiv preprint arXiv:2104.09455_ , 2021.
  * [12] Dias et al., “Ftset-a software tool for fault tolerance evaluation and improvement,” _Neural Computing and Applications_ , vol. 19, no. 5, pp. 701–712, 2010.
  * [13] Schorn et al., “An efficient bit-flip resilience optimization method for deep neural networks,” in _DATE 2019_. IEEE, pp. 1507–1512.
  * [14] Nwankpa et al., “Activation functions: Comparison of trends in practice and research for deep learning,” _arXiv preprint arXiv:1811.03378_ , 2018.
  * [15] Liew et al., “Bounded activation functions for enhanced training stability of deep neural networks on visual pattern recognition problems,” _Neurocomputing_ , vol. 216, pp. 718–734, 2016.
  * [16] Chen et al., “A low-cost fault corrector for deep neural networks through range restriction,” in _DSN 2021_. IEEE, pp. 1–13.
  * [17] Hong et al., “Terminal brain damage: Exposing the graceless degradation in deep neural networks under hardware fault attacks,” in _USENIX Security 2019_ , pp. 497–514.
  * [18] Hoang et al., “Ft-clipact: Resilience analysis of deep neural networks and improving their fault tolerance using clipped activation,” in _DATE 2020_. IEEE, pp. 1241–1246.
  * [19] Ali et al., “Erdnn: Error-resilient deep neural networks with a new error correction layer and piece-wise rectified linear unit,” _IEEE Access_ , vol. 8, pp. 158 702–158 711, 2020.
  * [20] Motors, Tesla, “Full self-driving hardware on all cars,” 2019. [Online]. Available: https://www.tesla.com/autopilot
  * [21] Kim et al., “Matic: Learning around errors for efficient low-voltage neural network accelerators,” in _DATE 2008_. IEEE, pp. 1–6.
  * [22] Jia et al., “Calibrating process variation at system level with in-situ low-precision transfer learning for analog neural network processors,” in _DAC 2018_ , pp. 1–6.
  * [23] Mhamdi et al., “When neurons fail,” _arXiv preprint arXiv:1706.08884_ , 2017\.
  * [24] Zahid et al., “Fat: Training neural networks for reliable inference under hardware faults,” in _ITC 2020_. IEEE, pp. 1–10.
  * [25] Krizhevsky et al., “Imagenet classification with deep convolutional neural networks,” _NIPS 2012_ , vol. 25, pp. 1097–1105.
  * [26] Arora et al., “Understanding deep neural networks with rectified linear units,” _arXiv preprint arXiv:1611.01491_ , 2016.
  * [27] Apicella et al., “A survey on modern trainable activation functions,” _Neural Networks_ , 2021.
  * [28] Kingma et al., “Adam: A method for stochastic optimization,” _arXiv preprint arXiv:1412.6980_ , 2014.
  * [29] Reagen et al., “Ares: A framework for quantifying the resilience of deep neural networks,” in _DAC 2018_. IEEE, pp. 1–6.