Rice pest image acquisition and detection method based on morphological guided double-field serpentine feature reconstruction

A rice pest detection method based on morphology-guided dual-field serpentine feature reconstruction solves the problems of image acquisition stability and target feature attenuation in complex field environments, achieving efficient detection of pest targets and stable expression of multi-scale features.

CN123182274APending Publication Date: 2026-11-27ZHEJIANG FORESTRY UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611688765.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-10-29
Publication Date
2026-11-27

AI Technical Summary

Technical Problem

Existing methods for detecting rice pests lack stability in image acquisition under complex field conditions, target features are easily attenuated, multi-scale fusion results in loss of detail information, and regular convolution with fixed sampling positions is difficult to adapt to the curved, slender, and irregular shapes of pest targets.

Method used

A morphology-guided dual-field serpentine feature reconstruction method is adopted. The rice pest end-to-end detection network is combined with the morphology-guided dual-field serpentine feature reconstruction module (MGDSConv) for feature extraction and reconstruction. The continuous offset field is generated by using horizontal and vertical morphological serpentine branches to enhance the expression of pest edges and slender structures.

Benefits of technology

It improves the accuracy and stability of rice pest detection, enhances the ability to detect multi-scale targets in complex field environments, and reduces the impact of lighting and pose changes on image consistency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123182274A_ABST
    Figure CN123182274A_ABST
Patent Text Reader

Abstract

The application discloses a rice pest image acquisition and detection method based on morphological guidance double-field snake-shaped feature reconstruction, and relates to the technical field of agricultural intelligent monitoring and machine vision. A field rice pest image is acquired by an image acquisition device and input to an end-to-end target detection network. The network comprises a backbone feature extraction module, a multi-scale feature fusion module, a morphological guidance double-field snake-shaped feature reconstruction module and a detection decoding module. The feature reconstruction module generates a tangential and normal double-field offset, establishes a morphological sampling track through continuous snake-shaped coordinate recursion, obtains horizontal and vertical direction enhanced features through continuous coordinate sampling and morphological response modulation, fuses the enhanced features with basic features, and outputs a pest category, a bounding box and a confidence. The application can enhance the expression of rice pest edge and irregular morphological features in a complex field environment and improve the stability of pest detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of agricultural intelligent monitoring, digital image processing and machine vision target detection technology, specifically to a method for rice pest image acquisition and detection based on morphology-guided dual-field serpentine feature reconstruction, which is applicable to rice pest image acquisition, multi-scale feature extraction, pest morphology feature enhancement and target detection in complex field environments. Background Technology

[0002] Rice is a vital food crop in my country, and its stable production is crucial for ensuring food security. During its growth, rice is frequently damaged by pests such as the brown planthopper, black-tailed leafhopper, rice leaf roller, rice stem borer, rice green bug, and others. These pests disrupt normal rice plant growth by sucking sap, gnawing on leaves, boring into stems, or engaging in other feeding methods, leading to reduced yield and quality in severe cases. Therefore, timely and accurate identification of rice pests in the field is essential for precise pest control, reducing unnecessary pesticide use, and improving agricultural production management.

[0003] Current methods for monitoring rice pests mainly include manual field surveys, insect-trapping monitoring, and automatic identification methods based on digital image processing and deep learning. Manual field surveys rely primarily on agricultural technicians to identify pests based on their physical characteristics, which suffers from low detection efficiency, significant subjective influence, and difficulty in continuous monitoring. Monitoring methods based on insect-trapping devices can achieve a certain degree of automatic data collection, but the target images acquired differ from the actual pest distribution in the natural field environment. With the development of deep learning and computer vision technologies, acquiring field pest images through image acquisition devices and using target detection models for automatic identification is gradually becoming an important technical approach for intelligent monitoring of rice pests.

[0004] However, there are significant differences between the actual field environment and the ideal experimental conditions, and the existing technology still has the following problems.

[0005] First, the natural lighting in the field environment varies significantly. Shadows, backlighting, strong light, and partial occlusion can all affect the imaging effect of pest targets. At the same time, image acquisition equipment in a fixed position is easily affected by changes in target distance and shooting posture, resulting in significant differences in scale, orientation, and brightness of target images obtained at different times, which in turn affects the consistency of input to subsequent detection models.

[0006] Second, rice pests typically have characteristics such as small target size, weak edge structure, irregular shape, and similar color to the leaf background. After multi-layer feature extraction by deep neural networks, local structures such as the insect body edge, antennae, wings, and slender limbs are easily interfered with by background information during downsampling and multi-scale feature fusion, resulting in the weakening of some fine-grained morphological information.

[0007] Third, traditional convolution typically uses a regular grid for fixed-position sampling. When pest targets have curved, elongated, tilted, or irregular edge structures, there is a spatial deviation between the regular sampling positions and the actual shape of the target, making it difficult for the convolution kernel to fully cover the target area with morphological changes.

[0008] Fourth, existing methods for extracting deformable features mainly adjust the sampling position based on a single offset field, lacking further constraints on the target's local morphological orientation and continuous spatial variation. When the target morphology changes continuously, the offset of different sampling points may be discontinuous, thus limiting the ability to continuously model insect pest outlines and slender structures.

[0009] Therefore, it is necessary to propose a rice pest detection method that combines stable field image acquisition with morphology-guided feature reconstruction, so that the feature sampling position can be continuously adjusted according to the local morphology of the pest target. At the same time, the morphological information from multiple directions can be used to enhance the expression of pest edges, slender structures and irregular contours, thereby improving the accuracy and stability of rice pest detection in complex field environments. Summary of the Invention

[0010] This invention aims to provide a method for rice pest image acquisition and detection based on morphology-guided dual-field serpentine feature reconstruction, in order to solve the problems of insufficient image acquisition stability, easy attenuation of target features, loss of detail information in multi-scale fusion, and difficulty in adapting the fixed sampling position of regular convolution to the curved, slender structure and irregular morphological features of rice pest targets under natural field environment, small target pests and similar background interference conditions.

[0011] The present invention achieves the above objectives through the following technical solutions:

[0012] A method for rice pest image acquisition and detection based on morphology-guided dual-field serpentine feature reconstruction, the method comprising the following steps:

[0013] S1: Acquire field images containing information about rice plants, pest targets, and natural environmental background through a rice pest image acquisition device;

[0014] S2: Filter and label the field images collected in step S1 to generate a target detection label file that includes pest target category information and bounding box information, construct a rice pest target detection dataset, and divide the rice pest target detection dataset into a training dataset and a validation dataset according to a preset ratio.

[0015] S3: Construct an end-to-end detection network for rice pests, which includes a feature extraction backbone network, a multi-scale feature fusion module, a morphology-guided dual-field serpentine feature reconstruction module, and a target detection decoding module.

[0016] The feature extraction backbone network is used to extract rice pest features at different spatial resolutions.

[0017] The multi-scale feature fusion module is used to perform channel mapping and cross-scale fusion on the rice pest features with different spatial resolutions, and output fused features at least two scales.

[0018] The morphology-guided dual-field snake feature reconstruction module is called Morphology-Guided Dual-Field Snake Convolution, or MGDSConv for short. It is used to enhance the morphological features of fused features at various scales.

[0019] The MGDSConv module includes a basic local feature branch, a horizontal morphological serpentine branch, a vertical morphological serpentine branch, and a multi-morphological feature fusion unit; wherein, the horizontal morphological serpentine branch and the vertical morphological serpentine branch are respectively configured with corresponding dual-field offset generation, local offset smoothing, continuous serpentine coordinate recursion, continuous coordinate feature sampling, serpentine convolution and morphological response modulation processes.

