Intelligent spectrum sensing algorithm for cognitive internet of vehicles based on KPCA and improved CNN

With the acceleration of economic globalization and integration, the global trade is becoming more frequent, which promotes the vigorous development of transportation industry. In recent years, the Internet of Vehicle (IoV) has developed rapidly in the transportation industry, and the number of IoV users has exploded. The requirements for IoV communication services are very high, resulting in the lack of spectrum resources. Rather than utilizing traditional spectrum resource allocation methods, cognitive radio technology makes full use of idle frequency bands, improving the IoV communication spectrum’s utilization rate. Spectrum sensing is the primary link to realize a cognitive radio. However, IoV mobile communication environment is characterized by complexity, dynamism, and substantial noise interference, thus imposing significant challenges to spectrum sensing. Thus, this paper proposes an intelligent spectrum sensing algorithm based on kernel principal component analysis (KPCA) and an improved convolutional neural network (CNN). Since the wireless signal cannot distinguish the signal and noise linearly, KPCA maps the sampled signal to a high-dimensional space, creates a covariance matrix, and obtains eigenvector data of the signal and noise through matrix decomposition. A spectrum sensing classifier based on improved CNN is proposed, and the dynamic threshold is obtained via offline training. Compared with the traditional algorithm, the designed deep CNN improves the model’s training speed, enables parameter sharing, and reduces the number of model parameters, effectively reducing the computational complexity. Additionally, due to the extracted signal feature’s small dimension, the algorithm reduces the number of pooling layers and avoids the effective features’ loss, thus increasing the detection probability. Finally, the proposed algorithm achieves a 10% higher sensing accuracy than support vector machine (SVM), Elman, and LeNet5 algorithms, signaling its robustness.


