Unmanned aerial vehicle pesticide package recovery detection and identification method based on deep learning
By using deep learning-based dynamic text prompts and gating fusion mechanisms, the system addresses the issues of recognition accuracy and robustness in complex environments for drone-based pesticide packaging recycling, achieving efficient and stable pesticide packaging recycling.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-21
- Publication Date
- 2026-04-07
AI Technical Summary
Existing drone-based pesticide packaging recycling systems cannot reliably identify pesticide packaging, leading to missed or incorrect recycling. Furthermore, they lack adaptive mechanisms and cannot improve recognition accuracy and robustness in complex environments.
A deep learning-based approach is adopted to dynamically generate text prompts and a dynamic gating fusion mechanism to adaptively adjust the fusion ratio of visual and text features, generate pesticide packaging recognition results, and optimize path planning.
It improves the accuracy and robustness of pesticide packaging identification, reduces invalid flight paths, lowers energy consumption and mission delays, and enhances identification stability and recycling efficiency in complex environments.
Smart Images

Figure CN121811201A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of deep learning technology, specifically to a method for detecting and identifying pesticide packaging recycling using drones based on deep learning. Background Technology
[0002] Pesticide packaging is a crucial carrier for pesticide products. Common pesticide packaging forms include plastic bottles, aluminum cans, woven bags, and composite material containers, with their materials, shapes, colors, and label designs varying depending on the type of pesticide (such as insecticides, herbicides, and fungicides) and brand. However, if discarded pesticide packaging is not recycled in a timely manner, it will leave behind harmful chemical residues, which, when exposed to the agricultural environment over a long period, lead to heavy metal pollution in the soil, eutrophication of water sources, and the accumulation of toxic substances in the food chain, seriously threatening the balance of the ecosystem and human health and safety.
[0003] In the field of agricultural waste management, drone technology is widely regarded as an ideal solution to the problem of pesticide packaging recycling due to its advantages such as high mobility, wide coverage, and flexible operation. Compared with traditional manual recycling methods, drones can quickly inspect large areas of farmland, collect image data in real time, and automatically locate the packaging based on visual analysis, significantly reducing labor costs and time consumption. Especially in areas with complex terrain or remote locations, drones can overcome the limitations of manual recycling, enabling all-weather, high-efficiency recycling operations. Therefore, developing drone-based pesticide packaging recycling technology has become a hot research direction in smart agriculture.
[0004] Currently, drone-based pesticide packaging recycling systems primarily rely on computer vision technology for target recognition and path planning. Typical solutions include: drones equipped with high-definition cameras capture images of farmland; pre-trained deep learning models (such as convolutional neural networks) extract and classify features from the images; and after identifying pesticide packaging, generate recycling path instructions. Some systems further incorporate image segmentation technology to attempt to pinpoint the exact location of the packaging.
[0005] The applicant found that the biggest bottleneck of existing technologies lies in their inability to reliably identify pesticide packaging, leading to frequent missed or incorrect collections during drone recycling. Pesticide packaging varies greatly in appearance (e.g., different brands of bottle textures, variations in residue levels, and label wear), while farmland environments are highly dynamic (e.g., sudden changes in light, rain and fog, crop cover, and ground debris). Existing methods, relying on fixed templates or single visual feature extraction strategies, struggle to adapt to these changing conditions. For example, in low-light conditions or when packaging is partially obscured, residual pesticide bottles are easily misidentified as ordinary plastic fragments, resulting in incorrect collection. When packaging is soiled or the background is cluttered, feature matching fails, leading to missed identification and the drone's inability to locate the target. This inaccurate identification not only wastes drone flight resources (e.g., ineffective path planning) but also leaves a large amount of pesticide packaging stranded in farmland, exacerbating environmental pollution. More importantly, existing technologies lack adaptive mechanisms and cannot dynamically optimize identification strategies based on environmental changes, resulting in drastic fluctuations in identification results in complex scenarios, with overall reliability far below the requirements of practical applications.
[0006] Therefore, existing recycling systems face the dilemma of low efficiency, high cost, and difficulty in guaranteeing environmental benefits when promoted on a large scale, and there is an urgent need to break through the bottleneck of identification accuracy. Summary of the Invention
[0007] To address the shortcomings of the existing technologies, the technical problem this invention aims to solve is: how to provide a deep learning-based method for detecting and identifying pesticide packaging during drone recycling, dynamically generating text prompts and extracting text features, and using a dynamic gating fusion mechanism to adaptively adjust the fusion ratio of visual and text features, thereby improving the accuracy and robustness of pesticide packaging identification during drone pesticide packaging recycling.
[0008] To solve the above-mentioned technical problems, the present invention adopts the following technical solution:
[0009] A deep learning-based method for detecting and identifying pesticide packaging recycling using drones, comprising:
[0010] S1: Obtain the surface image of the farmland to be identified;
[0011] S2: Input the farmland surface image to be identified into the trained pesticide packaging recognition model, and output the corresponding pesticide packaging recognition result;
[0012] The processing steps for pesticide packaging identification models include:
[0013] S201: Perform image preprocessing on the input farmland surface image to generate a preprocessed image;
[0014] S202: Input the preprocessed image into the candidate region network to generate several candidate regions;
[0015] S203: Input each candidate region into RoIAlign for visual feature extraction to obtain the corresponding visual feature vector;
[0016] S204: For each candidate region, generate a dynamic text prompt based on its visual feature vector, and extract text features from the dynamic text prompt to generate the corresponding text feature vector;
[0017] S205: Fuse the visual feature vectors and text feature vectors of each candidate region to generate a fused feature vector;
[0018] S206: Generate corresponding pesticide packaging recognition results based on the fused feature vectors of each candidate region;
[0019] S3: Generate a path planning scheme for the drone based on the pesticide packaging recognition results, and control the drone to recycle pesticide packaging through the path planning scheme.
[0020] Preferably, in step S201, image preprocessing includes global normalization and size cropping of the input farmland surface image to generate a preprocessed image.
[0021] Preferably, in step S202, the preprocessed image is input into a lightweight detector to generate several candidate regions.
[0022] Preferably, in step S204, dynamic text prompts for the candidate regions are generated through the following steps:
[0023] S2041: Retrieve pre-stored data Class prompt template;
[0024] S2042: Calculate the semantic similarity between the visual feature vectors of each type of cue template and the candidate region;
[0025] The formula for calculating semantic similarity is as follows:
[0026] ;
[0027] In the formula: Indicates prompt template Embedding vectors and candidate regions Visual feature vectors semantic similarity; The L2 norm of a vector;
[0028] S2043: Select a semantically similar prompt template as the target prompt template for the candidate region;
[0029] S2044: Extract the placeholders for each parameter from the target prompt template of the candidate region;
[0030] S2045: For each parameter placeholder: Calculate the raw score for each category of the parameter placeholder; generate the corresponding predicted probability based on the raw scores of each category, and select the category with the highest predicted probability as the predicted category of the parameter placeholder;
[0031] The formula for calculating the raw score is expressed as follows:
[0032] ;
[0033] In the formula: Indicates parameter placeholders Category The original score; and Represents the learnable placeholder weight matrix and bias vector; Indicates candidate region Visual feature vectors;
[0034] The formula for calculating the probability distribution is expressed as:
[0035] ;
[0036] In the formula: Indicate category The predicted probability; Indicates parameter placeholders Category The original score; Indicates parameter placeholders A collection of categories;
[0037] S2046: Fill the predicted categories of each parameter placeholder into the corresponding parameter placeholder positions of the target prompt template of the candidate region to obtain the dynamic text prompt of the candidate region.
[0038] Preferably, in step S204, the text encoder extracts text features from the dynamic text prompts in the candidate region to generate corresponding text feature vectors.
[0039] Preferably, in step S205, the visual feature vectors and text feature vectors of each candidate region are fused using a dynamic gating fusion method to generate a fused feature vector;
[0040] The formula is expressed as:
[0041] ;
[0042] In the formula: Indicates candidate region fused feature vectors; Indicates candidate region Visual feature vectors; Indicates candidate region The text feature vector; Indicates candidate region Gating weights.
[0043] Preferably, in step S205, based on the candidate region Visual feature vectors and text feature vectors Calculate the gating weights;
[0044] The formula is expressed as:
[0045] ;
[0046] In the formula: This represents the sigmoid activation function; Represents the learnable gated weight matrix; This indicates a splicing operation.
[0047] Preferably, in step S206, the fused feature vectors of each candidate region are input into the linear regression head and the confidence head to calculate the predicted coordinates and confidence of each candidate box, and the candidate boxes are filtered based on the confidence to generate pesticide packaging recognition results.
[0048] Preferably, in step S206, the confidence level of the candidate box is calibrated by adaptive temperature scaling;
[0049] The formula is expressed as:
[0050] ;
[0051] ;
[0052] In the formula: Candidate boxes Confidence level after calibration; Candidate boxes Confidence level; This represents the sigmoid activation function; Indicates the adaptive temperature coefficient; Indicates the basic temperature coefficient; Indicates the sensitivity coefficient; This represents the learnable temperature weight matrix.
[0053] Preferably, in step S206, candidate boxes with a calibrated confidence level exceeding the confidence threshold and their predicted coordinates are retained, while candidate boxes with a calibrated confidence level less than the confidence threshold and their predicted coordinates are deleted.
[0054] Compared with existing technologies, the deep learning-based drone-based pesticide packaging recycling detection and identification method of this invention has the following advantages:
[0055] Existing methods rely on fixed templates or single visual features, making it difficult to adapt to the diversity of pesticide packaging in farmland (such as differences in brand, type, and residue levels) and complex environmental interference (such as changes in lighting and partial occlusion). This invention dynamically selects the most matching template (e.g., automatically matching a "basic packaging template" in high residue scenarios) by calculating the semantic similarity between the prompt template and visual features, and uses a lightweight language generator to accurately fill in parameter placeholders (such as "brand" and "residue level"). This mechanism enables the model to adapt to the semantic features of different packaging, avoiding misclassification caused by fixed templates (e.g., misclassifying insecticides as herbicides). In blurry or occluded image scenarios, text prompts can effectively supplement missing visual information, reducing the misidentification rate. Furthermore, the dynamic prompt mechanism of this invention does not require additional labeled data. By pre-stored template libraries covering mainstream pesticide packaging categories, it significantly enhances the model's adaptability to the changing farmland environment, thereby improving the accuracy and robustness of pesticide packaging identification during drone pesticide packaging recovery.
[0056] Existing methods employ fixed weights (such as simple weighted averaging), which over-rely on visual features when images are clear, leading to noise interference. In blurred or occluded scenes, recognition fails due to insufficient utilization of text features. This invention designs a gated weight calculation logic, dynamically generating weights based on the differences between visual and text features of candidate regions (weights close to 1 emphasize visual features, and close to 0 emphasize text features). For example, in uniformly lit farmland, the model prioritizes high-precision visual features; in rainy or foggy scenes, it automatically enhances text feature weights to compensate for the lack of visual information. This mechanism ensures that the fused feature vector always focuses on the dominant information of the current scene, avoiding recognition fluctuations caused by fixed fusion strategies. Furthermore, the learnable nature of the gated weights allows the model to continuously optimize scene adaptability during training, significantly reducing the misjudgment rate caused by environmental interference and ensuring stable recognition performance in complex farmland environments. This further improves the accuracy and robustness of pesticide packaging recognition during drone pesticide packaging recycling.
[0057] This invention utilizes recognition results generated from fused feature vectors, and calibrates the confidence level through adaptive temperature scaling. This effectively filters out low-confidence misjudgments (such as misidentifying plastic fragments as pesticide packaging), ensuring that the drone only performs recycling tasks on genuine pesticide packaging. This avoids invalid flight paths caused by identification errors in traditional methods, significantly reducing drone energy consumption and mission delays. Simultaneously, the high-confidence recognition results enhance the model's robustness in dynamic farmland environments. Under interference from sudden changes in lighting, damaged packaging, or cluttered backgrounds, the dynamic optimization of fused features and confidence calibration maintain the stability of the recognition results. This allows the path planning scheme to generate the optimal recycling path based on accurate packaging location information, preventing the drone from deviating from the target or repeatedly covering the packaging, thereby improving the accuracy and efficiency of drone-based pesticide packaging recycling. Attached Figure Description
[0058] To make the objectives, technical solutions, and advantages of the invention clearer, the invention will now be described in further detail with reference to the accompanying drawings, wherein:
[0059] Figure 1 This is a logic block diagram of a deep learning-based drone-based pesticide packaging recycling detection and identification method. Detailed Implementation
[0060] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but only to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention.
[0061] It should be noted that similar reference numerals and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. In the description of this invention, it should be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the figures, or the orientation or positional relationship commonly used when the product is in use. They are only for the convenience of describing the invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on the invention. Furthermore, the terms "first," "second," and "third," etc., are only used to distinguish descriptions and should not be construed as indicating or implying relative importance. In addition, the terms "horizontal," "vertical," etc., do not mean that the component is required to be absolutely horizontal or suspended, but can be slightly tilted. For example, "horizontal" only means that its direction is more horizontal than "vertical," and does not mean that the structure must be completely horizontal, but can be slightly tilted. In the description of this invention, it should also be noted that, unless otherwise explicitly specified and limited, the terms "set," "install," "connect," and "link" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in this invention based on the specific circumstances.
[0062] The following detailed explanation illustrates the specific implementation methods:
[0063] Example:
[0064] This embodiment discloses a deep learning-based method for detecting and identifying pesticide packaging recycling using unmanned aerial vehicles (UAVs).
[0065] like Figure 1 As shown, a deep learning-based method for detecting and identifying pesticide packaging recycling using drones includes:
[0066] S1: Obtain the surface image of the farmland to be identified;
[0067] S2: Input the farmland surface image to be identified into the trained pesticide packaging recognition model, and output the corresponding pesticide packaging recognition result;
[0068] The processing steps for pesticide packaging identification models include:
[0069] S201: Perform image preprocessing on the input farmland surface image to generate a preprocessed image;
[0070] S202: Input the preprocessed image into the candidate region network to generate several candidate regions;
[0071] S203: Input each candidate region into RoIAlign for visual feature extraction to obtain the corresponding visual feature vector;
[0072] S204: For each candidate region, generate a dynamic text prompt based on its visual feature vector, and extract text features from the dynamic text prompt to generate the corresponding text feature vector;
[0073] S205: Fuse the visual feature vectors and text feature vectors of each candidate region to generate a fused feature vector;
[0074] S206: Generate corresponding pesticide packaging recognition results based on the fused feature vectors of each candidate region;
[0075] S3: Generate a path planning scheme for the drone based on the pesticide packaging recognition results, and control the drone to recycle pesticide packaging through the path planning scheme.
[0076] In this embodiment, the two parts of generating a path planning scheme for the drone based on the pesticide packaging identification results, and controlling the drone through the path planning scheme to achieve pesticide packaging recycling, are based on existing technologies. This invention does not protect the schemes for these two parts.
[0077] To better illustrate the technical solution of the present invention, this embodiment will be described in more detail through the following parts.
[0078] I. Image Preprocessing
[0079] In this embodiment, image preprocessing includes global normalization and size cropping of the input farmland surface image to generate a preprocessed image;
[0080] The formula for global normalization is expressed as:
[0081] ;
[0082] In the formula: This represents the preprocessed image after global normalization. Represents an original image of the farmland surface; This represents a predefined mean vector (calculated based on the ImageNet dataset); This represents a predefined standard deviation vector (calculated based on the ImageNet dataset).
[0083] This invention eliminates the effects of lighting differences and inconsistent image sizes by globally normalizing the input farmland surface image. At the same time, it ensures that the size of the preprocessed image strictly matches the model input requirements (1024×768) through size cropping, thus avoiding image distortion.
[0084] II. Candidate Region Network
[0085] In this embodiment, the preprocessed image Input a lightweight detector (YOLOv5-tiny) to the preprocessed image A set of candidate boxes containing several candidate regions is generated.
[0086] III. Dynamic Text Prompts
[0087] In this embodiment, dynamic text prompts for candidate regions are generated through the following steps:
[0088] S2041: Retrieve pre-stored data Class prompt template;
[0089] In this embodiment, a total of six prompt templates were designed, namely:
[0090] 1) Basic packaging template: "Brand: {brand}, Type: {type}, Residue: {residue}";
[0091] 2) Herbicide template: "Brand: {brand}, Expiry date: {validity}, Target herbicide: {target}";
[0092] 3) Insecticide template: "Brand: {brand}, Toxicity level: {toxicity}, Applicable crop: {crop}";
[0093] 4) Fungicide template: "Brand: {brand}, Residue: {residue}, Target pest: {target}";
[0094] 5) Organic pesticide template: "Brand: {brand}, Organic certification mark: {cert}, Applicable crops: {crop}";
[0095] 6) Compound pesticide template: "Ingredients: {component1}, Toxicity level: {toxicity}, Applicable crop: {crop}".
[0096] S2042: Calculate the semantic similarity between the visual feature vectors of each type of cue template and the candidate region;
[0097] The formula for calculating semantic similarity is as follows:
[0098] ;
[0099] In the formula: Indicates prompt template (Predefined) embedding vectors and candidate regions Visual feature vectors The semantic similarity, where the prompt template The embedding vectors are generated using the CLIP text encoder; The L2 norm of a vector;
[0100] S2043: Select a semantically similar prompt template as the target prompt template for the candidate region;
[0101] For example, the target prompt template is the basic packaging template: "Brand: {brand}, Type: {type}, Residue: {residue}".
[0102] S2044: Extract the placeholders for each parameter from the target prompt template of the candidate region;
[0103] For example, when the target prompt template is the base wrapper template, the parameter placeholder list is: ={brand,type,residue}. The "brand," "type," and "residue" placeholders in the basic packaging template are automatically filled in during subsequent prompt word filling, requiring no additional processing.
[0104] S2045: For each parameter placeholder: Calculate the raw score for each category of the parameter placeholder using a lightweight language generator (fine-tuned BERT); generate the corresponding predicted probabilities based on the raw scores of each category, and select the category with the highest predicted probability as the predicted category of the parameter placeholder.
[0105] The formula for calculating the raw score is expressed as follows:
[0106] ;
[0107] In the formula: Indicates parameter placeholders Category The original score; and Represents the learnable placeholder weight matrix and bias vector; Indicates candidate region Visual feature vectors;
[0108] The placeholder parameter "brand" has categories including "Roundup", "Glyphosate", and "Paraquat"; the placeholder parameter "type" has categories including "bottled", "bagged", and "canned"; and the placeholder parameter "residue" has categories including "high", "medium", and "low". Taking the placeholder parameter "brand" as an example, its original scores (vectors) for "Roundup", "Glyphosate", and "Paraquat" are (2.5, 1.8, 0.9) respectively.
[0109] The formula for calculating the probability distribution is expressed as:
[0110] ;
[0111] In the formula: Indicate category The predicted probability; Indicates parameter placeholders Category The original score; Indicates parameter placeholders The set of categories (such as) ={Roundup, Glyphosate, Paraquat});
[0112] Taking the parameter placeholder "brand" as an example, the predicted probabilities of its categories "Roundup", "Glyphosate" and "Paraquat" are (0.72, 0.25, 0.03) respectively. Therefore, the category "Roundup" with the highest predicted probability (0.72) is selected as the predicted category of "brand".
[0113] S2046: Fill the predicted categories of each parameter placeholder into the corresponding parameter placeholder positions of the target prompt template of the candidate region (and perform the corresponding format standardization processing) to obtain the dynamic text prompt of the candidate region.
[0114] Specifically, the text encoder (CLIP text encoder) extracts text features from the dynamic text prompts in the candidate region to generate the corresponding text feature vector.
[0115] Existing methods rely on fixed templates or single visual features, making it difficult to adapt to the diversity of pesticide packaging in farmland (such as differences in brand, type, and residue levels) and complex environmental interference (such as changes in lighting and partial occlusion). This invention dynamically selects the most matching template (e.g., automatically matching a "basic packaging template" in high residue scenarios) by calculating the semantic similarity between the prompt template and visual features, and uses a lightweight language generator to accurately fill in parameter placeholders (such as "brand" and "residue level"). This mechanism enables the model to adapt to the semantic features of different packaging, avoiding misclassification caused by fixed templates (e.g., misclassifying insecticides as herbicides). In blurry or occluded image scenarios, text prompts can effectively supplement missing visual information, reducing the misidentification rate. Furthermore, the dynamic prompt mechanism of this invention does not require additional labeled data. By pre-stored template libraries covering mainstream pesticide packaging categories, it significantly enhances the model's adaptability to the changing farmland environment, thereby improving the accuracy and robustness of pesticide packaging identification during drone pesticide packaging recovery.
[0116] IV. Dynamic Gating Fusion
[0117] In this embodiment, the visual feature vectors and text feature vectors of each candidate region are fused using dynamic gating fusion to generate a fused feature vector;
[0118] The formula is expressed as:
[0119] ;
[0120] In the formula: Indicates candidate region fused feature vectors; Indicates candidate region Visual feature vectors; Indicates candidate region The text feature vector; Indicates candidate region Gating weights (used to control the fusion ratio of visual and textual features). Among them, the gating weights... A value close to 1 indicates a clear image, emphasizing visual features; gating weights A value close to 0 indicates that the image is blurry or occluded, emphasizing text features.
[0121] Specifically, based on candidate regions Visual feature vectors and text feature vectors Calculate the gating weights;
[0122] The formula is expressed as:
[0123] ;
[0124] In the formula: This represents the sigmoid activation function; Represents the learnable gated weight matrix; This indicates a splicing operation.
[0125] Existing methods employ fixed weights (such as simple weighted averaging), which over-rely on visual features when images are clear, leading to noise interference. In blurred or occluded scenes, recognition fails due to insufficient utilization of text features. This invention designs a gated weight calculation logic, dynamically generating weights based on the differences between visual and text features of candidate regions (weights close to 1 emphasize visual features, and close to 0 emphasize text features). For example, in uniformly lit farmland, the model prioritizes high-precision visual features; in rainy or foggy scenes, it automatically enhances text feature weights to compensate for the lack of visual information. This mechanism ensures that the fused feature vector always focuses on the dominant information of the current scene, avoiding recognition fluctuations caused by fixed fusion strategies. Furthermore, the learnable nature of the gated weights allows the model to continuously optimize scene adaptability during training, significantly reducing the misjudgment rate caused by environmental interference and ensuring stable recognition performance in complex farmland environments. This further improves the accuracy and robustness of pesticide packaging recognition during drone pesticide packaging recycling.
[0126] V. Generation of Pesticide Packaging Identification Results
[0127] In this embodiment, the fused feature vectors of each candidate region are input into the linear regression head and the confidence head to calculate the predicted coordinates and confidence of each candidate box, and the candidate boxes are filtered based on the confidence to generate pesticide packaging recognition results.
[0128] Specifically, the confidence level of the candidate boxes is calibrated using adaptive temperature scaling;
[0129] The formula is expressed as:
[0130] ;
[0131] ;
[0132] In the formula: Candidate boxes Confidence level after calibration; Candidate boxes Confidence level; This represents the sigmoid activation function; Indicates the adaptive temperature coefficient; Indicates the base temperature coefficient (set to 1.2); Indicates the sensitivity coefficient; This represents the learnable temperature weight matrix.
[0133] Specifically, candidate boxes and their predicted coordinates with a calibrated confidence level exceeding the confidence threshold (0.6) are retained, while candidate boxes and their predicted coordinates with a calibrated confidence level less than the confidence threshold (0.6) are deleted.
[0134] This invention utilizes recognition results generated from fused feature vectors, and calibrates the confidence level through adaptive temperature scaling. This effectively filters out low-confidence misjudgments (such as misidentifying plastic fragments as pesticide packaging), ensuring that the drone only performs recycling tasks on genuine pesticide packaging. This avoids invalid flight paths caused by identification errors in traditional methods, significantly reducing drone energy consumption and mission delays. Simultaneously, the high-confidence recognition results enhance the model's robustness in dynamic farmland environments. Under interference from sudden changes in lighting, damaged packaging, or cluttered backgrounds, the dynamic optimization of fused features and confidence calibration maintain the stability of the recognition results. This allows the path planning scheme to generate the optimal recycling path based on accurate packaging location information, preventing the drone from deviating from the target or repeatedly covering the packaging, thereby improving the accuracy and efficiency of drone-based pesticide packaging recycling.
[0135] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit the technical solutions. Those skilled in the art should understand that any modifications or equivalent substitutions to the technical solutions of the present invention without departing from the spirit and scope of the present invention should be covered within the scope of the claims of the present invention.
Claims
1. A method for detecting and identifying pesticide packaging recycling using unmanned aerial vehicles (UAVs) based on deep learning, characterized in that, include: S1: Obtain the surface image of the farmland to be identified; S2: Input the farmland surface image to be identified into the trained pesticide packaging recognition model, and output the corresponding pesticide packaging recognition result; The processing steps for pesticide packaging identification models include: S201: Perform image preprocessing on the input farmland surface image to generate a preprocessed image; S202: Input the preprocessed image into the candidate region network to generate several candidate regions; S203: Input each candidate region into RoIAlign for visual feature extraction to obtain the corresponding visual feature vector; S204: For each candidate region, generate a dynamic text prompt based on its visual feature vector, and extract text features from the dynamic text prompt to generate the corresponding text feature vector; S205: Perform dynamic gating fusion of the visual feature vectors and text feature vectors of each candidate region to generate a fused feature vector; S206: Generate corresponding pesticide packaging recognition results based on the fused feature vectors of each candidate region; S3: Generate a path planning scheme for the drone based on the pesticide packaging recognition results, and control the drone to recycle pesticide packaging through the path planning scheme.
2. The method for detecting and identifying pesticide packaging recycling using unmanned aerial vehicles based on deep learning as described in claim 1, characterized in that: In step S201, image preprocessing includes global normalization and size cropping of the input farmland surface image to generate a preprocessed image.
3. The method for detecting and identifying pesticide packaging recycling using unmanned aerial vehicles based on deep learning as described in claim 1, characterized in that: In step S202, the preprocessed image is input into a lightweight detector to generate several candidate regions.
4. The method for detecting and identifying pesticide packaging recycling using unmanned aerial vehicles based on deep learning as described in claim 1, characterized in that: In step S204, dynamic text prompts for candidate regions are generated through the following steps: S2041: Retrieve pre-stored data Class prompt template; S2042: Calculate the semantic similarity between the visual feature vectors of each type of cue template and the candidate region; The formula for calculating semantic similarity is as follows: ; In the formula: Indicates prompt template Embedding vectors and candidate regions Visual feature vectors semantic similarity; The L2 norm of a vector; S2043: Select a semantically similar prompt template as the target prompt template for the candidate region; S2044: Extract the placeholders for each parameter from the target prompt template of the candidate region; S2045: For each parameter placeholder: Calculate the raw score for each category of the parameter placeholder; generate the corresponding predicted probability based on the raw scores of each category, and select the category with the highest predicted probability as the predicted category of the parameter placeholder; The formula for calculating the raw score is expressed as follows: ; In the formula: Indicates parameter placeholders Category The original score; and Represents the learnable placeholder weight matrix and bias vector; Indicates candidate region Visual feature vectors; The formula for calculating the probability distribution is expressed as: ; In the formula: Indicate category The predicted probability; Indicates parameter placeholders Category The original score; Indicates parameter placeholders A collection of categories; S2046: Fill the predicted categories of each parameter placeholder into the corresponding parameter placeholder positions of the target prompt template of the candidate region to obtain the dynamic text prompt of the candidate region.
5. The method for detecting and identifying pesticide packaging recycling using unmanned aerial vehicles based on deep learning as described in claim 4, characterized in that: In step S204, the text encoder extracts text features from the dynamic text prompts in the candidate region to generate the corresponding text feature vector.
6. The method for detecting and identifying pesticide packaging recycling using unmanned aerial vehicles based on deep learning as described in claim 1, characterized in that: In step S205, the visual feature vectors and text feature vectors of each candidate region are fused using dynamic gating fusion to generate a fused feature vector. The formula is expressed as: ; In the formula: Indicates candidate region fused feature vectors; Indicates candidate region Visual feature vectors; Indicates candidate region The text feature vector; Indicates candidate region Gating weights.
7. The method for detecting and identifying pesticide packaging recycling using unmanned aerial vehicles based on deep learning as described in claim 6, characterized in that: In step S205, based on the candidate region Visual feature vectors and text feature vectors Calculate the gating weights; The formula is expressed as: ; In the formula: This represents the sigmoid activation function; Represents the learnable gated weight matrix; This indicates a splicing operation.
8. The method for detecting and identifying pesticide packaging recycling using unmanned aerial vehicles based on deep learning as described in claim 1, characterized in that: In step S206, the fused feature vectors of each candidate region are input into the linear regression head and the confidence head to calculate the predicted coordinates and confidence of each candidate box, and the candidate boxes are filtered based on the confidence to generate pesticide packaging recognition results.
9. The method for detecting and identifying pesticide packaging recycling using unmanned aerial vehicles based on deep learning as described in claim 8, characterized in that: In step S206, the confidence level of the candidate boxes is calibrated by adaptive temperature scaling; The formula is expressed as: ; ; In the formula: Candidate boxes Confidence level after calibration; Candidate boxes Confidence level; This represents the sigmoid activation function; Indicates the adaptive temperature coefficient; Indicates the basic temperature coefficient; Indicates the sensitivity coefficient; This represents the learnable temperature weight matrix.
10. The method for detecting and identifying pesticide packaging recycling using unmanned aerial vehicles based on deep learning as described in claim 9, characterized in that: In step S206, candidate boxes with a calibrated confidence level exceeding the confidence threshold and their predicted coordinates are retained, while candidate boxes with a calibrated confidence level less than the confidence threshold and their predicted coordinates are deleted.