Nondestructive detection method and device for shrimp freshness
By combining the characteristic bands of shrimp tail bioelectrical parameters, whole shrimp and shrimp body spectral data, and using a ResNet neural network model enhanced by the CBAM module, the problem of insufficient accuracy in shrimp freshness detection was solved, and efficient and accurate non-destructive detection was achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-24
- Publication Date
- 2026-05-15
AI Technical Summary
Existing methods for detecting shrimp freshness are not accurate enough to meet the needs of rapid and non-destructive testing, and traditional methods are easily affected by individual experience and subjective judgment.
By using bioelectrical parameters of shrimp tails, characteristic band spectral data of whole shrimp, and full spectral data of shrimp bodies, a ResNet neural network model enhanced by the CBAM module is used for fusion detection. The Transformer model is then used to select characteristic bands and attention weights to achieve efficient and accurate detection of shrimp freshness.
It improves the accuracy and efficiency of shrimp freshness detection, enabling the rapid acquisition of accurate freshness information without damaging the shrimp, and reducing subjective errors.
Smart Images

Figure CN117092168B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of agricultural product testing, and in particular to a non-destructive testing method and apparatus for shrimp freshness. Background Technology
[0002] Shrimp are a popular aquatic animal; crayfish, for example, are widely consumed in many regions. The freshness of shrimp is crucial to their taste and food safety. As time passes, shrimp gradually lose their freshness, their meat becomes soft, their taste deteriorates, and they may develop an off-flavor or appear spoiled. Therefore, accurately assessing the freshness of shrimp is essential for ensuring food quality and safety. Traditionally, people mainly judge the freshness of shrimp by observing their appearance and smell. Fresh shrimp are usually lively, elastic, and shiny, with no obvious off-odor. However, this subjective assessment method is easily influenced by individual experience and subjective judgment, thus requiring more reliable, rapid, non-destructive, and objective methods for freshness testing.
[0003] Currently, although there are some methods, such as analyzing the freshness of shrimp through near-infrared spectroscopy, the accuracy of detection is still insufficient and cannot meet the needs of factories for rapid, non-destructive testing and high-accuracy detection. Summary of the Invention
[0004] To address the problems existing in the prior art, the present invention provides a non-destructive testing method and apparatus for shrimp freshness.
[0005] This invention provides a non-destructive method for detecting shrimp freshness, comprising: acquiring target bioelectrical parameters of the shrimp tail as first feature data, and acquiring full-spectrum data of the shrimp body and tail; extracting characteristic band spectral data of the whole shrimp as second feature data based on the full-spectrum data of the shrimp body and tail, and extracting characteristic band spectral data of the shrimp tail as third feature data; fusing the first feature data, the second feature data, and the third feature data, inputting them into a trained detection model, and outputting the freshness level of the shrimp to be detected; wherein, the detection model is a ResNet-based neural network model with an added CBAM module, which is trained based on the determined freshness level as a label and the corresponding first feature data, second feature data, and third feature data as input.
[0006] According to the non-destructive detection method for shrimp freshness provided by the present invention, before extracting the characteristic band spectral data of the whole shrimp as the second characteristic data and extracting the characteristic band spectral data of the shrimp tail as the third characteristic data, the method further includes: extracting the full spectral data of the whole shrimp and the full spectral data of the shrimp tail respectively based on the full spectral data of shrimp bodies with multiple known freshness grades; inputting the full spectral data of the whole shrimp body of each shrimp body, with a determined freshness grade as a label, into a first Transformer model for training, and obtaining the attention weights of all bands of the whole shrimp after training; selecting several bands whose attention weights meet preset conditions based on the attention weights of all bands of the whole shrimp to obtain the characteristic bands of the whole shrimp; inputting the full spectral data of the shrimp tail of each shrimp body of each shrimp body, with a determined freshness grade as a label, into a second Transformer model for training, and obtaining the attention weights of all bands of the shrimp tail after training; selecting several bands whose attention weights meet preset conditions based on the attention weights of all bands of the shrimp tail to obtain the characteristic bands of the shrimp tail.
[0007] According to a non-destructive detection method for shrimp freshness provided by the present invention, the method involves fusing the first feature data, the second feature data, and the third feature data, inputting them into a trained detection model, and outputting the freshness level of the shrimp to be detected. The method includes: fusing the first feature data, the second feature data, and the third feature data, inputting them into the CBAM module of the detection model to obtain multiple feature maps, and performing feature enhancement and extraction on the multiple feature maps based on channel attention and spatial attention to obtain fused feature data; inputting the fused feature data into the ResNet network of the detection model to output the freshness level of the shrimp to be detected.
[0008] According to the present invention, a non-destructive method for detecting shrimp freshness includes acquiring full-spectrum data of the shrimp body and tail, comprising: acquiring a two-dimensional grayscale image of each band of the full spectrum of the shrimp body under inspection with its abdomen facing down on the production line using a spectral camera placed at the top of the production line; synthesizing a three-dimensional color image based on the two-dimensional grayscale images of all bands; identifying the shrimp body as a region of interest based on the three-dimensional color image; segmenting the entire shrimp body image using visual attention; and segmenting the shrimp tail portion of the shrimp body using local features; and extracting full-spectrum data of the whole shrimp and the shrimp tail as regions of interest, respectively.
[0009] According to the present invention, a non-destructive method for detecting shrimp freshness includes, before obtaining the target bioelectrical parameters of the shrimp tail as the first feature data, the method further includes: obtaining multiple shrimp body samples with determined freshness parameters, and obtaining various types of bioelectrical parameters in the tail of each shrimp body sample, wherein the freshness parameters are used to determine the freshness level; performing correlation analysis between the various bioelectrical parameters and the determined freshness parameters, selecting bioelectrical parameters with a correlation greater than a preset condition to obtain candidate bioelectrical parameters; sequentially inputting the candidate bioelectrical parameters of each shrimp body sample, using the determined freshness level as a label, into a third Transformer model for training, and obtaining the attention weights of the candidate bioelectrical parameters after training; and selecting several bioelectrical parameters whose attention weights satisfy a preset condition as the target bioelectrical parameters based on the attention weights of the candidate bioelectrical parameters.
[0010] According to the present invention, a non-destructive method for detecting the freshness of shrimp is provided, wherein the first characteristic data includes: electrical activity intensity, resting potential, and membrane capacitance.
[0011] This invention also provides a non-destructive testing device for shrimp freshness, comprising: a data acquisition module for acquiring target bioelectrical parameters of the shrimp tail as first feature data, and acquiring full-spectrum data of the shrimp body and tail; an extraction module for extracting characteristic band spectral data of the whole shrimp as second feature data and extracting characteristic band spectral data of the shrimp tail as third feature data based on the full-spectrum data of the shrimp body and tail; and a processing module for fusing the first feature data, the second feature data, and the third feature data, inputting them into a trained detection model, and outputting the freshness level of the shrimp to be tested; wherein, the detection model is a ResNet-based neural network model with an added CBAM module, which is trained based on the determined freshness level as a label and the corresponding first feature data, second feature data, and third feature data as input.
[0012] The present invention also provides a non-destructive testing system for shrimp freshness, comprising: a conveyor belt, a conveyor belt control unit, a posture adjustment mechanism, a dark box, a light source, a hyperspectral imager, a contact bioelectrical parameter acquisition instrument, and a non-destructive testing device for shrimp freshness;
[0013] The conveyor belt is used to transport the shrimp to be inspected, and the conveyor belt control unit is used to control the movement of the conveyor belt; the posture adjustment mechanism is used to adjust the spatial position and angle of the shrimp to be inspected so that the shrimp to be inspected faces downwards before arriving at the dark box; the hyperspectral imager and the light source are arranged above the interior of the dark box; the hyperspectral imager is used to capture the spectral image of the shrimp to be inspected when it arrives at the dark box via the conveyor belt, and send it to the device; the contact bioelectric parameter acquisition instrument is used to collect the target bioelectric parameters of the shrimp tail and send them to the device; the device is used to execute any of the methods described above.
[0014] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement any of the above-described non-destructive detection methods for shrimp freshness.
[0015] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the non-destructive detection method for shrimp freshness as described above.
[0016] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements any of the above-described non-destructive detection methods for shrimp freshness.
[0017] This invention provides a non-destructive method and apparatus for detecting shrimp freshness, integrating bioelectrical parameters of the shrimp tail, characteristic wavelengths of the whole shrimp, and characteristic wavelengths of the shrimp body. Bioelectrical parameters provide information on the internal electrical activity of the shrimp tail, reflecting its physiological state and activity level. Characteristic wavelength data of the whole shrimp helps the model understand the overall state of the shrimp body; this information is related to the shrimp's structure, tissue, and biochemical composition. The shrimp tail is an important part of crayfish and other shrimp bodies; its characteristic wavelength spectral data reflects the tail's specific characteristics. The tail's appearance, tissue structure, and biochemical composition differ from the whole shrimp body. By fusing, enhancing, and filtering these three different types of characteristic data, information about crayfish freshness can be obtained from multiple perspectives, thereby improving detection accuracy. The trained detection model not only extracts the relationship between various features and freshness but also integrates the correlations between the three types of characteristic data and between the three types of features and freshness, thus obtaining more accurate freshness information and efficiently acquiring freshness information without damaging the shrimp body. Attached Figure Description
[0018] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0019] Figure 1 This is one of the flowcharts of the non-destructive testing method for shrimp freshness provided by the present invention;
[0020] Figure 2 This is the second flowchart of the non-destructive testing method for shrimp freshness provided by the present invention;
[0021] Figure 3 This is a schematic diagram of the non-destructive testing device for shrimp freshness provided by the present invention;
[0022] Figure 4 This is a schematic diagram of the non-destructive testing system for shrimp freshness provided by the present invention;
[0023] Figure 5 This is a schematic diagram of the structure of the electronic device provided by the present invention;
[0024] Explanation of reference numerals in the attached diagram: 1. Shrimp to be inspected; 2. Posture adjustment mechanism; 3. Light source; 4. Hyperspectral imager; 5. Dark box; 6. Non-destructive testing device for shrimp freshness; 7. Conveyor belt control unit; 8. Conveyor belt; 9. Contact bioelectrical parameter acquisition instrument. Detailed Implementation
[0025] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0026] The following is combined with Figures 1-5 This invention describes a non-destructive testing method and apparatus for shrimp freshness. Figure 1 This is one of the flowcharts of the non-destructive testing method for shrimp freshness provided by the present invention, such as... Figure 1 As shown, the present invention provides a non-destructive method for detecting the freshness of shrimp, comprising:
[0027] 101. Obtain the target bioelectrical parameters of the shrimp tail as the first feature data, and obtain the full spectrum data of the shrimp body and tail.
[0028] Electrochemical impedance spectroscopy (EIS) tests can be performed on the tails of shrimp, such as crayfish, using a contact-type electrochemical detector to obtain bioelectrical parameter data (referred to here as target bioelectrical parameters for easy distinction from subsequent examples). This data includes electroactivity intensity, resting potential, and membrane capacitance. Full-spectrum data of the shrimp body and tail, preferably spectral data from the dorsal side, is also obtained. The full-spectrum data includes multiple channels, each corresponding to a different band of the spectrum. Specifically, the data for a single channel can be the grayscale value of a different pixel location within a specific band.
[0029] 102. Based on the full spectrum data of the shrimp body and tail, extract the characteristic band spectral data of the whole shrimp as the second characteristic data, and extract the characteristic band spectral data of the shrimp tail as the third characteristic data.
[0030] Since not all bands acquired by the spectrometer are associated with freshness, and full-spectrum modeling leads to slow model convergence, complex model structure, and long detection time, this invention extracts characteristic band spectral data of whole shrimp and characteristic band spectral data of shrimp tails based on the spectral data acquired by the spectrometer to determine the corresponding characteristic data (denoted as the second characteristic data and the third characteristic data, respectively).
[0031] 103. Fuse the first feature data, the second feature data and the third feature data, input them into the trained detection model, and output the freshness level of the lobster to be detected.
[0032] The detection model is a ResNet-based neural network model with an added CBAM module. It is trained using the determined freshness level as the label and the corresponding first feature data, second feature data, and third feature data as input.
[0033] The freshness grade is determined based on freshness parameters, which include the firmness, elasticity, and chewiness of the shrimp tail meat.
[0034] This invention selects the ResNet model as the base model. Before step 101, some sample shrimp are selected, and specific freshness parameters are measured to obtain a freshness level, which is determined by weighting. The same three types of feature data as in steps 101 and 102 are collected. Then, using the freshness level as the label and the three types of feature data as the input to the model, the detection model built based on the ResNet model is trained. After the training conditions are met, in step 103, the three types of feature data collected in steps 101 and 102 are input into the trained detection model to obtain an accurate freshness level, thereby realizing freshness detection.
[0035] Furthermore, the detection model of this invention adds a CBAM module. CBAM combines channel attention mechanism and spatial attention mechanism to achieve dual attention weighting of features, which can effectively enhance the network's feature representation of the target, thereby making the detection process more computationally efficient and the results more accurate and reliable.
[0036] This invention provides a non-destructive method for detecting shrimp freshness, integrating bioelectrical parameters of the shrimp tail, characteristic wavelengths of the whole shrimp, and characteristic wavelengths of the shrimp body. Bioelectrical parameters provide information on the internal electrical activity of the shrimp tail, reflecting its physiological state and activity level. Characteristic wavelength data of the whole shrimp helps the model understand the overall state of the shrimp body, information related to its structure, tissue, and biochemical composition. The shrimp tail is an important part of crayfish and other shrimp; its characteristic wavelength spectral data reflects the tail's specific characteristics, as its appearance, tissue structure, and biochemical composition differ from the whole shrimp body. By fusing, enhancing, and filtering these three different types of characteristic data, information about crayfish freshness can be obtained from multiple perspectives, thereby improving detection accuracy. The trained detection model not only extracts the relationship between various features and freshness but also integrates the correlations between the three types of characteristic data and between the three types of features and freshness, thus obtaining more accurate freshness information and efficiently acquiring freshness information without damaging the shrimp body.
[0037] In one embodiment, before extracting the characteristic band spectral data of the whole shrimp as the second characteristic data and extracting the characteristic band spectral data of the shrimp tail as the third characteristic data, the method further includes: extracting the full-band spectral data of the whole shrimp and the full-band spectral data of the shrimp tail based on the spectral data of shrimp bodies with multiple known freshness grades; inputting the full-band spectral data of the whole shrimp body of each shrimp body, with a determined freshness grade as a label, into a first Transformer model for training, and obtaining the attention weights of all bands of the whole shrimp after training; selecting several bands whose attention weights meet preset conditions based on the attention weights of all bands of the whole shrimp to obtain the characteristic bands of the whole shrimp; inputting the full-band spectral data of the shrimp tail of each shrimp body, with a determined freshness grade as a label, into a second Transformer model for training, and obtaining the attention weights of all bands of the shrimp tail after training; selecting several bands whose attention weights meet preset conditions based on the attention weights of all bands of the shrimp tail to obtain the characteristic bands of the shrimp tail.
[0038] Using whole shrimp images and shrimp tail images as regions of interest, the original spectra of the whole shrimp and the shrimp tail (mainly the spectral data of all bands obtained in step 101) are extracted. To further improve accuracy, stepwise correlation analysis can be used to preprocess the original spectra of the whole shrimp and the shrimp tail to reduce noise, enhance features, and remove redundant information, thus obtaining the feature bands in step 102.
[0039] In this embodiment of the invention, an attention mechanism is used to further filter the bands of the spectral data. For example, before step 101, the spectral curves of all whole shrimp samples and shrimp tail samples are divided into a calibration set, a validation set, and a test set in a 2:1:1 ratio. All spectral data in the calibration set are input into a Transformer model (the first Transformer model for whole shrimp and the second Transformer model for shrimp tails), and the model learns the feature representation of the data. A regularization term is added to this model to limit the magnitude of the attention weights. The model will automatically learn the correlation and importance between different bands during training. By normalizing the attention weights, the relative importance of each band is obtained, i.e., the attention weight of each band is calculated.
[0040] Based on the calculated attention weights, bands with high attention weights are selected. These bands contain more information and meaningful features in the spectral data. After band selection, during training, the spectral data from the validation set is periodically input into the attention-based model for validation and evaluation. The model's performance on the validation set is observed, and attention parameters and model structure are adjusted as needed. After training, the model is finally evaluated using the test set, and metrics such as accuracy, precision, and recall are calculated. The selected bands are analyzed, considering their correlation, physical meaning, and feature importance, to determine the final selection of spectral features based on shrimp tails and spectral features based on whole shrimp.
[0041] The non-destructive shrimp freshness detection method of this invention uses the attention weights of a Transformer model to filter feature bands, avoiding the drawbacks of existing methods that filter band by band. This model can simultaneously capture the dependencies between different bands, regardless of whether these bands are adjacent. Traditional band-by-band filtering methods struggle to capture longer dependencies, while the Transformer's attention mechanism can effectively capture associations over greater distances. This is particularly important for connections between complex spectral features, and it can adaptively learn which bands are more important for freshness detection. This makes feature selection more targeted, avoiding the limitations and inflexibility of traditional filtering methods in selecting single feature bands, thereby further improving the accuracy of freshness detection.
[0042] In one embodiment, fusing the first feature data, the second feature data, and the third feature data, inputting them into the trained detection model, and outputting the freshness level of the lobster to be detected includes: fusing the first feature data, the second feature data, and the third feature data, inputting them into the CBAM module of the detection model to obtain multiple feature maps, and performing feature enhancement and extraction on the multiple feature maps based on channel attention and spatial attention to obtain fused feature data;
[0043] The extracted fusion feature data is input into the ResNet network of the detection model, and the freshness level of the lobster to be detected is output.
[0044] The CBAM module was determined based on the highest accuracy in shrimp freshness grading after different CBAM module configurations and hyperparameter configurations. The hyperparameter configurations were obtained through neural architecture search, which automatically finds suitable hyperparameter configurations for shrimp freshness grading, thereby reducing the need for manual intervention.
[0045] The selected target bioelectrical parameters, spectral feature bands based on shrimp tails, and spectral feature bands based on whole shrimp were integrated into a dataset, and the ResNet model was selected as the base model. A CBAM module was added to the ResNet model to enhance channel importance. The CBAM module consists of two parts: a channel attention module and a spatial attention module. The fused bioelectrical parameters, spectral feature bands based on shrimp tails, and spectral feature bands based on whole shrimps were input into the feature extraction part of the base ResNet model for feature extraction, generating a series of feature maps with semantic information. Then, in the CBAM module, the channel attention module was used to enhance the importance of channels in the generated feature maps. The channel attention module calculates the attention weight for each channel in the feature map to highlight the feature information of important channels. In the CBAM module, the spatial attention module was used to enhance the importance of spatial locations in the generated feature maps. The spatial attention module calculates the attention weight for each location to highlight the feature information of important locations. The feature maps processed by channel attention and spatial attention were fused to obtain a feature representation with enhanced importance. The enhanced feature representation was used for model training and detection output.
[0046] The non-destructive detection method for shrimp freshness in this embodiment of the invention processes feature maps through the channel attention module and spatial attention module of the CBAM module, further highlighting the feature information of important channels and further filtering features, thereby accelerating the detection speed and improving the accuracy of the detection model.
[0047] In one embodiment, acquiring the full-spectrum data of the shrimp body and tail includes: acquiring a two-dimensional grayscale image of each band of the full spectrum of the shrimp body under inspection with its abdomen facing down on the production line using a spectral camera placed at the top of the production line; synthesizing a three-dimensional color image based on the two-dimensional grayscale images of all bands; identifying the shrimp body as a region of interest based on the three-dimensional color image; segmenting the entire shrimp body image using visual attention; and segmenting the shrimp tail portion of the shrimp body using local features; and extracting the full-spectrum data of the whole shrimp and the full-spectrum data of the shrimp tail, respectively, using the whole shrimp image and the shrimp tail image as regions of interest.
[0048] Specifically, after the shrimp undergoes posture adjustment on the conveyor line, it is transported to the hyperspectral detection device. The posture adjustment primarily involves aligning the shrimp with its abdomen facing downwards to facilitate the acquisition of spectral dorsal images and bioelectrical parameters. The parameters of the detection device are then adjusted, including the focal length and exposure time of the pushbroom hyperspectral imager with a standard lens, to acquire the corresponding full-spectrum data.
[0049] Based on the three-dimensional color image, the shrimp body to be inspected is identified as the region of interest. The entire image of the shrimp body is segmented using visual attention, and the tail part of the shrimp body is segmented using local features.
[0050] In one embodiment, before obtaining the target bioelectrical parameters of the shrimp tail as the first feature data, the method further includes: obtaining multiple shrimp body samples with determined freshness parameters, and obtaining various types of bioelectrical parameters in the shrimp tail of each shrimp body sample, wherein the freshness parameters are used to determine the freshness level; performing correlation analysis between the various bioelectrical parameters and the determined freshness parameters, selecting bioelectrical parameters with a correlation greater than a preset condition to obtain candidate bioelectrical parameters; sequentially inputting the candidate bioelectrical parameters of each shrimp body sample, using the determined freshness level as a label, into a third Transformer model for training, and obtaining the attention weights of the candidate bioelectrical parameters after training; and selecting several bioelectrical parameters whose attention weights satisfy a preset condition as the target bioelectrical parameters based on the attention weights of the candidate bioelectrical parameters.
[0051] Specifically, a correlation analysis was performed on all the obtained shrimp tail bioelectrical parameters and freshness parameters. Bioelectrical parameters with a correlation of less than 0.5 or no significant correlation were removed to obtain candidate bioelectrical parameters.
[0052] Furthermore, self-attention is used to further screen candidate bioelectrical parameters. First, the bioelectrical parameters are normalized using the softmax function, initial values for the attention weights are set, a scaling factor is selected to adjust the range of the attention weights, and regularization terms, such as L1 or L2 regularization, are added to limit the magnitude of the attention weights. The Transformer model (the third Transformer model) is then trained and validated to evaluate performance and perform dynamic adjustments. The attention weights of the candidate bioelectrical parameters are obtained after training. Then, several bioelectrical parameters whose attention weights meet the criteria are selected as the target bioelectrical parameters in the 101 algorithm.
[0053] Accordingly, the non-destructive detection method for shrimp freshness in this embodiment of the invention uses the attention weights of the Transformer model to filter feature bands, avoiding the drawbacks of filtering bioelectrical parameters one by one. It can capture the dependence between different bioelectrical parameters and between bioelectrical parameters and freshness, thereby further improving the accuracy of freshness detection.
[0054] Figure 2 This is the second flowchart of the non-destructive testing method for shrimp freshness provided by the present invention, which is combined with the methods in the above embodiments as follows: Figure 2 As shown, please refer to the above-mentioned method embodiments for details, which will not be repeated here.
[0055] In one embodiment, the first feature data includes: electrical activity intensity, resting potential, and membrane capacitance.
[0056] To ensure accuracy in assessing freshness, this embodiment of the invention incorporates the electrical activity intensity, resting potential, and membrane capacitance of the shrimp tail into the target bioelectrical parameters. These parameters can provide information about the physiological state and activity level of the shrimp tail.
[0057] Electrical activity intensity refers to the amplitude of an electrical signal waveform. It represents the strength of the electrical signal and is related to physiological activities such as nerve conduction and muscle contraction within the shrimp tail. Higher electrical activity intensity usually indicates stronger nerve conduction and muscle contraction, while lower intensity usually indicates weaker physiological activity.
[0058] Resting potential refers to the difference in electrical potential across a biological cell membrane when the cell is at rest. It is determined by the concentration gradient of ions inside and outside the cell and membrane permeability. The resting potential of a shrimp tail can reflect the polarization state of the cell membrane and the balance of ions inside and outside the cell.
[0059] Membrane capacitance refers to the cell membrane's responsiveness to electrical charges; that is, the accumulation of charge on the membrane when a voltage or potential difference is applied. Membrane capacitance is usually related to the structure and properties of the cell's biological membrane and can affect the cell's sensitivity to electrical signals. The membrane capacitance of a shrimp tail reflects the plasticity of the cell membrane and its responsiveness to electrical signals.
[0060] The non-destructive testing device for shrimp freshness provided by the present invention is described below. The non-destructive testing device for shrimp freshness described below can be referred to in correspondence with the non-destructive testing method for shrimp freshness described above.
[0061] Figure 3 This is a schematic diagram of the non-destructive testing device for shrimp freshness provided by the present invention, as shown below. Figure 3 As shown, the non-destructive testing device for shrimp freshness includes: a data acquisition module 301, an extraction module 302, and a processing module 303. The data acquisition module 301 acquires the target bioelectrical parameters of the shrimp tail as first feature data, and acquires the full-spectrum data of the shrimp body and tail. The extraction module 302 extracts characteristic band spectral data of the whole shrimp as second feature data, and extracts characteristic band spectral data of the shrimp tail as third feature data, based on the full-spectrum data of the shrimp body and tail. The processing module 303 fuses the first, second, and third feature data, inputs them into a trained detection model, and outputs the freshness level of the shrimp to be tested. The detection model is a ResNet-based neural network model with an added CBAM module, trained using the determined freshness level as a label and the corresponding first, second, and third feature data as input.
[0062] The apparatus embodiments provided in this invention are for implementing the above-described method embodiments. For specific processes and details, please refer to the above-described method embodiments, which will not be repeated here.
[0063] The shrimp freshness non-destructive testing device provided in this embodiment of the invention has the same implementation principle and technical effect as the aforementioned shrimp freshness non-destructive testing method embodiment. For the sake of brevity, any parts not mentioned in the shrimp freshness non-destructive testing device embodiment can be referred to the corresponding content in the aforementioned shrimp freshness non-destructive testing method embodiment.
[0064] Figure 4 This is a schematic diagram of the non-destructive testing system for shrimp freshness provided by the present invention, as shown below. Figure 4 As shown, the shrimp freshness non-destructive testing system includes: a conveyor belt 8, a conveyor belt control unit 7, a posture adjustment mechanism 2, a dark box 5, a light source 3, a hyperspectral imager 4, a contact bioelectric parameter acquisition instrument 9, and a shrimp freshness non-destructive testing device (hereinafter referred to as the device) 6.
[0065] The conveyor belt 8 is used to transport the shrimp to be inspected, and the conveyor belt control unit 7 is used to control the movement of the conveyor belt 8; the posture adjustment mechanism 2 is used to adjust the spatial position and angle of the shrimp to be inspected so that the shrimp to be inspected 1 arrives at the dark box 5 with its abdomen facing down; the hyperspectral imager 4 and the light source 3 are arranged inside the dark box 5 at the top; the hyperspectral imager 4 is connected to the device 6 via a data cable, and is used to capture the spectral image of the shrimp to be inspected 1 when it arrives at the dark box 5 via the conveyor belt 8, and send it to the device 6; the contact bioelectric parameter acquisition instrument 9 is used to collect the target bioelectric parameters of the shrimp tail and send them to the device 6; the device is used to execute the method of any of the above method embodiments.
[0066] The conveyor belt control unit 7 can be a PLC control unit, and the light source 3 can be a ring-shaped adjustable light source. The hyperspectral imager 4 can be connected to the device 6 via a USB 3.0 data cable. The pushbroom hyperspectral imager 4 with a standard lens uses an airborne hyperspectral camera, model OCI-UAV-1000, and the data acquisition method is pushbroom. The camera lens (35mm fixed focus, 18° field of view) has dimensions of 80mm x 60mm x 60mm; its function is to capture high-quality shrimp images.
[0067] The ring-shaped adjustable light source 3 is installed in the dark box 5. It can be a Hikvision MV-LBES-300-W model with a power of 65W. The power of the ring-shaped adjustable light source can be obtained from the electronic device 6 via a data cable, providing a light source for acquiring hyperspectral images.
[0068] The PLC control unit 7 is a general-purpose component, and its function is to control the movement of the conveyor belt. The conveyor belt 8 mainly functions to transport the shrimp to be inspected, enabling the shrimp to reach the designated positions for inspection. For specific processing procedures and technical effects, please refer to the above-described method embodiments, which will not be repeated here.
[0069] The contact-type bioelectric parameter acquisition instrument 9 can acquire corresponding signals through two electrodes. For some bioelectric parameters, a power supply can be added to provide voltage and current. For special bioelectric parameters, corresponding sensors can be added to acquire the signals. Finally, these bioelectric parameters are sent to device 6.
[0070] Figure 5 This is a schematic diagram of the structure of the electronic device provided by the present invention, such as... Figure 5As shown, the electronic device may include: a processor 501, a communication interface 502, a memory 503, and a communication bus 504. The processor 501, communication interface 502, and memory 503 communicate with each other via the communication bus 504. The processor 501 can call logical instructions in the memory 503 to execute a non-destructive method for detecting shrimp freshness. This method includes: acquiring target bioelectrical parameters of the shrimp tail as first feature data, and acquiring full-spectrum data of the shrimp body and tail; based on the full-spectrum data of the shrimp body and tail, extracting characteristic band spectral data of the whole shrimp as second feature data, and extracting characteristic band spectral data of the shrimp tail as third feature data; fusing the first feature data, second feature data, and third feature data, inputting them into a trained detection model, and outputting the freshness level of the shrimp to be detected; wherein the detection model is a ResNet-based neural network model with an added CBAM module, obtained by training the model with the determined freshness level as a label and the corresponding first, second, and third feature data as input.
[0071] Furthermore, the logical instructions in the aforementioned memory 503 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, 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 described in the various embodiments of the present invention. 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.
[0072] On the other hand, the present invention also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the non-destructive detection method for shrimp freshness provided by the above methods. The method includes: acquiring target bioelectrical parameters of the shrimp tail as first feature data, and acquiring full-spectrum data of the shrimp body and tail; extracting characteristic band spectral data of the whole shrimp as second feature data and extracting characteristic band spectral data of the shrimp tail as third feature data based on the full-spectrum data of the shrimp body and tail; fusing the first feature data, the second feature data, and the third feature data, inputting them into a trained detection model, and outputting the freshness level of the shrimp to be detected; wherein, the detection model is a ResNet-based neural network model with an added CBAM module, which is trained based on the determined freshness level as a label and the corresponding first feature data, second feature data, and third feature data as input.
[0073] In another aspect, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon. When executed by a processor, the computer program implements a non-destructive detection method for shrimp freshness provided by the above methods. The method includes: acquiring target bioelectrical parameters of the shrimp tail as first feature data, and acquiring full-spectrum data of the shrimp body and tail; extracting characteristic band spectral data of the whole shrimp as second feature data based on the full-spectrum data of the shrimp body and tail, and extracting characteristic band spectral data of the shrimp tail as third feature data; fusing the first feature data, the second feature data, and the third feature data, inputting them into a trained detection model, and outputting the freshness level of the shrimp to be detected; wherein the detection model is a ResNet-based neural network model with an added CBAM module, which is trained based on the determined freshness level as a label and the corresponding first feature data, second feature data, and third feature data as input.
[0074] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0075] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0076] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A non-destructive method for detecting the freshness of shrimp, characterized in that, include: The target bioelectrical parameters of the shrimp tail were obtained as the first feature data, and the full spectrum data of the shrimp body and tail were also obtained. Based on the full spectrum data of the shrimp body and tail, the characteristic band spectral data of the whole shrimp are extracted as the second characteristic data, and the characteristic band spectral data of the shrimp tail are extracted as the third characteristic data. The first feature data, the second feature data, and the third feature data are fused together and input into the trained detection model to output the freshness level of the lobster to be detected. The detection model is a ResNet-based neural network model with an added CBAM module. It is trained using the determined freshness level as the label and the corresponding first feature data, second feature data, and third feature data as input.
2. The non-destructive testing method for shrimp freshness according to claim 1, characterized in that, Before extracting the characteristic band spectral data of the whole shrimp as the second characteristic data and extracting the characteristic band spectral data of the shrimp tail as the third characteristic data, the method further includes: Based on the spectral data of shrimp with multiple known freshness grades, the full spectral data of whole shrimp and shrimp tails were extracted separately. The whole spectrum data of each shrimp is used as a label with a certain freshness level. The data is then input into the first Transformer model for training, and the attention weights of all bands of the whole shrimp are obtained after training. Based on the attention weights of all bands of the whole shrimp, select several bands whose attention weights meet the preset conditions to obtain the characteristic bands of the whole shrimp. The full spectrum data of the shrimp tail of each shrimp body is used as a label with a certain freshness level. The data is then input into the second Transformer model for training, and the attention weights of all bands of the shrimp tail are obtained after training. Based on the attention weights of all bands in the shrimp tail, select several bands whose attention weights meet preset conditions to obtain the characteristic bands of the shrimp tail.
3. The non-destructive testing method for shrimp freshness according to claim 1, characterized in that, The process of fusing the first feature data, the second feature data, and the third feature data, inputting them into the trained detection model, and outputting the freshness level of the lobster to be detected includes: The first feature data, the second feature data, and the third feature data are fused and input into the CBAM module of the detection model to obtain multiple feature maps. The multiple feature maps are then enhanced and extracted based on channel attention and spatial attention to obtain fused feature data. The fused feature data is input into the ResNet network of the detection model, and the freshness level of the lobster to be detected is output.
4. The non-destructive testing method for shrimp freshness according to claim 1, characterized in that, The acquisition of full-spectral data of the shrimp body and tail includes: A spectral camera placed at the top of the production line acquires a two-dimensional grayscale image of each band of the full spectrum of the shrimp under inspection on the production line with their abdomen facing down, and synthesizes a three-dimensional color image based on the two-dimensional grayscale images of all bands. Based on the three-dimensional color image, the shrimp body to be inspected is identified as the region of interest. The entire image of the shrimp body is segmented using visual attention, and the tail part of the shrimp body is segmented using local features. Using whole shrimp images and shrimp tail images as regions of interest, full-spectral data of the whole shrimp and shrimp tail were extracted respectively.
5. The non-destructive testing method for shrimp freshness according to claim 1, characterized in that, Before obtaining the target bioelectrical parameters of the shrimp tail as the first feature data, the method further includes: Multiple shrimp samples with determined freshness parameters were obtained, and various bioelectrical parameters of different types were obtained from the tail of each shrimp sample; wherein, the freshness parameters were used to determine the freshness level. Correlation analysis was performed on the various bioelectrical parameters and the determined freshness parameters. Bioelectrical parameters with a correlation greater than the preset condition were selected to obtain candidate bioelectrical parameters. The candidate bioelectric parameters of each shrimp sample are sequentially input into the third Transformer model for training, using the determined freshness level as a label, and the attention weights of the candidate bioelectric parameters are obtained after training. Based on the attention weights of the candidate bioelectrical parameters, several bioelectrical parameters whose attention weights meet preset conditions are selected as the target bioelectrical parameters.
6. The non-destructive testing method for shrimp freshness according to any one of claims 1-5, characterized in that, The first feature data includes: electrical activity intensity, resting potential, and membrane capacitance.
7. A non-destructive testing device for shrimp freshness, characterized in that, include: The acquisition module is used to acquire the target bioelectrical parameters of the shrimp tail as the first feature data, as well as to acquire the full spectrum data of the shrimp body and tail. The extraction module is used to extract the characteristic band spectral data of the whole shrimp as the second characteristic data and the characteristic band spectral data of the shrimp tail as the third characteristic data based on the full spectrum data of the shrimp body and the shrimp tail. The processing module fuses the first feature data, the second feature data, and the third feature data, inputs them into the trained detection model, and outputs the freshness level of the lobster to be detected. The detection model is a ResNet-based neural network model with an added CBAM module. It is trained using the determined freshness level as the label and the corresponding first feature data, second feature data, and third feature data as input.
8. A non-destructive testing system for shrimp freshness, characterized in that, include: Conveyor belt, conveyor belt control unit, attitude adjustment mechanism, dark box, light source, hyperspectral imager, contact bioelectric parameter acquisition instrument, and non-destructive testing device for shrimp freshness; The conveyor belt is used to transport shrimp to be inspected, and the conveyor belt control unit is used to control the movement of the conveyor belt. The posture adjustment mechanism is used to adjust the spatial position and angle of the shrimp to be inspected so that the shrimp to be inspected is facing downwards before reaching the dark box. The hyperspectral imager and the light source are installed above the interior of the dark box; The hyperspectral imager is used to capture spectral images of the shrimp as it passes through the conveyor belt into the dark box, and then transmit these images to the device. The contact-type bioelectric parameter acquisition instrument is used to collect target bioelectric parameters of shrimp tails and send them to the device. The device is used to perform the non-destructive testing method for shrimp freshness as described in any one of claims 1 to 6.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the non-destructive detection method for shrimp freshness as described in any one of claims 1 to 6.
10. A non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the non-destructive detection method for shrimp freshness as described in any one of claims 1 to 6.