Rice leaf age prediction method, device, equipment and medium

By constructing a rice leaf age prediction model using pre-trained ViT model and attention model, and using images and accumulated temperature data for automated prediction, it solves the problem of high human and financial consumption in the existing technology, improves work efficiency and reduces professionalism. Require.

CN118570647APending Publication Date: 2024-08-30北大荒信息有限公司
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202410779439.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-17
Publication Date
2024-08-30

AI Technical Summary

Technical Problem

Existing rice leaf age prediction methods require a large amount of human and financial investment, require high professional knowledge, and are difficult to implement.

Method used

By obtaining leaf age stage rice image data and accumulated temperature and illumination data, a leaf age prediction model using pre-trained ViT model and attention model is constructed, MLP is used for regression prediction, and leaf age value is output to avoid manual labor in the field and improve work. efficiency and reduce professionalism requirements.

Benefits of technology

Automated rice leaf age prediction is realized, reducing manual labor and cost input, improving work efficiency, and reducing professional requirements for staff.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118570647A
    Figure CN118570647A
Patent Text Reader

Abstract

The invention provides a rice leaf age prediction method, device and equipment and a medium, and the method comprises the steps: obtaining image data and accumulated temperature illumination data of rice in a leaf age period; a leaf age prediction model is constructed, the leaf age prediction model uses a pre-trained ViT model to extract leaf age features from leaf age rice image data, uses an attention model to extract accumulated temperature features from accumulated temperature data, splices and combines the leaf age features and the accumulated temperature features, then adopts MLP to perform regression prediction, and outputs a leaf age value prediction result; training the leaf age prediction model by using the leaf age rice image data and the accumulated temperature illumination data to obtain a trained leaf age prediction model; and inputting the leaf age rice image data and accumulated temperature illumination data into a trained leaf age prediction model to predict a leaf age value, so as to solve the problem that the implementation is difficult due to huge consumption of manpower and financial resources and higher professional requirements on workers when obtaining the leaf age of the rice.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of rice leaf age prediction, and in particular to a rice leaf age prediction method, device, equipment and medium. Background Art

[0002] Rice leaf age is an indicator to measure the different stages of rice development. It is an important basis for judging the growth process of rice and the growth appearance of leaves during rice cultivation.

[0003] The existing rice prediction method is to manually go to the fields to conduct on-site surveys of the number and length of rice leaves to obtain the leaf age value of rice, but this requires a lot of manpower, high requirements on personnel's experience and professional knowledge, and requires a high investment cost.

[0004] Therefore, there is an urgent need for a rice leaf age prediction method to solve the technical problems that the existing technology of obtaining rice leaf age consumes huge manpower and financial resources and has high professional requirements for staff, resulting in difficult implementation. Summary of the invention

[0005] In order to overcome the problems existing in the related art, the present disclosure provides a rice leaf age prediction method, device, equipment and medium to solve the technical problem that when obtaining the rice leaf age in the related art, there is a huge consumption of manpower and financial resources and high professional requirements for staff, which makes it difficult to implement.

[0006] One or more embodiments of this specification provide a method for predicting the leaf age of rice, comprising the following steps:

[0007] Obtain rice image data and accumulated temperature and light data at leaf age;

[0008] Constructing a leaf age prediction model, wherein the leaf age prediction model uses a pre-trained ViT model to extract leaf age features from leaf age rice image data, uses an attention model to extract accumulated temperature features from accumulated temperature data, concatenates the leaf age features with the accumulated temperature features, and then uses MLP to perform regression prediction, and outputs a leaf age value prediction result;

[0009] Using the leaf age rice image data and the accumulated temperature and light data to train the leaf age prediction model, and obtaining a trained leaf age prediction model based on the convergence condition training;

[0010] The leaf age rice image data and accumulated temperature and light data are input into the trained leaf age prediction model to predict the leaf age value.

[0011] Preferably, the method further comprises the following steps:

[0012] The learning rates of the Embedding structure and the Transformer Encoder structure in the pre-trained ViT model are adjusted by fine-tuning in deep learning, and the learning rates of the Embedding structure and the Transformer Encoder structure in the fine-tuned ViT model are one percent of those of the MLP head model.

[0013] Preferably, the method further comprises the following steps:

[0014] The mean square error loss function is used as the loss function, and stochastic gradient descent is selected as the optimizer to iteratively optimize the leaf age prediction model.