[0020] The horizontal and vertical serpentine branches predict the corresponding tangential and normal offset fields based on the input fusion features, respectively, and perform local smoothing on the tangential and normal offset fields. Each branch uses the center position of the serpentine convolution sampling point as a reference to continuously recursively calculate the smoothed tangential offset field in both directions to form a continuous serpentine sampling trajectory in the corresponding direction, and determines the continuous sampling coordinates by combining the corresponding normal offset field.

[0021] The horizontal serpentine branch adjusts its horizontal sampling position based on its cumulative tangential offset and adjusts its vertical sampling position based on the corresponding normal offset; the vertical serpentine branch adjusts its vertical sampling position based on its cumulative tangential offset and adjusts its horizontal sampling position based on the corresponding normal offset; horizontal and vertical morphological sampling features are obtained through continuous coordinate feature sampling.

[0022] The horizontal and vertical serpentine branches calculate local morphological responses based on their respective continuous serpentine cumulative offset and normal offset, and generate corresponding morphological response weights; the horizontal serpentine features are modulated using the horizontal morphological response weights, and the vertical serpentine features are modulated using the vertical morphological response weights.

[0023] The multi-morphological feature fusion unit concatenates the basic local features, the horizontal serpentine features after response modulation, and the vertical serpentine features after response modulation along the channel dimension, and generates morphological enhancement features of the corresponding scale through channel fusion.

[0024] S4: Using the rice pest target detection dataset constructed in step S2, train the rice pest end-to-end detection network constructed in step S3; during the training data loading stage, simultaneously adjust the size of the input image and its corresponding bounding box information, and convert the adjusted image into the input data format required by the rice pest end-to-end detection network; update the network parameters by jointly optimizing the pest category prediction error, bounding box regression error, predicted bounding box overlap error, and localization distribution related error to obtain the trained rice pest detection model;

[0025] S5: Deploy the trained rice pest detection model to the backend processing equipment, perform inference calculations on the collected rice field images, and output pest category labels, predicted bounding box coordinates, and corresponding confidence scores.

[0026] As one of the preferred technical solutions of the present invention, the rice pest image acquisition device in step S1 adopts a fixed rod acquisition structure, including a fixed support module, an image acquisition module, an auxiliary lighting module, an attitude adjustment module, a distance detection module, and a data transmission module.

[0027] The image acquisition module is mounted on the fixed support module and is used to acquire images of rice plants and insect targets on their surface.

[0028] The attitude adjustment module is used to adjust the azimuth and pitch angles of the image acquisition module so that the rice target area to be monitored is within the preset shooting field of view.

[0029] The distance detection module is used to detect the spatial distance between the image acquisition module and the rice target area, and to determine whether the spatial distance is within a preset imaging distance range. The distance detection result is used to help determine the installation position and shooting posture of the image acquisition module.

[0030] The auxiliary lighting module is used to provide supplemental lighting to the image acquisition area, so as to reduce the impact of changes in natural lighting on the brightness and clarity of the acquired image, and improve the imaging recognition of pest targets whose body color is similar to that of rice leaf background.

[0031] The data transmission module is used to transmit the collected field images to back-end processing equipment or data storage equipment.

[0032] As one of the preferred technical solutions of the present invention, in step S2, the six types of rice pests appearing in the image are manually labeled one by one using a labeling tool. The labels uniformly use the English category identifiers of the pest species, including brown planthopper, green leafhopper, rice leaf folder, stem borer, rice bug, and whorl maggot, generating a standard target detection format labeling file containing the target category and bounding box position.

[0033] As one of the preferred technical solutions of the present invention, the English name of the morphology-guided dual-field snake feature reconstruction module in step S3 is Morphology-Guided Dual-Field Snake Convolution, abbreviated as MGDSConv module.

[0034] The MGDSConv module includes a basic local feature branch, a horizontal morphological serpentine branch, a vertical morphological serpentine branch, and a multi-morphological feature fusion unit; wherein, the horizontal morphological serpentine branch and the vertical morphological serpentine branch respectively include corresponding dual-field offset generation, local offset smoothing, continuous serpentine coordinate recursion, continuous coordinate feature sampling, serpentine convolution, and morphological response modulation processes.

[0035] The basic local feature branch is used to perform conventional local spatial feature extraction on the input fused features to obtain basic local features.

[0036] The horizontal and vertical serpentine branches each have their own corresponding dual-field offset generation processes. Offset information in the corresponding direction is independently generated based on the input fusion features, and the generated offset information is divided into a tangential offset field and a normal offset field. The tangential offset field corresponding to each branch is used to control the continuous change of the serpentine sampling trajectory of that branch along the main morphological direction, while the normal offset field corresponding to each branch is used to adjust the local spatial position of the sampling position of that branch relative to the main morphological direction.

[0037] For horizontal and vertical serpentine branches, local smoothing is performed on their respective tangential and normal offset fields to reduce the impact of local abnormal offsets on continuous sampling trajectories.

[0038] The continuous serpentine coordinate recursion process is performed independently in the horizontal and vertical serpentine branches. Each branch uses the center position of the serpentine convolution sampling point as a reference, and continuously recursively advances its smoothed tangential offset field along the positive and negative directions of the sampling point, so as to establish a continuous spatial relationship between adjacent sampling positions within the same branch and form a serpentine sampling trajectory that extends continuously from the center position to both sides.

[0039] The continuous coordinate feature sampling process determines the continuous sampling coordinates based on the cumulative tangential offset and normal offset of the continuous serpentine branches corresponding to each morphology, and obtains the sampling features at the corresponding positions in the input fusion features through continuous spatial sampling.

[0040] For the horizontal serpentine branch, the continuous serpentine cumulative tangential offset is applied to the horizontal sampling position, and the corresponding normal offset is used to adjust the vertical sampling position. The obtained multiple continuous coordinate sampling features are rearranged into the height dimension of the feature tensor according to the sampling point index order, and then horizontal serpentine convolution processing is performed to obtain the horizontal serpentine features.

[0041] For the vertical serpentine branch, the continuous serpentine cumulative tangential offset is applied to the vertical sampling position, and the corresponding normal offset is used to adjust the horizontal sampling position. The obtained multiple continuous coordinate sampling features are rearranged into the width dimension of the feature tensor according to the sampling point index order, and then vertical serpentine convolution is performed to obtain the vertical serpentine features.

[0042] The morphological response modulation process is performed independently in the horizontal morphological serpentine branch and the vertical morphological serpentine branch. The horizontal morphological serpentine branch generates horizontal morphological response weights based on the local morphological change information represented by the cumulative tangential and normal offsets of its corresponding continuous serpentine pattern, and uses these horizontal morphological response weights to modulate the response of the horizontal serpentine features. The vertical morphological serpentine branch generates vertical morphological response weights based on the local morphological change information represented by the cumulative tangential and normal offsets of its corresponding continuous serpentine pattern, and uses these vertical morphological response weights to modulate the response of the vertical serpentine features.

[0043] The multimorphic feature fusion unit is used to cascade basic local features, horizontal serpentine features modulated by horizontal morphological response weights, and vertical serpentine features modulated by vertical morphological response weights along the channel dimension, and obtain the morphological enhancement output features of the MGDSConv module through channel fusion.

[0044] Furthermore, the MGDSConv module is respectively set as a bypass of the P4 scale feature branch and the P5 scale feature branch of the multi-scale feature fusion module, and is used to perform morphological enhancement on the P4 scale basic fusion feature and the P5 scale basic fusion feature respectively; the MGDSConv morphological enhancement features of each scale are concatenated with the corresponding scale basic fusion features along the channel dimension, and the enhanced P4 scale output features and P5 scale output features are obtained by channel fusion, and the enhanced P4 scale output features and P5 scale output features are jointly input into the target detection decoding module.