Introduction
With the development of global economic integration, international exchanges and international trade become more frequent, which also promotes the economic exchanges of various countries [1].For a long time, the transportation industry has been the main support for the development of global economy and trade.The development of mobile wireless communication technology and the rise of the fifthgeneration (5G) mobile communication have promoted the vigorous development of transportation industry [2].Among other advances, 5G mobile communication has promoted intelligent transportation systems, which can improve road safety and transportation efficiency.Internet of Vehicles (IoV) is a critical aspect of an intelligent transportation system that combines advanced technologies such as computer technology, mobile wireless communication, and artificial intelligence [3]. Figure 1 shows the main applications of the current IoV networks.In IoV networks, car drivers can reduce traffic accidents via speeding warnings, reverse driving warnings, and emergency braking.In addition, vehicle information can be sent to the cloud, thus providing quick information services for individuals or enterprises and easing traffic congestion.Furthermore, the IoV networks can utilize an information management platform to realize intelligent parking, intelligent management of traffic lights, and intelligent vehicles' scheduling.
The introduction of 5G has advanced numerous wireless communication applications and has brought significant opportunities for IoV development.Consequently, more and more automotive devices connect to the IoV, but the demand for spectrum resources introduced immense challenges to the IoV networks.Several researchers tackled the related problems.For example, Liu et al. developed a novel millimeter-wave communication system that allows spectrum sharing among users [4].However, the traditional (i.e., static) spectrum allocation method allocates fixed frequency segments to specific users and fails to meet the spectrum resources demand in the 5G IoV networks.Therefore, rational and efficient management of spectrum resources is one of the major challenges to be resolved in the era of 5G IoV networks.Cognitive radio (CR) is the most promising technology for mitigating spectrum utilization issues.Specifically, applying the CR technology to the 5G IoV networks can effectively alleviate the poor spectrum utilization.Tashman and Hamouda outlined future research directions for cognitive radio [5], whereas Hasan and Marina analyzed the problem of spectrum sharing [6].Pei et al. tackled the spectrum sharing problem by proposing a Q-learning energy threshold optimization algorithm [7].The arrival of 5G provided great development opportunities for the IoV and big data.Liu et al. [8] proposed intelligent spectrum sensing for 5G heterogeneous IoV networks in a big data environment.Lee et al. adopted a nonlinear combining scheme to handle the noise in spectrum sensing, improving the detection performance [9].In [10], Gharib et al. proposed a There is extensive literature on machine learning (ML) applications in spectrum sensing.The ML algorithms in spectrum sensing typically proceed in two broad steps: offline learning and online detection.In [11], Zhang et al. proposed a fast Riemann distance spectrum sensing method to verify the ML method's effectiveness.Shi et al. proposed using an unsupervised learning algorithm (specifically, K-means clustering) for cooperative spectrum sensing, reducing the complexity of traditional sensing models in [12].In [13], Xu et al. used Bayesian learning to improve the sensing efficiency by realizing the collaboration between multiple secondary users.Although numerous, the traditional spectrum sensing algorithms have several limitations.For example, energy detection is simple and easy to implement, but it is easily affected by the signal-tonoise ratio (SNR) and can only detect a signal's presence without making a further judgment on its type.The matching filter detection algorithm relies on prior information regarding the transmitted signals, but the prior information is generally difficult to obtain.Finally, the cyclostationary feature detection algorithm requires calculating the circulating spectral density of transmitted signals, thus having high computational complexity.Furthermore, these methods are sensitive to the threshold value, which greatly affects the sensing accuracy.
The ML methods mitigate several shortcomings of the traditional methods.Nevertheless, these methods have limitations as well.K-means clustering is sensitive to abnormal data and has a high computational complexity.In each classification, the Euclidean distance of every data point should be calculated, which is difficult to apply to 5G big data.Naive Bayes cannot capture the correlations between features, resulting in feature data redundancy.The decision tree algorithm has low flexibility and does not support the online learning process.Further, the model needs to be rebuilt every time the sample data are updated, which is cumbersome.
Due to its superior learning characteristics, deep learning has been widely used in the mobile wireless communication domain.For example, Zerhouni et al. used deep learning to study the classification of filtered multi-carrier waveforms [14].Further, Cao et al. employed a convolutional neural network (CNN) to deal with intelligent security monitoring [15], while Xu et al. use it to predict the security performance [16].Therefore, applying CNN to cognitive IoV networks presents a new way of realizing intelligent spectrum sensing.
There are few studies related to intelligent spectrum sensing in cognitive IoV networks.This work investigates the cognitive IoV networks and proposes an intelligent spectrum sensing algorithm based on kernel principal component analysis (KPCA) and improved CNN to enhance the spectrum sensing accuracy and spectrum utilization rate under low SNRs.The main contributions of this paper can be summarized as follows: The mobile IoV networks are characterized by a complex and changeable communication environment in which signal and noise cannot be linearly distinguished.Thus, the KPCA algorithm is employed to map the sampled mobile wireless signals to a higher dimensional space.First, the appropriate kernel function matrix is selected based on the mobile wireless signals' characteristics, and then the signal and noise features with higher accuracy are obtained through matrix decomposition.
Aiming at the traditional methods' sensitivity to threshold settings and lack of prior information, this paper designs an improved CNN model and proposes an intelligent spectrum sensing algorithm for cognitive IoV networks.The proposed algorithm employs the improved CNN as a spectrum sensing classifier, which obtains the dynamic threshold value through offline training.Then, the spectrum sensing results are obtained through online testing, improving the spectrum sensing accuracy.
Based on the structural characteristics of the sampled signal data in the cognitive IoV networks, the designed CNN structure includes two convolution layers, one pooling layer, and three fully connected layers.CNN can be modeled flexibly using different channel states.Compared with the traditional ML algorithms, the CNN model's training speed is improved, and parameter sharing can be achieved, reducing both the number of CNN parameters and computational complexity.Additionally, based on the small dimension of the extracted signal features, the number of pooling layers is reduced, avoiding the loss of effective features and achieving a high detection probability.
The proposed spectrum sensing algorithm was tested under two modulation modes and seven SNRs.The results demonstrate that utilizing the algorithm increases the sensing accuracy by approximately 10% compared with the support vector machine (SVM), Elman, and Lenet5 algorithms.The proposed algorithm has good robustness in spectrum sensing.
The remainder of this paper is organized as follows.Section 2 introduces the related work, whereas Section 3 introduces the modeled system's implementation.The proposed algorithm is presented in Section 4. Section 5 discusses the simulation results.Finally, Section 6 concludes the paper by summarizing the work's contributions.

