A rice seedling transplanting position quality evaluation method based on image analysis and geometric modeling
Patent Information
- Application Number
- CN202510262343.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-06
- Publication Date
- 2026-10-30
- Estimated Expiration
- 2045-03-06
AI Technical Summary
[0004]本发明的目的是为了解决现有无人机遥感影像水稻插秧位置估计精度低、评估指标单一且缺乏空间定位能力问题,而提出一种基于图像分析与几何建模的插秧位置质量评估方法
[0016]针对当前水稻插秧质量评估技术在精确性、功能集成度以及自动化水平等方面存在的固有限制,本发明致力于突破现有瓶颈,构建一套高效、精准、智能化的水稻插秧质量评估体系,从而为提升农业生产效率和资源利用率提供坚实的技术保障。本发明的核心目标在于设计并实现一种集秧苗精确定位、缺苗智能识别与推断、秧苗数量精确统计、株距合理性科学评估以及评估结果地理空间可视化等多项关键功能于一体的综合性解决方案。
Smart Images

Figure CN120107799B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a method for evaluating the quality of rice planting locations based on image analysis and geometric modeling. Background Technology
[0002] With the rapid development of smart agriculture, the demand for refined and intelligent farmland management is constantly increasing. Rice planting, as a crucial link in grain production, has a significant impact on the overall growth and final yield of the crop due to the quality of transplanting. However, in actual agricultural production, transplanting operations are often constrained by various factors such as uneven terrain, insufficient mechanical precision, and human error, leading to problems such as uneven seedling distribution, crooked and disordered rows, and missing seedlings. Automated and refined monitoring of seedling distribution in the field is one of the important requirements of precision agriculture.
[0003] Due to its wide coverage, high acquisition efficiency, and non-contact monitoring capabilities, UAV remote sensing technology has gradually become the mainstream tool for monitoring farmland operations. Equipped with high-resolution optical sensors, UAVs can quickly acquire image data of large areas of farmland, enabling the monitoring of crop growth. However, accurately extracting transplanting quality information from complex field environments still faces numerous technical challenges: First, rice seedlings are often mixed with background elements such as weeds and mud in field images, making traditional threshold- or rule-based image processing methods insufficient in terms of recognition accuracy and robustness; second, existing technologies mainly focus on single seedling detection functions, lacking systematic solutions for deeper transplanting quality indicators such as missing seedling identification and plant spacing rationality analysis; furthermore, to achieve precise management of field operations, an effective solution is still needed to align image data with geographic coordinates to label the spatial distribution of missing seedling areas. Deep learning-based object detection networks have achieved excellent performance in general object detection, but when faced with complex backgrounds such as seedlings, weeds, and mud in farmland, traditional object detection networks are often susceptible to interference from sparsity and overlapping plants. To further improve detection accuracy and robustness, a pre-training strategy for rice seedling characteristics in farmland needs to be designed. Simultaneously, when assessing rice transplanting quality, not only accurate target detection results are required, but also automatic identification of the rationality of seedling spacing and precise location of missing seedlings are needed to facilitate timely replanting and overall management. Furthermore, fully utilizing UAV imagery EXIF metadata to map the geographic coordinates of missing seedlings and problem areas would allow agricultural managers to intervene more quickly and accurately. Summary of the Invention
[0004] The purpose of this invention is to address the problems of low accuracy in estimating rice transplanting locations using existing UAV remote sensing images, limited evaluation indicators, and lack of spatial positioning capabilities. Therefore, this invention proposes a method for evaluating the quality of rice transplanting locations based on image analysis and geometric modeling.
[0005] The specific process of a rice planting location quality assessment method based on image analysis and geometric modeling is as follows:
[0006] Step S1: The drone collects RGB image datasets of unmarked rice seedling locations in the farmland;
[0007] Step S2: Preprocess the RGB image data of unlabeled farmland seedling locations collected by the UAV in Step S1, and label the preprocessed RGB image data of unlabeled farmland seedling locations to obtain an RGB image dataset with labeled farmland seedling locations.
[0008] Step S3: Based on the dataset of RGB images of unlabeled farmland seedling locations collected by the UAV in Step S1, the encoder is pre-trained using contrastive learning to obtain a pre-trained encoder.
[0009] Step S4: Based on the RGB image dataset with labeled rice seedling locations obtained in Step S2 and the pre-trained encoder, train the rice seedling target detection model in the field to obtain the trained rice seedling target detection model in the field.
[0010] Step S5: Input the RGB image data to be tested into the trained rice seedling target detection model, and the trained rice seedling target detection model outputs the location of the rice seedlings in the RGB image data to be tested.
[0011] Step S6: Based on the rice seedling target detection model trained in step S5, obtain the rice seedling position information in the RGB image data of the field to be tested, obtain the planting spacing, and determine whether there are missing seedlings based on the planting spacing. If there are no missing seedlings, end the process; if there are missing seedlings, estimate the location of the missing seedlings.
[0012] Step S7: Based on the attitude information and GPS information recorded in step S1 during the UAV flight process, convert the missing seedling location estimated in S6 to the geographic coordinate system.
[0013] Attitude information includes the UAV's roll angle, pitch angle, and yaw angle;
[0014] GPS information includes the drone's longitude, latitude, altitude, and the timestamp of when the GPS information was acquired.
[0015] The beneficial effects of this invention are as follows:
[0016] Addressing the inherent limitations of current rice transplanting quality assessment technologies in terms of accuracy, functional integration, and automation, this invention aims to overcome these bottlenecks and construct an efficient, precise, and intelligent rice transplanting quality assessment system. This system will provide a solid technical guarantee for improving agricultural production efficiency and resource utilization. The core objective of this invention is to design and implement a comprehensive solution integrating multiple key functions, including precise seedling positioning, intelligent identification and inference of missing seedlings, accurate seedling quantity statistics, scientific assessment of plant spacing rationality, and geospatial visualization of assessment results.
[0017] Firstly, the primary technical problem addressed by this invention is how to achieve high-precision and robust detection and localization of rice seedlings in complex and ever-changing farmland environments. Factors such as weeds, soil texture, water reflection, and changes in lighting in farmland environments lead to significant differences in the apparent features of rice seedlings in images, resulting in decreased accuracy and false negatives in traditional detection algorithms. Differences in seedling morphology at different growth stages and shooting angles also increase the difficulty of detection. Traditional detection methods rely on a large number of precisely labeled samples for training; however, with limited labeled data, improving the model's adaptability to complex environmental factors and obtaining high-precision and robust seedling detection results is fundamental and crucial for subsequent high-quality evaluation. Therefore, this invention focuses on improving the generalization ability and robustness of the seedling detection model in the absence of large-scale labeled data. The core lies in using a contrastive learning strategy to pre-train an encoder on large-scale unlabeled farmland image data, enabling it to learn feature representations that are invariant to various environmental disturbances. Subsequently, the pre-trained encoder is transferred to the target detection model for fine-tuning, which significantly improves the model's detection accuracy and generalization ability with limited labeled data. This reduces reliance on labeled data and improves detection performance in complex farmland scenarios.
[0018] Secondly, this invention focuses on solving the problem of accurate identification and location of missing seedlings. Simply relying on detecting existing seedlings is insufficient to accurately determine the existence and specific location of missing seedlings. This invention innovatively introduces the Delaunay triangulation method to construct spatial neighborhood relationships between seedlings based on the detected seedling distribution, thereby inferring potential missing seedling areas. Especially in cases of uneven planting density, avoiding misjudging normal gaps in densely planted areas as missing seedlings and accurately inferring potential missing seedling locations in sparsely planted areas are key technical problems that this invention needs to solve. This invention uses adaptive estimation of the local desired plant spacing, combined with the geometric characteristics of Delaunay triangulation for missing seedling identification, enabling more accurate judgment of missing seedling conditions and precise location of missing seedlings, providing accurate spatial information for subsequent replanting operations.
[0019] Furthermore, this invention aims to achieve accurate statistics on the number of seedlings and scientific evaluation of the rationality of plant spacing. Based on accurate detection and seedling shortage inference, this invention needs to accurately count the total number of seedlings in the field and quantitatively analyze the plant spacing of each seedling and its neighborhood. Determining whether the plant spacing is reasonable is crucial for evaluating the quality of rice transplanting. However, in actual transplanting, plant spacing is not completely uniform and exhibits certain local variability. How to address the local variability of plant spacing in the field and set reasonable evaluation criteria is a key technical problem that this invention needs to solve. By combining Delaunay triangulation to construct neighborhood relationships and adaptive local expected plant spacing estimation, this invention can more accurately evaluate the rationality of seedling spacing, overcoming the bias caused by a globally uniform plant spacing threshold, and providing more refined data support for optimizing planting density.
[0020] Compared with existing rice transplanting quality evaluation methods, this invention mainly improves in three aspects: comprehensiveness, professionalism, and potential real-time performance.
[0021] From a comprehensive perspective, this invention aims to construct an integrated platform that combines multiple evaluation functions, avoiding the limitations of single-function evaluation in traditional methods, and enabling a more comprehensive and systematic assessment of rice transplanting quality. This multi-functional integration not only improves evaluation efficiency but also provides users with richer analytical dimensions and decision support information.
[0022] From a professional perspective, this invention achieves in-depth analysis of rice transplanting quality through ingenious strategies and scheme design. For example, the application of contrastive learning strategies improves the robustness of feature extraction in complex environments, laying the foundation for subsequent high-precision seedling detection; the use of Delaunay triangulation and local expected plant spacing provides an effective scheme for evaluating the rationality of seedling spacing in spatial geometric modeling; and geolocation based on UAV imagery EXIF information provides necessary geospatial information for subsequent precision agriculture operations.
[0023] From a potential real-time perspective, the algorithm framework designed in this invention emphasizes improving computational efficiency while ensuring accuracy. For example, choosing the YOLOv11 backbone network as the encoder and employing efficient modules such as SPPF and C2PSA helps accelerate feature extraction and processing. Combined with the efficient data acquisition capabilities of the UAV platform, the method of this invention has the potential for real-time or near-real-time evaluation, which can provide timely feedback information for agricultural producers to quickly adjust their production strategies.
[0024] In summary, this invention aims to overcome the bottlenecks of existing rice transplanting quality assessment technologies and provide a comprehensive solution that is high-precision, intelligent, and multifunctional. By addressing key technical challenges such as robust detection and precise positioning of seedlings in complex environments (with a particular focus on mitigating model generalization issues through contrastive learning), accurate identification and location inference of missing seedlings, assessment of the rationality of seedling quantity and spacing, and geographic coordinate-based visualization output, this invention is expected to provide strong technical support for achieving large-scale intelligent precision agriculture and help improve rice production efficiency and management levels.
[0025] This invention proposes a method for assessing rice transplanting quality based on image analysis and geometric modeling. This method combines deep learning's object detection capabilities with geometric modeling techniques to integrate multiple functions, including seedling location, missing seedling detection, seedling quantity statistics, and analysis of plant spacing rationality. In complex field environments, this invention can fully utilize the geometric features and attitude information of UAV imagery to spatially align the detection results, completing the geographic location and visual annotation of missing seedling areas.
[0026] This invention proposes a method for evaluating rice transplanting quality based on image analysis and geometric modeling. This method utilizes a contrastive learning strategy to improve the robustness of seedling feature representations and combines geometric modeling to achieve accurate evaluation of transplanting quality. Compared with traditional manual evaluation methods, this invention achieves significant improvements in efficiency, objectivity, and accuracy, effectively reducing labor intensity and human error.
[0027] This invention utilizes comparative learning to effectively leverage a large amount of unlabeled farmland image data, pre-training an encoder with stronger generalization capabilities. This encoder effectively overcomes interference from complex farmland backgrounds, varying lighting conditions, and differences in seedling growth stages, extracting robust seedling features even under different viewpoints, lighting conditions, and image quality. Applying this pre-trained encoder to the training of a subsequent seedling target detection model significantly improves the model's accurate seedling identification and localization capabilities, laying a solid foundation for subsequent quality analysis. Compared to directly training a target detection model on a small amount of labeled data, this invention's method more effectively utilizes the rich information contained in unlabeled data, improving the model's detection performance in complex environments. Furthermore, the geometric modeling method proposed in this invention, based on a combination of Delaunay triangulation and adaptive local expected plant spacing, can accurately identify and precisely locate missing seedling areas. Even in cases of uneven local planting density (such as densely or sparsely planted areas), this method still provides reliable criteria for judging missing seedlings, avoiding misjudgments caused by improper global threshold settings in traditional methods. This invention can also accurately count the number of seedlings in the field and scientifically assess the rationality of seedling spacing by quantitatively analyzing the deviation between the actual plant spacing and the local expected plant spacing, providing objective data support for optimizing planting density. This plant spacing assessment method based on local neighborhood relationships can more accurately reflect the actual planting quality and overcome the limitations of traditional methods that only consider the global average plant spacing. Furthermore, this invention utilizes EXIF information from UAV imagery to accurately map the assessment results to a geographic coordinate system, enabling the geographic location of areas with missing seedlings and abnormal spacing. This function greatly facilitates subsequent precise replanting and field management operations, allowing agricultural producers to quickly locate problem areas and take corresponding measures, thus improving management efficiency.
[0028] In summary, this invention provides an automated, high-precision, and multifunctional solution for assessing rice transplanting quality, offering strong technical support for achieving intelligent and refined agricultural production management. Attached Figure Description
[0029] Figure 1 This is a flowchart of the present invention. Detailed Implementation
[0030] Specific Implementation Method 1: The specific process of this implementation method for assessing the quality of rice planting positions based on image analysis and geometric modeling is as follows:
[0031] A method for assessing rice transplanting quality based on image analysis and geometric modeling, the overall steps of which are shown in the diagram below. Figure 1 As shown (divided into training and inference phases), it includes the following steps:
[0032] Step S1: The drone collects RGB image datasets of unmarked rice seedling locations in the farmland;
[0033] Step S2: Preprocess the RGB image data of unlabeled farmland seedling locations collected by the UAV in Step S1, and label the preprocessed RGB image data of unlabeled farmland seedling locations to obtain an RGB image dataset with labeled farmland seedling locations.
[0034] Step S3: Based on the dataset of RGB images of unlabeled farmland seedling locations collected by the UAV in Step S1, the encoder is pre-trained using contrastive learning to obtain a pre-trained encoder.
[0035] Step S4: Based on the RGB image dataset with labeled rice seedling locations obtained in Step S2 and the pre-trained encoder, train the rice seedling target detection model in the field to obtain the trained rice seedling target detection model in the field.
[0036] Step S5: Input the RGB image data to be tested into the trained rice seedling target detection model, and the trained rice seedling target detection model outputs the location of the rice seedlings in the RGB image data to be tested.
[0037] Step S6: Based on the rice seedling target detection model trained in step S5, obtain the rice seedling position information in the RGB image data of the field to be tested, obtain the planting spacing, and determine whether there are missing seedlings based on the planting spacing. If there are no missing seedlings, end the process; if there are missing seedlings, estimate the location of the missing seedlings.
[0038] Step S7: Based on the attitude information, GPS information, and camera parameters recorded in step S1 during the UAV flight process, convert the missing seedling location estimated in S6 to the geographic coordinate system.
[0039] Attitude information includes the UAV's roll angle, pitch angle, and yaw angle;
[0040] GPS information includes the drone's longitude, latitude, altitude, and the timestamp of when the GPS information was acquired.
[0041] Specific Implementation Method Two: This implementation method differs from Specific Implementation Method One in that step S1 involves the drone collecting an RGB image dataset of unmarked rice seedling locations in the farmland; it includes the following steps:
[0042] Choose a multi-rotor drone, which has a positioning system RTK or PPK;
[0043] Multi-rotor drone equipped with RGB camera;
[0044] Set the flight altitude of the multi-rotor drone equipped with an RGB camera;
[0045] Set the forward overlap rate and lateral overlap rate of a multi-rotor drone equipped with an RGB camera;
[0046] Choose a multi-rotor drone with a high-precision positioning system (such as RTK or PPK) and stable flight performance to ensure the spatial accuracy and clarity of the imagery.
[0047] Equipped with an RGB camera boasting high resolution and excellent color reproduction, it ensures the clear capture of detailed features of rice seedlings. Based on the camera's field of view and target accuracy requirements, an appropriate flight altitude is set, flying at 10-30 meters above the ground to achieve centimeter-level ground resolution. Simultaneously, reasonable forward and lateral overlap rates are set (no less than 80% and 60%, respectively) to guarantee the quality of image stitching and the feasibility of subsequent 3D reconstruction.
[0048] Key parameters of a camera include the size of its image sensor (internal light-sensitive element), lens focal length, exposure time, ISO sensitivity, and aperture size.
[0049] Set appropriate exposure time, ISO sensitivity, and aperture size according to lighting conditions to avoid overexposure or underexposure, ensuring moderate brightness and clear details in the image.
[0050] Fly using pre-planned routes to ensure coverage of the entire target area;
[0051] A drone was used to collect RGB image datasets of unmarked locations of rice seedlings in farmland;
[0052] The RGB image dataset of unlabeled rice seedling locations in farmland, collected by UAVs, is stored using lossless image formats such as RAW or TIFF to preserve the original information of the images and facilitate subsequent fine processing.
[0053] Maintain stable flight of the drone during flight, avoiding swaying and tilting, and record attitude and GPS information during flight;
[0054] Attitude information includes the UAV's roll angle, pitch angle, and yaw angle;
[0055] GPS information includes the drone's longitude, latitude, altitude, and the timestamp of when the GPS information was acquired.
[0056] The other steps and parameters are the same as in Specific Implementation Method 1.
[0057] Specific Implementation Method 3: This implementation method differs from Specific Implementation Method 1 or 2 in that, in step S2, the RGB image data of the unlabeled farmland seedling locations collected by the UAV in step S1 is preprocessed, and the preprocessed RGB image data of the unlabeled farmland seedling locations is labeled to obtain an RGB image dataset with labeled farmland seedling locations.
[0058] The specific process is as follows:
[0059] S21. Perform geometric and atmospheric correction on the RGB image data of unmarked rice seedling locations collected by the UAV in step S1; the specific process is as follows:
[0060] (1) Perform geometric correction on the acquired RGB images to eliminate geometric deformation caused by sensor pose changes and lens distortion, and restore the true geometric shape of the images;
[0061] Geometric correction is achieved using spatial resection methods based on camera calibration parameters and UAV attitude data.
[0062] Atmospheric correction is performed on the geometrically corrected RGB image to eliminate the influence of atmospheric absorption, scattering, and other factors on the spectral information of ground features, thereby obtaining accurate surface reflectance data; represented as:
[0063]
[0064] Among them, L λ The spectral radiance of the RGB image is expressed in W / (m²). 2 ·sr·nm), W is watt (unit of power), m 2 sr is square meters (unit of area), sr is steradian (unit of solid angle), nm is nanometer (unit of wavelength), and · is a multiplication sign;
[0065] d represents the Earth-Sun distance, measured in astronomical units (AU). AU is the standard unit for measuring the average Earth-Sun distance in astronomy.
[0066] E sunλ The average extraterrestrial irradiance of the sun in a given wavelength band, expressed in W / (m²). 2 ·nm);
[0067] θ z ρ is the solar zenith angle. λ Surface reflectance;
[0068] S22. Mark the center point of each seedling in the atmospherically corrected RGB image.
[0069] The center point of each seedling in the atmospherically corrected RGB image was labeled using an image annotation tool.
[0070] The primary target of the labeling is the center point of a single seedling;
[0071] Use a professional image annotation tool (LabelImg) to perform precise point annotation.
[0072] Other steps and parameters are the same as in specific implementation method one or two.
[0073] Specific Implementation Method Four: This implementation method differs from Specific Implementation Methods One to Three in that, in S3, the dataset of unlabeled RGB images of rice seedlings in farmland collected by the UAV in S1 is used to perform self-supervised pre-training on the encoder using contrastive learning to obtain a pre-trained encoder; it includes the following detailed steps:
[0074] S31. Generate positive and negative sample pairs; the specific process is as follows:
[0075] S311. Several anchored image blocks are randomly cropped from the dataset of RGB images of unlabeled rice seedling stages collected by the S1 UAV. Each anchored image block is the same size.
[0076] S312. Perform data augmentation on each anchored image patch to generate corresponding positive sample pairs; the specific process is as follows:
[0077] (1) For each anchored image block, perform random rotation (-10° to 10°), translation (±10% of the image size), scaling (0.8 to 1.2 times), and flipping (horizontal or vertical flipping) to obtain each processed image block; simulate the seedling morphology under different viewpoints and shooting angles;
[0078] (2) For each processed image block obtained in (1), the brightness (±20%), contrast (±20%), saturation (±20%), and hue (±10°) are randomly adjusted in sequence to obtain each processed image block;
[0079] Simulate images under different lighting conditions and color deviations.
[0080] (3) Add different degrees of Gaussian noise, salt-and-pepper noise and blurring to each processed image block obtained in (2) to obtain each processed image block.
[0081] Simulates potential image quality degradation during actual shooting.
[0082] (4) Randomly add weeds to each processed image block obtained in (3) to obtain each processed positive sample image block;
[0083] Each processed positive sample image block and the anchored image block randomly cropped from S311 generate a positive sample pair;
[0084] Improve the model's resistance to interference from weeds.
[0085] This invention employs a series of random image transformations to simulate the variations of the same scene or the same seedling under different viewpoints, lighting conditions, and imaging quality. Each anchored image patch and its enhanced version constitute a positive sample pair.
[0086] S313. From the dataset of unlabeled RGB images of farmland seedlings collected by UAV S1, image blocks different from the anchored image blocks are randomly selected to form negative sample image blocks, ensuring that the content of negative sample pairs is unrelated.
[0087] Negative sample image patches and image patches randomly cropped from S311 are used to generate negative sample pairs;
[0088] By constructing a large number of positive and negative sample pairs, sufficient training data is provided for contrastive learning;
[0089] S32. Select encoder; the specific process is as follows:
[0090] The YOLOv11 backbone network was selected as the encoder;
[0091] This invention selects the YOLOv11 backbone network as the encoder for self-supervised pre-training. The YOLOv11 backbone network mainly consists of input convolutional layers, C3k2 modules, SPPF modules, and C2PSA modules, possessing powerful feature extraction capabilities and efficient computational performance, effectively capturing detailed information and global contextual features in images. This backbone network is extracted from the complete YOLOv11 model, removing its subsequent feature fusion network and prediction head, and trained as an independent encoder.
[0092] S33. Construct the contrastive loss function; the specific process is as follows:
[0093] The InfoNCE loss function is used as the contrastive loss function;
[0094] This invention uses the InfoNCE loss function as the loss function for contrastive learning to maximize the consistency of feature representations between positive sample pairs while minimizing the consistency of feature representations between negative sample pairs.
[0095] The InfoNCE loss function is defined as follows:
[0096]
[0097] in,
[0098] L i This represents the InfoNCE loss function for anchored image patch i;
[0099] q i This represents the query vector output by the encoder when the anchored image block i is input into the encoder;
[0100] k + This represents the key vector output by the encoder when the positive sample corresponding to the anchored image block i is input into the encoder;
[0101] k j This represents the key vector output by the encoder when the negative sample corresponding to the anchored image block i is input into the encoder;
[0102] • Represents the dot product of vectors;
[0103] τ is a temperature coefficient used to adjust the discrimination between different sample pairs and control the degree of separation between positive and negative sample pairs in the feature space;
[0104] j represents a negative sample;
[0105] N i This represents the total number of anchored image patches randomly cropped from a large dataset of unlabeled farmland RGB images collected by drones.
[0106] S34. Based on positive and negative sample pairs, the selected encoder, and the constructed contrastive loss function, perform self-supervised pre-training to obtain a pre-trained encoder;
[0107] The specific process is as follows:
[0108] The anchored image patch i is input into the encoder, and the encoder outputs the query vector q. i ;
[0109] The positive sample corresponding to the anchored image block i is input into the encoder, and the encoder outputs the key vector k. + ;
[0110] The negative sample corresponding to the anchored image patch i is input into the encoder, and the encoder outputs the key vector k. j ;
[0111] Based on query vector q i Key vector k + Key vector k j Calculate the InfoNCE loss;
[0112] Update the encoder parameters using the Adam optimizer and minimize the contrastive loss function;
[0113] The process continues until the contrast loss function converges, resulting in a pre-trained encoder, which is then used to initialize the backbone network of the downstream object detection model, thereby enabling knowledge transfer.
[0114] By pre-training on large-scale unlabeled farmland image data, the encoder can learn more robust and discriminative feature representations of rice seedlings, improving its adaptability to various seedling shapes, scales, and light variations.
[0115] The other steps and parameters are the same as those in one of the specific implementation methods one to three.
[0116] Specific Implementation Method 5: This implementation method differs from one of the specific implementation methods one to four in that, in S4, based on the RGB image dataset of the rice seedling stage labeled in S2 and the pre-trained encoder, a rice seedling target detection model for farmland is trained to obtain a trained rice seedling target detection model for farmland.
[0117] The specific process is as follows:
[0118] S41. Establish a target detection model for rice seedlings in farmland:
[0119] The target detection model for rice seedlings in farmland is the YOLOv11 model, which consists of three parts: a backbone network, a feature fusion network, and a prediction head.
[0120] The backbone network is responsible for extracting features from the input image, the feature fusion network is used to further process the features extracted by the backbone network, and the prediction head is the output part of YOLOv11, which is responsible for classification and localization from the fused features.
[0121] S42. Transfer the weights of the pre-trained encoder to the backbone network of the rice seedling target detection model (YOLOv11 model);
[0122] The encoder weights obtained through self-supervised pre-training on large-scale unlabeled data in step S3 are used as the initial weights for the backbone network of the YOLOv11 object detection model. This knowledge transfer fully utilizes the rich information contained in the unlabeled data, giving the model strong feature extraction capabilities from the early stages of training, accelerating the convergence process, and significantly improving the model's detection performance and generalization ability on limited labeled data. After transferring the weights, some shallow layers of the backbone network are frozen to prevent the destruction of general features learned during pre-training in the early stages. Then, all network layers are gradually unfrozen in subsequent training for end-to-end fine-tuning and optimization.
[0123] S43. Construct the loss function for the target detection model of rice seedlings in farmland:
[0124] An improved Smooth L1 loss function is used to optimize the regression of seedling center coordinates and seedling number, and the cross-entropy loss function is used to optimize the prediction of confidence.
[0125] The loss function takes the following form:
[0126]
[0127] In the formula,
[0128] This represents the smoothed L1 loss function;
[0129] This represents the smoothed L1 loss function;
[0130] It is the center coordinate of the i-th rice seedling predicted by the target detection model for rice seedlings in farmland;
[0131] It is the true value of the center coordinates of the i-th seedling;
[0132] N gt This represents the total number of real rice seedlings in the RGB image dataset where the locations of rice seedlings in the farmland are marked in step S2;
[0133] It is cross-entropy loss;
[0134] It is a binary label indicating whether a seedling exists in the j-th grid cell; if it does, then... It is 1 if it is true, otherwise it is 0;
[0135] It is the confidence level of the j-th grid cell predicted by the target detection model for rice seedlings in farmland to contain seedlings;
[0136] H and W represent the height and width of the feature map, respectively;
[0137] The process of obtaining grid cell j is as follows:
[0138] Set the height and width of one grid cell, and divide the RGB image dataset of the rice seedlings marked in step S2 into ζ grid cells of size one grid cell, j = 1, 2, ..., ζ;
[0139] S44. Optimizer selection and parameter settings;
[0140] The specific process is as follows:
[0141] Adam was selected as the optimizer for the target detection model of rice seedlings in farmland;
[0142] A cosine annealing learning rate decay strategy is adopted, which uses a higher learning rate in the early stage of training to accelerate convergence and then reduces the learning rate in the later stage to improve accuracy.
[0143] The early stopping method is used to prevent overfitting of the target detection model for rice seedlings in farmland.
[0144] S45. Use the RGB image dataset with the rice seedling locations marked in S2 as the training set to train the rice seedling target detection model in the field, and obtain the trained rice seedling target detection model in the field.
[0145] The specific process is as follows:
[0146] (1) Use the RGB image dataset with S2 labeled with the location of rice seedlings in the field as the training set;
[0147] (2) Input the training set into the target detection model for rice seedlings in farmland. The target detection model for rice seedlings in farmland outputs the predicted location of the rice seedlings in farmland. Calculate the loss function based on the predicted location of the rice seedlings in farmland.
[0148] The gradient is calculated using the backpropagation algorithm, and the parameters of the rice seedling target detection model in farmland are updated using an optimizer until the loss function converges, thus obtaining the trained rice seedling target detection model in farmland.
[0149] Evaluate model performance on the validation set and save the parameters of the best-performing model.
[0150] The other steps and parameters are the same as those in one of the specific implementation methods one to four.
[0151] Specific Implementation Method Six: This implementation method differs from Specific Implementation Methods One to Five in that, in S6, the rice seedling position information in the RGB image data of the field to be tested, based on the target detection model of rice seedlings trained in step S5, is used to obtain the transplanting spacing, and it is determined whether the transplanting spacing is reasonable. If it is reasonable, the process ends; if it is not reasonable, the missing seedling position is estimated.
[0152] The specific process is as follows:
[0153] Step S61: Obtain seedling p based on the Delaunay triangulation method. i The neighbor set N i The specific process is as follows:
[0154] The set of coordinate points of the rice seedlings in the RGB image data to be tested, output by the target detection model for rice seedlings trained in steps S611 and S5, is as follows:
[0155] Where, p i p represents the i-th seedling. i coordinates (x) i ,y i ), p i ∈R 2 R represents the set of real numbers, and N represents the total number of rice seedlings in the RGB image data to be tested;
[0156] Set of coordinate points of rice seedlings in farmland Delaunay triangulation was performed to obtain a set of triangular meshes.
[0157] Among them, T k =(v k1 ,v k2 ,v k3 ) represents the k-th triangular mesh, (v k1 ,v k2 ,v k3 ) represents the k-th triangular mesh T k The coordinates of the three vertices, the triangular mesh T k The positions of the three vertices are determined based on the seedling point information in the point set P; N T This represents the number of triangles in a set of triangular grids;
[0158] Step S612: In order to further optimize the modeling of neighborhood relationships, consider the edges of the Delaunay triangulation;
[0159] For each edge e of the triangular mesh ij If edge e ij Connected the i-th seedling p i and the j-th seedling p j And side e ij If a seedling is not "divided" by any other seedling point, then the i-th seedling p is considered to be... i and the j-th seedling p j They are neighbors; the i-th seedling p i The neighbor set is represented as N i ={p j |(p i ,p j )},(p i ,p j () is one edge of the triangular mesh;
[0160] Otherwise, consider the i-th seedling p i and the j-th seedling p j They are not neighbors;
[0161] Step S62: Utilize the neighbor set N i Calculate the i-th seedling p i The planting spacing between each adjacent seedling is used to obtain the local expected average plant spacing based on the planting spacing; the specific process is as follows:
[0162] Step S621: Utilize the neighbor set N i Calculate the i-th seedling p i The planting spacing d between each adjacent seedling ij :
[0163]
[0164] Among them, (x i ,y i ) represents the i-th seedling p i The coordinates, (x j ,y j ) represents the j-th seedling p j The coordinates;
[0165] p j Representative and seedlings p i Adjacent seedlings, i.e., p j Belongs to p i The neighbor set N i ;
[0166] Step S622: To improve robustness, the median is used as the local expected plant spacing average. Because it is not sensitive to outliers:
[0167]
[0168] in, p represents the i-th seedling i The average value of the local expected plant spacing;
[0169] S63. Based on the average value of transplanting spacing and local desired plant spacing. Determine if the spacing is reasonable. If it is reasonable, end the process; otherwise, proceed to step S64.
[0170] The specific process is as follows:
[0171] Considering the allowable error range during the planting process, the following conditions are defined to determine whether the spacing deviates significantly from the expectation:
[0172] If equation (6) is not satisfied, then the i-th seedling p is considered to be i and the j-th seedling p j The spacing between them is reasonable;
[0173] If equation (6) is satisfied, then the i-th seedling p is considered to be i and the j-th seedling p j The spacing between them is unreasonable;
[0174]
[0175] in,
[0176] d ij p represents the i-th seedling i With the j-th adjacent seedling p j The spacing between rice seedlings;
[0177] p represents the i-th seedling i The average value of the local expected plant spacing;
[0178] p represents the j-th seedling j The average of the local expected plant spacing,
[0179] θ spacing θ represents a positive threshold set based on the expected row spacing and plant spacing error tolerances. spacing The value is 2, but the specific value can depend on the actual planting standards and tolerance range.
[0180] Step S64: Estimate the location of missing seedlings based on the average value of the local expected plant spacing; the specific process is as follows:
[0181] Each triangle T after Delaunay triangulation k The seedlings corresponding to the three vertices are the a-th seedling p. a The bth seedling p b The cth seedling p c ;
[0182] First, calculate the lengths of the three sides of the triangle:
[0183] l ab =‖p a -p b ||2 (7)
[0184] l bc =‖p b -p c ||2 (8)
[0185] l ca =‖p c -p a ||2 (9)
[0186] Among them, l ab For vertex p a and p b The length of the side that makes up the edge; l bc For vertex p b and p c The length of the side that makes up the edge; l ca For vertex p c and p a The length of the side that makes up the edge; ||||2 is the 2-norm;
[0187] If the length of one side of a triangle is much greater than the sum of the local expected plant spacing of the seedlings corresponding to its two endpoints, then it is considered that there may be a missing seedling between the two seedlings connected by that side.
[0188] If the following formula is not satisfied, then there is no missing seedling between the two seedlings connected by the longest side;
[0189] If the following formula is satisfied, there may be a gap between the two seedlings connected by the longest edge. The location p of the gap is estimated using a weighted average method based on the local expected plant spacing. missing ;
[0190]
[0191] in, Indicates seedling p a The local expected average plant spacing, Indicates seedling p b The local expected average plant spacing, Indicates seedling p c The local expected plant spacing average; θ missing_edge This indicates the set threshold value, which is 1.8.
[0192] The method of estimating the location p of missing seedlings is based on a weighted average method according to the local expected plant spacing. missing ; indicates as:
[0193]
[0194] Among them, (x a ,y a (x) represents the coordinates of the a-th seedling. b ,y b () represents the coordinates of the b-th seedling;
[0195] The advantage of using a weighted average of locally expected plant spacing to estimate the location of missing seedlings is that it takes into account the non-uniformity of local seedling distribution. If some areas in the field are planted densely and others sparsely (due to factors such as topography, soil quality, or transplanting methods leading to local unevenness), the weighted average can better reflect the true distribution pattern of the seedlings, placing the missing seedlings in areas that more closely match the surrounding density. If the seedling density is p... a Expected plant spacing around A smaller value indicates denser planting in the area, meaning the missing seedlings are more likely to be located near p. a ;vice versa.
[0196] S65. Generate a high-information seedling spacing quality evaluation map based on S63 and S64: Visualize the evaluation results and generate a seedling spacing quality evaluation map containing rich information.
[0197] The other steps and parameters are the same as those in one of the specific implementation methods one to five.
[0198] Specific Implementation Method Seven: This implementation method differs from one of Specific Implementation Methods One to Six in that, in S65, a high-information seedling spacing quality evaluation map is generated based on S63 and S64: the evaluation results are visualized, and a seedling spacing quality evaluation map containing rich information is generated.
[0199] The specific process is as follows:
[0200] Use solid green dots to mark seedlings with normal spacing;
[0201] Yellow triangles are used to mark seedlings with improper spacing;
[0202] Mark the estimated missing seedling locations with a red cross in the middle of seedlings with unreasonable spacing.
[0203] The other steps and parameters are the same as those in one of the specific implementation methods one to six.
[0204] Specific Implementation Method Eight: This implementation method differs from any of the specific implementation methods one to seven in that, in step S7, the missing seedling location estimated in S6 is converted to a geographic coordinate system based on the attitude information, GPS information, and camera parameters of the UAV during flight recorded in step S1.
[0205] Attitude information includes the UAV's roll angle, pitch angle, and yaw angle;
[0206] GPS information includes the drone's longitude, latitude, altitude, and the timestamp of GPS acquisition.
[0207] The specific process is as follows:
[0208] Step S71
[0209] Extract the attitude information, GPS information, and camera parameters of the UAV recorded in step S1 during its flight process;
[0210] GPS information includes the latitude, longitude, and altitude of the location captured by the drone;
[0211] Attitude information includes roll, pitch, and yaw angles;
[0212] S72. Establish the coordinates (u,v) in the image pixel coordinate system to the coordinates (X) in the world coordinate system. w ,Y w Z w The mapping relationship;
[0213] S73, Change the coordinates (X) in the world coordinate system w ,Y w Convert ,0) to coordinates in the geographic coordinate system (Latitude, Longitude);
[0214] S74,
[0215] The coordinates (u,v) in the image pixel coordinate system established according to S72 are converted to the coordinates (X) in the world coordinate system. w ,Y w Z w The mapping relationship will determine the missing seedling location p estimated by S6. missing Transform to world coordinate system (X) w ,Y w ,0);
[0216] According to S73, the coordinates in the world coordinate system (X) are... w ,Y w Convert the coordinates (,0) to geographic coordinates (Latitude, Longitude) to obtain the location p of the missing seedlings. missing Coordinates in a geographic coordinate system.
[0217] The other steps and parameters are the same as those in any of the specific implementation methods one to seven.
[0218] Specific Implementation Method Nine: This implementation method differs from Specific Implementation Methods One to Eight in that, in step S72, the coordinates (u,v) in the image pixel coordinate system are established to the coordinates (X) in the world coordinate system. w ,Y w Z w The mapping relationship;
[0219] The specific process is as follows:
[0220] Considering the relatively flat ground, assume the seedlings are located on the same plane (Z). w =0 or a constant);
[0221] In the homogeneous pixel coordinate system of an image, a point on the image is represented as P. img =[u,v,1] T Point P img The corresponding three-dimensional position in the homogeneous world coordinate system is represented by P. world =[X w ,Y w Z w ,1] T (The homogeneous coordinate representation here adds a dimension of 1 for easier transformation and projection operations in three-dimensional space, but it essentially still represents a three-dimensional point.) It is related by the following formula:
[0222]
[0223] Where s is a scale factor; the superscript T indicates transpose; K is the camera intrinsic matrix, [R|t] is the extrinsic matrix; R is the rotation matrix, t is the translation vector; u represents the x-coordinate in the image pixel coordinate system, v represents the y-coordinate in the image pixel coordinate system, and X... w Represents the X and Y coordinates in the world coordinate system. w Represents the Y-coordinate and Z-coordinate in the world coordinate system. w Represents the Z-coordinate in the world coordinate system;
[0224] Given the altitude of the drone and assuming the ground altitude is 0, solve for the coordinates (X) in world coordinates. w ,Y w ,0).
[0225] The rotation matrix R is calculated from the UAV's roll angle φ, pitch angle ω, and yaw angle κ.
[0226] The other steps and parameters are the same as those in one of the specific implementation methods one to eight.
[0227] Specific Implementation Method Ten: This implementation method differs from Specific Implementation Methods One to Nine in that, in step S73, the coordinates (X) in the world coordinate system are... w ,Y w Convert ,0) to coordinates in the geographic coordinate system (Latitude, Longitude);
[0228] The specific process is as follows:
[0229] The geographic coordinates corresponding to the center of the image at the time of drone capture are (Lat center Lon center (Given)
[0230] Among them, Lat drone Lon is the latitude of the location where the drone took the picture. drone The longitude of the location where the drone took the photo;
[0231] The seedling position in the world coordinate system (X) w ,Y w The coordinates (X, 0) of the ground point in the local coordinate system local ,Y local ) is represented as:
[0232] X local =(X w -c x )×scale x (13)
[0233] Y local =(Y w -c y)×scale y (14)
[0234] in,
[0235] (c x ,c y The coordinates of the image center in the world coordinate system are known.
[0236] scale x and scale y It represents the actual physical size of each pixel, which is calculated using the drone's altitude and camera parameters;
[0237] The coordinates (X) in the local coordinate system local ,Y local Transform the coordinates to a geographic coordinate system (Latitude, Longitude) using an affine transformation:
[0238]
[0239] Where a, b, c, and d represent coefficients; Latitude represents the latitude of the coordinate position in the geographic coordinate system, and Longitude represents the longitude of the coordinate position in the geographic coordinate system;
[0240] The least squares method is used to solve the linear equation system (15) to obtain the optimal estimates of coefficients a, b, c, and d.
[0241] The other steps and parameters are the same as those in any of the specific implementation methods one to nine.
[0242] The testing of the target detection model for rice seedlings in farmland includes the following aspects:
[0243] (1) Use a test dataset that is independent of the training set to ensure the objectivity and reliability of the test results. The test dataset should cover seedling images under various scenarios and conditions, such as different lighting, angles, and growth stages.
[0244] (2) Select appropriate model performance evaluation metrics to comprehensively evaluate the model's detection accuracy and localization capability. The evaluation metrics used for seedling density estimation include: precision, recall, F1 score, and mean average precision (mAP).
[0245] The trained model was tested using a test dataset, and various performance evaluation metrics were calculated. Based on the test results, the model was further optimized or the training strategy was adjusted.
[0246] Key points of the invention
[0247] 1. A Self-Supervised Pre-training Scheme for Rice Seedling Target Detection. This invention employs a contrastive learning strategy, utilizing large-scale unlabeled farmland RGB image data for self-supervised pre-training of the encoder. By constructing positive and negative sample pairs and designing the InfoNCE loss function, the encoder learns more discriminative and robust feature representations for rice seedlings. Specifically, by applying a series of data augmentation strategies, such as geometric transformation, color perturbation, noise addition, and weed simulation, positive sample pairs anchored to image patches are generated to simulate the variation of the same seedling under different viewpoints, lighting conditions, and image quality. This self-supervised pre-training method fully utilizes the rich information contained in a large amount of unlabeled data, significantly improving the encoder's feature extraction ability and generalization performance when facing complex farmland environments (such as changes in lighting, weed occlusion, and viewpoint differences), laying a solid foundation for subsequent accurate seedling target detection, rather than solely relying on training with labeled data. The key to this invention lies in the crucial role of this contrastive learning strategy in improving the robustness of the seedling detection model to complex and variable farmland environments.
[0248] 2. Accurate identification and location of missing seedlings by combining Delaunay triangulation and adaptive local expected plant spacing. To address the problem of missing seedling identification, this invention proposes a neighborhood relationship modeling method based on Delaunay triangulation, combined with adaptive local expected plant spacing estimation, to achieve accurate identification of missing seedling areas and precise location of missing seedlings. Delaunay triangulation can effectively represent the true adjacency relationships between seedlings, while the introduction of adaptive local expected plant spacing can effectively address situations of uneven local planting density, avoiding misjudging normal gaps as missing seedlings and accurately inferring potential missing seedling locations.
[0249] 3. A Seedling Target Detection Model Integrating a Self-Supervised Pre-trained Encoder and Its Application in Evaluating the Reasonableness of Seedling Quantity and Spacing. This invention constructs a deep learning-based target detection model. This model uses a self-supervised pre-trained encoder through contrastive learning as its backbone network, thus inheriting the powerful feature extraction capabilities of the pre-trained encoder. This model can accurately predict the center position of seedlings, providing precise data support for subsequent seedling quantity statistics and spacing reasonableness evaluation. Based on the accurate seedling localization results, combined with the neighborhood relationships constructed by Delaunay triangulation and adaptive local expected plant spacing, this invention can quantitatively evaluate the reasonableness of seedling spacing and identify abnormal spacing that significantly deviates from the expected value.
[0250] 4. Geolocation and Visualization Output Based on UAV Imagery EXIF Information. To achieve accurate spatial positioning and visualization of evaluation results, this invention utilizes EXIF metadata (such as GPS coordinates and attitude information) from UAV imagery, combined with a camera imaging model, to establish a transformation relationship from image coordinates to geographic coordinates. This method can project detected missing seedling locations and abnormal spacing areas onto a geographic coordinate system and generate a highly informative seedling spacing quality evaluation map, providing intuitive and precise guidance for field workers.
[0251] In summary, the innovations of this invention are mainly reflected in the design and application of the technical solution, particularly in achieving a breakthrough in improving the robustness of seedling detection under complex environments using a contrastive learning strategy. First, the self-supervised pre-training method based on contrastive learning proposed in this invention can effectively improve the detection accuracy and robustness of seedlings under complex environments, overcoming the limitations of traditional methods that rely on supervised learning. Second, by combining Delaunay triangulation and adaptive local expected plant spacing, accurate identification and location of missing seedlings are achieved, effectively solving the misjudgment problem of traditional methods under uneven planting density. Furthermore, applying the self-supervised pre-trained encoder to the target detection model improves the accuracy of seedling quantity statistics and spacing rationality assessment. Finally, geospatial visualization of the assessment results is achieved based on UAV imagery EXIF information. In summary, this invention enables accurate, comprehensive, and reliable assessment of rice transplanting quality, and has significant application value for improving agricultural production management.
[0252] While the technical solution of this invention can effectively achieve high-precision and robust rice transplanting quality assessment, there are alternative solutions in certain specific application scenarios, such as when computing resources are extremely limited or the assessment accuracy requirements can be appropriately reduced. However, these alternative solutions are generally insufficient in terms of robustness of seedling detection, especially in complex and variable farmland environments, and are difficult to achieve the technical effects of this invention.
[0253] The core technical challenge of this invention lies in achieving high-precision and robust detection and localization of rice seedlings in complex and ever-changing farmland environments. This invention effectively solves this problem by introducing a contrastive learning strategy in step S3 to perform self-supervised pre-training of the encoder. This strategy utilizes a large amount of unlabeled farmland image data, enabling the encoder to learn more discriminative and robust seedling feature representations, thereby significantly improving the generalization ability of the target detection model under different viewpoints, lighting conditions, and image quality.
[0254] If we consider an alternative to step S3, one possible approach is to directly train the rice seedling detection model in farmland using supervised learning methods instead of self-supervised pre-training with contrastive learning. However, the effectiveness of this approach heavily depends on the quality and quantity of labeled data. With limited labeled data, the model is prone to overfitting, leading to a significant drop in detection performance in unfamiliar and complex farmland scenes. Furthermore, the labeling process itself is time-consuming and labor-intensive, making it difficult to utilize the rich information contained in massive amounts of unlabeled farmland imagery. In contrast, the contrastive learning method employed in this invention can fully utilize a large amount of readily available unlabeled data to learn more generalized feature representations, thereby improving the model's generalization ability and robustness.
[0255] Another alternative is to use traditional image feature extraction methods, such as hand-designed feature descriptors (e.g., SIFT, HOG), combined with machine learning classifiers for seedling detection. However, the features extracted by these traditional methods are sensitive to factors such as changes in lighting, scale, and occlusion, making them unsuitable for seedling detection in complex farmland environments. Compared to deep learning methods, their feature representation capabilities are fundamentally inferior, failing to capture the diverse features of seedlings, resulting in detection accuracy and robustness that are insufficient to meet the requirements of high-quality rice transplanting assessment.
[0256] In step S6, the process of locating missing seedlings and assessing the quality of transplanting spacing, while a simplified method based on point-by-point distance calculation could be considered—that is, calculating the nearest neighbor distance between each detected seedling point and other seedling points and setting a fixed distance threshold to determine whether there are missing seedlings or abnormal spacing—this method ignores the local differences in farmland planting. In cases of manual transplanting or uneven local planting density, it is easy to misjudge normal sparse areas as missing seedlings, or the spacing assessment may be inaccurate. In contrast, the neighborhood relationship modeling method based on Delaunay triangulation and adaptive local expected plant spacing estimation designed in this invention can more accurately reflect the actual distribution of seedlings and adaptively assess missing seedlings and spacing quality based on local density, exhibiting higher accuracy and reliability.
[0257] In summary, although some alternatives exist to some of the technical solutions of this invention, these alternatives have significant shortcomings in addressing the core technical challenge of high-precision and robust detection and localization of rice seedlings in complex farmland environments. The self-supervised pre-training method based on contrastive learning adopted in this invention can more effectively utilize unlabeled data to improve the model's generalization ability and robustness, which is key to achieving high-quality rice transplanting assessment. Other alternatives either rely on large amounts of labeled data, have insufficient feature representation capabilities, or cannot adapt to the local differences in farmland planting, making it difficult to achieve the technical effects and accuracy levels of this invention.
[0258] What are the advantages of this invention compared to the closest existing technology?
[0259] In response to current rice transplanting quality assessment technologies based on remote sensing imagery, the method proposed in this invention, based on image analysis and geometric modeling, exhibits significant advantages in several aspects and effectively overcomes the limitations of existing technologies. Specific comparisons are as follows:
[0260] 1. Significantly Improved Accuracy and Robustness of Seedling Detection in Complex Environments: Existing rice transplanting quality assessment methods, some of which focus on simple object detection or traditional machine learning methods, have limited feature extraction capabilities and struggle to effectively address factors such as varying light levels, shadow interference, weed occlusion, and differences in seedling growth stages in complex farmland environments. This results in insufficient accuracy and robustness in seedling detection, easily leading to missed detections and false detections. In contrast, this invention innovatively employs a contrastive learning strategy for self-supervised pre-training of the encoder. This method utilizes a large amount of unlabeled farmland RGB image data to learn more robust and discriminative seedling feature representations by constructing positive and negative sample pairs. This pre-training method enables the encoder to capture more essential seedling features, significantly improving the adaptability and generalization performance of the object detection model in various complex environments. Subsequent object detection models benefit from the high-quality features extracted by this pre-trained encoder, enabling more accurate identification and location of seedlings. Even under adverse conditions such as uneven lighting and weed interference, they maintain high detection accuracy, laying a more solid and reliable foundation for subsequent quality assessment. Compared to existing technologies that rely solely on supervised learning or shallow feature extraction, the method of this invention has significant advantages in detection performance in complex farmland scenarios.
[0261] 2. Precise Identification and Location of Missing Seedlings: Some existing rice transplanting quality assessment methods rely mainly on simple density statistics, fixed threshold rule judgments, or analysis based on low-resolution remote sensing images for identifying missing seedlings. These methods struggle to accurately address situations with uneven seedling distribution and significant local planting density differences, and often only provide macroscopic estimates of the area or number of missing seedlings, failing to pinpoint their exact location. This invention innovatively introduces a neighborhood relationship modeling method based on Delaunay triangulation, combined with adaptive local expected plant spacing estimation. Delaunay triangulation effectively captures the spatial proximity relationships between seedlings, while adaptive local expected plant spacing considers local planting differences and dynamically estimates the expected plant spacing based on the distribution of surrounding seedlings. Based on this, this invention can accurately identify missing seedlings caused by missed planting or seed death, and precisely locate the position of each missing seedling, providing reliable criteria and accurate location information even in cases of localized dense or sparse planting. This has significant advantages over existing technologies that can only provide a macroscopic picture of missing seedlings or rely on fixed thresholds to determine the exact location of each missing seedling, and can provide more effective guidance for precise replanting operations.
[0262] 3. Comprehensiveness and Accuracy of Evaluation Indicators: Some existing technologies or methods may only provide single-dimensional evaluation indicators such as seedling density and coverage, failing to comprehensively and accurately reflect the quality of rice transplanting. For example, even if the seedling density meets the standard, uneven plant spacing can severely affect subsequent growth. The method proposed in this invention can comprehensively evaluate the rationality of both seedling quantity and plant spacing. First, a high-precision target detection model accurately counts the number of seedlings. Second, using Delaunay triangulation and adaptive local expected plant spacing, the rationality of the spacing between adjacent seedlings can be quantitatively evaluated, identifying excessively large or small spacings that deviate significantly from the expected value. This comprehensive evaluation indicator can more comprehensively and accurately reflect the quality of rice transplanting, avoiding the one-sidedness that may result from a single indicator evaluation. Compared to existing technologies with single and limited-precision evaluation indicators, this invention can provide more valuable and comprehensive reference information, providing more reliable data support for refined management.
[0263] 4. Effective Integration and Application of Geospatial Information: Many existing rice transplanting quality assessment methods or systems lack effective integration with geospatial information, making it difficult to directly apply the assessment results to guide field management and precision operations. For example, even if missing seedlings are detected, it is difficult to quickly locate their specific positions within the field. This invention fully utilizes the precise geographic coordinates and attitude information contained in the EXIF metadata of UAV imagery to establish a precise conversion relationship between image pixel coordinates and geographic coordinates. This method can accurately project each detected missing seedling location and improperly spaced seedling pairs onto the geographic coordinate system, generating a high-information-content seedling spacing quality evaluation map with geographic coordinate information. These evaluation maps can provide intuitive and operable guidance information for precision agriculture operations such as precise replanting and variable fertilization, greatly enhancing the application value of the assessment results. This is a significant advantage that many existing technologies struggle to achieve due to the lack of effective geographic information fusion methods.
[0264] This invention may have other embodiments. Without departing from the spirit and essence of this invention, those skilled in the art can make various corresponding changes and modifications according to this invention, but these corresponding changes and modifications should all fall within the protection scope of the appended claims.
Claims
1. A method for evaluating the quality of rice transplanting positions based on image analysis and geometric modeling, characterized in that: The specific process of the method is as follows: Step S1: The drone collects RGB image datasets of unmarked rice seedling locations in the farmland; Step S2: Preprocess the RGB image data of unlabeled farmland seedling locations collected by the UAV in Step S1, and label the preprocessed RGB image data of unlabeled farmland seedling locations to obtain an RGB image dataset with labeled farmland seedling locations. Step S3: Based on the dataset of RGB images of unlabeled farmland seedling locations collected by the UAV in Step S1, the encoder is pre-trained using contrastive learning to obtain a pre-trained encoder. Step S4: Based on the RGB image dataset with labeled rice seedling locations obtained in Step S2 and the pre-trained encoder, train the rice seedling target detection model in the field to obtain the trained rice seedling target detection model in the field. Step S5: Input the RGB image data to be tested into the trained rice seedling target detection model, and the trained rice seedling target detection model outputs the location of the rice seedlings in the RGB image data to be tested. Step S6: Based on the rice seedling target detection model trained in step S5, obtain the rice seedling position information in the RGB image data of the field to be tested, obtain the planting spacing, and determine whether there are missing seedlings based on the planting spacing. If there are no missing seedlings, end the process; if there are missing seedlings, estimate the location of the missing seedlings. Step S7: Based on the attitude information and GPS information recorded in step S1 during the UAV flight process, convert the missing seedling location estimated in S6 to the geographic coordinate system. Attitude information includes the UAV's roll angle, pitch angle, and yaw angle; GPS information includes the drone's longitude, latitude, altitude, and the timestamp of GPS acquisition. In step S6, the rice seedling position information in the RGB image data of the field to be tested is used to obtain the transplanting spacing based on the rice seedling target detection model trained in step S5. If the transplanting spacing is reasonable, the process ends; otherwise, the missing seedling position is estimated. The specific process is as follows: Step S61: Obtain seedlings based on the Delaunay triangulation method Neighbor set The specific process is as follows: The set of coordinate points of the rice seedlings in the RGB image data to be tested, output by the target detection model for rice seedlings trained in steps S611 and S5, is as follows: ; in, Indicates the first One seedling, coordinates , , Represents the set of real numbers. This represents the total number of rice seedlings in the RGB image data to be tested; Set of coordinate points of rice seedlings in farmland Delaunay triangulation was performed to obtain a set of triangular meshes. ; in, Indicates the first A triangular grid, Indicates the first Triangular grid The coordinates of the three vertices; This represents the number of triangles in a set of triangular grids; Step S612: For each edge of the triangular mesh If the side Connected to the first seedlings and the seedlings And on the side If it is not "divided" by any other seedling point, then it is considered that the first seedling point is... seedlings and the seedlings They are neighbors; the first seedlings The neighbor set is represented as , It is one edge of the triangular mesh; Otherwise, it is considered that the first seedlings and the seedlings They are not neighbors; Step S62: Utilize the neighbor set Calculate the first seedlings The planting spacing between each adjacent seedling is used to obtain the local expected average plant spacing based on the planting spacing; the specific process is as follows: Step S621: Utilize the neighbor set Calculate the first seedlings Planting spacing between each adjacent seedling : (4) in, Indicates the first seedlings coordinates Indicates the first seedlings The coordinates; Representatives and seedlings Adjacent seedlings, i.e. belong Neighbor set ; Step S622: Use the median as the local expected plant spacing average. : (5) in, Indicates the first seedlings The average value of the local expected plant spacing; S63. Based on the average value of transplanting spacing and local desired plant spacing. Determine if the spacing is reasonable. If it is reasonable, end the process; otherwise, proceed to step S64. The specific process is as follows: If equation (6) is not satisfied, then the first one is considered to be... seedlings and the seedlings The spacing between them is reasonable; if equation (6) is satisfied, then the first one is considered to be reasonable. seedlings and the seedlings The spacing between them is unreasonable; (6) in, Indicates the first seedlings With the Adjacent seedlings The spacing between rice seedlings; Indicates the first seedlings The average value of the local expected plant spacing; Indicates the first seedlings The average of the local expected plant spacing, ; This indicates the set positive threshold. Step S64: Estimate the location of missing seedlings based on the average value of the local expected plant spacing; the specific process is as follows: Each triangle after Delaunay triangulation The seedlings corresponding to the three vertices are respectively the first seedlings , No. seedlings , No. seedlings ; First, calculate the lengths of the three sides of the triangle: (7) (8) (9) in, As vertices and The length of the side that makes up the edge; As vertices and The length of the side that makes up the edge; As vertex and The length of the side that makes up the edge; It is a 2-norm; If the following formula is not satisfied, then there is no missing seedling between the two seedlings connected by the longest side; If the following formula is satisfied, there may be a gap between the two seedlings connected by the longest edge. The location of the gap is estimated by using a weighted average method based on the local expected plant spacing. ; (10) in, Indicates seedlings The local expected average plant spacing, Indicates seedlings The local expected average plant spacing, Indicates seedlings The local expected plant spacing average; This indicates the set threshold. The method of estimating missing seedling locations is based on a weighted average method according to the local expected plant spacing. ; indicates as: (11) in, Indicates the first The coordinates of each seedling Indicates the first The coordinates of each seedling; S65. Generate a seedling spacing quality evaluation chart based on S63 and S64.
2. The method for evaluating the quality of rice planting location based on image analysis and geometric modeling according to claim 1, characterized in that: Step S1 involves the drone collecting an RGB image dataset of unlabeled rice seedling locations in the farmland; this includes the following steps: The drone is equipped with an RGB camera; Set the flight altitude of the drone equipped with an RGB camera; Flying along a pre-planned route; A drone was used to collect RGB image datasets of unmarked locations of rice seedlings in farmland; The RGB image dataset of unlabeled rice seedling locations in farmland, collected by UAVs, is stored using RAW or TIFF lossless image formats. Record attitude and GPS information during flight; Attitude information includes the UAV's roll angle, pitch angle, and yaw angle; GPS information includes the drone's longitude, latitude, altitude, and the timestamp of when the GPS information was acquired.
3. The method for evaluating the quality of rice planting location based on image analysis and geometric modeling according to claim 2, characterized in that: In step S2, the RGB image data of unlabeled farmland seedling locations collected by the UAV in step S1 is preprocessed, and the preprocessed RGB image data of unlabeled farmland seedling locations is labeled to obtain an RGB image dataset with labeled farmland seedling locations; the specific process is as follows: S21. Perform geometric and atmospheric correction on the RGB image data of unmarked rice seedling locations collected by the UAV in step S1; the specific process is as follows: (1) Perform geometric correction on the acquired RGB images; Atmospheric correction is performed on the geometrically corrected RGB image to obtain accurate surface reflectance data; represented as: (1) in, This represents the spectral radiance of the RGB image. The Earth-Sun distance; The average extraterrestrial irradiance of the sun in a given wavelength band; The solar zenith angle; Surface reflectance; S22. Mark the center point of each seedling in the atmospherically corrected RGB image.
4. The method for evaluating the quality of rice planting location based on image analysis and geometric modeling according to claim 3, characterized in that: The dataset in S3, based on unlabeled RGB images of rice seedlings in farmland collected by the S1 UAV, uses contrastive learning to perform self-supervised pre-training on the encoder, resulting in a pre-trained encoder; this includes the following detailed steps: S31. Generate positive and negative sample pairs; the specific process is as follows: S311. Anchored image blocks are randomly cropped from the dataset of RGB images of unlabeled rice seedling stages collected by the S1 UAV, with each anchored image block being the same size; S312. Perform data augmentation on each anchored image patch to generate corresponding positive sample pairs; the specific process is as follows: (1) Randomly rotate, translate, scale, and flip each anchored image block to obtain each processed image block; (2) For each processed image block obtained in (1), the brightness, contrast, saturation and hue are randomly adjusted in sequence to obtain each processed image block. (3) Gaussian noise, salt-and-pepper noise and blurring are added to each processed image block obtained in (2) in sequence to obtain each processed image block; (4) Randomly add weeds to each processed image block obtained in (3) to obtain each processed positive sample image block; Each processed positive sample image block and the anchored image block randomly cropped from S311 generate a positive sample pair; S313. From the dataset of unlabeled RGB images of farmland seedlings collected by UAV S1, image blocks that are different from the anchored image blocks are randomly selected to form negative sample image blocks. Negative sample image patches and image patches randomly cropped from S311 are used to generate negative sample pairs; S32. Select encoder; the specific process is as follows: The YOLOv11 backbone network was selected as the encoder; S33. Construct the contrastive loss function; the specific process is as follows: The InfoNCE loss function is used as the contrastive loss function; The InfoNCE loss function is defined as follows: (2) in, Represents anchored image blocks The InfoNCE loss function; This indicates that the image block will be anchored. The input is fed into the encoder, and the encoder outputs the query vector; This indicates that the image block will be anchored. The corresponding positive sample is input into the encoder, and the encoder outputs the key vector; This indicates that the image block will be anchored. The corresponding negative sample is input into the encoder, and the encoder outputs the key vector; Represents the dot product of vectors; It is the temperature coefficient; Indicates a negative sample; This represents the total number of anchored image patches randomly cropped from the dataset of unlabeled farmland RGB images collected by drones; S34. Based on positive and negative sample pairs, the selected encoder, and the constructed contrastive loss function, self-supervised pre-training is performed to obtain the pre-trained encoder; the specific process is as follows: Anchor image blocks The input is fed into the encoder, and the encoder outputs a query vector. ; Anchor image blocks The corresponding positive samples are input into the encoder, and the encoder outputs the key vector. ; Anchor image blocks The corresponding negative samples are input into the encoder, and the encoder outputs the key vector. ; Based on query vector Key vector Key vector Calculate the InfoNCE loss; Update the encoder parameters using the Adam optimizer and minimize the contrastive loss function; The process continues until the contrastive loss function converges, resulting in a pre-trained encoder.
5. The method for evaluating the quality of rice planting location based on image analysis and geometric modeling according to claim 4, characterized in that: In S4, based on the RGB image dataset of rice seedlings labeled in S2 and the pre-trained encoder, a rice seedling target detection model is trained to obtain a trained rice seedling target detection model. The specific process is as follows: S41. Establish a target detection model for rice seedlings in farmland: The target detection model for rice seedlings in farmland is the YOLOv11 model; S42. Transfer the weights of the pre-trained encoder to the backbone network of the rice seedling target detection model in farmland. S43. Construct the loss function for the target detection model of rice seedlings in farmland: The loss function takes the following form: (3) In the formula, This represents the smoothed L1 loss function; This represents the smoothed L1 loss function; This is the first prediction made by the target detection model for rice seedlings in farmland. The center coordinates of each seedling; It is the first The true value of the center coordinates of each seedling; This represents the total number of real rice seedlings in the RGB image dataset where the locations of rice seedlings in the farmland are marked in step S2; It is cross-entropy loss; It is a binary tag, indicating the first Does each grid cell contain seedlings? If so, then... It is 1 if it is true, otherwise it is 0; This is the first prediction made by the target detection model for rice seedlings in farmland. Each grid cell has a confidence level regarding the presence of seedlings; and These represent the height and width of the feature map, respectively. S44, Optimizer Selection; S45. Use the RGB image dataset with the rice seedling locations marked in S2 as the training set to train the rice seedling target detection model in the field, and obtain the trained rice seedling target detection model in the field.
6. The method for evaluating the quality of rice planting location based on image analysis and geometric modeling according to claim 5, characterized in that: In step S65, a seedling spacing quality evaluation map is generated based on steps S63 and S64; the specific process is as follows: Use solid green dots to mark seedlings with normal spacing; Yellow triangles are used to mark seedlings with improper spacing; Mark the estimated missing seedling locations with a red cross in the middle of seedlings with unreasonable spacing.
7. The method for evaluating the quality of rice transplanting location based on image analysis and geometric modeling according to claim 6, characterized in that: In step S7, based on the attitude information and GPS information of the UAV during flight recorded in step S1, the missing seedling location estimated in S6 is converted to a geographic coordinate system. Attitude information includes the UAV's roll angle, pitch angle, and yaw angle; GPS information includes the drone's longitude, latitude, altitude, and the timestamp of GPS acquisition. The specific process is as follows: Step S71 Extract the attitude information and GPS information of the UAV recorded in step S1 during its flight process; GPS information includes the latitude, longitude, and altitude of the location captured by the drone; Attitude information includes roll, pitch, and yaw angles; S72. Establish coordinates in the image pixel coordinate system Coordinates in the world coordinate system The mapping relationship; S73, Change the coordinates in the world coordinate system Convert to geographic coordinate system ; S74. Coordinates in the image pixel coordinate system established according to S72 Coordinates in the world coordinate system The mapping relationship will determine the locations of missing seedlings estimated by S6. Transform to world coordinate system ; According to S73, coordinates in the world coordinate system Convert to geographic coordinate system To obtain the location of missing seedlings Coordinates in a geographic coordinate system.
8. The method for evaluating the quality of rice transplanting location based on image analysis and geometric modeling according to claim 7, characterized in that: In S72, the coordinates are established in the image pixel coordinate system. Coordinates in the world coordinate system The mapping relationship; the specific process is as follows: Assume the seedlings are located on the same plane; In the homogeneous pixel coordinate system of an image, a point on the image is represented as: ,point The corresponding three-dimensional position in the homogeneous world coordinate system is represented as: ; The following formula is used for correlation: (12) in, It is a scale factor; the superscript T indicates transpose. For the camera intrinsic parameter matrix, This is the extrinsic parameter matrix; It is a rotation matrix. It is a translation vector; Represents the x-coordinate in the image pixel coordinate system. Represents the ordinate in the image pixel coordinate system. Represents the X-coordinate in the world coordinate system. Represents the Y-coordinate in the world coordinate system. Represents the Z-coordinate in the world coordinate system; Given the altitude of the drone and assuming the ground altitude is 0, the coordinates in world coordinates can be calculated. .
9. The method for evaluating the quality of rice transplanting location based on image analysis and geometric modeling according to claim 8, characterized in that: S73 will use coordinates in the world coordinate system. Convert to geographic coordinate system ; The specific process is as follows: The geographic coordinates of the image center at the moment the drone was captured are ; in, This refers to the latitude of the location where the drone took the photo. The longitude of the location where the drone took the photo; The position of the seedlings in the world coordinate system The corresponding ground point coordinates in the local coordinate system Represented as: (13) (14) in, These are the coordinates of the image center in the world coordinate system; and It represents the actual physical size that each pixel represents; coordinates in the local coordinate system Coordinates transformed to geographic coordinates via an affine transformation : (15) in, , , , Indicates coefficient; Indicates the latitude of the coordinate position in the geographic coordinate system. Indicates the longitude of the coordinate position in the geographic coordinate system; The least squares method is used to solve the linear system of equations (15) to obtain the coefficients. , , , The optimal estimate.
Citation Information
Patent Citations
Seedling missing detection method
CN116584220A
Plant seedling stage seedling emergence quality evaluation method and device based on remote sensing image
CN118865098A
Green orange detection method based on self-supervised comparative learning and computer device
CN119169472A
