Farmland carrier and lightweight field crop segmentation method, device and storage medium thereof

By constructing a dual-channel semantic segmentation model and optimizing the Segnext-Resnet101 and Segnext-Resnet18 networks through quantization training, the accuracy and efficiency issues of field straw coverage detection were solved, achieving lightweight and efficient straw coverage measurement.

CN122244662APending Publication Date: 2026-06-19CHINESE ACAD OF AGRI MECHANIZATION SCI GRP CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
CHINESE ACAD OF AGRI MECHANIZATION SCI GRP CO LTD
Filing Date
2024-12-18
Publication Date
2026-06-19

AI Technical Summary

Technical Problem

Existing technologies for detecting straw in the field suffer from problems such as high detection difficulty, low robustness, high computational complexity, large computer memory consumption, and slow recognition speed. In particular, the accuracy of straw coverage measurement is insufficient in complex field scenarios.

Method used

A dual-channel semantic segmentation model is constructed. The knowledge transfer and quantitative training of the student model are guided by the teacher model. Combined with data augmentation and background interference training, the Segnext-Resnet101 and Segnext-Resnet18 networks are optimized to achieve lightweight and efficient straw coverage detection.

Benefits of technology

It achieves high-precision, low-error detection of straw coverage in complex field scenarios. The model is lightweight and stable, and meets the hardware requirements of edge monitoring platforms.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122244662A_ABST
    Figure CN122244662A_ABST
Patent Text Reader

Abstract

A farmland vehicle and its lightweight field crop segmentation method, apparatus, and storage medium are disclosed. The farmland vehicle includes a lightweight field crop segmentation device, which stores a storage medium for implementing the lightweight field crop segmentation method. The method includes constructing a dual-channel semantic segmentation model, whose network structure includes a teacher model and a student model, with each channel including an encoding module and a decoding module; training the student model by mimicking the output distribution of the teacher model to obtain a lightweight and efficient model; performing quantization calculations on the model, converting floating-point numbers to low-bit-width integer representations to reduce the precision of model parameters and activation functions; pre-training the model, calculating the loss function, and retaining the optimal parameters; constructing a dataset by adjusting brightness, contrast, flipping, and noise to augment the original training data; and adding background interference including exposure, ruts, shadows, soil clumps, and ditches, and retraining the model to obtain the final model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of agricultural field crop image processing technology, and in particular to a field crop image segmentation method, apparatus, storage medium, and farmland vehicle based on an image semantic segmentation model. Background Technology

[0002] Conservation tillage is an important means to reduce soil erosion, improve soil fertility, and promote cost-effectiveness and sustainable development in agriculture. With the development of modern agriculture, conservation tillage for staple crops has been largely mechanized. However, the quality of mechanized operations varies greatly, requiring manual field verification, which is time-consuming, labor-intensive, and lacks objective data support, becoming a bottleneck restricting the promotion and development of conservation tillage. Straw return to the field is a widely adopted conservation tillage technique with multiple benefits, including preventing air pollution, increasing soil fertility, and reducing soil erosion, positively impacting agricultural production and the ecological environment. Straw coverage rate is a direct indicator for evaluating the degree of straw return to the field. Accurate straw coverage rate measurement plays a significant role in the development of smart agriculture and the promotion of conservation tillage techniques.

[0003] The unstructured and fragmented nature of straw in fields, coupled with factors such as light, shadow, and tire tracks, increases the difficulty of straw detection. Common computer vision methods include using automatic thresholding algorithms (an image processing technique used to convert grayscale images into binary images, i.e., black and white images. This algorithm automatically determines one or more thresholds to distinguish different regions in an image. When the grayscale value of a pixel is higher than the set threshold, the pixel is marked as white (or 1), and vice versa. Automatic thresholding algorithms can reduce human intervention and improve processing efficiency and accuracy in applications such as image segmentation and feature extraction. Common automatic thresholding algorithms include the Otsu method and the maximum entropy method) to segment straw images, performing a first identification of straw images through Fourier transform followed by a second identification using a support vector machine classifier. However, these methods have certain limitations. They are easily affected by light intensity noise, are not suitable for processing large-scale samples, require the extraction of specific features, and lack robustness in complex field scenarios. Straw recognition algorithms based on semantic segmentation models (a deep learning technique primarily used in computer vision. This model can classify each pixel in an image into different categories, achieving a fine understanding of the image content. Unlike object detection, semantic segmentation not only needs to identify what objects are in the image, but also needs to determine the specific location and range of these objects in the image, i.e., assigning a label to each pixel to indicate which category it belongs to) often suffer from redundancy in feature recognition. This not only increases the complexity of the model and consumes a lot of computer memory, but also slows down the recognition speed, and the edge processing cannot adapt to the needs of straw detection. Summary of the Invention