[0015] Preferably, the optimizer uses a gradient clipping algorithm and a learning rate decay algorithm to iteratively optimize the leaf age prediction model.

[0016] One or more embodiments of the present specification provide a rice leaf age prediction device, comprising:

[0017] A data acquisition module, used to acquire rice image data and accumulated temperature and light data at leaf age;

[0018] A model building module is used to build a leaf age prediction model, wherein the leaf age prediction model uses a pre-trained ViT model to extract leaf age features from leaf age rice image data, uses an attention model to extract accumulated temperature features from accumulated temperature data, concatenates the leaf age features with the accumulated temperature features, and then uses MLP to perform regression prediction, and outputs a leaf age value prediction result;

[0019] A model training module, used for training the leaf age prediction model using the leaf age rice image data and the accumulated temperature and light data, and obtaining a trained leaf age prediction model based on the convergence condition training;

[0020] The leaf age acquisition module is used to input the rice image data and accumulated temperature and light data during the leaf age period into the trained leaf age prediction model to predict the leaf age value.

[0021] Preferably, it also includes a fine-tuning module for adjusting the learning rate of the Embedding structure and the Transformer Encoder structure in the pre-trained ViT model by fine-tuning in deep learning, and the learning rate of the Embedding structure and the Transformer Encoder structure in the fine-tuned ViT model is one percent of that of the MLP head model.

[0022] Preferably, it also includes an optimization module for adopting a mean square error loss function as a loss function and selecting stochastic gradient descent as an optimizer to iteratively optimize the leaf age prediction model.

[0023] Preferably, the optimization module is also used to iteratively optimize the leaf age prediction model by using a gradient clipping algorithm and a learning rate decay algorithm in the optimizer.

[0024] One or more embodiments of the present specification provide a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned rice leaf age prediction method when executing the computer program.

[0025] One or more embodiments of the present specification provide a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above-mentioned method for predicting the leaf age of rice are implemented.

[0026] The present invention provides a rice leaf age prediction method, device, equipment and medium, which have the advantages of forming a data set for leaf age judgment by acquiring rice image data and accumulated temperature and light data at leaf age, and constructing a leaf age prediction model, wherein the leaf age prediction model uses a pre-trained ViT model to extract leaf age features from rice image data at leaf age, and uses an attention model to extract accumulated temperature features from accumulated temperature data, and then uses MLP to perform regression prediction after splicing and combining the leaf age features with the accumulated temperature features, and outputs a leaf age value prediction result, and obtains a model capable of leaf age prediction by training a neural network model with the data set; trains the leaf age prediction model using leaf age rice image data and accumulated temperature and light data; inputs the leaf age rice image data and accumulated temperature and light data into the trained leaf age prediction model to obtain a leaf age value, and can obtain the leaf age value through an AI algorithm, thereby avoiding manual labor in the field, improving work efficiency, reducing investment costs and lowering the requirements for staff. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] In order to more clearly illustrate one or more embodiments of this specification or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0028] Figure 1 A schematic flow chart of a rice leaf age prediction method provided in one or more embodiments of this specification;

[0029] Figure 2 A structural diagram of a ViT model provided for one or more embodiments of this specification;

[0030] Figure 3A structural diagram of a rice leaf age prediction device provided in one or more embodiments of this specification;

[0031] Figure 4 A schematic diagram of the structure of a computer device provided for one or more embodiments of this specification. DETAILED DESCRIPTION

[0032] In order to enable those skilled in the art to better understand the technical solutions in one or more embodiments of this specification, the technical solutions in one or more embodiments of this specification will be clearly and completely described below in conjunction with the drawings in one or more embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on one or more embodiments of this specification, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the protection scope of the present invention.

[0033] The present invention is described in detail below in conjunction with specific implementation methods and the accompanying drawings.

[0034] Method Embodiment

[0035] According to an embodiment of the present invention, a method for predicting the leaf age of rice is provided. Figure 1 FIG. 1 is a schematic flow chart of a rice leaf age prediction method provided in this embodiment. The rice leaf age prediction method according to the embodiment of the present invention comprises the following steps:

[0036] Step S110, obtaining rice image data and accumulated temperature and light data at different leaf ages.

