Agricultural machinery automatic driving method, device, equipment, storage medium and product
By optimizing the hyperparameters of the instance segmentation model using the gray squirrel optimization algorithm, the problems of limited computing resources and complex environmental changes in agricultural machinery are solved, efficient and stable instance segmentation is achieved, and the intelligent decision-making and autonomous driving safety of agricultural machinery are improved.
Patent Information
- Application Number
- CN202510845363.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-23
- Publication Date
- 2025-10-17
AI Technical Summary
Existing instance segmentation models are subject to limited computing resources, complex environmental changes, and difficulty in hyperparameter optimization in the embedded environment of agricultural machinery, resulting in insufficient real-time performance and accuracy, which affects the intelligent decision-making capabilities of agricultural machinery.
The gray squirrel optimization algorithm is used to optimize the key hyperparameters of the instance segmentation model. By simulating the ecological behaviors of gray squirrels, such as storage and retrieval, deceptive food hiding, and vigilance cooperation, the global exploration ability and local optimization capabilities are improved. The optimized model can run efficiently on a low-power embedded platform.
It improves the real-time performance and accuracy of the instance segmentation model, enhances the intelligent decision-making ability of agricultural machinery in complex farmland environments, achieves accurate segmentation of crops and obstacles, and improves the safety and accuracy of autonomous driving.
Smart Images