[0004] The technical problem to be solved by the present invention is to address the above-mentioned deficiencies of the prior art by providing a farmland vehicle and a lightweight method, device and storage medium for crop splitting in the field.

[0005] To achieve the above objectives, the present invention provides a lightweight field crop segmentation method, comprising the following steps:

[0006] S100. Construct a dual-channel semantic segmentation model. The network structure of the dual-channel semantic segmentation model includes a teacher model and a student model. Both channels include an encoding module and a decoding module.

[0007] S200, dual-channel semantic model knowledge transfer, by training the student model by imitating the output distribution of the teacher model, to obtain a lightweight and efficient model;

[0008] S300. Quantize the lightweight and efficient model to convert the floating-point number into a low-bit-width integer representation, thereby reducing the precision of the model parameters and activation function.

[0009] S400. Pre-train the lightweight and efficient model, calculate the loss function, and retain the optimal parameters;

[0010] S500, constructing the dataset by augmenting the original training data through adjustments to brightness, contrast, flipping, and noise; and

[0011] S600, adding background interference including exposure, ruts, shadows, soil clumps and ditches, retraining the lightweight and efficient model to obtain the final model QSR101-18 with higher stability and accuracy.

[0012] In the aforementioned lightweight field crop segmentation method, during the training process in step S200, the gap between the student model and the true label is minimized, and the output probability distribution of the teacher model on the training data is made as close as possible to the teacher model, thereby obtaining the lightweight and efficient model.

[0013] The aforementioned lightweight field crop segmentation method uses Segnext-Resnet101 to guide the learning of Segnext-Resnet18. The training process further includes:

[0014] S201, Initialize parameters;

[0015] S202. Train the Segnext-Resnet101 model as the teacher model and save the optimal weights;

[0016] S203. Generate soft labels: The Segnext-Resnet101 model performs forward propagation on the training set to generate soft labels for each sample, and uses temperature parameters to smooth the output probabilities.

[0017] S204. The student model is Segnext-Resnet18, and the Segnext-Resnet18 model loads the best weights of the Segnext-Resnet101 model as the initial weights during training.

[0018] S205. Calculate the loss function, including the cross-entropy loss function and the distillation loss function. The cross-entropy loss function is used to measure the difference between the output of the Segnext-Resnet18 model and the true label. The distillation loss function is used to measure the difference between the output of the Segnext-Resnet18 model and the soft label of the Segnext-Resnet101 model. By jointly optimizing the cross-entropy loss function and the distillation loss function, the Segnext-Resnet18 model can learn the generalization ability of the Segnext-Resnet101 model while maintaining prediction accuracy.

[0019] S206. Adjust the temperature parameters; during the distillation process, use dynamic linear temperature parameter settings to smooth the soft label; and

[0020] S207. End training and save the best model as SR101-18.

[0021] The aforementioned lightweight field crop segmentation method, in step S300, employs Quantization-Aware Training (QAT) for quantization training, passes the quantization loss to the model's loss function, and the optimizer optimizes the loss value based on the training process to obtain the optimized model, thereby achieving the quantization of model parameters. This further includes:

[0022] S301. Load and save the weights SR101-18 as pre-training weights, and introduce the simulation of quantization operations during the training process;

[0023] S302, Forward Propagation: Insert pseudo-quantization nodes during model training to calculate the maximum and minimum values ​​of the input data distribution.

[0024] S303, Quantization parameters are calculated as: clamp(x,x) min ,x max := min(max(x,x) min ),x max );

[0025] S304, Quantization: FP32→INT8;

[0026] S305, Backward propagation: δ out =δ in ,I x ∈S,(x min <x<x max );as well as

[0027] S306, Update x min ,x max ;

