1 Introduction

Normalization with mean and variance is a noise/error compensation method that is used in many applications such as signal, image and speech processing, artificial intelligence, big data, optimization algorithms and so on (Scalco et al. 2020; Song et al. 2020; Xu et al. 2020). One of the compensation techniques is Batch normalization (BN) method to develop performance and stability of neural networks by rescaling values of hidden layer units and also to create more complicated deep learning models. One of the critical problems is the covariate shift in the learning process for deep learning models. To solve this problem, BN is proposed in 2015 (Ioffe and Szegedy 2015). Besides, Cepstral mean and variance normalization (CMVN) (Joshi et al. 2016) is used to eliminate noise inside voice for speech processing applications. CMVN is a critical method for recognizing voice instructions to minimize the data lost for messages during normalization.

Noise in the image is a general problem for image processing applications (Hong et al. 2020). It is also hot topic in computer vision and image processing. Many techniques based on image de-noising model have been developed to overcome this problem (Islam et al. 2018; Huber et al. 2021; Noor et al. 2020). In most studies, researchers firstly add noise (especially Gaussian noise) with different noise ratios to the original image, then they design deep CNNs to enhance image de-noising performance (speed, quality and cost) and efficiency (Zhang et al. 2017). Some of these techniques consists of CNN with BN (Tian et al. 2020), image restoration by applying ResNet (Ren et al. 2019), several traditional linear and non-linear image filter techniques (Motwani et al. 2004).

Deep Normalized Convolutional Neural Network (DNCNN) is developed for unbalanced classifications of neural networks and constructed based on ReLU and weight normalization strategy. In (Jia et al. 2018), ReLU is employed as an activation function to overcome the gradient vanishing problem and enhance the optimization by using the parameters (weight, bias) normalization strategy (Nair and Hinton 2010). Weight Normalization (WN) is used to accelerate the convergence of stochastic gradient descent optimization in a neural network. In Salimans and Kingma (2016), WN is applied to show benefits of this technique in four different NN models. WN method is also used for image smoke detection in Yin et al. (2017). The result of this study shows that false alarm ratio is achieved under 0.60% and smoke detection accuracy is around 96.37%.

CNN models have been constructed in many different ways (Saponara et al. 2021; Supraja et al. 2021) for image processing (such as image segmentation, classification and de-noising), but still there are many challenge during image processing. These models require amounts of parameters (image size, weights, and bias, etc.) and lots of convolution operations in the training and inference process (Köpüklü et al. 2019; Nayak et al. 2020; Yamashita et al. 2018; Agrawal and Choudhary 2021). This has inspired many researchers to focus their attention on more hardware platforms with energy-efficiency (Duan et al. 2018; Pang et al. 2020).

Field Programmable Gate Array (FPGA) is a vital side for implementation of CNN models due to its hardware adaptability and parallel process capability. On the other hand, General Processing Units (GPUs) supply more resources in terms of memory and computational units. But, during the validation process, GPUs have a long execution time because of sequential logic design (Wang et al. 1999; Zhijie et al. 2020). FPGA has parallel architectures on its logic configuration. This feature makes it better choice for hardware designers because of the validation process of CNN configurations. At the implementation stage of CNN models, normalization process ensures fewer number of hardware resources and reduced power consumption during the training and validation processes on any hardware platforms (Wang et al. 1999; Zhijie et al. 2020; Nurvitadhi et al. 2016; Baptista et al. 2020).

COVID-19 is a pandemic disease, and it can threaten the health of all people in the world. It directly attacks the lung cells, and if not diagnosed early, can cause damage, including mortality. Therefore, in this paper a new normalization algorithm that consists of MVSR (named as acronym of Mean–Variance-Softmax-Rescale) processes respectively is proposed. Mean and Variance techniques have generally been used for noise recompense in signal processing (especially speech) applications to eliminate the mismatch between training and test signals by changing to zero mean and unit variance (Subramanian et al. 2021). In order to show effect of MVSR on image processing, the proposed algorithm is applied to chest X-ray and CT images to provide facilitation pre-assessment and diagnosis Covid-19 disease. Therefore, the normalized X-ray images with MVSR are used to recognize Covid-19 virus via one of the neural network models as known Convolutional Neural Networks (CNNs). At the implementation stage, the MVSR algorithm is executed on MATLAB, then it is implemented on FPGA platform. The experimental platform consists of Zynq-7000 Development Board and VGA monitor to display the both original X-ray and MVSR normalized image. The CNN model is constructed and executed using Anaconda Navigator interface with python language.

