Crop seed phenotypic parameter detection method, device, equipment and medium
By integrating a state-space model with a self-attention mechanism into a deep learning network, the problems of insufficient feature recognition and high computational cost in seed phenotypic parameter detection in existing technologies are solved, achieving high-precision and high-efficiency seed phenotypic detection and meeting the real-time needs of agricultural breeding and seed quality grading.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-02-09
- Publication Date
- 2026-05-19
AI Technical Summary
Among existing seed phenotypic parameter detection technologies, computer vision-based detection technologies can identify few features and perform poorly on complex tasks, while deep learning-based detection technologies require a large amount of computation and cannot meet the needs of modern breeding for phenotypic big data.
A deep learning network that integrates a fusion state-space model (SSM) and a self-attention mechanism, combined with a dual-branch local supplementary branch, is used to achieve three-dimensional feature representation of long-distance sequence association, global spatial association, and local detail features. Through multi-level downsampling and channel expansion design, the computational load is reduced and the detection efficiency is improved.
It achieves high precision, high efficiency, and high adaptability in crop seed phenotyping, meeting the real-time requirements of agricultural breeding and seed quality grading, adapting to the morphological diversity of different varieties and qualities, and maintaining high efficiency in complex lighting and background scenarios.
Smart Images

Figure CN122066680A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of seed screening, and in particular to a method for detecting phenotypic parameters of crop seeds, a corresponding device, electronic equipment, and a computer-readable storage medium. Background Technology
[0002] Seeds are the "chips" of agriculture. Rapid and accurate acquisition and analysis of seed phenotypic information is fundamental to modern crop breeding research and crucial for the precise selection of high-quality seeds. Seed phenotypic detection typically involves collecting and analyzing the morphological, structural, and appearance characteristics of seeds, including their size, shape, color, and surface texture.
[0003] Seed phenotyping technology, as a core support of modern breeding, is undergoing a revolutionary transformation. In recent years, with technological advancements, automated seed phenotyping technology has replaced manual testing. This not only improves testing efficiency but also reduces labor intensity.
[0004] Currently, existing seed phenotypic parameter detection algorithms are mainly based on computer vision detection techniques and deep learning detection techniques, and they mainly have the following technical shortcomings: Firstly, in seed phenotypic parameter detection, computer vision-based detection technology has few identifiable features, performs poorly on complex tasks, and is effective only for single-species seeds, without the ability to transfer learning.
[0005] Secondly, deep learning-based detection technologies involve large computational loads, reduced efficiency, and high requirements for the computational performance of detection equipment, making it difficult to meet the needs of modern breeding for phenotypic big data.
[0006] In summary, given the limitations of existing computer vision-based detection technologies, such as limited identifiable features and poor performance in complex tasks, as well as the high computational requirements of deep learning-based detection technologies that struggle to meet the demands of modern breeding for phenotypic big data, the applicant has undertaken corresponding explorations to address these issues. Summary of the Invention
[0007] The purpose of this application is to solve the above-mentioned problems by providing a method, device, electronic equipment and computer-readable storage medium for detecting phenotypic parameters of crop seeds.
[0008] To achieve the various objectives of this application, the following technical solution is adopted: A method for detecting phenotypic parameters of crop seeds, proposed to meet one of the purposes of this application, includes: Obtain a training sample set, wherein the training sample set includes multiple training samples and their corresponding sample labels, the training samples represent RGB images of crop seeds, and the sample labels represent phenotypic parameters corresponding to the target crop seeds, the phenotypic parameters including the size, shape, color and surface texture features of the target crop seeds; A phenotypic parameter detection model is constructed. A local feature extraction module in the phenotypic parameter detection model is constructed based on a projection backbone network, a first convolutional module, and a first downsampling module connected in sequence. A local feature enhancement and dimension compression module is constructed based on a second convolutional module and a second downsampling module connected in sequence. Based on the first-layer normalization unit, the alternating loop execution of the first state-space model mixer and the first self-attention mechanism module, and the third downsampling module to construct the feature fusion module, based on the sequentially connected second-layer normalization unit, the previous... The second state-space model mixer set in the layer, and the post- The layer configuration includes a second self-attention mechanism module, a two-dimensional average pooling layer, and a linear layer to construct a phenotypic parameter prediction module. The RGB image of the target crop seed containing the target crop seed is input into the phenotypic parameter detection model trained using the training sample set to obtain the phenotypic parameters of the target crop seed, thereby completing the detection of the crop seed phenotypic parameters.
[0009] Optionally, the phenotypic parameter detection model includes a local feature extraction module, a local feature enhancement and dimensionality compression module, a feature fusion module, and a phenotypic parameter prediction module connected in sequence. The projected backbone network consists of two consecutive networks with a step size of 2. Convolutional layers; both the first downsampling module and the second downsampling module include a stride of 2. Convolutional layer; The first state space model mixer, the first self-attention mechanism module, the second state space model mixer, and the second self-attention mechanism module all have a built-in multilayer perceptron. Both the first state-space model mixer and the second state-space model mixer replace the causal convolutional layer with a conventional convolutional layer. Both include a state-space model sequence branch and a non-state-space model local supplementary branch. The state-space model sequence branch includes a first linear layer, a first one-dimensional convolutional layer, a first SiLU activation function layer, and a state-space model layer connected in sequence. The non-state-space model local supplementary branch includes a second linear layer, a second one-dimensional convolutional layer, and a second SiLU activation function layer connected in sequence.
[0010] Optionally, the step of inputting an RGB image of the target crop seed containing the target crop seed into a phenotypic parameter detection model trained using the training sample set to obtain the phenotypic parameters of the target crop seed includes: The local feature extraction module obtains a size of The RGB image of the crop seed to be detected is projected into a C-dimensional embedding space in the projection backbone network to generate a size of [missing information]. The local image patch, wherein the local image patch represents a local pixel patch generated by sliding window sampling, covering the entire RGB image of crop seeds and having pixel overlap in adjacent areas; In the first convolution module, local feature enhancement is performed on the local image patch to preserve the basic morphological features of the local color distribution, edges, and contours of the target crop seed. In the first downsampling module, the resolution of the feature map enhanced by the first convolution module is reduced by half, and the output size is [size missing]. Local feature map.
[0011] Optionally, the step of inputting an RGB image of the target crop seed containing the target crop seed into a phenotypic parameter detection model trained using the training sample set to obtain the phenotypic parameters of the target crop seed includes: The local feature enhancement and dimensionality compression module obtains the size output by the local feature extraction module. Local feature map; The second convolution module further enhances the basic morphological features of the local color distribution, edges, and contours of the target crop seeds. The second downsampling module reduces the resolution of the feature map enhanced by the second convolution module by half, with an output size of [missing value]. The in-depth feature map.
[0012] Optionally, the step of inputting an RGB image of the target crop seed containing the target crop seed into a phenotypic parameter detection model trained using the training sample set to obtain the phenotypic parameters of the target crop seed includes: The feature fusion module receives the size output by the local feature enhancement and dimensionality compression module. The enhanced feature map is normalized in the first layer normalization unit to eliminate feature scale differences. In the state-space model sequence branch of the first state-space model mixer, the first linear layer reduces the dimensionality of the normalized, deepened feature map from the C-dimensional embedding space to... The 1D embedding space, after being processed by the first 1D convolution and the first SiLU activation function layer, captures the long-distance sequence association features of the seed surface texture through the state space model layer; In the non-state-space model local supplementation branch of the first state-space model mixer, the second linear layer reduces the dimensionality of the normalized, deepened feature map from the C-dimensional embedding space to... The 1D embedding space is processed by the second 1D convolution and the second SiLU activation function layer to supplement the local detail features lost by the state space model layer. In the first self-attention mechanism module, a multi-head self-attention mechanism is used to capture the correlation features between the global morphology and local details of the target crop seed, and alternately loops with the first state space model mixer to perform deep fusion of global sequence features and local spatial features. In the third downsampling module, the feature map after alternating cyclic fusion is subjected to resolution compression and channel dimension adjustment, and the output size is [size missing]. The fusion feature map.
[0013] Optionally, the step of inputting an RGB image of the target crop seed containing the target crop seed into a phenotypic parameter detection model trained using the training sample set to obtain the phenotypic parameters of the target crop seed includes: The phenotypic parameter prediction module receives the size output by the feature fusion module. The fused feature map is normalized in the second-layer normalization unit to eliminate feature scale differences; In the state-space model sequence branch of the second state-space model mixer, the first linear layer transfers the normalized fused feature map from... Dimensionality reduction of embedding space to The 1D embedding space, after being processed by the first 1D convolution and the first SiLU activation function layer, captures the long-distance sequence association features of the seed surface texture through the state space model layer; In the non-state-space model local supplement branch of the second state-space model mixer, the second linear layer transfers the normalized fused feature map from... Dimensionality reduction of embedding space to The 1D embedding space is processed by the second 1D convolution and the second SiLU activation function layer to supplement the local detail features lost by the state space model layer. In the first self-attention mechanism module, a multi-head self-attention mechanism is used to capture the deep correlation features between the global morphology and local details of the target crop seed, and to perform deep fusion of global sequence features and local spatial features with the second state space model mixer. After downsampling the feature map after deep fusion, the two-dimensional average pooling layer maps the two-dimensional average pooling features to the phenotypic parameters of the target crop seed through a linear layer, so as to complete the detection of the phenotypic parameters of the crop seed.
[0014] Optionally, the basic network architecture of the phenotypic parameter detection model is a deep learning network that integrates a state-space model and a self-attention mechanism; The target crop seeds include rice seeds or wheat seeds.
[0015] A crop seed phenotypic parameter detection device provided for another purpose of this application includes: The sample set acquisition module is configured to acquire a training sample set, wherein the training sample set includes multiple training samples and their corresponding sample labels. The training samples represent RGB images of crop seeds, and the sample labels represent phenotypic parameters corresponding to the target crop seeds. The phenotypic parameters include the size, shape, color, and surface texture features of the target crop seeds. The first construction module is configured to construct a phenotypic parameter detection model. It constructs a local feature extraction module in the phenotypic parameter detection model based on a projection backbone network, a first convolution module, and a first downsampling module connected in sequence. It constructs a local feature enhancement and dimension compression module based on a second convolution module and a second downsampling module connected in sequence. The second construction module is configured to construct a feature fusion module based on the first-layer normalization unit, the first state-space model mixer executed alternately in a loop, the first self-attention mechanism module, and the third downsampling module, according to the second-layer normalization unit, the first state-space model mixer executed alternately in a loop, the first self-attention mechanism module, and the third downsampling module, in sequence. The second state-space model mixer set in the layer, and the post- The layer configuration includes a second self-attention mechanism module, a two-dimensional average pooling layer, and a linear layer to construct a phenotypic parameter prediction module. The phenotypic parameter detection module is configured to input an RGB image of the target crop seed containing the target crop seed into a phenotypic parameter detection model trained using the training sample set, in order to obtain the phenotypic parameters of the target crop seed and complete the detection of the crop seed phenotypic parameters.
[0016] An electronic device provided for another purpose of this application includes a central processing unit and a memory, the central processing unit being configured to invoke and run a computer program stored in the memory to perform the steps of the crop seed phenotypic parameter detection method of this application.
[0017] A computer-readable storage medium is provided for another purpose of this application, which stores, in the form of computer-readable instructions, a computer program implemented according to the crop seed phenotypic parameter detection method, which, when called by a computer, executes the steps included in the corresponding method.
[0018] Compared to existing technologies, this application addresses the problems of existing computer vision-based detection technologies having few identifiable features and poor performance in complex tasks, as well as the high computational requirements of deep learning-based detection technologies, which make it difficult to meet the needs of modern breeding for phenotypic big data. This application includes, but is not limited to, the following beneficial effects: Firstly, it integrates SSM (State Space Model) and self-attention mechanism, and is equipped with a dual-branch local supplementary branch to realize the three-dimensional feature representation of long-distance sequence association (SSM), global spatial association (self-attention) and local detail features (convolutional branch), comprehensively covering the detection needs of phenotypic parameters such as seed size, shape, color, and texture.
[0019] Secondly, it adopts a hierarchical alternating architecture of state-space model mixer and self-attention mechanism module: SSM efficiently processes long sequences of seed image unfolding with linear complexity, greatly reducing the amount of computation; self-attention is only used in the latter half, accurately capturing the relationship between global shape and local details, avoiding the high complexity of pure self-attention.
[0020] Thirdly, through multi-level downsampling and channel expansion design, the number of channels is doubled while gradually compressing the resolution, achieving an efficient balance between resolution and channels, further improving inference speed, and meeting the real-time requirements of agricultural batch detection.
[0021] Fourth, the sliding window overlapping sampling generates local image patches that cover the entire seed image while preserving edge information, adapting to the morphological diversity of different varieties and qualities of seeds. The multi-head self-attention dynamic weight allocation mechanism can automatically filter background noise and focus on key phenotypic features of seeds, maintaining stable detection even under complex lighting and background scenes.
[0022] This application achieves high precision, high efficiency, high adaptability, and high automation in crop seed phenotypic detection, providing reliable technical support for agricultural breeding, seed quality grading, and other scenarios. Attached Figure Description
[0023] The above and / or additional aspects and advantages of this application will become apparent and readily understood from the following description of the embodiments taken in conjunction with the accompanying drawings, wherein: Figure 1 This is a flowchart illustrating the method for detecting phenotypic parameters of crop seeds in an embodiment of this application. Figure 2This is an exemplary network architecture for a deep learning network that integrates a state-space model and a self-attention mechanism in the embodiments of this application; Figure 3 This is an exemplary network architecture for the state-space model mixer (Mixer block) in the embodiments of this application; Figure 4 This is a diagram illustrating the effect of training parameters of the phenotypic parameter detection model in the embodiments of this application; Figure 5 This is a schematic block diagram of the crop seed phenotypic parameter detection device in the embodiments of this application; Figure 6 This is a schematic diagram of the structure of the computer device in the embodiments of this application. Detailed Implementation
[0024] The embodiments of this application are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain this application, and should not be construed as limiting this application.
[0025] Those skilled in the art will understand that, unless specifically stated otherwise, the singular forms “a,” “an,” “the,” and “the” used herein may also include the plural forms. It should be further understood that the term “comprising” as used in this application means the presence of the stated features, integers, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof. It should be understood that when we say an element is “connected” or “coupled” to another element, it can be directly connected or coupled to the other element, or there may be intermediate elements. Furthermore, “connected” or “coupled” as used herein can include wireless connections or wireless coupling. The term “and / or” as used herein includes all or any units and all combinations of one or more associated listed items.
[0026] Those skilled in the art will understand that, unless otherwise defined, all terms used herein (including technical and scientific terms) have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains. It should also be understood that terms such as those defined in general dictionaries should be understood to have the same meaning as in the context of the prior art, and should not be interpreted in an idealized or overly formal sense unless specifically defined as herein.
[0027] Those skilled in the art will understand that the terms "client," "terminal," and "terminal device" as used herein include both devices that receive wireless signals, devices that only possess wireless signal receiver capabilities without transmission capabilities, and devices with receiving and transmitting hardware, devices that have receiving and transmitting hardware capable of bidirectional communication over a bidirectional communication link. Such devices may include: cellular or other communication devices such as personal computers or tablets, having single-line displays, multi-line displays, or cellular or other communication devices without multi-line displays; PCS (Personal Communications Service) that can combine voice, data processing, fax, and / or data communication capabilities; PDAs (Personal Digital Assistants) that may include radio frequency receivers, pagers, internet / intranet access, web browsers, notebooks, calendars, and / or GPS (Global Positioning System) receivers; and conventional laptops and / or handheld computers or other devices that have and / or include radio frequency receivers. As used herein, "client," "terminal," and "terminal device" can be portable, transportable, installed in a means of transportation (air, sea, and / or land), or suitable and / or configured to operate locally and / or in a distributed manner, operating in any other location on Earth and / or in space. "Client," "terminal," and "terminal device" as used herein can also be a communication terminal, an internet access terminal, or a music / video playback terminal, such as a PDA, a MID (Mobile Internet Device), and / or a mobile phone with music / video playback capabilities, or a smart TV, set-top box, etc.
[0028] The hardware referred to by the names "server," "client," and "service node" in this application is essentially an electronic device with the equivalent capabilities of a personal computer. It is a hardware device with the necessary components revealed by the von Neumann architecture, such as a central processing unit (including an arithmetic logic unit and a control unit), memory, input devices, and output devices. The computer program is stored in its memory, and the central processing unit loads the program stored in the secondary storage into the main memory to run it, execute the instructions in the program, and interact with the input and output devices to complete specific functions.
[0029] It should be noted that the concept of "server" used in this application can also be extended to the case of server clusters. Based on the network deployment principles understood by those skilled in the art, the servers should be logically divided. Physically, these servers can be independent of each other but accessible through interfaces, or they can be integrated into a single physical computer or a computer cluster. Those skilled in the art should understand this flexibility and should not use it to constrain the implementation of the network deployment method in this application.
[0030] One or more of the technical features of this application, unless explicitly specified herein, can be deployed on a server and accessed by a client remotely calling the online service interface provided by the server, or can be directly deployed and run on a client for access.
[0031] Unless otherwise specified, the neural network models referenced or potentially referenced in this application may be deployed on a remote server and invoked remotely on the client, or deployed on a client with the capability to invoke directly. In some embodiments, when running on the client, the corresponding intelligence may be acquired through transfer learning in order to reduce the requirements on the client's hardware resources and avoid excessive consumption of the client's hardware resources.
[0032] Unless otherwise specified, all data involved in this application may be stored remotely on a server or on a local terminal device, as long as it is suitable for use by the technical solution of this application.
[0033] Those skilled in the art will understand that although the various methods in this application are described based on the same concept and thus present commonality among them, they can be performed independently unless otherwise specified. Similarly, the various embodiments disclosed in this application are all based on the same inventive concept; therefore, concepts expressed in the same way, as well as concepts that are appropriately changed for convenience but are expressed differently, should be understood equivalently.
[0034] Unless otherwise expressly stated, the various embodiments disclosed in this application can be combined in a cross-cutting manner to flexibly construct new embodiments, as long as such combination does not depart from the inventive spirit of this application and can meet the needs of the prior art or solve a certain deficiency in the prior art. Those skilled in the art should be aware of such modifications.
[0035] Please see Figure 1 In one embodiment of the crop seed phenotypic parameter detection method of this application, the method includes: Step S10: Obtain a training sample set, wherein the training sample set includes multiple training samples and their corresponding sample labels, the training samples represent RGB images of crop seeds, the sample labels represent phenotypic parameters corresponding to the target crop seeds, and the phenotypic parameters include the size, shape, color and surface texture features of the target crop seeds. The crop seed phenotypic parameter detection system in the terminal device can acquire a training sample set, wherein the training sample set includes multiple training samples and their corresponding sample labels. The training samples represent RGB images of crop seeds, and the sample labels represent the phenotypic parameters corresponding to the target crop seeds. The phenotypic parameters include the size, shape, color, and surface texture features of the target crop seeds. The target crop seeds include rice seeds or wheat seeds.
[0036] Specifically, RGB images of the crop seeds can be acquired using an industrial camera with a dedicated lens. The images should cover samples of different varieties, qualities (e.g., normal seeds, slightly defective seeds), and placement angles to ensure the model's generalization ability. The size feature is a quantified representation of the seed's actual physical size or pixel dimensions, such as pixel area (total number of pixels in the seed image) and the ratio of actual length to actual width (converted using an image scale). The shape feature is quantified based on geometric parameters, such as aspect ratio (ratio of the seed's longest axis to its shortest axis), roundness, and contour complexity (ratio of the number of contour points to the perimeter). The image features are quantized based on image pixel values, such as the RGB channel mean (average pixel values of the R, G, and B channels in the seed region) and HSV space parameters (statistical values of hue (H), saturation (S), and lightness (V), which reflect the uniformity of seed color or abnormal color areas (such as color deviation caused by mold). The surface texture features are quantized based on texture analysis algorithms, such as gray-level co-occurrence matrix parameters (contrast, correlation, and energy) and texture roughness (standard deviation of pixel gray values), which capture details such as the smoothness of the seed surface, spot distribution, and stripe density.
[0037] Step S20: Construct a phenotypic parameter detection model. Construct a local feature extraction module in the phenotypic parameter detection model based on the sequentially connected projection backbone network, the first convolution module, and the first downsampling module. Construct a local feature enhancement and dimensionality compression module based on the sequentially connected second convolution module and the second downsampling module. Please see Figure 2After obtaining the training sample set, a phenotypic parameter detection model is constructed. A local feature extraction module is built based on a sequentially connected projection backbone network, a first convolutional module, and a first downsampling module. A local feature enhancement and dimensionality compression module is built based on a sequentially connected second convolutional module and a second downsampling module. The basic network architecture of the phenotypic parameter detection model is a deep learning network that integrates a state-space model and a self-attention mechanism. The phenotypic parameter detection model includes a sequentially connected local feature extraction module, a local feature enhancement and dimensionality compression module, a feature fusion module, and a phenotypic parameter prediction module. The projection backbone network includes two consecutive convolutional modules with a stride of 2. Convolutional layers; both the first downsampling module and the second downsampling module include a stride of 2. Convolutional layer.
[0038] In some embodiments, a local feature extraction module in the phenotypic parameter detection model is constructed based on a sequentially connected projection backbone network, a first convolutional module, and a first downsampling module. The local feature extraction module includes a sequentially connected projection backbone network, a first convolutional module, and a first downsampling module, which extracts features of size [missing information]. The RGB image of the crop seed is input into the local feature extraction module of the phenotypic parameter detection model. The RGB image is then projected into a C-dimensional embedding space via a projection backbone network (Stem block) to generate a sample of size [missing information]. The overlapping fragments (local image patches) are then processed by the first convolution module (traditional convolution block), and then by the first downsampling module to output an image of size 1. The local feature map, where the projected backbone network (Stem block) consists of two consecutive blocks with a stride of 2. Convolutional (CNN) layers are composed of... The RGB image of crop seeds is projected into a C-dimensional embedding space; the first downsampling module (Downsample block) consists of a step size of 2. The convolutional neural network (CNN) layers reduce the image resolution by half.
[0039] Furthermore, a local feature enhancement and dimensionality compression module is constructed based on a second convolutional module and a second downsampling module connected in sequence. This local feature enhancement and dimensionality compression module includes a second convolutional module and a second downsampling module connected in sequence. The second convolutional module has the same structure as the first convolutional module, and the second downsampling module has the same structure as the first downsampling module, both consisting of a stride of 2. The system consists of convolutional (CNN) layers. The local feature enhancement and dimensionality compression module reduces the size of the output of the local feature extraction module to [value missing]. Local feature maps are processed into The enhanced feature map, wherein the first convolutional module and the second convolutional module process the RGB image of crop seeds using the following calculation formula, which includes: , in, The input feature map of the module; Represents the Gaussian error linear unit activation function; Indicates batch normalization; This represents a convolution kernel with a size of 3×3; This represents the intermediate output feature map.
[0040] , in, This represents the intermediate output feature map; Indicates batch normalization; This represents a convolution kernel with a size of 3×3.
[0041] Step S30: Construct a feature fusion module based on the first layer normalization unit, the alternating loop execution of the first state space model mixer and the first self-attention mechanism module, and the third downsampling module, according to the sequentially connected second layer normalization unit, the first self-attention mechanism module, and the third downsampling module. The second state-space model mixer set in the layer, and the post- The layer configuration includes a second self-attention mechanism module, a two-dimensional average pooling layer, and a linear layer to construct a phenotypic parameter prediction module. The local feature extraction module in the phenotypic parameter detection model is constructed by sequentially connecting the projection backbone network, the first convolutional module, and the first downsampling module. Then, a local feature enhancement and dimensionality compression module is constructed by sequentially connecting the second convolutional module and the second downsampling module. Finally, a feature fusion module is constructed by sequentially connecting the first normalization unit, the alternating loop execution of the first state space model mixer and the first self-attention mechanism module, and the third downsampling module. The second state-space model mixer set in the layer, and the post- The layer configuration includes a second self-attention mechanism module, a two-dimensional average pooling layer, and a linear layer to construct a phenotypic parameter prediction module. Each of the first state-space model mixer, the first self-attention mechanism module, the second state-space model mixer, and the second self-attention mechanism module incorporates a multilayer perceptron. Both the first state-space model mixer and the second state-space model mixer replace causal convolutional layers with conventional convolutional layers. Each includes a state-space model sequence branch and a non-state-space model local supplementary branch. The state-space model sequence branch comprises a first linear layer, a first one-dimensional convolutional layer, a first SiLU activation function layer, and a state-space model layer connected sequentially. The non-state-space model local supplementary branch comprises a second linear layer, a second one-dimensional convolutional layer, and a second SiLU activation function layer connected sequentially.
[0042] In some embodiments, a feature fusion module is constructed based on a first-layer normalization unit, an alternately executed first state-space model mixer and a first self-attention mechanism module, and a third downsampling module. The feature fusion module receives the output size of the local feature enhancement and dimensionality compression module. The image is then processed by a third downsampling module to extract high-level features. This involves fusing the deep features output from the local feature enhancement and dimensionality compression modules, and alternately using the first state-space model mixer block and the first self-attention mechanism block to enhance the correlation modeling of dispersed regions of crop seeds. Finally, the image size is converted to a more detailed representation using the third downsampling module. The first state-space model mixer (Mixer block) not only replaces the causal convolutional layers with regular convolutional layers, but also creates a symmetric path without a state-space model (SSM) layer to determine the local supplementary branch of the non-state-space model, thereby enhancing the modeling of the global context. The first self-attention mechanism module (Self-Attention block) adopts a multi-head self-attention mechanism. Both the first state-space model mixer (Mixer block) and the first self-attention mechanism module (Self-Attention block) have built-in multilayer perceptrons.
[0043] Specifically, the State Space Model (SSM) layer in the first State Space Model Mixer (Mixer block) will handle the one-dimensional continuous input signal. Through learnable hidden states Transform into ,parameter , , The calculation formulas for the continuous-time state-space model (SSM) include: , in, , , , , , Represents the real number field; express 3D real vector space; express 3D real matrix space; express 3D real matrix space; The one-dimensional continuous input signal represents the state-space model (SSM), which characterizes the one-dimensional pixel sequence after the crop seed image is unfolded. Representing the state-space model (SSM) at discrete time points The learnable hidden state, which stores historical information of the input sequence, is the core carrier of SSM to capture long-distance feature associations of the seed (such as global texture distribution); This represents the output signal of the state-space model (SSM), whose feature output after hidden state transition is used for subsequent feature fusion with the local supplementary branches of the non-state-space model; The state transition matrix represents the state space model (SSM), which controls the weighting of historical information in the hidden state and determines how preceding features affect the current state. This represents the input weight matrix of the state-space model (SSM), used to control the current input. For hidden state Contribution weight; This represents the output weight matrix of the State-Space Model (SSM), used to control the hidden states. To output Mapping weights; It represents a continuous-time variable used to describe the dynamic changes of input signals, hidden states, and output signals over time.
[0044] , in, This represents the output weight matrix of the State-Space Model (SSM), used to control the hidden states. To output Mapping weights; Representing the state-space model (SSM) at discrete time points The learnable hidden state, which stores historical information of the input sequence, is the core carrier of SSM to capture long-distance feature associations of the seed (such as global texture distribution); This represents the output signal of the State-Space Model (SSM), whose feature output after hidden state transition is used for subsequent feature fusion with the local supplementary branches of the non-State-Space Model.
[0045] The continuous parameter in the above formula , , This is further converted into discrete parameters. Specifically, assuming a time scale Δ, the discrete parameters can be obtained by applying a zero-order preserved scale. , and For continuous parameters of the state-space model (SSM) , , The calculation formulas for discretization include: , in, It represents the time scale and is used to convert between continuous and discrete parameters; It represents the discretized state transition matrix, retains the continuous state transition logic, and adapts to the discrete feature sequence of the seed image; The state transition matrix represents the state space model (SSM), which controls the weighting of historical information transmission in the hidden states and determines how preceding features affect the current state.
[0046] , in, This represents the discretized input weight matrix; It represents the time scale and is used to convert between continuous and discrete parameters; It represents the discretized state transition matrix, retains the continuous state transition logic, and adapts to the discrete feature sequence of the seed image; Represents the identity matrix; This represents the input weight matrix of the state-space model (SSM), used to control the current input. For hidden state Contribution weight; , in, This represents the output weight matrix after discretization; This represents the output weight matrix of the State-Space Model (SSM), used to control the hidden states. To output Mapping weights.
[0047] Then the formula , This can be expressed using discrete parameters as follows: , , in, Representing the state-space model (SSM) at discrete time points Learnable hidden states.
[0048] In addition, for sizes of The input feature sequence can be used with kernel as The formula is calculated using global convolution. and The output of converts the sequence operations of discrete SSM into equivalent global convolution operations, and its calculation formula is expressed as: , , in, This represents the global convolution kernel, which is composed of discrete parameters of the SSM and is used to perform global convolution on the input sequence to achieve long-distance dependency modeling. The input sequence length represents the length of the one-dimensional feature sequence after the crop seed image is unfolded (e.g., the number of pixels when unfolded by row). The input sequence represents the pixel sequence after the crop seed image is unfolded; The output sequence represents the feature output after global convolution, which is used for subsequent feature fusion. This represents global convolution, used to sum the element-wise product of the input sequence and the global convolution kernel, thus completing long-distance feature extraction; The state transition matrix The exponent indicates the result of... Step-by-step state transitions to capture long-distance dependencies in the input sequence; As can be seen from the above calculation formula, it introduces a selection mechanism that allows for input-dependent sequence processing, which allows for changes in the model's parameters. 、 and It dynamically adjusts based on input and filters out irrelevant information.
[0049] Furthermore, given in the feature fusion module or phenotypic parameter prediction module Layer, front The layer uses a state-space model mixer (Mixer block), while the remaining layers... The layer uses a self-attention mechanism module. Assume the input feature sequence... The sequence length is The embedding dimension is Then the feature fusion module and the phenotypic parameter prediction module are the first... The formula for calculating the layer output is expressed as follows: , , in, Indicates the input feature sequence; The input sequence length represents the length of the one-dimensional feature sequence after the crop seed image is unfolded (e.g., the number of pixels when unfolded by row). The embedding dimension (positive integer) represents the channel dimension of the feature sequence, which represents the length of the feature vector at each position. The current layer index (a positive integer) represents the first layer of the feature fusion module and the phenotypic parameter prediction module. Layer operations; Indicates the first The output features of the layer; For the first The intermediate features of the layer after processing by the state-space model mixer (Mixer block) represent the intermediate results after layer normalization, Mixer block processing and residual connection. Indicates the first The final output features of the layer, after layer normalization, MLP processing and residual connection, are used as the input of the next layer. The representation layer normalizes, and the final features after layer normalization, MLP processing, and residual connection are used as the input for the next layer; This represents a state-space model mixer (Mixer block) with built-in SSM sequence branches and non-SSM local supplementary branches to capture long-range sequence correlations and local details. This refers to a multilayer perceptron, which is used to perform nonlinear transformations and dimensionality adaptations on features to enhance their expressive power. This indicates a residual connection (element-wise addition), used to preserve the original feature information, avoid gradient vanishing in deep networks, and ensure feature integrity. This indicates the total number of layers in the feature fusion module or phenotypic parameter prediction module. The layer uses a state-space model mixer (Mixer block), while the remaining layers... The layer uses a self-attention mechanism module.
[0050] For further details, please refer to Figure 3 State-space model mixer (Mixer block) such as Figure 3As shown, firstly, regular convolutional layers are used to replace causal convolutional layers. This is because replacing causal convolutional layers with regular ones restricts the influence to one direction, which is limiting and unnecessary for visual tasks. Furthermore, a non-SSM local complement branch without SSM is added, consisting of an additional convolutional module and Sigmoid linear unit (SiLU) activations, to compensate for any content lost due to the continuity constraint of SSM. Then, the outputs of the SSM sequence branch and the non-SSM local complement branch are concatenated and projected through the final linear layer, ensuring that the final feature representation combines sequential and spatial information. This leverages the advantages of both the SSM sequence branch and the non-SSM local complement branch. Note that the output of each branch is projected onto a matrix of size [missing information]. In the embedding space, to maintain a similar number of parameters as the original block design, given input The output of the state-space model mixer (Mixer block) can be expressed by the following formula: , , , in, Input features for the module, with dimension . It represents the feature sequence of the seed image after processing by the preceding module. For sequence length, For the embedded dimension; The intermediate features representing the branches of the SSM sequence are the features after passing through a linear layer, a one-dimensional convolutional layer, a SiLU activation function layer, and selective scanning, and are used to capture long-distance sequence associations. The intermediate features representing the non-SSM local supplementary branches are the features after passing through a linear layer, a one-dimensional convolutional layer, and SiLU activation, and are used to supplement local detail information. This represents a linear layer with input dimension . Output dimension Perform dimensional transformation on the features, changing the input dimension. Downgraded to It is compatible with dual-branch parallel processing. This represents a one-dimensional convolution operation, used to extract local spatial relationships of features and enhance feature expressiveness. SiLU activation function is used to perform non-linear transformation on the convolutional features, thereby improving the model's expressive power. This indicates a selective scanning operation that dynamically adjusts SSM parameters to filter out irrelevant information and focus on key seed phenotypic features (such as global texture distribution). This indicates a splicing operation, which combines the two-branch features. Merge and integrate long-distance correlations and local details; The embedding dimension of the input features is represented by the channel dimension of the feature sequence, and the length of the feature vector at each position is represented by the embedding dimension of the input features. This represents the output dimension of the two-branch layer and the input dimension of the linear layer. Downgraded to This ensures that the output dimensions of the two branches are consistent, making them easy to connect. The input sequence length represents the length of the one-dimensional feature sequence after the crop seed image is unfolded (e.g., the number of pixels when unfolded by row). Furthermore, the expression for the multi-head self-attention mechanism is: , in, The self-attention calculation result is weighted by the attention mechanism, and the resulting feature output is used to capture the global correlation of the sequence. This indicates a query. Indicates Key. Indicates Value. To obtain the query-key similarity matrix, calculate the dot product between the query and the key to get the similarity score between each position in the sequence; This is a scaling factor used to scale similarity scores, avoiding scaling due to dimensionality. An excessively large value will cause the Softmax output to saturate; The dimension representing a single attention head, and the feature dimension of each attention head, determines the precision and complexity of attention computation; This represents the Softmax activation function, which converts similarity scores into attention weights between 0 and 1, with the weights summing to 1.
[0051] In some embodiments, in the phenotypic parameter prediction module, the size is... The fused feature map is taken as input and then passed through the state-space model mixer (Mixer block) and self-attention mechanism module (Self-Attention block). Two-dimensional average pooling is then used to downsample the two-dimensional feature map, reducing data dimensionality and preserving key features by calculating the average value of local regions. Finally, a linear layer completes the final prediction task, mapping the two-dimensional average pooled features to the phenotypic parameters of the target crop seed to complete the detection of crop seed phenotypic parameters.
[0052] Step S40: Input the RGB image of the target crop seed containing the target crop seed into the phenotypic parameter detection model trained using the training sample set to obtain the phenotypic parameters of the target crop seed, thereby completing the detection of the crop seed phenotypic parameters.
[0053] Based on the first-layer normalization unit, the alternating loop execution of the first state-space model mixer and the first self-attention mechanism module, and the third downsampling module to construct the feature fusion module, based on the sequentially connected second-layer normalization unit, the previous... The second state-space model mixer set in the layer, and the post- After constructing the phenotypic parameter prediction module by setting the second self-attention mechanism module, the two-dimensional average pooling layer, and the linear layer, the RGB image of the target crop seed containing the target crop seed is input into the phenotypic parameter detection model trained using the training sample set to obtain the phenotypic parameters of the target crop seed, thereby completing the detection of the crop seed phenotypic parameters.
[0054] In some embodiments, please refer to Figure 4 , Figure 4 This is a graph showing the effect of training parameters of the phenotypic parameter detection model.
[0055] In some embodiments, the step of inputting an RGB image of a target crop seed containing the target crop seed into a phenotypic parameter detection model trained using the training sample set to obtain the phenotypic parameters of the target crop seed includes: Step S41: The local feature extraction module obtains a size of... The RGB image of the crop seed to be detected is projected into a C-dimensional embedding space in the projection backbone network to generate a size of [missing information]. The local image patch, wherein the local image patch represents a local pixel patch generated by sliding window sampling, covering the entire RGB image of crop seeds and having pixel overlap in adjacent areas; The size is The RGB image of the crop seeds to be detected is quickly reduced to a smaller size using a projection backbone network. This significantly reduces the computational load of subsequent modules and improves the overall inference speed of the model. The local image patches generated by the sliding window sampling not only cover the entire seed image, but also avoid the loss of edge information through the overlap of pixels in adjacent regions, ensuring that both the overall shape and local details of the seed can be captured.
[0056] Step S42: In the first convolution module, local feature enhancement is performed on the local image block to preserve the basic morphological features of the local color distribution, edges and contours of the target crop seed. The first convolutional module focuses on enhancing basic morphological features such as color distribution, edges, and contours, providing high-quality local feature inputs for subsequent SSM to capture long-distance texture relationships and self-attention modeling of global relationships.
[0057] Step S43: In the first downsampling module, the resolution of the feature map enhanced by the first convolution module is reduced by half, and the output size is [size missing]. Local feature map.
[0058] The first downsampling module reduces the feature map resolution by half again, while doubling the number of channels, resulting in an output size of [missing value]. The local feature map further reduces the computational load while improving the expressive power of the features, achieving an efficient balance between resolution and channels.
[0059] In a further embodiment, the step of inputting an RGB image of a target crop seed containing the target crop seed into a phenotypic parameter detection model trained using the training sample set to obtain the phenotypic parameters of the target crop seed includes: Step S401: The local feature enhancement and dimensionality compression module obtains the size output by the local feature extraction module. Local feature map; The size of the output from the local feature extraction module is The local feature map is further enhanced on the existing basis to avoid feature gaps and ensure the continuity of feature extraction.
[0060] Step S402: The second convolution module further enhances the basic morphological features of the local color distribution, edges, and contours of the target crop seeds. The second convolutional module further enhances the basic morphological features of the seed, such as color distribution, edges, and contours, making the core phenotypic features of the seed (such as shape regularity and color uniformity) more prominent, and providing more accurate local features for subsequent global modeling.
[0061] Step S403: The resolution of the feature map enhanced by the second convolution module is reduced by half through the second downsampling module, with the output size being... The in-depth feature map.
[0062] The second downsampling module reduces the feature map resolution by half again, while doubling the number of channels, with the output size being... The enhanced feature map further reduces computational load and improves inference speed, while enhancing the expressive power of features through channel expansion, achieving an efficient balance between resolution and channels.
[0063] In a further embodiment, the step of inputting an RGB image of a target crop seed containing the target crop seed into a phenotypic parameter detection model trained using the training sample set to obtain the phenotypic parameters of the target crop seed includes: Step S4001: The feature fusion module receives the size output by the local feature enhancement and dimensionality compression module. The enhanced feature map is normalized in the first layer normalization unit to eliminate feature scale differences. Layer normalization eliminates feature scale differences, avoids training instability caused by uneven feature distribution, and allows subsequent Mixer blocks and self-attention blocks to learn feature associations more efficiently.
[0064] Step S4002: In the state space model sequence branch of the first state space model mixer, the first linear layer reduces the normalized and deepened feature map from the C-dimensional embedding space to... The 1D embedding space, after being processed by the first 1D convolution and the first SiLU activation function layer, captures the long-distance sequence association features of the seed surface texture through the state space model layer; The state-space model sequence branch captures long-distance sequence associations of seed surface texture (such as the coherence of stripes from tip to tail), solving the problem of limited receptive field in traditional CNNs; Step S4003: In the non-state space model local supplementation branch of the first state space model mixer, the second linear layer reduces the normalized deepened feature map from the C-dimensional embedding space to... The 1D embedding space is processed by the second 1D convolution and the second SiLU activation function layer to supplement the local detail features lost by the state space model layer. The non-state space model supplements local details (such as small edge depressions or individual spots) that are easily lost in the SSM, achieving complementary features that are both globally coherent and locally accurate.
[0065] Step S4004: In the first self-attention mechanism module, a multi-head self-attention mechanism is used to capture the correlation features between the global morphology and local details of the target crop seed, and alternately loops with the first state space model mixer to perform deep fusion of global sequence features and local spatial features. The Mixer block and the self-attention block alternate in a loop, which ensures the efficiency of long sequence processing and accurately captures the relationship between the global shape and local details of the seed, achieving the optimal balance between speed and accuracy.
[0066] Step S4005: In the third downsampling module, the feature map after alternating cyclic fusion is subjected to resolution compression and channel dimension adjustment, and the output size is [size missing]. The fusion feature map.
[0067] The third downsampling module reduces the feature map resolution to... The number of channels has been expanded to While further reducing the computational load, the feature representation capability is enhanced through channel expansion, providing fusion features with low redundancy and high information density for subsequent phenotypic parameter prediction.
[0068] In a further embodiment, the step of inputting an RGB image of the target crop seed containing the target crop seed into a phenotypic parameter detection model trained using the training sample set to obtain the phenotypic parameters of the target crop seed includes: Step S40001: The phenotypic parameter prediction module receives the size output by the feature fusion module. The fused feature map is normalized in the second-layer normalization unit to eliminate feature scale differences; Step S40002: In the state space model sequence branch of the second state space model mixer, the first linear layer transfers the normalized fused feature map from... Dimensionality reduction of embedding space to The 1D embedding space, after being processed by the first 1D convolution and the first SiLU activation function layer, captures the long-distance sequence association features of the seed surface texture through the state space model layer; Step S40003: In the non-state space model local supplement branch of the second state space model mixer, the second linear layer transfers the normalized fused feature map from... Dimensionality reduction of embedding space to The 1D embedding space is processed by the second 1D convolution and the second SiLU activation function layer to supplement the local detail features lost by the state space model layer. Step S40004: In the first self-attention mechanism module, a multi-head self-attention mechanism is used to capture the deep correlation features between the global morphology and local details of the target crop seed, and to perform deep fusion of global sequence features and local spatial features with the second state space model mixer. Step S40005: After the two-dimensional average pooling layer downsamples the feature map after the deep fusion, the feature map after two-dimensional average pooling is mapped to the phenotypic parameters of the target crop seed through a linear layer to complete the detection of the phenotypic parameters of the crop seed.
[0069] As can be seen from steps S40001 to S40005 above, through normalized stable training, dual-branch feature re-enhancement, self-attention deep fusion, pooling and linear mapping, the final fusion of seed long-distance texture, local details and global morphology and the end-to-end accurate prediction of phenotypic parameters are completed, achieving a dual guarantee of detection efficiency and accuracy.
[0070] As can be seen from the above embodiments, compared with the prior art, this application addresses the problems of existing computer vision-based detection technologies having few identifiable features and poor performance in complex tasks, and deep learning-based detection technologies having high computational requirements for detection equipment, making it difficult to meet the needs of modern breeding for phenotypic big data. This application has, but is not limited to, the following beneficial effects: Firstly, it integrates SSM (State Space Model) and self-attention mechanism, and is equipped with a dual-branch local supplementary branch to realize the three-dimensional feature representation of long-distance sequence association (SSM), global spatial association (self-attention) and local detail features (convolutional branch), comprehensively covering the detection needs of phenotypic parameters such as seed size, shape, color, and texture.
[0071] Secondly, it adopts a hierarchical alternating architecture of state-space model mixer and self-attention mechanism module: SSM efficiently processes long sequences of seed image unfolding with linear complexity, greatly reducing the amount of computation; self-attention is only used in the latter half, accurately capturing the relationship between global shape and local details, avoiding the high complexity of pure self-attention.
[0072] Thirdly, through multi-level downsampling and channel expansion design, the number of channels is doubled while gradually compressing the resolution, achieving an efficient balance between resolution and channels, further improving inference speed, and meeting the real-time requirements of agricultural batch detection.
[0073] Fourth, the sliding window overlapping sampling generates local image patches that cover the entire seed image while preserving edge information, adapting to the morphological diversity of different varieties and qualities of seeds. The multi-head self-attention dynamic weight allocation mechanism can automatically filter background noise and focus on key phenotypic features of seeds, maintaining stable detection even under complex lighting and background scenes.
[0074] This application achieves high precision, high efficiency, high adaptability, and high automation in crop seed phenotypic detection, providing reliable technical support for agricultural breeding, seed quality grading, and other scenarios.
[0075] Please see Figure 5A crop seed phenotypic parameter detection device provided for one of the purposes of this application includes a sample set acquisition module 1100, a first construction module 1200, a second construction module 1300, and a phenotypic parameter detection module 1400. The sample set acquisition module 1100 is configured to acquire a training sample set, wherein the training sample set includes multiple training samples and their corresponding sample labels. The training samples represent RGB images of crop seeds, and the sample labels represent phenotypic parameters corresponding to the target crop seeds. The phenotypic parameters include the size, shape, color, and surface texture features of the target crop seeds. The first construction module 1200 is configured to construct a phenotypic parameter detection model. It constructs a local feature extraction module in the phenotypic parameter detection model based on a sequentially connected projection backbone network, a first convolution module, and a first downsampling module. It constructs a local feature enhancement and dimensionality compression module based on a sequentially connected second convolution module and a second downsampling module. The second construction module 1300 is configured to construct a feature fusion module based on a first-layer normalization unit, an alternately executed first state space model mixer and a first self-attention mechanism module, and a third downsampling module. The second state-space model mixer set in the layer, and the post- The layer is configured with a second self-attention mechanism module, a two-dimensional average pooling layer, and a linear layer to construct a phenotypic parameter prediction module; the phenotypic parameter detection module 1400 is configured to input an RGB image of a target crop seed containing the target crop seed into a phenotypic parameter detection model trained using the training sample set to obtain the phenotypic parameters of the target crop seed, thereby completing the detection of the crop seed phenotypic parameters.
[0076] Based on any embodiment of this application, please refer to Figure 6 Another embodiment of this application also provides an electronic device, which can be implemented by a computer device, such as... Figure 6 The diagram shows the internal structure of a computer device. The computer device includes a processor, a computer-readable storage medium, a memory, and a network interface connected via a system bus. The computer-readable storage medium stores an operating system, a database, and computer-readable instructions. The database may store control information sequences. When the computer-readable instructions are executed by the processor, the processor can implement a method for detecting phenotypic parameters of crop seeds. The processor of the computer device provides computing and control capabilities, supporting the operation of the entire computer device. The memory of the computer device may store computer-readable instructions. When the computer-readable instructions are executed by the processor, the processor can execute the method for detecting phenotypic parameters of crop seeds of this application. The network interface of the computer device is used for communication with a terminal. Those skilled in the art will understand that… Figure 6The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0077] In this embodiment, the processor is used to execute... Figure 5 The specific functions of each module are defined within the device, and the memory stores the program code and various data required to execute these modules. A network interface is used for data transmission between the user terminal and the server. In this embodiment, the memory stores the program code and data required to execute all modules in the crop seed phenotypic parameter detection device of this application, and the server can call the server's program code and data to execute the functions of all modules.
[0078] This application also provides a storage medium storing computer-readable instructions, which, when executed by one or more processors, cause the one or more processors to perform the steps of the crop seed phenotypic parameter detection method described in any embodiment of this application.
[0079] This application also provides a computer program product, including a computer program / instructions, which, when executed by one or more processors, implement the steps of the crop seed phenotypic parameter detection method described in any embodiment of this application.
[0080] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments of this application can be implemented by a computer program instructing related hardware. This computer program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the methods described above. The aforementioned storage medium can be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc.
[0081] The above description is only a partial embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.
Claims
1. A method for detecting phenotypic parameters of crop seeds, characterized in that, include: Obtain a training sample set, wherein the training sample set includes multiple training samples and their corresponding sample labels, the training samples represent RGB images of crop seeds, and the sample labels represent phenotypic parameters corresponding to the target crop seeds, the phenotypic parameters including the size, shape, color and surface texture features of the target crop seeds; A phenotypic parameter detection model is constructed. A local feature extraction module in the phenotypic parameter detection model is constructed based on a projection backbone network, a first convolutional module, and a first downsampling module connected in sequence. A local feature enhancement and dimension compression module is constructed based on a second convolutional module and a second downsampling module connected in sequence. Based on the first-layer normalization unit, the alternating loop execution of the first state-space model mixer and the first self-attention mechanism module, and the third downsampling module to construct the feature fusion module, based on the sequentially connected second-layer normalization unit, the previous... The second state-space model mixer set in the layer, and the post- The layer configuration includes a second self-attention mechanism module, a two-dimensional average pooling layer, and a linear layer to construct a phenotypic parameter prediction module. The RGB image of the target crop seed containing the target crop seed is input into the phenotypic parameter detection model trained using the training sample set to obtain the phenotypic parameters of the target crop seed, thereby completing the detection of the crop seed phenotypic parameters.
2. The method for detecting phenotypic parameters of crop seeds according to claim 1, characterized in that, The phenotypic parameter detection model includes a local feature extraction module, a local feature enhancement and dimensionality compression module, a feature fusion module, and a phenotypic parameter prediction module connected in sequence. The projected backbone network consists of two consecutive networks with a step size of 2. Convolutional layers; both the first downsampling module and the second downsampling module include a stride of 2. Convolutional layer; The first state space model mixer, the first self-attention mechanism module, the second state space model mixer, and the second self-attention mechanism module all have a built-in multilayer perceptron. Both the first state-space model mixer and the second state-space model mixer replace the causal convolutional layer with a conventional convolutional layer. Both include a state-space model sequence branch and a non-state-space model local supplementary branch. The state-space model sequence branch includes a first linear layer, a first one-dimensional convolutional layer, a first SiLU activation function layer, and a state-space model layer connected in sequence. The non-state-space model local supplementary branch includes a second linear layer, a second one-dimensional convolutional layer, and a second SiLU activation function layer connected in sequence.
3. The method for detecting phenotypic parameters of crop seeds according to claim 2, characterized in that, The step of inputting an RGB image of a target crop seed containing the target crop seed into a phenotypic parameter detection model trained using the training sample set to obtain the phenotypic parameters of the target crop seed includes: The local feature extraction module obtains a size of The RGB image of the crop seed to be detected is projected into a C-dimensional embedding space in the projection backbone network to generate a size of [missing information]. The local image patch, wherein the local image patch represents a local pixel patch generated by sliding window sampling, covering the entire RGB image of crop seeds and having pixel overlap in adjacent areas; In the first convolution module, local feature enhancement is performed on the local image patch to preserve the basic morphological features of the local color distribution, edges, and contours of the target crop seed. In the first downsampling module, the resolution of the feature map enhanced by the first convolution module is reduced by half, and the output size is [size missing]. Local feature map.
4. The method for detecting phenotypic parameters of crop seeds according to claim 2, characterized in that, The step of inputting an RGB image of a target crop seed containing the target crop seed into a phenotypic parameter detection model trained using the training sample set to obtain the phenotypic parameters of the target crop seed includes: The local feature enhancement and dimensionality compression module obtains the size output by the local feature extraction module. Local feature map; The second convolution module further enhances the basic morphological features of the local color distribution, edges, and contours of the target crop seeds. The second downsampling module reduces the resolution of the feature map enhanced by the second convolution module by half, with an output size of [missing value]. The in-depth feature map.
5. The method for detecting phenotypic parameters of crop seeds according to claim 2, characterized in that, The step of inputting an RGB image of a target crop seed containing the target crop seed into a phenotypic parameter detection model trained using the training sample set to obtain the phenotypic parameters of the target crop seed includes: The feature fusion module receives the size output by the local feature enhancement and dimensionality compression module. The enhanced feature map is normalized in the first layer normalization unit to eliminate feature scale differences. In the state-space model sequence branch of the first state-space model mixer, the first linear layer reduces the dimensionality of the normalized, deepened feature map from the C-dimensional embedding space to... The 1D embedding space, after being processed by the first 1D convolution and the first SiLU activation function layer, captures the long-distance sequence association features of the seed surface texture through the state space model layer; In the non-state-space model local supplementation branch of the first state-space model mixer, the second linear layer reduces the dimensionality of the normalized, deepened feature map from the C-dimensional embedding space to... The 1D embedding space is processed by the second 1D convolution and the second SiLU activation function layer to supplement the local detail features lost by the state space model layer. In the first self-attention mechanism module, a multi-head self-attention mechanism is used to capture the correlation features between the global morphology and local details of the target crop seed, and alternately loops with the first state space model mixer to perform deep fusion of global sequence features and local spatial features. In the third downsampling module, the feature map after alternating cyclic fusion is subjected to resolution compression and channel dimension adjustment, and the output size is [size missing]. The fusion feature map.
6. The method for detecting phenotypic parameters of crop seeds according to claim 1, characterized in that, The step of inputting an RGB image of a target crop seed containing the target crop seed into a phenotypic parameter detection model trained using the training sample set to obtain the phenotypic parameters of the target crop seed includes: The phenotypic parameter prediction module receives the size output by the feature fusion module. The fused feature map is normalized in the second-layer normalization unit to eliminate feature scale differences; In the state-space model sequence branch of the second state-space model mixer, the first linear layer transfers the normalized fused feature map from... Dimensionality reduction of embedding space to The 1D embedding space, after being processed by the first 1D convolution and the first SiLU activation function layer, captures the long-distance sequence association features of the seed surface texture through the state space model layer; In the non-state-space model local supplement branch of the second state-space model mixer, the second linear layer transfers the normalized fused feature map from... Dimensionality reduction of embedding space to The 1D embedding space is processed by the second 1D convolution and the second SiLU activation function layer to supplement the local detail features lost by the state space model layer. In the first self-attention mechanism module, a multi-head self-attention mechanism is used to capture the deep correlation features between the global morphology and local details of the target crop seed, and to perform deep fusion of global sequence features and local spatial features with the second state space model mixer. After downsampling the feature map after deep fusion, the two-dimensional average pooling layer maps the two-dimensional average pooling features to the phenotypic parameters of the target crop seed through a linear layer, so as to complete the detection of the phenotypic parameters of the crop seed.
7. The method for detecting phenotypic parameters of crop seeds according to any one of claims 1 to 6, characterized in that, The basic network architecture of the phenotypic parameter detection model is a deep learning network that integrates a state-space model and a self-attention mechanism. The target crop seeds include rice seeds or wheat seeds.
8. A device for detecting phenotypic parameters of crop seeds, characterized in that, include: The sample set acquisition module is configured to acquire a training sample set, wherein the training sample set includes multiple training samples and their corresponding sample labels. The training samples represent RGB images of crop seeds, and the sample labels represent phenotypic parameters corresponding to the target crop seeds. The phenotypic parameters include the size, shape, color, and surface texture features of the target crop seeds. The first construction module is configured to construct a phenotypic parameter detection model. It constructs a local feature extraction module in the phenotypic parameter detection model based on a projection backbone network, a first convolution module, and a first downsampling module connected in sequence. It constructs a local feature enhancement and dimension compression module based on a second convolution module and a second downsampling module connected in sequence. The second construction module is configured to construct a feature fusion module based on the first-layer normalization unit, the first state-space model mixer executed alternately in a loop, the first self-attention mechanism module, and the third downsampling module, according to the second-layer normalization unit, the first state-space model mixer executed alternately in a loop, the first self-attention mechanism module, and the third downsampling module, in sequence. The second state-space model mixer set in the layer, and the post- The layer configuration includes a second self-attention mechanism module, a two-dimensional average pooling layer, and a linear layer to construct a phenotypic parameter prediction module. The phenotypic parameter detection module is configured to input an RGB image of the target crop seed containing the target crop seed into a phenotypic parameter detection model trained using the training sample set, in order to obtain the phenotypic parameters of the target crop seed and complete the detection of the crop seed phenotypic parameters.
9. An electronic device comprising a central processing unit and a memory, characterized in that, The central processing unit is used to invoke and run a computer program stored in the memory to perform the steps of the method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, It stores, in the form of computer-readable instructions, a computer program implemented according to any one of claims 1 to 7, which, when invoked by a computer, executes the steps included in the corresponding method.