[0028] Where x is the input, x max For the maximum pseudo-quantized node, x min For minimum value pseudo-quantization nodes, FP32-INT8 converts a 32-bit floating-point character to an 8-bit integer character, δ out =δ in ,I x ∈S,(x min <x<x max ) represents a direct connecting device, and S represents the range of the connecting device.

[0029] The aforementioned lightweight field crop segmentation method, in S400, has 40,000 training iterations, and uses the cross-entropy loss function for loss calculation.

[0030] Where n is the number of pixels, i is the pixel position, y is the true value, and a is the predicted probability. The training loss result is saved once every 10 iterations, and the best model is saved once every 1000 tests.

[0031] In the aforementioned lightweight field crop segmentation method, in step S400, the decay strategy is Consine, the batch size is set to 16, and the formula for Consine is:

[0032]

[0033] In the formula, lr is the current learning rate, initial_lr is the initial learning rate, T is the total number of iterations, and t is the current number of iterations.

[0034] In the aforementioned lightweight field crop segmentation method, in S500, the brightness and contrast amplification data are randomly selected within the range of (0.8, 1.2), and the original image is multiplied by this value to obtain the amplified image; the original image is rotated by 90 degrees and 180 degrees to achieve a flip amplification of 2 times; Gaussian noise is added at random positions with a value of 0.001; the data is distributed using a load balancing algorithm before being put into the lightweight and efficient model; after normalizing the RGB data of the image, it is input into the trained dual-channel semantic segmentation model to predict the masks corresponding to the two categories of straw and non-straw in the image.

[0035] To better achieve the above objectives, the present invention also provides a lightweight field crop segmentation device, which includes a fuzzy neural network controller. The fuzzy neural network controller is used to construct a dual-channel semantic segmentation model. Both channels of the dual-channel semantic segmentation model include an encoding module and a decoding module, and the above-mentioned lightweight field crop segmentation method is used to detect the field straw coverage rate.

[0036] To better achieve the above objectives, the present invention also provides a farmland vehicle, including a chassis and a vehicle body, a vehicle control device, and an image acquisition device mounted on the chassis. The vehicle control device includes the aforementioned lightweight field crop segmentation device. The front-facing camera of the image acquisition device captures images of crops in front and uploads them to the lightweight field crop segmentation device via a data transmission module to detect the straw coverage rate in the field.

[0037] To better achieve the above objectives, the present invention also provides a storage medium storing a computer program configured to execute the above-described lightweight field crop segmentation method during runtime.

[0038] The technical effects of this invention are as follows:

[0039] This invention acquires straw images through a vehicle-mounted terminal platform and constructs a dataset through data augmentation. SegNext is selected as the base model for optimization, and a dual-channel semantic segmentation model and knowledge transfer method are constructed. ResNet101 is used as the teacher model with the backbone layer, and ResNet18 is used as the student model for training. The straw feature extraction capability is increased by improving the backbone network, and knowledge transfer and quantization methods are integrated to achieve model lightweighting. The final model maintains straw detection accuracy even in complex scenarios. QAT quantization is used to further lighten the overall model structure. Retraining is performed under multi-factor field scenarios, resulting in a lightweight, low-error, stable, and highly accurate QSR101-18 model. This solves the problem of difficult straw cover detection caused by unstructured, fragmented straw and environmental factors, and meets the detection requirements of edge monitoring platforms for field straw cover.

[0040] The present invention will be described in detail below with reference to the accompanying drawings and specific embodiments, but this is not intended to limit the present invention. Attached Figure Description

[0041] Figure 1 This is a schematic diagram illustrating the working principle of an embodiment of the present invention;

[0042] Figure 2 This is a schematic diagram of the knowledge transfer process of a dual-channel semantic model according to an embodiment of the present invention;

[0043] Figure 3 This is a schematic diagram of model quantization according to an embodiment of the present invention;

[0044] Figure 4 This is a schematic diagram of a farmland vehicle structure according to an embodiment of the present invention;

[0045] Figure 5 This is a schematic diagram illustrating the working principle of a storage medium according to an embodiment of the present invention;

[0046] Figure 6 This is a schematic diagram of the detection results according to an embodiment of the present invention.

[0047] Among them, the attached figures are labeled

[0048] 1 Chassis

[0049] 2 body

[0050] 3 Image Acquisition Device

[0051] 4 Vehicle control devices

[0052] S100-S600 Steps Detailed Implementation

[0053] The structural and working principles of the present invention will be described in detail below with reference to the accompanying drawings:

