Cracked egg nondestructive testing method based on Transform network
Through the Transformer network method, combining the sound of poultry egg knocking and hyperspectral signals to feature fusion, the efficiency and accuracy of poultry egg crack detection is solved, and the automated detection of machine vision is realized, replacing manual detection, and ensuring the quality of poultry eggs.
Patent Information
- Application Number
- CN202510715525.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-30
- Publication Date
- 2025-08-01
AI Technical Summary
In the prior art, poultry egg crack detection relies on manual testing, which is time-consuming and labor-intensive, and is seriously wasted, making it difficult to achieve efficient and accurate non-destructive testing.
Using a method based on Transformer network, combining the knocking sound signal of poultry eggs and visible near-infrared hyperspectral signals, the poultry egg crack detection is performed through feature fusion and pre-trained models, and machine vision is used instead of manual judgment.
It improves the efficiency and accuracy of crack detection of poultry eggs, avoids waste of resources from manual inspection, and realizes automatic high-efficiency quality assurance.
Smart Images

Figure CN120405059A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of machine vision, and in particular to a non-destructive detection method for cracked eggs based on a Transformer network. Background Art
[0002] In recent years, with the rapid development of machine vision-related technologies and the great improvement in the performance of various hardware devices, image detection and processing technologies have been widely used in almost all industries and even in people's daily lives, playing an increasingly important role. It is to study the use of computers to automatically process a large amount of perceptual information (including sound, images, videos, etc.) instead of people, to solve the problem that the resolution ability of the human visual organs is easily affected by factors such as environment, emotion, and fatigue, so as to partially replace manual labor and greatly improve production efficiency. At present, almost all egg production is in an industrial production mode in a concentrated state, which results in the complexity and difficulty of manually distinguishing whether eggs have cracks on a huge quantity basis. Manual distinction will surely be time-consuming, laborious, and waste a large amount of resources. Summary of the Invention
[0003] The purpose of the present invention is to design a non-destructive detection method for cracked eggs based on a Transformer network in view of the deficiencies of the prior art. By applying machine vision technology to egg crack detection, it realizes the extension of machine vision to the human eye, making it have the judgment ability of the human brain to a certain extent, and replacing manual distinction of whether there are egg cracks in an automated manner to ensure the quality of eggs.
[0004] To achieve the above object, the present invention provides the following technical solutions: On the one hand, a non-destructive detection method for cracked eggs based on a Transformer network is provided, including the following steps: The purpose of the present invention is to design a non-destructive detection method for cracked eggs with a small purpose based on a Transformer network in view of the deficiencies of the prior art. By applying machine vision technology to egg crack inspection, it realizes the extension of machine vision to the human eye, making it have the judgment ability of the human brain to a certain extent, and replacing manual distinction of whether there are egg cracks in an automated manner to ensure the quality of eggs.
[0005] On the one hand, the present patent provides a non-destructive detection method for cracked eggs based on a Transformer network, including the following steps: Step 1: Collect the sound signal V1 of the currently tapped egg and the visible and near-infrared hyperspectral signal H1 of the currently inspected egg; Step 2: Preprocess the sound signal V1 and hyperspectral signal H1 of the egg to form a first sound signal and a first hyperspectral signal corresponding to the sound signal V1; Step 3: Perform format conversion on the first sound sequence corresponding to the first sound signal V1 and the first hyperspectral signal to form a first sound sequence and a first hyperspectral sequence that conform to the Transformer input format; Step 4: Input the first sound sequence and the first hyperspectral sequence that conform to the Transformer input format into the Transformer for pre-training; Step 5: Input the sound signal and the hyperspectral signal after the Transformer pre-training into the fully connected layer respectively for dimensional transformation to form a second sound sequence and a second hyperspectral sequence; Step 6: Perform cross-modal feature fusion on the second sound sequence and the second hyperspectral sequence after dimensional transformation to form a fusion signal; Step 7: Input the fusion signal into the Transformer for training to output a judgment result on whether there is a crack in the poultry egg.
[0006] Preferably, in the said Step 1, the acquisition of the current sound signal V1 of the tapped poultry egg includes: Step 11: Apply an excitation to the poultry egg through a tapping head to generate a sound signal, and collect the sound signal V1 through a microphone.
[0007] Preferably, in the said Step 1, the acquisition of the visible and near-infrared hyperspectral signal H1 of the current poultry egg includes: Step 12: Use a tungsten halogen lamp or an LED light source to provide a light source to excite the spectral signal of the poultry egg; Step 13: Collect the spectrum in a dark box environment through a spectrometer covering the visible and near-infrared spectral ranges to obtain the visible and near-infrared hyperspectral signal H1.
[0008] Preferably, in the said Step 2, the preprocessing of the sound signal V1 of the poultry egg to form a first sound signal includes: Step 211: Perform filtering processing on the sound signal V1 of the poultry egg to improve the sound signal quality; Step 212: Use Fourier transform or short-time Fourier transform to convert the filtered sound signal from the time domain to the frequency domain to extract the frequency characteristics of the sound signal.
[0009] Preferably, in the said Step 2, the preprocessing of the hyperspectral signal H1 to form a first hyperspectral signal includes: Step 221: Use median filtering on the near-infrared hyperspectral signal H1 to remove the noise of the hyperspectral signal; Step 222: Identify the absorption peak position of the hyperspectral signal after noise processing and extract its parameters, and the parameters include the wavelength position, absorption depth, and full width at half maximum of the absorption peak.
[0010] Preferably, in the step 3, the format conversion of the first sound sequence corresponding to the first sound signal V1 to form the first sound sequence includes: Step 311: Generate a spectrogram corresponding to the first sound signal V1 according to the Fourier transform or short-time Fourier transform result; Step 312: Perform normalization processing on the spectrogram; Step 313: Convert the two-dimensional spectrogram into a one-dimensional sequence, and use embedding representation to convert each element in the sequence into a numerical sequence; Step 314: Use positional encoding (such as sine / cosine positional embedding) to add positional information to each input element to achieve positional encoding.
[0011] Preferably, in the step 3, the format conversion of the first hyperspectral signal to form the first hyperspectral sequence includes: Step 321: Combine the extracted absorption peak parameters into a feature vector; Step 322: Perform normalization processing on the extracted feature vector; Step 323: Encode the normalized feature vector into an embedding vector acceptable to the Transformer model; Step 324: Use the positional encoding vector generated by sine and cosine functions to add positional information to the embedding vector to achieve positional encoding.
[0012] Preferably, in the step 4, The sound-specific Transformer model processes the input first sound sequence through the self-attention mechanism and the feed-forward neural network, and outputs a series of state vectors Vector1 corresponding to the sound signal; The spectrum-specific Transformer model processes the input first sound sequence through the self-attention mechanism and the feed-forward neural network, and outputs a series of state vectors Vector2 corresponding to the hyperspectral signal.
[0013] Preferably, in the step 5, a fully connected layer is added as the output layer to the outputs of the sound-specific Transformer model and the spectrum-specific Transformer model, and the fully connected layer is used to perform dimensionality reduction processing on the extracted sound feature vector and hyperspectral feature vector.
[0014] Preferably, in the step 6, it includes the following: Step 61: Calculate the correlation score between the state vector of the sound signal and the hyperspectral state vector through the cross-attention mechanism, and fuse the features according to the score.
[0015] On the other hand, the present invention also provides a system and an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of a detection method as described above are implemented.
[0016] In summary, compared with the prior art, the present invention has the following beneficial effects: The non-destructive detection method provided by the present invention features the fusion of the sound signal of tapping eggs, visible and near-infrared spectral signals, and the input of the fused features into the Transformer network model for training to output a judgment result on whether the eggs have cracks. This detection method for cracked eggs based on the Transformer network model greatly improves the non-destructive detection efficiency and accuracy of cracked eggs, avoiding the waste of resources caused by manual detection. By applying machine vision technology to egg crack detection, the expansion of machine vision to the human eye is realized, endowing it with the judgment ability of the human brain to a certain extent, and replacing manual discrimination of egg cracks in an automated manner to ensure the quality of eggs. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 It is the overall flowchart of a non-destructive detection method for cracked eggs based on the Transformer network provided in this embodiment; Figure 2 It is a spectral acquisition system provided in this embodiment; DETAILED DESCRIPTION OF THE EMBODIMENTS The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0018] Embodiment 1 As Figure 1 shown, this embodiment provides a non-destructive detection method for cracked eggs based on the Transformer network. As Figure 1 shown, it includes the following steps: Step 1: Collect the current sound signal V1 of tapping the egg and collect the visible and near-infrared hyperspectral signal H1 of the current egg; In step 1, an impact is applied to the poultry egg by knocking its head to generate a sound signal, and the sound signal V1 is collected by a microphone. For the specific steps of collecting the sound signal V1 of knocking the poultry egg, refer to Patent CN116858947A, a crack detection method in a salted egg pickling production line. Based on the STM32 and arduino control systems, the control system takes one on-off cycle as one period and one impact. When the poultry egg passes through, the control system will give the electromagnet (2) a short-term power-on pulse state. The magnetic pole of the permanent magnet (4) is opposite to that of the electromagnet (2) when it is powered on. The knocking head V6_P2 (7) will move downward under the repulsive force to knock the poultry egg; when the electromagnet (2) is powered off, the electromagnet (2) loses its magnetism. At this time, it is subjected to the opposite torsion force of the torsion spring (11), and the knocking head V6_P2 (7) returns to its original position. The knocking head V6_P2 (7) from giving an impact to the poultry egg to the end is one cycle. When the knocking head V6_P2 (7) gives an impact to the poultry egg, a sound signal will be generated, and the sound signal will be collected by the microphone (15). In this way, the collection of the sound signal of knocking the poultry egg is realized.
[0019] In step 1, the acquisition of the visible and near-infrared hyperspectral signal H1 of the current poultry egg includes: using a tungsten halogen lamp or an LED light source to provide a light source to excite the spectral signal of the poultry egg; collecting the spectrum in a dark box environment through a spectrometer covering the visible and near-infrared spectral ranges to obtain the visible and near-infrared hyperspectral signal H1. In order to be able to collect the hyperspectral signal, it is necessary to first build a spectral acquisition system. The acquisition system is as Figure 2 shown. The acquisition system includes a computer, a spectrometer, a dark box, a light source, a bracket, a stage, and a poultry egg. For the specific connection relationship of each component in the system, refer to Figure 2 . The specific acquisition steps are as follows: Step 1, turn the brightness of the light source to 0% non-luminous state through the knob of the light source controller. In this embodiment, the light source uses a tungsten halogen lamp or an LED light source. Open the SPECSUITE software and confirm that the spectrometer is successfully connected. Set the acquisition mode of the spectrometer to "spectral intensity" and adjust the acquisition parameters; Step 2, close the dark box door, collect the dark spectrum and save it; Step 3, turn the light source brightness to 100% and preheat for half an hour. Then continuously reduce the light source brightness until the peak of the spectral curve reaches 50000 and stop, collect the reference spectrum and save it; Step 4, set the acquisition mode of the spectrometer to "transmission", and turn the light source brightness back to 100%; Step 5, open the dark box door, place the poultry egg on the placement platform and close the door, and collect the transmission spectrum of the sample.
[0020] Step 2, preprocess the sound signal V1 and hyperspectral signal H1 of the poultry egg to form a first sound signal and a first hyperspectral signal corresponding to the sound signal V1; In step 2, the preprocessing of the sound signal V1 of the poultry egg to form the first sound signal includes: filtering the sound signal V1 of the poultry egg to improve the sound signal quality; using Fourier transform or short-time Fourier transform to convert the filtered sound signal from the time domain to the frequency domain to extract the frequency characteristics of the sound signal. Taking the short-time Fourier transform as an example, the time-domain signal can be converted into a spectrogram representing two-dimensional time-frequency to capture its frequency characteristics.
[0021] In step 2, the preprocessing of the hyperspectral signal H1 to form the first hyperspectral signal includes: using median filtering on the near-infrared hyperspectral signal H1 to remove the noise of the hyperspectral signal; identifying the absorption peak positions of the hyperspectral signal after noise processing and extracting its parameters, where the parameters include the wavelength position, absorption depth, and full width at half maximum of the absorption peak. In this step, when there is a crack in the poultry egg, the optical properties of the surface of the poultry egg will change. Specifically, the crack will cause changes in the light absorption and reflection characteristics of the poultry eggshell, resulting in specific absorption peaks or reflection peaks appearing in the spectral curve. These changes can be detected by hyperspectral imaging technology. The positions and intensities of these characteristic peaks are related to factors such as the severity and position of the crack and the material of the poultry eggshell. Therefore, the characteristics of the hyperspectral signal can be used to assist in judging whether there is a crack in the poultry egg. In order to characterize the characteristics of the absorption peaks of the hyperspectral signal of the poultry egg, in this embodiment, the wavelength position, absorption depth, and full width at half maximum of the absorption peak are selected to characterize the spectral characteristics.
[0022] Step 3: Perform format conversion on the first sound signal corresponding to the first sound signal V1 and the first hyperspectral signal to form a first sound sequence and a first hyperspectral sequence that conform to the input format of Transformer; In step 3, the format conversion of the first sound signal corresponding to the first sound signal V1 to form a first sound sequence that conforms to the input format of Transformer includes the following steps: generating a spectrogram corresponding to the first sound signal V1 according to the Fourier transform or short-time Fourier transform result; performing normalization processing on the spectrogram. This normalization processing can adopt the linear normalization processing method. Specifically, first calculate the minimum energy value and the maximum energy value in the spectrogram, and then apply the normalization formula to each energy value E in the spectrogram Perform calculations to obtain a normalized spectrogram. In this way, all energy values will be scaled to the range of [0, 1]. Read the element values in the spectrogram from left to right and top to bottom, and put the element values in the two-dimensional spectrogram into a one-dimensional array in order to convert the two-dimensional spectrogram into a one-dimensional token sequence. Use positional encoding to add position information to each input element to achieve positional encoding. In the Transformer model, positional encoding is a technique used to inject position information into the Transformer model, usually using sine and cosine functions with different frequencies to generate unique encodings for each position.
[0023] In step 3, the format conversion of the first hyperspectral signal to form the first hyperspectral sequence includes: combining the extracted absorption peak parameters (wavelength position, absorption depth, full width at half maximum) into a feature vector; performing normalization processing on the extracted feature vector to normalize the intensity values of the spectral data to the range of [0, 1]; encoding the normalized feature vector into an embedding vector that can be accepted by the Transformer model; using the positional encoding vector generated by sine and cosine functions to add position information to the embedding vector to achieve positional encoding.
[0024] Step 4: Input the first voice sequence and the first hyperspectral sequence that conform to the Transformer input format into the Transformer for pre-training. In this step 4, input the first voice sequence that conforms to the Transformer input format into the Transformer for pre-training. Specifically, use a voice-specific Transformer model to process the input first voice sequence through the self-attention mechanism and the feed-forward neural network, and output a series of state vectors Vector1 corresponding to the voice signal. Input the first hyperspectral sequence that conforms to the Transformer input format into the Transformer for pre-training. Specifically, use a spectrum-specific Transformer model to process the input first voice sequence through the self-attention mechanism and the feed-forward neural network, and output a series of state vectors Vector2 corresponding to the hyperspectral signal.
[0025] Step 5: Input the voice signal and the hyperspectral signal after Transformer pre-training into the fully connected layer for dimensional transformation to form the second voice sequence and the second hyperspectral sequence.
[0026] In step 5, a fully connected layer is added as the output layer to the outputs of the sound-specific Transformer model and the hyperspectral-specific Transformer model. The fully connected layer is used to perform dimensionality reduction processing on the extracted sound feature vectors and hyperspectral feature vectors. The input sound signals and hyperspectral data contain a large number of features, while the target task is mainly to detect the high-frequency part of the sound signals and the absorption peak features of the hyperspectral signals. The fully connected layer can selectively retain the high-frequency sound signals useful for judging egg cracks and the hyperspectral signals with absorption peak features, while discarding other irrelevant features, thereby achieving dimensionality reduction of the data.
[0027] Step 6: Perform cross-modal feature fusion on the dimension-transformed second sound sequence and the second hyperspectral sequence to form a fusion signal. In this step 6, the following is included: Calculate the correlation score between the state vector of the sound signal and the hyperspectral state vector through the cross-attention mechanism, and fuse the features weighted according to the score. The cross-attention mechanism can calculate the attention weights between two different input sequences and dynamically focus on the parts most relevant to the current task. Therefore, in the fusion task of sound signals and hyperspectral data, the correlation score is specifically completed according to the following steps: First, take the state vector Vector1 of the sound signal as the query (Query), and the state vector Vector2 of the hyperspectral signal as the key (Key) and value (Value).
[0028] Then, perform a dot product operation on the query (Query) and the key (Key) to obtain the correlation score between them, which is expressed as: , where Q is the query matrix, K is the key matrix, V is the value matrix, is the dimension of the key, which is used as a scaling factor to avoid the correlation score value from being too large.
[0029] Finally, convert the dot product result into a probability distribution through the softmax function to obtain the attention weight of each hyperspectral state vector for the sound signal state vector.
[0030] Fusing the features weighted according to the score is specifically as follows: Use the obtained attention weights to perform a weighted sum on the value (Value) to obtain the fused feature vector. This step can be expressed as: Output = ∑(Attention Weights * V), where ∑ represents the summation operation. Fuse the feature vector obtained by the weighted sum with the original sound signal state vector or hyperspectral state vector to obtain the final feature representation. The fusion method can be concatenation, addition, or other more complex fusion strategies.
[0031] Step 7: Input the fused signal into the Transformer for training to output a judgment result on whether the poultry egg has a crack. In this step 7, the features of the two modalities are fused through the cross-attention module, processed again through the Transformer network, and the last part is a prediction head specific to the crack detection task. The probability of the poultry egg having a crack is generated through the softmax function of the output layer of the Transformer network. When the probability of having a crack exceeds the preset threshold, it is considered that the poultry egg has a crack.
[0032] In summary, for the non-destructive testing method provided by the present invention, by fusing the acoustic signal of knocking on the poultry egg, the visible and near-infrared spectral signals, and inputting the fused features into the Transformer network model for training to output a judgment result on whether the poultry egg has a crack, this detection method for cracked eggs based on the Transformer network model greatly improves the non-destructive testing efficiency and detection accuracy of cracked eggs, and avoids the waste of resources caused by manual detection.
[0033] Based on the same inventive concept, an embodiment of the present invention further provides a system or electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the method described above are implemented.
[0034] In some embodiments, the processor may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chips. The processor is generally used to control the overall operation of the electronic device. In this embodiment, the processor is used to run the program code stored in the memory or process data, such as the program code of the target recognition algorithm.
[0035] The memory at least includes one type of readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (such as SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disc, etc. In some embodiments, the memory may be an internal storage unit of the electronic device, such as the hard disk or memory of the electronic device. In other embodiments, the memory may also be an external storage device of the electronic device, such as a plug-in hard disk equipped on the electronic device, a SmartMedia Card (SMC), a Secure Digital (SD) card, a FlashCard, etc. Of course, the memory may also include both the internal storage unit of the electronic device and its external storage device. In this embodiment, the memory is generally used to store the operation methods and various application software installed on the electronic device, such as the program code of the non-destructive testing method. In addition, the memory may also be used to temporarily store various data that have been output or will be output.
[0036] Based on the same inventive concept, the present invention also provides a readable storage medium, in which a computer program is stored, and when the computer program is executed by a processor, the steps of the non-destructive testing method described above are implemented.
[0037] Those skilled in the art should understand that the embodiments of the present invention can be provided as a method, a system, or a computer program product. Therefore, the present invention can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present invention can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk memories and optical memories, etc.) containing computer-usable program code.
[0038] The present invention is described with reference to the flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, and the combination of 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 the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing devices generate for implementing in the process Figure 1 one process or multiple processes and / or blocks Figure 1means for the functions specified in one or more boxes.
[0039] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to operate in a particular manner, such that the instructions stored in the computer-readable memory produce a manufacture including an instruction means that implements the functions specified in one Figure 1 or more processes and / or boxes Figure 1 or more boxes.
[0040] These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus, such that a series of operational steps are performed on the computer or other programmable apparatus to produce a computer-implemented process, whereby the instructions executed on the computer or other programmable apparatus provide steps for implementing the functions specified in one Figure 1 or more processes and / or boxes Figure 1 or more boxes.
[0041] It will be understood that the above-described embodiments are merely exemplary embodiments employed to illustrate the principles of the present invention, and that the present invention is not limited thereto. Various modifications and improvements may be made by those of ordinary skill in the art without departing from the spirit and essence of the present invention, and such modifications and improvements are also considered to be within the scope of protection of the present invention.
Claims
1. A non-destructive detection method for cracked eggs based on the Transformer network, characterized in that, It includes the following steps: Step 1: Collect the current sound signal V1 of the tapped poultry egg and the visible and near-infrared hyperspectral signal H1 of the current poultry egg; Step 2: Preprocess the sound signal V1 and hyperspectral signal H1 of the poultry egg to form a first sound signal and a first hyperspectral signal corresponding to the sound signal V1; Step 3: Convert the formats of the first sound signal corresponding to the first sound signal V1 and the first hyperspectral signal to form a first sound sequence and a first hyperspectral sequence that conform to the Transformer input format; Step 4: Input the first sound sequence and the first hyperspectral sequence that conform to the Transformer input format into the Transformer for pre-training; Step 5: Input the sound signal and hyperspectral signal after Transformer pre-training into the fully connected layer respectively for dimensional transformation to form a second sound sequence and a second hyperspectral sequence; Step 6: Perform cross-modal feature fusion on the second sound sequence and the second hyperspectral sequence after dimensional transformation to form a fusion signal; Step 7: Input the fusion signal into the Transformer for training to output the judgment result on whether the poultry egg has cracks.
2. The non-destructive detection method for cracked eggs according to claim 1, characterized in that, In the said Step 1, the collection of the current sound signal V1 of the tapped poultry egg includes: Step 11: Apply an excitation to the poultry egg through a tapping head to generate a sound signal, and collect the sound signal V1 through a microphone.
3. The non-destructive detection method for cracked eggs according to claim 1, characterized in that, In the said Step 1, the collection of the visible and near-infrared hyperspectral signal H1 of the current poultry egg includes: Step 12: Use a tungsten halogen lamp or an LED light source to provide light to excite the spectral signal of the poultry egg; Step 13: Collect the spectrum in a dark box environment through a spectrometer covering the visible and near-infrared spectral ranges to obtain the visible and near-infrared hyperspectral signal H1.
4. The non-destructive detection method for cracked eggs according to claim 2, wherein, In the said Step 2, the preprocessing of the sound signal V1 of the poultry egg to form a first sound signal includes: Step 211: Perform filtering on the sound signal V1 of the poultry egg to improve the sound signal quality; Step 212: Use Fourier transform or short-time Fourier transform to convert the filtered sound signal from the time domain to the frequency domain to extract the frequency characteristics of the sound signal.
5. The non-destructive detection method for cracked eggs according to claim 3, characterized in that, In the said Step 2, the preprocessing of the hyperspectral signal H1 to form a first hyperspectral signal includes: Step 221: Use median filtering on the visible and near-infrared hyperspectral signal H1 to remove the noise of the hyperspectral signal; Step 222: Identify the absorption peak positions of the hyperspectral signal after noise processing and extract its parameters, where the parameters include the wavelength position, absorption depth, and full width at half maximum of the absorption peak.
6. The non-destructive detection method for cracked eggs according to claim 4, characterized in that, In the said Step 3, the conversion of the format of the first sound sequence corresponding to the first sound signal V1 to form a first sound sequence includes: Step 311: Generate a spectrogram corresponding to the first sound signal V1 according to the Fourier transform or short-time Fourier transform result; Step 312: Perform normalization on the spectrogram; Step 313: Convert the two-dimensional spectrogram to a one-dimensional sequence; Step 314: Use sine / or cosine functions of different frequencies to generate a unique position encoding for each element in the sequence.
7. The non-destructive detection method for cracked eggs according to claim 5, characterized in that, In the said step 3, the format conversion of the first hyperspectral signal to form the first hyperspectral sequence includes: Step 321: Combine the extracted absorption peak parameters into a feature vector; Step 322: Normalize the extracted feature vector; Step 323: Encode the normalized feature vector into an embedding vector acceptable to the Transformer model; Step 324: Add position information to the embedding vector with a position encoding vector generated by a sine or cosine function to achieve position encoding.
8. The non-destructive detection method for cracked eggs according to claim 1, wherein, In the said step 4, The sound-specific Transformer model processes the input first sound sequence through the self-attention mechanism and the feed-forward neural network, and outputs a series of state vectors Vector1 corresponding to the sound signal; The spectrum-specific Transformer model processes the input first sound sequence through the self-attention mechanism and the feed-forward neural network, and outputs a series of state vectors Vector2 corresponding to the hyperspectral signal.
9. The non-destructive detection method for cracked eggs according to claim 8, characterized in that, In the said step 5, a fully connected layer is added as the output layer to the outputs of the sound-specific Transformer model and the spectrum-specific Transformer model, and the fully connected layer is used to perform dimensionality reduction processing on the extracted sound feature vector and hyperspectral feature vector.
10. The crack egg non-destructive detection method according to claim 1, characterized in that, In the said step 6, it includes the following: Step 61: Calculate the correlation score between the state vector of the sound signal and the hyperspectral state vector through the cross-attention mechanism, and fuse the features weighted according to the score.