A method for detecting lean meat rate of pork belly based on hyperspectral technology

By combining hyperspectral technology and deep learning technology, a multi-stage dimensionality reduction and feature extraction module was designed to solve the accuracy of pork belly detection in a diverse environment, realize efficient and reliable lean meat segmentation, and improve food processing quality control capability.

CN118747799BActive Publication Date: 2024-12-10DALIAN POLYTECHNIC UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410807974.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-21
Publication Date
2024-12-10
Estimated Expiration
2044-06-21

AI Technical Summary

Technical Problem

The prior art is difficult to accurately detect the lean meat ratio of pork belly under diversified environmental backgrounds and complex morphology and texture characteristics, especially when blood stains and minced meat, resulting in insufficient segmentation accuracy and robustness.

Method used

Combining hyperspectral technology and deep learning technology, the Pig Five Flower Dimensional Reduction and Image Reconstruction Modules were designed, and the improved marine predator algorithm and Robust PCA algorithm were used for multi-stage dimensionality reduction, combining the pyramid pool of U-Net encoding network and PSPNet network The integrated module is introduced, and the hybrid attention module and the depth-separable residual convolution submodule are optimized to optimize feature extraction and segmentation network structures and improve the performance of segmentation tasks.

Benefits of technology

It significantly improves the accuracy and robustness of pork belly lean meat segmentation, enhances the anti-interference ability to complex environments and noises, realizes more efficient lean meat area identification and segmentation, and improves the reliability of food processing and quality control. .

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118747799B_ABST
    Figure CN118747799B_ABST
Patent Text Reader

Abstract

The present invention belongs to the field of food industrialization and artificial intelligence, and discloses a method for detecting the lean meat rate of pork belly based on hyperspectral technology. The method includes a pork belly spectral feature extraction module, a pork belly lean meat fusion segmentation network module and a smooth hole filling module. The pork belly lean meat fusion segmentation network module includes a fusion segmentation network submodule, a hybrid attention submodule and a deep separable residual convolution submodule. Through the innovative design of the above modules and submodules, the spatial information and channel information in the pork belly image can be more effectively extracted, and the overall recognition accuracy of the model for pork belly fat and lean meat is improved, and the robustness and generalization ability of the model are enhanced. The present invention accurately detects the lean meat rate of pork belly through hyperspectral technology and deep learning methods, solving two key problems: low efficiency, high cost and lack of objectivity of manual detection; the threshold segmentation algorithm will be interfered by irrelevant features such as blood stains and minced meat, resulting in inaccurate segmentation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of food industrialization and artificial intelligence, and specifically relates to a method for detecting lean meat rate of pork belly based on hyperspectral technology. Background Art

[0002] Pork belly is one of the most popular meats in pig carcasses. Pork belly with different fat-to-lean ratios has obvious differences in meat structure, taste and flavor. A higher lean meat ratio makes the meat more compact and firmer, which is suitable for consumers who prefer light tastes; a higher fat ratio can give the meat a richer taste and fat, making it more juicy and delicious, suitable as a raw material for gourmet dishes; pork belly with a uniform fat-to-lean ratio has a rich taste and tender and juicy meat. Secondly, consumers' taste preferences also have different requirements for the fatness and leanness of pork belly. Therefore, realizing the automated detection of the lean meat rate of pork belly can provide objective fat-to-lean ratio data, and make reasonable pricing and classification in the market, which helps to meet the fat-to-lean requirements of different consumers for pork belly and provide more choices for the pork market segment. At the same time, it can also improve production efficiency and quality control, and ensure product consistency and standardization.

[0003] At present, in the field of image processing related technologies, only a simple processing is performed through the color threshold segmentation method in a single digital image processing algorithm, which is only applicable to the lean meat rate detection when the lighting is uniform and the sample is not contaminated. However, during the cutting process of pork belly, blood stains and minced meat will be produced, which will reduce the contrast between fat and lean meat and interfere with the threshold setting of the threshold segmentation algorithm. In addition, color threshold segmentation is particularly sensitive to noise, lighting conditions, etc., which affects the accuracy of threshold segmentation. Patent "A method for identifying aircraft take-off and landing runways based on PSPNet network"

[0004] (CN113052106A) uses the residual network ResNet and the lightweight deep neural network MobileNetV2 as the backbone network of PSPNet to extract features under visible light. However, the pork belly image acquisition environment will change with the changes in different environmental backgrounds such as processing production lines, transportation processes, storage processes, supermarkets, etc., and there are many interference factors. In particular, the visible light-based acquisition is highly dependent on the environment. In addition, the shape and size of the lean meat in the pork belly image vary greatly, and the surface texture is relatively complex. The above combined network cannot fully capture these complex changes and features, and it is difficult to adapt to the situation where pork belly has diverse environmental backgrounds and complex morphology and texture characteristics.