[0054] See Figures 1-3 , Figure 1 This is a schematic diagram illustrating the working principle of an embodiment of the present invention. Figure 2 This is a schematic diagram of the knowledge transfer process of a dual-channel semantic model according to an embodiment of the present invention. Figure 3 This is a schematic diagram of model quantization according to an embodiment of the present invention. The lightweight field crop segmentation method of the present invention includes the following steps:

[0055] Step S100: Construct a dual-channel semantic segmentation model. The network structure of the dual-channel semantic segmentation model includes a teacher model and a student model. That is, the network structure of the model contains two inputs, namely a complex and expressive Segnext-Resnet101 model and a simpler and more computationally efficient Segnext-Resnet18 model. Both channels include an encoding module and a decoding module.

[0056] Step S200: Dual-channel semantic model knowledge transfer. The student model is trained by mimicking the output distribution of the teacher model to obtain a lightweight and efficient model. During training, the gap between the student model and the true labels is minimized, and the output probability distribution of the teacher model on the training data is made as close as possible to obtain the lightweight and efficient model. Segnext-Resnet101 is used to guide Segnext-Resnet18 learning. The training process further includes:

[0057] Step S201: Initialize parameters;

[0058] Step S202: Train the Segnext-Resnet101 model as the teacher model and save the optimal weights;

[0059] Step S203: Generate soft labels. The Segnext-Resnet101 model performs forward propagation on the training set to generate soft labels for each sample, and uses temperature parameters to smooth the output probabilities.

[0060] Step S204: The student model is Segnext-Resnet18, and the Segnext-Resnet18 model loads the best weights of the Segnext-Resnet101 model as the initial weights during training.

[0061] Step S205: Calculate the loss function, including the cross-entropy loss function and the distillation loss function. The cross-entropy loss function is used to measure the difference between the output of the Segnext-Resnet18 model and the true label. The distillation loss function is used to measure the difference between the output of the Segnext-Resnet18 model and the soft label of the Segnext-Resnet101 model. By jointly optimizing the cross-entropy loss function and the distillation loss function, the Segnext-Resnet18 model can learn the generalization ability of the Segnext-Resnet101 model while maintaining prediction accuracy.

[0062] Step S206: Adjust the temperature parameters. During the distillation process, use a dynamic linear setting of the temperature parameters to smooth the soft label; and

[0063] Step S207: End training and save the best model as SR101-18.

[0064] Step S300: Quantize the lightweight and efficient model. To reduce the model's memory usage and computation time, quantization is performed on the model to convert floating-point numbers into low-bit-width integer representations, reducing the precision of model parameters and activation functions. Quantization training is performed using Quantization-Aware Training (QAT), where the quantization loss is passed to the model's loss function. The optimizer optimizes the loss value based on the training process to obtain the optimized model, thus achieving the quantization of model parameters. Further steps include:

[0065] Step S301: Load and save weights SR101-18 as pre-training weights, and introduce simulation of quantization operations during training;

[0066] Step S302, Forward Propagation: Insert pseudo-quantization nodes during model training to calculate the maximum value Max and minimum value Min pseudo-quantization nodes of the input data distribution;

[0067] Step S303, the quantization parameter is calculated as: clamp(x, x min ,x max := min(max(x,x) min ),x max );

[0068] Step S304, Quantization: FP32 → INT8;

[0069] Step S305, Backpropagation: δ out =δ in ,I x ∈S,(x min <x<x max );as well as

[0070] Step S306, Update x min ,x max ;

[0071] Where x is the input, x max For the maximum pseudo-quantized node, x min For minimum value pseudo-quantization nodes, FP32-INT8 converts a 32-bit floating-point character to an 8-bit integer character, δ out =δ in ,I x ∈S,(x min <x<x max ) represents a directly connected communicating vessel, and S represents the range of the communicating vessel.

[0072] Step S400: Pre-train the lightweight and efficient model, calculate the loss function, and retain the optimal parameters; wherein, the preferred number of training iterations is 40,000, and the cross-entropy loss function is selected for loss calculation.

[0073] Where n is the number of pixels, i is the pixel position, y is the true value, and a is the predicted probability. The training loss result is saved once every 10 iterations, and the best model is saved once every 1000 tests.

[0074] The preferred attenuation strategy is Consine, and the preferred batch size is 16. The formula for Consine is:

[0075]

[0076] In the formula, lr is the current learning rate, initial_lr is the initial learning rate, T is the total number of iterations, t is the current number of iterations, the training loss result is saved once every 10 iterations, and the best model is saved once every 1000 tests; in addition, in order to balance the efficiency of model training and the use of computing resources, the batch size is set to 16.

[0077] Step S500: Construct a dataset. To increase data diversity and improve the generalization ability of the training data to the model, the training data is augmented by adjusting brightness, contrast, flipping, and noise to augment the original training data by 7 times. Specifically, the brightness and contrast augmentation values ​​are randomly selected within the range (0.8, 1.2), and the original image is multiplied by this value to obtain the augmented image. The original image is rotated 90 degrees and 180 degrees to achieve a 2-fold augmentation by flipping. Gaussian noise is added at random positions with a value of 0.001. The data is distributed using a load balancing algorithm before being fed into the lightweight and efficient model. After normalizing the RGB data of the image, it is input into the trained dual-channel semantic segmentation model to predict the masks corresponding to the straw and non-straw categories in the image.

[0078] Step S600: Add five background disturbances, including exposure, ruts, shadows, soil clumps and ditches, and retrain the lightweight and efficient model to improve model stability and obtain the final model QSR101-18 with higher stability and accuracy.

[0079] Furthermore, this invention also provides a lightweight field crop segmentation device, including a fuzzy neural network controller. The fuzzy neural network controller is used to construct a dual-channel semantic segmentation model. Each channel of the dual-channel semantic segmentation model includes an encoding module and a decoding module, and the aforementioned lightweight field crop segmentation method is used for field straw mulch detection. It should be noted that this device is used for action execution, and its functions can be implemented by several modules or units. In fact, according to embodiments of this invention, the features and functions of two or more modules or units can be specified in one module or unit. Conversely, the features and functions of one module or unit can be further divided and specified by multiple modules or units.

[0080] See Figure 4 , Figure 4 This is a schematic diagram of a farmland vehicle structure according to an embodiment of the present invention. The farmland vehicle of the present invention includes a chassis 1 and a vehicle body 2, a vehicle control device 4, and an image acquisition device 3 mounted on the chassis 1. The vehicle control device 4 includes the aforementioned lightweight field crop segmentation device. The front-facing camera of the image acquisition device 3 captures images of crops in front and uploads them to the lightweight field crop segmentation device via a data transmission module for field straw mulch detection. The working process of the lightweight field crop segmentation device is as follows:

[0081] First, knowledge transfer and training of the dual-channel semantic segmentation model. The student model is trained by mimicking the output distribution of the teacher model. During training, the student model not only attempts to minimize the gap between itself and the true labels, but also tries to approximate the soft labels (soft targets) of the teacher model as closely as possible. Soft labels are the output probability distribution of the teacher model on the training data. Compared to hard labels, i.e., true labels, soft labels contain more information, such as inter-class relationships and uncertainties.

[0082] To obtain a more efficient straw coverage segmentation model, Segnext-Resnet101 (SR-101) was used to guide the learning of Segnext-Resnet18 (SR-18), resulting in a lightweight and efficient model. The lightweight and efficient model obtained in this embodiment is "QSR101-18". During model pre-training, the model was trained 40,000 times. Training ended when all iterations were completed, and the optimal weights from the 40,000 iterations were saved as the optimal model weights.

[0083] The training process is as follows:

[0084] a) Initialize parameters;

[0085] b) Train SR-101 as a teacher model and save the optimal weights;

[0086] c) Soft label generation: The SR-101 model performs forward propagation on the training set to generate soft labels for each sample. In order to increase the information content of the soft labels, the output probability is smoothed using a temperature parameter to generate a smoother probability distribution.

[0087] d) Training of the student model: The SR-18 model is trained by loading the optimal weights from S-R101 as initial weights;

[0088] e) Loss calculation: The loss function consists of two parts: one part is the cross-entropy loss, which measures the difference between the output of the SR-18 model and the true label; the other part is the distillation loss, which measures the difference between the output of the SR-18 model and the soft label of the SR-101 model. By jointly optimizing these two losses, the SR-18 model can learn the generalization ability of the SR-101 model while maintaining prediction accuracy.

