A method and device for detecting soy sauce ingredients
By using the combination of XL-Net and ResNet18 models in soy sauce component detection, the spectral data sequence and deep convolutional network training are disrupted, the problem of insufficient model learning ability in the existing technology is solved, and the accuracy of soy sauce component detection is significantly improved Sex and reliability.
Patent Information
- Application Number
- CN202111375435.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-19
- Publication Date
- 2024-11-22
- Estimated Expiration
- 2041-11-19
AI Technical Summary
The existing soy sauce component detection methods have limited model learning ability and cannot deeply understand the correlation between spectral data, resulting in the inability to accurately detect liquid content indicators.
The Permutation Language Model in the XL-Net model is used to disrupt the order of spectral data, and the disrupted data is input into the ResNet18 model. The local and macro features of spectral data are extracted through a deep convolution network, and combined with historical data for training. Create preset models to improve detection accuracy.
By disrupting the sequence of spectral data and using deep convolutional networks, the relationship between spectral data can be learned more effectively, the accuracy and reliability of soy sauce component detection can be improved, and the amino acid nitrogen, total acid, salt and OD are significantly improved. The detection accuracy of the indicator.
Smart Images

Figure CN114136895B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of soy sauce component detection, and specifically to a soy sauce component detection method and device. Background Art
[0002] When the spectrum is irradiated onto liquids such as soy sauce, the organic components in them will have a certain absorption of different bands of the spectrum. Finally, the spectrum after passing through the liquid is analyzed to measure the components in the liquid, such as amino acid nitrogen, salt, total acid, and OD indicators.
[0003] In related technologies, the spectrum value is directly regarded as a one-dimensional mathematical vector, and then a simple fully connected neural network (MLP) is used to solve a regression problem. This is equivalent to directly combining all the band information with linear equations and then using nonlinear functions to make the entire network learn nonlinear relationships as much as possible.
[0004] However, the entire model is too simple. It simply combines all the spectral values of different bands into a linear combination and then adds a nonlinear function, which is equivalent to directly combining them all together, ignoring the possibility that there may be certain correlations between different bands. Secondly, the model's learning ability is limited. It cannot learn the deeper correlations between each value of the spectrum and cannot find the real impact of the spectral data on the liquid content index. Summary of the invention
[0005] In view of this, the purpose of the present invention is to overcome the shortcomings of the prior art and provide a soy sauce ingredient detection method and device to solve the problem that the learning ability of the model in the prior art is limited, the deeper correlation between each spectral value cannot be learned, and the real impact of the spectral data on the liquid content index cannot be found.
[0006] According to a first aspect of an embodiment of the present application, a method for detecting soy sauce ingredients is provided, the method comprising:
[0007] Collect soy sauce samples;
[0008] Using lights of different wavelengths to supplement the soy sauce sample;
[0009] collecting the intensity of light of different wavelengths after passing through the soy sauce sample to obtain spectral data;
[0010] The components of the soy sauce sample are obtained according to the spectral data.
[0011] Furthermore, the light of different wavelengths is emitted by multiple OLED lamp beads.
[0012] Furthermore, a receiver is used to collect the intensity of light of different wavelengths after passing through the soy sauce sample.
[0013] Further, obtaining the components of the soy sauce sample according to the spectral data includes:
[0014] Copying the spectral data to obtain N groups of spectral data;
[0015] The order of each group of spectral data is disrupted by using the Permutation Language Model method in the XL-Net model to obtain N*N dimensional spectral data after the order is disrupted;
[0016] Inputting the N*N dimensional spectral data into a preset ResNet18 model to obtain the composition of the soy sauce sample;
[0017] The dimension of each group of spectral data is N, where N is a positive integer.
[0018] Furthermore, the method further comprises:
[0019] The preset ResNet18 model is established.
[0020] Furthermore, the establishment of the preset ResNet18 model includes:
[0021] The preset ResNet18 model is obtained by training with historical N*N dimensional spectral data as input layer training samples of the ResNet18 model and with historical soy sauce sample components as output layer training samples of the ResNet18 model.
[0022] According to a second aspect of an embodiment of the present application, a soy sauce component detection device is provided, the device comprising:
[0023] The first collection module is used to collect soy sauce samples;
[0024] A fill light module, used for emitting light of different wavelengths to fill light for the soy sauce sample;
[0025] A second acquisition module is used to collect the intensity of light of different wavelengths after passing through the soy sauce sample to obtain spectral data;
[0026] The component analysis module is used to obtain the components of the soy sauce sample according to the spectral data.
[0027] In some embodiments, the component analysis module may, but is not limited to, use a single chip microcomputer to implement its functions.
[0028] Furthermore, the fill light module includes: a plurality of OLED lamp beads.
[0029] Furthermore, the second acquisition module adopts a receiver.
[0030] Furthermore, the component analysis module is specifically used for:
[0031] Copying the spectral data to obtain N groups of spectral data;
[0032] The order of each group of spectral data is disrupted by using the Permutation Language Model method in the XL-Net model to obtain N*N dimensional spectral data after the order is disrupted;
[0033] Inputting the N*N dimensional spectral data into a preset ResNet18 model to obtain the composition of the soy sauce sample;
[0034] The dimension of each group of spectral data is N, where N is a positive integer.
[0035] Furthermore, the device also includes:
[0036] A module is established to establish the preset ResNet18 model.
[0037] Furthermore, the establishment module is specifically used for:
[0038] The preset ResNet18 model is obtained by training with historical N*N dimensional spectral data as input layer training samples of the ResNet18 model and with historical soy sauce sample components as output layer training samples of the ResNet18 model.
[0039] The present invention adopts the above technical scheme, and can achieve the following beneficial effects: by collecting soy sauce samples, using light of different wavelengths to supplement the soy sauce samples, collecting the intensity of light of different wavelengths after passing through the soy sauce samples, obtaining spectral data, and obtaining the components of the soy sauce samples according to the spectral data, the relationship between the spectra of different bands can be used to obtain the relationship between the spectra of different bands and the components, thereby improving the accuracy and reliability of soy sauce component detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0041] Figure 1 The figure is a flow chart of a soy sauce ingredient detection method according to an exemplary embodiment.
[0042] Figure 2It is a schematic structural diagram of a soy sauce ingredient detection device according to an exemplary embodiment. DETAILED DESCRIPTION
[0043] To make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be described in detail below. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other implementation methods obtained by ordinary technicians in this field without creative work belong to the scope of protection of the present invention.
[0044] Figure 1 is a flow chart of a soy sauce component detection method according to an exemplary embodiment. Figure 1 As shown, the method can be but is not limited to being used in a terminal, and includes the following steps:
[0045] Step 101: collecting soy sauce samples;
[0046] Step 102: supplementing the soy sauce sample with light of different wavelengths;
[0047] Step 103: collecting the intensity of light of different wavelengths after passing through the soy sauce sample to obtain spectrum data;
[0048] Step 104: Obtain the components of the soy sauce sample according to the spectral data.
[0049] It should be noted that the embodiment of the present invention does not limit the type of wavelength of light, and can be set by those skilled in the art according to experimental data, etc. For example, 22 different wavelengths of light are used to supplement the soy sauce sample.
[0050] A soy sauce component detection method provided by an embodiment of the present invention collects a soy sauce sample, supplements the soy sauce sample with light of different wavelengths, collects the intensity of light of different wavelengths after passing through the soy sauce sample, obtains spectral data, and obtains the components of the soy sauce sample according to the spectral data. The relationship between spectra of different bands can be used to obtain the relationship between spectra of different bands and components, thereby improving the accuracy and reliability of soy sauce component detection.
[0051] Specifically and optionally, light of different wavelengths is emitted by multiple OLED lamp beads.
[0052] Further optionally, a receiver is used to collect the intensity of light of different wavelengths after passing through the soy sauce sample.
[0053] It should be noted that the method of "using a receiver to collect the intensity of light of different wavelengths after passing through a soy sauce sample" involved in the embodiments of the present invention is well known to those skilled in the art, and therefore, its specific implementation method is not described in detail. In some optional embodiments, the receiver can be, but is not limited to, composed of a photodiode, a silicon material, and an indium gallium arsenide material.
[0054] Further optionally, step 104 of obtaining the components of the soy sauce sample according to the spectral data includes:
[0055] Step 1041: copy the spectrum data to obtain N groups of spectrum data;
[0056] It should be noted that when the spectral data is copied, the number of copies is equal to the dimension of the spectral data;
[0057] Step 1042: using the Permutation Language Model method in the XL-Net model to disrupt the order of each set of spectral data, and obtain N*N dimensional spectral data after the order is disrupted;
[0058] Step 1043: inputting the N*N dimensional spectral data into a preset ResNet18 model to obtain the composition of the soy sauce sample;
[0059] The dimension of each set of spectral data is N, where N is a positive integer.
[0060] It is understandable that the convolution modules in the ResNet18 model can extract local features very well, and then the stacked convolution modules can combine local features and learn macroscopic and more abstract features.
[0061] In some embodiments, the component indicators of the soy sauce sample may include, but are not limited to: amino acid nitrogen, salt, total acid and OD.
[0062] It is understandable that the purpose of changing from one dimension to two dimensions and scrambling the order to become two-dimensional is to better adapt to the convolution model used first. Secondly, the order is scrambled to better put non-adjacent spectra together to learn relationships and features, because different positions of the spectrum do not necessarily have relationship features only in adjacent positions, so all possible combination features can be learned as much as possible. Convolution stacking can combine local features to learn global features, while the original method simply linearly combines all spectral values and adds nonlinear functions. In this way, local features cannot be learned at all, let alone further explore the effects brought by local features. It simply explores the surface global features, which is a manifestation of insufficient information mining.
[0063] It should be noted that since the input of ResNet18 is two-dimensional, the one-dimensional spectral data is copied many times, and each copy is recorded in a shuffled arrangement. The purpose is to allow all bands to interact as much as possible when performing convolution in the ResNet18 model, and then proceed layer by layer (because it is a deep convolutional network), gradually aggregate the information of small areas to extract more macroscopic features, and finally further study and mine the relationship between the spectra of each band and their combined features, so as to find the real impact of the spectral data on the liquid content index.
[0064] For example, suppose that 22 different wavelengths of light are used to illuminate a soy sauce sample. After the light passes through the soy sauce, the intensity of the light collected by the receiver is used to obtain spectral data. Then a set of spectral data contains 22 data. Suppose the 22 data are 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22. The Permutation Language Model method in the XL-Net model is used to disrupt the order of each set of spectral data to obtain 22*22 new spectral data and input it into the preset ResNet18 model to obtain the content of salt, OD, total acid or amino acid nitrogen, etc.
[0065] Optionally, the method further includes:
[0066] Step 100: Create a default ResNet18 model.
[0067] Further optionally, step 100 establishes a preset ResNet18 model, including:
[0068] The historical N*N dimensional spectral data are used as the input layer training samples of the ResNet18 model, and the historical soy sauce sample components are used as the output layer training samples of the ResNet18 model to obtain the preset ResNet18 model.
[0069] It should be noted that ResNet18 is a relatively classic deep convolutional network. First, it can learn more abstract features, especially in the field of images. Second, it uses the residual module to transfer gradients well when the network is too deep, avoid gradient disappearance, and make network learning more stable and easier to converge. Therefore, the deep model ResNet18 can further explore higher-level relationships and features.
[0070] In order to further illustrate that the soy sauce component detection method provided in the embodiment of the present invention is more reliable and more accurate in detecting soy sauce components, specific data is also provided, as shown in Table 1:
[0071] Table 1 Comparison of specific data between the embodiments of the present invention and the prior art
[0072] Amino acid nitrogen Total acid (calculated as lactic acid) Salt OD value (650nm) Embodiments of the present invention 0.0671 0.0761 0.6184 0.1294 Fully connected neural network MLP 0.070 0.113 0.827 0.257
[0073] From the error values of the four indicators of amino acid nitrogen, total acid, salt and OD according to the embodiments of the present invention and the prior art method, it can be clearly seen that the soy sauce ingredient detection method provided by the embodiments of the present invention is more accurate.
[0074] A soy sauce component detection method provided by an embodiment of the present invention collects soy sauce samples, supplements the soy sauce samples with light of different wavelengths, photographs the supplemented soy sauce samples to obtain a target image, extracts spectral data in the target image, and obtains the components of the soy sauce sample according to the spectral data. The relationship between spectra of different bands can be used to obtain the relationship between spectra of different bands and components, thereby improving the accuracy and reliability of soy sauce component detection.
[0075] In order to implement the above-mentioned soy sauce component detection method, the embodiment of the present invention also provides a soy sauce component detection device, referring to Figure 2 , the device comprises:
[0076] The first collection module is used to collect soy sauce samples;
[0077] A fill light module is used to emit light of different wavelengths to fill light for the soy sauce sample;
[0078] The second acquisition module is used to collect the intensity of light of different wavelengths after passing through the soy sauce sample to obtain spectral data;
[0079] The component analysis module is used to obtain the components of soy sauce samples based on spectral data.
[0080] Specifically and optionally, the fill light module includes: a plurality of OLED lamp beads.
[0081] Further optionally, the second acquisition module adopts a receiver.
[0082] It can be understood that the intensity of light of different wavelengths after passing through the soy sauce sample is collected by a receiver.
[0083] Further optional, component analysis module, specifically used for:
[0084] The spectral data are copied to obtain N groups of spectral data;
[0085] The Permutation Language Model method in the XL-Net model is used to disrupt the order of each set of spectral data to obtain N*N dimensional spectral data after the order is disrupted;
[0086] Input the N*N dimensional spectral data into the preset ResNet18 model to obtain the composition of the soy sauce sample;
[0087] The dimension of each set of spectral data is N, where N is a positive integer.
[0088] Further optionally, the device also includes:
[0089] Build a module for building the default ResNet18 model.
[0090] Optionally, a module is established, specifically for:
[0091] The historical N*N dimensional spectral data are used as the input layer training samples of the ResNet18 model, and the historical soy sauce sample components are used as the output layer training samples of the ResNet18 model to obtain the preset ResNet18 model.
[0092] The embodiment of the present invention provides a soy sauce component detection method, wherein a soy sauce sample is collected by a first acquisition module, a fill light module uses light of different wavelengths to fill light on the soy sauce sample, a second acquisition module collects the intensity of light of different wavelengths after passing through the soy sauce sample to obtain spectral data, and a component analysis module obtains the components of the soy sauce sample according to the spectral data. The relationship between spectra of different bands can be used to obtain the relationship between spectra of different bands and components, thereby improving the accuracy and reliability of soy sauce component detection.
[0093] It can be understood that the device embodiment provided above corresponds to the method embodiment described above, and the corresponding specific contents can be referenced to each other and will not be repeated here.
[0094] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage and optical storage, etc.) that contain computer-usable program code.
[0095] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or block in the flowchart and / or block diagram and the combination of the processes and / or blocks in the flowchart and / or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0096] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction method, which is implemented in the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0097] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0098] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. A method for detecting soy sauce ingredients, characterized in that: The method comprises: Collect soy sauce samples; Using lights of different wavelengths to supplement the soy sauce sample; collecting the intensity of light of different wavelengths after passing through the soy sauce sample to obtain spectral data; Obtaining the components of the soy sauce sample according to the spectral data includes: Copying the spectral data to obtain N groups of spectral data; The order of each group of spectral data is disrupted by using the Permutation Language Model method in the XL-Net model to obtain N*N dimensional spectral data after the order is disrupted; Inputting the N*N dimensional spectral data into a preset ResNet18 model to obtain the composition of the soy sauce sample; Wherein, the dimension of each group of spectral data is N, and N is a positive integer; Also includes: Establishing the preset ResNet18 model includes: using historical N*N dimensional spectral data as input layer training samples of the ResNet18 model, and using historical soy sauce sample components as output layer training samples of the ResNet18 model for training, to obtain the preset ResNet18 model.
2. The method according to claim 1, characterized in that The lights of different wavelengths are emitted by multiple OLED lamp beads.
3. The method according to claim 1, characterized in that The intensity of light of different wavelengths after passing through the soy sauce sample is collected by a receiver.
4. A soy sauce component detection device, characterized in that: The device comprises: The first collection module is used to collect soy sauce samples; A fill light module, used for emitting light of different wavelengths to fill light for the soy sauce sample; A second acquisition module is used to collect the intensity of light of different wavelengths after passing through the soy sauce sample to obtain spectral data; A component analysis module, used for obtaining the components of the soy sauce sample according to the spectral data; The component analysis module is specifically used for: Copying the spectral data to obtain N groups of spectral data; The order of each group of spectral data is disrupted by using the Permutation Language Model method in the XL-Net model to obtain N*N dimensional spectral data after the order is disrupted; Inputting the N*N dimensional spectral data into a preset ResNet18 model to obtain the composition of the soy sauce sample; Wherein, the dimension of each group of spectral data is N, and N is a positive integer; It is also used to: establish the preset ResNet18 model, including: using historical N*N dimensional spectral data as input layer training samples of the ResNet18 model, and using historical soy sauce sample components as output layer training samples of the ResNet18 model for training, to obtain the preset ResNet18 model.
5. The device according to claim 4, characterized in that The fill light module includes: a plurality of OLED lamp beads.
6. The device according to claim 4, characterized in that The second acquisition module adopts a receiver.
Citation Information
Patent Citations
Method for rapidly detecting content of amino acid nitrogen and total acids by using mid-infrared spectrum
CN108072627A
Method and device for detecting quality of soy sauce
CN109297928A
Portable multi-spectral imaging device based on array sensor chips and application of device
CN109883959A
Hyperspectral abnormal point rapid detection method based on coarse positioning and collaborative representation
CN111986162A
Unsupervised hyperspectral image change detection method based on adversarial learning
CN112784777A