[0005] Therefore, the present invention combines hyperspectral technology with deep learning technology to achieve automated and real-time segmentation of fat and lean meat in pork belly. Hyperspectral technology contains rich spatial and spectral information, and can accurately distinguish and identify fat and lean meat in images according to the different spectral responses of fat and lean meat in specific bands. These innovative functional modules improve the performance of pork belly segmentation tasks as a whole by improving the accuracy of feature extraction, optimizing feature fusion methods, introducing attention mechanisms, and improving convolutional network structures. They solve the key problem that in the lean meat segmentation task, pork belly samples are disturbed by blood stains and the like and cannot accurately segment the lean meat. They further improve the recognition accuracy, robustness, and generalization ability of the segmentation network, providing an efficient and reliable solution for the fields of food processing and quality control. Summary of the invention

[0006] The present invention proposes a method for detecting lean meat rate of pork belly based on hyperspectral technology.

[0007] In order to achieve the above object, the technical solution of the present invention is:

[0008] A method for detecting lean meat rate of pork belly based on hyperspectral technology comprises the following steps:

[0009] Step 1: Preparation of pork belly samples;

[0010] Step 2: Hyperspectral data acquisition;

[0011] The pig streaky sample block obtained in step 1 is placed on the conveyor platform of the hyperspectral imager and sent to the spectrum collection area. The halogen lamps are located on both sides of the pig streaky sample block, 20 cm above the pig streaky sample, and at a 45° angle to the horizontal direction. The original hyperspectral image is collected by a spectral camera; the hyperspectral imager parameters are set as follows: band range 380.2-1020.2nm, spectral resolution 2.8nm, exposure time 10ms, gain 1, object distance 500mm, image resolution 900*1400, and moving stage moving speed 2cm / s;

[0012] Step 3: Perform black and white correction on the original hyperspectral image obtained in step 2;

[0013] Step 4: Design a pig streaky dimension reduction and image reconstruction module, and use it to complete the dimension reduction of pig streaky hyperspectral data and the construction of the data set for the subsequent detection model;

[0014] In view of the fact that pork belly is easily affected by blood stains, minced meat, lighting conditions and noise, it is extremely important to find the most representative spectral feature bands to distinguish between fat and lean meat areas. Therefore, the present invention designs a pork belly dimensionality reduction and image reconstruction module, and improves the original marine predator algorithm and connects it in series with the Robust PCA algorithm to achieve multi-stage dimensionality reduction. That is, after the first stage of dimensionality reduction is achieved using the improved marine predator algorithm, the Robust PCA algorithm performs the second stage of dimensionality reduction on this basis and reconstructs the pork belly image. In the dimensionality reduction process of the above two stages, the improved marine predator algorithm introduces the Logistics chaos map to initialize the population in the initialization stage of the marine predator algorithm, so that the marine predator algorithm can more effectively explore the band combination that best distinguishes fat and lean meat in the pork belly image, thereby improving the exploration efficiency of the algorithm; after the above initial stage, the golden sine strategy is introduced in the front, middle and late stages of the algorithm update iteration to coordinate the local search and global search of the algorithm, so that the algorithm can effectively search the valuable areas in detail and improve the quality of the pork belly lean meat band; after obtaining the band combination again through the above steps, a new solution is generated by introducing Gaussian mutation at the optimal solution position to perform perturbation mutation, thereby increasing the sensitivity of the algorithm to the subtle parts of the pork belly lean meat and obtaining the final beneficial band; the beneficial band determined by the first stage dimensionality reduction algorithm is used as the Robust The input of the PCA algorithm is used to realize the second stage of dimensionality reduction. The number of output bands is set to three, and the principal component images of these three output bands are extracted. The three principal component images are used to reconstruct the pork belly image, that is, the grayscale image of the first principal component is assigned to the R channel of the reconstructed image, the grayscale image of the second principal component is assigned to the G channel of the reconstructed image, and the grayscale image of the third principal component is assigned to the B channel of the reconstructed image, so as to obtain a reconstructed image containing the pork belly area, thereby constructing a pork belly detection model data set; this improvement increases the diversity of the initial population and optimizes the search efficiency and quality, so that the algorithm has better adaptability to the dynamically changing collection environment of pork belly, improves the algorithm's global search ability for the beneficial bands of pork belly, and effectively improves the overall performance of the algorithm.

[0015] Step 5: Design a pork belly lean meat fusion segmentation network module, and use it to segment the lean meat in the pork belly reconstructed image;