[0089] f) Temperature parameter adjustment: During distillation, a dynamic linear setting of the temperature parameter is used to smooth the soft labels. Higher temperature values ​​produce smoother soft labels, but may cause the SR-18 model to learn overly vague information; lower temperature values ​​make the soft labels closer to hard targets. Therefore, a dynamic linear setting is adopted. A linear adjustment is made, where the value of α decreases linearly with the number of iterations, causing T to decrease as well. This makes the SR-18 model focus more on soft labels (i.e., similar to SR-101) in the early stages of training, and more on hard labels (i.e., the difference between the model and the true labels) as the number of iterations increases.

[0090] g) Training ends, save the best model (SR101-18).

[0091] Secondly, model quantization. To reduce the model's memory footprint and computation time, quantization is performed on the aforementioned model "SR101-18," converting floating-point numbers into lower-bit-width integer representations, thus reducing the precision of model parameters and activation functions. The core of quantization training lies in simulating quantization operations during training, enabling the model to adapt to the precision loss caused by quantization and minimizing the resulting performance degradation. Quantization-aware training (QAT), a training method that incorporates the quantization process into the model, is used to improve the model's performance in low-precision environments by simulating quantization operations. This embodiment performs quantization on the SR101-18 model, resulting in a lightweight and efficient model.

[0092] The steps for quantization training using QAT in this embodiment are as follows:

[0093] a) Load and save the weights (SR101-18) as pre-training weights, and introduce the simulation of quantization operations during the training process;

[0094] b) Forward propagation: During model training, fake quantization nodes are inserted to calculate the maximum value (Max) and minimum value (Min) of the input data distribution.

[0095] c) Calculation of quantization parameters: clamp(x,x) min ,x max := min(max(x,x) min ),x max );

[0096] d) Quantization: FP32 → INT8;

[0097] e) Back propagation: δ out =δ in ,I x ∈S,(x min <x<x max ), direct communicating device;

[0098] f) Update x min ,x max .

[0099] Through the above steps, the quantization loss is passed to the loss function of the SR101-18 model. The optimizer optimizes the loss value based on the training process to obtain the optimized model. The optimizer refers to the loss caused by the entire QAT process, which is added to the training process. The SGD (Stochastic Gradient Descent) optimizer optimizes the weights of the training process, reduces the model's loss, and enables the model to converge quickly.

[0100] Next, model pre-training. The training iterations were 40,000, and the cross-entropy loss function was chosen for loss calculation. Where n is the number of pixels, i is the pixel position, y is the true value, and a is the predicted probability. The training loss result is saved every 10 iterations, and the best model is saved every 1000 tests. The decay strategy is consine. Furthermore, to balance the efficiency of model training and the use of computational resources, the batch size is set to 16.

[0101] Next, the dataset is constructed. In this embodiment, the image acquisition device 3 is preferably a YB-DB015A vehicle-mounted camera. The front-facing camera captures images of the straw in front and uploads them to the cloud server via a 4G high-speed data transmission module. The camera image data is packaged and transmitted to the cloud monitoring platform.

[0102] The field environment is complex, with significant differences in surface color. Various factors such as soil clods, tire tracks, ditches, and shadows can interfere with straw identification. Therefore, to improve the adaptability of the model constructed in this paper, the 1068 original images (image size 640×480) selected from the platform included these factors affecting straw identification. The images were manually labeled using LabelMe and randomly divided into a training set (854 images), a validation set (107 images), and a test set (107 images) in an 8:1:1 ratio. To increase data diversity and improve the generalization ability of the training data to the model, the training data was augmented. The original training set data was augmented 7 times by adjusting brightness, contrast, flipping, and noise. Brightness and contrast were augmented by randomly selecting values ​​within the range (0.8, 1.2), and the original image was multiplied by this value to obtain the augmented image. Flipping was achieved by rotating the original image by 90 degrees and 180 degrees to achieve a 2-fold augmentation. Gaussian noise was added at random positions with a value of 0.001. A total of 6832 images were obtained for the training set. The data is distributed using a load balancing algorithm before being fed into the model. After normalizing the RGB data of the image, it is input into the trained dual-channel semantic segmentation model to predict the masks corresponding to the two categories of straw and land in the image.