[0037] Leaf age is a physiological and morphological indicator that reflects the growth status of wheat and is an evaluation indicator for monitoring wheat seedlings. Winter wheat is easily affected by many factors during its growth and development, and temperature is the dominant factor affecting the growth and development of winter wheat before wintering. The amount of accumulated temperature determines the length of the winter wheat growth period, which can directly affect the growth and growing season of winter wheat. In a specific example, by fixing photographing equipment in the cold-region rice fields, farm agricultural personnel or equipment can automatically take pictures of the growth status of rice during the leaf age every day, and the obtained pictures are sent back to the back-end server for pre-processing.

[0038] During the preprocessing process, first, the pictures are manually screened to delete flying plastic bags, human hands, and some blurry noise pictures, and then the pictures are cropped into square pictures. For example, if the picture size is 1280*960, then 1280 is converted to 960. The specific cropping method is to reduce the same width on both sides in the same proportion. For example, in the above picture, 1280 is cropped to 960, then 1280-960=320, and 160 is cropped on both sides respectively. Then, the picture is scaled according to the needs of the network structure. In the present invention, it is scaled to 22 Finally, after obtaining a 224*224 size picture, the data augmentation technology is used to expand the picture to form a picture data set. For example, by adjusting the hue, color difference, horizontal or upside down flipping, rotating a certain angle, etc., the accumulated temperature and light data are obtained by setting specific sensors in the cold-region rice fields. The picture data set and the accumulated temperature and light data are batch normalized using the nn.BatchNorm1d function to form the leaf age rice image data and accumulated temperature and light data as the input data set.

[0039] Step S120, construct a leaf age prediction model. The leaf age prediction model uses the pre-trained ViT model to extract leaf age features from leaf age rice image data, uses the attention model to extract accumulated temperature features from accumulated temperature data, and uses MLP to perform regression prediction after splicing and combining the leaf age features and accumulated temperature features. The leaf age value prediction result is output, and the leaf age features are weighted by the accumulated temperature features of the main factors affecting the leaf age of winter wheat to obtain a more accurate predicted leaf age value, such as Figure 2 As shown, it is a structural diagram of the pre-trained ViT model provided in this embodiment.

[0040] Step S130: training a leaf age prediction model using leaf age rice image data and accumulated temperature and light data, and obtaining a trained leaf age prediction model based on convergence condition training.

[0041] Step S140: inputting the leaf age rice image data and the accumulated temperature and light data into the trained leaf age prediction model to predict the leaf age value.

[0042] The method provided in this embodiment forms a data set for leaf age judgment by acquiring rice image data and accumulated temperature and light data at leaf age stage, and constructs a leaf age prediction model. The leaf age prediction model uses a pre-trained ViT model to extract leaf age features from rice image data at leaf age stage, and uses an attention model to extract accumulated temperature features from accumulated temperature data. The leaf age features are spliced ​​and combined with the accumulated temperature features, and then MLP is used for regression prediction to output a leaf age value prediction result. The neural network model is trained by the data set to obtain a model capable of leaf age prediction. The leaf age prediction model is trained by using the leaf age rice image data and accumulated temperature and light data. The leaf age prediction model is input into the trained leaf age prediction model to obtain the leaf age value. The leaf age value can be obtained by an AI algorithm, thereby avoiding manual labor in the field, improving work efficiency, reducing input costs, and lowering the requirements for staff.

[0043] In one embodiment, the following steps are also included:

[0044] S150. The initial leaf age prediction model uses the nn.init.xavier_uniform_ function to initialize the MLP head layer and MLP through data initialization technology. The weights and biases of the pre-trained model are used as the initial values ​​of the leaf age prediction model, which can help the neural network converge faster to ensure that the signal can be evenly propagated between different layers during forward propagation and back propagation.

[0045] In one embodiment, the pre-trained ViT model uses a large amount of data for training and has the ability to extract shallow basic features and deep abstract features. However, there are risks such as model non-convergence, insufficient optimization of parameters, low accuracy, low model generalization ability, and easy overfitting. In addition, for new tasks, training needs to be started from scratch, which requires a large amount of data, computing time, and computing resources. Therefore, the following steps are also included:

[0046] Fine-tuning in deep learning is used to adjust the learning rate of the Embedding structure and Transformer Encoder structure in the pre-trained ViT model. The learning rate of the Embedding structure and Transformer Encoder structure in the fine-tuned ViT model is one percent of that of the MLP head model. The fine-tuning technology saves computing time and resources, improves the accuracy and generalization ability of the model, and avoids overfitting.