[0045] As one of the preferred technical solutions of this invention, step S4 employs a joint loss function to optimize the parameters of the rice pest end-to-end detection network. The joint loss function includes variable focus classification loss, bounding box regression loss, generalized cross-union loss, fine-grained localization loss, and decoupled distillation focus loss.

[0046] The variable focus classification loss is used to constrain the difference between the predicted pest target category and the true category label; the bounding box regression loss is used to constrain the positional and size deviations between the predicted bounding box parameters and the true bounding box parameters; the generalized intersection-union loss is used to constrain the overlap relationship between the predicted bounding box and the true bounding box; the fine-grained localization loss is used to constrain the fine-grained prediction results of the bounding box localization distribution; and the decoupled distillation focus loss is used to perform self-distillation constraints on the localization distribution between different decoding layers of the target detection decoding module.

[0047] As one of the preferred technical solutions of the present invention, the back-end processing device in step S5 includes a memory, a processor, and a detection program stored in the memory and executable by the processor.

[0048] The detection program is used to load the rice pest detection model trained in step S4, perform input preprocessing, network forward computation and detection result parsing on field images acquired in real time or stored in advance, and output rice pest identification results including predicted bounding boxes, pest category labels and confidence scores.

[0049] Compared with the prior art, the beneficial effects of the present invention are: (1) The present invention monitors the image acquisition distance status by setting a distance detection module, a posture adjustment module and an auxiliary lighting module, and adjusts the shooting direction and lighting conditions of the acquisition area, which helps to reduce the impact of changes in natural light, shooting posture and target imaging scale on the consistency of field images. (2) The present invention proposes a morphology-guided dual-field serpentine feature reconstruction module MGDSConv, which obtains the tangential offset field and normal offset field through a dual-field offset generation unit, and continuously recursively pushes the tangential offset based on the center sampling position, so that adjacent sampling positions establish continuous spatial association; further, it combines the normal offset to determine the continuous sampling position, so that the sampling trajectory can be spatially adjusted according to the local morphology of rice pest targets, which helps to enhance the feature expression of curved, slender and irregular pest outlines. (3) This invention extracts edge, texture and local morphological information of pest targets from different directions by setting horizontal and vertical serpentine branches. It also generates morphological response weights for the corresponding directions by using the local morphological change information represented by the cumulative tangential and normal offsets of the continuous serpentine branches in each direction. The serpentine features in the corresponding directions are then modulated. The modulated horizontal and vertical serpentine features are then channel-cascaded and fused with the basic local features. This is beneficial to enhance the expression ability of fine-grained morphological features of rice pests in complex field environments and improve the positioning stability and detection accuracy of multi-scale target detection. Attached Figure Description

[0050] Figure 1 This is a flowchart illustrating the overall process of the rice pest image acquisition and detection method described in this invention.

[0051] Figure 2 This is a schematic diagram of the structure of the fixed-rod type rice pest image acquisition device of the present invention;

[0052] Figure 3 This is a schematic diagram of the overall structure of the D-FINE-N rice pest end-to-end detection network described in this invention.

[0053] Figure 4 This is a schematic diagram of the overall structure of the MGDSConv morphology-guided dual-field serpentine convolution module described in this invention;

[0054] Figure 5 This is a schematic diagram of the MGDSConv dual-field offset generation and continuous serpentine coordinate recursion process described in this invention;

[0055] Figure 6 This is a schematic diagram of the continuous coordinate sampling process for the horizontal and vertical serpentine branches described in this invention.

[0056] Figure 7This is a schematic diagram of the bypass enhancement structure for P4 and P5 scale features described in this invention;

[0057] Figure 8 This is an example of field images of rice pests described in this invention;

[0058] Figure 9 This is a schematic diagram of the rice pest detection results described in this invention. Detailed Implementation

[0059] The technical solution of the present invention will be further described in detail below through embodiments and in conjunction with the accompanying drawings.

[0060] This embodiment provides a method for rice pest image acquisition and detection based on morphology-guided dual-field serpentine feature reconstruction, such as... Figure 1 As shown, it includes the following steps:

[0061] S1: Acquire field images containing information about rice plants, pest targets, and natural environmental background through a rice pest image acquisition device;

[0062] S2: Screen and label the collected images of rice pests in the field, generate corresponding target detection label files, and divide the labeled image data into training dataset and validation dataset according to a preset ratio.

[0063] S3: Construct an end-to-end detection network for rice pests based on an improved D-FINE-N architecture. This network includes a feature extraction backbone network, a multi-scale feature fusion encoder, a morphology-guided dual-field serpentine feature reconstruction module, and a target detection decoder. The feature extraction backbone network extracts feature maps at different spatial resolutions. The multi-scale feature fusion encoder performs channel mapping and cross-scale fusion on P4-scale and P5-scale features, generating P4-scale and P5-scale basic fusion features with 128 channels respectively. Before the P4-scale and P5-scale features enter the target detection decoder, MGDSConv modules are set to perform morphology-guided dual-field serpentine feature reconstruction on the corresponding scale's basic fusion features.

[0064] S4: During the training data loading phase, the input images and their corresponding bounding box information in the training dataset are simultaneously resized, and the resized input images are converted into the input data format required by the rice pest end-to-end detection network; the rice pest end-to-end detection network constructed in step S3 is trained using the processed training data to obtain the trained rice pest detection model.

[0065] S5: Deploy the validated rice pest detection model from step S4 onto the backend processing equipment to perform inference calculations on real-time acquired or pre-stored field images, and output pest category labels, predicted bounding box coordinates, and corresponding confidence scores.

[0066] Step S1 includes the following steps: Figure 2 As shown, this embodiment uses a rice pest image acquisition device with a fixed pole-type acquisition structure to acquire field images. The rice pest image acquisition device includes a fixed support module, an image acquisition module, an auxiliary lighting module, an attitude adjustment module, a distance detection module, and a data transmission module.

[0067] The fixed support module includes a fixed base, a vertical support rod, and a mounting connector. The fixed base is fixed to a preset monitoring position in the paddy field via the anchor connector. The lower end of the vertical support rod is fixedly connected to the fixed base, and the mounting connector is positioned at a preset height on the vertical support rod. The attitude adjustment module is mounted on the mounting connector. The image acquisition module, auxiliary lighting module, and distance detection module are supported by the attitude adjustment module, thereby reducing changes in the shooting position caused by wind, ground vibration, and field operation disturbances.

[0068] The attitude adjustment module adopts a dual-axis motor gimbal structure, including a horizontal rotation base, a pitch support, a first drive motor, a second drive motor, a motor driver, and an attitude controller.

[0069] The horizontal rotating base is rotatably mounted on the fixed support module. The output shaft of the first drive motor is directly or via a transmission mechanism connected to the horizontal rotating base, driving the horizontal rotating base to rotate about a vertical rotation axis that is substantially parallel to the vertical support rod. When the horizontal rotating base rotates, it drives the pitch support and the image acquisition module to rotate in the horizontal direction, thereby adjusting the azimuth angle of the image acquisition module.

[0070] The pitch support is rotatably mounted on a horizontal rotating base. The output shaft of the second drive motor is directly or via a transmission mechanism connected to the pitch support, driving the pitch support to rotate about a horizontal rotation axis that is substantially perpendicular to the vertical rotation axis. When the pitch support rotates, it causes the image acquisition module to deflect upwards or downwards, thereby adjusting the pitch angle of the image acquisition module.

[0071] In this embodiment, the first drive motor and the second drive motor are respectively connected to a motor driver, which is in turn connected to an attitude controller. Both the first and second drive motors are capable of rotational position control. The current rotation angles of the horizontal swivel mount and the pitch support are obtained by a position feedback unit inside the motor or by angle detection units respectively located on the two rotation axes.

