The open, interconnected, and shared operational characteristics of the energy Internet introduce more sophisticated cybersecurity attacks. How to accurately detect these cyber attacks is crucial for energy Internet security protection. Existing machine learning-based intrusion detection algorithms cannot cope with the continuous increase of network traffic and features in the energy Internet. And convolutional neural networks (CNN) can be a good solution for the descending and optimal selection of high-dimensional intrusion features. Unfortunately, traditional convolutional neural networks have complex structures with many parameters and are prone to fall into local optimality. To fill the gap of CNN, in this paper, we use a gene expression programming (GEP) to optimize the parameters of CNN and propose an intrusion detection algorithm based on GEP-CNN (GCNN-IDS). Our key idea is to avoid the convolutional neural network from falling into local optimum by designing a new code on GEP and fitness function to optimize the parameters of the CNN using the global search capability of GEP. The experimental results on two benchmark datasets and a real dataset substantiate that the detection accuracy of the optimized CNN-based intrusion detection algorithm (ICNN-IDS) reaches up to 0.9143 under different parameter combinations; meanwhile, compared with other algorithms, the detection accuracy, precision, recall, F1 and false detection rate of the intrusion detection model proposed in this paper reach 0.9897, 0.99, 0.98, 0.97 and 0.0126, respectively.(c) 2022 Elsevier B.V. All rights reserved.