Wheat pests seriously threaten global wheat production, making accurate pest detection essential for yield protection. While deep learning methods excel at capturing distinct visual features, they often fail to distinguish morphologically similar pest species due to limited feature representation, resulting in inter-class confusion and reduced accuracy. To tackle this problem, we propose an Edge-Enhanced Deformable Attention Network (E \(^2\) DA-Net). The network incorporates three core modules: First, the Edge Enhancement Feature Module (E \(^2\) FM) employs the Sobel operator to enhance the perception of pest contours and textures, thereby improving the capture of fine-grained features. Second, we design a Global-Context Deformable Convolutional Network (GDCN), which incorporates our proposed Global-Context Coordinate Attention (GCCA) mechanism to guide the offset learning of deformable convolution. Leveraging GCCA’s unique global–local attention architecture, GDCN’s sampling points can adaptively focus on pest regions in complex backgrounds. Third, the Superficial Detail Fusion Module fuses high-resolution shallow features from the backbone network with deep semantic information from the neck network to enhance the utilization of subtle features. Experiments on our self-built wheat pest dataset show that E \(^2\) DA-Net improves mAP50 by 5.2% over the baseline and outperforms other mainstream comparative algorithms, confirming its practicality and advanced performance in real-world wheat pest detection applications. The code is available at: https://github.com/ldx-coder/MY-E2DA-Net.