[0047] In one embodiment, the leaf age prediction model uses the mean square error loss function as the loss function, and optimizes the regression prediction by comparing the MSE of the predicted leaf age value with the actual leaf age value. In the optimization training process of the regression prediction, the random gradient descent is selected as the optimizer to iteratively optimize the leaf age prediction model. Specifically, when calculating the gradient, the gradient clipping algorithm sets a maximum and minimum value for the calculated gradient in order to prevent gradient explosion and gradient diffusion, so that the gradient is within this range. If it exceeds this range, the gradient is set to the maximum or minimum value. In the process of training optimization, the learning rate decay algorithm sets a learning rate decay method in order to make the learning effect better. Specifically, every 10 or 20 times of learning, the learning rate is reduced to 0.99 times the previous one. Assuming that the initial learning rate is r, after learning 10 or 20 times, the learning rate is 0.99r. The optimizer uses the nn.utils.clip_grad_norm_ function in the gradient clipping algorithm to alleviate gradient diffusion and gradient explosion, and uses the torch.optim.lr_scheduler.StepLR function in the learning rate decay algorithm to ensure the stability of training.

[0048] In one embodiment, the following steps are also included:

[0049] The mean square error loss function is used as the loss function, and stochastic gradient descent is selected as the optimizer to iteratively optimize the leaf age prediction model. The gradient clipping algorithm and learning rate decay algorithm are used in the optimizer to iteratively optimize the leaf age prediction model.

[0050] The method provided in this embodiment alleviates gradient diffusion and gradient explosion through gradient clipping technology during model training, ensures the stability of training through learning rate decay technology, ensures that gradient diffusion and gradient explosion will not occur during training, and has good convergence.

[0051] Device Embodiment

[0052] According to an embodiment of the present invention, a rice leaf age prediction device is provided. Figure 3 As shown, it is a structural diagram of the rice leaf age prediction device provided in this embodiment. The rice leaf age prediction device according to the embodiment of the present invention comprises:

[0053] The data acquisition module 310 is used to acquire rice image data and accumulated temperature and light data at different leaf ages.

[0054] The model building module 320 is used to build a leaf age prediction model. The leaf age prediction model uses the pre-trained ViT model to extract leaf age features from leaf age rice image data, uses the attention model to extract accumulated temperature features from accumulated temperature data, concatenates the leaf age features with the accumulated temperature features, uses MLP to perform regression prediction, and outputs the leaf age value prediction result.

[0055] The model training module 330 is used to train the leaf age prediction model using the leaf age rice image data and the accumulated temperature and light data, and obtain the trained leaf age prediction model based on the convergence condition training.

[0056] The leaf age acquisition module 340 is used to input the rice image data and accumulated temperature and light data during the leaf age period into the trained leaf age prediction model to predict the leaf age value.

[0057] The device provided in this embodiment acquires rice image data and accumulated temperature and light data at leaf age stage through data acquisition module 310 to form a data set for leaf age judgment, and constructs a leaf age prediction model through model construction module 320. The leaf age prediction model uses a pre-trained ViT model to extract leaf age features from rice image data at leaf age stage, and uses an attention model to extract accumulated temperature features from accumulated temperature data. After splicing and combining the leaf age features with the accumulated temperature features, MLP is used for regression prediction, and a leaf age value prediction result is output. A model capable of leaf age prediction is obtained by training a neural network model through the data set; the leaf age prediction model is trained using leaf age rice image data and accumulated temperature and light data through model training module 330, and a trained leaf age prediction model is obtained based on convergence condition training; the leaf age acquisition module 340 inputs the rice image data and accumulated temperature and light data into the trained leaf age prediction model to predict the leaf age value, and the leaf age value can be obtained through an AI algorithm, thereby avoiding manual labor in the field, improving work efficiency, reducing investment costs, and lowering the requirements for staff.

[0058] In one embodiment, a fine-tuning module is also included, which is used to adjust the learning rate of the Embedding structure and the Transformer Encoder structure in the pre-trained ViT model by fine-tuning in deep learning. The learning rate of the Embedding structure and the Transformer Encoder structure in the fine-tuned ViT model is one percent of that of the MLP head model.

[0059] In one embodiment, an optimization module is also included, which is used to use the mean square error loss function as the loss function and select stochastic gradient descent as the optimizer to iteratively optimize the leaf age prediction model.

[0060] In one embodiment, the optimization module is further used to iteratively optimize the leaf age prediction model by using a gradient clipping algorithm and a learning rate decay algorithm in the optimizer.