Relevant work
The IoV networks developed rapidly with the rise of 5G technology, and the related problem regarding the spectrum resource shortage can be mitigated using CR technology.
Therefore, the research on CR technology has attracted a large number of scholars.For example, Fang et al. demonstrated the effectiveness of CR technology [17].Qin and Li reviewed the advances in CR technology for intelligent communication and summarized the relevant challenges [18].Liu et al. combined CR with non-orthogonal multiple access (NOMA) to improve sensing accuracy [19].Shruti and Rakhee proposed a new spectrum access mechanism to improve network resource utilization [20].Xiao et al. developed an incentive mechanism, which enables spectrum resource sharing in heterogeneous IoV networks [21].Hamedani et al. introduced a spectrum sensing system employing the spiking delayed feedback reservoir [22].Joshi et al. used a discontinuous wideband spectrum sensing method to improve throughput [23].Gu et al. improved the sensing accuracy via dynamical threshold setting [24].Javaid et al. introduced signal correlation factors into the traditional energy detection threshold [25].In [26], Shi et al. analyzed the spectrum access systems to ensure their security and privacy against attacks.The spectrum sharing strategy in satellite systems was proposed by Wang et al. [27].Wang et al. presented a sensing method with multiple highorder cumulants [28].Liu et al. designed a dynamic spectrum access scheme to improve spectrum utilization [29].Building on the mobile wireless signals' sparsity, Xu et al.
proposed a new compression signal algorithm to improve the spectrum sensing detection performance [30].However, the discussed method is based on the traditional method and does not eliminate the impact of the threshold value on the sensing accuracy.
The rise of ML significantly advanced spectrum sensing technology.Zhou et al. demonstrated the feasibility of combining CR and ML for realizing intelligent wireless communication [31].Khalek and Hamouda highlighted key challenges and future directions for applying ML methods to cognitive networks [32].Yang et al. used simulation experiments to prove the effectiveness of applying ML in CR [33].Building on the vehicle-to-vehicle communication standard, Mollah et al. proposed a reward mechanism to encourage sharing between cellular networks and vehicle users [34].Finally, in [35], Rathee et al. employed the blockchain and CR to improve the IoV safety service performance.
With the popularization of 5G technology, the number of vehicle users accessing the network increases rapidly.The excessive user information, in turn, increases the difficulty and complexity of the ML model training, finally leading to data redundancy, longer training time, and reduced sensing efficiency.Deep learning has a good performance in multidimensional data classification (e.g., image classification), and CNN is successful in processing low-dimensional data (e.g., wireless signals).Therefore, this paper proposes a cognitive IoV spectrum sensing algorithm based on KPCA and improved CNN.

System model
The cognitive IoV network model is presented in Fig. 2. Here, PU stands for "authorized vehicle," and SU denotes a "cognitive vehicle."The base station and PU communicate through a specific frequency band, and the SU makes spectrum sensing judgments.More precisely, spectrum sensing refers to the cognitive vehicle judging whether an authorized vehicle is communicating in a certain frequency band of interest.Formally, the process is written as follows: where H 0 and H 1 represent the existence and absence of "authorized vehicle," respectively.Further, x(t) denotes the discrete sampling signal sequence received by the receiver, h(t) is the channel gain of the N-Nakagami fading channel, and s(t) stands for the signal data sent by the transmitter.Finally, n(t) conforms to the Gaussian distribution N(0, 2 ).
Based on the acquired signal vector, one needs to calculate the statistical vector T. The spectrum sensing judgment is made by comparing T and the empirical value .If T >  , it is determined that the authorized vehicle uses this frequency band.Otherwise, it is judged that the cognitive vehicle can utilize the frequency band.T is calculated as The critical indicators of spectrum sensing are detection probability (denoted by P d ), missed detection probability (P m ), and false alarm probability (P f ).If the precondition is H 1 , P d follows the formula Similarly, if the precondition is H 0 , P f is given as Finally, if the precondition is H 1 , P m is Following the outlined analysis, the empirical value has a decisive influence on the detection probability.To prevent such an influence, this work proposes an intelligent spectrum sensing algorithm for cognitive IoV networks based on KPCA and CNN, which does not require setting the detection threshold (i.e., ).The proposed algorithm makes full use of the original information in the sampling signal and (1) improves the cognitive users' access to the cognitive IoV networks.