[0103] Finally, background interference was added for retraining. Different straw mulch environments affect straw recognition. Increased light intensity causes straw color changes and reduces the difference from the ground, increasing detection difficulty; tractor ruts are very common in fields, and general models have limited accuracy in recognizing scattered small straws in rut areas; shadows, soil clods, and ditches are also common. Five types of background interference, including exposure, ruts, shadows, soil clods, and ditches, were added to retrain the model, improving its stability and accuracy. The retrained model, based on a shallow network structure, learned the feature extraction capabilities of a deep network. During quantization, the calculated loss was also backpropagated to ensure straw recognition capability. The final model is denoted as QSR101-18.

[0104] Accordingly, based on the same inventive concept, the present invention also provides a storage medium storing a computer program configured to execute the aforementioned lightweight field crop segmentation method during runtime. Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution according to the embodiments of the present invention can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (e.g., a CD-ROM, USB flash drive, portable hard drive, etc.) or on a network, including several instructions to cause a computing device (which can be a personal computer, server, mobile terminal, or network device, etc.) to execute the method according to the embodiments of the present invention.

[0105] In some possible implementations, various aspects of the present invention can also be implemented as a program product comprising program code that, when run on a terminal device, causes the terminal device to perform the steps described in the "Exemplary Methods" section of this specification according to various exemplary embodiments of the present invention. Optionally, in this embodiment, the storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard disk, magnetic disk, or optical disk.

[0106] According to embodiments of the present invention, a program product for implementing the above-described method may employ a portable compact disc read-only memory (CD-ROM) and include program code, and may run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited thereto. In this document, a readable storage medium may be any tangible medium containing or storing a program that may be used by or in conjunction with an instruction execution system, apparatus, or device.

[0107] The program product may employ any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0108] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium, capable of sending, propagating, or transmitting programs for use by or in conjunction with an instruction execution system, apparatus, or device.

[0109] The program code contained on the readable medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.

[0110] Program code for performing the operations of this invention can be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java and C++, and conventional procedural programming languages ​​such as C or similar languages. The program code can execute entirely on the user's computing device, partially on the user's device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).

[0111] This invention is used to detect straw coverage. Straw images are acquired through a vehicle-mounted terminal platform, and a dataset is constructed using data augmentation. SegNext is selected as the base model for optimization, and a dual-channel semantic segmentation model and knowledge transfer method are constructed. ResNet101 is used as the teacher model with its backbone layer, and ResNet18 is used as the student model for training. The model is quantized using QAT while maintaining detection accuracy. Retraining is performed under multi-factor field conditions, resulting in a lightweight, low-error, stable, and highly accurate QSR101-18 model. This solves the problem of difficult straw coverage detection caused by unstructured, fragmented straw and environmental factors, and meets the hardware requirements for field straw detection in edge monitoring platforms.

[0112] Of course, the present invention may have other various embodiments. Without departing from the spirit and essence of the present invention, those skilled in the art can make various corresponding changes and modifications according to the present invention, but these corresponding changes and modifications should all fall within the protection scope of the appended claims.

Claims

1. A lightweight method for crop segmentation in the field, characterized in that, Includes the following steps: S100. Construct a dual-channel semantic segmentation model. The network structure of the dual-channel semantic segmentation model includes a teacher model and a student model. Both channels include an encoding module and a decoding module. S200, dual-channel semantic model knowledge transfer, by training the student model by imitating the output distribution of the teacher model, to obtain a lightweight and efficient model; S300. Quantize the lightweight and efficient model to convert the floating-point number into a low-bit-width integer representation, thereby reducing the precision of the model parameters and activation function. S400. Pre-train the lightweight and efficient model, calculate the loss function, and retain the optimal parameters; S500: Construct a dataset by adjusting brightness, contrast, flipping, and noise to augment the original training data. as well as S600, adding background interference including exposure, ruts, shadows, soil clumps and ditches, retraining the lightweight and efficient model to obtain the final model QSR101-18 with higher stability and accuracy.

2. The lightweight field crop segmentation method as described in claim 1, characterized in that, During the training process in step S200, the gap between the student model and the true label is minimized, and the output probability distribution of the teacher model on the training data is made as close as possible to the teacher model, so as to obtain the lightweight and efficient model.