[0016] Further, the specific implementation plan of step 5 is: designing a fusion segmentation network module for pork belly lean meat, which is composed of a fusion segmentation network submodule, a hybrid attention submodule and a deep separable residual convolution submodule, with the fusion segmentation network submodule as the core architecture, which is formed by horizontally connecting the pyramid pooling module of the U-Net encoding network and the PSPNet network, and then sequentially integrating the deep separable residual convolution submodule and the hybrid attention submodule into the U-Net encoding network of the fusion segmentation network submodule, so as to improve the network's extraction of detailed features of the pork belly lean meat area and enhance the model's attention to important features. The following are the design steps of the three submodules:

[0017] Step 5-1: Construct a fusion segmentation network submodule, which divides the U-Net network into an encoding network and a decoding network at the jump connection position, discards the original decoding network, and replaces the backbone network Resnet50 in the classic PSPNet network with the U-Net encoding network to extract the detailed features of pork belly lean meat and improve the segmentation accuracy of the network module; construct a mixed-scale pooling layer that performs maximum pooling, global average pooling, and dilated convolution pooling operations in parallel, and put it into the pyramid pooling module of the PSPNet network, that is, replace the global average pooling layer corresponding to the original four different scales (1x1, 2x2, 3x3, 6x6) with a mixed-scale pooling layer respectively. For each scale, the mixed-scale pooling layer performs three different pooling operations of maximum pooling, global average pooling, and dilated convolution pooling in parallel, which enhances the network module's ability to capture small-area lean meat features in pork belly images, and is suitable for precise pixel-level segmentation tasks such as pork belly lean meat.

[0018] Step 5-2: Design a hybrid attention submodule. In the pork belly lean meat area segmentation task, not only will irrelevant features such as blood stains, minced meat, lighting conditions, and noise cause interference, but there will also be a "lean and fat" area in the entire pork belly area, which refers to the part of the pork belly where lean meat and fat are staggered and stacked. This part belongs to the lean meat area. Usually, there will be some evenly distributed small granular fat in this area, and this part of the area cannot be accurately identified and segmented during the segmentation process. In response to the above problems, the present invention is based on the Spatial Attention (SA) module and the Efficient Channel Attention (EfficientChannel Attention) module. The SA module and the ECA module are connected in parallel. In the fusion segmentation network module, the reconstructed image of the pork belly in the data set is first input into the depth-separable residual convolution submodule. The feature maps obtained after convolution, pooling and other operations are then input into the SA module and the ECA module respectively. The SA module takes the maximum and global average pooling fusion of the input feature map to obtain a H×W×2 vector, where H and W are the width and height of the input feature map respectively. Then the convolution operation is performed, and the sigmoid function is used to calculate the spatial weight coefficient. Finally, the spatial weight coefficient is combined with the input pork belly reconstructed image. Point-by-point multiplication obtains the weighted feature map; the ECA module uses global average pooling to compress the spatial information of the input feature map to obtain a 1×1×C vector, where C is the number of channels of the input feature map. Secondly, adaptive one-dimensional convolution is used between each channel and k adjacent channels to avoid multi-channel dimensionality reduction. k represents the coverage of cross-channels. k=3 is defined, leaving only the channel attention information. Then the Sigmoid function is used to calculate the channel weight coefficient. Finally, the channel weight coefficient is multiplied point by point with the input pork belly reconstructed image to obtain the weighted feature map; the two output weighted feature maps are fused by element-level product to obtain a feature map with spatial and channel attention.

[0019] Step 5-3: Construct a deep separable residual convolution submodule. First, replace the original 3×3 convolution layer in the U-Net encoding network with a 3×3 deep separable convolution layer. Then add a residual connection between the feature map input position and the output feature map after convolution. The deep separable residual convolution submodule constructed in this way includes two 3×3 deep separable convolution layers, two nonlinear ReLU layers, and two 2×2 maximum pooling layers. Finally, the output feature map of the residual connection and the output feature map of the main path are added element-wise, which can better integrate the feature information from different paths and obtain the final feature map. This improvement realizes the separation of channels and spaces, facilitates the subsequent hybrid attention module to capture channel information and spatial information, and improves the detection speed and accuracy of the model as a whole, and enhances the feature expression of the model.

[0020] Step 6: Input the reconstructed image created in step 4 into the network module of step 5 for model training, and output the segmented pork belly lean meat area image;

[0021] Step 7: Use the smooth hole filling module to smooth and fill holes in the image segmented in step 6;