Intelligent spectrum sensing algorithm based on KPCA and CNN
The designed intelligent spectrum sensing algorithm based on KPCA and CNN uses the KPCA nonlinear mapping to extract a feature vector from the sampled signal covariance matrix.Once the feature data are obtained, normalization and dimensionality reduction are performed, and then the data are employed to train the improved CNN.Finally, the testing data are input into the trained CNN model to achieve fast and accurate spectrum sensing.Figure 3 depicts the details of the intelligent spectrum sensing algorithm proposed in this paper.

Data preprocessing
Let x(t) denote the sampled signal sequence.Point i is taken as the starting position of a sampling point, and a signal subfragment M(i) of length L is used.Thus, each signal subfragment includes L sampling points of discrete signals.Further, there are N signal subfragments in each time frame.Thus, The matrix constructed from the received sensing signals is

KPCA feature extraction
In mobile IoV networks, the communication environment is complex and variable, and the received signal is susceptible to noise as well as human activities.Information entropy is a measure of the amount of information needed to eliminate uncertainty, i.e., the information that an unknown event may contain.As noted previously, the noise interference prevents distinguishing the noise from the authorized user's signal in a linear space.Based on PCA feature extraction theory, the nonlinear mapping of data is carried out using sum function.Thus, the original data is mapped to the higher dimensional data space to analyze the sampled signal data.For each sampled signal subfragment M(i), the signal subfragment set K*M(i) in the new feature space is obtained via the nonlinear mapping of kernel function K.There are many kernel functions, including.
1. Linear kernel function Based on a careful analysis of the listed kernel functions, this work selects the RBF kernel function.The RBF kernel function has a good anti-interference ability regarding the noise in the data and a strong ability to process the mixed noise wireless signals (which need to be processed herein).The method is then used to construct the covariance matrix.Thus, (10) can be rewritten as: For the covariance matrix R � (L * L) , the eigenvalues and eigenvectors are obtained through matrix decomposition: Since the matrix R � (L * L) is a semipositive definite matrix, there exist eigenvalues Λ = diag(a 1 , a 2 , a 3 , ⋯ , a L ) and cor- responding eigenvectors V = ( 1 , 2 , 3 , ⋯ , L ) .The eigen- value is the larger, and the variance contribution of the corresponding eigenvector is the larger.So, this algorithm arranges the eigenvalues obtained after the singular value decomposition in descending order, and the corresponding eigenvectors are also arranged in the same order.
The cumulative variance contribution of the first k eigenvectors is calculated as: The contribution of the cumulative variance reflects the degree of variation in the features and the proportion of the original information contained in the features, i.e., the importance of the features.
After the eigenvalues are arranged from largest to smallest, the corresponding eigenvectors are arranged Finally, we can get the data after KPCA dimensionality reduction: Note that the auto-correlation of the authorized user signal is strong, whereas the noise correlation is poor.The signal's correlation is reflected by the covariance matrix's eigenvectors.Therefore, the covariance matrix eigenvectors are utilized to distinguish the sampled signal from noise.The traditional algorithm compares the sampled signal feature vectors with those of known primary user signals.
If the similarity is within the limit threshold, the authorized users' presence is deduced.Otherwise, the signal is judged as noise.However, in wireless mobile communication, the channel environment is complex and changeable, making it difficult to determine the authorized user signal and noise characteristics.As a result, the threshold is difficult to set, thus affecting the spectrum sensing's accuracy.Within the proposed algorithm, the signal features obtained via KPCA mapping are input into the improved CNN.Then, the dynamic threshold values of complex and variable channels are obtained indirectly through the offline training CNN model.Consequently, the spectrum sensing accuracy is improved.( 18)