The rest of the paper is organized as follows. The architecture, mathematic of the MVSR normalization technique and its necessity are detailed in Sect. 2. In Sect. 3, the MATLAB pre-study is accomplished for observing the effect of proposed normalization algorithm on chest X-ray images. Section 4 consists of FPGA implementation of MVSR normalization technique and the experimental results for chest X-ray images on VGA screen. Then, in Sect. 5, the architecture of CNN model is constructed and the implementation of image classification (diagnosis of Covid-19 disease) for original and normalized chest X-ray images are executed on Anaconda Navigator interface with python language to prove the benefits of proposed MVSR normalization algorithm. Section 6 concludes the paper.

2 MVSR Normalization Algorithm

In general, the standard deviation (the square root of the variance) is used to make a relation between each data and measure how to spread out or distribute around the mean of a data set (Singh and Singh 2020). The MVSR normalization is built on these features of mathematical operations, which are include four-part processes as fallows;

  • Mean

  • Variance

  • Softmax

  • Rescaling of the data, respectively.

According to R. Duncan Luce's probability theory, it is also known as Luce's choice axiom, probability of one of the sample is dependent on another sample in the same data set. The softmax function, based on Luce's choice axiom, is usually employed in the last activation function of multiclass Artificial Neural Network (ANN) models to make a probability distribution of the output classes (Angelov and Soares 2020). After calculation of the normalized intensity of the input, the dataset can have the negative and the positive fractional numbers. In order to conserve the effect of negative data and also nonlinearity, we used the softmax function. it is one of the main contributions to the state of the art this paper proposes. In the rescaling step, all data is transformed to 8-bit unsigned integer intervals change from 0–1 to 0–255. The MVSR normalization technique consists of following mathematical processes where \({\mu }_{MVSR}\),\({\sigma }_{MVSR}^{2}\), \({\widehat{x}}_{i}\), \(S{(x)}_{i}\) and \({r}_{i}\) stand for mean of \({x}_{i}\), variance, the normalized intensity of the input, softmax and rescaled values, respectively.

$$ \mu_{MVSR} = \frac{1}{M}\mathop \sum \limits_{i = 1}^{M} x_{i} $$
(1)
$$ \sigma_{MVSR}^{2} = \frac{1}{M}\mathop \sum \limits_{i = 1}^{M} \left( {x_{i} - \mu_{MVSR} } \right)^{2} $$
(2)
$$ \hat{x}_{i} = \frac{{\left( {x_{i} - \mu_{MVSR} } \right)}}{{\sqrt {\sigma_{MVSR}^{2} + {\varvec{\delta}}} }} $$
(3)
$$ S \left( x \right)_{i} = \frac{{e^{{\hat{x}_{i} }} }}{{\mathop \sum \nolimits_{j} e^{{\hat{x}_{j} }} }} $$
(4)
$$ r_{i} = \frac{{S \left( x \right)_{i} }}{{{\text{max}}\left( {S \left( x \right)_{i} } \right)}}*255 $$
(5)

In the normalized intensity value of the input (\({\widehat{x}}_{i}\)), a small positive number (\(\delta )\) is added to the variance value to avoid the divisor is to be zero. In the equations above, \({x}_{i}\) is the input data intensity and \({r}_{i}\) is the result of MVSR normalization technique.

The MVSR normalization architecture is given in Fig. 1. The mathematical operations are executed in order to represented flow. The chest X-ray images are used in the MVSR algorithm as input variables and later, the normalized input images are applied to the CNN model to make a classification.

Fig. 1
figure 1

MVSR architecture

In the pre-study, the proposed normalization algorithm is executed on MATLAB program to observe the effect of MVSR normalization for Covid-19 disease diagnosis from chest X-ray and CT images. Chest X-ray images of Covid-19 infected and No-Finding are represented after and before MVSR normalization in the Fig. 2. The sources, chest X-ray and CT images datasets, which has been generally used in the literature, are publicly available from Hospital Israelita Albert Einstein (Sertaç et al. 2019; Kingma and Ba 1412). According to the expert view, Infectious Diseases Doctor, the infection is more clearly observed after applying the MVSR normalization techniques on chest X-ray images. At this stage, the starting point of this study is based on this view and this normalization process is thought to be used in image classification applications. The accuracy of Covid-19 diagnose is increased by using the proposed MVSR normalization technique before training process for the neural network models. The rest of the paper is based on this projection.

