A pest identification device and method
By using an improved YOLOv8 model and a two-stage active baffle assembly, the problems of inaccurate identification and high power consumption in the pest identification system have been solved, achieving efficient and accurate pest identification and real-time cleaning, and improving detection performance.
Patent Information
- Application Number
- CN202410723403.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-05
- Publication Date
- 2026-01-30
- Estimated Expiration
- 2044-06-05
AI Technical Summary
Existing pest identification systems are inaccurate in identifying pests that accumulate at the bottom of collectors or on sticky insect boards, requiring manual cleaning, and the YOLO algorithm has low detection accuracy.
An improved YOLOv8 model is adopted, which combines the ASF-YOLO improved Neck, adds a scale sequence feature fusion module, a triple feature encoder module and channel and position attention mechanism, uses the Focaler-IoU bounding box loss function, and realizes real-time cleaning of pest corpses through a two-level active baffle component.
It improves the accuracy and efficiency of pest identification, avoids inaccurate identification caused by pests blocking each other, reduces power consumption, and enhances detection performance.
Smart Images

Figure CN118556660B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of crop pest identification, in particular to a pest identification device and method. BACKGROUND
[0002] According to statistics, pests cause 15-20% of crop losses worldwide each year, and indirectly or directly transmit diseases and viruses, disrupting the ecological balance. In such an agricultural power as China, the monitoring of farmland pests and the statistical prediction of pest disasters are crucial to ensure the yield and quality of crops. Traditional pest identification methods mainly rely on manual labor, i.e., experienced farmers and insect classification experts identify pests by observing their morphological characteristics. However, this method has problems such as high labor intensity and low efficiency, especially in the case of a large number of pest species and large quantities.
[0003] In recent years, deep learning technology has made remarkable progress in image recognition, especially convolutional neural networks (CNN) have made revolutionary breakthroughs in image classification tasks. In the field of agriculture, image recognition technology based on deep learning has been able to efficiently and accurately identify farmland pests, providing strong technical support for real-time monitoring and early warning of crops. The introduction of this technology not only greatly improves the efficiency and accuracy of pest identification, but also helps farmers take timely prevention and control measures, reduces crop losses, and ensures the safety and stability of agricultural production.
[0004] The crop pest identification system in the prior art can only take pictures and count the pests accumulated at the bottom of the collector or attached to the pest board after a period of time, which can cause inaccurate identification due to mutual shielding of pests, and manual cleaning is required for the next identification, which is time-consuming and labor-intensive. At the same time, although the YOLO algorithm is constantly improved, the detection accuracy of crop pests is still low. SUMMARY
[0005] The purpose of the present application is to overcome the shortcomings of the prior art and provide a pest identification device and method that can clean pest carcasses in real time and improve the accuracy of pest identification.
[0006] The present application achieves the above-mentioned purpose by adopting the following technical solutions. In a first aspect, the present application provides a pest identification method, comprising:
[0007] S1, obtaining a pest data set and preprocessing the pest data set;
[0008] S2, dividing the preprocessed pest data set into three subsets: a training set, a validation set, and a test set;
[0009] S3, constructing an improved YOLOv8 model;
[0010] S4, input the training set into the improved YOLOv8 model, perform transfer learning, compare the prediction result with the true result, calculate the loss function, and update the network weight, if the preset iteration number is reached, the training is completed, and the trained floating point model is exported;
[0011] S5, preparing calibration data, quantizing the exported floating point model into a fixed point model used by the edge computing board;
[0012] S6, deploying the fixed point model to the edge computing board, testing the performance of the fixed point model, and performing pest identification;
[0013] The Neck in the original version of YOLOv8 is improved using ASF-YOLO, and a bounding box loss function Focaler-IoU is used;
[0014] Specifically includes: adding a scale sequence feature fusion module, a triple feature encoder module, and a channel and position attention mechanism, the scale sequence feature fusion module fuses the feature maps of P3, P4 and P5 extracted from the Backbone, in the scale sequence feature fusion module, P3, P4 and P5 feature maps are normalized to the same size, after up-sampling operation, they are stacked together as the input of 3D convolution; the triple feature encoder module captures detailed information of the target by concatenating features of different sizes in the spatial dimension, the detailed feature information of the triple feature encoder module is integrated into each feature branch through the PANet structure, then these feature branches are combined with the multi-scale information of the scale sequence feature fusion module into the P3 branch, the channel and position attention mechanism includes a channel attention network and a position attention network, the channel attention network generates a channel weight through average pooling and 1D convolution, and uses a Sigmoid function for normalization, the position attention network performs average pooling on the width and height respectively, generates a spatial weight through a convolution layer and a Sigmoid function, and the channel weight and the spatial weight are combined through Hadamard product to generate the final weighted output;
[0015] The bounding box loss function Focaler-IoU adjusts the loss according to the value of the intersection over union, when the intersection over union is less than a lower threshold d, the loss is 0, when the intersection over union is greater than an upper threshold u, the loss is 1, when the intersection over union is greater than or equal to d and less than or equal to u, the loss is a function that increases linearly according to the value of the intersection over union, allowing the loss function to be sensitive to the intersection over union within a certain interval, and the specific formula is as follows:
[0016] .
[0017] In a second aspect, the present application provides a pest identification device for implementing the pest identification method described above, comprising: a pest killing lamp body 1, a pest trapping lamp 2, a wireless communication module, a voltage detection module, a control module, and a pest identification module, the pest killing lamp body 1 comprising a pest collector 5, a device box 103, and a high-voltage power grid 104, the pest identification module comprising a camera 3 and an edge computing board, the device box 103 being fixedly connected with the high-voltage power grid 104, the pest collector 5 being installed below the high-voltage power grid 104, the wireless communication module, the voltage detection module, the control module, and the edge computing board being installed in the device box 103, the wireless communication module, the voltage detection module, and the edge computing board being electrically connected with the control module, the camera 3 being fixed below the pest trapping lamp 2 and being electrically connected with the edge computing board, and an improved YOLOv8 pest identification model being deployed on the edge computing board for identifying pests.
[0018] Further, the pest collector 5 comprises a collecting groove 501, a two-stage movable baffle assembly, a standard grid paper 503, a collecting channel 502, and a collecting box 504, the collecting groove 501 being fixedly connected with the collecting channel 502, the collecting channel 502 being fixedly connected with the collecting box 504, the two-stage movable baffle assembly comprising a first-stage movable baffle module 6 and a second-stage movable baffle module 7, the first-stage movable baffle module 6 comprising a pair of first-stage steering gears 601, a pair of first-stage rectangular baffles 602, and a pair of first-stage support rods 603, the first-stage movable baffle module 6 being located at the connection between the collecting groove 501 and the collecting channel 502, the pair of first-stage steering gears 601 being installed in opposite notches in a semi-submerged manner, so that the first-stage steering gear rotating discs 604 are all located in the collecting channel 502, one end of the first-stage support rods 603 being fixed to the first-stage steering gear rotating discs 604, so that the first-stage support rods 603 can rotate downward with the first-stage steering gear rotating discs 604, the first-stage rectangular baffles 602 being fixed to one side of the support rods, the standard grid paper 503 being adhered to the corresponding first-stage rectangular baffles 602, the second-stage movable baffle module 7 comprising a pair of second-stage steering gears 701, a pair of second-stage rectangular baffles 702, and a pair of second-stage support rods 703, the second-stage movable baffle module 7 being located at the connection between the collecting channel 502 and the collecting box 504, the pair of second-stage steering gears 701 being installed in opposite notches in a semi-submerged manner, so that the second-stage steering gear rotating discs 704 are all located in the collecting channel 502, one end of the second-stage support rods 703 being fixed to the second-stage steering gear rotating discs 704, so that the second-stage support rods 703 can rotate downward with the second-stage steering gear rotating discs 704, the second-stage rectangular baffles 702 being fixed to one side of the second-stage support rods 703, the standard grid paper 503 being adhered to the corresponding second-stage rectangular baffles 702, and the camera 3 being adjusted to an angle at which the lens is directed to the center of the second-stage rectangular baffles 702.
[0019] Further, the insecticidal lamp body 1 further comprises a fixed hook 101, a top waterproof cover 102, and a high-voltage isolation ceramic piece 105, the fixed hook 101 is fixedly connected with the top waterproof cover 102, the top waterproof cover 102 is fixedly connected with the device box 103, the high-voltage isolation ceramic piece 105 is installed at the connection position of the high-voltage power grid 104 and the device box 103, the antenna 106 of the wireless communication module is adhered to the outer wall of the device box 103, and the high-voltage isolation ceramic piece 105 is installed at the connection position of the high-voltage power grid 104 and the pest collector 5.
[0020] Further, the voltage detection module comprises a signal amplifier and a voltmeter, the high-voltage power grid 104 is electrically connected with the signal amplifier, the output end of the signal amplifier is electrically connected with the voltmeter, and the voltmeter is electrically connected with the control module.
[0021] In a third aspect, the present application provides a pest identification method applied to the pest identification device as described above, comprising:
[0022] Step 1: after the device is started, the control module turns on the insect attracting lamp according to the time set in advance, when the pests are attracted by the light and touch the high-voltage power grid, the high-voltage power grid is instantaneously short-circuited, the voltage is increased, the signal of the voltage increase is transmitted to the voltage detection module, and the information is transmitted to the control module after the voltage absolute difference is measured by the voltage detection module;
[0023] Step 2: the control module judges the voltage absolute difference, if the voltage absolute difference is greater than the threshold value set in advance, the camera is turned on, and the image shot by the camera is transmitted to the edge computing board, the improved YOLOv8 pest identification model is deployed on the edge computing board to identify the pests, and the type and quantity of the corresponding pests are obtained.
[0024] Further, after the device is started, the pest identification method further comprises: the two-stage movable baffle enters a default state, for the first-stage movable baffle module, one pair of rotating discs of the first-stage steering engine rotates downward, and a first-stage rectangular baffle is driven by a first-stage supporting rod to be perpendicular to the horizontal plane, for the second-stage movable baffle module, one pair of rotating discs of the second-stage steering engine is fixed, and a second-stage rectangular baffle is driven by a second-stage supporting rod to be parallel to the horizontal plane.
[0025] Further, the pest identification method further comprises: when the image captured by the camera is transmitted to the edge computing board, the edge computing board sends a baffle control signal to the control module, and the control module controls the two-stage movable baffle to enter a cleaning state according to the baffle control signal; for the first-stage movable baffle module, one pair of rotating discs of the first-stage steering engine rotates upwards, drives the first-stage rectangular baffle to be parallel to the horizontal plane through the first-stage supporting rod, and blocks the pest corpses falling at this time; for the second-stage movable baffle module, one pair of rotating discs of the second-stage steering engine rotates downwards, makes the second-stage rectangular baffle vertical to the horizontal plane through the second-stage supporting rod, and makes the pest corpses originally on the second-stage rectangular baffle fall into the collecting box below; and then the control module controls the two-stage movable baffle to re-enter a default state.
[0026] The present application has the following advantages:
[0027] The two-stage movable baffle assembly can realize real-time cleaning of pests, and only a small amount of pest corpses will be attached to the standard grid paper when the high-definition camera captures each time, so that the problem of inaccurate identification caused by mutual shielding due to accumulation of a large number of pest corpses is avoided.
[0028] The present application uses the instantaneous voltage difference formed by the pest touching the high-voltage power grid to determine whether the pest is killed and falls into the collecting groove, so as to start the high-definition camera and the like, avoids that all components of the system are in a working state for a long time, and reduces power consumption.
[0029] On the basis of the original version of the YOLOv8 network, the ASF-YOLO improves the Neck, increases a scale sequence feature fusion module, a triple feature encoder module, a channel and position attention mechanism, the scale sequence feature fusion module can enhance the multi-scale information extraction capability of the network, the triple feature encoder module fuses feature maps of different scales to increase detailed information, and the channel and position attention mechanism integrates the above two modules together, so that the network focuses on small targets related to information channels and spatial positions, so as to improve the detection and identification capability of crop pests.
[0030] The present application uses a more focused bounding box loss function Focaler-IoU, considers the influence of the distribution of difficult samples and simple samples in bounding box regression on the regression result, uses the geometric relationship between the bounding boxes to improve the regression performance, and improves the detection performance. BRIEF DESCRIPTION OF DRAWINGS
[0031] Figure 1 is a structure schematic diagram of a pest identification device provided by an embodiment of the present application;
[0032] Figure 2 is a top view schematic diagram of a pest collector provided by an embodiment of the present application;
[0033] Figure 3 is a front view of a collection channel of a pest collector provided by an embodiment of the present application;
[0034] Figure 4 is a flow chart of a pest identification method based on an improved YOLOv8 pest identification model provided by an embodiment of the present application;
[0035] Figure 5 is a comparison chart of identification accuracies of an improved YOLOv8 pest identification algorithm model and other algorithm models provided by an embodiment of the present application;
[0036] Figure 6 is a flow chart of a pest identification method provided by an embodiment of the present application.
[0037] In the drawings, 1 is a pesticide lamp body; 2 is a cylindrical LED moth lamp; 3 is a camera; 4 is a fill light; 5 is a pest collector; 101 is a fixed hook; 102 is a top waterproof cover; 103 is a device box; 104 is a high-voltage electric net; 105 is a high-voltage isolation ceramic piece; 106 is an antenna of a wireless communication module; 501 is a collection groove; 502 is a collection channel; 503 is a standard square paper; 504 is a collection box; 6 is a first-stage movable baffle module; 601 is a first-stage steering engine; 602 is a first-stage rectangular baffle; 603 is a first-stage support rod; 604 is a first-stage steering engine rotating disc; 7 is a second-stage movable baffle module; 701 is a second-stage steering engine; 702 is a second-stage rectangular baffle; 703 is a second-stage support rod; 704 is a second-stage steering engine rotating disc. DETAILED DESCRIPTION
[0038] In order to make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application.
[0039] As shown in Figure 1 The present application provides a pest identification device, which comprises a pesticide lamp body 1, a voltage boosting module, a voltage detection module, a 12V lithium battery, a cylindrical LED moth lamp 2, a wireless communication module, an embedded control module, a pest identification counting module, the voltage boosting module and the voltage detection module, the 12V lithium battery, the cylindrical LED moth lamp 2, the wireless communication module, the embedded control module and the pest identification counting module are electrically connected, the pest identification counting module comprises a camera 3, an edge computing board and a fill light 4, the camera 3 is electrically connected with the edge computing board and the fill light 4, the camera 3 is fixed below the cylindrical LED moth lamp 2, the fill light 4 is installed on the outer wall of the lens barrel of the camera 3, and an improved YOLOv8 pest identification algorithm model is arranged on the edge computing board, and the camera 3 is a zoomable high-definition camera.
[0040] The insecticidal lamp main body 1 includes a fixed hook 101, a top waterproof cover 102, a device box 103, a high-voltage power grid 104, and a pest collector 5. The fixed hook 101 is fixed with the top waterproof cover 102 by screws. The top waterproof cover 102 is connected with the device box 103 by four diagonal screws. The device box 103 is fixed with the high-voltage power grid 104 by screws. The high-voltage power grid 104 is provided with a high-voltage isolation ceramic piece 105 at the connection with the device box 103. The voltage boosting module, 12V lithium battery, wireless communication module main body, embedded control module, and edge computing board are all fixedly installed in the device box 103. The antenna 106 of the wireless communication module is adhered to the outer wall of the device box 103. The high-voltage power grid 104 is arranged above the pest collector 5. Similarly, the high-voltage power grid 104 is provided with a high-voltage isolation ceramic piece 105 at the connection with the pest collector 5.
[0041] The voltage detection module includes a signal amplifier and a voltmeter. The 12V lithium battery is electrically connected with the voltage boosting module. The output end of the voltage boosting module is connected with the high-voltage power grid 104. The high-voltage power grid 104 is electrically connected with the signal amplifier. The output end of the signal amplifier is electrically connected with the voltmeter. The voltmeter is electrically connected with the embedded control board. The voltage boosting module can boost the 12V voltage output of the 12V lithium battery to 5000V output to the high-voltage power grid 104. The working current on the high-voltage power grid 104 is less than 2mA.
[0042] As Figures 2-3As shown, in the above embodiment, specifically, the pest collector 5 is composed of a collection groove 501, a two-stage movable baffle assembly, a standard grid paper 503, a collection channel 502, and a collection box 504. The collection groove 501 is fixed to the collection channel 502 by screws, and the collection channel 502 is fixed to the collection box 504 by screws. The two-stage movable baffle assembly includes a first-stage movable baffle module 6 and a second-stage movable baffle module 7. The first-stage movable baffle module 6 is located at the connection between the collection groove 501 and the collection channel 502. The first-stage movable baffle module 6 includes a pair of first-stage steering engines 601, a pair of first-stage rectangular baffles 602, and a pair of first-stage support rods 603. The first-stage steering engines 601 are installed in opposite notches in a semi-submerged manner, so that the first-stage steering engine rotating discs 604 are all located in the collection channel 502. One end of the first-stage support rods 603 is fixed to the first-stage steering engine rotating discs 604, so that the first-stage support rods 603 can rotate downward by 90° with the first-stage steering engine rotating discs 604. The first-stage rectangular baffles 602 are fixed to one side of the support rods. The standard grid paper 503 is adhered to the corresponding first-stage rectangular baffles 602. The second-stage movable baffle module 7 is located at the connection between the collection channel 502 and the collection box 504. The second-stage movable baffle module 7 includes a pair of second-stage steering engines 701, a pair of second-stage rectangular baffles 702, and a pair of second-stage support rods 703. The second-stage steering engines 701 are installed in opposite notches in a semi-submerged manner, so that the second-stage steering engine rotating discs 704 are all located in the collection channel 502. One end of the second-stage support rods 703 is fixed to the second-stage steering engine rotating discs 704, so that the second-stage support rods 703 can rotate downward by 90° with the second-stage steering engine rotating discs 704. The second-stage rectangular baffles 702 are fixed to one side of the second-stage support rods 703. The standard grid paper 503 is adhered to the corresponding second-stage rectangular baffles 702. The camera 3 is adjusted to a certain angle, so that the lens is directed to the center of the second-stage rectangular baffle 702.
[0043] As shown, Figure 4 The improved YOLOv8 pest recognition algorithm model is deployed on the edge computing board. The specific steps of identifying pests through the improved YOLOv8 pest recognition algorithm model include:
[0044] Step one: Obtain the pest data set and perform enhancement processing on the data set.
[0045] In this embodiment, a 1230-megapixel camera is used to shoot pest images, and the image size is 2095*1944. The pest data set is constructed, the data set is expanded by methods such as Flip, 90° Rotate, Mosaic, and adding noise, and the image size is converted to 640*640, while the corresponding annotation information is updated.
[0046] Step two: divide the pre-processed data set into a training set, a validation set and a test set.
[0047] In this embodiment, the pre-processed data set is divided into a training set, a validation set and a test set in the ratio of 5:2:3 after S1 processing.
[0048] Step three: build an improved YOLOv8 model.
[0049] In this embodiment, the improved YOLOv8 model is improved from the original version of YOLOv8 using ASF-YOLO to improve the Neck and using a more focused bounding box loss function Focaler-IoU.
[0050] The improved YOLOv8 model adds a scale sequence feature fusion module, a triple feature encoder module and a channel and position attention mechanism compared to the original version of YOLOv8 feature fusion layer, the scale sequence feature fusion module fuses the feature maps of P3, P4 and P5 extracted from the Backbone, in the scale sequence feature fusion module, P3, P4 and P5 feature maps are normalized to the same size, after upsampling operation, stacked together as the input of 3D convolution, to combine multi-scale features, the triple feature encoder module captures detailed information of small targets by concatenating features of large, medium and small sizes in the spatial dimension, the detailed feature information of the triple feature encoder module is integrated into each feature branch through the PANet structure, then these feature branches are combined with the multi-scale information of the scale sequence feature fusion module into the P3 branch, the channel and position attention mechanism includes a channel attention network and a position attention network, the channel attention network generates a channel weight through average pooling and 1D convolution, and uses a Sigmoid function for normalization, the position attention network performs average pooling on width and height respectively, generates a spatial weight through a convolution layer and a Sigmoid function, the channel weight and the spatial weight are combined through Hadamard product to produce the final weighted output, enhancing the focusing ability of the model on specific channels and positions.
[0051] The Focaler-IoU function adjusts the loss according to the value of the intersection over union, specifically, when the intersection over union is less than a lower threshold d, the loss is 0, when the intersection over union is greater than an upper threshold u, the loss is 1, when the intersection over union is greater than or equal to d and less than or equal to u, the loss is a function that increases linearly according to the value of the intersection over union, allowing the loss function to be sensitive to the intersection over union within a certain interval, the specific formula is as follows:
[0052] .
[0053] Step four: model training, export the model.
[0054] As Figure 5 shown, in this embodiment, the training set is input into the improved YOLOv8 model, the number of iterative training is set to 100 times, the YOLOv8s pre-training model is used for transfer learning, the prediction result is compared with the true result, the loss function is calculated, and the network weight is updated, if the preset number of iterations is reached, the training is ended, and the trained floating point model is exported.
[0055] The improved pest recognition algorithm model based on the original YOLOv8s algorithm provided by the application is compared with YOLOv5s, yolov6s and yolov8s, and reference is made to Figure 5 It can be seen that the improved model based on the original YOLOv8s algorithm provided by the application has a recognition accuracy for crop pests that is obviously better than that of other algorithms.
[0056] Step five: model quantization and conversion.
[0057] In this embodiment, the exported floating point model is quantized and converted into a fixed point model that can be used by an edge computing board. After model verification, preparation of calibration data and model conversion, the floating point model is converted into a fixed point model. The model verification is used to ensure that the model meets the support constraints of the edge computing board processor. The preparation of calibration data is used to reduce errors. The calibration data stores image data according to target size, target color rgb or bgr, etc., and target arrangement CHW or HWC. The model conversion completes the conversion of the floating point model to the fixed point model.
[0058] Step six: model deployment, model performance test, and pest recognition.
[0059] In this embodiment, the performance of the fixed point model is tested to obtain an analysis result. The analysis result mainly consists of two parts: Model Performance Summary and Model Structure. The Model Performance Summary is the overall performance evaluation result of the fixed point model, and the Model Structure provides the subgraph-level visualization result of the fixed point model.
[0060] As Figure 6 shown, the application also provides a pest recognition method applied to the pest recognition device of the application, which specifically includes the following steps.
[0061] Step 1: Install the system at a designated position in a farmland, and turn on all components.
[0062] Step 2: After the system is started, the two-stage movable baffle enters the default state, specifically, for the first-stage movable baffle module, one pair of rotating discs of the first-stage steering engine rotates 90° downward, driving the first-stage rectangular baffle to be perpendicular to the horizontal plane through the first-stage support rod, for the second-stage movable baffle module, one pair of rotating discs of the second-stage steering engine is fixed, driving the second-stage rectangular baffle to be parallel to the horizontal plane through the second-stage support rod, the embedded control module starts the cylindrical LED moth lamp according to the pre-set time, when the pests are attracted by the light and touch the high-voltage power grid, the high-voltage power grid will be short-circuited instantaneously, the voltage increases, the signal is amplified by the signal amplifier and transmitted to the voltmeter, the voltmeter measures the absolute difference of the voltage and transmits the information to the embedded control module, the pest corpses will fall into the second-stage movable baffle module through the collection channel.
[0063] Step 3: If the absolute difference of the voltage is greater than the pre-set threshold value, the embedded control module will control the start of the fill light and the high-definition camera, shoot the image on the second-stage rectangular baffle, and transmit the image to the edge computing board, the edge computing board identifies the image by deploying the improved YOLOv8 pest identification algorithm model, obtains the species and quantity of the corresponding pests, and then transmits the pest data to the cloud platform through the wireless communication module.
[0064] Step 4: After the image shot by the above-mentioned high-definition camera is transmitted to the edge computing board, the edge computing board will send a signal to the embedded control module, and the embedded control module will control the two-stage movable baffle to enter the cleaning state, specifically, for the first-stage movable baffle module, one pair of rotating discs of the first-stage steering engine rotates 90° upward, driving the first-stage rectangular baffle to be parallel to the horizontal plane through the first-stage support rod, blocking the pest corpses falling at this time, for the second-stage movable baffle module, one pair of rotating discs of the second-stage steering engine rotates 90° downward, driving the second-stage rectangular baffle to be perpendicular to the horizontal plane through the second-stage support rod, so that the pest corpses originally on the second-stage rectangular baffle fall into the collection box below.
[0065] Step 5: The embedded control module controls the two-stage movable baffle to re-enter the default state, and the operations of steps 2-4 are repeated.
[0066] The above is only the preferred embodiment of the present application, it should be understood that the present application is not limited to the form disclosed herein, should not be regarded as excluding other embodiments, and can be used in various other combinations, modifications and environments, and can be modified within the scope of the concept described herein, by the above-mentioned teaching or related technical or knowledge. The modification and change made by the person skilled in the art without departing from the spirit and scope of the present application shall be within the protection scope of the appended claims of the present application.
Claims
1. A pest identification method characterized by comprising: The method comprises the following steps: S1, obtaining a pest data set, and preprocessing the pest data set; S2, dividing the preprocessed pest data set into a training set, a validation set and a test set; S3, constructing an improved YOLOv8 model; S4, inputting the training set into the improved YOLOv8 model, performing transfer learning, comparing the prediction result with the true result, calculating the loss function, and updating the network weight, if the preset number of iterations is reached, the training is ended, and the trained floating point model is exported; S5, preparing calibration data, and quantizing the exported floating point model into a fixed point model used by an edge computing board; S6, deploying the fixed point model to the edge computing board, testing the performance of the fixed point model, and performing pest identification; The ASF-YOLO is used to improve the Neck in the original version of YOLOv8 and a bounding box loss function Focaler-IoU is used; Specifically, a scale sequence feature fusion module, a triple feature encoder module and a channel and position attention mechanism are added, the scale sequence feature fusion module fuses feature maps of P3, P4 and P5 extracted from the Backbone, in the scale sequence feature fusion module, the P3, P4 and P5 feature maps are normalized to the same size, and after up-sampling operation, they are stacked together as the input of 3D convolution; the triple feature encoder module captures detailed information of a target by concatenating features of different sizes in the spatial dimension, the detailed feature information of the triple feature encoder module is integrated into each feature branch through the PANet structure, and then the feature branches and multi-scale information of the scale sequence feature fusion module are combined into the P3 branch, the channel and position attention mechanism includes a channel attention network and a position attention network, the channel attention network generates a channel weight through average pooling and 1D convolution, and the channel weight is normalized by using a Sigmoid function, the position attention network performs average pooling on the width and the height respectively, generates a spatial weight through a convolution layer and a Sigmoid function, and the channel weight and the spatial weight are combined through Hadamard product to generate a final weighted output; The bounding box loss function Focaler-IoU adjusts the loss according to the value of the intersection over union, when the intersection over union is less than a lower threshold d, the loss is 0, when the intersection over union is greater than an upper threshold u, the loss is 1, when the intersection over union is greater than or equal to d and less than or equal to u, the loss is a function that linearly increases according to the value of the intersection over union, allowing the loss function to be sensitive to the intersection over union in a certain interval, and the specific formula is as follows: 。 2. A pest identification device for implementing the pest identification method according to claim 1, characterized by, The insecticidal lamp body (1) includes a pest collector (5), a device box (103), and a high-voltage power grid (104), the pest recognition module includes a camera (3) and an edge computing board, the device box (103) is fixedly connected with the high-voltage power grid (104), the pest collector (5) is installed below the high-voltage power grid (104), the voltage detection module, the control module and the edge computing board are installed in the device box (103), the voltage detection module and the edge computing board are electrically connected with the control module, the voltage detection module is electrically connected with the high-voltage power grid (104), the camera (3) is fixed below the moth lamp (2) and is electrically connected with the edge computing board, an improved YOLOv8 pest recognition model is deployed on the edge computing board and is used for identifying pests; The pest collector (5) comprises a collection groove (501), a two-stage movable baffle assembly, a standard grid paper (503), a collection channel (502), and a collection box (504), the collection groove (501) is fixedly connected with the collection channel (502), the collection channel (502) is fixedly connected with the collection box (504), the two-stage movable baffle assembly comprises a first-stage movable baffle module (6) and a second-stage movable baffle module (7), the first-stage movable baffle module (6) comprises a pair of first-stage steering engines (601), a pair of first-stage rectangular baffles (602), and a pair of first-stage support rods (603), the first-stage movable baffle module (6) is located at the connection between the collection groove (501) and the collection channel (502), the pair of first-stage steering engines (601) are installed in opposite notches in a semi-submerged manner, so that the first-stage steering engine rotating discs (604) are all located in the collection channel (502), one end of the first-stage support rod (603) is fixed to the first-stage steering engine rotating disc (604), so that the first-stage support rod (603) rotates downward together with the first-stage steering engine rotating disc (604), the first-stage rectangular baffle (602) is fixed to one side of the support rod, the standard grid paper (503) is adhered to the corresponding first-stage rectangular baffle (602), the second-stage movable baffle module (7) comprises a pair of second-stage steering engines (701), a pair of second-stage rectangular baffles (702), and a pair of second-stage support rods (703), the second-stage movable baffle module (7) is located at the connection between the collection channel (502) and the collection box (504), the pair of second-stage steering engines (701) are installed in opposite notches in a semi-submerged manner, so that the second-stage steering engine rotating discs (704) are all located in the collection channel (502), one end of the second-stage support rod (703) is fixed to the second-stage steering engine rotating disc (704), so that the second-stage support rod (703) rotates downward together with the second-stage steering engine rotating disc (704), the second-stage rectangular baffle (702) is fixed to one side of the second-stage support rod (703), the standard grid paper (503) is adhered to the corresponding second-stage rectangular baffle (702), the camera (3) is adjusted to an angle at which the lens is directed to the center of the second-stage rectangular baffle (702).
3. The pest identification apparatus according to claim 2, wherein The insecticidal lamp body (1) further comprises a fixed hook (101), a top waterproof cover (102), and a high-voltage isolation ceramic piece (105), the fixed hook (101) is fixedly connected with the top waterproof cover (102), the top waterproof cover (102) is fixedly connected with the device box (103), the high-voltage isolation ceramic piece (105) is installed at the connection between the high-voltage power grid (104) and the device box (103), and the high-voltage isolation ceramic piece (105) is installed at the connection between the high-voltage power grid (104) and the pest collector (5).
4. The pest identification apparatus according to claim 2, wherein The voltage detection module comprises a signal amplifier and a voltmeter, the high-voltage power grid (104) is electrically connected with the signal amplifier, the output end of the signal amplifier is electrically connected with the voltmeter, and the voltmeter is electrically connected with the control module.
5. The pest identification apparatus according to claim 2, wherein The pest identification device further comprises a wireless communication module, an antenna (106) of which is adhered to the outer wall of the device box (103).
6. A pest identification method applied to the pest identification device according to any one of claims 2 to 5, characterized in that, Comprise: Step 1, after the device is started, the control module turns on the insect lamp according to the time set in advance, when the pests are attracted by the light and touch the high-voltage electric net, the high-voltage electric net is instantaneously short-circuited, the voltage increases, and the signal of voltage increase is transmitted to the voltage detection module; After measuring the absolute difference of voltage by the voltage detection module, the information is transmitted to the control module; Step 2, the control module judges the absolute difference of voltage, if the absolute difference of voltage is greater than the threshold set in advance, the camera is controlled to start, and the image shot by the camera is transmitted to the edge computing board, the improved YOLOv8 pest identification model is deployed on the edge computing board to identify the pests, and the type and quantity of the corresponding pests are obtained.
7. The pest identification method according to claim 6, characterized in that, After the device is started, the pest identification method further comprises: the two-stage movable baffle enters the default state, for the first-stage movable baffle module, one pair of rotating discs of the first-stage steering engine rotates downward, and the first-stage rectangular baffle is driven by the first-stage supporting rod to be perpendicular to the horizontal plane, for the second-stage movable baffle module, one pair of rotating discs of the second-stage steering engine is fixed, and the second-stage rectangular baffle is driven by the second-stage supporting rod to be parallel to the horizontal plane.
8. The pest identification method according to claim 7, characterized in that, The pest identification method further comprises: after the image shot by the camera is transmitted to the edge computing board, the edge computing board sends a baffle control signal to the control module, the control module controls the two-stage movable baffle to enter the cleaning state according to the baffle control signal, for the first-stage movable baffle module, one pair of rotating discs of the first-stage steering engine rotates upward, and the first-stage rectangular baffle is driven by the first-stage supporting rod to be parallel to the horizontal plane, blocking the pests corpses falling at this time, for the second-stage movable baffle module, one pair of rotating discs of the second-stage steering engine rotates downward, and the second-stage rectangular baffle is driven by the second-stage supporting rod to be perpendicular to the horizontal plane, so that the pests corpses originally on the second-stage rectangular baffle fall into the collection box below; then the control module controls the two-stage movable baffle to re-enter the default state.
Citation Information
Patent Citations
Traffic sign detection and identification method based on cascaded network
CN108363957A
Counting insecticidal lamp based on lightweight neural network and counting method
CN115024298A