The propose improved CNN model
The improved CNN model takes the feature vector as the input, which is obtained through the decomposition of the sampling covariance matrix from KPCA nonlinear mapping.Throughout the CNN model's training, the convolution layer, pooling layer, and fully connected layer can extract the different characteristics of signals and noise.Finally, the testing set is input into the trained CNN model to obtain the spectrum sensing result, i.e., the judgment of whether the cognitive vehicle can access the network.Figure 4 shows the structure of the improved CNN model.
The proposed improved CNN spectrum sensing classification model mainly consists of two steps.Firstly, the input features are standardized, and then the processed data are input to train the proposed improved CNN model.

Full connection
Since the algorithm's input is a three-dimensional vector, it is necessary to transform 61 × 1 data into 61 × 1 × 1 data.Such transformation does not change the number of input data features.Figure 5 shows the data dimension transformation process.

(B) Architecture of the Proposed CNN Model
Considering the particularity of mobile wireless signal data, we design an appropriate CNN classification model.This design is mainly to extract the features of the signal, and then classify it.Firstly, the convolutional layer is used to learn data features, then the de-pooling layer is used to effectively screen the feature graph of the convolutional learning, and finally the full connection layer is used for spectrum sensing classification.where, the variable c is in [0,1].i denotes the input, N denote the number of neurons in the output layer.

Intelligent spectrum sensing algorithm
Figure 6 shows the intelligent spectrum sensing algorithm's flowchart, whereas the pseudocode is given in Algorithm 1.The proposed algorithm first obtains the discrete signal sequence.Then, the sampled signal dataset is constructed via the KPCA nonlinear mapping, and the eigenvectors of the covariance matrix are obtained through matrix decomposition to complete the feature extraction.Finally, the feature data are normalized and fed into the improved CNN to obtain the spectrum sensing classification results.

Experimental analysis
This section verifies the effectiveness of the proposed intelligent spectrum sensing algorithm.

Dataset generation
In each SNR, 4000 sets of noise data without PU and 4000 sets of mixed signal and noise data with PU were generated and added with labels [0,1] and [1,0].The obtained ( 23)

Influence of network structure on spectrum sensing performance
The network structure has a guiding significance for the CNN model's optimal performance.Thus, this section obtains the optimal parameter setting for the proposed CNN model by investigating the influence of the learning rate, activation function, and the convolution kernels on model performance and complexity.
1. Influence of convolution kernels on the spectrum sensing performance The CNN's structural design impacts both training and testing and affects the sensing accuracy.Table 2 shows the influence of five different convolution kernels on spectrum sensing performance.C 1 and C 2 represent the number of convolutional kernels at the first and second layers, respectively.F 1 represents the number of neurons in the full junction layer.
Table 2 shows that the convolution kernel and the number of neurons in the fully connected layer affect the detection probability and false alarm probability.The comprehensive analysis revealed that the first listed configuration (i.e., the configuration listed under number 1) yields the best result.Thus, the subsequent analysis adopted this configuration.

Influence of the learning rate on the spectrum sensing performance
The learning rate plays a decisive role in updating the CNN model's parameters and bias and is a critical factor affecting the model convergence.Figures 7 and 8 demonstrate that the learning rate equal to 0.1 or 0.01 is too large, broadening the model parameters' update range during training.As a result, the loss function significantly fluctuates at the minimum value, and the optimal value is difficult to reach.However, when the learning rate is set to a small value, the model learning is slow, and the training takes a long time.The exponentially attenuated learning automatically updates the model learning rate based on the training progress.In the early stage of training, the CNN model can quickly obtain the learning rate, and in the later stage, the learning rate is reduced to near the optimal value.Thus, the model training tends to be stable.

Influence of the optimizer on the spectrum sensing performance
Table 3 compares four optimizers.One can note that the Adam optimizer outperforms other considered optimizers.It accumulates experimental gradients by calculating momentum and constantly changes the learning rate based on the cache value size.

Influence of activation function on the spectrum sensing performance
Four activation functions (namely Sigmoid, Tanh, ReLU, and Leaky_ReLU) were utilized for network training, and the obtained probabilities are shown in Table 4.One can note that Leaky_ReLU yields the best results.