3. The lightweight field crop segmentation method as described in claim 2, characterized in that, Segnext-Resnet101 was used to guide the learning of Segnext-Resnet18. The training process further included: S201, Initialize parameters; S202. Train the Segnext-Resnet101 model as the teacher model and save the optimal weights; S203. Generate soft labels: The Segnext-Resnet101 model performs forward propagation on the training set to generate soft labels for each sample, and uses temperature parameters to smooth the output probabilities. S204. The student model is Segnext-Resnet18, and the Segnext-Resnet18 model loads the best weights of the Segnext-Resnet101 model as the initial weights during training. S205. Calculate the loss function, including the cross-entropy loss function and the distillation loss function. The cross-entropy loss function is used to measure the difference between the output of the Segnext-Resnet18 model and the true label. The distillation loss function is used to measure the difference between the output of the Segnext-Resnet18 model and the soft label of the Segnext-Resnet101 model. By jointly optimizing the cross-entropy loss function and the distillation loss function, the Segnext-Resnet18 model can learn the generalization ability of the Segnext-Resnet101 model while maintaining prediction accuracy. S206. Adjust the temperature parameters; during the distillation process, use dynamic linear temperature parameter settings to smooth the soft label; and S207. End training and save the best model as SR101-18.

4. The lightweight field crop segmentation method as described in claim 1, characterized in that, In step S300, quantization training is performed using Quantization-Aware Training (QAT). The quantization loss is passed to the model's loss function, and the optimizer optimizes the loss value based on the training process to obtain the optimized model, thus realizing the quantization of model parameters. This further includes: S301. Load and save the weights SR101-18 as pre-training weights, and introduce the simulation of quantization operations during the training process; S302, Forward Propagation: Insert pseudo-quantization nodes during model training to calculate the maximum and minimum values ​​of the input data distribution. S303, Quantization parameters are calculated as: clamp(x,x) min ,x max := min(max(x,x) min ),x max ); S304, Quantization: FP32→INT8; S305, Backward propagation: δ out =δ in ,I x ∈S,(x min <x<x max );as well as S306, Update x min ,x max ; Where x is the input, x max For the maximum pseudo-quantized node, x min For minimum value pseudo-quantization nodes, FP32-INT8 converts a 32-bit floating-point character to an 8-bit integer character, δ out =δ in ,I x ∈S,(x min <x<x max ) represents a direct connecting device, and S represents the range of the connecting device.

5. The lightweight field crop segmentation method as described in claim 1, characterized in that, In S400, the training iterations are 40,000, and the cross-entropy loss function is chosen for loss calculation: Where n is the number of pixels, i is the pixel position, y is the true value, and a is the predicted probability. The training loss result is saved once every 10 iterations, and the best model is saved once every 1000 tests.

6. The lightweight field crop segmentation method as described in claim 5, characterized in that, In step S400, the attenuation strategy is consine, the batch size is set to 16, and the formula for consine is: In the formula, lr is the current learning rate, initial_lr is the initial learning rate, T is the total number of iterations, and t is the current number of iterations.

7. The lightweight field crop segmentation method as described in claim 1, characterized in that, In S500, the brightness and contrast amplification data are randomly selected within the range of (0.8, 1.2). The original image is multiplied by this value to obtain the amplified image. The original image is rotated by 90 degrees and 180 degrees to achieve a flip amplification of 2 times. Gaussian noise is added at random positions with a value of 0.

001. The data is distributed using a load balancing algorithm before being fed into the lightweight and efficient model. After normalizing the RGB data of the image, it is input into the trained dual-channel semantic segmentation model to predict the masks corresponding to the two categories of straw and non-straw in the image.

8. A lightweight field crop splitting device, characterized in that, The system includes a fuzzy neural network controller, which is used to construct a dual-channel semantic segmentation model. Each channel of the dual-channel semantic segmentation model includes an encoding module and a decoding module. The system also employs the lightweight field crop segmentation method described in any one of claims 1-7 to detect field straw coverage.

9. A farmland vehicle, comprising a chassis and a body, a vehicle control device, and an image acquisition device mounted on the chassis, characterized in that, The vehicle control device includes the lightweight field crop segmentation device as described in claim 8. The front-facing camera of the image acquisition device captures images of the crops in front and uploads them to the lightweight field crop segmentation device through the data transmission module to detect the straw coverage rate in the field.

10. A storage medium, characterized in that, The storage medium stores a computer program, which is configured to execute the lightweight field crop segmentation method according to any one of claims 1-7 when running.