Machine vision-based spray bar adaptive adjustment method and system
By acquiring RGB and depth images of the crop canopy and extracting pest and disease features using a cross-stage pyramid attention module, adaptive adjustment commands for the spray boom are generated. This solves the problem of insufficient pesticide coverage in traditional spraying operations and enables precise pesticide application and increased coverage in diseased areas.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- TAIZHOU CITY CHUNGFENG MACHINERY
- Filing Date
- 2026-02-27
- Publication Date
- 2026-06-05
AI Technical Summary
Traditional agricultural spraying operations cannot be dynamically adjusted according to the actual distribution of pests and diseases in the field, resulting in insufficient pesticide coverage in severely affected areas, while waste of pesticides and environmental pollution occur in healthy areas. Existing machine vision-based pest and disease identification technologies lack global context modeling capabilities and have insufficient identification accuracy.
By acquiring RGB and depth images of the crop canopy, and using a cross-stage pyramid attention module to extract pest and disease features, combined with lesion pixel classification and the spray boom coordinate system, adaptive adjustment commands for spray boom height, flow rate, and angle are generated to achieve precise pesticide application to diseased areas.
It enables precise application of pesticide solution to diseased areas, increases disease coverage, reduces pesticide usage, and avoids pesticide waste and environmental pollution.
Smart Images