Influence of convolution layer number on spectrum sensing performance
Table 5 analyzes the changes of perception accuracy under different convolution layers.We can see that there is little difference in perception performance under different number of layers.However, with the increase of network layers and the increase of model parameters, the time of network training will also increase.So we choose to employ two convolution layers in the CNN.

The algorithms' performance comparison
Finally, the algorithm's performance was compared with Elman, SVM, and Lenet5 algorithms.Figures 9 and 10 show the detection probability under 2FSK and QPSK modulations, respectively.Note that the proposed algorithm's detection probability reaches 100% when the SNR is above -3 dB.In contrast, SVM's and Lenet5's detection probabilities do not exceed 90%.Elman algorithm displays a poor recognition accuracy for signals with strong noise interference, and its performance is close to failure under low SNR.The CNN algorithm's detection accuracy is 10% higher with respect to the considered algorithms.
Figures 11 and 12 present the four algorithms' missing probability, demonstrating that the proposed algorithm outperforms others regarding the missing probability.Specifically, when the SNR is 0 dB, the CNN algorithm's missing probability is nearly 0, while the results for the other algorithms are greater than 0.
Similarly, Figs. 13 and 14 present the four algorithms' false alarm probability.It can be seen that the Elman algorithm's false alarm probability is the highest, while the overall false alarm probability of SVM and LeNet5 algorithms is approximately 20%.The proposed CNN algorithm has the best false alarm detection probability performance.More precisely, compared with SVM and LeNet5 algorithms, the proposed algorithm achieves a 4%-10% reduction in the false alarm probability.Table 6 compares the four algorithms' running time, demonstrating that the CNN algorithm requires significantly shorter time than the other considered algorithms.Compared with LeNet5 and SVM, CNN's running time is reduced by 90% and 75%, respectively.The LeNet5 model performs well when the data dimension is 36.However, this work uses a 61-dimensional eigenvector as the input data, leading to an increase in model parameters and running time.SVM performs complex calculations.Its feature analysis based on the eigenvector of the input covariance matrix requires considerable time.Thus, the presented comprehensive analysis demonstrates that the proposed CNN model is an optimal sensing model.

Conclusion
This paper proposed an intelligent spectrum sensing algorithm for cognitive IoV networks based on KPCA and improved CNN.A KPCA nonlinear mapping method was utilized to facilitate the signal and noise characteristics' extraction in complex and dynamic wireless channels.More precisely, the method extracts signal and noise feature vectors.Next, an improved CNN classifier was introduced to realize spectrum sensing, and a suitable network structure was designed according to the wireless signals' characteristics.The simulation results enabled the following insights: 1. Different network structures significantly impact the spectrum sensing results.2. The method utilized an exponential decay learning rate, Adam optimizer, and Leaky_ReLU as the activation function.Such a design yielded the best sensing result.3. The proposed CNN algorithm outperformed SVM, LeNet5, and Elman algorithms, achieving a 10% increase in sensing accuracy.
Nevertheless, since this study dealt with spectrum sensing of a single user, the research presented herein will be   further extended to accommodate multi-user cooperative spectrum sensing in the future.Further, the combination of NOMA and CR will be considered to improve the sensing accuracy.

Fig. 3
Fig.3The intelligent spectrum sensing algorithm (A) Data normalization To reduce the model training complexity, the sampling signal feature vector should be normalized.Normalization removes the unit limitations and facilitates comparison and weighting of different characteristic data, thus facilitating the CNN training The min-max normalization follows the formula where X is the original feature data, X' is the normalized data, and Max and Min denote the maximum and minimum values of X.
Fig.4 The improved CNN model's structure

7
Average accuracy different learning rates 8 Loss function under different learning rates

Fig. 14
Fig. 14 False alarm probability of QPSK modulation

Table 1
Dataset parameters used in the experiment

Table 2
Influence of convolution kernels on the spectrum sensing performance

Table 3
Influence of different optimizers on the spectrum sensing performance

Table 5
Pd comparison of detection probability under different number of convolution layers

Table 6
The comparison of the four algorithms' running time