Abnormal data detection is an important step to ensure the accuracy and reliability of node data in wireless sensor networks. In this paper, a data classification method based on convolutional neural network is proposed to solve the problem of data anomaly detection in wireless sensor networks. First, Normal data and abnormal data generated after injection fault are normalized and mapped to gray image as input data of the convolutional neural network. Then, based on the classical convolution neural network, three new convolutional neural network models are designed by designing the parameters of the convolutional layer and the fully connected layer. This model solves the problem that the performance of traditional detection algorithm is easily affected by relevant threshold through self-learning data characteristics of convolution layer. The experimental results show that this method has better detection performance and higher reliability.