[0022] Furthermore, a specific implementation scheme of step 7: In the mask image of pork belly lean meat obtained in step 6, there are usually a small amount of "fat mixed with lean meat" areas that have not been segmented into lean meat areas. Therefore, before calculating the lean meat rate, the mask image needs to be filled with holes. The present invention constructs a smooth hole-filling module based on an improved flood filling algorithm and boundary smoothing technology. The classical flood filling algorithm usually uses a recursive method for filling, while the improved flood filling algorithm of the present invention first uses scan line filling to quickly fill the area to be filled, and then uses recursive filling to accurately fill the irregular boundaries of the area to be filled. The specific filling steps are as follows: First, the mask image threshold is processed into a binary image, in which the pixel values ​​of the background and the area to be filled are 0, and the pixel values ​​of the identified lean meat area are 255. Then, the yolov5 model is used to identify the area to be filled in the binary image, and the pixel coordinates of the area to be filled are averaged to calculate the geometric center point of each area to be filled. These geometric center points will be used as seed points for the improved flood filling algorithm, and the filling pixels of the algorithm are set to 2. 55, the termination condition is set to 255, that is, when encountering a boundary with a pixel value of 255, the filling is stopped; all the areas to be filled are first filled with scan lines, each seed point is expanded to the left and right, and it is terminated when encountering a boundary with a pixel value of 255. All 0 pixels encountered during the expansion process are filled with 255. After the current row is filled, it moves to the upper and lower rows. For each new row, the above left and right expansion and filling process is repeated; then a point close to the boundary but still in the area to be filled is selected as a new seed point to continue recursive filling, and the pixels in the four directions of the seed point are checked. If the value of the adjacent pixel is not 255, the pixel is filled with 255, and the point is used as a new seed point to continue recursive filling, and the above process is repeated until all the pixels in the area to be filled are filled with 255. After the hole filling is completed, the Gaussian filter is used to smooth the filled boundary pixels, so that the transition between the filled boundary and the original image boundary is more natural, and finally the pork belly lean meat area image processed by the improved flood filling algorithm and boundary smoothing technology is output.

[0023] Step 8: Calculate the number of pixels in the pork belly area and lean meat area obtained in step 4 and step 7.

[0024] Furthermore, the specific implementation method of step 1 is as follows: prepare several strips of pork belly, and divide them into blocks of approximately 50mm×50mm×40mm in size, with a weight range of 125g-132g.

[0025] Furthermore, a specific implementation scheme of step 3 is as follows: the original hyperspectral image obtained in step 2 is subjected to black-and-white correction to reduce the influence of camera current, light source illumination intensity and other unstable factors. The black-and-white correction calculation formula is as follows:

[0026]

[0027] Where R is the calibrated hyperspectral image data; I is the collected original hyperspectral image data; W is the data of the standard white calibration plate; and B is the black background data.

[0028] Furthermore, the specific implementation plan of step 6 is: use the image data set produced in step 4 to train the pork belly lean meat fusion segmentation network model, save the model with the highest accuracy in the training set as the optimal network model, use the optimal network model to realize the recognition and segmentation of pork belly lean meat, and obtain the pork belly lean meat mask image.

[0029] Furthermore, a specific implementation plan of step 8 is as follows: traverse the entire image, calculate the number of pixels in the pork belly area and the lean meat area obtained in step 4 and step 7, and the lean meat rate is the ratio of the two.

[0030] Beneficial effects of the present invention:

[0031] (1) The Logistics chaos strategy, the Golden Sine strategy and the Gaussian mutation improved algorithm were introduced into the classic marine predator algorithm to optimize the diversity of the characteristic bands that are beneficial to the network model and avoid the influence of insignificant spectral bands on the accuracy of the subsequent pork belly lean meat segmentation model. The improved marine predator algorithm was connected in series with the Robust PCA algorithm to achieve multi-stage dimensionality reduction, which helps to extract and retain the important features of pork belly hyperspectral data more comprehensively and accurately, thereby obtaining richer feature expressions in the dimensionality reduction process.

[0032] (2) The pyramid pooling modules of the U-Net encoding network and the PSPNet network are horizontally connected to improve the network's extraction of pork belly lean meat features, and a deep separable convolution module is constructed to achieve the separation of channels and space, so that the hybrid attention module can more conveniently capture channel information and spatial information, which improves the detection efficiency of the model as a whole, making it more suitable for segmentation of complex images, and further improving the segmentation accuracy and robustness.

[0033] (3) The depthwise separable residual convolution submodule and the hybrid attention submodule are connected in series to fully extract the feature information between channels and spatial positions, improve the segmentation accuracy of the lean meat area, and weight the region of interest in the skip connection layer through the attention mechanism in the attention fusion module to make the feature map of the convolution stage more compact, improve the network's anti-interference ability, and thus improve the segmentation accuracy of the lean meat area.

