# Efficient Learning of Healthcare Data from IoT Devices by Edge Convolution Neural Networks +
## 3 ECG Diagnosis Model Based on Edge Cloud Intelligent Medical Architecture
### Diagnosis Model for Agile Learning in EdgeCNN  
Although some of the research based on deep learning algorithms have been able to perform electrocardiogram diagnostics well, their models are too complex to be deployed on edge devices for low latency diagnosis. Diagnosis cannot effectively promote the popularization of home-based smart medical. In this section, we introduce a model that can effectively trade off between accuracy and complexity so that it can be deployed on smart devices to perform low latency ECG diagnosis for users. The general structure of our model is shown in Figure 2. This is a convolutional neural network with five convolutional layers and one fully connected layer. Since the length of the ECG signal in the dataset is different, we preprocess the original data, splitting the ECG data and inputing the model with one-dimensional data. The data are batched into the CNN network, a convolution operation is performed on the input data using a \(1\times 5\) convolution kernel and the offset value is added after this. Figure 2: The proposed neural network architecture. To enhance the generalization of the network and enable rapid convergence of model training, we use batch-normalization (BN) [32] to normalize the data after each convolution. The BN can normalize input sample features to make the data be distributed with a mean of 0 and a standard deviation of 1. If we do not normalize the data, due to the scattered distribution of the sample features, the neural network will learn slowly or even have difficulty learning. The formula for data normalization is given in Equation (1):  
\[\hat{x}^{(k)}=\frac{x^{(k)}-E[x^{(k)}]}{\sqrt{Var[x^{(k)}]}}, \tag{1}\]  
where \(x^{(k)}\) represents the \(k\)th dimension of the input data, \(E[x^{(k)}]\) represents the average of the dimensions and \(\sqrt{Var[x^{(k)}]}\) represents the standard deviation. However, if it is done simply, it will reduce the layer of expression. Thus, BN adds two parameters (\(\gamma\) and \(\beta\)) to maintain the expressiveness of the model. The form is Equation (2):  
\[y^{(k)}=\gamma^{(k)}\hat{x}^{(k)}+\beta^{(k)}. \tag{2}\]  
Rectified linear activation (ReLU) [33] can save computational complexity, alleviate overfitting problems to a certain degree and obtain faster convergence than other activation functions. For ReLU functions, the formula is Equation (3):  
\[ReLU(x)=max(0,x). \tag{3}\]  
Its function is to make the calculated value equal to 0 if it is less than 0, otherwise it remains the same. It has been proven in practice that the trained network is fully moderately sparse. The visualized training results are similar to the pre-trained results of the traditional methods. This also shows that ReLU has the ability to guide moderate sparseness. The pooling layer can reduce the parameters and calculations while retaining the main features, prevent over-fitting and improve the model's generalization ability. The model uses \(1\times 2\) average pooling, which averages the two values in the domain. This can reduce the error of the increase in the variance of the estimate caused by the limited size of the neighborhood. The fully connected layer converts the output from the convolutional layer into a \(n\times T\) vector. Each number corresponds to a category (N, A, O or \(\sim\)). Finally, softmax is used to obtain the most likely prediction result. The performance of softmax is Equation (4):  
\[S_{i}=\frac{e^{V_{i}}}{\Sigma_{j}e^{V_{j}}}, \tag{4}\]  
where \(V_{i}\) represents the i-th element in the array \(V\). When a sample passes through the softmax layer and outputs a vector of \(1\times T\), the index of the one with the highest value in the vector is taken as the prediction label of the sample. However, actual ECG data are generated continuously over time and are not similar to fixed-length ECG data when training models. The actual process of real-time diagnosis is abstracted as Algorithm 1. We note that the time series data generated during a certain period of time are set \(X=\{x_{1},x_{2},\cdots,x_{n}\}\).