Methods for detecting and identifying ips beetles
By improving the YOLOv5 and ResNet50 models, combining multi-scale feature fusion and lightweight technology, and optimizing the power module, the problems of time-consuming detection of bark beetles in the field and high power consumption of the equipment were solved, and efficient and accurate pest monitoring was achieved.
Patent Information
- Application Number
- CN202411812183.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-10
- Publication Date
- 2026-02-10
- Estimated Expiration
- 2044-12-10
AI Technical Summary
Existing technologies for detecting and identifying bark beetles in the wild are time-consuming and require specialized equipment. Traditional image processing algorithms are ineffective for detecting small targets, and deep learning algorithms have high computational and storage overhead on embedded devices, making equipment deployment difficult.
We employ improved YOLOv5 and ResNet50 deep learning models, combined with multi-scale feature fusion, model pruning, and lightweighting techniques to optimize detection and classification models. We also utilize low-power AI intelligent computing chips and power management chips, and optimize the power module to reduce power consumption.
It enables efficient, fast, and accurate detection of bark beetles on embedded devices, reducing computational and storage requirements while improving detection accuracy and device stability.
Abstract
Description
Technical Field
[0001] This invention relates to the field of pest detection technology, specifically a method for detecting and identifying the leaf beetle. Background Technology
[0002] Traditional detection and identification methods for *Bartholinium truncatum* mainly include molecular identification and morphological recognition. While these methods are accurate and reliable, they are time-consuming and require specialized personnel and equipment, making them difficult to implement in the field. Therefore, there is an urgent need to research a rapid, efficient identification method and instrument with high classification accuracy to solve the current challenges of identifying *Bartholinium truncatum* in the field.
[0003] Traditional image processing algorithms often perform poorly in detecting small targets, failing to effectively distinguish subtle differences between similar insects and the background, leading to frequent false positives and false negatives. In recent years, target detection and image classification technologies based on deep learning algorithms have made significant progress, especially the application of Convolutional Neural Networks (CNNs) and Region Convolutional Neural Networks (R-CNNs), which have improved the accuracy of automated pest monitoring. For example, the YOLO series of algorithms performs excellently in target detection, achieving efficient real-time detection, but its ability to distinguish small targets (such as the leaf beetle) and similar backgrounds still has some limitations. To address this issue, the optimized version of YOLOv5 has partially resolved the balance between accuracy and efficiency, but the identification of small targets in complex environments still faces challenges.
[0004] The paper "Farmland Pest Detection Based on YOLO-V51 and ResNet50" (Liu Chunyuan, Chen Hongjian, Zeng Xiaohui, Xiang Tao, Kou Xipeng) discloses the use of deep learning technology to analyze pest data obtained from light-trapping devices, overcoming the time-consuming and labor-intensive nature of manual pest information collection. It proposes a coarse data classification method to improve the accuracy of the detection model. For imbalanced data, data augmentation is used to expand and balance the data. In the first-layer detection model, the YOLO-V51 model is used, incorporating coarsely classified data to reduce the impact of numerous classifications and high inter-class similarity, thus improving accuracy. In the second-layer recognition model, the coarse classification results from the YOLO-V51 detection model are used for fine classification, and a weighted prediction augmentation algorithm is proposed to further improve model accuracy. Although the model has high recognition accuracy, it cannot solve the problem of reducing the large computing and storage overhead of the device while ensuring high-precision classification. As a result, the model is difficult to deploy on embedded devices, has high power consumption and poor performance, and affects the long-term stability of embedded devices. Summary of the Invention
[0005] To address the problems existing in current deep learning algorithms, this invention proposes a method for detecting and identifying bark beetles.
[0006] The present invention discloses a method for detecting and identifying the twig beetle. This method is based on a twig beetle detection and identification instrument, which includes a housing, a screen, a processing unit, and a power supply. The screen, processing unit, and power supply are electrically connected in sequence. The identification method includes two parts: a detection model and a classification model. The step of obtaining the detection model is as follows:
[0007] 1) Model selection: YOLOv5s.pt was selected as the pre-trained model;
[0008] 2) Freeze strategy: During the initial training, freeze the low-level layers used to capture general features, while keeping the high-level layers trainable; unfreeze the low-level layers after the model tends to converge.
[0009] 3) Multi-scale feature fusion: FPN is embedded in the YOLOv5 model, GFPN is introduced to enhance multi-scale feature expression, and BiFPN is combined to introduce bidirectional feature flow;
[0010] 4) Model compression: During training, L1 regularization is introduced to sparsify the weights; then, the importance of convolution kernels and features is evaluated based on the absolute value of the weights and the response of the feature maps, and convolution kernels or feature channels that have little impact on the final output are pruned.
[0011] 5) Detection layer optimization: Use the more robust classification loss function Focal Loss to handle the imbalance between positive and negative samples, optimize the bounding box regression loss, and use DIoU to improve regression accuracy;
[0012] 6) Training strategy: The Cosine Annealing strategy is adopted, and the learning rate is gradually reduced from the initial value to near zero; the Warm-up strategy is used in the early stage of training, and the learning rate is gradually increased.
[0013] The steps to obtain the classification model are as follows:
[0014] 1) Model selection: ResNet50 is adopted as the base network model for improving the classification algorithm;
[0015] 2) Lightweight Model: DS is introduced into the residual module of the bark beetle classification model to replace the standard convolution of ResNet50; the depthwise convolutional sub-layer of DS is used to apply independent convolutional kernels to each channel, and the number of output feature maps is the same as the number of input channels; the pointwise convolution of DS is used to process the feature maps output by the depthwise convolution with 1×1 convolutional kernels, so that the feature maps of different channels are combined into new feature maps;
[0016] 3) Strategies to improve classification accuracy: Introduce ECA in the residual module of each layer in the ResNet50 network to make the network focus on key features, thereby improving the discrimination ability of the main features and suppressing the secondary features; replace the fully connected layers in the ResNet50 network with the MobileNetV3 classifier; replace the ReLU activation function in the ResNet50 network with the PReLU activation function.
[0017] 4) Training strategy: The optimizer uses the adaptive moment estimation algorithm, the loss function is the cross-entropy loss function, the number of training iterations is 100 rounds, the batch-size is set to 32, and the learning rate training parameter is 0.0001.
[0018] The obtained detection and classification models were deployed into the bark beetle detection and identification instrument.
[0019] Specifically, during the training of the YOLOv5s.pt model, the low-level features include the general structure of the edges, corners, lines, colors, and textures of the bark beetle, while the high-level features are the curved contour edge information of the bark beetle and the texture information on the elytra slope and body.
[0020] Specifically, the casing of the bark beetle detector uses a PCB board made of FR-4 material, which encloses the processing unit and power module inside the casing.
[0021] Specifically, the processing unit of the bark beetle detection and identification instrument uses the RV1126 core board. The processing unit is a low-power AI intelligent computing chip, which improves the inference speed of deep learning algorithms through hardware enhancement, reducing reliance on the AI chip and thus lowering overall power consumption. The optimized instrument can support long-term continuous operation, extending its lifespan while efficiently running the algorithm.
[0022] Specifically, the power module of the bark beetle detector consists of a power management chip and a battery. The power management chip uses an SCT2230 chip, and the battery is a 12V battery. The power management chip can convert the input 12V battery voltage to 3.3V and 5V, providing a stable power supply to various components, improving the device's battery life, and ensuring power stability, thereby guaranteeing the stable operation of the device.
[0023] The beneficial effects of this invention are as follows: YOLOv5 is widely used in object detection tasks. Its efficient single-stage detection framework can provide real-time processing capabilities while ensuring high detection accuracy. It also employs multi-scale feature fusion and model pruning techniques to effectively improve the detection accuracy of small targets. The use of a ResNet50 deep residual structure can extract rich features from images, effectively classifying different types of insects. Furthermore, ResNet50 is optimized through DS depthwise separable convolution and ECA attention mechanisms, while modifying the number of output channels, significantly reducing computational load and memory requirements. This ensures high classification accuracy while improving model efficiency. The combination of the improved YOLOv5 and ResNet50 not only fully leverages the advantages of the YOLO series algorithms in object detection tasks but also demonstrates the strong performance of ResNet in image classification. The combined application of the two significantly improves classification efficiency while maintaining high accuracy. Detailed Implementation
[0024] Example 1: The method for detecting and identifying the twig beetle is based on a twig beetle detection and identification instrument. The instrument includes a housing, a screen, a processing unit, and a power supply, which are electrically connected in sequence. The housing is a PCB board made of FR-4 material, enclosing the processing unit and power supply module within it. The processing unit uses an RV1126 core board. The power supply module consists of a power management chip and a battery; the power management chip is an SCT2230 chip, and the battery is a 12V battery.
[0025] The Tomicus yunnanensis detection and identification instrument acquired images of different types of Tomicus yunnanensis using a high-resolution microscope for the first time. To improve dataset quality and address class imbalance, we preprocessed the dataset. Preprocessing primarily included data augmentation and class balancing to enhance the model's generalization performance and ensure the scientific rigor of model training, validation, and testing. For data augmentation, we first enhanced the data by combining random cropping, horizontal mirroring, rotation, and denoising. To address class imbalance, we selected images from different classes in proportion to augment the original data. For Tomicus yunnanensis, Tomicus minor, and Tomicus brevipilosus, we randomly selected 30% of the images from each class for augmentation; for Tomicus armandii, where the original data was relatively small, we selected 50% of the images for augmentation. After data augmentation and balancing, the total dataset increased from 4934 images to 6371 images, while ensuring that the number of images for each class remained around 1590. Finally, the dataset was divided into training, validation, and test sets in an 8:1:1 ratio to ensure balance among images of each category during training, validation, and testing. This provided the model with ample learning and evaluation samples, thereby improving the model's reliability and accuracy. The software for the *Barkhornia crassipes* detection and identification instrument consists of two parts: a detection model and a classification model. The steps for obtaining the detection model are as follows:
[0026] 1) Model Selection: YOLOv5s.pt was selected as the pre-trained model. Since fast inference is required on resource-constrained embedded devices, both detection accuracy and inference efficiency must be considered when selecting a model. The YOLOv5 series of networks, due to their lightweight design, fast inference capabilities, and high accuracy, are very suitable for embedded device deployment scenarios. The pre-trained weights are optimized based on large-scale datasets (such as COCO), exhibiting strong versatility.
[0027] 2) Freezing strategy: During the initial training, the low-level features used to capture general features are frozen. These low-level features include the general structure of the edges, corners, lines, colors, and textures of the bark beetle. The high-level features remain trainable, and they are the curved contour edge information of the bark beetle and the texture information on the elytra slope and body. After the model tends to converge, the low-level features used to capture general features are unfrozen to improve the adaptability to texture and edge information.
[0028] 3) Multi-scale feature fusion: The YOLOv5 model embeds FPN, which fuses high-level semantic features and low-level spatial detail features through a top-down feature flow. GFPN is introduced to enhance multi-scale feature expression, and a dynamic fusion mechanism and multi-path feature flow are introduced. At the same time, BiFPN is combined to introduce bidirectional feature flow, allowing features to be passed from top to bottom or bottom to top, so as to enhance the function of detecting small targets.
[0029] 4) During training, L1 regularization is introduced to sparsify the weights, forcing unimportant weights to approach zero; then, the importance of convolution kernels and features is evaluated based on the absolute value of the weights and the response of the feature map, and convolution kernels or feature channels that have little impact on the final output are pruned. Special attention is paid to the low-to-mid-level feature extraction part during pruning, while convolution kernels that are key to the expression of texture and detail features are retained.
[0030] 5) Detection layer optimization: Use the more robust classification loss function Focal Loss to handle positive and negative samples, adjust the factor γ using the default initial value γ=2.0, and balance the factor α. t The setting was determined empirically, based on the ratio of positive to negative samples. First, γ was fixed at 2.0, and then α was adjusted. t = 0.25 to 0.75), observe the balance of positive and negative sample loss contributions; optimize the bounding box regression loss and use DIoU to improve regression accuracy.
[0031] 6) Training strategy: A cosine annealing strategy is adopted, with the learning rate gradually reduced from the initial value to near zero; in the early stages of training, a warm-up strategy is used, gradually increasing the learning rate.
[0032] The steps to obtain the classification model are as follows:
[0033] 1) Model selection: ResNet50 is used as the base network model for improving the classification algorithm, which can give full play to the advantages of residual networks and ensure the capture of detailed features.
[0034] 2) Lightweight Model: A Depthwise Spectroradiometer (DS) is introduced into the residual module of the *Bartholinae* classification model to replace the standard convolution of ResNet50. For the input color *Bartholinae* image, the depthwise convolutional sublayer of DS is used to apply independent convolutional kernels to each channel, resulting in the same number of output feature maps as the input channels. Pointwise convolution of DS is used, with 1×1 convolutional kernels to process the output feature maps of the depthwise convolution, combining feature maps from different channels into new feature maps, thus achieving effective information fusion. ResNet50 is used as the improved base model, and the number of output channels for each layer is modified from the original 256, 512, 1024, and 2048 to 64, 128, 256, and 512, reducing the number of training parameters.
[0035] 3) Strategies to improve classification accuracy: ECA (Early Coefficient of Classification) is introduced into the residual module of each layer in the ResNet50 network. This allows the network to focus on key features, thereby improving the discriminative power of primary features and suppressing secondary features. Global Average Pooling (GAP) in the ECA module is a crucial operation, used to extract the global response value of each channel. These response values are statistical representations of channel features across the entire feature map, reflecting the importance of that channel. A high GAP value for a channel indicates a strong response in the overall feature map, containing more significant information helpful for classification or recognition, and is thus considered a primary feature. Conversely, a low GAP value indicates limited contribution from that channel, potentially containing redundant information or noise, and is thus considered a secondary feature.
[0036] 4) Replace the fully connected layers in the ResNet50 network with the MobileNetV3 classifier; replace the ReLU activation function in the ResNet50 network with the PReLU activation function;
[0037] 5) Training strategy: The optimizer uses the adaptive moment estimation algorithm, the loss function is the cross-entropy loss function, the number of training iterations is 100 rounds, the batch-size is set to 32, and the learning rate training parameter is 0.0001.
Claims
1. A method for detecting and identifying bark beetles, characterized in that... This method is based on a bark beetle detection and identification device. The device includes a housing, a screen, a processing unit, and a power supply. The screen, processing unit, and power supply are electrically connected in sequence. The device acquires image information of bark beetles with different types. The identification method includes two parts: a detection model and a classification model. The steps for obtaining the detection model are as follows: 1) Model selection: YOLOv5s.pt was selected as the pre-trained model; 2) Freezing strategy: During the initial training, freezing is used to capture the bottom layer of general features. The bottom layer features include the general structure of edges, corners, lines, colors and textures of the bark beetle. The high layer remains trainable. The high layer features are the curved contour edge information of the bark beetle and the texture information on the elytra slope and body. After the model tends to converge, unfreezing is used to capture the bottom and middle layers of general features to improve the adaptability to texture and edge information. 3) Multi-scale feature fusion: FPN is embedded in the YOLOv5 model, GFPN is introduced to enhance multi-scale feature expression, and BiFPN is combined to introduce bidirectional feature flow; 4) Model compression: During training, L1 regularization is introduced to sparsify the weights; then, by evaluating the importance of convolution kernels and features, convolution kernels or feature channels that have little impact on the final output are pruned. 5) Detection layer optimization: Use the more robust classification loss function Focal Loss to handle the imbalance between positive and negative samples, optimize the bounding box regression loss, and use DIoU to improve regression accuracy; 6) Training strategy: The Cosine Annealing strategy is adopted, and the learning rate is gradually reduced from the initial value to near zero; the Warm-up strategy is used in the early stage of training, and the learning rate is gradually increased. The steps to obtain the classification model are as follows: 1) Model selection: ResNet50 is adopted as the base network model for improving the classification algorithm; 2) Lightweight model: DS is introduced into the residual module of the bark beetle classification model to replace the standard convolution of ResNet50; 3) Strategies to improve classification accuracy: Introduce ECA in the residual module of each layer in the ResNet50 network to make the network focus on key features, thereby improving the discrimination ability of the main features and suppressing the secondary features; replace the fully connected layers in the ResNet50 network with the MobileNetV3 classifier; replace the ReLU activation function in the ResNet50 network with the PReLU activation function.
2. The method for detecting and identifying bark beetles as described in claim 1, characterized in that... The casing of the bark beetle detector is made of FR-4 material and contains the processing unit and power module.
3. The method for detecting and identifying bark beetles as described in claim 1, characterized in that... The processing unit uses the RV1126 core board.
4. The method for detecting and identifying bark beetles as described in claim 1, characterized in that... The power module of the tip beetle detection and identification instrument consists of a power management chip and a battery. The power management chip is an SCT2230 chip, and the battery is a 12V battery.
Citation Information
Patent Citations
Real-time multifunctional pest and disease damage intelligent identification and early warning system
CN115187868A
Plasmodium detection method, system and device based on MindSpore deep learning framework
CN117523558A