[0034] (4) Combining recursive filling and scanline filling, supplemented by boundary smoothing, significantly improves the flexibility and accuracy of the filling task, reduces the discontinuity between the filling area and the boundary of the original image, and makes the overall visual effect of the filled image more continuous and natural, thereby improving the overall visual quality of the image. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] Figure 1 It is a schematic diagram of the flow chart of an embodiment of the present invention.

[0036] Figure 2 a is a reconstructed image synthesized in an embodiment of the present invention.

[0037] Figure 2 b is a visualization diagram of the pork belly lean meat after segmentation in an embodiment of the present invention.

[0038] Figure 2 c is a binarized image in an embodiment of the present invention.

[0039] Figure 2 d is a visualization effect diagram after the smooth hole filling module in the embodiment of the present invention.

[0040] Figure 3 It is an overall structural diagram of the combination of the U-Net encoding network and the pyramid pooling module of the PSPNet network in the present invention. DETAILED DESCRIPTION

[0041] The specific implementation of the present invention is further described below in conjunction with the accompanying drawings and technical solutions.

[0042] The present invention proposes a method for detecting lean meat rate of pork belly based on hyperspectral technology, such as Figure 1 As shown, the technical solution of this embodiment includes the following steps:

[0043] Step 1: Prepare several strips of pork belly and cut them into pieces of approximately 50mm×50mm×40mm in size, with a weight range of 125g-132g.

[0044] Step 2: Place the sample obtained in step 1 on the conveyor platform of the hyperspectral imager and send it to the spectrum collection area. The halogen lamps are located on both sides of the sample, 20 cm above the sample, and at a 45° angle to the horizontal direction. The original image and its spectrum are collected by the spectral camera. The parameters of the hyperspectral imager are set as follows: band range 380.2-1020.2nm, spectral resolution 2.8nm, exposure time 10ms, gain 1, object distance 500mm, image resolution 900*1400, and moving stage moving speed 2cm / s.

[0045] Step 3: Perform black and white correction on the original hyperspectral image obtained in step 2 to reduce the influence of camera current, light source illumination intensity and other unstable factors. The black and white correction calculation formula is as follows:

[0046]

[0047] Where R is the calibrated hyperspectral image data; I is the collected original hyperspectral image data; W is the data of the standard white calibration plate; and B is the black background data.

[0048] Step 4: In view of the fact that pork belly is easily affected by blood stains, minced meat, lighting conditions and noise, it is extremely important to find the most representative spectral feature bands to distinguish between fat and lean meat areas. Therefore, the present invention designs a pork belly dimensionality reduction and image reconstruction module, and improves the original marine predator algorithm and connects it in series with the Robust PCA algorithm to achieve multi-stage dimensionality reduction. That is, after the first stage dimensionality reduction is achieved using the improved marine predator algorithm, the Robust PCA algorithm performs the second stage dimensionality reduction on this basis and reconstructs the pork belly image. The improved marine predator algorithm introduces Logistics chaotic mapping to initialize the population in the initialization stage of the classic marine predator algorithm, so that the algorithm can more effectively explore the band combination that is most distinguishing between fat and lean meat in the pork belly image, thereby improving the exploration efficiency of the algorithm; then the golden sine strategy is introduced in the early, middle and late stages of the algorithm update iteration to coordinate the local and global searches of the algorithm, so that the algorithm can effectively search the valuable areas in detail and improve the quality of the pork belly lean meat band; after obtaining the precise band combination, a new solution is generated by introducing Gaussian mutation at the optimal solution position to perform perturbation mutation, thereby increasing the algorithm's sensitivity to the subtle parts of the pork belly lean meat and obtaining the optimal beneficial band. The beneficial bands determined by the first stage dimensionality reduction algorithm are used as the input of the Robust PCA algorithm to achieve the second stage dimensionality reduction. The three bands obtained by the first and second stages of dimensionality reduction are 751.2nm, 576.3nm, and 536.5nm. The principal components of these three bands are extracted and assigned to the R, G, and B color channels of the pig streaky reconstructed image. Specifically, the grayscale value of the 751.2nm principal component map is assigned to the R value of the synthetic image, the grayscale value of the 576.3nm principal component map is assigned to the G value of the synthetic image, and the grayscale value of the 536.5nm principal component map is assigned to the B value of the synthetic image to obtain a reconstructed image containing the pork belly area. The final pig streaky detection model data set has a total of 750 pig streaky reconstructed images, as shown in Figure 2 As shown in a.