Figure CN120802716A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of agricultural machinery control, and in particular to an agricultural machinery automatic driving method, device, equipment, storage medium and product. BACKGROUND
[0002] With the development of agricultural intelligence, automatic driving agricultural machines are widely used in tasks such as plowing, seeding, fertilizing and harvesting. The core of automatic driving lies in real-time perception and intelligent decision-making, among which the target detection technology based on instance segmentation can be used for accurate identification of crop rows, obstacles and other farmland features. However, the existing instance segmentation model still faces the following challenges in the embedded environment of agricultural machinery: (1) limited computing resources: the embedded platform of agricultural machinery usually uses low-power processors, which are difficult to support complex deep learning models; (2) complex environmental changes: farmland scenes have unstructured characteristics, such as changes in light, occlusions, and soil reflections, which affect the robustness of the model; (3) difficulty in hyperparameter optimization: the hyperparameters of the instance segmentation model have a significant impact on the performance of the model, but traditional search methods (such as grid search and random search) have large computational overhead and slow convergence speed, which cannot meet the actual application requirements.
[0003] In the prior art, methods such as Particle Swarm Optimization (PSO) and Genetic Algorithm (GA) have been used for hyperparameter optimization, but these methods have problems such as local optimal trap and insufficient global search capability. Therefore, there is an urgent need for an efficient and stable hyperparameter optimization method to improve the real-time performance and accuracy of the instance segmentation model, thereby enhancing the intelligent decision-making capability of agricultural machinery. SUMMARY
[0004] The present application provides an agricultural machinery automatic driving method, device, equipment, storage medium and product, which solves the defects of the prior art that the hyperparameter optimization method has local optimal trap and insufficient global search capability, affecting the real-time performance and accuracy of the instance segmentation model, and realizes efficient and stable hyperparameter optimization to improve the real-time performance and accuracy of the instance segmentation model, thereby enhancing the intelligent decision-making capability of agricultural machinery.
[0005] The present application provides an agricultural machinery automatic driving method, comprising: obtaining a real-time farmland crop row image; inputting the real-time farmland crop row image into an optimized instance segmentation model to obtain real-time segmentation results of crop rows and other instance objects in the farmland, and adjusting the automatic driving path of the agricultural machinery based on the real-time segmentation results; wherein the instance segmentation model is optimized by the following method: Map the key hyperparameter combination of the instance segmentation model to a multi-dimensional position vector of the grey squirrel individual, randomly generate a plurality of grey squirrel individuals to obtain an initial population; In the case where the current iteration round does not satisfy the preset iteration termination condition, the current population is iteratively optimized based on the caching and retrieval mechanism, the deceptive caching strategy and the alert cooperation mechanism of the grey squirrel optimization algorithm. In the case where the current iteration round satisfies the preset iteration termination condition, the multi-dimensional position vector of the optimal grey squirrel individual is output as the optimal hyperparameter combination, and the instance segmentation model optimized by the optimal hyperparameter combination is obtained.
[0006] According to the agricultural machinery automatic driving method provided by the application, the caching and retrieval mechanism is used to enable each grey squirrel individual to maintain a historical optimal solution memory bank for storing a plurality of historical optimal solutions, and the historical optimal solutions are referred to in the individual position updating process; The deceptive caching strategy is used to generate a pseudo-optimal solution every preset iteration round, and to disturb the current optimal solution by applying random Gaussian noise around the current optimal solution; The alert cooperation mechanism is used to trigger global direction reset when a better solution with a fitness higher than that of the current optimal solution is detected.
[0007] According to the agricultural machinery automatic driving method provided by the application, the plurality of key hyperparameters of the instance segmentation model at least include a learning rate, a batch size, an anchor box ratio, a classification loss weight and a regression loss weight; The learning rate is logarithmically uniformly sampled, the batch size is a discrete value, the anchor box ratio is floated based on a preset reference value according to a preset floating range, the classification loss weight is adaptively dynamically adjusted within a first preset weight range, and the regression loss weight is adaptively dynamically adjusted within a second preset weight range.
[0008] According to the agricultural machinery automatic driving method provided by the application, the preset iteration termination condition is that the current iteration number reaches a preset maximum iteration number or the fitness of the current optimal solution reaches a preset fitness threshold; after the plurality of grey squirrel individuals are randomly generated to obtain the initial population, the method further comprises: In the current iteration round, the fitness of each grey squirrel individual in the current population is calculated based on a multi-objective fitness function, and the grey squirrel individual with the highest fitness is determined as the current optimal solution; wherein the optimization objectives of the multi-objective fitness function include improving accuracy, reducing computational complexity and improving frame rate.
[0009] According to the agricultural machinery automatic driving method provided by the application, the fitness of each grey squirrel individual in the current population is calculated based on a multi-objective fitness function, and the grey squirrel individual with the highest fitness is determined as the current optimal solution; wherein the optimization objectives of the multi-objective fitness function include improving accuracy, reducing computational complexity and improving frame rate. For each grey squirrel individual in the current population, based on the hyperparameter combination mapped by the multi-dimensional position vector of the grey squirrel individual, the pre-training instance segmentation model corresponding to the grey squirrel individual is trained to obtain the pre-training instance segmentation model corresponding to the grey squirrel individual. For each pre-training instance segmentation model, based on the intersection over union, the model frames per second, the preset reference frame rate, the floating point operations per second, and the preset reference computation amount of the pre-training instance segmentation model, the fitness of the grey squirrel individual corresponding to the pre-training instance segmentation model is calculated.
[0010] According to the agricultural machinery automatic driving method provided by the application, the real-time crop row image of the farmland is obtained, which comprises: An initial crop row image of the farmland is obtained by a multispectral camera. The initial crop row image of the farmland is subjected to data enhancement to obtain a real-time crop row image of the farmland.
[0011] The application also provides an agricultural machinery automatic driving device, which comprises: An image acquisition module is configured to acquire a real-time crop row image of the farmland. An instance segmentation module is configured to input the real-time crop row image of the farmland into an optimized instance segmentation model to obtain a real-time segmentation result of crop rows and other instance objects in the farmland, and to adjust an automatic driving path of the agricultural machinery based on the real-time segmentation result. The instance segmentation model is optimized by the following modules: A hyperparameter mapping module is configured to map a key hyperparameter combination of the instance segmentation model into a multi-dimensional position vector of a grey squirrel individual, to randomly generate a plurality of grey squirrel individuals, and to obtain an initial population. An iterative optimization module is configured to, in a case where a current iteration round does not satisfy a preset iteration termination condition, perform iterative optimization on a current population based on a storage and retrieval mechanism, a deceptive hoarding mechanism and a vigilance cooperation mechanism of a grey squirrel optimization algorithm. An optimal output module is configured to, in a case where the current iteration round satisfies the preset iteration termination condition, output a multi-dimensional position vector of an optimal grey squirrel individual as an optimal hyperparameter combination, and to obtain an instance segmentation model optimized by the optimal hyperparameter combination.
[0012] The application also provides an electronic device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the agricultural machinery automatic driving method according to any one of the above embodiments when executing the computer program.
[0013] The application further provides a non-transitory computer-readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement the agricultural machinery automatic driving method.
[0014] The application further provides a computer program product, which comprises a computer program, and the computer program is executed by a processor to implement the agricultural machinery automatic driving method.
[0015] The agricultural machinery automatic driving method, device, equipment, storage medium and product provided by the application optimize the hyperparameters of the instance segmentation model applied to the agricultural machinery automatic driving scene based on the multi-behavior coordination gray squirrel optimization algorithm, improve the global exploration ability and local optimization ability of the hyperparameter search by simulating the ecological behaviors of the gray squirrel such as storage and retrieval, deceptive food storage and alert cooperation, realize efficient and stable hyperparameter optimization, and is beneficial to improving the real-time performance and accuracy of the instance segmentation model, thereby enhancing the intelligent decision-making ability of the agricultural machinery in the complex farmland environment; the optimized instance segmentation model can be widely applied to the agricultural machinery automatic driving scene, realizes the accurate segmentation of crops and obstacles in the complex farmland scene, thereby not only can accurately identify crop rows, effectively reduce the automatic driving path deviation and improve the seeding and harvesting precision, but also can enhance the real-time detection ability of obstacles, so that the agricultural machinery can automatically avoid obstacles during the operation process and improve the automatic driving safety. BRIEF DESCRIPTION OF DRAWINGS
[0016] In order to more clearly illustrate the technical solutions in the application or prior art, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings in the following description are some embodiments of the application, and for those skilled in the art, other drawings can also be obtained without creative labor based on these drawings.
[0017] Figure 1 is a flowchart of the agricultural machinery automatic driving method provided by the embodiment of the application.
[0018] Figure 2 is a flowchart of the iterative optimization of the key hyperparameter combination of the instance segmentation model provided by the embodiment of the application.
[0019] Figure 3 is a structural diagram of the agricultural machinery automatic driving device provided by the embodiment of the application.
[0020] Figure 4 is a structural diagram of the electronic device provided by the embodiment of the application. DETAILED DESCRIPTION
[0021] In order to make the objects, technical solutions and advantages of the present application clearer, the following will clearly and completely describe the technical solutions in the present application with reference to the drawings in the present application. Obviously, the described embodiments are only some but not all of the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall into the protection scope of the present application.
[0022] In the description of the embodiments of the present application, the terms "comprising", "containing" or any other variants thereof are intended to cover the non-exclusive inclusion, so that the process, method, article or equipment including a series of elements not only includes those elements, but also includes other elements not explicitly listed or inherent to such process, method, article or equipment. The specific meaning of the above terms in the present application can be understood by the person of ordinary skill in the art according to the specific circumstances.
[0023] Figure 1 is a flowchart of the agricultural machinery automatic driving method provided by the embodiments of the present application. With reference to Figure 1 , the embodiments of the present application provide an agricultural machinery automatic driving method, which can specifically include the following steps: Step 101, acquiring a real-time crop row image.
[0024] It should be noted that the execution subject of the agricultural machinery automatic driving method provided by the embodiments of the present application can be an agricultural machinery, an electronic device in the agricultural machinery, a component in the electronic device, an integrated circuit or a chip.
[0025] The embodiments of the present application will be described below with the electronic device as the execution subject. The method provided by the embodiments of the present application can be applied to the target detection and instance segmentation task in the agricultural machinery automatic driving system, and the execution subject of the method can be an electronic device, such as an embedded computing platform of the agricultural machinery, which can contain a computing device for instance segmentation, and the computing device can be realized by hardware, software or both.
[0026] The agricultural machinery can drive along the road beside the crop row in the farmland scene to perform the work task. In some embodiments, a video acquisition device can be installed on the agricultural machinery, so that during the automatic driving of the agricultural machinery, the environment of the agricultural machinery is acquired in real time through the video acquisition device to generate a crop row video in the farmland, and a video frame is obtained from the crop row video in the farmland to obtain a real-time crop row image.
[0027] In some embodiments, a multispectral camera can be employed to collect multispectral image data of a crop row in a farmland. The multispectral data can provide richer spectral information than single visible light, which is helpful to distinguish different crops, weeds and soil background, and thus is conducive to improving the segmentation accuracy of the instance segmentation model.
[0028] In step 102, the real-time farmland crop row image is input into the optimized instance segmentation model to obtain a real-time segmentation result of crop rows and other instance objects in the farmland, and the automatic driving path of the agricultural machine is adjusted based on the real-time segmentation result. The instance segmentation model is optimized by the following method: mapping the key hyperparameter combination of the instance segmentation model to a multi-dimensional position vector of a gray squirrel individual, randomly generating a plurality of gray squirrel individuals to obtain an initial population, in the case that the current iteration round does not satisfy the preset iteration termination condition, iteratively optimizing the current population based on the storing and retrieving mechanism, the deceptive food hiding mechanism and the alert cooperation mechanism of the gray squirrel optimization algorithm, in the case that the current iteration round satisfies the preset iteration termination condition, outputting the multi-dimensional position vector of the optimal gray squirrel individual as the optimal hyperparameter combination to obtain the instance segmentation model optimized by the optimal hyperparameter combination.
[0029] In the embodiment of the present application, the key hyperparameter combination of the instance segmentation model can be first optimized using the gray squirrel optimization algorithm (GSO), and the optimal hyperparameter combination is output, so as to obtain the instance segmentation model optimized by the optimal hyperparameter combination (i.e. the optimized instance segmentation model). One key hyperparameter combination can include a plurality of key hyperparameters.
[0030] In the training process of the instance segmentation model, a plurality of key hyperparameters directly affect the convergence speed, detection accuracy and computational overhead of the instance segmentation model. In the embodiment of the present application, the key hyperparameters are mapped to the multi-dimensional position vector of the gray squirrel individual in the gray squirrel optimization algorithm, and the gray squirrel optimization algorithm is used for searching and updating, so that the gray squirrel optimization algorithm can adjust the optimal hyperparameter combination in a high-dimensional search space. Each gray squirrel individual can represent a hyperparameter combination, and the search process can be simulated by the foraging behavior of the gray squirrel.
[0031] In the embodiment of the present application, after the key hyperparameter combination of the instance segmentation model is mapped to the multi-dimensional position vector of the gray squirrel individual, a plurality of gray squirrel individuals can be randomly generated to obtain an initial population, so as to search and iteratively update based on the initial population.
[0032] In some embodiments, after the iteration update of the last population, a current population can be obtained. In the current iteration round, it can be judged whether the current iteration round meets the preset iteration termination condition. If the current iteration round does not meet the preset iteration termination condition, the current population can be iteratively updated and optimized based on the caching and retrieval mechanism, the deceptive hoarding mechanism and the vigilance cooperation mechanism of the chipmunk optimization algorithm, so as to iteratively optimize the hyperparameter combination, and continue to judge whether the preset iteration termination condition is met in the next iteration round, so as to continuously iteratively optimize the population until the preset iteration termination condition is met. If the current iteration round meets the preset iteration termination condition, the optimal chipmunk individual can be determined, and the multi-dimensional position vector of the optimal chipmunk individual is output as the optimal hyperparameter combination of the model, so as to obtain an instance segmentation model optimized by the optimal hyperparameter combination.
[0033] The embodiment of the present application designs a multi-behavior collaborative optimization strategy by utilizing the ecological behavior of chipmunks, including caching and retrieval mechanism, deceptive hoarding mechanism and vigilance cooperation mechanism to iteratively optimize the population, which is beneficial to improve the global exploration ability and local search efficiency of the search.
[0034] In the embodiment of the present application, after obtaining the optimized instance segmentation model, the optimized instance segmentation model can be deployed on an electronic device in an agricultural machine to run, so that the electronic device executes the agricultural machine automatic driving method provided by the embodiment of the present application.
[0035] In some embodiments, the electronic device in the agricultural machine can include a main electronic device and a low-power embedded computing device, and the instance segmentation model optimized by the embodiment of the present application can be efficiently run on the embedded computing device, ensuring high-precision target detection while meeting real-time requirements, so that high-precision detection and stable navigation control can be maintained in sunny, cloudy or complex farmland environments. Specifically, the optimized instance segmentation model can be deployed on the low-power embedded computing device to run, so that the main electronic device obtains a real-time farmland crop row image, transmits the real-time farmland crop row image to the low-power embedded computing device for running the optimized instance segmentation model for processing to obtain a real-time segmentation result, and finally adjusts the automatic driving path of the agricultural machine based on the real-time segmentation result through the main electronic device.
[0036] The low-power embedded computing device can be a processor with relatively low computing power. By using the low-power embedded computing device to perform the instance segmentation process of the input image using the optimized instance segmentation model, compared with a general-purpose processor, it is beneficial to improve the calculation speed and efficiency of the instance segmentation model.
[0037] In some embodiments, the instance object can include a crop row in a farmland, a road beside the crop row, an obstacle on the road, and the like. During the driving of the agricultural machine, a real-time farmland crop row image can be input into the optimized instance segmentation model to obtain a real-time segmentation result of the crop row in the farmland and other instance objects except the crop row output by the optimized instance segmentation model, so as to adjust the automatic driving path of the agricultural machine based on the real-time segmentation result.
[0038] The optimization strategy of the embodiment of the present application enhances the real-time detection capability of the instance segmentation model on the obstacle. The agricultural machine can automatically drive along the road path detected by the optimized instance segmentation model, and when it is detected in real time that there is an obstacle on the road, the automatic driving path of the agricultural machine is adjusted in time, so that the agricultural machine can automatically and accurately avoid obstacles during operation, thereby improving the safety of the automatic driving of the agricultural machine.
[0039] The embodiment of the present application optimizes the hyperparameters of the instance segmentation model applied to the automatic driving scene of the agricultural machine based on the multi-behavior collaborative grey squirrel optimization algorithm. By simulating the ecological behaviors of the grey squirrel such as storage and retrieval, deceptive food hiding, and alert cooperation, the global exploration capability and local optimization capability of the hyperparameter search are improved, efficient and stable hyperparameter optimization is achieved, which is conducive to improving the real-time performance and accuracy of the instance segmentation model, thereby enhancing the intelligent decision-making capability of the agricultural machine in complex farmland environment. The optimized instance segmentation model can be widely applied to the automatic driving scene of the agricultural machine to realize accurate segmentation of crops and obstacles in complex farmland scenes, so as to not only accurately identify crop rows, effectively reduce the deviation of the automatic driving path, and improve the seeding and harvesting precision, but also enhance the real-time detection capability of the obstacle, so that the agricultural machine can automatically avoid obstacles during operation, thereby improving the safety of automatic driving.
[0040] In an alternative embodiment, the real-time farmland crop row image can be obtained by acquiring an initial farmland crop row image collected by a multispectral camera, and performing data enhancement on the initial farmland crop row image to obtain the real-time farmland crop row image.
[0041] In the embodiment of the present application, multispectral image data of the farmland can be collected and dynamically enhanced for preprocessing to obtain a real-time farmland crop row image for input into the optimized instance segmentation model for analysis.
[0042] In some embodiments, multispectral image data of the farmland crop row can be collected by a multispectral camera. Multispectral data can provide richer spectral information than single visible light, which is conducive to distinguishing different crops, weeds and soil backgrounds in the image, and thus improving the segmentation accuracy of the subsequent instance segmentation model.
[0043] In some embodiments, in order to enhance the robustness of the data, data enhancement strategies such as dynamic light enhancement and occlusion simulation can be used to reduce the influence of light changes, shadows, and vegetation density changes on the instance segmentation model. Light change simulation uses high dynamic range (High Dynamic Range, HDR) technology to generate images under different light conditions, enhancing the adaptability of the model. Random occlusion enhancement simulates the occlusion of targets caused by agricultural equipment and vegetation interlacing, avoiding performance degradation of the instance segmentation model under occlusion conditions. In addition, different levels of Gaussian noise can be applied to the input image to improve the noise resistance of the instance segmentation model, so that it still maintains high segmentation accuracy in complex farmland environments.
[0044] In an alternative embodiment, the plurality of key hyperparameters of the instance segmentation model at least include a learning rate, a batch size, an anchor box ratio, a classification loss weight, and a regression loss weight; wherein the learning rate adopts logarithmic uniform sampling; the batch size is a discrete value; the anchor box ratio is based on a preset reference value and is floated within a preset floating range; the classification loss weight is adaptively and dynamically adjusted within a first preset weight range; and the regression loss weight is adaptively and dynamically adjusted within a second preset weight range.
[0045] During the training process of the instance segmentation model, a plurality of key hyperparameters (such as learning rate, batch size, anchor box ratio, loss function weight, etc., which can include classification loss weight and regression loss weight) can directly affect the convergence speed, detection accuracy, and computational overhead of the model. The embodiment of the present application maps these key hyperparameters to the multi-dimensional position vectors of the grey squirrel individuals in the grey squirrel optimization algorithm , so that the grey squirrel optimization algorithm can adjust the optimal hyperparameter combination in a high-dimensional search space. Among them, for the learning rate, for the batch size, for the anchor box ratio, for the classification loss weight, for the regression loss weight.
[0046] In some embodiments, the learning rate can adopt logarithmic uniform sampling to ensure that learning rates of different orders of magnitude have the opportunity to be searched; the batch size can be selected from a discrete value set to adapt to different computational resource limitations; the anchor box ratio allows floating up and down within a certain range based on a preset reference value to adapt to different crop row spacings; and the loss function weight can adopt a dynamic adjustment strategy to adaptively adjust the weight ratio of the classification loss, the bounding box regression loss, and the mask loss according to the actual optimization situation, improving the final segmentation effect while reducing unnecessary computational burden.
[0047] As an example, the preset floating range can be 20% up and down, and the first preset weight range can be , the second preset weight range can be The definition of the hyperparameter search space can include: learning rate Logarithmic uniform sampling is used; batch size is a discrete value; the anchor box ratio is allowed to be within the reference value Fluctuation of 20% (i.e., baseline value ±20%); classification loss weight , regression loss weight .
[0048] In an optional embodiment, the preset iteration termination condition is that the current number of iterations reaches a preset maximum number of iterations or the fitness of the current optimal solution reaches a preset fitness threshold; after randomly generating multiple gray squirrel individuals and obtaining an initial population, the method may further include: in the current iteration round, based on a multi-objective fitness function, calculating the fitness of each gray squirrel individual in the current population, and determining the gray squirrel individual with the highest fitness as the current optimal solution; wherein, the optimization objectives of the multi-objective fitness function include improving accuracy, reducing computational complexity and increasing frame rate.
[0049] In some embodiments, after iteratively updating the previous population, a current population can be obtained. In the current iteration round, it can be determined whether the current iteration round meets a preset iteration termination condition. If the current iteration number reaches a preset maximum number of iterations, or the fitness of the current optimal solution reaches a preset fitness threshold, then the current iteration round meets the preset iteration termination condition. If the current iteration number does not reach the preset maximum number of iterations, and the fitness of the current optimal solution does not reach the preset fitness threshold, then the current iteration round does not meet the preset iteration termination condition.
[0050] In some embodiments, the updating iteration may be terminated if the fitness value does not improve significantly in a plurality of consecutive iterations.
[0051] In some embodiments, the optimization objectives of the multi-objective fitness function may include improving accuracy, thereby ensuring the segmentation accuracy of the instance segmentation model for crops and obstacles; the optimization objectives may also include reducing the amount of computation, thereby reducing computational overhead and making the instance segmentation model adaptable to low-power embedded hardware; the optimization objectives may also include improving the frame rate, thereby ensuring that agricultural machinery can respond to environmental changes in a timely manner during automatic driving.
[0052] The embodiment of the present application constructs a multi-objective fitness function with the optimization target of improving accuracy, reducing calculation amount and improving frame rate, calculates the fitness of the individual of the grey squirrel by using the multi-objective fitness function, so that the constraint of calculation complexity is considered in the optimization process, so that the finally optimized instance segmentation model can run efficiently on the embedded computing device, while ensuring high-precision target detection and meeting the real-time requirement, and can maintain high-precision detection and stable navigation control under sunny, cloudy or complex farmland environment.
[0053] In an optional embodiment, the fitness of each individual of the grey squirrel in the current population is calculated based on the multi-objective fitness function, and specifically can include: for each individual of the grey squirrel in the current population, based on the hyperparameter combination mapped by the multi-dimensional position vector of the individual of the grey squirrel, the to-be-trained instance segmentation model corresponding to the individual of the grey squirrel is trained to obtain the pre-trained instance segmentation model corresponding to the individual of the grey squirrel; for each pre-trained instance segmentation model, the fitness of the individual of the grey squirrel corresponding to the pre-trained instance segmentation model is calculated based on the intersection over union of the pre-trained instance segmentation model, the number of frames processed per second of the model, the preset reference frame rate, the number of floating point operations executed per second of the model, and the preset reference calculation amount.
[0054] In the embodiment of the present application, after the previous population is iteratively updated, the current population can be obtained, so that the to-be-trained instance segmentation model corresponding to each individual of the grey squirrel is trained based on the hyperparameter combination mapped by the multi-dimensional position vector of each individual of the grey squirrel, respectively, to obtain the pre-trained instance segmentation model corresponding to each individual of the grey squirrel.
[0055] Among them, one individual of the grey squirrel can correspond to one to-be-trained instance segmentation model. In each iteration round, the to-be-trained instance segmentation model needs to be trained again based on the position vectors of all individuals of the grey squirrel in the current population, respectively, to calculate the fitness value of the individual of the grey squirrel based on the related parameters for evaluating the model.
[0056] In some embodiments, before model training, a multispectral camera (including visible light and near-infrared waveband) can be used to collect images of crop rows in farmland, and the collected video frame images can be used as sample data to train the to-be-trained instance segmentation model. The sample video frame images can cover different light conditions and crop growth stages, thereby ensuring the diversity of sample data. The sample video frame image data can contain the crop row scene of the farmland under different environmental conditions, so as to ensure the robustness of the model trained under different scenes.
[0057] In some embodiments, in order to enhance the generalization ability of the model, before inputting the sample video frame image into the instance segmentation model to be trained for model training, the image can be processed by using a data enhancement technique, so as to improve the adaptability of the instance segmentation model to partial occlusion and complex scenes through the data enhancement technique. Specifically, illumination simulation can be used, that is, high dynamic range (HDR) technology is used to simulate images under different sunlight conditions, such as simulating sunlight changes, shadows and reflection effects; occlusion simulation can also be used, that is, by simulating the occlusion between the agricultural equipment and the crops, a random occlusion algorithm is used to generate a partially occluded image.
[0058] In some embodiments, before model training, the key hyperparameters of the instance segmentation model can be first optimized using the grey squirrel optimization algorithm; after hyperparameter optimization (i.e., after updating the current population by iterating the previous population), model training can begin. During model training, a lightweight network architecture can be used to reduce the number of parameters and ensure that the model is suitable for low-power embedded computing platforms. Specifically, an adaptive anchor box generation strategy can be used, that is, the change in crop row spacing is detected from the sample video frame image, and the anchor box ratio is dynamically adjusted according to the change in crop row spacing, thereby facilitating the optimization of model detection accuracy and recall rate, which enables the instance detection model to maintain high segmentation accuracy when facing different crop types and crop row densities; and a comprehensive loss function can be used to optimize segmentation accuracy (IoU) and computational efficiency at the same time to ensure a balance between accuracy and efficiency.
[0059] In actual application, the instance segmentation model can be an improved Mask R-CNN architecture. The backbone network of the instance segmentation model can use MobileNetV3 with a parameter amount ≤2.5M; an adaptive anchor box generator can be used to dynamically adjust the anchor box ratio according to the crop row spacing; the loss function weighting can combine the classification error, the bounding box regression error and the mask segmentation error, and the weight ratio can be 1:1:2.
[0060] In some embodiments, the instance segmentation model after training (i.e., the pre-trained instance segmentation model) can be subjected to inference acceleration processing. In order to improve inference efficiency, TensorRT can be used for inference acceleration, and quantization technology can be used to further reduce computational resource consumption. Quantization technology reduces memory bandwidth and storage requirements by reducing the bit width of the model, thereby improving inference speed and reducing power consumption. On the basis of inference acceleration, the optimized instance segmentation model can be deployed in the embedded system of the agricultural machinery for real-time target detection and navigation control. During deployment, the optimized instance segmentation model can be adapted in real time according to the changes in the actual scene, such as dynamically adjusting the anchor box to cope with the change in crop row spacing in different farmland environments, to ensure that the system can always maintain high detection accuracy and response speed in variable farmland environments.
[0061] The embodiment of the present application trains an instance segmentation model based on the hyperparameter combination of the grey squirrel optimization algorithm, and deploys it to an embedded computing platform of an agricultural machine, such as NVIDIA Jetson AGX Orin; and further adopts a lightweight backbone network (MobileNetV3) to reduce the parameter amount to ≤2.5M, which can adapt to the environment of limited embedded computing resources in the automatic driving scene of the agricultural machine; an adaptive anchor box generation strategy is adopted, which can adjust the candidate box proportion according to the crop row spacing; and a deep reasoning optimization technology is combined, and quantization reasoning acceleration is performed based on TensorRT, which can improve the reasoning speed. The optimized instance segmentation model in the embodiment of the present application can realize efficient reasoning on the embedded device with limited computing resources, and ensure the stable operation of the agricultural machine in the real-time environment.
[0062] The embodiment of the present application adopts a multi-spectral data enhancement and a dynamic adaptive anchor box strategy to improve the generalization ability of the instance segmentation model under different illumination conditions and occlusion conditions, so that it can adapt to various farmland operation scenes.
[0063] In some embodiments, after obtaining the pre-trained instance segmentation model corresponding to each grey squirrel individual in the current population, the fitness of each grey squirrel individual in the current population can be calculated based on the following multi-objective fitness function, and the grey squirrel individual with the highest fitness can be determined as the current optimal solution: wherein, is the fitness of the grey squirrel individual, FPS (Frames Per Second) is the number of frames processed per second by the model, FLOPs (Floating-Point Operations) is the number of floating-point operations performed per second by the model, 、 、 is a weighted factor and + + =1.
[0064] wherein, FPS can be measured in the model reasoning stage to evaluate the real-time performance of the model; FLOPs can be calculated before the model training starts or in the model design stage to evaluate the computational complexity of the model; and IoU can be calculated in the model training stage and the verification / test stage to evaluate the detection performance of the model.
[0065] The embodiment of the present application constructs a multi-objective fitness function fusing key indicators such as segmentation accuracy, inference frame rate and calculation complexity, so as to ensure that the optimization result takes into account detection accuracy, calculation efficiency and real-time performance. The optimization objectives of the multi-objective fitness function include improving IoU to ensure the segmentation accuracy of the model to crops and obstacles, reducing FLOPs to reduce the calculation overhead, adapting the model to low-power embedded hardware, and improving FPS to ensure that the model can respond to environmental changes in time during the automatic driving of agricultural machinery. Since the constraint of calculation complexity is considered in the optimization process, the instance segmentation model finally optimized can run efficiently on embedded computing devices, ensuring high-precision target detection while meeting real-time requirements, and maintaining high-precision detection and stable navigation control in sunny, cloudy or complex farmland environments.
[0066] In an optional embodiment, the storage and retrieval mechanism can be used to enable each grey squirrel individual to maintain a historical optimal solution memory for storing a plurality of historical optimal solutions, and to refer to the historical optimal solution during individual position updating; the deceptive food caching strategy can be used to generate a pseudo-optimal solution every preset iteration round, and to disturb the current optimal solution with random Gaussian noise around the current optimal solution; and the vigilance cooperation mechanism can be used to trigger global direction resetting when a better solution with fitness higher than that of the current optimal solution is detected.
[0067] In the embodiment of the present application, the storage and retrieval mechanism can be used to enable each individual to maintain a historical optimal solution repository, and to refer to the historical optimal solution with a certain probability each time of updating, so as to accelerate convergence.
[0068] In some embodiments, the storage and retrieval mechanism can enable each grey squirrel individual to maintain a historical optimal solution memory, which can be used to store the optimal solutions of the previous k iterations (k e [3, 7]). When updating the position, the historical optimal solution can be referred to with a probability p e [0.2, 0.4] to further accelerate the convergence process. The position updating formula can be: ; wherein p is the historical optimal solution reference probability, X mem is the historical optimal solution, X i is the position of the i-th grey squirrel individual, AX is the update amount of the individual position, is the updated individual position.
[0069] In the embodiment of the present application, the deceptive food caching mechanism can be used to generate a pseudo-optimal solution every certain number of rounds, to disturb the current optimal solution with random Gaussian noise, to prevent the individual from falling into a local optimum, and to improve the diversity and robustness of the search.
[0070] In some embodiments, the deceptive hoarding mechanism can cause a pseudo-optimal solution to be generated every T (T [5, 15]) iterations, simulate the vicinity of the global optimal solution, and apply Gaussian noise (σ [0.1, 0.3]) in the vicinity of the current global optimal solution, thereby disturbing the current global optimal solution and avoiding falling into a local optimum. Wherein the pseudo-optimal solution is only used to guide the moving direction of the particle, and does not participate in the actual fitness evaluation.
[0071] In the embodiments of the present application, the alert cooperation mechanism can be used to trigger global direction reset when an individual finds a new solution that is more than 5% higher than the current global optimal solution, promote the convergence of the overall population, and improve the stability of the optimization result.
[0072] In some embodiments, the alert cooperation mechanism can cause the entire population to converge to a new solution when an individual finds a new solution that is better than the current global optimal solution (i.e., the fitness difference ΔF between the better solution and the current global optimal solution is greater than or equal to 5%), thereby enhancing the global search capability: ; Wherein, X i is the position of the i-th grey squirrel individual, X alert is the position of the individual that finds a new solution better than the current global optimal solution, r is a random number in the specified range is the updated individual position.
[0073] The embodiments of the present application utilize the ecological behavior of grey squirrels to design a multi-behavior collaborative optimization strategy, including a hoarding and retrieval mechanism, a deceptive hoarding mechanism, and an alert cooperation mechanism to iteratively optimize the population, which is beneficial to improve the global exploration ability and local search efficiency of the search.
[0074] Figure 2 is the process diagram provided by the embodiments of the present application for iteratively optimizing the key hyperparameter combination of the instance segmentation model. Referring to Figure 2 In one specific embodiment, firstly, image data of crop rows in a farmland can be acquired by a multispectral camera, and data augmentation can be performed in combination with dynamic occlusion and light simulation, so as to realize data acquisition and augmentation. Then, key hyperparameters of an instance segmentation model can be mapped into a multi-dimensional position vector of a grey squirrel individual, a multi-objective fitness function that fuses a segmentation intersection-over-union, a real-time frame rate and a computational load can be constructed, so that based on the multi-objective fitness function, the fitness of each grey squirrel individual in the current population can be calculated, and it can be judged whether the current iteration round meets a preset iteration termination condition. In the case of not meeting the iteration termination condition, a hierarchical optimization framework including a caching and retrieval mechanism, a deceptive food caching strategy and a vigilance cooperation mechanism can be designed based on biological behavior characteristics of the grey squirrel, that is, the caching and retrieval mechanism is used to call a historical optimal solution to improve search efficiency, and the deceptive food caching strategy is used to inject a pseudo-solution to break out of a local optimal trap; further, the vigilance cooperation mechanism is introduced, and when a significantly optimized solution is detected, global redirection is triggered to realize iterative update optimization of the current population, so as to iteratively optimize the hyperparameter combination, train the instance segmentation model according to the optimized hyperparameter combination, calculate the individual fitness in the population that is updated and optimized, and continue to judge whether the preset iteration termination condition is met, so that the population is continuously iteratively optimized, the hyperparameter combination is continuously iteratively optimized, and the iteration is terminated until the preset iteration termination condition is met. If the current iteration round meets the preset iteration termination condition, the multi-dimensional position vector of the optimal grey squirrel individual can be output as the optimal hyperparameter combination of the model, so that the instance segmentation model optimized by the optimal hyperparameter combination is obtained. Finally, the optimized instance segmentation model can be deployed to an agricultural machinery embedded system, millimeter-level segmentation of crops and obstacles in a complex farmland scene is realized, real-time segmentation results are output to drive navigation control, and the problem of collaborative optimization of real-time performance, robustness and computational resource constraints of an autonomous driving system in a dynamic farmland environment is effectively solved.
[0075] Compared with the traditional hyperparameter optimization method (such as grid search, genetic algorithm), the application has higher search efficiency, can effectively improve the global exploration ability of hyperparameter search, and reduce the risk of searching into local optimum. The experimental results show that, compared with the genetic algorithm and the particle swarm optimization, the convergence speed is improved, the search iteration number is reduced, the final fitness is improved, and a better hyperparameter combination is obtained. Specifically, the optimized instance segmentation model obtained based on the grey squirrel optimization algorithm performs well in the following multiple indicators: (1) convergence speed: the convergence speed of the instance segmentation model is significantly improved by using the grey squirrel optimization algorithm for model hyperparameter optimization, the search iteration number required for training is reduced, and the convergence speed is improved; (2) segmentation accuracy: the optimized instance segmentation model has a significant improvement in segmentation accuracy and can more accurately identify farmland crops and obstacles; (3) real-time performance: the inference speed is improved, which can meet the real-time response requirements of agricultural machinery during operation; (4) computational complexity: the optimized instance segmentation model greatly reduces the computational complexity and adapts to the low-power embedded hardware platform, ensuring efficient real-time inference.
[0076] Therefore, the hyperparameter optimization method of the instance segmentation model provided by the embodiment of the application not only effectively improves the target detection accuracy in the agricultural machinery automatic driving system, but also significantly reduces the computational burden and adapts to the low-power requirement of the embedded platform; by combining the grey squirrel intelligent optimization algorithm with the agricultural machinery automatic driving technology, the optimization method can be widely applied to agricultural intelligent equipment, and a more efficient, stable and low-power instance segmentation model optimization scheme can be provided for agricultural automation, so that the crop recognition, obstacle detection and automatic navigation control and other operation tasks can be better performed. Moreover, the method can also be applied to other intelligent agricultural equipment, such as unmanned seeding machines and harvesters, to further promote the improvement of agricultural automation, intelligence and precision.
[0077] The agricultural machinery automatic driving device provided by the application will be described below. The agricultural machinery automatic driving device described below can be correspondingly referred to the agricultural machinery automatic driving method described above.
[0078] Figure 3 is a structural schematic diagram of the agricultural machinery automatic driving device provided by the embodiment of the application. Referring to Figure 3 , the embodiment of the application provides an agricultural machinery automatic driving device, which can specifically include the following modules: The image acquisition module 310 is configured to acquire a real-time farmland crop row image. The instance segmentation module 320 is configured to input the real-time farmland crop row image into the optimized instance segmentation model to obtain a real-time segmentation result of crop rows and other instance objects in the farmland, and adjust the automatic driving path of the agricultural machinery based on the real-time segmentation result. The instance segmentation model is optimized by the following modules: The hyperparameter mapping module 330 is configured to map a key hyperparameter combination of the instance segmentation model into a multi-dimensional position vector of the grey squirrel individual, randomly generate a plurality of grey squirrel individuals to obtain an initial population, and the hyperparameter mapping module 330 comprises a hyperparameter mapping unit 331. The iterative optimization module 340 is configured to, in a case where the current iteration round does not satisfy the preset iteration termination condition, perform iterative optimization on the current population based on a caching and retrieval mechanism, a deceptive hoarding mechanism and a vigilance cooperation mechanism of the grey squirrel optimization algorithm. The optimal output module 350 is configured to, in a case where the current iteration round satisfies the preset iteration termination condition, output the multi-dimensional position vector of the optimal grey squirrel individual as an optimal hyperparameter combination, and obtain the instance segmentation model optimized by using the optimal hyperparameter combination.
[0079] The embodiment of the present application optimizes the hyperparameters of the instance segmentation model applied to the agricultural machinery automatic driving scene through the grey squirrel optimization algorithm based on multi-behavior cooperation, simulates the ecological behaviors such as caching and retrieval, deceptive hoarding and vigilance cooperation of the grey squirrel, improves the global exploration ability and local optimization ability of the hyperparameter search, realizes efficient and stable hyperparameter optimization, and is beneficial to improving the real-time performance and accuracy of the instance segmentation model, thereby enhancing the intelligent decision-making ability of the agricultural machinery in the complex farmland environment; the optimized instance segmentation model can be widely applied to the agricultural machinery automatic driving scene, realizes the accurate segmentation of crops and obstacles in the complex farmland scene, thereby not only can accurately identify crop rows, effectively reduce the automatic driving path deviation and improve the seeding and harvesting precision, but also can enhance the real-time detection ability of the obstacles, so that the agricultural machinery can automatically avoid obstacles during the operation process, and improve the automatic driving safety.
[0080] Figure 4 An example of an entity structure diagram of an electronic device is shown in Figure 4As shown, the electronic device can include a processor 410, a communications interface 420, a memory 430, and a communications bus 440, wherein the processor 410, the communications interface 420, and the memory 430 complete mutual communication through the communications bus 440. The processor 410 can invoke a logic instruction in the memory 430 to execute an agricultural machine automatic driving method, which includes: acquiring a real-time crop row image in a farmland; inputting the real-time crop row image in the farmland into an optimized instance segmentation model to obtain a real-time segmentation result of a crop row and other instance objects in the farmland, and adjusting an automatic driving path of an agricultural machine based on the real-time segmentation result; wherein the instance segmentation model is optimized by: mapping a key hyperparameter combination of the instance segmentation model into a multi-dimensional position vector of a chipmunk individual, randomly generating a plurality of chipmunk individuals to obtain an initial population; in a case where a current iteration round does not satisfy a preset iteration termination condition, performing iterative optimization on the current population based on a storage and retrieval mechanism, a deceptive food hoarding mechanism, and a vigilance cooperation mechanism of a chipmunk optimization algorithm; and in a case where the current iteration round satisfies the preset iteration termination condition, outputting the multi-dimensional position vector of the optimal chipmunk individual as an optimal hyperparameter combination, and obtaining the instance segmentation model optimized by using the optimal hyperparameter combination.
[0081] In addition, the logic instruction in the memory 430 described above can be implemented in the form of a software function unit and sold or used as an independent product, and can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application essentially or parts of the prior art that make contributions or parts of the technical solutions can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a plurality of instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the method described in various embodiments of the present application. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various program code storage media.
[0082] In another aspect, the present application also provides a computer program product, which comprises a computer program, the computer program being stored on a non-transitory computer-readable storage medium and executable by a processor to enable a computer to perform the agricultural machinery automatic driving method provided by any of the above methods, the method comprising: acquiring a real-time crop row image in a farmland; inputting the real-time crop row image in the farmland into an optimized instance segmentation model to obtain a real-time segmentation result of crop rows and other instance objects in the farmland, and adjusting an automatic driving path of the agricultural machinery based on the real-time segmentation result; wherein the instance segmentation model is optimized by: mapping a key hyperparameter combination of the instance segmentation model into a multi-dimensional position vector of a grey squirrel individual, randomly generating a plurality of grey squirrel individuals to obtain an initial population; in a case where a current iteration round does not satisfy a preset iteration termination condition, iteratively optimizing the current population based on a caching and retrieval mechanism, a deceptive caching mechanism and a vigilance cooperation mechanism of a grey squirrel optimization algorithm; and in a case where the current iteration round satisfies the preset iteration termination condition, outputting the multi-dimensional position vector of the optimal grey squirrel individual as an optimal hyperparameter combination, and obtaining the instance segmentation model optimized by using the optimal hyperparameter combination.
[0083] In yet another aspect, the present application also provides a non-transitory computer-readable storage medium having a computer program stored thereon, the computer program being executable by a processor to implement the agricultural machinery automatic driving method provided by any of the above methods, the method comprising: acquiring a real-time crop row image in a farmland; inputting the real-time crop row image in the farmland into an optimized instance segmentation model to obtain a real-time segmentation result of crop rows and other instance objects in the farmland, and adjusting an automatic driving path of the agricultural machinery based on the real-time segmentation result; wherein the instance segmentation model is optimized by: mapping a key hyperparameter combination of the instance segmentation model into a multi-dimensional position vector of a grey squirrel individual, randomly generating a plurality of grey squirrel individuals to obtain an initial population; in a case where a current iteration round does not satisfy a preset iteration termination condition, iteratively optimizing the current population based on a caching and retrieval mechanism, a deceptive caching mechanism and a vigilance cooperation mechanism of a grey squirrel optimization algorithm; and in a case where the current iteration round satisfies the preset iteration termination condition, outputting the multi-dimensional position vector of the optimal grey squirrel individual as an optimal hyperparameter combination, and obtaining the instance segmentation model optimized by using the optimal hyperparameter combination.
[0084] The device embodiments described above are merely illustrative, wherein the units described as separate components can or can not be physically separate, and the components displayed as units can or can not be physical units, i.e., can be located in one place, or can be distributed to multiple network units. Part or all of the modules can be selected to achieve the purposes of the embodiments according to actual needs. Those skilled in the art can understand and implement without creative labor.
[0085] Through the description of the above embodiments, those skilled in the art can clearly understand that the embodiments can be realized by means of software and the necessary general hardware platform, and of course can also be realized by hardware. Based on such understanding, the above technical solutions can be embodied in the form of a software product, which can be stored in a computer readable storage medium, such as a ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute the methods described in each embodiment or some parts of the embodiments.
[0086] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: it can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement for part of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for automatic driving of agricultural machinery, characterized in that: include: Get real-time images of crop rows in farmland; Inputting the real-time farmland crop row image into the optimized instance segmentation model to obtain real-time segmentation results of the crop rows and other instance objects in the farmland, so as to adjust the automatic driving path of the agricultural machinery based on the real-time segmentation results; The instance segmentation model is optimized in the following ways: The key hyperparameter combinations of the instance segmentation model are mapped to multi-dimensional position vectors of gray squirrel individuals, and multiple gray squirrel individuals are randomly generated to obtain an initial population. If the current iteration round does not meet the preset iteration termination conditions, the current population is iteratively optimized based on the storage and retrieval mechanism, deceptive food hiding mechanism and alert cooperation mechanism of the gray squirrel optimization algorithm; When the current iteration round meets the preset iteration termination condition, the multi-dimensional position vector of the optimal gray squirrel individual is output as the optimal hyperparameter combination, and an instance segmentation model optimized by using the optimal hyperparameter combination is obtained.
2. The automatic driving method for agricultural machinery according to claim 1, characterized in that: The storage and retrieval mechanism is used to enable each gray squirrel individual to maintain a historical optimal solution memory bank for storing multiple historical optimal solutions, and to refer to the historical optimal solutions during the individual position update process; The deceptive food hiding strategy is used to generate a pseudo-optimal solution every preset iteration round, and to perturb the current optimal solution by applying random Gaussian noise near the current optimal solution; The alert cooperation mechanism is used to trigger a global direction reset when a better solution with a fitness higher than the fitness of the current best solution is detected.
3. The automatic driving method for agricultural machinery according to claim 1, characterized in that: The multiple key hyperparameters of the instance segmentation model include at least learning rate, batch size, anchor box ratio, classification loss weight and regression loss weight; Among them, the learning rate adopts logarithmic uniform sampling; the batch size is a discrete value; the anchor box ratio fluctuates according to a preset floating range based on a preset benchmark value; the classification loss weight is adaptively and dynamically adjusted within a first preset weight range; the regression loss weight is adaptively and dynamically adjusted within a second preset weight range.
4. The automatic driving method for agricultural machinery according to claim 1, characterized in that: The preset iteration termination condition is that the current number of iterations reaches the preset maximum number of iterations or the fitness of the current optimal solution reaches the preset fitness threshold; After randomly generating a plurality of gray squirrel individuals to obtain an initial population, the method further includes: In the current iteration round, based on the multi-objective fitness function, the fitness of each gray squirrel individual in the current population is calculated, and the gray squirrel individual with the highest fitness is determined as the current optimal solution; wherein, the optimization goals of the multi-objective fitness function include improving accuracy, reducing calculation amount and increasing frame rate.
5. The automatic driving method for agricultural machinery according to claim 4, characterized in that: The fitness of each individual gray squirrel in the current population is calculated based on the multi-objective fitness function, including: For each gray squirrel individual in the current population, training the to-be-trained instance segmentation model corresponding to the gray squirrel individual based on the hyperparameter combination mapped by the multidimensional position vector of the gray squirrel individual, to obtain a pre-trained instance segmentation model corresponding to the gray squirrel individual; For each pre-trained instance segmentation model, the fitness of the gray squirrel individual corresponding to the pre-trained instance segmentation model is calculated based on the intersection-over-union ratio of the pre-trained instance segmentation model, the number of frames processed per second by the model, the preset benchmark frame rate, the number of floating-point operations performed per second by the model, and the preset benchmark calculation amount.
6. The automatic driving method for agricultural machinery according to claim 1, characterized in that: The method of acquiring real-time farmland crop row images includes: Obtaining initial crop row images collected by a multispectral camera; Data enhancement is performed on the initial farmland crop row image to obtain a real-time farmland crop row image.
7. An automatic driving device for agricultural machinery, characterized in that: include: An image acquisition module, used to acquire real-time images of crop rows in farmland; an instance segmentation module, configured to input the real-time farmland crop row image into an optimized instance segmentation model to obtain real-time segmentation results of the crop rows and other instance objects in the farmland, so as to adjust the automatic driving path of the agricultural machinery based on the real-time segmentation results; The instance segmentation model is optimized through the following modules: A hyperparameter mapping module is used to map the key hyperparameter combinations of the instance segmentation model into multi-dimensional position vectors of gray squirrel individuals, randomly generate multiple gray squirrel individuals, and obtain an initial population; An iterative optimization module is used to iteratively optimize the current population based on the storage and retrieval mechanism, deceptive food hiding mechanism, and alert cooperation mechanism of the gray squirrel optimization algorithm when the current iteration round does not meet the preset iteration termination conditions; The optimal output module is used to output the multi-dimensional position vector of the optimal gray squirrel individual as the optimal hyperparameter combination when the current iteration round meets the preset iteration termination condition, and obtain an instance segmentation model optimized using the optimal hyperparameter combination.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that: When the processor executes the computer program, the automatic driving method for agricultural machinery as described in any one of claims 1 to 6 is implemented.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the automatic driving method for agricultural machinery as described in any one of claims 1 to 6 is implemented.
10. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the automatic driving method for agricultural machinery as described in any one of claims 1 to 6 is implemented.