[0072] When the device is started, the attitude controller controls the first drive motor and the second drive motor to perform initial position calibration, so that the horizontal rotating seat and the pitch support reach the preset reference position respectively, and sets the azimuth angle and pitch angle corresponding to the preset reference position as the initial angle for attitude control.

[0073] The attitude controller receives attitude control commands sent by the back-end processing device or pre-stored. These attitude control commands include at least the target azimuth angle and the target pitch angle. The attitude controller reads the current azimuth angle of the horizontal swivel mount and the current pitch angle of the pitch support, and calculates them respectively:

[0074]

[0075]

[0076] in, Indicates azimuth deviation. Indicates the target azimuth. Indicates the current azimuth angle; Indicates pitch angle deviation. Indicates the target pitch angle. Indicates the current pitch angle.

[0077] When the absolute value of the azimuth angle deviation is greater than the preset azimuth angle allowable error, the attitude controller controls the first drive motor to rotate in the forward or reverse direction according to the positive or negative direction of the azimuth angle deviation; when the absolute value of the pitch angle deviation is greater than the preset pitch angle allowable error, the attitude controller controls the second drive motor to rotate in the forward or reverse direction according to the positive or negative direction of the pitch angle deviation.

[0078] The attitude controller continuously reads the current azimuth and pitch angles during motor rotation. When:

[0079]

[0080] and:

[0081]

[0082] When the first and second drive motors stop, the first drive motor and the second drive motor are stopped. and These represent the preset azimuth angle tolerance and the preset pitch angle tolerance, respectively. This ensures that the image acquisition module's shooting direction is towards the rice target area to be monitored, and that this area is within the preset shooting field of view.

[0083] The image acquisition module is fixedly mounted on a tilting bracket, and its lens optical axis changes direction synchronously with the horizontal rotation mount and the tilting bracket. After receiving an image acquisition command, the image acquisition module acquires field images containing information about rice plants, pest targets, and the natural environment background, according to preset image resolution, exposure parameters, and acquisition time.

[0084] The auxiliary lighting module is positioned around the image acquisition module, and in one specific embodiment, it comprises multiple lighting units arranged around the lens. The illumination direction of each lighting unit is directed towards the field of view of the image acquisition module. An attitude controller or back-end processing device sends lighting control commands according to preset lighting parameters to control the auxiliary lighting module to turn on, off, or adjust its brightness. The auxiliary lighting module is activated when natural light is insufficient to improve the imaging effect of the pest's outline, texture, and body color information.

[0085] The distance detection module is positioned near the image acquisition module and rotates synchronously with the attitude adjustment module. The detection axis of the distance detection module is substantially parallel to the optical axis of the lens of the image acquisition module, ensuring that the target area detected by the distance detection module corresponds to the shooting area of ​​the image acquisition module. In one specific embodiment, the distance detection module employs a time-of-flight ranging unit or a laser ranging unit.

[0086] The distance detection module continuously acquires multiple distance measurements before image acquisition, performs outlier removal and averaging on these measurements, and obtains the effective spatial distance between the image acquisition module and the rice target area. The attitude controller or back-end processing device will effectively control the spatial distance. With respect to the preset imaging distance range Compare them.

[0087] when:

[0088]

[0089] When the target area of ​​the rice paddy is determined to be within the preset imaging distance range, the image acquisition module is allowed to perform image acquisition; when or If the target area of ​​the rice field is determined to be outside the preset imaging distance range, the current image acquisition is paused, and a prompt for adjusting the installation position of the fixed support module or a prompt for checking the shooting posture is output to the backend processing equipment.

[0090] Since the attitude adjustment module mainly changes the shooting direction of the image acquisition module, rather than directly changing the physical distance between the fixed support module and the rice target area, when the distance detection result continuously exceeds the preset imaging distance range, the problem is addressed by adjusting the installation position of the fixed support module or the imaging parameters of the image acquisition module, rather than describing the adjustment of the azimuth or pitch angle as a distance adjustment.

[0091] The data transmission module includes a data interface, a data buffer unit, and a communication unit. The data interface is connected to the image acquisition module to receive field images output by the image acquisition module; the data transmission module is also connected to the distance detection module and the attitude controller to obtain the distance detection results, azimuth angle, and pitch angle corresponding to the corresponding field images.

[0092] After receiving a field image, the data transmission module associates the field image with an image identifier, acquisition time, distance detection result, azimuth angle, and elevation angle, and forms the field image and its associated information into data to be transmitted. The communication unit then sends the data to be transmitted to the backend processing device or data storage device via wired or wireless communication.

[0093] When the communication connection is normal, the data transmission module sends the data to be transmitted and determines whether the data transmission is complete based on the reception confirmation information returned by the backend processing device. When the communication connection is interrupted or no reception confirmation information is received, the data caching unit temporarily saves the corresponding field images and their associated information and retransmits them after the communication connection is restored, so as to reduce the loss of image data caused by unstable field communication conditions.

[0094] The complete working process of the rice pest image acquisition device includes:

[0095] First, the attitude controller completes the initial position calibration of the first drive motor and the second drive motor;

[0096] Subsequently, the distance detection module acquires the effective spatial distance between the image acquisition module and the rice target area, and determines whether the effective spatial distance is within the preset imaging distance range;

[0097] After the effective spatial distance meets the requirements, the attitude controller controls the first drive motor and the second drive motor to rotate according to the target azimuth angle and the target pitch angle, so that the rice target area enters the preset shooting field of view.

[0098] Control the auxiliary lighting module to turn on or adjust the lighting brightness according to the lighting conditions of the shooting area;

[0099] The image acquisition module performs image acquisition, and the data transmission module associates the acquired field images with the acquisition time, distance detection results, azimuth angle and elevation angle, and transmits them to the back-end processing device or data storage device.

[0100] Step S2 includes the following steps: screening the acquired images and removing invalid images that do not meet the quality requirements; using the VisioFirm tool to manually classify and annotate the six types of rice pests (each using English category identifiers), and other targets not included in the preset pest categories are not labeled as positive sample categories; generating a COCO format annotation file, which includes image identifiers, pest categories, bounding box positions, and bounding box size information; and dividing the annotated images and corresponding labels into training sets and validation sets according to a preset ratio, which are used for network parameter updates and model performance evaluation, respectively.

[0101] In step S3, the rice pest end-to-end detection network is implemented based on an end-to-end architecture. The backbone network is used to extract multi-scale features from the input 640×640×3 rice pest image. The specific process is as follows:

[0102] The StemBlock module performs initial feature extraction and downsampling on the input image to generate an initial feature map with a spatial size of 160×160 and 16 channels, which is used to extract low-level features such as edges and textures.

[0103] The first HG_Stage module performs further convolution processing to generate a 160×160×64 P2 scale feature map;

[0104] The second HG_Stage module performs downsampling extraction with a stride of 2 to generate a P3 scale feature map of 80×80×256.

[0105] The third HG_Stage module performs downsampling extraction with a stride of 2 to generate a 40×40×512 P4 scale feature map;

[0106] The fourth HG_Stage module performs downsampling extraction with a stride of 2, generating a 20×20×1024 P5 scale deep feature map.

[0107] Among them, the P4 and P5 scale feature maps contain intermediate and high-level semantic information, respectively, and are selected by the network as feature outputs and passed to the subsequent encoder for fusion processing.

[0108] The encoder is used to perform cross-scale fusion processing on the P4-scale and P5-scale features output by the backbone network.