[0049] Step 5: Design a fusion segmentation network module for pork belly lean meat. The module consists of a fusion segmentation network submodule, a hybrid attention submodule and a deep separable residual convolution submodule. The fusion segmentation network submodule is the core architecture. The architecture is formed by horizontally connecting the U-Net encoding network and the pyramid pooling module of the PSPNet network, and placing the mixed-scale pooling layer into the pyramid pooling module of the PSPNet network. The maximum pooling, global average pooling and hole convolution pooling operations are performed in parallel. Then the deep separable residual convolution submodule and the hybrid attention submodule are sequentially integrated into the U-Net encoding network of the fusion segmentation network submodule. The deep separable residual convolution submodule includes two 3×3 deep separable convolution layers, two nonlinear ReLU layers, and two 2×2 maximum pooling layers. Finally, the output feature map of the residual connection and the output feature map of the main path are element-wise added. The final feature map is used as the input of the hybrid attention submodule to further improve the segmentation accuracy of the model. The hybrid attention submodule consists of a spatial attention (SA) module and an efficient channel attention (Efficient Channel Attention). Attention, ECA) modules are designed in parallel. The overall structure of the network is shown in the figure below. Figure 3 As shown in the figure, after testing, its average intersection-over-union ratio and Dice coefficient can reach 0.9328 and 0.8857, indicating that it has superior performance in the task of pork belly lean meat segmentation, can accurately distinguish fat and lean meat, and significantly improves the accuracy and efficiency of segmentation.

[0050] Step 6: Divide the pork belly detection model dataset produced in step 4 into a training set and a test set in a ratio of 8:2, and train the pork belly lean meat fusion segmentation network. Save the model with the highest accuracy in the training set as the optimal network model, and use the optimal network model to realize the recognition and segmentation of pork belly lean meat. The input of the model is Figure 2 The output of the pig streaky image shown in a is Figure 2 b shows the mask image of pork belly lean meat.

[0051] Step 7: There are usually a small number of "fine and fat" areas in the mask image of pork belly lean meat obtained in step 6 that are not segmented into lean meat areas, so the mask image needs to be filled with holes before calculating the lean meat rate. The present invention constructs a smooth hole filling module based on the improved flood filling algorithm and boundary smoothing technology. The classic flood filling algorithm usually uses a recursive method for filling, while the improved flood filling algorithm of the present invention first uses scan line filling to quickly fill the area to be filled, and then uses recursive filling to accurately fill the irregular boundaries of the area to be filled. The specific filling steps are as follows: First, the mask image threshold is processed into a binary image, in which the pixel values ​​of the background and the area to be filled are 0, and the pixel values ​​of the identified lean meat area are 255. Then, the yolov5 model is used to identify the area to be filled in the binary image, and the pixel coordinates of the area to be filled are averaged to calculate the geometric center point of each area to be filled. These geometric center points will be used as seed points of the improved flood filling algorithm. The filling pixels of the algorithm are set to 255, and the termination condition is set to 255. Then, the improved flood filling algorithm is used to complete the filling of the area to be filled. After the hole filling is completed, the Gaussian filter is used to smooth the filled boundary pixels to make the transition between the filled boundary and the original image boundary more natural, and the final image of the lean pork belly area is obtained as shown in the figure. Figure 2 As shown in d.

[0052] Step 8: Traverse the entire image and perform mathematical statistics on the pixel points of the images obtained in step 4 and step 7. Count the number of pixels in the pork belly area and the lean meat area. The ratio of the number of pixels in the lean meat area to the number of pixels in the pork belly area is the lean meat rate.

[0053] Step 9: Test and evaluate the segmentation network module. In order to test the effect of the hybrid attention module in the segmentation task of this embodiment, the segmentation results of the classic PSPNet neural network and the PSPNet of the hybrid attention module are compared with the pork belly lean meat fusion segmentation network module constructed in this application. The 150 pork belly images in the test set were tested, and the network test results are shown in Table 1 below, where the Mean Intersection over Union (Mean Intersection over Union, Miou) and the Dice Similarity Coefficient (Dice Similariy Coefficient, DSC) are commonly used evaluation indicators for segmentation tasks, so this application uses these two indicators to test the accuracy of the segmentation network module results.

[0054] Table 1 Model test results

[0055] Segmentation method MioU Dice Classic PSPNet 0.8933 0.8148 AttentionPSPNet 0.9167 0.8526 Pork belly lean meat fusion segmentation network module 0.9328 0.8857

[0056] According to the test results, the network with the addition of hybrid attention has achieved improvements in various indicators, and the pork belly lean meat fusion segmentation network module constructed by combining the U-Net encoding network and the PSPNet network and introducing the hybrid attention module has achieved the best results.