Figure CN122139722A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of machine vision technology, and in particular to a machine vision-based adaptive adjustment method and system for a spray boom. Background Technology
[0002] Traditional agricultural spraying operations employ a uniform spraying pattern with fixed parameters. The boom height, pesticide flow rate, and spray angle remain constant throughout the operation, making dynamic adjustments impossible based on the actual distribution of pests and diseases in the field. This results in insufficient pesticide coverage in severely affected areas, while wasteful pesticide application and environmental pollution occur in healthy areas. Existing machine vision-based pest and disease identification technologies mostly use standard convolutional neural networks for feature extraction, focusing only on texture information within the local receptive field. They lack the ability to model the global context for small, scattered lesions in the field, leading to insufficient identification accuracy. Summary of the Invention
[0003] This invention provides a machine vision-based adaptive adjustment method and system for spray booms. This invention can accurately deliver pesticide solution to the diseased area, reducing pesticide usage while increasing disease coverage.
[0004] In a first aspect, the present invention provides a machine vision-based adaptive adjustment method for a spray boom, the machine vision-based adaptive adjustment method for the spray boom comprising: RGB and depth images of the crop canopy are acquired, and the RGB images are segmented into image block sequences and mapped into spatial feature maps of pests and diseases. Based on the spatial feature map of the pests and diseases, lesion pixels are classified to obtain a disease severity index and a list of three-dimensional coordinates of disease instances. Divide the total horizontal length of the spray boom into N control units and establish a spray boom coordinate system. Project the three-dimensional coordinate list of the disease instances onto the spray boom coordinate system and assign them to the corresponding control units. Calculate the local disease density parameters by counting the number and area of diseases in the i-th control unit and extract the average crop height corresponding to the i-th control unit by combining the depth image. Based on the local disease density parameters and the average crop height, corresponding stepper motor pulse commands, solenoid valve flow commands, and servo motor angle commands are generated.
[0005] In conjunction with the first aspect, in a first implementation of the first aspect of the present invention, the step of acquiring RGB images and depth images of the crop canopy, and segmenting the RGB images into a sequence of image blocks and mapping them into a spatial feature map of pests and diseases, includes: An RGB image of the crop canopy in front of the sprayer is obtained by capturing the image using an RGB camera; A depth image is obtained by emitting near-infrared light pulses to the crop canopy using a depth camera and receiving the reflected light, and calculating the depth value based on the time difference between emission and reception. The RGB image is segmented into a sequence of image blocks and mapped to an embedding vector. Based on the embedding vector, main path attention calculation and auxiliary path feature direct transmission are performed to obtain a spatial feature map of pests and diseases.
[0006] In conjunction with the first aspect, in a second implementation of the first aspect of the present invention, the step of segmenting the RGB image into a sequence of image blocks and mapping them to embedding vectors, and performing main path attention calculation and auxiliary path feature direct transmission based on the embedding vectors to obtain a pest and disease spatial feature map, includes: The RGB image is segmented by a sliding window to form an image block sequence. Each image block in the image block sequence is flattened and mapped through a linear projection layer to obtain an embedding vector. The embedding vectors are divided into main path embedding vectors and auxiliary path embedding vectors in the channel dimension. The main path embedding vectors are linearly transformed by the query key matrix and the attention weights are calculated and then multiplied by the value matrix to obtain the main path attention features. The auxiliary path embedding vectors are directly passed to obtain the auxiliary path retained features. The main road attention features and the auxiliary road retention features are fused to obtain a spatial feature map of pests and diseases.
[0007] In conjunction with the first aspect, in the third implementation of the first aspect of the present invention, the step of dividing the embedding vector into a main path embedding vector and an auxiliary path embedding vector in the channel dimension, performing a linear transformation of the query key-value matrix on the main path embedding vector and calculating the attention weight, and then multiplying it with the value matrix to obtain the main path attention feature, and directly passing the auxiliary path embedding vector to obtain the auxiliary path retained feature, includes: The embedding vector is divided into a first part of the channel and a second part of the channel according to the channel dimension. The first part of the channel constitutes the main path embedding vector and the second part of the channel constitutes the auxiliary path embedding vector. The main path embedding vector is multiplied by the query weight matrix, key weight matrix, and value weight matrix respectively, and then linearly transformed to obtain the query matrix, key matrix, and value matrix. The query matrix is multiplied by the transpose of the key matrix and then scaled to obtain the attention weight matrix. The attention weight matrix is then multiplied by the value matrix to obtain the main path attention features. At the same time, the secondary path embedding vector is directly used as the secondary path retained features.
[0008] In conjunction with the first aspect, in the fourth implementation of the first aspect of the present invention, the step of classifying lesion pixels based on the spatial feature map of the pests and diseases to obtain a disease severity index and a list of three-dimensional coordinates of disease instances includes: The spatial feature map of the pests and diseases is classified into lesion pixels to obtain a set of lesion pixels. The RGB image is then converted to the HSV color space for leaf pixel analysis to obtain a set of leaf pixels. Calculate the geometric center coordinates of the leaf pixel set, calculate the Euclidean distance from each lesion pixel in the lesion pixel set to the geometric center coordinates and perform exponential decay weighting, divide the weighted sum by the total number of pixels in the leaf pixel set to obtain the disease severity index; The pixel coordinates of each lesion pixel in the lesion pixel set are transformed with the depth value of the corresponding position in the depth image to obtain a three-dimensional coordinate list of lesion instances.
[0009] In conjunction with the first aspect, in a fifth implementation of the first aspect of the present invention, the step of calculating the geometric center coordinates of the leaf pixel set, calculating the Euclidean distance from each lesion pixel in the lesion pixel set to the geometric center coordinates and performing exponential decay weighting, and dividing the weighted sum by the total number of pixels in the leaf pixel set to obtain the disease severity index includes: The center x-coordinate is obtained by summing the x-coordinates of all pixels in the leaf pixel set and dividing by the total number of pixels; the center y-coordinate is obtained by summing the y-coordinates of all pixels in the leaf pixel set and dividing by the total number of pixels. Construct the geometric center coordinates based on the central x-coordinate and the central y-coordinate; Calculate the Euclidean distance from each lesion pixel in the lesion pixel set to the geometric center coordinates, divide the Euclidean distance by the attenuation coefficient, take the negative value as the exponent base, and perform natural exponentiation to obtain the weighting coefficient of each lesion pixel; The weighted sum is obtained by summing the weighted coefficients of all lesion pixels in the lesion pixel set. The weighted sum is then divided by the total number of pixels in the leaf pixel set to obtain the disease severity index.
[0010] In conjunction with the first aspect, in the sixth implementation of the first aspect of the present invention, the step of dividing the total lateral length of the spray boom into N control units and establishing a spray boom coordinate system, projecting the three-dimensional coordinate list of the disease instances onto the spray boom coordinate system and assigning them to the corresponding control units, calculating the local disease density parameters by counting the number and area of diseases in the i-th control unit, and extracting the average crop height corresponding to the i-th control unit based on the depth image includes: Divide the total horizontal length of the spray boom into N control units and calculate the center horizontal coordinate and boundary coordinate of each control unit to establish the spray boom coordinate system. The horizontal coordinate of each disease instance in the three-dimensional coordinate list of disease instances is compared with the boundary coordinates of each control unit, and the disease instances whose central horizontal coordinate falls within the boundary range of the i-th control unit are assigned to the corresponding control unit. The total disease area is obtained by summing the number of disease instances belonging to the i-th control unit and the area of each disease instance. The number of disease instances is divided by the monitoring area of each control unit to obtain the number density component. The total disease area is multiplied by the area weighting coefficient to obtain the area density component. The number density component and the area density component are added together to obtain the local disease density parameter of the i-th control unit; Extract the pixels in the depth image whose depth values are within the valid range within the region corresponding to the i-th control unit and calculate the average depth value. Then, convert the average depth value into the average crop height within the region corresponding to the i-th control unit.
[0011] In conjunction with the first aspect, in the seventh implementation of the first aspect of the present invention, the stepping of generating corresponding stepper motor pulse commands, solenoid valve flow commands, and servo motor angle commands based on the local disease density parameters and the average crop height includes: Based on the local disease density parameter and the disease severity index, calculate the height adjustment value, flow rate adjustment value, and spray angle adjustment value of the i-th control unit; The speed value of the stepper motor is calculated based on the height adjustment amount of the i-th control unit, and the speed value is converted into the corresponding stepper motor pulse command; The corresponding PWM duty cycle is calculated based on the flow regulation value of the i-th control unit, and the corresponding solenoid valve flow command is generated based on the PWM duty cycle. Calculate the angle error, cumulative error, and error change rate based on the injection angle adjustment value of the i-th control unit, calculate the PID control quantity based on the angle error, the cumulative error, and the error change rate, and generate the corresponding servo motor angle command based on the PWM duty cycle.
[0012] In conjunction with the first aspect, in the eighth implementation of the first aspect of the present invention, the step of calculating the height adjustment amount, flow rate adjustment value, and injection angle adjustment value of the i-th control unit based on the local disease density parameter and the disease severity index includes: The density ratio is obtained by dividing the local disease density parameter by the maximum disease density parameter among the N control units. The density ratio is then multiplied by pi to calculate the sine function value. Finally, the disease severity index of the i-th control unit is multiplied by a preset constant to obtain the hyperbolic tangent function value. The disease downforce component is obtained by multiplying the sine function value by the disease response amplitude. The height tracking component is obtained by multiplying the difference between the average crop height in the area corresponding to the i-th control unit and the benchmark crop height by the height tracking coefficient. The height adjustment amount of the i-th control unit is obtained by adding the disease downforce component and the height tracking component. Multiply the hyperbolic tangent function value by the disease severity amplification factor and add 1 to obtain the disease severity factor. Calculate the average disease density parameter of N control units, subtract 1 from the ratio of the local disease density parameter of the i-th control unit to the average disease density parameter, multiply by the density deviation coefficient and add 1 to obtain the density deviation factor. Multiply the base flow value by the disease severity factor and the density deviation factor to obtain the flow regulation value of the i-th control unit. Calculate the average height adjustment of N control units. Subtract the height adjustment of the i-th control unit from the average height adjustment and multiply by the height linkage coefficient to obtain the height linkage term. Subtract the local disease density parameter of the i-th control unit from the average disease density parameter and multiply by the density correction coefficient to obtain the density correction term. Add the reference injection angle, wind speed compensation term, density correction term, and height linkage term to obtain the injection angle adjustment value of the i-th control unit.
[0013] Secondly, the present invention provides a machine vision-based adaptive adjustment system for a spray boom, the machine vision-based adaptive adjustment system for a spray boom comprising: The acquisition module is used to acquire RGB and depth images of the crop canopy, and to segment the RGB images into image block sequences and map them into spatial feature maps of pests and diseases; The classification module is used to classify lesion pixels based on the spatial feature map of the pests and diseases, and obtain a disease severity index and a list of three-dimensional coordinates of disease instances. The calculation module is used to divide the total horizontal length of the spray boom into N control units and establish a spray boom coordinate system. It projects the three-dimensional coordinate list of the disease instances onto the spray boom coordinate system and assigns them to the corresponding control units. It counts the number and area of diseases in the i-th control unit to calculate the local disease density parameters and extracts the average crop height corresponding to the i-th control unit by combining the depth image. The generation module is used to generate corresponding stepper motor pulse commands, solenoid valve flow commands, and servo motor angle commands based on the local disease density parameters and the average crop height.
[0014] The technical solution provided by this invention utilizes a feature extraction mechanism that combines main path attention calculation with auxiliary path feature direct transmission through a cross-stage pyramid attention module. This captures the global spatial dependency of the diseased area while preserving local texture details, effectively improving the detection and identification capabilities of small, scattered lesions in the field. By establishing a distance-weighted model from lesion pixels to the leaf center and using an exponential decay function to quantify the disease severity index, the invention scientifically reflects the actual impact weight of diseases in the leaf center area on crop photosynthesis. The invention divides the spray boom into multiple control units and establishes a nonlinear coupling mapping relationship between disease density parameters and spray boom physical parameters. Through the saturation characteristics of sine and hyperbolic tangent functions, it achieves maximum response in the peak disease density region and gain saturation when disease severity approaches its limit, avoiding excessive parameter adjustment. This enables the linked adaptive adjustment of three parameters: spray boom height, pesticide flow rate, and spray angle. Differential control commands are dynamically generated based on the local disease density, disease severity, and crop height of each control unit's corresponding region, precisely delivering pesticides to the diseased area, reducing pesticide usage while increasing disease coverage. Attached Figure Description
[0015] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0016] Figure 1 This is a schematic diagram illustrating the steps of the machine vision-based adaptive adjustment method for the spray boom in an embodiment of the present invention. Figure 2 This is a schematic diagram of the structure of the machine vision-based adaptive adjustment system for the spray boom in an embodiment of the present invention. Detailed Implementation
[0017] This invention provides a machine vision-based adaptive adjustment method and system for a spray boom. The terms "first," "second," "third," "fourth," etc. (if present) in the specification, claims, and accompanying drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" or "having" and any variations thereof are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0018] For ease of understanding, the specific process of the embodiments of the present invention is described below. Please refer to [link / reference]. Figure 1 One embodiment of the machine vision-based adaptive adjustment method for the spray boom in this invention includes: Step S1: Collect RGB and depth images of the crop canopy, and segment the RGB images into image block sequences and map them into spatial feature maps of pests and diseases; Specifically, a synchronized vision acquisition system is installed at the front of the spraying vehicle. This system includes an industrial-grade RGB camera and a time-of-flight (TOF) depth camera. The RGB camera, configured with a CMOS sensor, 1920×1080 resolution, 16mm lens focal length, and mounted at a 15° angle at 120cm above the ground, acquires color image information covering the crop canopy area within approximately 2 to 10 meters in front of the vehicle. Simultaneously, the depth camera emits 850nm near-infrared pulses and detects the time difference between their reflection from the crop canopy. Using a TOF algorithm, it calculates the depth value of each pixel in real time, generating a 640×480 resolution depth image with an accuracy of ±2cm. Synchronization is achieved through hardware trigger signals, ensuring that each pixel (x,y) of each frame of the RGB image is mapped to the corresponding depth value d(x,y). The two types of images, along with synchronized wind speed data, form a data frame with a unified timestamp. The RGB image is segmented into several fixed-size (e.g., 16×16 pixels) image patches using a non-overlapping sliding window. Each image patch is flattened into a one-dimensional vector and then input into a linear projection layer to map the original low-dimensional vectors to a unified high-dimensional embedding space, forming an embedding vector matrix. This embedding vector matrix is then input into a Pest-DINOv3 network incorporating a CSPPA module. The main feature processing path performs a multi-head self-attention mechanism on the embedding vectors to model the long-range correlations between image patches. Specifically, the main path embedding vectors are transformed into query Q, key K, and value V matrices, and an attention score matrix is calculated. After Softmax normalization to form a weight matrix, a weighted sum is obtained to obtain the main path's attention output. Simultaneously, the auxiliary path performs direct transmission on the embedding vectors of the other half of the channels, preserving the local texture details of the image patches. The main path attention output and the auxiliary path direct transmission features are concatenated along the channel dimension and fused through a 1×1 convolution to obtain the pest and disease spatial feature map. Step S2: Classify lesion pixels based on the spatial feature map of pests and diseases to obtain the severity index of the disease and a list of three-dimensional coordinates of disease instances; Specifically, based on the spatial feature map of pests and diseases, a classification operation is performed on each pixel location. The spatial feature map of pests and diseases is upsampled to the same size as the original RGB image, and the feature vector corresponding to each pixel location is extracted. A two-layer fully connected classifier is used to determine whether it belongs to the lesion region, generating a binary image containing the lesion classification probability. The RGB image of the corresponding location is simultaneously converted to the HSV color space. Pixels whose color features match the typical appearance of lesions are selected by using hue, saturation, and brightness thresholds. Candidate pixels for lesions with probability values higher than a set threshold (e.g., 0.7) are cross-validated with the HSV rule selection results to obtain a set of lesion pixels. The green vegetation index is used to judge the pixel areas not marked as lesions, and pixels whose color features meet the standards of healthy vegetation are selected to construct a set of leaf pixels. The geometric center coordinates of the leaf region are calculated using the average coordinates of all pixels in the set. Using the geometric center as a reference, the Euclidean distance between each pixel in the lesion pixel set and the center point is calculated. Each distance value is input into an exponential decay function to generate a corresponding weight coefficient, where the weight decreases as the distance increases, reflecting the physiological assumption that the closer to the center of the leaf, the greater the weight of the disease's influence. The exponential decay weighted values corresponding to all lesion pixels are summed to form the weighted sum of lesion areas. The total number of pixels in the leaf pixel set is used as the normalized denominator. Dividing the weighted sum by the denominator yields the disease severity index DSI, which ranges from [0,1] and quantitatively reflects the relative degree of disease infection on the entire leaf. The image plane coordinates of each pixel in the lesion pixel set are matched with the depth value of the corresponding position in the depth image. Based on a pre-calibrated camera intrinsic and extrinsic parameter model, each pixel coordinate is converted into a corresponding three-dimensional spatial coordinate point, which includes the position, lesion area, shape bounding box, and corresponding DSI value, constructing a three-dimensional coordinate list of disease instances.
[0019] Step S3: Divide the total horizontal length of the spray boom into N control units and establish a spray boom coordinate system. Project the three-dimensional coordinate list of disease instances onto the spray boom coordinate system and assign them to the corresponding control units. Calculate the local disease density parameters by counting the number and area of diseases in the i-th control unit and extract the average crop height corresponding to the i-th control unit by combining the depth image. Specifically, the total lateral length of the spray boom is divided into multiple equal-width control units. For example, a total length of 6 meters is divided into 10 control units, each with a width of 0.6 meters. The center lateral coordinate of each unit is calculated; for example, the center lateral coordinate of the i-th unit is (i–0.5)×0.6 meters, and the boundary coordinates are [(i–1)×0.6, i×0.6] meters. A coordinate system is established with the center of the spray boom as the origin, where the X-axis points in the opposite direction to the vehicle's forward movement, the Y-axis points to the left, and the Z-axis points vertically upward. The three-dimensional coordinate list of defect instances is traversed, and the lateral spatial position Y-coordinate of each defect instance is read and compared with the boundary interval of each unit to determine which unit it belongs to. If the coordinate falls within a certain interval, the defect instance is assigned to the corresponding unit, thus completing the spatial assignment of the defect instances along the lateral direction of the spray boom. After establishing the attribution relationship between disease instances and spray boom segments, the number of disease instances assigned to each unit is counted, and the sum of the spatial projected areas of these disease instances is accumulated to obtain the total disease area of the current unit. Then, based on the forward monitoring area area of each unit (assumed to be 0.6 m × 2 m = 1.2 square meters), the number of disease instances is divided by 1.2 square meters to reflect the disease density per unit area. Simultaneously, the total disease area is multiplied by a fixed normalization coefficient (e.g., 0.5) to obtain the area density index. Finally, the two are added together to form the local disease density parameter of the current unit, comprehensively reflecting the density and coverage of disease distribution in front of the spray boom segment. Meanwhile, for the i-th control unit, the average crop height of its corresponding area is extracted as the basis for spray boom lifting and lowering adjustment. The image area of the corresponding unit is located in the depth map, and all pixels with depth values within the valid range are selected. For example, pixels with depths between 50 cm and 150 cm are considered valid values, and the average depth is obtained by averaging the depth values of these pixels. Since the depth camera is installed at a fixed height of 120 cm and has a downward angle of 15 degrees, the average depth is multiplied by the cosine of the downward angle and then subtracted from the camera installation height to convert it into the actual average crop height.
[0020] Step S4: Generate corresponding stepper motor pulse commands, solenoid valve flow commands, and servo motor angle commands based on local disease density parameters and average crop height.
[0021] Specifically, based on the local disease density parameters and disease severity indicators corresponding to each control unit as core inputs, the required boom height adjustment, pesticide flow rate adjustment, and spray angle adjustment are calculated respectively. The height adjustment is obtained by amplifying the difference between the average crop height and the reference height by a certain factor, and then superimposing a dynamic downward pressure component proportional to the disease severity. The dynamic downward pressure component forms its maximum amplitude through a sine function when the disease density reaches its peak. In areas with high disease density and severe disease, the nozzle downward pressure is increased to shorten the spray distance and enhance penetration. The pesticide flow rate adjustment value achieves response saturation control based on the disease severity through a hyperbolic tangent function. That is, when the disease severity approaches the maximum value, the flow rate increment tends to stabilize to prevent pesticide waste. It also considers the deviation of the disease density from the average density of the entire field to form a differential liquid supply adjustment logic for different areas. The spray angle adjustment value makes offset compensation based on the magnitude of the lateral wind speed and superimposes the response gain of disease density and the geometric offset correction term caused by the change of boom height to maintain stable coverage of the pesticide spraying direction under wind field interference and physical structure changes. The height adjustment is converted into the displacement value of the stepper motor, and its movement speed is determined using a speed planning curve. The speed planning follows a three-stage change rule of acceleration, constant speed, and deceleration. That is, a triangular speed curve is used for short-distance movement, and a trapezoidal speed curve is used for long-distance movement. The target speed value per unit time is determined, and then the speed value is converted into the number of pulses per unit time. For example, if the stepper motor moves 5 mm per revolution and each revolution corresponds to 200 pulses, then 1 cm of displacement corresponds to 400 pulses. The instantaneous pulse frequency is obtained by multiplying the speed by a conversion factor. The instantaneous pulse frequency is used to generate the pulse signal of the stepper motor, which constitutes the pulse command to drive the stepper motor. For the flow rate adjustment value, the solenoid valve control curve is consulted according to the required flow rate value. Within the linear adjustment range of 0.5 to 2.5 L / min, the flow rate value is converted into the duty cycle of the PWM signal. Specifically, 0.5 L / min corresponds to a duty cycle of 40%, 2.5 L / min corresponds to 100%, and other values are calculated according to the linear ratio to obtain the required duty cycle. This duty cycle is then configured as a PWM signal output to form the flow control command of the solenoid valve. The angle error is calculated by comparing the injection angle adjustment value with the actual injection angle and accumulating historical error values to form an integral term. At the same time, the difference between the current error and the previous error is differentiated to form a differential term. The weighted sum of the three constitutes the output of the PID closed-loop controller. After the control quantity is limited within a certain range, it is mapped to a PWM duty cycle signal between 0 and 100% to drive the servo motor to rotate, thereby completing the target angle adjustment. The PWM duty cycle signal is the angle control command of the servo motor.
[0022] In one specific embodiment, the process of performing step S1 may specifically include the following steps: An RGB image of the crop canopy in front of the sprayer is obtained by capturing the image using an RGB camera; A depth image is obtained by emitting near-infrared light pulses to the crop canopy using a depth camera and receiving the reflected light, and calculating the depth value based on the time difference between emission and reception. The RGB image is segmented into a sequence of image blocks and mapped to an embedding vector. Based on the embedding vector, the main path attention is calculated and the auxiliary path features are directly transmitted to obtain the spatial feature map of pests and diseases.
[0023] Specifically, a binocular vision system, including an RGB camera and a depth camera, is installed at the front end of the spraying platform. The RGB camera is used to acquire high-resolution color images of the crop canopy. The camera uses an industrial-grade CMOS sensor with a spatial resolution of 1920×1080 pixels and is equipped with a 16mm focal length lens. It is mounted at a height of 120cm above the ground with the lens tilted downwards at a 15-degree angle, allowing the camera to completely cover the crop canopy area within a range of 2 to 10 meters in front of it. At the same time, the depth camera uses the TOF (Time-of-Flight) imaging principle. It emits near-infrared light pulses with a wavelength of 850nm to illuminate the surface of the crop canopy, and then uses the receiver to record the reflected signal and measure its propagation delay to calculate the spatial depth value of the target point, forming a depth image containing the depth information corresponding to each pixel. The depth map has a resolution of 640×480 pixels, a ranging accuracy of ±2cm, a ranging range of 0.3 to 5 meters, and is time-synchronized with the RGB image at a frame rate of 30fps. A hardware-level synchronization triggering mechanism controls two cameras to begin exposure at the same time point. Simultaneously, a unified timestamp is appended to the acquired RGB and depth images, and these images, along with the wind speed vector acquired by the three-axis anemometer, are packaged and stored in a multimodal data frame. A fixed-step sliding window segmentation operation is performed on the RGB image, dividing the entire image into 8100 image blocks with 16×16 pixels as the basic unit. Each image block is flattened into a 256-dimensional one-dimensional vector and input into a linear projection layer, mapping its dimensions to a 768-dimensional unified embedding vector to form an image embedding matrix. The image embedding matrix is input into the Pest-DINOv3 feature extraction network, which integrates a cross-stage pyramidal attention structure (CSPPA) module. The CSPPA module splits the embedding matrix in two along the channel dimension. One part serves as the main path feature input, entering a pyramidal multi-head self-attention computation process. This involves generating a query matrix, key matrix, and value matrix through linear transformations, and performing an inner product operation on the query and key matrices to construct global relationships between image patches. Scaling and softmax normalization are then applied to obtain the attention weight matrix, which is then weighted and summed with the value matrix to output the main path attention features. The other part of the channel serves as the auxiliary path features, retaining the original structural information without any transformation, thus preserving local texture details. The global context features output from the main path and the local features preserved by the auxiliary path are concatenated along the channel dimension and then input into a 1×1 convolutional fusion layer to complete feature integration. The output is a spatial feature map of pests and diseases that simultaneously preserves spatial layout, detailed information, and long-distance dependent perception capabilities.
[0024] In one specific embodiment, the process of segmenting the RGB image into a sequence of image patches and mapping them to embedding vectors, and then performing main path attention calculation and auxiliary path feature direct transmission based on the embedding vectors to obtain the spatial feature map of pests and diseases can specifically include the following steps: The RGB image is segmented by a sliding window to form a sequence of image patches. Each image patch in the sequence is flattened and mapped through a linear projection layer to obtain an embedding vector. The embedding vectors are divided into main path embedding vectors and auxiliary path embedding vectors in the channel dimension. The main path embedding vectors are linearly transformed by the query key matrix and the attention weights are calculated and then multiplied by the value matrix to obtain the main path attention features. The auxiliary path embedding vectors are directly passed to obtain the auxiliary path retained features. By fusing the attention features of the main road with the preserved features of the auxiliary road, a spatial feature map of pests and diseases is obtained.
[0025] Specifically, a sliding window spatial segmentation operation is performed on the RGB image, dividing the entire image into non-overlapping 16×16 pixel units. This process is repeated row by row and column by column until the entire image is traversed, dividing the 1920×1080 pixel input image into 120 columns × 67.5 rows, totaling 8100 image blocks, forming a spatially ordered sequence of image blocks. Each image block in the sequence is unfolded, flattening its three-dimensional structure into a one-dimensional vector, forming a low-dimensional original feature vector of length 256 for each block. This low-dimensional original feature vector is then input into a linear projection layer, which consists of a fully connected network. Its function is to uniformly map each 256-dimensional image block vector to a 768-dimensional embedding vector, resulting in a set of consistent high-dimensional representations, forming an image embedding matrix of shape 8100×768. The image embedding matrix is separated along the channel dimension. Each 768-dimensional embedding vector is divided into two 384-dimensional sub-vectors along its dimension, one as the main path embedding vector and the other as the auxiliary path embedding vector for feature preservation. For the main path embedding vector, a query matrix, a key matrix, and a value matrix are constructed through three linear transformation layers. These three matrices have the same shape as the main path dimension to capture the contextual semantic dependencies between image patches. The query matrix and the key matrix are subjected to block-wise inner product operation, and the result is scaled to form an attention score matrix. Then, a Softmax normalization operation is applied to each row to transform it into an attention weight matrix. A weighted summation operation is performed on the attention weight matrix and the value matrix to obtain the main path attention features that model the contextual relationships of pests and diseases in the whole image. At the same time, the auxiliary path embedding vector is not transformed and is directly passed to the next stage as the local structure preservation path to preserve the original details of the image. The main path attention features and the auxiliary path preserved features are concatenated along the channel dimension and input into a 1×1 convolutional fusion layer with the same number of channels for compression and integration, outputting a spatial feature map corresponding to the arrangement of image patches.
[0026] In one specific embodiment, the process of dividing the embedding vector into a main path embedding vector and an auxiliary path embedding vector in the channel dimension, performing a linear transformation of the query key matrix on the main path embedding vector and calculating the attention weights, and then multiplying them with the value matrix to obtain the main path attention features, and directly passing the auxiliary path embedding vectors to obtain the auxiliary path preserved features, can specifically include the following steps: The embedding vector is divided into a first part of the channel and a second part of the channel according to the channel dimension. The first part of the channel constitutes the main path embedding vector and the second part of the channel constitutes the auxiliary path embedding vector. The main path embedding vector is multiplied by the query weight matrix, key weight matrix, and value weight matrix respectively, and then linearly transformed to obtain the query matrix, key matrix, and value matrix. The query matrix is multiplied by the transpose of the key matrix and then scaled to obtain the attention weight matrix. The attention weight matrix is then multiplied by the value matrix to obtain the main path attention features, while the secondary path embedding vector is directly used as the secondary path retained features.
[0027] Specifically, a feature splitting operation is performed on the image patch embedding vector sequence along the channel dimension. Each 768-dimensional embedding vector is proportionally divided into two parts along the channel dimension. The first 384 dimensions are used as the first part of the channel to construct the main path embedding vector, and the last 384 dimensions are used as the second part of the channel to construct the auxiliary path embedding vector. Global modeling computation is concentrated within the main path channel, while the auxiliary path part retains its undisturbed local representation structure to improve the preservation of spatial texture information. After obtaining the main path embedding vector, matrix multiplication is performed with three independent linear weight matrices to generate a query matrix, a key matrix, and a value matrix, respectively. The dimension of each weight matrix matches the main path channel, and the parameters are trained through backpropagation to make it discriminative and responsive in feature encoding. The generated query matrix and key matrix are multiplied by a dot product operation, i.e., the query vector of each image patch is paired with the key vectors of all image patches to obtain a relative weight score matrix reflecting the similarity between any image patches. Each row of the weight score matrix is then scaled to stabilize the numerical distribution, and normalized to form the attention weight matrix, representing the contribution to all other image patches when constructing the features of the t-th image patch. The attention weight matrix and value matrix are then weighted and summed to obtain the global attention features under the main path, capturing the non-local response relationships between image patches and describing the semantic associations of lesion regions in the entire image. Simultaneously, during the entire main path attention modeling process, the auxiliary path embedding vectors are passed invariably without any transformation, preserving the original structural information as auxiliary path features.
[0028] In one specific embodiment, the process of performing step S2 may specifically include the following steps: The spatial feature map of pests and diseases is classified into lesion pixels to obtain a set of lesion pixels. Then, the RGB image is converted to the HSV color space for leaf pixel analysis to obtain a set of leaf pixels. Calculate the geometric center coordinates of the leaf pixel set, calculate the Euclidean distance from each lesion pixel in the lesion pixel set to the geometric center coordinates and apply exponential decay weighting, divide the weighted sum by the total number of pixels in the leaf pixel set to obtain the disease severity index; The pixel coordinates of each lesion pixel in the lesion pixel set are transformed with the depth value of the corresponding position in the depth image to obtain a three-dimensional coordinate list of lesion instances.
[0029] Specifically, based on the spatial feature map of pests and diseases, a lesion pixel classification operation is performed on each pixel location in the image. This involves pixel-by-pixel classification of the feature map, inputting the high-dimensional feature vector corresponding to each pixel into a pre-trained two-layer fully connected neural network classification head. The classification head outputs the probability value of each pixel belonging to the lesion category and determines whether the pixel should be marked as a lesion pixel based on a set probability threshold, constructing a lesion pixel set that spatially forms several unconnected disease regions. To determine the complete boundary of the leaf and calculate the influence of lesions on the entire leaf, the original RGB image is converted to the HSV color space. Pixels that match the color characteristics of green plants are selected by extracting the hue, saturation, and brightness information of the pixels. Pixels with a hue range between 25° and 75°, a saturation higher than 0.4, and a brightness lower than 0.6 are selected as leaf pixels. These pixels constitute the leaf pixel set, reflecting the spatial distribution of plant tissue in the current image. The geometric center coordinates of the leaf pixel set are calculated. The position coordinates of all leaf pixels are summed and divided by the total number of pixels to determine a reference position representing the center of the entire leaf. Spatial distance calculations are performed on each pixel in the lesion pixel set. Euclidean distance is used to measure the straight-line distance between the pixel and the geometric center. Simultaneously, the distance value is input as a variable into an exponential decay function to construct corresponding weighting coefficients. The farther the lesion pixel is from the center, the smaller the weight value, reflecting that lesions closer to the leaf center have a greater impact on physiological processes such as photosynthesis, and are therefore more harmful. The weighting coefficients of all lesion pixels are summed to obtain the total weight value of the lesion. This total weight value is then divided by the total number of pixels in the leaf pixel set to obtain a disease severity index, ranging from 0 to 1, with a higher value indicating a more severe lesion impact. The lesions are then mapped from the image plane to three-dimensional space. The image coordinates of the lesion pixels are registered with the depth values of the corresponding positions in the depth image. The planar position of each lesion pixel is calculated in conjunction with its depth value using the system's preset camera intrinsic parameters (including principal point position and focal length parameters) to obtain the real spatial position coordinates. The real spatial position coordinates consist of three components: lateral displacement, longitudinal displacement, and forward distance. This restores the three-dimensional position of the lesion in the actual physical space and constructs a three-dimensional coordinate list of disease instances, which includes spatial coordinate information as well as attribute information such as the area, bounding box, and severity level of the lesion.
[0030] In one specific embodiment, the process of calculating the geometric center coordinates of the leaf pixel set, calculating the Euclidean distance from each lesion pixel in the lesion pixel set to the geometric center coordinates and applying exponential decay weighting, and dividing the weighted sum by the total number of pixels in the leaf pixel set to obtain the disease severity index can specifically include the following steps: The center x-coordinate is obtained by summing the x-coordinates of all pixels in the leaf pixel set and dividing by the total number of pixels; the center y-coordinate is obtained by summing the y-coordinates of all pixels in the leaf pixel set and dividing by the total number of pixels. Construct the geometric center coordinates based on the center x-coordinate and center y-coordinate; Calculate the Euclidean distance from each lesion pixel in the lesion pixel set to the geometric center coordinates, divide the Euclidean distance by the attenuation coefficient, take the negative value as the exponent base, and perform natural exponentiation to obtain the weighting coefficient of each lesion pixel. The weighted sum is obtained by summing the weighted coefficients of all lesion pixels in the lesion pixel set. The weighted sum is then divided by the total number of pixels in the leaf pixel set to obtain the disease severity index.
[0031] Specifically, the abscissas of all pixels in the leaf pixel set are summed, and the sum is divided by the number of pixels to obtain the center abscissa value. The ordinates of all pixels are summed and divided by the total number of pixels to obtain the center ordinate value, thus constructing the geometric center coordinates of the leaf region and representing the morphological centroid position of the entire leaf in two-dimensional image space. Using the geometric center as a reference point, the Euclidean distance between the spatial position of each pixel in the lesion pixel set and the geometric center is calculated. The horizontal and vertical offsets of each lesion pixel relative to the geometric center are squared, summed, and then the square root is taken to obtain the actual distance from the lesion pixel to the leaf center. The Euclidean distance is exponentially decayed by dividing the Euclidean distance of each lesion pixel by a preset decay coefficient, for example, set to 50 pixels. This results in a weight of approximately 0.368 when the lesion is 50 pixels from the center, and a weight decaying to approximately 0.135 when the distance increases to 100 pixels. This reflects the physiological assumption that the farther the lesion is from the center, the smaller its impact on the leaf's photosynthetic tissue. The negative value of the ratio of distance to attenuation coefficient is used as the base of the natural index for exponential calculation. This involves applying the natural exponential function to the value to obtain the weighted coefficient for each lesion pixel, reflecting the spatial distribution weight of the relative importance of each lesion pixel. The weighted coefficients of all lesion pixels are summed to obtain the weighted sum of the entire lesion area. This weighted sum is then divided by the total number of pixels in the leaf pixel set to complete the normalization process, outputting a disease severity index. The index value ranges from 0 to 1; a higher value indicates a more concentrated lesion distribution, closer to the functional core area, and thus a higher physiological impact and spray priority.
[0032] The process includes the following steps after obtaining the lesion pixel set and before generating the 3D coordinate list of disease instances: Connected component clustering and instance-level feature extraction are performed on the lesion pixels. This involves: labeling the lesion pixel set with eight neighboring connected components; traversing each lesion pixel and checking if its eight neighboring pixels belong to the lesion pixel set; if adjacent pixels belong to the same lesion, they are labeled as the same connected component; after labeling all pixels, the number of connected components is counted and a unique identifier is assigned to each, resulting in a lesion connected component set; performing morphological opening operations on each connected component in the lesion connected component set to remove isolated noise points; using structuring elements to erode the connected components and then performing dilation operations; identifying and removing small connected components with an area smaller than a preset threshold after erosion as noise; performing morphological closing operations on the remaining connected components to fill internal voids; and using structuring elements to first dilate and then erode to smooth the boundaries of the connected components, resulting in a refined lesion connected component set; traversing each connected component in the refined lesion connected component set and extracting the x-coordinates and y-coordinates of all pixels within the connected component. The minimum and maximum values of the ordinate are used to construct the bounding rectangle. The total number of pixels in the connected region is calculated as the lesion area. The centroid coordinates of the connected region are extracted as the lesion center position. The ratio of the perimeter to the area of the connected region is calculated as the compactness feature. The ratio of the major axis to the minor axis of the connected region is calculated as the elongation feature, resulting in a geometric feature vector for each lesion instance. Based on the geometric feature vector, a confidence score is calculated for each lesion instance. The lesion area is compared with a preset area range to obtain the area confidence component. When the area is within a reasonable range, the confidence component is set to 1; otherwise, it decreases according to the degree of deviation. The compactness feature is compared with a standard lesion compactness threshold to obtain the shape confidence component. The elongation feature is compared with a standard lesion elongation threshold to obtain the orientation confidence component. The three confidence components are weighted and summed to obtain the comprehensive confidence score of the lesion instance. Lesion instances with confidence scores higher than a preset threshold are selected as valid disease instances, resulting in a set of valid disease instances and their corresponding bounding boxes, center positions, and area parameters.
[0033] The process involves transforming the pixel coordinates of each lesion pixel in the lesion pixel set with the corresponding depth value in the depth image to obtain a 3D coordinate list of lesion instances. This includes: performing bilateral filtering denoising on the depth image; traversing each pixel in the depth image; calculating spatial distance weights and depth value difference weights within the neighborhood window of that pixel; using a Gaussian function to calculate the Euclidean distance from neighboring pixels to the center pixel and then taking an exponentially decaying value; and using a Gaussian function to calculate the depth difference between neighboring pixels and the center pixel and then taking an exponentially decaying value. The distance weight and the depth difference weight are multiplied to obtain the comprehensive weight of the neighboring pixels. The depth values of all pixels in the neighborhood are then weighted and averaged according to the comprehensive weight to obtain the filtered depth value of the center pixel. After completing the full image traversal, a denoised depth image is obtained. For each lesion pixel in the lesion pixel set, its pixel coordinates and the corresponding depth value in the denoised depth image are extracted. It is determined whether the depth value is within the valid measurement range. When the depth value is zero or exceeds the depth camera's measurement limit, it is marked as invalid depth. For lesion pixels with invalid depth, a neighborhood depth interpolation method is used to search within the neighborhood window of that pixel. For pixels with effective depth values, the interpolated depth is obtained by averaging the effective depth values of their neighbors using the inverse of distance. This interpolated depth is then assigned to the lesion pixel, resulting in a complete correspondence between the lesion pixel coordinates and depth values. Distortion correction is performed on the lesion pixel coordinates based on the camera intrinsic matrix and distortion coefficients. The normalized pixel coordinates are obtained by subtracting the camera principal point coordinates from the pixel coordinates. The distortion correction amount is calculated based on the radial and tangential distortion coefficients. The distortion correction is applied to the normalized pixel coordinates to obtain the corrected normalized coordinates. Finally, the corrected normalized coordinates are multiplied by the corresponding depth value and divided by the focal length. The parameters are used to obtain the three-dimensional coordinates of the lesion pixel in the camera coordinate system. The three-dimensional coordinates in the camera coordinate system are transformed to the sprayer body coordinate system through a rotation matrix and a translation vector. A coordinate transformation matrix is constructed based on the installation pose parameters of the camera relative to the sprayer. The three-dimensional coordinates in the camera coordinate system are first rotated and then translated. It is determined whether the transformed three-dimensional coordinates are within a reasonable crop canopy space. Abnormal three-dimensional coordinates that exceed the reasonable height or lateral range are removed. The valid three-dimensional coordinates of disease instances are retained and organized into a list of three-dimensional coordinates of disease instances.
[0034] In one specific embodiment, the process of performing step S3 may specifically include the following steps: Divide the total horizontal length of the spray boom into N control units and calculate the center horizontal coordinate and boundary coordinate of each control unit to establish the spray boom coordinate system. Compare the x-coordinate of each disease instance in the 3D coordinate list with the boundary coordinates of each control unit, and assign the disease instances whose center x-coordinate falls within the boundary range of the i-th control unit to the corresponding control unit. The total disease area is obtained by summing the number of disease instances belonging to the i-th control unit and the area of each disease instance. The number of disease instances is divided by the monitoring area of each control unit to obtain the number density component. The total disease area is multiplied by the area weighting coefficient to obtain the area density component. The number density component and the area density component are added together to obtain the local disease density parameter of the i-th control unit; Extract the pixels in the depth image whose depth values are within the valid range corresponding to the i-th control unit region and calculate the average depth value. Convert the average depth value into the average crop height in the i-th control unit region.
[0035] Specifically, the total physical length of the spray boom in the lateral direction is divided into equal intervals according to a preset number N. For example, when the total length of the spray boom is 6 meters and N is set to 10, the lateral length of each control unit is 0.6 meters, and each unit is numbered from unit 1 to unit N accordingly. At the same time, the boundary coordinate interval of each control unit in the spray boom coordinate system is calculated, where the lateral start and end range of the i-th control unit is from (i... 1) × 0.6 meters to i × 0.6 meters, with the center x-coordinate as (i 0.5) × 0.6 meters. The spray boom coordinate system has the center of the spray boom as the origin, the Y′ axis points to the lateral extension direction of the spray boom, the X′ axis is reversed along the vehicle's forward direction, and the Z′ axis is vertically upward, used to uniformly describe the spatial projection position of each defect instance. The list of 3D coordinates of the defect instances with completed spatial positioning is traversed line by line, extracting the lateral coordinates of each defect instance in the vehicle coordinate system, and mapping them to the corresponding lateral coordinates in the spray boom coordinate system according to the transformation relationship. Then, the lateral coordinates are compared with the boundary coordinates of each control unit. If the lateral coordinate of a defect instance falls within the boundary range of a certain control unit, it is assigned to that control unit, forming a subset of defect instances covered by the i-th control unit. After completing the spatial assignment determination of defect instances, the defect instances assigned to each control unit are statistically processed, the number of defect instances is recorded, and the areas of all defect instances are summed to obtain the total defect area of that unit. To quantify the disease density level in the current area, normalization is performed based on the spatial monitoring area of the unit. For example, by default, the monitoring area is a 2-meter depth range in front of each unit, then the monitoring area is 0.6 meters × 2 meters = 1.2 square meters. Dividing the number of diseases by 1.2 square meters yields the number density component. Simultaneously, the total disease area is multiplied by an area weighting coefficient, for example, set to 0.5, to give the lesion area a relatively balanced influence weight in the density composition, yielding the area density component. The two components are added together to obtain the local disease density parameter of the i-th control unit, comprehensively reflecting the concentration and coverage of diseases in this spatial area. The height characteristics of the crop in front of the boom control unit are estimated to guide the boom lifting and lowering adjustment operation. Pixel regions corresponding to the horizontal interval of the i-th control unit are extracted from the depth image, and all pixels with depth values within the effective crop height range are selected, for example, depth values between 50cm and 150cm are limited to be valid values, thereby eliminating interference from the ground, cavities, or background. The mean of the depth values of the valid pixels is then calculated to obtain the average depth of field within the field of view of this control unit. Since the depth camera is installed at a fixed height of 120cm and shoots downwards at a 15-degree angle, the average depth value is multiplied by the cosine of 15 degrees for projection correction, and the projected depth value is subtracted from the camera installation height to obtain the average actual height of the crop canopy in the area.
[0036] In one specific embodiment, the process of performing step S4 may specifically include the following steps: Calculate the height adjustment, flow rate adjustment, and injection angle adjustment value of the i-th control unit based on the local disease density parameter and disease severity index; The speed value of the stepper motor is calculated based on the height adjustment amount of the i-th control unit, and the speed value is converted into the corresponding stepper motor pulse command; The corresponding PWM duty cycle is calculated based on the flow regulation value of the i-th control unit, and the corresponding solenoid valve flow command is generated based on the PWM duty cycle. Calculate the angle error, cumulative error, and error change rate based on the injection angle adjustment value of the i-th control unit, calculate the PID control quantity based on the angle error, cumulative error, and error change rate, and generate the corresponding servo motor angle command according to the PWM duty cycle.
[0037] Specifically, the local disease density parameter and disease severity index of each control unit are used as inputs to the adjustment model. The target boom height adjustment, liquid flow rate adjustment and spray angle adjustment of the i-th control unit are calculated respectively through nonlinear mapping relationship. In the calculation of height adjustment, the difference between the average crop height and the baseline spraying height is used as the basic adjustment value. A joint response term of disease severity index and disease density value is introduced. When the disease density value is high and the density is close to the extreme value, the downward pressure of the spray boom is increased. This term is modulated by a sine function to avoid a drastic response to height adjustment when the disease density is too low. The flow rate adjustment value is constructed based on the disease severity to form a flow rate gain factor, and a hyperbolic tangent function is used to form an incremental saturation characteristic for the high severity range to prevent the flow rate from increasing infinitely when the DSI approaches 1. At the same time, the deviation of the disease density from the average density of the whole field is introduced as a compensation coefficient to reflect the adjustment logic of increased pesticide demand in high density areas. The construction of the spray angle adjustment value takes into account the influence of wind speed on pesticide drift, the requirements of disease spatial density on spray coverage, and the geometric offset effect caused by changes in spray boom height. The three factors are superimposed to form the target spray angle value. The height adjustment value is used as the displacement target input to the stepper motor speed planning module. Based on the current displacement amplitude, a suitable speed curve mode is selected. If the target displacement is less than a certain length, a triangular speed curve is used for smooth acceleration and deceleration; if it exceeds this threshold, a standard trapezoidal speed curve is used. In the initial stage, the motor accelerates to its maximum speed with constant acceleration, moves at a constant speed in the middle, and finally decelerates to zero with opposite acceleration. The time for each stage is calculated, and the corresponding speed value at each moment is determined. The speed value is then multiplied by a conversion factor (e.g., 400 pulses correspond to 1 cm displacement), converting the speed value into the corresponding stepper motor pulse frequency. This generates a pulse command sequence, which is sent to the drive controller via CAN message. Simultaneously, the flow rate adjustment value is input into the PWM control mapping model of the solenoid valve. Within the linear adjustment range of 0.5 to 2.5 L / min, the flow rate value is proportionally mapped to a duty cycle range of 40% to 100%, preventing the solenoid valve from entering the nonlinear control region. The calculated PWM duty cycle parameters are packaged into flow control commands and sent to the solenoid valve drive module, ensuring linear controllability of the flow rate adjustment response. For controlling the injection angle, the real-time angle error is constructed by the difference between the actual injection angle fed back by the current servo motor and the target angle. At the same time, historical errors are recorded for calculating the integral term, and the difference between the current error and the previous error is used as the differential term. The three terms are multiplied by the proportional, integral and differential gain coefficients respectively and added to form the output of the PID controller. After the control quantity is limited, it is converted into the PWM duty cycle required for the servo motor drive signal. For example, the range of -100 to +100 is linearly mapped to a duty cycle of 0% to 100% to control the servo motor to rotate and adjust the angle according to the current control torque command. This PWM signal is sent to the angle actuator as an angle control command.
[0038] In one specific embodiment, the process of calculating the height adjustment, flow rate adjustment, and injection angle adjustment value of the i-th control unit based on the local disease density parameter and disease severity index can specifically include the following steps: The density ratio is obtained by dividing the local disease density parameter by the maximum disease density parameter in N control units. The density ratio is then multiplied by pi to calculate the sine function value. Finally, the disease severity index of the i-th control unit is multiplied by a preset constant to obtain the hyperbolic tangent function value. The disease downforce component is obtained by multiplying the sine function value by the disease response amplitude. The height tracking component is obtained by multiplying the difference between the average crop height in the area corresponding to the i-th control unit and the benchmark crop height by the height tracking coefficient. The height adjustment amount of the i-th control unit is obtained by adding the disease downforce component and the height tracking component. Multiply the hyperbolic tangent function value by the disease severity amplification factor and add 1 to obtain the disease severity factor. Calculate the average disease density parameter of N control units, subtract 1 from the ratio of the local disease density parameter of the i-th control unit to the average disease density parameter, multiply by the density deviation coefficient and add 1 to obtain the density deviation factor. Multiply the base flow value by the disease severity factor and the density deviation factor to obtain the flow regulation value of the i-th control unit. Calculate the average height adjustment of N control units. Subtract the height adjustment of the i-th control unit from the average height adjustment and multiply by the height linkage coefficient to obtain the height linkage term. Subtract the local disease density parameter of the i-th control unit from the average disease density parameter and multiply by the density correction coefficient to obtain the density correction term. Add the reference injection angle, wind speed compensation term, density correction term, and height linkage term to obtain the injection angle adjustment value of the i-th control unit.
[0039] Specifically, the local disease density parameter is standardized by dividing the local disease density value by the maximum value among all disease density parameters in the current N control units to obtain a density ratio, quantifying the relative position of the regional disease density within the overall scenario. This density ratio is multiplied by pi to introduce a periodic response mechanism, and a sine function value is calculated from the resulting value to construct a disease density response factor with diminishing marginal returns. Simultaneously, the disease severity index of the i-th control unit is multiplied by a preset disease response amplitude constant to form the input of a hyperbolic tangent function. The response tends to saturate when the disease severity approaches its upper limit, thus calculating the hyperbolic tangent function value, which describes the nonlinear enhancement effect of disease severity on spray control. Multiplying the sinusoidal function output value by the disease response amplitude constant creates the disease downforce component, reflecting the need to appropriately lower the spray boom to shorten the spray distance in areas with high disease density. Simultaneously, the difference between the current average crop height and the system-set baseline crop height is multiplied by a height tracking coefficient to obtain a height tracking component that dynamically adjusts with the crop canopy. Adding the disease downforce component to the height tracking component yields the target spray boom height adjustment for the control unit. Multiplying the hyperbolic tangent function value by the disease severity amplification factor and adding 1 creates the disease severity factor, used to adjust the enhancement of the base flow rate under different disease levels. The average disease density is calculated for all control units. The density parameter of the current control unit is then compared to this average value, subtracted by 1, multiplied by the density deviation coefficient, and then added by 1 to obtain the density deviation factor. This factor characterizes the direction and extent of pesticide supply adjustment when the current disease density is too high or too low. The base spray flow rate value is then multiplied sequentially by the disease severity factor and the density deviation factor to obtain the pesticide flow rate adjustment value for the i-th control unit. For calculating the spray angle adjustment value, the height adjustment values of all N control units are statistically analyzed and their average value is calculated. Then, the difference between the current control unit's height adjustment value and the average value is multiplied by the height linkage coefficient to obtain the height linkage term, which is used to compensate for the spray angle deviation caused by the displacement of the spray boom. At the same time, the difference between the disease density parameter of the current control unit and the average density parameter is multiplied by the density correction coefficient to construct the density correction term, so as to expand the coverage of high-density areas. The wind speed compensation term is determined according to the magnitude of the lateral wind speed component, reflecting the interference trend of the external environment on the trajectory of the liquid. The reference spray angle is superimposed with the wind speed compensation term, density correction term, and height linkage term to form the target spray angle adjustment value of the i-th control unit.
[0040] The process, after obtaining the local disease density parameter of the i-th control unit, also includes the step of analyzing and smoothing the disease distribution gradient between adjacent control units: calculating the difference in local disease density parameters between adjacent control units, taking the absolute value of the difference between the local disease density parameters of the i-th control unit and the (i+1)-th control unit to obtain the density gradient value, traversing all adjacent control unit pairs to calculate N-1 density gradient values, statistically analyzing the mean and standard deviation of all density gradient values, identifying adjacent control unit pairs whose density gradient values exceed the mean plus twice the standard deviation, marking them as disease distribution abrupt change boundaries, and obtaining the disease... The distribution mutation boundary set is used to smooth the control units within the disease distribution mutation boundary set. For the mutation boundary between the i-th and i+1-th control units, the local disease density parameters of the (i-1), i-th, i+1, and i+2-th control units are extracted to form a local density sequence. A moving average filter is applied to the local density sequence, and a sliding window of length 3 is used to average the previous, current, and next density values at each position in the sequence. The density value after moving average is used as the smoothed density value to update the corresponding control unit. After smoothing all mutation boundaries, the process is repeated. The smoothed local disease density parameters are obtained. Based on the smoothed local disease density parameters, the spatial distribution curve of disease density between control units is calculated. The horizontal axis is the center coordinate of N control units, and the corresponding smoothed local disease density parameters are the vertical axis. A smooth transition curve is constructed between the density values of adjacent control units using cubic spline interpolation. The first derivative of the interpolation curve at each control unit position represents the density change rate, and the second derivative of the interpolation curve at each control unit position represents the density change acceleration, thus obtaining the disease density spatial distribution feature vector. Based on the disease density spatial distribution feature vector, the adjustment parameters of the control units are optimized by boundary coordination. When the density change rate of two adjacent control units exceeds a preset threshold, the height adjustment, flow rate adjustment, and spray angle adjustment values of the two control units are linearly interpolated and transitioned. A transition coefficient is introduced at the boundary position of the two control units. The adjustment parameters of the former control unit are multiplied by the decreasing transition coefficient, and the adjustment parameters of the latter control unit are multiplied by the increasing transition coefficient. The two are weighted and summed to obtain the adjustment parameters of the boundary transition region. After updating the adjustment parameters of each control unit and its boundary transition region, a spatially continuous multi-parameter adjustment command sequence of the spray boom is obtained.
[0041] The above describes the machine vision-based adaptive adjustment method for the spray boom in embodiments of the present invention. The following describes the machine vision-based adaptive adjustment system for the spray boom in embodiments of the present invention. Please refer to [link / reference]. Figure 2 One embodiment of the machine vision-based adaptive adjustment system for the spray boom in this invention includes: The acquisition module 201 is used to acquire RGB and depth images of the crop canopy, and to segment the RGB images into image block sequences and map them into spatial feature maps of pests and diseases. Classification module 202 is used to classify lesion pixels based on the spatial feature map of pests and diseases, and obtain the severity index of the disease and a list of three-dimensional coordinates of disease instances; The calculation module 203 is used to divide the total horizontal length of the spray boom into N control units and establish a spray boom coordinate system, project the three-dimensional coordinate list of disease instances onto the spray boom coordinate system and assign them to the corresponding control units, count the number and area of diseases in the i-th control unit to calculate the local disease density parameters, and extract the average crop height corresponding to the i-th control unit by combining the depth image. The generation module 204 is used to generate corresponding stepper motor pulse commands, solenoid valve flow commands, and servo motor angle commands based on local disease density parameters and average crop height.
[0042] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0043] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0044] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A machine vision-based adaptive adjustment method for a spray boom, characterized in that, include: RGB and depth images of the crop canopy are acquired, and the RGB images are segmented into image block sequences and mapped into spatial feature maps of pests and diseases. Based on the spatial feature map of the pests and diseases, lesion pixels are classified to obtain a disease severity index and a list of three-dimensional coordinates of disease instances. Divide the total horizontal length of the spray boom into N control units and establish a spray boom coordinate system. Project the three-dimensional coordinate list of the disease instances onto the spray boom coordinate system and assign them to the corresponding control units. Calculate the local disease density parameters by counting the number and area of diseases in the i-th control unit and extract the average crop height corresponding to the i-th control unit by combining the depth image. Based on the local disease density parameters and the average crop height, corresponding stepper motor pulse commands, solenoid valve flow commands, and servo motor angle commands are generated.
2. The machine vision-based adaptive adjustment method for the spray boom according to claim 1, characterized in that, The process of acquiring RGB and depth images of the crop canopy, segmenting the RGB images into image patch sequences, and mapping them to a spatial feature map of pests and diseases includes: An RGB image of the crop canopy in front of the sprayer is obtained by capturing the image using an RGB camera; A depth image is obtained by emitting near-infrared light pulses to the crop canopy using a depth camera and receiving the reflected light, and calculating the depth value based on the time difference between emission and reception. The RGB image is segmented into a sequence of image blocks and mapped to an embedding vector. Based on the embedding vector, main path attention calculation and auxiliary path feature direct transmission are performed to obtain a spatial feature map of pests and diseases.
3. The machine vision-based adaptive adjustment method for the spray boom according to claim 2, characterized in that, The process of segmenting the RGB image into a sequence of image blocks and mapping them to embedding vectors, and then performing main path attention calculation and secondary path feature direct transmission based on the embedding vectors to obtain a spatial feature map of pests and diseases, includes: The RGB image is segmented by a sliding window to form an image block sequence. Each image block in the image block sequence is flattened and mapped through a linear projection layer to obtain an embedding vector. The embedding vectors are divided into main path embedding vectors and auxiliary path embedding vectors in the channel dimension. The main path embedding vectors are linearly transformed by the query key matrix and the attention weights are calculated and then multiplied by the value matrix to obtain the main path attention features. The auxiliary path embedding vectors are directly passed to obtain the auxiliary path retained features. The main road attention features and the auxiliary road retention features are fused to obtain a spatial feature map of pests and diseases.
4. The machine vision-based adaptive adjustment method for the spray boom according to claim 3, characterized in that, The embedding vector is divided into a main path embedding vector and an auxiliary path embedding vector in the channel dimension. The main path embedding vector undergoes a linear transformation of the query key matrix, and the attention weights are calculated and multiplied by the value matrix to obtain the main path attention features. The auxiliary path embedding vector is directly passed to obtain the auxiliary path retained features, including: The embedding vector is divided into a first part of the channel and a second part of the channel according to the channel dimension. The first part of the channel constitutes the main path embedding vector and the second part of the channel constitutes the auxiliary path embedding vector. The main path embedding vector is multiplied by the query weight matrix, key weight matrix, and value weight matrix respectively, and then linearly transformed to obtain the query matrix, key matrix, and value matrix. The query matrix is multiplied by the transpose of the key matrix and then scaled to obtain the attention weight matrix. The attention weight matrix is then multiplied by the value matrix to obtain the main path attention features. At the same time, the secondary path embedding vector is directly used as the secondary path retained features.
5. The machine vision-based adaptive adjustment method for the spray boom according to claim 1, characterized in that, The step of classifying lesion pixels based on the spatial feature map of the pests and diseases to obtain a disease severity index and a list of three-dimensional coordinates of disease instances includes: The spatial feature map of the pests and diseases is classified into lesion pixels to obtain a set of lesion pixels. The RGB image is then converted to the HSV color space for leaf pixel analysis to obtain a set of leaf pixels. Calculate the geometric center coordinates of the leaf pixel set, calculate the Euclidean distance from each lesion pixel in the lesion pixel set to the geometric center coordinates and perform exponential decay weighting, divide the weighted sum by the total number of pixels in the leaf pixel set to obtain the disease severity index; The pixel coordinates of each lesion pixel in the lesion pixel set are transformed with the depth value of the corresponding position in the depth image to obtain a three-dimensional coordinate list of lesion instances.
6. The machine vision-based adaptive adjustment method for the spray boom according to claim 5, characterized in that, The calculation of the geometric center coordinates of the leaf pixel set involves calculating the Euclidean distance from each lesion pixel in the lesion pixel set to the geometric center coordinates and applying an exponentially decaying weighted average. The weighted sum is then divided by the total number of pixels in the leaf pixel set to obtain the disease severity index, including: The center x-coordinate is obtained by summing the x-coordinates of all pixels in the leaf pixel set and dividing by the total number of pixels; the center y-coordinate is obtained by summing the y-coordinates of all pixels in the leaf pixel set and dividing by the total number of pixels. Construct the geometric center coordinates based on the central x-coordinate and the central y-coordinate; Calculate the Euclidean distance from each lesion pixel in the lesion pixel set to the geometric center coordinates, divide the Euclidean distance by the attenuation coefficient, take the negative value as the exponent base, and perform natural exponentiation to obtain the weighting coefficient of each lesion pixel; The weighted sum is obtained by summing the weighted coefficients of all lesion pixels in the lesion pixel set. The weighted sum is then divided by the total number of pixels in the leaf pixel set to obtain the disease severity index.
7. The machine vision-based adaptive adjustment method for the spray boom according to claim 1, characterized in that, The process involves dividing the total horizontal length of the spray boom into N control units and establishing a spray boom coordinate system. The three-dimensional coordinate list of the disease instances is projected onto the spray boom coordinate system and assigned to the corresponding control unit. The number and area of diseases within the i-th control unit are counted to calculate local disease density parameters. The average crop height corresponding to the i-th control unit is extracted using the depth image. This includes: Divide the total horizontal length of the spray boom into N control units and calculate the center horizontal coordinate and boundary coordinate of each control unit to establish the spray boom coordinate system. The horizontal coordinate of each disease instance in the three-dimensional coordinate list of disease instances is compared with the boundary coordinates of each control unit, and the disease instances whose central horizontal coordinate falls within the boundary range of the i-th control unit are assigned to the corresponding control unit. The total disease area is obtained by summing the number of disease instances belonging to the i-th control unit and the area of each disease instance. The number of disease instances is divided by the monitoring area of each control unit to obtain the number density component. The total disease area is multiplied by the area weighting coefficient to obtain the area density component. The number density component and the area density component are added together to obtain the local disease density parameter of the i-th control unit; Extract the pixels in the depth image whose depth values are within the valid range within the region corresponding to the i-th control unit and calculate the average depth value. Then, convert the average depth value into the average crop height within the region corresponding to the i-th control unit.
8. The machine vision-based adaptive adjustment method for the spray boom according to claim 7, characterized in that, The generation of corresponding stepper motor pulse commands, solenoid valve flow commands, and servo motor angle commands based on the local disease density parameters and the average crop height includes: Based on the local disease density parameter and the disease severity index, calculate the height adjustment value, flow rate adjustment value, and spray angle adjustment value of the i-th control unit; The speed value of the stepper motor is calculated based on the height adjustment amount of the i-th control unit, and the speed value is converted into the corresponding stepper motor pulse command; The corresponding PWM duty cycle is calculated based on the flow regulation value of the i-th control unit, and the corresponding solenoid valve flow command is generated based on the PWM duty cycle. Calculate the angle error, cumulative error, and error change rate based on the injection angle adjustment value of the i-th control unit, calculate the PID control quantity based on the angle error, the cumulative error, and the error change rate, and generate the corresponding servo motor angle command based on the PWM duty cycle.
9. The machine vision-based adaptive adjustment method for the spray boom according to claim 8, characterized in that, The calculation of the height adjustment, flow rate adjustment, and injection angle adjustment value of the i-th control unit based on the local disease density parameter and the disease severity index includes: The density ratio is obtained by dividing the local disease density parameter by the maximum disease density parameter among the N control units. The density ratio is then multiplied by pi to calculate the sine function value. Finally, the disease severity index of the i-th control unit is multiplied by a preset constant to obtain the hyperbolic tangent function value. The disease downforce component is obtained by multiplying the sine function value by the disease response amplitude. The height tracking component is obtained by multiplying the difference between the average crop height in the area corresponding to the i-th control unit and the benchmark crop height by the height tracking coefficient. The height adjustment amount of the i-th control unit is obtained by adding the disease downforce component and the height tracking component. Multiply the hyperbolic tangent function value by the disease severity amplification factor and add 1 to obtain the disease severity factor. Calculate the average disease density parameter of N control units, subtract 1 from the ratio of the local disease density parameter of the i-th control unit to the average disease density parameter, multiply by the density deviation coefficient and add 1 to obtain the density deviation factor. Multiply the base flow value by the disease severity factor and the density deviation factor to obtain the flow regulation value of the i-th control unit. Calculate the average height adjustment of N control units. Subtract the height adjustment of the i-th control unit from the average height adjustment and multiply by the height linkage coefficient to obtain the height linkage term. Subtract the local disease density parameter of the i-th control unit from the average disease density parameter and multiply by the density correction coefficient to obtain the density correction term. Add the reference injection angle, wind speed compensation term, density correction term, and height linkage term to obtain the injection angle adjustment value of the i-th control unit.
10. A machine vision-based adaptive adjustment system for a spray boom, characterized in that, A method for performing the machine vision-based adaptive adjustment of a spray boom as described in any one of claims 1-9 includes: The acquisition module is used to acquire RGB and depth images of the crop canopy, and to segment the RGB images into image block sequences and map them into spatial feature maps of pests and diseases; The classification module is used to classify lesion pixels based on the spatial feature map of the pests and diseases, and obtain a disease severity index and a list of three-dimensional coordinates of disease instances. The calculation module is used to divide the total horizontal length of the spray boom into N control units and establish a spray boom coordinate system. It projects the three-dimensional coordinate list of the disease instances onto the spray boom coordinate system and assigns them to the corresponding control units. It counts the number and area of diseases in the i-th control unit to calculate the local disease density parameters and extracts the average crop height corresponding to the i-th control unit by combining the depth image. The generation module is used to generate corresponding stepper motor pulse commands, solenoid valve flow commands, and servo motor angle commands based on the local disease density parameters and the average crop height.