[0109] First, the first ConvNormLayer_fuse module is used to perform channel mapping on the P4 scale feature map with a spatial size of 40×40 and 512 channels to obtain a P4 scale mapped feature map with a spatial size of 40×40 and 128 channels. Then, the second ConvNormLayer_fuse module is used to perform channel mapping on the P5 scale feature map with a spatial size of 20×20 and 1024 channels to obtain a P5 scale mapped feature map with a spatial size of 20×20 and 128 channels.

[0110] Subsequently, the P5-scale mapped feature map is input into the TransformerEncoderBlock module for global feature encoding. The TransformerEncoderBlock module has a multi-head self-attention mechanism with 8 heads and a feedforward network dimension of 512, outputting a P5-scale global semantic feature map with a spatial size of 20×20 and 128 channels.

[0111] The P5-scale global semantic feature map is processed by the third ConvNormLayer_fuse module and upsampled by a factor of two to obtain an upsampled feature map with a spatial size of 40×40 and 128 channels. The upsampled feature map is then concatenated with the P4-scale mapping feature map along the channel dimension to obtain a P4-scale stitched feature map with a spatial size of 40×40 and 256 channels.

[0112] The P4-scale stitched feature map is input into the first RepNCSPELAN4 module for feature extraction and channel fusion to obtain a P4-scale basic fused feature map with a spatial size of 40×40 and 128 channels.

[0113] In the natural field setting of rice pests, the individual pests vary significantly in size, and the camouflage of the complex green background is quite noticeable. During conventional multi-scale feature fusion, fine-grained features such as edges, textures, and local morphology of the pest targets are easily interfered with by background information. Furthermore, since the sampling positions of traditional regular convolutions are determined by a fixed convolutional grid, these fixed sampling positions cannot adequately capture the local morphological changes of pest targets with curved edges, elongated structures, and irregular contours. Therefore, this invention incorporates a morphology-guided dual-field serpentine feature reconstruction module, namely the MGDSConv module, in the feature path before the encoder output is fed into the target detection decoder, to enhance the morphology of the fused features at the corresponding scales.

[0114] The English name of the MGDSConv module is Morphology-Guided Dual-Field SnakeConvolution, abbreviated as MGDSConv module.

[0115] The MGDSConv module includes a basic local feature branch, a horizontal morphological serpentine branch, a vertical morphological serpentine branch, and a multi-morphological feature fusion unit; wherein, the horizontal morphological serpentine branch and the vertical morphological serpentine branch respectively include the corresponding dual-field offset generation, local offset smoothing, continuous serpentine coordinate recursion, continuous coordinate feature sampling, serpentine convolution, and morphological response modulation process.

[0116] The MGDSConv module receives input features. The input feature dimension is represented as:

[0117]

[0118] in, Indicates the batch dimension. This indicates the number of channels for the input feature. and These represent the height and width of the input feature, respectively.

[0119] In this embodiment, both MGDSConv modules P4 and P5 have 128 input channels.

[0120] First, local spatial features are extracted from the input features using basic local branches to obtain basic local features:

[0121]

[0122] in, Representing basic local convolution:

[0123] Meanwhile, the horizontal and vertical serpentine branches predict the offset information required for serpentine sampling using their respective dual-field offset generation units. Let... ,in Let v and v represent horizontal and vertical serpentine branches, respectively. Then:

[0124]

[0125] in, Indicates the offset expansion factor;

[0126] Then:

[0127]

[0128] as well as:

[0129]

[0130]

[0131] in, Indicates the kernel size as An average pooling operation with a step size of 1, a fill size of 1, and a constant spatial size.

[0132] Let the number of sampling points in the serpentine convolution kernel be K, and the index of the center sampling point be:

[0133]

[0134] Both horizontal and vertical serpentine branches establish a bidirectional continuous recursive relationship based on the central sampling point. Let... ,in This indicates a horizontal, serpentine branch. This represents a vertical, serpentine branch. For the first... For each serpentine branch, the cumulative tangential offset of the continuous serpentine pattern at the center sampling point is first set as follows:

[0135]

[0136] Continuous recursion is performed along the positive direction of the sampling points:

[0137]

[0138] Continuous recursion is performed along the negative direction of the sampling points:

[0139]

[0140] in, Indicates the first The serpentine branch of the first form The continuous serpentine cumulative tangential offset corresponding to each sampling point; This represents the first branch in the smoothed tangential offset field. The tangential offset component corresponding to each sampling point.

[0141] Through the above recursive relationship, the tangential offset between adjacent sampling points is continuously correlated, avoiding the independent processing of the offset of each sampling point, thereby establishing a continuous serpentine sampling trajectory extending from the center position in two directions.

[0142] In this embodiment, the serpentine convolution kernel size is set to 3, therefore:

[0143]

[0144] therefore:

[0145]

[0146] For any serpentine branch The corresponding ones are:

[0147]

[0148] The second sampling point along the positive direction:

[0149]

[0150] The 0th sampling point along the negative direction:

[0151]

[0152] That is, taking the first sampling point as the center, establish corresponding continuous shape offsets in two directions in the horizontal and vertical serpentine branches respectively.

[0153] For input feature locations In the horizontal serpentine branch, the first The basic horizontal position of each sampling point is determined by Confirmed, and simultaneously superimposed the continuous serpentine cumulative offset of this branch. And through normal offset Correct the vertical position.

[0154] Therefore, in the horizontal serpentine branch, the first The continuous sampling coordinates of each sampling point are represented as follows:

[0155]

[0156]

[0157] For vertical serpentine branches, the first The basic vertical position of each sampling point is determined by... Determine and superimpose the continuous serpentine cumulative tangential offset corresponding to the branch at the base vertical position. Simultaneously, through the normal offset corresponding to this branch Correct the horizontal position.

[0158] Therefore, in the vertical serpentine branch, the first The continuous sampling coordinates of each sampling point are represented as follows:

[0159]

[0160]

[0161] in, and Representing the smoothed normal offset field in the horizontal and vertical serpentine branches, respectively, at the [number]th [year]. Normal offset components corresponding to each sampling point;

[0162] The obtained coordinates are restricted to the valid region of the input features:

[0163]

[0164]

[0165] The corresponding sampling features are then obtained through continuous spatial bilinear interpolation:

[0166]

[0167] In the horizontal serpentine branch The sampling features corresponding to each sampling point are rearranged into the height dimension of the feature tensor according to the sampling point index order, forming:

[0168]

[0169] The subsequent sampling convolution kernel size is... Step size is Horizontal serpentine convolution is used for feature aggregation to restore the spatial size. Horizontal serpentine features:

[0170]

[0171] in, express Horizontal serpentine convolution, This indicates the GroupNorm normalization operation. This represents the preset activation function. In this embodiment, the activation function is SiLU.

[0172] Subsequently, bilinear continuous coordinate sampling was used to obtain:

[0173]

[0174] In the vertical serpentine branch The sampling features corresponding to each sampling point are rearranged into the width dimension of the feature tensor according to the sampling point index order, forming:

[0175]

[0176] The subsequent sampling convolution kernel size is... Step size is Vertical serpentine convolutions are used for feature aggregation to restore the spatial dimensions. Vertical serpentine features:

[0177]

[0178] in, express Vertical serpentine convolution.

[0179] In this embodiment, continuous coordinate sampling uses bilinear interpolation.

[0180] For any continuous sampling coordinate Determine the coordinates of its adjacent integer raster cells:

[0181]

[0182]

[0183] In the specific implementation, the constrained continuous sampling coordinates are linearly normalized to... The range is defined, and the corresponding features are obtained by using a bilinear grid sampling method. Boundary positions are processed by a boundary value expansion method.

[0184] Then, a weighted combination is performed based on the feature values ​​of the input features at four neighborhood positions:

[0185]

[0186] in:

[0187]

[0188]

[0189] When the sampling coordinates exceed the input feature boundary, the sampling coordinates are restricted to the effective space range, and boundary values ​​are used for sampling.

[0190] In order to adaptively adjust the feature response according to the degree of local morphological change of the serpentine sampling trajectory in different directions, this embodiment constructs morphological response information based on the continuous serpentine cumulative offset and normal offset corresponding to the horizontal and vertical serpentine branches respectively.

[0191] make ,in, This indicates a horizontal, serpentine branch. This represents a vertical, serpentine branch. For the first... For each serpentine branch, the tangential morphological energy is first calculated along the sampling point dimension of the serpentine convolution kernel:

[0192]

[0193] Calculate the normal shape energy:

[0194]

[0195] in, Indicates the first The serpentine branch of the first form The continuous serpentine cumulative tangential offset corresponding to each sampling point Indicates the first The serpentine branch of the first form The normal offset component corresponding to each sampling point.

[0196] The dimensions of the tangential shape energy and the normal shape energy are respectively:

[0197]

[0198] Then the two forms of energy are cascaded along the channel dimension:

[0199]

[0200] Get the first The morphological response input features corresponding to each morphological serpentine branch, where:

[0201]

[0202] The morphological response modulation unit further... Convolution, ReLU activation, and Convolution generates the morphological response weights for the corresponding branches:

[0203]

[0204] in, Indicates the first Each serpentine branch corresponds to Morphological response mapping convolution is used to map a 2-channel morphological response input to an 8-channel intermediate feature. express The morphological response output convolution is used to map the 8-channel intermediate features to single-channel morphological response weights.

[0205] In this embodiment:

[0206]

[0207] Therefore, the horizontal and vertical serpentine branches respectively yield their corresponding shape response weights. and .

[0208] Utilizing horizontal shape response weights Horizontal serpentine features Perform response modulation:

[0209]

[0210] Utilizing vertical shape response weights Vertical serpentine features Perform response modulation:

[0211]

[0212] in, This indicates element-wise multiplication.

[0213] Because the output of the Sigmoid function satisfies:

[0214]

[0215] therefore:

[0216]

[0217] This results in a relative enhancement of locations with strong local morphological changes, while allowing locations with low responses to retain a response no less than 0.5 times that of the original feature, thus avoiding excessive suppression of serpentine features when using simple gating weights.

[0218] The basic local feature branch is obtained as follows:

[0219]

[0220] The horizontal serpentine feature is obtained after being modulated by the corresponding horizontal morphological response weights:

[0221]

[0222] The vertical serpentine feature is obtained after being modulated by the corresponding vertical morphological response weight:

[0223]

[0224] The basic local features, modulated horizontal serpentine features, and modulated vertical serpentine features are concatenated along the channel dimension:

[0225]

[0226] When the number of channels in all three branches is hour:

[0227]

[0228] Subsequently passed Fusion convolution will Each channel is mapped to a preset number of output channels. :

[0229]

[0230] in, This refers to the output features of MGDSConv.

[0231] In this embodiment, the number of MGDSConv input channels for both P4 and P5 scales is 128, and the number of output channels is also set to 128. Therefore:

[0232]

[0233] After cascading the three branches:

[0234]

[0235] After The result of fusion convolution is:

[0236]

[0237] This ensures that the number of channels for the input and output features of the MGDSConv module is consistent, and facilitates the MGDSConv module to be embedded into subsequent multi-scale feature fusion paths in a bypass manner.

[0238] The output space size of the first RepNCSPELAN4 module is: The P4-scale basic fusion feature map with 128 channels is denoted as:

[0239]

[0240] Input the P4-scale basic fused feature map into the first MGDSConv module:

[0241]

[0242] get:

[0243]

[0244] Subsequently, the original P4-scale basic fusion features and P4-scale morphological enhancement features are cascaded along the channel dimension:

[0245]

[0246] get:

[0247]

[0248] Then, through The ConvNormLayer_fuse module performs channel compression, restoring 256 channels to 128 channels, to obtain the final P4-scale output features:

[0249]

[0250] in:

[0251]

[0252] The P4 scale output features are used for subsequent P5 scale feature fusion and final target detection decoding.

[0253] The final output features at the P4 scale Input the SCDown module for double downsampling:

[0254]

[0255] get:

[0256]

[0257] The downsampled features Features output by the aforementioned P5 scale mapping path Cascade along the channel dimension.

[0258] in:

[0259]

[0260] The P5 scale splicing feature is then represented as:

[0261]

[0262] therefore:

[0263]

[0264] The P5 scale splicing feature Input the second RepNCSPELAN4 module to perform multi-branch feature extraction and channel fusion to obtain the basic fused features at the P5 scale:

[0265]

[0266] in:

[0267]

[0268] Then, the P5-scale basic fusion features are... Input the second MGDSConv module:

[0269]

[0270] Obtain P5-scale morphological enhancement features:

[0271]

[0272] Subsequently, the P5-scale basic fusion features were... and P5 scale morphological enhancement features Cascade along the channel dimension:

[0273]

[0274] get:

[0275]

[0276] Subsequently, through The ConvNormLayer_fuse module performs channel fusion, mapping 256 channels to 128 channels to obtain the final P5-scale output features:

[0277]

[0278] in:

[0279]

[0280] Therefore, in this embodiment, two MGDSConv modules are used to perform morphological enhancement on the basic fusion features at the P4 and P5 scales respectively, while retaining the original basic fusion features at the corresponding scales. The morphological enhancement information is then re-fused into the main feature path through bypass cascading and channel fusion.

[0281] The P4 scale feature enhancement path can be represented as:

[0282]

[0283]

[0284] The P5 scale feature fusion and enhancement path can be represented as:

[0285]

[0286]

[0287]

[0288]

[0289] Thus, we ultimately obtain:

[0290]

[0291] as well as:

[0292]

[0293] The target detection decoder employs a DFINETransformer module based on the Transformer architecture, and simultaneously receives the final P4-scale output features. and P5 scale output features .

[0294] The spatial size of the P4 scale output feature is: The number of channels is 128, corresponding to a feature step size of 16 relative to the input image; the spatial size of the P5 scale output feature is... The number of channels is 128, corresponding to a feature step size of 32 relative to the input image.

[0295] In this embodiment, the hidden feature dimension of the DFINETransformer module is set to 128, the number of input feature layers is set to 2, the number of object detection decoding layers is set to 3, the feedforward network dimension is set to 512, and the number of attention sampling points at both the P4 and P5 scales is set to 6.

[0296] The DFINETransformer module establishes the correlation between the target query and the output features at both the P4 and P5 scales through multi-scale feature interaction and target query decoding, and outputs the category prediction results and bounding box prediction results of the pest target.

[0297] During the network training phase, a one-to-one bipartite graph matching method based on the Hungarian algorithm is adopted to establish a matching relationship between the set of predicted results output by the object detection decoder and the set of real annotations. Based on the matching relationship, the predicted results used to calculate the classification loss, bounding box regression loss, overlap loss, and localization distribution related loss are determined.

[0298] During the detection inference phase, without inputting a real labeled set, the pest category label, predicted bounding box coordinates, and corresponding confidence scores are obtained based on the category prediction results and bounding box prediction results output by the object detection decoder.

[0299] In step S4, the rice pest target detection dataset is used to train the rice pest end-to-end detection network.

[0300] During the training data loading phase, the input images in the training dataset are resized to a spatial dimension of [missing value]. The image is processed, and the bounding box positions and sizes of the corresponding pest targets are adjusted synchronously according to the image size transformation relationship, so that the resized bounding boxes correspond to the pest targets in the input image. Subsequently, the resized images are converted into the input data format required by the rice pest end-to-end detection network, and input into the rice pest end-to-end detection network in batches.