[0057] Therefore, the present invention combines hyperspectral technology with deep learning technology to achieve automated and real-time segmentation of fat and lean meat in pork belly. Hyperspectral technology contains rich spatial and spectral information, and can accurately distinguish and identify fat and lean meat in images according to the different spectral responses of fat and lean meat in specific bands. These innovative functional modules improve the performance of pork belly segmentation tasks as a whole by improving the accuracy of feature extraction, optimizing feature fusion methods, introducing attention mechanisms, and improving convolutional network structures. They solve the key problem that in the lean meat segmentation task, pork belly samples are disturbed by blood stains and the like and cannot accurately segment the lean meat. They further improve the recognition accuracy, robustness, and generalization ability of the segmentation network, providing an efficient and reliable solution for the fields of food processing and quality control.

Claims

1. A method for detecting lean meat rate of pork belly based on hyperspectral technology. It is characterized in that The following steps are involved: Step 1: Preparation of pork belly samples; Step 2: Hyperspectral data acquisition; The pig streaky sample block obtained in step 1 is placed on the conveyor platform of the hyperspectral imager and sent to the spectrum collection area. The halogen lamps are located on both sides of the pig streaky sample block, 20 cm above the pig streaky sample, and at an angle of 45° to the horizontal direction. The original hyperspectral image is collected by the spectral camera; Step 3: Perform black and white correction on the original hyperspectral image obtained in step 2; Step 4: Design a pig streaky dimension reduction and image reconstruction module, and use it to complete the dimension reduction of pig streaky hyperspectral data and the construction of a pig streaky detection model dataset; Design a pig streaky dimension reduction and image reconstruction module, and connect the improved marine predator algorithm and the Robust PCA algorithm in series to achieve multi-stage dimension reduction. That is, after the first stage of dimension reduction is achieved using the improved marine predator algorithm, the Robust PCA algorithm performs the second stage of dimension reduction and reconstructs the pig streaky image on this basis. The improved marine predator algorithm is to introduce the Logistics chaos map to initialize the population in the initialization stage of the marine predator algorithm; after the initial stage, the golden sine strategy is introduced in the front, middle and late stages of the marine predator algorithm update iteration to coordinate the local search and global search of the algorithm; after obtaining the band combination through the above steps, a new solution is generated by introducing Gaussian mutation at the optimal solution position to obtain the final beneficial band; the final beneficial band is used as the input of the Robust PCA algorithm to achieve the dimensionality reduction in the second stage, the number of output bands is set to three, the principal component images of the three output bands are extracted, and the three principal component images are used to reconstruct the pork belly image, that is, the grayscale image of the first principal component is assigned to the R channel of the reconstructed pork belly image, the grayscale image of the second principal component is assigned to the G channel of the reconstructed pork belly image, and the grayscale image of the third principal component is assigned to the B channel of the reconstructed pork belly image, so as to obtain a reconstructed image containing the pork belly area, thereby constructing a pork belly detection model data set; Step 5: Design a pork belly lean meat fusion segmentation network module, and use it to segment the lean meat in the pork belly reconstructed image; A pork belly lean meat fusion segmentation network module is designed, which is mainly composed of a fusion segmentation network submodule, a hybrid attention submodule and a deep separable residual convolution submodule. The fusion segmentation network submodule is the core architecture, which is formed by horizontally connecting the U-Net encoding network and the pyramid pooling module of the PSPNet network. Then, the deep separable residual convolution submodule and the hybrid attention submodule are sequentially connected in series into the U-Net encoding network of the fusion segmentation network submodule. Step 5-1: Construct a fusion segmentation network submodule, split the U-Net network into an encoding network and a decoding network at the jump connection position, discard the original decoding network, and replace the backbone network Resnet50 in the PSPNet network with the U-Net encoding network; construct a mixed-scale pooling layer that performs maximum pooling, global average pooling, and dilated convolution pooling operations in parallel, and put it into the pyramid pooling module of the PSPNet network, that is, replace the original global average pooling layer corresponding to the four different scales with a mixed-scale pooling layer respectively. For each scale, the mixed-scale pooling layer performs three different pooling operations of maximum pooling, global average pooling, and dilated convolution pooling in parallel; Step 5-2: Design a hybrid attention submodule. Design a hybrid attention submodule based on the spatial attention SA module and the efficient channel attention ECA module. The spatial attention SA module and the efficient channel attention ECA module are connected in parallel. In the fusion segmentation network module, the reconstructed image of the pork belly in the pork belly detection model data set is first input into the depth-separable residual convolution submodule. The feature map obtained after convolution and pooling operations is then input into the spatial attention SA module and the efficient channel attention ECA module respectively. The spatial attention SA module takes the maximum and global average pooling fusion of the input feature map to obtain a H×W×2 vector, where H and W are the width and height of the input feature map, respectively. Then, a convolution operation is performed, and the spatial weight coefficient is calculated using the Sigmoid function. Finally, the spatial weight coefficient is multiplied point by point with the input reconstructed image of the pork belly to obtain a weighted feature map. The efficient channel attention ECA module uses global average pooling to compress the spatial information of the input feature map to obtain a 1×1×C vector, where C is the number of channels of the input feature map; adaptive one-dimensional convolution is used between each channel of the feature map and k adjacent channels to avoid multi-channel dimensionality reduction. k represents the coverage of cross-channels, and k=3 is defined, leaving only channel attention information; then the channel weight coefficient is calculated using the Sigmoid function, and finally the channel weight coefficient is multiplied point by point with the input pork belly reconstructed image to obtain a weighted feature map; the two weighted feature maps of the output are fused by element-level product to obtain a feature map with spatial and channel attention; Step 5-3: Construct a depth-wise separable residual convolution submodule. First, replace the original 3×3 convolution layer in the U-Net encoding network with a 3×3 depth-wise separable convolution layer. Then, add a residual connection between the feature map input position and the output feature map after convolution. The depth-wise separable residual convolution submodule constructed in this way includes two 3×3 depth-wise separable convolution layers, two nonlinear ReLU layers, and two 2×2 maximum pooling layers. Finally, the output feature map of the residual connection and the output feature map of the main path are element-wise added to obtain the final feature map. Step 6: Input the reconstructed pork belly image created in step 4 into the pork belly lean meat fusion segmentation network module in step 5 for model training, and output the segmented pork belly lean meat area image; Step 7: Use the smooth hole filling module to smooth and fill holes in the image segmented in step 6; A smooth hole filling module is constructed based on the improved flood filling algorithm and boundary smoothing technology. Scan line filling is first used to quickly fill the area to be filled, and then recursive filling is used to accurately fill the irregular boundaries of the area to be filled. The specific filling steps are as follows: First, the mask image threshold is processed into a binary image, in which the pixel values ​​of the background and the area to be filled are 0, and the pixel value of the identified lean meat area is 255. Then, the yolov5 model is used to identify the area to be filled in the binary image, and the pixel coordinates of the area to be filled are averaged to calculate the geometric center point of each area to be filled. These geometric center points will be used as seed points for the improved flood filling algorithm. The filling pixels of the algorithm are set to 255, and the termination condition is set to 255, that is, the filling is stopped when the boundary with a pixel value of 255 is encountered; for all areas to be filled, scan line filling is first used, and each seed point is expanded to the left and right, and it is terminated when the boundary with a pixel value of 255 is encountered. All 0 pixels encountered during the expansion process are filled with 255. After the current row is filled, it moves to the upper and lower rows. For each new row, the above left and right expansion and filling process is repeated; Then, a point close to the boundary but still within the area to be filled is selected as a new seed point to continue recursive filling, and the pixels in the four directions of the seed point, up, down, left, and right are checked. If the value of the adjacent pixel is not 255, the pixel is filled with 255, and the point is used as a new seed point to continue recursive filling, and the above process is repeated until all the pixels in the area to be filled are filled with 255; after the hole filling is completed, the Gaussian filter is used to smooth the filled boundary pixels, so that the transition between the filling boundary and the boundary of the original pork belly lean meat area image is more natural, and finally the pork belly lean meat area image processed by the improved flood filling algorithm and boundary smoothing technology is output; Step 8: Traverse the entire image and calculate the number of pixels in the pork belly area and lean meat area obtained in step 4 and step 7. The lean meat rate is the ratio of the two.

2. The method for detecting lean meat rate of pork belly based on hyperspectral technology according to claim 1, It is characterized in that The pork belly samples are in the size of 50mm×50mm×40mm blocks, with a weight range of 125g-132g.

3. The method for detecting lean meat rate of pork belly based on hyperspectral technology according to claim 1, It is characterized in that The parameters of the hyperspectral imager are set as follows: band range 380.2-1020.2nm, spectral resolution 2.8nm, exposure time 10ms, gain 1, object distance 500mm, image resolution 900*1400, and moving stage moving speed 2cm / s.

4. The method for detecting lean meat rate of pork belly based on hyperspectral technology according to claim 1, It is characterized in that The black and white correction calculation formula is as follows: Where R is the calibrated hyperspectral image data; I is the collected original hyperspectral image data; W is the data of the standard white calibration plate; and B is the black background data.

5. The method for detecting lean meat rate of pork belly based on hyperspectral technology according to claim 1, It is characterized in that Use the pork belly detection model data set produced in step 4 to train the pork belly lean meat fusion segmentation network model, save the model with the highest accuracy in the training set as the optimal network model, use the optimal network model to realize pork belly lean meat recognition and segmentation, and obtain the pork belly lean meat mask image.