Tomicus is a globally significant forestry pest, with Yunnan Province in southwestern China experiencing particularly severe infestations. The morphological differences among Tomicus species are minimal, making accurate identification challenging. While traditional molecular identification and morphological recognition methods are reliable, they require specialized personnel and equipment and are time-consuming. For individuals with limited expertise, accurate identification becomes particularly difficult. This highlights the challenge of developing a rapid, efficient, and accurate classification model for Tomicus. This study investigates four major Tomicus species in Yunnan Province: Tomicus yunnanensis, Tomicus minor, Tomicus brevipilosus, and Tomicus armandii. We collected samples from infested pine trees and constructed a dataset comprising 6,371 high-resolution images captured using a handheld microscope. A novel Tomicus classification model, DEMNet, was proposed based on an improved ResNet50 architecture. Experimental results demonstrate that DEMNet outperforms ResNet50 across key metrics, achieving a classification accuracy of 92.8%, a parameter count of 1.6 M, and an inference speed of 0.1193 s per image. Specifically, DEMNet reduces the parameter count by 90% while improving classification accuracy by 9.5%. Its lightweight and high-precision design makes DEMNet highly suitable for deployment on embedded devices, offering significant potential for real-time Tomicus identification and pest management applications.