Fig. 2
figure 2

a, c Are original chest X-ray images while b, d are the normalized versions of a, c

The proposed MVSR normalization technique is applied to both the Chest X-ray and the SARS-CoV-2 CT computed tomography datasets and the results obtained are shown in Figs. 2 and 3. When comparing the normalized image with the original image, it is clearly seen that the proposed normalization increases the quality of the images and facilitates the detection of infected regions.

Fig. 3
figure 3

a, c Are original Sars-Cov-2 scan images while b, d are the normalized versions of a, c

MVSR normalization technique used on the data sets via the MATLAB program for the pre-phase. This process was taken as a reference to design the FPGA-based MVSR normalization technique. In order to show benefit of the MVSR normalization, more images are normalized and presented in Fig. 4.

Fig. 4
figure 4

a, c Are original chest X-ray images while b, d are the normalized versions of a, c

3 MVSR Normalization on FPGA

In order to apply the proposed MVSR normalization algorithm, the operations, standard deviation, mean, and variance are required to calculate in sequence. To obtain these operations, we need to define real numbers as a fixed point number type for embedded systems or any hardware languages. Multiplication, division, addition, subtraction, and especially square root calculations are essential mathematical arithmetic operations to execute proposed MVSR normalization technique on FPGA platform. MVSR normalization is implemented by using a static random access memory (SRAM) on re-programmable FPGA. All the data is read from SRAM and defined arrays. Systolic arrays are used for these operations to perform parallel integrations such as convolution, correlation, linear algebra or additional data tasks (Angelov and Soares 2020). All normalization processes are constructed with pure VHDL language at Vivado 2018.1 version.

3.1 Division of the fixed-point fractional binary numbers

Division is one of the important operation to calculate standard deviation, mean, and variance. Fixed-point fractional number format is a way to represent fractional numbers. The fixed point division process is slightly different from the standard binary division operation. It is needed to scale the fractional part of the division after finding the remainder (Schwab et al. 2020).

figure a

The LUT_operation consists of lookup table to provide programmable hardware functionality for division operation and to validate remainder values by matching against a list of valid items in the array. The values stored in LUT are in the unsigned fractional fixed point binary numbers. For example, when the nReminder is equal to “00,010,110” (stands for 0.22 in decimal), mRemainder is "00,111,000" in 8-bit format.

3.2 Square root of the fixed-point fractional binary numbers

This section represents calculating the fixed-point square root. Square root of the fixed point binary numbers is essential to have normalized input data with standard deviation from variance operation in the MVSR operation. After making the groups of data by 2n (n = 1, 2… m, m = data size/2), it is gradually compared with the multiplied expected data. If the group of the data is smaller than expected, the result is equal to 1, vice versa 0.

figure b

The FPGA implementation platform where Xilinx Zynq-7000 Development Board is used to implement the MVSR normalization algorithm for input images and VGA monitor to display the both original and MVSR normalized image.

Results of FPGA implementation of MVSR normalization algorithm is given in Fig. 5. As seen in this figure, the algorithm is implemented on FPGA board and the results are shown on VGA monitor successfully. The main result of FPGA implementation stage is that the X-ray image can be normalized on FPGA and the expert views support our opinions on the starting point of this study.

Fig. 5
figure 5

FPGA implementation of MVSR normalization and the results for chest X-ray images on VGA screen

In the Table 1, information about resource utilization of FPGA implementation stage of the present study is shown. This result shows that the MVSR normalization algorithm is performed on FPGA chip with the fewer number of resource.

Table 1 Resource utilization of FPGA Chip

4 Proposed CNN architecture and results obtained

The architecture of the CNN model is constructed with seven convolutional layers and five max-pooling layers and this model can be seen in Table 2. This model is executed for original and MVSR normalized chest X-ray images on Anaconda Navigator interface with python language to prove the benefits of the proposed MVSR normalization algorithm.

