Method for detecting lean meat percentage of streaky pork based on hyperspectral technology
By combining hyperspectral technology and deep learning technology, a multi-stage dimensionality reduction and feature fusion module is designed to solve the problem of interference factors in pig belly lean meat segmentation, achieve high-precision and robust lean meat segmentation, and is suitable for complex Environmental background, providing efficient solutions for food processing and quality control.
Patent Information
- Application Number
- CN202410807974.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-21
- Publication Date
- 2024-10-08
- Estimated Expiration
- 2044-06-21
AI Technical Summary
Existing pork belly lean meat rate detection technology is difficult to achieve accurate fat and lean meat segmentation when faced with interfering factors such as blood stains, minced meat, lighting conditions and noise, and is insufficient in capturing complex environmental backgrounds and morphological features, affecting segmentation accuracy and robustness.
Combining hyperspectral technology and deep learning technology, the Zhuwuhua dimensionality reduction and image reconstruction module is designed, using the improved ocean predator algorithm and Robust PCA algorithm for multi-stage dimensionality reduction, and combining the pyramid pooling of the U-Net coding network and the PSPNet network module, introduces hybrid attention and depth-separable residual convolution sub-modules, optimizes feature extraction and fusion methods, and enhances the adaptability and anti-interference ability of the model.
It improves the accuracy and robustness of lean pork belly segmentation, enhances the adaptability to complex environmental backgrounds, significantly improves the recognition accuracy and generalization ability of the segmentation network, and provides an efficient and reliable solution.
Smart Images