[0061] The embodiment of the present invention is an apparatus embodiment corresponding to the above-mentioned method embodiment. The specific operations of the processing steps of each module can be understood by referring to the description of the method embodiment, which will not be repeated here.

[0062] like Figure 4As shown, the present invention also provides a computer-readable storage medium having a computer program stored thereon, which implements the rice leaf age prediction in the above embodiment when the computer program is executed by a processor, or implements the rice leaf age prediction method in the above embodiment when the computer program is executed by a processor.

[0063] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in the present application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0064] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device or system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. The device and system embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0065] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the above embodiments, or replace some or all of the technical features therein by equivalents. These modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present invention, and the contents not described in detail in the specification of the present invention belong to the common knowledge of those skilled in the art.

Claims

1. A method for predicting leaf age of rice, characterized in that: The following steps are involved: Obtain rice image data and accumulated temperature and light data at leaf age; Constructing a leaf age prediction model, wherein the leaf age prediction model uses a pre-trained ViT model to extract leaf age features from leaf age rice image data, uses an attention model to extract accumulated temperature features from accumulated temperature data, concatenates the leaf age features with the accumulated temperature features, and then uses MLP to perform regression prediction, and outputs a leaf age value prediction result; Using the leaf age rice image data and the accumulated temperature and light data to train the leaf age prediction model, and obtaining a trained leaf age prediction model based on the convergence condition training; The leaf age rice image data and accumulated temperature and light data are input into the trained leaf age prediction model to predict the leaf age value.

2. The leaf age prediction method according to claim 1, characterized in that: The following steps are also included: Fine-tuning in deep learning is used to adjust the learning rate of the Embedding structure and the Transformer Encoder structure in the pre-trained ViT model. The learning rate of the Embedding structure and the Transformer Encoder structure in the fine-tuned ViT model is one percent of that of the MLP head model.

3. The leaf age prediction method according to claim 1, characterized in that: The following steps are also included: The mean square error loss function is used as the loss function, and stochastic gradient descent is selected as the optimizer to iteratively optimize the leaf age prediction model.

4. The leaf age prediction method according to claim 3, characterized in that: The optimizer adopts a gradient clipping algorithm and a learning rate decay algorithm to iteratively optimize the leaf age prediction model.

5. A rice leaf age prediction device, characterized in that: include: A data acquisition module, used to acquire rice image data and accumulated temperature and light data at leaf age; A model building module is used to build a leaf age prediction model, wherein the leaf age prediction model uses a pre-trained ViT model to extract leaf age features from leaf age rice image data, uses an attention model to extract accumulated temperature features from accumulated temperature data, concatenates the leaf age features with the accumulated temperature features, and then uses MLP to perform regression prediction, and outputs a leaf age value prediction result; A model training module, used for training the leaf age prediction model using the leaf age rice image data and the accumulated temperature and light data, and obtaining a trained leaf age prediction model based on the convergence condition training; The leaf age acquisition module is used to input the rice image data and accumulated temperature and light data during the leaf age period into the trained leaf age prediction model to predict the leaf age value.

6. The leaf age prediction device according to claim 5, characterized in that: It also includes a fine-tuning module for adjusting the learning rate of the Embedding structure and the Transformer Encoder structure in the pre-trained ViT model by fine-tuning in deep learning. The learning rate of the Embedding structure and the Transformer Encoder structure in the fine-tuned ViT model is one percent of that of the MLPhead model.

7. The leaf age prediction device according to claim 5, characterized in that: It also includes an optimization module, which is used to adopt the mean square error loss function as the loss function and select the stochastic gradient descent as the optimizer to iteratively optimize the leaf age prediction model.

8. The leaf age prediction device according to claim 7, characterized in that: The optimization module is also used to iteratively optimize the leaf age prediction model by using a gradient clipping algorithm and a learning rate decay algorithm in the optimizer.

9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method for predicting rice leaf age according to any one of claims 1 to 4 is implemented.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the rice leaf age prediction method according to any one of claims 1 to 4 are implemented.

Citation Information

Cited By

  • Rape development period identification method and device based on multi-modal big data

    CN119418191A

  • Rice seedling condition collaborative prediction method based on environmental data and multi-task deep learning

    CN121636917A

  • Rice leaf age tracking method and system based on time sequence unmanned aerial vehicle image

    CN122289983A