[0301] The AdamW optimization algorithm is used during training. The parameters of the AdamW optimizer... and Set them to 0.9 and 0.999 respectively, and set the global basic weight decay coefficient to the preset value.

[0302] A hierarchical learning rate strategy is adopted, setting corresponding base learning rates for parameters in the backbone network except for the normalization layer and bias parameters; setting independent learning rates for the normalization layer parameters in the backbone network and setting the corresponding weight decay coefficients to the corresponding values; using the set base learning rates for the remaining network parameters; and not performing weight decay on the normalization layer parameters and bias parameters in the encoder and decoder.

[0303] In this embodiment, the maximum number of training rounds is set to 300. The training data transformation strategy is switched at the 4th, 148th, and 288th rounds of training, respectively. MixUp augmentation is enabled in the training phases corresponding to the 4th to 148th rounds. Data augmentation is stopped after the 288th round of training, and the final parameters are adjusted using training samples without data augmentation in the 289th to 300th rounds.

[0304] In addition to MixUp augmentation, training data can also be augmented with at least one of the following basic data augmentations: random flipping, scaling, or color transformation, depending on the training data loading configuration.

[0305] The network training employs a joint loss function to optimize the parameters of the rice pest end-to-end detection network. This joint loss function includes variable focus classification loss, bounding box L1 regression loss, generalized intersection-over-union loss, fine-grained localization loss, and decoupled distillation focus loss, expressed as:

[0306]

[0307] in, This represents the total loss during network training; This represents the Variable Focus Loss (VFL), used to constrain the difference between the predicted pest target category and the true category label; This represents the bounding box L1 regression loss, used to constrain the positional and dimensional deviations between the predicted and actual bounding box parameters. This represents the generalized intersection-union loss, used to constrain the overlap between the predicted bounding box and the ground truth bounding box; This represents the fine-grained localization loss (FGL), which is used to constrain the localization distribution of the bounding box. This represents the Decoupled Distillation Focal Loss (DDF), which is used to constrain the localization distribution between different decoding layers through self-distillation.

[0308] In this embodiment, the weighting coefficients corresponding to each loss term , , , and Configure the settings according to the training configuration of the detection network.

[0309] The class balance parameter of the variable focus classification loss is set to 0.75, the easy / difficult sample adjustment parameter is set to 2.0, and the upper limit parameter of the bounding box localization distribution is set to 32.

[0310] The intersection-over-union ratio (IoU) between the predicted bounding box and the true bounding box is expressed as:

[0311]

[0312] in, Indicates the predicted bounding box. Represents the actual bounding box.

[0313] The generalized intersection-union ratio is expressed as:

[0314]

[0315] The corresponding generalized cross-union ratio loss is expressed as:

[0316]

[0317] in, Indicates that the predicted bounding box is surrounded simultaneously. and the true bounding box The smallest closure region, symbol This represents the set difference operation.

[0318] During the training phase of the detection network, the Hungarian matching algorithm is used to establish a one-to-one matching relationship between the predicted result set output by the object detection decoding module and the ground truth annotation set. The matching cost includes classification matching cost, bounding box L1 distance cost, and generalized intersection-union (CIU) cost, expressed as:

[0319]

[0320] in, Indicates the cost of classification matching. This represents the L1 distance cost of the bounding box. This represents the cost of matching generalized intersection and union.

[0321] The category-related parameters used in the matching phase are independent of the category balance parameters used in the variable focus classification loss in the joint loss function, and are set according to their respective training configurations.

[0322] The back-end processing device in step S5 includes an edge computing device, a server, or a mobile terminal with model inference capabilities. The back-end processing device includes a memory, a processor, and a detection program stored in the memory and executable by the processor.

[0323] The detection program loads the rice pest detection model that has been trained and verified in step S4, receives field images that are collected in real time or stored in advance by the rice pest image acquisition device, and sequentially performs size adjustment, data format conversion, network forward computation, and detection result parsing on the input images.

[0324] During the forward computation of the network, the detection program sequentially performs backbone feature extraction, multi-scale feature fusion, P4-scale MGDSConv morphological enhancement, P5-scale MGDSConv morphological enhancement, and DFINETransformer target detection decoding, and outputs rice pest identification results including pest category labels, predicted bounding box coordinates, and corresponding confidence levels.

[0325] The confidence level is used to represent the degree of credibility of the detection model's prediction of the corresponding prediction result. Its specific value range and calculation method are determined by the category prediction output format of the target detection decoding module.

Claims

1. A method for acquiring and detecting rice pest images based on morphology-guided dual-field serpentine feature reconstruction, characterized in that, Includes the following steps: S1. Acquire field images containing rice plants, pest targets, and natural environmental background using a rice pest image acquisition device; S2. Perform image filtering, pest target category labeling, and bounding box labeling on the field images to establish a rice pest target detection dataset; S3. Construct an end-to-end target detection network for rice pests. The target detection network includes a feature extraction backbone network, a multi-scale feature fusion module, a morphology-guided dual-field snake-like feature reconstruction module MGDSConv, and a target detection decoding module. The multi-scale feature fusion module fuses features of different scales output by the feature extraction backbone network, and sets the MGDSConv module on at least two scale feature branches; The MGDSConv module receives input feature X. The horizontal and vertical serpentine branches obtain tangential and normal offset fields through their respective dual-field offset generation units. The tangential and normal offset fields are locally smoothed, and the smoothed tangential offset fields of each branch are continuously recursively extrapolated along the positive and negative directions, based on the center position of the serpentine convolution sampling points, to form continuous serpentine cumulative offsets for the corresponding branches. Continuous sampling coordinates in the horizontal direction are established based on the continuous serpentine cumulative offsets and normal offsets corresponding to the horizontal branches, and continuous sampling coordinates in the vertical direction are established based on the continuous serpentine cumulative offsets and normal offsets corresponding to the vertical branches. The MGDSConv module further generates horizontal morphological response weights and vertical morphological response weights based on the local morphological change information represented by the continuous serpentine cumulative offset and normal offset corresponding to the horizontal and vertical branches, respectively. The horizontal morphological response weights are used to modulate the response of the horizontal serpentine features, and the vertical morphological response weights are used to modulate the response of the vertical serpentine features. The modulated horizontal serpentine features, the modulated vertical serpentine features, and the basic local features obtained from the input features are concatenated along the channel dimension and fused through channels to obtain morphological enhancement features. The multi-scale feature fusion module fuses the morphological enhancement features with the basic fusion features of the corresponding scale to obtain enhanced multi-scale features, and inputs the enhanced multi-scale features into the target detection decoding module. S4. Train the target detection network using the rice pest target detection dataset to obtain a rice pest detection model; S5. Deploy the trained rice pest detection model to the backend processing device, perform target detection inference on rice field images, and output pest category labels, predicted bounding box coordinates and corresponding confidence scores.

