An intelligent detection method for agricultural waste mulch film based on UAV remote sensing images
By introducing FPN and RetinaNet detection heads into the DINO model, combined with k-means clustering and specific loss functions, the sample imbalance and small object detection problems in agricultural waste plastic film detection in drone high-resolution images are solved. Achieve higher detection accuracy and efficiency.
Patent Information
- Application Number
- CN202410725672.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-06
- Publication Date
- 2025-02-14
- Estimated Expiration
- 2044-06-06
AI Technical Summary
In the prior art, when using deep learning methods to detect agricultural waste plastic film in high-resolution images of drones, there are problems with sample category imbalance and small object detection.
Based on the DINO model, a feature pyramid network (FPN) is introduced to capture multi-scale features, and a RetinaNet detection head is used to improve detection accuracy. At the same time, the anchor box size is determined through k-means clustering, and FocalLoss and CIoULoss are used as loss functions to solve the sample imbalance problem and improve the detection positioning accuracy.
Effectively improve the accuracy and efficiency of detecting agricultural waste films of different sizes from high-resolution remote sensing images of drones, solve the problems of sample imbalance and small object detection, and provide stronger technical support for agricultural waste management and protection. .
Smart Images

Figure CN118691991B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of deep learning target detection technology, and specifically to a technology for detecting agricultural mulch films in high-resolution images of unmanned aerial vehicles using deep learning technology. Background Art
[0002] In the agricultural field, intelligent detection of waste mulch is of great significance for environmental protection and sustainable agricultural development. Since waste mulch degrades very slowly in the natural environment, the mulch remaining in the soil will have an adverse effect on soil structure and crop growth, which in turn will affect ecological balance and agricultural production. Traditional detection methods mainly rely on manual inspections, but this method cannot be applied on a large scale and is inefficient. Manual detection is not only time-consuming and labor-intensive, but also due to the subjectivity of the human eye and the limitations of environmental conditions, the accuracy and consistency of the detection results are difficult to guarantee.
[0003] With the development of drone technology and the advancement of deep learning technology, using drones to obtain high-resolution farmland images and combining deep learning algorithms for intelligent detection has become an effective way to solve the problem of abandoned mulch film detection. However, the use of deep learning methods for abandoned mulch film detection may have the following problems:
[0004] 1. In actual farmland images, there is a significant difference in the number of abandoned mulch (positive samples) and background (negative samples), which leads to an imbalance in the sample categories of model training, thus affecting the model training effect.
[0005] 2. Agricultural waste mulch is usually small in size and has a low contrast with the farmland background, which poses a challenge to the detection of small targets. Further research is needed to accurately locate the location of waste mulch from high-resolution remote sensing images.
[0006] To solve the above problems, the present invention, based on the DINO model, introduces a feature pyramid network (FPN) to capture multi-scale features, adopts the RetinaNet detection head to improve the detection accuracy, and uses k-means clustering to determine the anchor frame size. A DINO-HResNet (High Resolution) model is built to detect agricultural waste mulch from high-resolution remote sensing images taken by UAVs. The model can better detect agricultural waste mulch of different sizes from high-resolution remote sensing images taken by UAVs, providing strong technical support for the management and protection of agricultural waste. Summary of the invention
[0007] The purpose of the present invention is to provide an intelligent detection method for agricultural waste mulch film based on UAV remote sensing images to solve the problems raised in the above background technology.
[0008] To achieve the above object, the present invention provides the following technical solutions:
[0009] An intelligent detection method for agricultural waste mulch film based on UAV remote sensing images includes the following steps:
[0010] Step 1: Data collection and preprocessing of agricultural waste mulch film images;
[0011] Step 2: Improve the construction of the DINO-HResNet model;
[0012] Step 3: Training based on the DINO-HResNet model;
[0013] Step 4: Visualize the prediction and detection results of the DINO-HResNet model.
[0014] As a further solution of the present invention: the specific process of data collection in step 1 is as follows: first, the operating personnel need to conduct a comprehensive environmental survey of the farmland area. By collecting detailed information on the surrounding terrain and landforms, necessary preliminary preparations are provided for the selection of the take-off point of the UAV, the setting of the landing area, and the planning of the aerial photography route. Next, the route and flight parameters of the UAV are set, and the flight route of the UAV is planned to ensure full coverage of the target area, and then the flight altitude, shooting angle, aerial photography speed and image acquisition frequency of the UAV are set. Finally, during the flight, the operator monitors the images captured by the UAV in real time through the ground station, and synchronizes the data after the flight.
[0015] As a further solution of the present invention, the specific processing steps of the data preprocessing in step 1 include: first, applying an edge detection algorithm to highlight the features of the edge of the agricultural film, and then applying a histogram equalization method to adjust the contrast and brightness of the image to enhance the distinction between the film and the background in the image.
[0016] As a further solution of the present invention, the edge detection algorithm of data preprocessing selects the Laplacian operator, which is an isotropic second-order differential operator with rotation invariance. This operator is not suitable for processing images with large noise intensity, so it is necessary to first apply low-pass filtering to remove image noise. The mathematical expression of the Gaussian low-pass filter is as follows:
[0017]
[0018] G(x,y) represents the Gaussian function, σ is the standard deviation of the Gaussian kernel, and (x,y) represents the coordinates in the image space. In discrete form, for each pixel I(i,j) in the image, m and n are integers representing the horizontal and vertical offsets of the center of the Gaussian kernel relative to the current processing pixel I(i,j). The value I'(i,j) after Gaussian low-pass filtering can be calculated as follows:
[0019]
[0020] The summation is performed over the entire image space, but in applications, only a small range around the Gaussian kernel is usually considered, because the distant values have very little effect on the center point. Due to the smoothing process of the Gaussian filter in the spatial domain, the edge information of the image is retained to a certain extent, making the texture features of the ground film more obvious.
[0021] Apply the Laplacian operator of the image function to the processed image, where is the second-order partial derivative of the function f(x,y) with respect to x, It is the partial derivative of the function f(x,y) with respect to y. The Laplacian operator is the sum of the second-order partial derivatives of the image function f(x,y), which is defined as:
[0022]
[0023] Among them, the discrete form expression suitable for digital image processing is:
[0024]
[0025] The Laplacian operator generated by the above formula is divided into four-domain operators S, four-domain operators and gradients in four directions of the central pixel. This is a 3×3 convolution kernel used to calculate the value of the Laplacian operator:
[0026]
[0027] When the grayscale value of the pixel itself and its neighborhood is the same, the result of the Laplacian operator processing is zero. When the grayscale value of the pixel itself is higher than the grayscale mean of the pixels in its neighborhood, the result of the operation is positive, otherwise it is negative. Therefore, we can determine the edge points of the image through the zero-crossing point between the positive peak and the negative peak.
[0028] As a further solution of the present invention, the histogram equalization technology of data preprocessing has the following specific steps:
[0029] First, calculate the grayscale histogram of the original image and count the number of times each grayscale appears in the image h(r k ), r k represents the kth gray level in the image, k∈{0,1,...,L-1}, where n is the total number of pixels in the image, L is the maximum number of gray levels, k, j are variables, and the normalized histogram p(r k ) is calculated as:
[0030]
[0031] Then the histogram is accumulated to obtain the cumulative distribution function (CDF). The CDF value of each gray level represents the cumulative probability of the gray level and all gray levels below it. The cumulative distribution function C(r k ) is expressed as:
[0032]
[0033] Then construct and apply a new grayscale mapping. According to the normalized CDF value, construct a new grayscale mapping table. The new grayscale mapping table maps the original grayscale to the new grayscale. k Represents the kth gray level after equalization. The new gray level mapping s k It is expressed as:
[0034] s k =(L-1)·C(r k )
[0035] The grayscale value of each pixel in the original image is replaced with the value in the new grayscale mapping table to obtain the equalized image. Finally, the high-resolution image data of agricultural waste mulch obtained by the drone is preprocessed and then cropped to construct a data set, which is divided into a training set, a prediction set, and a validation set for subsequent model training and performance evaluation.
[0036] As a further solution of the present invention: the improvement of the DINO model in step 2 includes introducing the detection heads of FPN and RetinaNet and selecting the k-means clustering method to determine the optimal size and ratio of the anchor frame. Through these improvements, a DINO-HResNet model for small target detection from high-resolution remote sensing images of drones is obtained.
[0037] As a further solution of the present invention, in order to integrate feature information at different levels and improve the accuracy of small target detection, the present invention first introduces FPN into the DINO model. The specific process is as follows:
[0038] The DINO model extracts multi-scale features of the image through the encoder of its backbone network, and then builds a feature pyramid structure between the encoder and decoder of the DINO model. The structure consists of feature layers of different resolutions, and each layer corresponds to objects of different sizes. Through the feature FPN, the features of the low and high layers can be fused. Finally, ensure that the decoder part of the DINO model receives the multi-scale features from the FPN and interacts with the output of the encoder.
[0039] Since the number of positive sample abandoned mulch and negative sample background is quite different, as a further solution of the present invention, the present invention integrates the detection head of RetinaNet to improve the performance of agricultural abandoned mulch detection. The detection head of RetinaNet is the classification subnetwork and the bounding box regression subnetwork. The encoder of the DINO model is responsible for extracting multi-scale features of the image and generating a feature map. The present invention combines the encoder output of the DINO model with the detection head of RetinaNet. The feature map provides rich contextual information, and the detection head uses this information to predict the category and position of the bounding box. The classification subnetwork is parallel to the bounding box regression subnetwork, and the classification subnetwork is responsible for predicting the category probability of the target in each adjusted bounding box. The bounding box regression subnetwork is responsible for adjusting the position of the candidate box to better match the actual mulch edge.
[0040] As a further solution of the present invention, a k-means clustering algorithm is selected to determine the optimal size and proportion of the anchor box. The specific process is as follows:
[0041] First, according to the size distribution of agricultural waste mulch, a set of appropriate anchor box sizes is defined. The basic formula and steps of k-means clustering are as follows:
[0042] First, randomly select k sample points from the data set as the initial clustering centers. For each data point x i , calculate its relationship with each cluster center c j The distance d(x i ,c j ), and assign it to the nearest center:
[0043]
[0044] Where D is the dimension of the data, x id It is point x i The value in the dth dimension, c jd is the center c j The value in the dth dimension. Then update the cluster center. For each cluster j, calculate the average value of all points assigned to the cluster and update the average value as the new cluster center c j :
[0045]
[0046] N j is the number of points assigned to cluster j, S j is the set of all points in cluster j. Finally, repeat the above steps until the cluster center no longer changes significantly.
[0047] Finally, a set of defined anchor boxes are generated at each feature point. These anchor boxes will cover different sizes and aspect ratios according to their sizes and shapes to better capture objects of different sizes and achieve multi-scale prediction.
[0048] As a further solution of the present invention: the key to the training process of the model in step 3 mainly includes two steps: adjustment of the loss function and configuration of hyperparameters.
[0049] As a further solution of the present invention: the loss function selected by this patent is focal loss FocalLoss and improved IoU loss function CloULoss.
[0050] FocalLoss reduces the loss contribution of easy-to-classify samples and focuses on difficult-to-classify samples, thereby improving the overall performance of the model and alleviating the problem of imbalance between positive and negative samples in the present invention. The formula of FocalLoss is as follows:
[0051] Focal loss(pt)=-a t (1-p t ) γ log(p t )
[0052] Where pt is the model's predicted probability for positive samples, at is a balancing factor used to adjust the ratio between the positive and negative sample losses. γ is the adjustment factor, (1-p t ) γ Used to reduce the loss contribution of easily separable samples.
[0053] CIoULoss is an improved IoU loss function that takes into account the overlapping area, center point distance, and aspect ratio between target borders, thus providing more accurate border regression. The calculation formula of CIoULoss is as follows:
[0054]
[0055] where ρ 2 (b,b gt ) is the Euclidean distance between the center points of the predicted box and the true box, c is the diagonal length of the minimum external box between the predicted box and the true box, and a and v are parameters used to measure the consistency of aspect ratio.
[0056] The two loss functions are weighted and combined:
[0057] L=λL Focal +(1-λ)L CIoU
[0058] Where λ is a parameter between 0 and 1 that is used to balance the weights of the two loss functions. FocalRepresents the focal loss FocalLoss, L CIoU Represents the improved IoU loss function CloULoss.
[0059] As a further solution of the present invention, the hyperparameter configuration during the model training process includes determining the initial weights of the parameters and fine-tuning to seek optimal performance.
[0060] As a further solution of the present invention, the prediction and detection results visualization of the DINO-HResNet model in step 4 is specifically achieved by evaluating the trained model on a test set, using a series of evaluation indicators to measure its performance, and then achieving an intuitive display of the results through visualization.
[0061] The present invention is a complete detection method for agricultural waste mulch films, and the selected evaluation indicators are as follows, where TP is correctly predicted as a positive sample, FP is the number of samples incorrectly predicted as positive samples, and FN is the number of missed reports, which is the number of samples that are actually positive but are incorrectly predicted as negative samples. Positive samples refer to agricultural waste mulch films, and negative samples refer to backgrounds.
[0062] Precision: Precision refers to the proportion of positive samples predicted by the model to actually positive samples. The calculation formula is:
[0063]
[0064] Recall: Also known as the true rate, it refers to the proportion of all actual positive samples that are correctly predicted. The calculation formula is:
[0065]
[0066] Mean Squared Error (MSE): The mean squared error measures the average of the squares of the differences between the predicted value and the actual value, and is used to evaluate the accuracy of bounding box regression, where N is the total number of samples and y is i is the actual value, is the predicted value, and the calculation formula is:
[0067]
[0068] F1 Score: The F1 score is the harmonic mean of precision and recall. It takes precision and recall into account. The calculation formula is:
[0069]
[0070] As a further scheme of the present invention, the present invention provides a method for visualizing anchor box prediction to intuitively demonstrate the performance of the model in the task of detecting agricultural waste mulch film. Specifically, the anchor box predicted by the model is first drawn on the test image, where the anchor boxes of positive samples and negative samples are represented by different colors, respectively. The size and aspect ratio of each anchor box are clearly marked on the image. The confidence of the model prediction is displayed by adding numbers or bar graphs in or next to the anchor box, further providing credibility information of the prediction. Finally, a detailed report containing all visualization results and performance evaluation indicators is automatically generated for in-depth analysis and recording.
[0071] Compared with the prior art, the present invention has the following beneficial effects:
[0072] (1) Enhanced small target detection capability: Through FPN, the present invention can generate multi-scale feature maps to effectively capture and represent the features of small target abandoned mulch, especially at high resolution. The fusion mechanism of FPN further enhances the model's sensitivity and detection capability for small targets.
[0073] (2) Alleviating the problem of class imbalance: FocalLoss is specially optimized for the problem of class imbalance. By reducing the weight of easy-to-classify samples and increasing the learning weight of difficult-to-classify samples, the model's ability to identify agricultural waste mulch is effectively improved. In addition, CIoULoss is selected as the bounding box regression loss, which comprehensively considers the position, size, and aspect ratio of the bounding box, which can further improve the prediction accuracy.
[0074] (3) Improve target detection and positioning accuracy: The sub-network combined with the RetinaNet detection head can more accurately predict the bounding box coordinates of the target. At the same time, the model improves detection accuracy by adjusting the size and scale of the anchor box. BRIEF DESCRIPTION OF THE DRAWINGS
[0075] Figure 1 It is the overall flow chart;
[0076] Figure 2 This is a schematic diagram of multi-scale feature fusion of feature pyramid FPN;
[0077] Figure 3 This is a schematic diagram of the detection head classification and bounding box sub-network of RetinaNet;
[0078] Figure 4 This is a schematic diagram of the internal operation of the classification and border sub-network convolution;
[0079] Figure 5 This is the overall model diagram of the built DINO-HResNet model. DETAILED DESCRIPTION
[0080] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiment is only a theoretical embodiment of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0081] See also Figure 1-5 , an intelligent detection method for abandoned agricultural mulch film from UAV remote sensing images. Firstly, data collection and preprocessing of abandoned agricultural mulch film images are carried out to enhance the distinction between mulch film and background in the image; secondly, an improved DINO-HResNet model is constructed. This model optimizes the ability of DINO model to detect small target objects from high-resolution remote sensing images by introducing feature pyramid network and RetinaNet detection head; then, training is carried out based on the improved model, using FocalLoss and CIoULoss as loss functions to solve the problem of sample class imbalance and improve the model's ability to locate samples; finally, the prediction and detection results of the model are visualized.
[0082] The specific method is as follows:
[0083] Step 1: Data collection and preprocessing of agricultural waste mulch film images;
[0084] Data collection: First, operators need to conduct a comprehensive environmental survey of the farmland area. First, collect detailed information on the surrounding terrain and landforms. Then set the drone's route and flight parameters, and then set the drone's flight altitude, shooting angle, aerial photography speed, and image acquisition frequency. Finally, the operator monitors the images captured by the drone in real time through the ground station and synchronizes the data after the flight.
[0085] The edge detection algorithm for data preprocessing uses the Laplacian operator, and a low-pass filter needs to be applied first to remove image noise. The mathematical expression of the Gaussian low-pass filter is as follows:
[0086]
[0087] In discrete form, for each pixel I(i,j) in the image, the value I'(i,j) after Gaussian low-pass filtering can be calculated as follows:
[0088]
[0089] The summation is performed over the entire image space, but in applications, only a small range around the Gaussian kernel is usually considered. The Laplacian operator of the image function is then applied to the processed image, which is defined as:
[0090]
[0091] The discrete form of expression suitable for digital image processing is:
[0092]
[0093] The Laplacian operator generated by the above formula is divided into four-domain operators. The four-domain operators and the gradients in four directions of the central pixel are defined as follows:
[0094]
[0095] When the grayscale values of the pixel itself and its neighborhood are the same, the result of the Laplacian operator processing is zero. When the grayscale value of the pixel itself is higher than the grayscale mean of the pixels in its neighborhood, the result of the operation is a positive number, otherwise it is a negative number.
[0096] Then apply the histogram equalization technology. The specific steps are as follows:
[0097] Calculate the grayscale histogram of the original image and count the number of times each grayscale appears in the image h(r k ), r k represents the kth gray level in the image, k∈{0,1,...,L-1}, the normalized histogram p(r k ) is calculated as:
[0098]
[0099] The histogram is accumulated to obtain the cumulative distribution function (CDF). The CDF value of each gray level represents the cumulative probability of the gray level and all gray levels below it. The cumulative distribution function C(r k ) is expressed as:
[0100]
[0101] Construct and apply a new grayscale mapping. According to the normalized CDF value, construct a new grayscale mapping table. The new grayscale mapping table maps the original grayscale to the new grayscale. k It is expressed as:
[0102] s k =(L-1)·C(r k )
[0103] The grayscale value of each pixel in the original image is replaced by the value in the new grayscale mapping table to obtain the equalized image.
[0104] Finally, the processed images are cropped, the data set is constructed, and divided into training set, prediction set and validation set for subsequent model training and performance evaluation.
[0105] Step 2: Improve the construction of the DINO-HResNet model;
[0106] First, FPN is introduced into the DINO model, such as Figure 2 The feature fusion process of FPN is as follows:
[0107] First, a feature pyramid structure is constructed between the encoder and decoder of the DINO model. The DINO model extracts multi-scale features of the image through the encoder of its backbone network to generate a series of feature maps C2, C3, and C4 with gradually decreasing spatial resolution but increasing number of channels. These feature maps represent the semantic information of the image at different levels. Then, in the FPN feature fusion layer, the high-level feature maps of the backbone network receive information from the low-level feature maps through lateral connections. Through the upsampling operation, the spatial resolution of the low-level feature maps is increased to match the resolution of the high-level feature maps. Then, a 1x1 convolution operation is used to adjust the number of channels of the upsampled feature maps to ensure that they can be fused with the high-level feature maps. The fusion operation combines feature information from different levels to generate multi-scale feature maps P2, P3, and P4, which contain rich details and contextual information.
[0108] Since the number of positive sample abandoned mulch films and negative sample background is quite different, the present invention then integrates the detection head of RetinaNet to improve the performance of agricultural abandoned mulch film detection, such as Figure 3 As shown in Figure 1, the detection head of RetinaNet is the classification subnetwork and the bounding box regression subnetwork. The classification subnetwork predicts the class probability of each object in the adjusted bounding box. It passes through a series of convolutional layers such as Figure 4 As shown in the figure, the network first performs 4 3x3 convolution operations with a convolution kernel of 256, and each convolution is followed by a ReLU activation function. Finally, a 3x3 convolution operation with a convolution kernel of K×A is performed, where K is the target category, which is 1 here, and A is the number of anchor boxes obtained. Finally, the probability of each bounding box belonging to abandoned ground film is output.
[0109] The bounding box regression subnetwork focuses on adjusting the position of the candidate box to achieve a more accurate match with the actual edge of the ground film. Similarly, it also achieves this function through a series of convolutional layers and outputs the adjusted offset of the bounding box. The overall model after combining the DINO model with the RetinaNet detection head is shown in the figure below: Figure 5 As shown in the figure, the multi-scale feature map provided by the DINO model is rich in contextual information of the target, and the detection head uses this information to predict the category and position of the bounding box, thereby improving the accuracy of detection.
[0110] Finally, the k-means clustering algorithm is selected to determine the optimal size and ratio of the anchor box. The specific process is as follows:
[0111] First, according to the size distribution of agricultural waste mulch, a set of appropriate anchor box sizes is defined. The basic formula and steps of k-means clustering are as follows:
[0112] First, randomly select k sample points from the data set as the initial clustering centers. For each data point x i , calculate its relationship with each cluster center c j The distance d(x i ,c j ), and assign it to the nearest center:
[0113]
[0114] Next, update the cluster center. For each cluster j, calculate the average value of all points assigned to the cluster and update the average value as the new cluster center c. j :
[0115]
[0116] Repeat the above steps until the cluster center no longer changes significantly.
[0117] Finally, a set of defined anchor boxes are generated at each feature point. These anchor boxes will cover different sizes and aspect ratios according to their sizes and shapes to better capture objects of different sizes and achieve multi-scale prediction.
[0118] Step 3: Training based on the DINO-HResNet model;
[0119] First, adjust the loss function: the loss function selected by the present invention is the focal loss FocalLoss and the improved IoU loss function CloULoss. The formula of FocalLoss is as follows:
[0120] Focal loss(pt)=-a t (1-p t ) γ log(p t )
[0121] CIoULoss is an improved IoU loss function. The calculation formula of CIoULoss is as follows:
[0122]
[0123] The two loss functions are weighted and combined:
[0124] L=λL Focal +(1-λ)L CIoU
[0125] The hyperparameter configuration during the model training process includes determining the initial weights of the parameters and fine-tuning to optimize the performance. Unsupervised pre-training can be performed on a large-scale data set before being transferred to the detection task of agricultural waste mulch. The learning rate can be set to 1e-4 in the unsupervised pre-training stage and 1e-6 in the transfer learning stage; the AdamW optimizer suitable for unsupervised learning can be selected to adapt the weight of the learning rate. In addition, the training cycle, batch size, etc. should be set according to the actual task.
[0126] Step 4: Visualize the prediction and detection results of the DINO-HResNet model.
[0127] The trained model is evaluated on the test set, and a series of evaluation indicators are used to measure its performance, and then the results are intuitively displayed through visualization.
[0128] The evaluation indicators used in the present invention are as follows:
[0129] Precision: Precision refers to the proportion of positive samples predicted by the model to actually positive samples. The calculation formula is:
[0130]
[0131] Recall: Also known as the true rate, it refers to the proportion of all actual positive samples that are correctly predicted. The calculation formula is:
[0132]
[0133] Mean Squared Error (MSE): The mean squared error measures the average of the squares of the differences between the predicted value and the actual value. It is used to evaluate the accuracy of bounding box regression. The calculation formula is:
[0134]
[0135] F1 Score: F1 score is the harmonic mean of precision and recall. It takes precision and recall into consideration. The calculation formula is:
[0136]
[0137] In order to intuitively demonstrate the performance of the model in the agricultural waste mulch film detection task, a method of visualizing anchor box prediction is used. Specifically, the anchor boxes predicted by the model are first drawn on the test image, where the anchor boxes of positive samples and negative samples are represented by different colors. The size and aspect ratio of each anchor box are clearly marked on the image. The confidence of the model prediction is displayed by adding numbers or bar graphs in or next to the anchor box to further provide information on the credibility of the prediction. Finally, a detailed report containing all visualization results and performance evaluation indicators is automatically generated for in-depth analysis and records.
[0138] The above description is only an illustration of the principles used in the present invention. It is obvious to those skilled in the art that the present invention is not limited to the details of the above implementation, and the present invention can be implemented in other ways without departing from the concept of the present invention. Therefore, no matter from which point of view, the embodiments should be regarded as exemplary and non-restrictive.
Claims
1. An intelligent detection method for agricultural waste mulch film based on UAV remote sensing images, characterized in that: The following steps are involved: Step 1: Data collection and preprocessing of agricultural waste mulch film images; Step 2: Improve the construction of the DINO-HResNet model; Step 3: Training based on the DINO-HResNet model; Step 4: Visualize the prediction and detection results of the DINO-HResNet model; Step 2 improves the DINO model by introducing the FPN and RetinaNet detection heads and selecting the k-means clustering method to determine the optimal size and ratio of the anchor box; Combined with FPN: The DINO model extracts multi-scale features of the image through the encoder of its backbone network, then builds a feature pyramid structure between the encoder and decoder of the DINO model, and fuses low-level and high-level features through FPN. Finally, ensure that the decoder part of the DINO model receives the multi-scale features from FPN and interacts with the output of the encoder; Combined with the detection head of RetinaNet: The encoder of the DINO model is responsible for extracting multi-scale features of the image and generating feature maps. The encoder output of the DINO model is combined with the detection head of RetinaNet. The feature maps provide rich contextual information, and the detection head uses this information to predict the category and position of the bounding box. The classification subnetwork and the bounding box regression subnetwork are parallel. The classification subnetwork is responsible for predicting the category probability of the object in each adjusted bounding box, and the bounding box regression subnetwork is responsible for adjusting the position of the candidate box to better match the actual edge of the mulch film; Select the k-means clustering algorithm to determine the optimal size and ratio of the anchor boxes: First, according to the size distribution of agricultural waste mulch, a set of appropriate anchor frame sizes is defined. The basic formula and calculation steps of k-means clustering are as follows: First randomly select from the data set k Sample points are used as the initial cluster centers. For each data point , calculate its relationship with each cluster center The distance between , and assign it to the nearest center: in D is the dimension of the data, Yes In the d The value of the dimension, Is the center In the d The value of the dimension, then update the cluster center, for each cluster j , calculate the average value of all points assigned to the cluster and update the average value as the new cluster center : N j is assigned to the cluster j The number of points, S j It is clustering j Finally, repeat the above steps until the cluster center no longer changes significantly, and finally generate a defined anchor box set at each feature point; The model training process in step 3 mainly includes two steps: adjustment of loss function and configuration of hyperparameters; The adjustment process of the loss function is: First, choose the focal loss Focal Loss and improved IoU Loss Function CloU Loss , Focal Loss The formula is as follows: in pt is the model’s predicted probability for positive samples, at Is a balancing factor used to adjust the ratio between the positive and negative sample losses. is the regulating factor, Used to reduce the loss contribution of easily divisible samples; CIoU Loss It is an improved IoU Loss function, CIoU Loss The calculation formula is as follows: is the Euclidean distance between the center point of the predicted box and the true box, is the diagonal length of the minimum external box between the predicted box and the real box, and is a parameter used to measure aspect ratio consistency; The two loss functions are weighted and combined: is a parameter between 0 and 1 that is used to balance the weights of the two loss functions. Represents focal loss Focal Loss , Represents the loss function CloU Loss .
2. According to claim 1, a method for intelligent detection of agricultural waste mulch based on UAV remote sensing images is characterized in that: The specific process of data collection described in step 1 is as follows: first, the operator conducts a comprehensive environmental survey of the farmland area and collects detailed information on the surrounding terrain and landforms; then sets the flight altitude, shooting angle, aerial photography speed and image acquisition frequency of the drone; finally, the operator monitors the images captured by the drone in real time through the ground station and synchronizes the data after the flight.
3. According to claim 1, a method for intelligent detection of agricultural waste mulch based on UAV remote sensing images is characterized in that: The preprocessing step in step 1 includes firstly applying an edge detection algorithm to highlight the features of the edge of the agricultural mulch film, and then applying a histogram equalization method to adjust the contrast and brightness of the image to enhance the distinction between the mulch film and the background in the image; The edge detection algorithm selects the Laplacian operator and first applies low-pass filtering to remove image noise. The calculation formula of the Gaussian low-pass filter is: represents the Gaussian function, is the standard deviation of the Gaussian kernel, Represents the coordinates in image space. In discrete form, for each pixel in the image , m and n is an integer representing the center of the Gaussian kernel relative to the current processing pixel The horizontal and vertical offsets after Gaussian low-pass filtering Calculated by: Apply the Laplacian operator of the image function to the processed image, where is a function Relative to x The second-order partial derivative of is a function Compared to y The partial derivative of the Laplacian operator is the image function The sum of the second-order partial derivatives of is defined as: The discrete form of expression suitable for digital image processing is: The Laplacian operator generated by the above formula is divided into four domain operators: S , four-domain operators and gradients in four directions of the central pixel. This is a 3×3 convolution kernel used to calculate the value of the Laplacian operator: When the grayscale value of the pixel itself and its neighborhood is the same, the result of the Laplacian operator processing is zero. When the grayscale value of the pixel itself is higher than the grayscale mean of the pixels in its neighborhood, the result of the operation is a positive number, otherwise it is a negative number. Histogram equalization technology, the specific steps are as follows: First calculate the grayscale histogram of the original image and count the number of times each grayscale appears in the image , For the image Gray levels, ,in is the total number of pixels in the image, L is the maximum number of gray levels , k, j For variables, normalized histogram The calculation is expressed as: The histogram is accumulated to obtain the cumulative distribution function (CDF). The CDF value of each gray level represents the cumulative probability of the gray level and all gray levels below it. It is expressed as: Construct and apply a new grayscale mapping. According to the normalized CDF value, construct a new grayscale mapping table. The new grayscale mapping table maps the original grayscale to the new grayscale. Represents the equalized Gray levels, new gray level mapping It is expressed as: The grayscale value of each pixel in the original image is replaced with the value in the new grayscale mapping table to obtain the equalized image. The preprocessed high-resolution image data of agricultural waste mulch is then cropped to construct a data set and divided into training set, prediction set and validation set.
4. According to claim 1, a method for intelligent detection of agricultural waste mulch based on UAV remote sensing images, characterized in that: In step 4, the trained DINO-HResNet model is evaluated on the test set to perform predictions and visualize the results, and evaluation indicators are used to measure its performance, and then the results are intuitively displayed through visualization.
Citation Information
Patent Citations
High-resolution remote sensing image target detection method of M-F-Y type lightweight convolutional neural network
CN111666836A
Remote sensing image target detection parallel training method based on communication optimization
CN117994662A