Figure CN118747799A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the fields of food industrialization and artificial intelligence, and specifically relates to a method for detecting the lean meat rate of pork belly based on hyperspectral technology. Background Art
[0002] Pork belly is one of the most popular cuts of pork carcass. Different fat-to-lean ratios reveal distinct differences in texture, texture, and flavor. A higher lean ratio results in a denser, firmer texture, suitable for consumers who prefer lighter flavors. A higher fat ratio imparts a richer flavor and fat content, making the meat more juicy and flavorful, making it suitable for use in gourmet dishes. Pork belly with a balanced fat-to-lean ratio offers a richer texture and tender, juicy texture. Furthermore, consumer preferences vary regarding the leanness of pork belly. Therefore, automated lean meat testing can provide objective fat-to-lean ratio data, enabling appropriate pricing and categorization in the market. This helps meet the diverse fat-to-lean ratio requirements of different consumers and provides more options for pork belly in various market segments. It can also improve production efficiency and quality control, ensuring product consistency and standardization.
[0003] Currently, image processing technology relies solely on color threshold segmentation within a single digital image processing algorithm. This method is only applicable to lean meat detection in samples with uniform lighting and no contamination. However, the cutting process of pork belly produces blood stains and minced meat, which reduces the contrast between fat and lean meat and interferes with the threshold setting of the threshold segmentation algorithm. Furthermore, color threshold segmentation is particularly sensitive to noise and lighting conditions, affecting the accuracy of the threshold segmentation. Patent: "A Method for Identifying Aircraft Takeoff and Landing Runways Based on a 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 acquisition based on visible light 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 of pork belly with diverse environmental backgrounds and complex morphology and texture characteristics.
[0005] Therefore, the present invention combines hyperspectral technology and deep learning technology to realize the 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 based on 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 interfered with by blood stains and other factors 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 the 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 five flower sample obtained in step 1 is placed on the conveyor platform of the hyperspectral imager and sent to the spectrum collection area. The halogen lamp is located on both sides of the pig five flower sample, 20 cm above the pig five flower sample, and at a 45° angle to the horizontal direction. The original hyperspectral image is collected by a 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;
[0012] Step 3: Perform black and white correction on the original hyperspectral image obtained in step 2;
[0013] Step 4: Design a pig streaky dimensionality reduction and image reconstruction module, and use it to complete the dimensionality reduction of the pig streaky hyperspectral data and construct the dataset for the subsequent detection model;
[0014] Given that pork belly is easily affected by blood stains, minced meat, lighting conditions, and noise, finding the most representative spectral feature bands is extremely important for distinguishing between fat and lean meat areas. Therefore, the present invention designs a pork belly dimensionality reduction and image reconstruction module. The original marine predator algorithm is improved and then connected in series with the Robust PCA algorithm to achieve multi-stage dimensionality reduction. That is, after using the improved marine predator algorithm to achieve the first stage of dimensionality reduction, 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 is most distinguishable between fat and lean meat in the pig 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 pig 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 algorithm's sensitivity to the subtle parts of the pig 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 achieve the second stage of dimensionality reduction, and the number of output bands is set to three. The principal component images of these 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 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 dataset; this improvement makes the algorithm more adaptable to the dynamically changing collection environment of pork belly by increasing the diversity of the initial population and optimizing the search efficiency and quality, thereby improving the algorithm's global search ability for bands that are beneficial to pork belly, and effectively improving 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] Furthermore, the specific implementation plan of step 5 is: designing a pork belly lean meat fusion segmentation network module, which consists of a fusion segmentation network submodule, a hybrid attention submodule and a depth-separable residual convolution submodule. The fusion segmentation network submodule is used as the core architecture. The architecture is composed of a U-Net encoding network and a pyramid pooling module of a PSPNet network connected horizontally. Then, the depth-separable residual convolution submodule and the hybrid attention submodule are sequentially integrated in series into the U-Net encoding network of the fusion segmentation network submodule 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 void 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 void convolution pooling in parallel, enhancing the network module's ability to capture small area lean meat features in pork belly images, which 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 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. This refers to the part where lean meat and fat are interlaced and stacked in the pork belly. This part belongs to the lean meat area. Usually, there will be some evenly distributed small granular fat in this area. This part 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 (ECA) module. The SA module and the ECA module are connected in parallel. In the fusion segmentation network module, the reconstructed image of the pig belly in the data set is first input into the depth-separable residual convolution submodule. The feature maps obtained by 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 pig belly reconstructed image. Point-by-point multiplication obtains a 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 a weighted feature map; the two weighted feature maps output are fused at the element level to obtain a feature map with spatial and channel attention.
[0019] Step 5-3: Construct a depthwise separable residual convolution submodule. First, replace the original 3×3 convolution layer in the U-Net encoding network with a 3×3 depthwise separable convolution layer. Then, add a residual connection between the feature map input position and the output feature map after convolution. The depthwise separable residual convolution submodule constructed in this way includes two 3×3 depthwise 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. This can better integrate the feature information from different paths to obtain the final feature map. This improvement achieves channel-space separation, facilitating the subsequent hybrid attention module to capture channel and spatial information. Overall, it improves the detection speed and accuracy of the model and enhances the model's feature expression.
[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 image of the pork belly lean meat area;
[0021] Step 7: Use the smooth hole filling module to smooth and fill holes in the image segmented in step 6;
[0022] Furthermore, the specific implementation plan of step 7: There are usually a small number of "lean and fat" areas in the mask image of pork belly lean meat obtained in step 6 that have not been segmented into lean meat areas. Therefore, the mask image needs to be hole-filled 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 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 of 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, filling stops when encountering a boundary with a pixel value of 255; all areas to be filled are first filled using scan lines, and each seed point is expanded to the left and right. 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 filling the current row, 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. The pixels in the four directions of the seed point are checked. If the values of the adjacent pixels are not 255, the pixel is filled with 255 and the point is used as a new seed point to continue recursive filling. The above process is repeated until all pixels in the area to be filled are filled with 255. After the hole filling is completed, the filled boundary pixels are smoothed using a Gaussian filter to make the transition between the filled boundary and the original image boundary more natural. Finally, the image of the lean pork belly area 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 plan of step 1 is: prepare several pieces of pork belly, and divide them into samples with a size of about 50mm×50mm×40mm, with a weight range of 125g-132g.
[0025] Furthermore, a specific implementation plan of step 3 is to 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:
[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 steps 4 and 7, and the lean meat rate is the ratio of the two.
[0030] Beneficial effects of the present invention:
[0031] (1) The Logistic Chaos Strategy, Golden Sine Strategy and Gaussian Mutation Improvement Algorithm were introduced into the classic marine predator algorithm, which optimized the diversity of the characteristic bands that are beneficial to the network model and avoided 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 helped 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 U-Net encoding network and the pyramid pooling module of 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, makes it more suitable for segmentation of complex images, and further improves the segmentation accuracy and robustness.
[0033] (3) The depthwise separable residual convolution submodule and the hybrid attention submodule are sequentially connected in series to fully extract the feature information between channels and spatial positions, thereby improving the segmentation accuracy of the lean meat area. The attention mechanism in the attention fusion module is used to weight the region of interest in the jump connection layer, making the feature map of the convolution stage more compact and improving the network's anti-interference ability, thereby improving 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 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 an embodiment of the present invention.
[0040] Figure 3 This is the 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 transport stage of the hyperspectral imager and move it to the spectrum collection area. Halogen lamps are positioned on both sides of the sample, 20 cm above the sample and at a 45° angle to the horizontal. A spectral camera is used to capture the original image and spectrum. The hyperspectral imager parameters are set as follows: band range 380.2-1020.2 nm, spectral resolution 2.8 nm, exposure time 10 ms, gain 1, object distance 500 mm, image resolution 900 x 1400 pixels, and moving stage speed 2 cm / 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 characteristics of pork belly being easily affected by blood stains, minced meat, lighting conditions and noise, finding the most representative spectral feature band is extremely important for distinguishing between fat and lean meat areas. Therefore, the present invention designs a pork belly dimensionality reduction and image reconstruction module. The original marine predator algorithm is improved and then connected in series with the Robust PCA algorithm to realize multi-stage dimensionality reduction. That is, after using the improved marine predator algorithm to realize the first stage of dimensionality reduction, the Robust PCA algorithm performs the second stage of dimensionality reduction on this basis and reconstructs the pork belly image. The improved marine predator algorithm introduces the Logistics chaos map 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 distinguishable 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 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 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 part 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 stage 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 image is assigned to the R value of the synthetic image, the grayscale value of the 576.3nm principal component image is assigned to the G value of the synthetic image, and the grayscale value of the 536.5nm principal component image 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 dataset has a total of 750 pig streaky reconstructed images, as shown in Figure 5. Figure 2 As shown in a.
[0049] Step 5: Design the pork belly lean meat fusion segmentation network module, which consists of a fusion segmentation network submodule, a hybrid attention submodule and a depth-wise separable residual convolution submodule. The fusion segmentation network submodule is the core architecture. The architecture is composed of a U-Net encoding network and a pyramid pooling module of the PSPNet network, and the mixed-scale pooling layer is placed in the pyramid pooling module of the PSPNet network. The maximum pooling, global average pooling and void convolution pooling operations are performed in parallel. Then the depth-wise 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 depth-wise separable residual convolution submodule 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. 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 and 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 an 8:2 ratio, 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: In the mask image of pork belly lean meat obtained in step 6, there are usually a small amount of "lean and fat" areas that are not segmented into lean meat areas. Therefore, the mask image needs to be hole-filled 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, where 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, the termination condition is set to 255, and 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 pixels of the images obtained in steps 4 and 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, among which the Mean Intersection over Union (Miou) and the Dice Similarity Coefficient (DSC) are commonly used evaluation indicators for segmentation tasks. Therefore, 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 achieved the best results.
[0057] Therefore, the present invention combines hyperspectral technology and deep learning technology to realize the 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 based on 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 interfered with by blood stains and other factors 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, 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 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 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 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 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.
Citation Information
Patent Citations
Aircraft take-off and landing runway identification method based on PSPNet network
CN113052106A
Pork intramuscular fat content nondestructive testing method based on computer vision
CN105701805A
Cantonese style sausage hyperspectral image-based lean meat and fat meat adaptive separation method
CN107403181A
Intelligent musk identification method based on hyperspectral imaging and application
CN115937670A
Neural network algorithm-based multi-part pork intramuscular fat content estimation method
CN116452489A
Cited By
Efficient pixel point filling method and system based on adaptive boundary detection technology
CN119068007A
Multi-spectral image intelligent processing method based on unmanned aerial vehicle
CN120014073A
Pork flavor substance nondestructive testing method and system based on hyperspectrum
CN122524713A
Nondestructive detection method and system for flavor substances of pork based on hyperspectrum
CN122524713B