2. The method for rice pest image acquisition and detection based on morphology-guided dual-field serpentine feature reconstruction according to claim 1, characterized in that, The rice pest image acquisition device adopts a fixed rod type acquisition structure, including a fixed support module, an image acquisition module, an auxiliary lighting module, an attitude adjustment module, a distance detection module, and a data transmission module. The fixed support module includes a fixed base, a vertical support rod, and mounting connectors. The fixed base is set at a preset monitoring position in the rice field. The vertical support rod is installed on the fixed base. The mounting connectors are set on the vertical support rod and are used to install the attitude adjustment module, image acquisition module, auxiliary lighting module, and distance detection module. The attitude adjustment module includes a horizontal rotating base, a pitch support, a first drive motor, a second drive motor, and an attitude controller. The horizontal rotating base is driven by the first drive motor and is used to drive the image acquisition module to rotate around a first vertical rotation axis. The pitch support is driven by the second drive motor and is used to drive the image acquisition module to rotate around a second horizontal rotation axis. The image acquisition module is mounted on the pitch support and is used to acquire field images containing rice plants and pest targets. The auxiliary lighting module is located near the field of view of the image acquisition module and is used to provide supplementary lighting to the rice area to be monitored. The detection direction of the distance detection module is consistent with or approximately parallel to the shooting direction of the image acquisition module, and is used to obtain the spatial distance between the image acquisition module and the rice area to be monitored. The attitude controller controls the first drive motor and the second drive motor respectively based on the first angle deviation between the target azimuth angle and the current azimuth angle, and the second angle deviation between the target pitch angle and the current pitch angle, so that the area to be monitored enters the preset shooting field of view. The attitude controller or back-end processing device compares the spatial distance with a preset imaging distance range. When the spatial distance is within the preset imaging distance range, image acquisition is performed. When the spatial distance exceeds the preset imaging distance range, a position adjustment prompt is output or image acquisition is paused. The data transmission module is communicatively connected to the image acquisition module, attitude adjustment module, and distance detection module, and is used to transmit field images and the corresponding acquisition time, spatial distance, azimuth angle, and elevation angle information.

3. The method for rice pest image acquisition and detection based on morphology-guided dual-field serpentine feature reconstruction according to claim 1, characterized in that, Step S2 includes: S21. Filter the collected field images according to image clarity, integrity and target identifiability, and remove invalid images; S22. Label the rice pest targets in the screened field images with category and bounding box location; S23. Associate the image files with the corresponding annotation files, and divide them into training datasets and validation datasets according to a preset ratio; S24. Perform one or more data augmentation processes on the training dataset, including random flipping, scaling, cropping, rotation, brightness variation, color variation, and noise perturbation, to increase the sample distribution under different lighting, background, target pose, and target scale conditions.

4. The method for rice pest image acquisition and detection based on morphology-guided dual-field serpentine feature reconstruction according to claim 1, characterized in that, The MGDSConv module includes a basic local branch, a horizontal morphological serpentine branch, a vertical morphological serpentine branch, and a multi-morphological feature fusion unit; the horizontal morphological serpentine branch and the vertical morphological serpentine branch respectively include dual-field offset generation, local offset smoothing, continuous serpentine coordinate recursion, continuous coordinate feature sampling, serpentine convolution, and morphological response modulation processes. For input features Basic local features are obtained through basic local branches: in, Indicates the number of samples in the batch. Indicates the number of input channels. and These represent the height and width of the input feature, respectively. make ,in This indicates a horizontal, serpentine branch. This represents a vertical serpentine branch, with each serpentine branch obtaining a two-field offset through its corresponding offset generation unit: in, , This indicates the number of sampling points in the serpentine convolution kernel. Indicates the first The offsets corresponding to the serpentine branches generate convolutions. This indicates the corresponding batch normalization. Indicates the offset expansion factor; The dual-field migration is divided into the original tangential migration field and the original normal migration field along the channel dimension: Local smoothing is performed on the original tangential offset field and the original normal offset field, respectively; in, and They represent the first Tangential and normal offset fields after smoothing the serpentine branch shape; Continuous serpentine sampling trajectories are established for both horizontal and vertical serpentine branches. The serpentine convolution kernel is assumed to contain... There are 1 sampling point, and the index of the center sampling point is: For the Each serpentine branch shape is configured such that the cumulative tangential offset of the continuous serpentine pattern at the center sampling point is set as follows: Continuous recursion is performed along the positive direction of the sampling points: Continuous recursion is performed along the negative direction of the sampling points: in, Indicates the first The serpentine branch of the first form The continuous serpentine cumulative tangential offset corresponding to each sampling point; This represents the first branch in the smoothed tangential offset field. Tangential offset components corresponding to each sampling point; For horizontal serpentine branches, at characteristic locations Establish the first Continuous coordinates of each sampling point: For vertical serpentine branches, the first The continuous coordinates of each sampling point are: in, and These represent the first normal offset fields after smoothing the horizontal and vertical serpentine branches, respectively. Normal offset components corresponding to each sampling point; Features corresponding to each sampling point are obtained through bilinear continuous coordinate sampling, and the horizontal serpentine branches are... The sampled features corresponding to each sampling point are rearranged into the height dimension of the feature tensor according to the sampling point index order, and a convolution kernel with a size of [size missing] is used. Step size is The serpentine convolution is used to aggregate features and obtain horizontal serpentine features; In the vertical serpentine branch The sampled features corresponding to each sampling point are rearranged into the width dimension of the feature tensor according to the sampling point index order, and a convolution kernel with a size of [size missing] is used. Step size is The serpentine convolution is used to aggregate features and obtain vertical serpentine features.

5. The method for rice pest image acquisition and detection based on morphology-guided dual-field serpentine feature reconstruction according to claim 4, characterized in that, Construct corresponding shape response weights based on the continuous serpentine cumulative offset and normal offset of the horizontal and vertical serpentine branches respectively: For the Each serpentine branch is used to calculate the tangential and normal shape energies respectively: The tangential and normal morphological energies are cascaded along the channel dimension: The first is obtained through the morphological response mapping unit. The morphological response weights corresponding to each morphological serpentine branch: in, Represents morphological response mapping, Indicates the shape response output; The horizontal and vertical serpentine features are modulated using the morphological response weights of the corresponding branches: in, This represents element-wise multiplication; The basic local features, modulated horizontal serpentine features, and modulated vertical serpentine features are cascaded along the channel dimension: And obtain the MGDSConv output features by fusing convolutions: Among them, if , and The number of channels is ,but The number of channels is ; Will Each channel is mapped to a preset number of output channels. And keep the spatial dimensions unchanged.

6. The method for acquiring and detecting rice pest images based on morphology-guided dual-field serpentine feature reconstruction according to claim 1, characterized in that, The multi-scale feature fusion module includes a P4 scale feature branch and a P5 scale feature branch, and the MGDSConv module is set as a bypass of the corresponding scale feature branch. For P4 scale features Morphological enhancement features are obtained through the first MGDSConv module. and will and Perform channel cascading, via Fusion convolutions yield enhanced P4-scale output ; For P5 scale features Morphological enhancement features are obtained through the second MGDSConv module. and will and Perform channel cascading, via Fusion convolutions yield enhanced P5-scale output ; Will and The target detection and decoding module is input, which establishes the correlation between the target query and the feature space based on multi-scale features, and outputs the category prediction, bounding box coordinates and confidence score of rice pest targets. in, and As a multi-scale input to the target detection decoding module, the number of its channels is mapped to the preset hidden dimension of the target detection decoding module.

7. The method for rice pest image acquisition and detection based on morphology-guided dual-field serpentine feature reconstruction according to claim 1, characterized in that, In steps S4 and S5, the backend processing device includes a processor, a memory, and a detection program. The detection program is stored in the memory and executed by the processor. It is used to load the trained rice pest detection model and sequentially complete field image input, main stem feature extraction, multi-scale feature fusion, MGDSConv morphological feature reconstruction, and target detection decoding. During training, based on the matching relationship between the predicted target and the real labeled target, a joint loss including at least classification loss, bounding box regression loss, overlap loss and localization distribution correlation loss is calculated to update the parameters of the target detection network. During the inference process, the output of the input field image includes at least the pest category label, the predicted bounding box coordinates, and the category confidence score. The detection results are then associated and stored with the corresponding acquisition time, spatial distance, and acquisition posture information.