Meat variety identification method and related apparatus
Patent Information
- Application Number
- CN202611310804.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-27
- Publication Date
- 2026-10-23
AI Technical Summary
[0003]目前,相关技术通常是依赖人工选择特征波段,并采用主成分分析、偏最小二乘判别分析、支持向量机或随机森林等传统化学计量学或机器学习算法,该种方式对肉类的复杂非线性光谱信息的提取能力有限,使得后续肉类品种识别的准确性不尽人意
[0018]本申请的优点和有益效果将在下面的描述中部分给出,部分将从下面的描述中变得明显,或通过本申请的实践了解到:
Smart Images

Figure CN122967264A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of deep learning technology, and in particular to a method and related equipment for identifying meat varieties. Background Technology
[0002] To ensure the authenticity of meat evaluations, meat variety identification has become an essential measure.
[0003] Currently, related technologies typically rely on manually selecting feature bands and employing traditional chemometrics or machine learning algorithms such as principal component analysis, partial least squares discriminant analysis, support vector machines, or random forests. This approach has limited ability to extract complex nonlinear spectral information from meat, resulting in unsatisfactory accuracy in subsequent meat variety identification.
[0004] Therefore, the problems with the relevant technologies still need to be solved and optimized. Summary of the Invention
[0005] The purpose of this invention is to at least partially solve one of the technical problems existing in the related art.
[0006] Therefore, one objective of this invention is to provide a method and related equipment for identifying meat varieties, wherein the method can improve the accuracy of meat variety identification.
[0007] To achieve the above-mentioned technical objectives, the technical solutions adopted in the embodiments of this application include: In a first aspect, embodiments of this application provide a method for identifying meat varieties, including: Obtain unknown meat samples to be identified; The unknown meat sample is input into a trained meat variety recognition model for recognition, and the variety recognition result of the unknown meat sample is obtained. The trained meat variety recognition model is obtained through the following steps: Obtain meat training samples; A multi-view tensor is constructed from the meat training samples to obtain a multi-view spectral tensor; The multi-view spectral tensor is fused using multi-branch encoding to obtain spectral fusion features; Based on the spectral fusion features, the parameters of the initialized meat variety recognition model are updated to obtain the trained meat variety recognition model.
[0008] In addition, the method according to the above embodiments of this application may also have the following additional technical features: Furthermore, in one embodiment of this application, the step of constructing a multi-view tensor from the meat training sample to obtain a multi-view spectral tensor includes: Spectral derivative analysis was performed on the original spectral vector of the meat training sample to obtain the first-order derivative spectral vector; Perform spectral derivative analysis on the first-order derivative spectral vector to obtain the second-order derivative spectral vector; The original spectral vector, the first-order derivative spectral vector, and the second-order derivative spectral vector are stacked by channels to obtain the multi-view spectral tensor.
[0009] Furthermore, in one embodiment of this application, the step of performing multi-branch coding fusion on the multi-view spectral tensor to obtain spectral fusion features includes: Local branch encoding is performed on the multi-view spectral tensor to extract local spectral features; Global branch encoding is performed on the multi-view spectral tensor to obtain global spectral features; Direct branch encoding is performed on the multi-view spectral tensor to extract direct spectral features; The local spectral features, the global spectral features, and the direct spectral features are fused to obtain the spectral fusion features.
[0010] Furthermore, in one embodiment of this application, the step of extracting local branch encoding from the multi-view spectral tensor to obtain local spectral features includes: Obtain local input features, which are the local output features of the multi-view spectral tensor or the output of the previous multi-scale residual block; Parallel convolutional branch extraction is performed on the local input features to obtain a first convolutional feature and a second convolutional feature. The convolutional receptive field corresponding to the first convolutional feature is different from the convolutional receptive field corresponding to the second convolutional feature. Based on the local input features, the first convolutional features and the second convolutional features are residually connected to obtain the local output features of the current multi-scale residual block output.
[0011] Furthermore, in one embodiment of this application, the step of performing global branch encoding extraction on the multi-view spectral tensor to obtain global spectral features includes: The multi-view spectral tensor is subjected to block convolution extraction to obtain several block features; All the block features are input into several cascaded transformer coding layers for transformation coding to obtain the transformation coding features output by the last cascaded transformer coding layer; Attention pooling is performed on the transform-coded features to obtain the global spectral features.
[0012] Furthermore, in one embodiment of this application, the feature fusion of the local spectral features, the global spectral features, and the direct spectral features to obtain the spectral fusion features includes: The local spectral features, the global spectral features, and the direct spectral features are spliced together to obtain spectral splicing features; Gating weight analysis is performed on the spectral splicing features to obtain the local gating weights of the local spectral features, the global gating weights of the global spectral features, and the direct gating weights of the direct spectral features. Based on the local gate weight, the global gate weight, and the direct gate weight, the local spectral features, the global spectral features, and the direct spectral features are fused using gate weights to obtain the spectral fusion features.
[0013] Further, in this embodiment of the application, the step of updating the parameters of the initialized meat variety recognition model based on the spectral fusion features to obtain the trained meat variety recognition model includes: Obtain direct spectral features; The spectral fusion features are subjected to main classification identification to obtain the main classification identification result; The direct spectral features are subjected to auxiliary classification and recognition to obtain auxiliary classification and recognition results; Based on the primary classification recognition result and the secondary classification recognition result, the parameters of the initialized meat variety recognition model are updated to obtain the trained meat variety recognition model.
[0014] Secondly, embodiments of this application provide a meat variety identification system, including: The first processing unit is used to acquire unknown meat samples to be identified; The second processing unit is used to input the unknown meat sample into a trained meat variety recognition model for recognition, and obtain the variety recognition result of the unknown meat sample. The trained meat variety recognition model is obtained through the following steps: Obtain meat training samples; A multi-view tensor is constructed from the meat training samples to obtain a multi-view spectral tensor; The multi-view spectral tensor is fused using multi-branch encoding to obtain spectral fusion features; Based on the spectral fusion features, the parameters of the initialized meat variety recognition model are updated to obtain the trained meat variety recognition model.
[0015] Thirdly, embodiments of this application also provide an electronic device, including: At least one processor; At least one memory for storing at least one program; When the at least one program is executed by the at least one processor, the at least one processor performs the method described above.
[0016] Fourthly, embodiments of this application also provide a computer-readable storage medium storing a processor-executable program, which, when executed by the processor, is used to implement the above-described method.
[0017] Fifthly, embodiments of this application also provide a computer program product, which includes a computer program stored in a computer-readable storage medium. A processor of an electronic device reads the computer program from the computer-readable storage medium and executes the computer program, causing the electronic device to perform the method described above.
[0018] The advantages and beneficial effects of this application will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of this application: This application discloses a method and related equipment for meat variety identification. The method involves acquiring an unknown meat sample to be identified; inputting the unknown meat sample into a trained meat variety identification model for identification, thereby obtaining the variety identification result of the unknown meat sample. The trained meat variety identification model is obtained through the following steps: acquiring meat training samples; constructing a multi-view tensor from the meat training samples to obtain a multi-view spectral tensor; performing multi-branch encoding fusion on the multi-view spectral tensor to obtain spectral fusion features; and updating the parameters of the initialized meat variety identification model based on the spectral fusion features to obtain the trained meat variety identification model. This method, by constructing a multi-view spectral tensor of meat samples and performing multi-branch encoding fusion on the multi-recipe spectral tensor to obtain a trained meat variety identification model, allows the model to fully extract the complex nonlinear spectral information of meat, thereby improving the accuracy of the model in identifying meat varieties. Attached Figure Description
[0019] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the following description is provided with accompanying drawings of the relevant technical solutions in the embodiments of this application or the prior art. It should be understood that the accompanying drawings described below are only for the purpose of clearly illustrating some embodiments of the technical solutions in this application. For those skilled in the art, other drawings can be obtained based on these drawings without any creative effort.
[0020] Figure 1A flowchart illustrating a method for identifying meat varieties provided in an embodiment of this application; Figure 2 This is a schematic diagram of the framework of a meat variety identification system provided in an embodiment of this application; Figure 3 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0021] 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. The step numbers in the following embodiments are set only for ease of explanation, and there is no limitation on the order between the steps. The execution order of each step in the embodiments can be adaptively adjusted according to the understanding of those skilled in the art.
[0022] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit the scope of this application.
[0023] Different types of meat (such as fish, beef, pork, and lamb) vary in flavor, intramuscular fat content, and texture. For ease of understanding, the embodiments of this application will use pork as an example of meat. The content regarding fish, beef, lamb, etc., is similar to the example of pork and can be easily deduced by analogy.
[0024] Currently, related technologies typically rely on manually selecting feature bands and employing traditional chemometrics or machine learning algorithms such as principal component analysis, partial least squares discriminant analysis, support vector machines, or random forests. This approach has limited ability to extract complex nonlinear spectral information from meat, making it difficult to fully utilize the high-dimensional spectral features formed by the combined effects of moisture, fat, protein, myoglobin, and tissue structure in pork. Furthermore, this approach is prone to problems such as decreased recognition accuracy, insufficient stability, and weak generalization ability when the quality and chemical composition of different pork breeds (e.g., rural black pigs, commercial white pigs, and Duroc pigs) are relatively similar, or when samples are affected by complex factors such as slaughter batch, feeding conditions, age, sex, storage time, temperature, and surface condition.
[0025] It should be noted that the aforementioned related technologies are only used to assist in understanding the technical solutions of this application and do not mean that they belong to the publicly disclosed prior art.
[0026] In view of this, embodiments of this application provide a method and related equipment for identifying meat varieties. The method constructs a multi-view spectral tensor for meat samples. Specifically, it analyzes the derivative spectrum of the spectral vector of the meat samples. This method can obtain the derivative spectrum highlighting the slope and curvature transformation while retaining the original spectral vector of the overall reflectance level, reducing the information loss of single preprocessing and thus improving the model's ability to extract complex nonlinear spectral information of meat.
[0027] Furthermore, this method obtains a well-trained meat variety recognition model by performing multi-branch encoding and fusion on the multi-view spectral tensor. This fully utilizes the high-dimensional spectral features of meat, which is beneficial to improving the accuracy, stability, and generalization ability of the model in subsequent recognition. Specifically, it extracts the absorption features of meat to different spectral bands through several multi-scale residual blocks, and establishes correlations between wavelength segments in the spectrum through several transformer encoders, thereby achieving joint modeling of local and global aspects. In addition, it extracts short-path separable information of the multi-view spectral tensor through direct branches (i.e., retains the direct linear or near-linear separable information in the original spectral vector through shorter information paths), which is beneficial to stabilizing the classification and recognition boundary of the model in subsequent stages.
[0028] In addition, this method fuses the spectral features of all branches, specifically by using gated weight fusion to dynamically adjust the contribution weight of each branch. This can reflect the importance changes of local peak shapes and global baselines in meat samples of different varieties, thereby effectively ensuring the model's recognition accuracy, stability, and generalization ability under the influence of complex factors.
[0029] Reference Figure 1 In this embodiment of the application, a method for identifying meat varieties includes: Step 110: Obtain the unknown meat sample to be identified; Step 120: Input the unknown meat sample into the trained meat variety recognition model for recognition, and obtain the variety recognition result of the unknown meat sample; In this embodiment of the application, a pork sample of an unknown breed to be identified can be input into a trained meat breed identification model, and the model can identify the specific breed of the pork sample, which is recorded as the breed identification result.
[0030] The trained meat variety recognition model is obtained through the following steps: Step 130: Obtain meat training samples; In this embodiment of the application, if the meat is pork, the reflectance spectrum of a known breed of pork can be collected by a visible-near infrared spectroscopy device to obtain an original spectral vector arranged in ascending order of wavelength. Then, the original spectral vector and the known breed of pork are determined as the pork training sample.
[0031] Step 140: Construct a multi-view tensor for the meat training sample to obtain a multi-view spectral tensor; In this embodiment of the application, the spectral vectors of meat training samples at different viewpoints can be determined based on the original spectral vectors in the meat training samples, thereby obtaining the multi-view spectral tensor.
[0032] In some embodiments, the construction of a multi-view tensor from the meat training samples to obtain a multi-view spectral tensor includes: Spectral derivative analysis was performed on the original spectral vector of the meat training sample to obtain the first-order derivative spectral vector; Perform spectral derivative analysis on the first-order derivative spectral vector to obtain the second-order derivative spectral vector; The original spectral vector, the first derivative spectral vector, and the second derivative spectral vector are stacked by channels to obtain the multi-view spectral tensor.
[0033] In the embodiments of this application, the derivative of the original spectral vector can be determined by methods such as central difference or Savitzky-Golay local polynomial fitting, thereby obtaining the first derivative spectral vector of the original spectral vector.
[0034] In one feasible implementation, if the original spectral vector contains the spectral intensities of pork at N wavelengths, then the original spectral vector is denoted as... ,in Let be the spectral intensity of pork at the Nth wavelength point of the original spectral vector, where N is a positive integer. The first derivative spectral vector can be expressed as:
[0035] in, is the vector element of the first derivative spectral vector at the j-th wavelength point, which is also the first derivative of the spectral intensity of the original spectral vector at the j-th wavelength point, where j is less than N; and These represent the spectral intensities of the original spectral vector at the (j+1)th and (j-1)th wavelength points, respectively. and These are the wavelength values corresponding to the (j+1)th and (j-1)th wavelength points in the original spectral vector, respectively.
[0036] The second derivative spectral vector can be expressed as:
[0037] in, The vector element of the second derivative spectral vector at the j-th wavelength point is the second derivative of the original spectral vector at the j-th wavelength point. and These are the vector elements of the first derivative spectral vector at the (j+1)th and (j-1)th wavelength points, respectively.
[0038] Understandably, channel stacking can be achieved by stacking the original spectral vector, the first-order derivative spectral vector, and the second-order derivative spectral vector along the channels to obtain a multi-view spectral tensor with a shape size of 3×N.
[0039] Step 150: Perform multi-branch encoding fusion on the multi-view spectral tensor to obtain spectral fusion features; In the embodiments of this application, the multi-view spectral tensor can be encoded and fused through multiple different types of branches to obtain spectral fusion features.
[0040] In some embodiments, the step of performing multi-branch encoding fusion on the multi-view spectral tensor to obtain spectral fusion features includes: Local branch encoding is performed on the multi-view spectral tensor to extract local spectral features; The step of extracting local spectral features by encoding local branches of the multi-view spectral tensor includes: Obtain local input features, which are the local output features of the multi-view spectral tensor or the output of the previous multi-scale residual block; Parallel convolutional branch extraction is performed on the local input features to obtain a first convolutional feature and a second convolutional feature. The convolutional receptive field corresponding to the first convolutional feature is different from the convolutional receptive field corresponding to the second convolutional feature. Based on the local input features, the first convolutional features and the second convolutional features are residually connected to obtain the local output features of the current multi-scale residual block output.
[0041] In this embodiment, local branches can be used to extract features from the multi-view spectral tensor to obtain local spectral features. Specifically, the local branch includes several cascaded multi-scale residual blocks. For the first cascaded multi-scale residual block, its input can be the multi-view spectral tensor; while for the second and more cascaded multi-scale residual blocks, its input can be the local output features of the previous multi-scale residual block. For example, for the third cascaded multi-scale residual block, its local input features are the local output features of the second multi-scale residual block.
[0042] For any multi-scale residual block, parallel convolutional branch extraction can be achieved by outputting local input features to at least two convolutional branches with different receptive fields in the multi-scale residual block. Each convolutional branch processes the local input features to obtain the corresponding convolutional features. For ease of understanding, this embodiment takes a multi-scale residual block including a first convolutional branch and a second convolutional branch with different receptive fields as an example. The first convolutional branch can be a regular convolutional branch composed of convolutional layers with kernel widths of 3, 7, and 15 respectively, and the output of the first convolutional branch is the first convolutional feature. The second convolutional branch can be a dilated convolutional layer with a kernel width of 5 and an inflation rate of 2, and its output is the second convolutional feature. Different receptive fields of the convolutional branches are achieved by using different kernel widths.
[0043] Understandably, residual connections can concatenate the convolutional features output from each convolutional branch along the channel dimension. After normalization, mixing with activation function layers and 1×1 convolutional layers, and processing by a compression-activation module, the residuals are added to the local input features to obtain the local output features of the current multi-scale residual block. It should be noted that for local spectral features, the local output features of the last multi-scale residual block in the cascaded multi-scale residual blocks can be identified as the local spectral features.
[0044] Global branch encoding is performed on the multi-view spectral tensor to obtain global spectral features; The step of extracting global branch encoding from the multi-view spectral tensor to obtain global spectral features includes: The multi-view spectral tensor is subjected to block convolution extraction to obtain several block features; All the block features are input into several cascaded transformer coding layers for transformation coding to obtain the transformation coding features output by the last cascaded transformer coding layer; Attention pooling is performed on the transform-coded features to obtain the global spectral features.
[0045] In this embodiment, one-dimensional convolution can be used to divide the multi-view spectral tensor into blocks, thereby dividing the three-channel spectral lines represented by the multi-view spectral tensor into several partially overlapping or non-overlapping wavelength segments, denoted as block features. The transformer coding layer can be a Transformer Encoder, each transformer coding layer including a multi-head self-attention layer, residual connections, layer normalization, and a feedforward network, which enables any wavelength segment to directly establish a correlation with other segments. Transform coding can involve inputting all block features into cascaded transformer coding layers, establishing dependencies between different wavelength segments through the transformer coding layers, to obtain the transform-coded features output by the last cascaded transformer coding layer. Attention pooling can be performed on the transform-coded features to achieve a weighted average of the transform-coded features, thereby obtaining global spectral features.
[0046] Direct branch encoding is performed on the multi-view spectral tensor to extract direct spectral features; In this embodiment, the direct branch sequentially includes a flattening layer, a linear layer, a layer normalization layer, and a GeLU activation function layer. Direct branch encoding extraction can involve inputting the multi-view spectral vector into the direct branch, flattening the 3×N multi-view spectral vector into a vector of length 3N through the flattening layer, and then processing it through the linear layer, layer normalization layer, and GeLU activation function layer to obtain the direct spectral features. This direct branch has a shorter information path when encoding and extracting the multi-view spectral tensor, effectively preserving the direct linear or near-linear separable information of the spectral lines in the multi-view spectral tensor, which is beneficial for stabilizing the model's classification boundary when the training sample size is limited.
[0047] The local spectral features, the global spectral features, and the direct spectral features are fused to obtain the spectral fusion features.
[0048] The process of fusing the local spectral features, the global spectral features, and the direct spectral features to obtain the spectral fusion features includes: The local spectral features, the global spectral features, and the direct spectral features are spliced together to obtain spectral splicing features; Gating weight analysis is performed on the spectral splicing features to obtain the local gating weights of the local spectral features, the global gating weights of the global spectral features, and the direct gating weights of the direct spectral features. Based on the local gate weight, the global gate weight, and the direct gate weight, the local spectral features, the global spectral features, and the direct spectral features are fused using gate weights to obtain the spectral fusion features.
[0049] In this embodiment, feature stitching can first involve projecting local spectral features and direct spectral features onto the feature space where global spectral features reside, and then performing a stitching (Concat) operation on the local spectral features, direct spectral features, and global spectral features in the same feature space to obtain spectral features.
[0050] Gating weight analysis can be performed by inputting spectral stitching features into a gating network, and outputting local gating weights, global gating weights, and direct gating weights through the gating network. The gating network can include linear layers and softmax activation function layers, and the local gating weights, global gating weights, and direct gating weights are all non-negative numbers, and the sum of the local gating weights, global gating weights, and direct gating weights is 1.
[0051] Understandably, gated weight fusion can be achieved by weighting local spectral features, global spectral features, and direct spectral features based on local gated weights, global gated weights, and direct gated weights, thereby obtaining the spectral fusion feature. This spectral fusion feature can be expressed as:
[0052] in, It is a spectral fusion feature; To control the weight of the department, Local spectral characteristics; For global gating weights, Global spectral characteristics; For direct gating weights, These are direct spectral features.
[0053] Step 160: Update the parameters of the initialized meat variety recognition model based on the spectral fusion features to obtain the trained meat variety recognition model.
[0054] In this embodiment, taking a feature dimension of 96 for the spectral fusion feature as an example, parameter updates can first be achieved by processing the spectral fusion feature through the main classifier in the meat variety recognition model. This main classifier sequentially includes a layer normalization layer, a first dropout layer, a first linear layer, a GeLU activation function layer, a second dropout layer, and a second linear layer. The first linear layer maps the input feature dimension from 96 dimensions to 64 dimensions, while the second linear layer maps the input feature dimension to the dimension of the number of categories that the meat variety recognition model can output, to obtain the main classification score of the model for the spectral fusion feature. Then, a loss function is used to calculate the loss value of the main classification score, and the initialized meat variety recognition model is trained based on the loss value to update the model parameters. The meat variety recognition model includes at least the parallel branch, gating network, and main classifier in step 150. After a certain number of training rounds, a trained meat variety recognition model can be obtained. There are various training methods for the specific model, such as training the model through the backpropagation algorithm, which will not be elaborated here.
[0055] In some embodiments, updating the parameters of the initialized meat variety recognition model based on the spectral fusion features to obtain the trained meat variety recognition model includes: Obtain direct spectral features; The spectral fusion features are subjected to main classification identification to obtain the main classification identification result; The direct spectral features are subjected to auxiliary classification and recognition to obtain auxiliary classification and recognition results; Based on the primary classification recognition result and the secondary classification recognition result, the parameters of the initialized meat variety recognition model are updated to obtain the trained meat variety recognition model.
[0056] In this embodiment, the primary classification result can be the aforementioned primary classification score; the auxiliary classification result can be obtained by inputting direct spectral features into a linear classifier to obtain the primary classification score output by the linear classifier. The parameter update can first be based on the primary and auxiliary classification results, using the weighted cross-entropy loss function and the multiclass maximum margin loss function to calculate the target loss value. Then, the model parameters are updated based on the target loss value to obtain the trained meat variety recognition model. The target loss value can be:
[0057] in, The target loss value; The weighted cross-entropy loss value for the main classification can be calculated by substituting the main classification result into the weighted cross-entropy loss function. The weighted cross-entropy loss value for auxiliary classification can be calculated by substituting the auxiliary classification result into the weighted cross-entropy function; To assist in calculating the multi-class maximum margin loss value, it can be obtained by substituting the auxiliary classification and recognition results into the multi-class maximum margin loss function; and For category weights, The values can be 0.1, 0.2, 0.25, etc. The values can be 0.02, 0.03, 0.05, etc.
[0058] Reference Figure 2 The meat variety identification system proposed in this application includes: The first processing unit 101 is used to acquire unknown meat samples to be identified; The second processing unit 102 is used to input the unknown meat sample into a trained meat variety recognition model for recognition, and obtain the variety recognition result of the unknown meat sample. The trained meat variety recognition model is obtained through the following steps: Obtain meat training samples; A multi-view tensor is constructed from the meat training samples to obtain a multi-view spectral tensor; The multi-view spectral tensor is fused using multi-branch encoding to obtain spectral fusion features; Based on the spectral fusion features, the parameters of the initialized meat variety recognition model are updated to obtain the trained meat variety recognition model.
[0059] It is understood that the content of the above method embodiments is applicable to this system embodiment. The specific functions implemented in this system embodiment are the same as those in the above method embodiments, and the beneficial effects achieved are also the same as those achieved in the above method embodiments.
[0060] Reference Figure 3 This application also provides an electronic device, including: At least one processor 201; At least one memory 202 is used to store at least one program; When the at least one program is executed by the at least one processor 201, the at least one processor 201 implements the method embodiment described above.
[0061] Similarly, it can be understood that the content of the above method embodiments is applicable to this device embodiment. The specific functions implemented by this device embodiment are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0062] This application also provides a computer-readable storage medium storing a program executable by a processor 201, which, when executed by the processor 201, is used to implement the above-described method embodiments.
[0063] Similarly, the content of the above method embodiments is applicable to the present computer-readable storage medium embodiments. The specific functions implemented by the present computer-readable storage medium embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0064] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps in the above-described method embodiments.
[0065] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. 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 methods.
[0066] In some alternative embodiments, the functions / operations mentioned in the block diagrams may not occur in the order shown in the operation diagrams. For example, depending on the functions / operations involved, two consecutively shown blocks may actually be executed substantially simultaneously, or the blocks may sometimes be executed in reverse order. Furthermore, the embodiments presented and described in the flowcharts of this application are provided by way of example to provide a more comprehensive understanding of the technology. The disclosed methods are not limited to the operations and logic flows presented herein. Alternative embodiments are contemplated in which the order of various operations is changed and sub-operations described as part of a larger operation are executed independently.
[0067] Furthermore, although this application is described in the context of functional modules, it should be understood that, unless otherwise stated to the contrary, one or more of the functions and / or features may be integrated into a single physical device and / or software module, or one or more functions and / or features may be implemented in a separate physical device or software module. It is also understood that a detailed discussion of the actual implementation of each module is unnecessary for understanding this application. Rather, given the properties, functions, and internal relationships of the various functional modules in the apparatus disclosed herein, the actual implementation of the module will be understood within the scope of conventional technology for an engineer. Therefore, those skilled in the art can implement the application set forth in the claims using ordinary techniques without excessive experimentation. It is also understood that the specific concepts disclosed are merely illustrative and not intended to limit the scope of this application, which is determined by the full scope of the appended claims and their equivalents.
[0068] If a function is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods in the embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0069] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-including system, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device.
[0070] More specific examples (a non-exhaustive list) of computer-readable media include: electrical connections (electronic devices) having one or more wires, portable computer disk drives (magnetic devices), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Furthermore, computer-readable media can even be paper or other suitable media on which programs can be printed, because programs can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, interpreting, or otherwise processing as necessary, and then stored in computer memory.
[0071] It should be understood that various parts of this application can be implemented using hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented using software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.
[0072] In the foregoing description of this specification, the references to terms such as "one embodiment," "another embodiment," or "some embodiments," etc., indicate that a specific feature, structure, material, or characteristic described in connection with an embodiment or example is included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.
[0073] Although embodiments of this application have been shown and described, those skilled in the art will understand that various changes, modifications, substitutions and variations can be made to these embodiments without departing from the principles and spirit of this application, the scope of which is defined by the claims and their equivalents.
[0074] The above is a detailed description of the preferred embodiments of this application, but this application is not limited to the embodiments. Those skilled in the art can make various equivalent modifications or substitutions without departing from the spirit of this application, and these equivalent modifications or substitutions are all included within the scope defined by the claims of this application.
Claims
1. A method for identifying meat varieties, characterized in that, include: Obtain unknown meat samples to be identified; The unknown meat sample is input into a trained meat variety recognition model for recognition, and the variety recognition result of the unknown meat sample is obtained. The trained meat variety recognition model is obtained through the following steps: Obtain meat training samples; A multi-view tensor is constructed from the meat training samples to obtain a multi-view spectral tensor; The multi-view spectral tensor is fused using multi-branch encoding to obtain spectral fusion features; Based on the spectral fusion features, the parameters of the initialized meat variety recognition model are updated to obtain the trained meat variety recognition model.
2. The method according to claim 1, characterized in that, The construction of a multi-view tensor from the meat training samples to obtain a multi-view spectral tensor includes: Spectral derivative analysis was performed on the original spectral vector of the meat training sample to obtain the first-order derivative spectral vector; Perform spectral derivative analysis on the first-order derivative spectral vector to obtain the second-order derivative spectral vector; The original spectral vector, the first derivative spectral vector, and the second derivative spectral vector are stacked by channels to obtain the multi-view spectral tensor.
3. The method according to claim 1, characterized in that, The process of performing multi-branch encoding fusion on the multi-view spectral tensor to obtain spectral fusion features includes: Local branch encoding is performed on the multi-view spectral tensor to extract local spectral features; Global branch encoding is performed on the multi-view spectral tensor to obtain global spectral features; Direct branch encoding is performed on the multi-view spectral tensor to extract direct spectral features; The local spectral features, the global spectral features, and the direct spectral features are fused to obtain the spectral fusion features.
4. The method according to claim 3, characterized in that, The step of extracting local spectral features by encoding local branches of the multi-view spectral tensor includes: Obtain local input features, which are the local output features of the multi-view spectral tensor or the output of the previous multi-scale residual block; Parallel convolutional branch extraction is performed on the local input features to obtain a first convolutional feature and a second convolutional feature. The convolutional receptive field corresponding to the first convolutional feature is different from the convolutional receptive field corresponding to the second convolutional feature. Based on the local input features, the first convolutional features and the second convolutional features are residually connected to obtain the local output features of the current multi-scale residual block output.
5. The method according to claim 3, characterized in that, The step of extracting global branch encoding from the multi-view spectral tensor to obtain global spectral features includes: The multi-view spectral tensor is subjected to block convolution extraction to obtain several block features; All the block features are input into several cascaded transformer coding layers for transformation coding to obtain the transformation coding features output by the last cascaded transformer coding layer; Attention pooling is performed on the transform-coded features to obtain the global spectral features.
6. The method according to claim 3, characterized in that, The process of fusing the local spectral features, the global spectral features, and the direct spectral features to obtain the spectral fusion features includes: The local spectral features, the global spectral features, and the direct spectral features are spliced together to obtain spectral splicing features; Gating weight analysis is performed on the spectral splicing features to obtain the local gating weights of the local spectral features, the global gating weights of the global spectral features, and the direct gating weights of the direct spectral features. Based on the local gate weight, the global gate weight, and the direct gate weight, the local spectral features, the global spectral features, and the direct spectral features are fused using gate weights to obtain the spectral fusion features.
7. The method according to any one of claims 1-6, characterized in that, The step of updating the parameters of the initialized meat variety recognition model based on the spectral fusion features to obtain the trained meat variety recognition model includes: Obtain direct spectral features; The spectral fusion features are subjected to main classification identification to obtain the main classification identification result; The direct spectral features are subjected to auxiliary classification and recognition to obtain auxiliary classification and recognition results; Based on the primary classification recognition result and the secondary classification recognition result, the parameters of the initialized meat variety recognition model are updated to obtain the trained meat variety recognition model.
8. A meat variety identification system, characterized in that, include: The first processing unit is used to acquire unknown meat samples to be identified; The second processing unit is used to input the unknown meat sample into a trained meat variety recognition model for recognition, and obtain the variety recognition result of the unknown meat sample. The trained meat variety recognition model is obtained through the following steps: Obtain meat training samples; A multi-view tensor is constructed from the meat training samples to obtain a multi-view spectral tensor; The multi-view spectral tensor is fused using multi-branch encoding to obtain spectral fusion features; Based on the spectral fusion features, the parameters of the initialized meat variety recognition model are updated to obtain the trained meat variety recognition model.
9. An electronic device, characterized in that, include: At least one processor; At least one memory for storing at least one program; When the at least one program is executed by the at least one processor, the at least one processor performs the method as described in any one of claims 1-7.
10. A computer-readable storage medium storing a processor-executable program, characterized in that, The processor-executable program, when executed by the processor, is used to implement the method as described in any one of claims 1-7.