Table 2 CNN architecture

There are four-type of prediction approaches, four distinct combinations of predicted and actual values, to evaluate results of classification model via confusion matrix (Zeng 2020; Wu et al. 2019). These are True Positives (TP), True Negatives (TN), False Positives (FP) and False Negatives (FN).

  • TP: These are the people who are diagnosed with Covid-19 infection by clinical tests and the CNN model validates them as Covid-19 infected.

  • TN: These are the people who are not diagnosed with Covid-19 disease by clinical tests and the CNN model validates them as not infected.

  • FP: These are the people who are not diagnosed with Covid-19 disease by clinical tests but the CNN model classified them as Covid-19 infected.

  • FN: These are the people who are diagnosed with Covid-19 disease by clinical tests but the CNN model classified them as not infected.

F1-score is the harmonic mean of the Precision and Recall. Therefore, f1-score gives a combined idea of these two measurements. F1-score is maximum when the Precision is equal to Recall. The precision determines whether the model is reliable or not. Prediction according to the model, the recall is given how many true positive cases are accurately predicted.

Precision; It counts how precise the executed model operates by examining TP from the predicted ones

$$ P = \frac{{T_{P} }}{{\left( {T_{P} + F_{P} } \right)}} $$
(6)

Recall (Sensitivity); It is the percentage of recognition of positive samples

$$ R = \frac{{T_{P} }}{{\left( {T_{P} + F_{N} } \right)}} $$
(7)

F-1 Score; It is a function to find a balance between sensitivity and precision.

$$ F1 = \frac{2}{{\left( {\frac{1}{R} + \frac{1}{P}} \right)}} $$
(8)

The results of the f1-scores given in Table 3, performed with original chest X-ray and MVSR normalized images, the normalized images perform the better F1-Score (accuracy).

Table 3 Obtained F1-scores

Figure 6 shows the confusion matrix of models, which are trained with original and MVSR normalized images. This matrix demonstrate how the CNN models classify and misclassify Covid-19 disease on chest X-ray images. Furthermore, the precision, recall and f1-score can be easily computable by using confusion matrix.

Fig. 6
figure 6

Confusion Matrix

Table 4 briefly compares our proposed model with the other studies in terms of accuracy, which is found from recall and precision. Although the studies in the literature use transfer-learning, many pre-processing algorithms and traditional big machine learning models, the proposed model has higher classification accuracy by using the simple model and low execution time with less learning parameters. Before normalization, the other studies can have better results but when applying the MVSR normalization to Chest and CT images, the results of our model are better than in the studies of the literature, which are presented in Table 4.

Table4 Normalization techniques used for the detection of COVID-19 patients in literature

5 Conclusion

In this paper, we propose a novel method, the MVSR normalization architecture, to facilitate pre-assessment of Covid-19 disease from Chest X-ray and CT images. The datasets are contained 2482 CT scan slices and 465 Chest X-ray images. The effectiveness of this new normalization technique is proved by using different evaluation methods, which include expert view, MATLAB, Anaconda Navigator interface and all the arithmetic operations of the MVSR normalization are coded in VHDL language with the help of the fixed-point fractional number representation format for FPGA embedded system. The proposed MVSR normalization technique increase the accuracy of the CNN model from 83.01, to 96.16% on chest X-ray images. In summary, the proposed normalization algorithm has the following benefits:

  1. (i)

    MVSR normalization considerably improves the accuracy of the CNN model and according to expert view, the difference of Covid-19 infected and uninfected CT and X-ray images can be seen more clearly at the pre-assessment stage.

  2. (ii)

    MVSR normalization can be applied to complex images like CT and chest X-ray images for recognizing the difference between infected and uninfected patients with Covid-19.

  3. (iii)

    Covid-19 disease can be efficiently diagnosed for MVSR normalized image.

Main contributions to the state of the art this paper proposes,

  1. (i)

    The proposed normalization algorithm enhances the accuracy of the CNN model. Infected and uninfected regions can be seen more clearly on CT and X-ray images.

  2. (ii)

    The softmax function is to be the conserved effect of negative values and nonlinearity after applying mean and variance operations on every image.

  3. (iii)

    The proposed algorithm is implemented on the FPGA platform. The covid-19 virus can be diagnosed on an independent embedded platform by using this experimental platform.