Method and device for automatically segmenting and quantifying body composition of live pig based on CT (Computed Tomography) image scanning

Through a deep learning method combining gradient-guided horizontal set edge strengthening segmentation method and a bidirectional convolutional residual framework, the accuracy and efficiency problems of fat, lean meat and bone segmentation and quantification in live pigs are solved, and fast and accurate automated segmentation and quantification are achieved, which is suitable for pig breeding, precise breeding and food processing.

CN120411142APending Publication Date: 2025-08-01ANHUI UNIVERSITY OF TECHNOLOGY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510507191.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-22
Publication Date
2025-08-01

AI Technical Summary

Technical Problem

The prior art has problems such as low segmentation accuracy, high model complexity or time-consuming in the segmentation and quantification of CT images of fat, lean meat and bones in live pigs, making it difficult to achieve fast and accurate automated segmentation and quantization.

Method used

Using a deep learning-based method, combined with the gradient-guided horizontal set edge strengthening segmentation method and the bidirectional convolution residual frame, the CT bed part was removed through the gradient-guided horizontal set edge strengthening segmentation method, and the bidirectional convolution residual frame was used to segment and quantify internal organs, and combined with the Gaussian distribution to calculate the segmentation threshold for fat, lean meat and bones were identified and quantified.

Benefits of technology

It realizes the rapid and accurate segmentation and quantification of the body fat, lean meat and bones of live pigs, reduces errors and variations caused by manual operations, improves segmentation accuracy and calculation efficiency, and is suitable for live pigs of different sizes and shapes, providing scientific data support.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120411142A_ABST
    Figure CN120411142A_ABST
Patent Text Reader

Abstract

The invention discloses a CT image scanning-based live pig body composition automatic segmentation and quantification method and device, and belongs to the technical field of segmentation and quantification. The method comprises the following steps: acquiring CT scanning image data of a live pig, and preprocessing the CT scanning image data; segmenting the preprocessed CT scanning image based on a gradient guidance level set edge enhancement segmentation method so as to remove a CT bed part in the image; predicting a segmentation mask of the visceral organ based on a bidirectional convolution residual frame, and further removing visceral tissues of the live pig from the scanning image of which the CT bed part is removed according to a prediction result; and identifying and quantifying bones, lean meat and fat of the live pigs to obtain the mass and mass ratio of each tissue. Through a deep learning technology and a CT imaging technology, bones, lean meat, fat and the like in a live pig body can be quickly and accurately segmented and quantitatively analyzed, so that certain technical support is favorably provided for agricultural production, scientific research and food safety.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of segmentation and quantization, and more specifically, relates to a method and device for automatic segmentation and quantization of live pig body composition based on deep learning CT image scanning. Background Art

[0002] With the development of modern animal husbandry, precision farming has become an important means to improve production efficiency and optimize the quality of live pigs. Traditional analysis of pig body composition mainly relies on post-slaughter anatomical measurements, which are not only time-consuming and laborious but also destructive and cannot be applied to live pigs. In addition, although estimation methods based on B-ultrasound or bioelectrical impedance analysis can obtain pig body composition information to a certain extent, they have low accuracy and are greatly affected by individual differences and measurement environments.

[0003] In recent years, computed tomography (CT) technology has been widely applied in the field of animal science, which can provide high-resolution cross-sectional images, making it possible to evaluate the body composition of live pigs. However, due to the large amount of CT image data and the blurred tissue boundaries, it is difficult to efficiently and accurately complete segmentation and quantization through manual analysis. Therefore, the automatic segmentation and quantization method of CT images based on deep learning has become an important research direction to solve this problem.

[0004] After retrieval, a Chinese patent application with the application number 2024101802183 discloses a CT segmentation method based on context fusion perception. The method includes: constructing a CT image segmentation model including a backbone structure with an encoder and a decoder, a parallel dilated convolution module PDCM, a pyramid fusion module PFM, and a position attention module PAM; using cross-entropy and dice loss as a mixed loss to optimize the model; using the encoder to encode the input image and output the encoding results at different stages; using the PFM module to cascade the encoding results at different stages and perform context feature fusion through separable dilated convolutions at different rates, and connecting the output to the decoder skip connection at the same stage; using the PDCM module to enhance the fusion of the feature map finally output by the encoder through six different branches, and sending the transformed high-order feature map to the decoder; using the PAM module to locate and segment the target through multi-layer position attention for the feature maps at each stage output by the decoder. Although this application improves the accuracy and robustness of segmentation to a certain extent through context fusion perception, its possible disadvantages include high model complexity, large computational resource requirements, and long training time. Summary of the Invention

[0005] In view of the problems of low segmentation accuracy, high model complexity or long time consumption in the prior art when segmenting and quantifying fat, lean meat, bones, etc. in live pigs, this solution provides an automatic segmentation and quantification method and device for the body composition of live pigs based on CT image scanning. Through deep learning technology and CT imaging technology, the present invention can quickly and accurately segment and quantitatively analyze bones, lean meat, fat, etc. in live pigs, which is beneficial to providing certain technical support for agricultural production, scientific research and food safety, and the model structure of the present invention is relatively simple.

[0006] To achieve the above object, the technical solution provided by the present invention is as follows:

[0007] The first aspect of the present invention provides an automatic segmentation and quantification method for the body composition of live pigs based on CT image scanning, including:

[0008] S1. Obtain the CT scan image data of live pigs and preprocess it;

[0009] S2. Based on the gradient-guided level set edge enhancement segmentation method (CT table segmentation network), segment the preprocessed CT scan image to remove the CT table part in the image;

[0010] The gradient-guided level set edge enhancement segmentation method represents the segmentation boundary with the level set function φ(x, y), uses the edge information of the image to guide the segmentation, and combines the regional gray information to distinguish the CT table and the background; among them, φ(x, y)=0 represents the segmentation boundary, greater than 0 represents the foreground area, and less than 0 represents the background area;

[0011] S3. Based on the bidirectional convolutional residual framework, predict the segmentation mask of internal organs, and further remove the internal organs of live pigs from the scan image after removing the CT table part according to the prediction result;

[0012] S4. Identify and quantify the bones, lean meat and fat of live pigs to obtain the mass and mass ratio of each tissue.

[0013] According to the technical solution described in the first aspect of the present invention, the preprocessing in S1 includes but is not limited to denoising, contrast enhancement and voxel intensity value normalization processing;

[0014] And / or in S1, before preprocessing the image, semi-automatically label the key internal organs in the CT scan image using medical image processing software.

[0015] According to the technical solution described in the first aspect of the present invention, the S2 segmenting the preprocessed CT scan image based on the gradient-guided level set edge enhancement segmentation method to remove the CT table part in the image includes:

[0016] Initialize the segmentation boundary φ 0 (x, y), and calculate the regional consistency measure E under the current segmentation boundary region (φ), the edge consistency measure E edge (φ), and the smoothness term E smooth (φ); among them, the regional consistency measure is used to evaluate the consistency of the gray value distribution within the foreground region, the edge consistency measure is used to evaluate the sharpness of the boundary between the foreground and background regions; the smoothness term is used to control the smoothness of the boundary;

[0017] Fuse the regional consistency measure, the edge consistency measure, and the smoothness term to obtain the energy function E(φ): E(φ) = E region (φ) + α·E edge (φ) + β·E smooth (φ); α and β are the corresponding weight coefficients respectively; the parameters α and β control the contributions of different energy terms to the total energy function. α adjusts the weight of the edge consistency measure (E edge (φ)). A larger α makes the segmentation boundary pay more attention to aligning with the image edge; while β controls the influence of the smoothness term (E smooth (φ)). A larger β strengthens the smoothness of the segmentation boundary and avoids irregular boundaries. A smaller β ensures that the smoothness term does not overly interfere with the precise alignment of the segmentation boundary, while also avoiding irregular or overly tortuous boundaries to balance smoothness and edge accuracy. α is set to a larger value to emphasize edge consistency, and β is set to a smaller value to balance the requirements of smoothness and edge alignment. In the present invention, through experiments and cross-validation, the initial value of α is determined to be 1, and the value of β is 0.1, and continuous iterative optimization is performed to ensure that the segmentation result achieves the best balance between edge accuracy and boundary smoothness.

[0018] Calculate the partial derivative of the energy function E(φ) Gradually update the segmentation boundary φ t+1 (x, y):

[0019]

[0020] where η is the learning rate, which controls the step size of each update, t is the number of iterations, is the partial derivative of the total function with respect to φ, indicating the change direction under the current segmentation boundary;

[0021] Repeat the iteration until the energy function E(φ) converges or reaches the maximum number of iterations, that is, obtain the optimized segmentation boundary;

[0022] Based on the optimized segmentation boundary, remove the CT table part in the CT scan image.

[0023] According to the technical solution described in the first aspect of the present invention, before segmenting the preprocessed CT scan image based on the gradient-guided level set edge enhancement segmentation method, the slices corresponding to the head and neck on the scan image are directly discarded and do not participate in the subsequent trunk segmentation, where the total length of the head and neck occupies the first 10%-12% of the total length of the pig body.

[0024] According to the technical solution described in the first aspect of the present invention, the bidirectional convolutional residual framework in S3 includes a two-dimensional convolutional neural network R-Dense U-Net and a bidirectional convolutional long short-term memory BC-LSTM. R-Dense U-Net is used to extract intra-layer feature information from 2D slices, and BC-LSTM is used to extract hierarchical features; where:

[0025] The R-Dense U-Net includes multiple R-Dense blocks. Each R-Dense block includes three consecutive convolutional layers and realizes residual connection through a 1x1 convolutional layer; its Res-Attention path is a path including an encoder and a decoder, reduces the size of the feature map through a max-pooling operation, and increases the size of the feature map through a transposed convolutional operation;

[0026] The BC-LSTM includes a series of BC-LSTM blocks and convolutional, deconvolutional, max-pooling, and 1×1 convolutional operations. Each BC-LSTM block contains a bidirectional convolutional LSTM module, and the convolutional LSTM replaces the vector multiplication in the traditional LSTM gate with a convolutional operator.

[0027] Compared with the prior art, the BiConv-Res framework of the present invention has been carefully improved in terms of model structure and combination method, making it more advantageous in the segmentation of internal organs in live pig CT images. The traditional U-Net is prone to gradient disappearance or explosion in the deep network, resulting in a decline in feature extraction ability. The R-Dense U-Net in the BiConv-Res framework effectively alleviates the gradient problem and improves the efficiency and accuracy of feature extraction by introducing residual connection to fuse shallow feature information and deep feature information. The attention mechanism in the Res-Attention path can dynamically adjust the weight of feature information according to the important regions in the feature map, highlight key information, and suppress irrelevant information, thereby improving the segmentation accuracy.

[0028] Traditional LSTM models can only process time series data unidirectionally and cannot fully utilize context information. The BC-LSTM in the BiConv-Res framework can transmit context information in two directions by introducing a bidirectional convolutional LSTM module, capture long-term dependencies in time series data, and thus extract feature information more comprehensively. The BiConv-Res framework combines R-Dense U-Net and BC-LSTM. R-Dense U-Net is responsible for extracting and transmitting in-slice feature information, while BC-LSTM is responsible for extracting hierarchical features and fusing context information. This combination can make full use of the advantages of different network structures to achieve accurate segmentation of internal organs.

[0029] According to the technical solution described in the first aspect of the present invention, the identification and quantification of the bones, lean meat, and fat of live pigs in S4 include:

[0030] Voxel classification and segmentation: In the CT image of the live pig slice after removing internal organs, set the optimal segmentation threshold to classify and segment bones, fat, and lean meat;

[0031] Voxel quantity calculation: Accurately count the classified voxels to determine the voxel quantities of fat, lean meat, and bones;

[0032] Volume calculation: When calculating the volume of each tissue of the live pig, use the corrected pixel spacing and slice thickness. The volume calculation formula is: Volume = Voxel number × Pixel spacing × Slice thickness;

[0033] Weight calculation: Calculate the weight of each tissue based on the density and volume of fat, lean meat, and bones.

[0034] According to the technical solution described in the first aspect of the present invention, the voxel classification and segmentation specifically include:

[0035] Perform statistical analysis on the voxels in the live pig CT image, fit the CT value histogram to a Gaussian mixture model, and use the expectation maximization algorithm to solve for the optimal three-class tissue parameters;

[0036] Calculate the intersection points of the Gaussian distributions to obtain the optimized segmentation thresholds T1 and T2;

[0037] Classify the voxels using the optimized thresholds T1 and T2: v < T1 is classified as fat; T1 ≤ v < T2 is classified as lean meat; v ≥ T2 is classified as bones.

[0038] According to the technical solution described in the first aspect of the present invention, the segmentation thresholds T1 and T2 are calculated as follows:

[0039]

[0040] Among them, μ1, μ2, and μ3 are the mean CT intensity values of fat, lean meat, and bone respectively; σ1, σ2, and σ3 are the standard deviations of the CT intensity values of fat, lean meat, and bone respectively.

[0041] The second aspect of the present invention also provides an automatic segmentation and quantification device for the body composition of live pigs based on CT image scanning, including:

[0042] A data acquisition and preprocessing module, which is used to acquire the CT scan image data of live pigs and preprocess it;

[0043] A CT table segmentation module, which is used to segment the preprocessed CT scan image based on the gradient-guided level set edge enhancement segmentation method to remove the CT table part in the image;

[0044] The gradient-guided level set edge enhancement segmentation method represents the segmentation boundary with the level set function φ(x,y), uses the edge information of the image to guide the segmentation, and combines the regional gray information to distinguish the CT table and the background; among them, φ(x,y)=0 represents the segmentation boundary, greater than 0 represents the foreground area, and less than 0 represents the background area;

[0045] An internal organ segmentation module, which is used to predict the segmentation mask of internal organs based on a bidirectional convolutional residual framework, and further remove the internal organs of live pigs from the scan image after removing the CT table part; and

[0046] A bone, lean meat, and fat identification and quantification module, which is used to identify and quantify the bones, lean meat, and fat of live pigs to obtain the mass and mass ratio of each tissue.

[0047] By adopting the technical solution provided by the present invention, compared with the prior art, the following beneficial effects can be obtained:

[0048] (1) The present invention adopts a method combining deep learning and CT scanning, uses deep learning technology to analyze CT scan images, realizes the accurate segmentation and quantification of fat, lean meat, and bone. Its process includes image preprocessing, removal of the CT table and internal organs, and finally analysis of the meat quality (bone, fat, and lean meat) composition, so as to provide certain scientific data support for fields such as live pig breeding, precision farming, slaughter grading, and food processing. At the same time, this method can quickly process a large amount of CT data, reduce the errors and variations brought by manual operations, be economical and efficient, and has wide applicability, and can better adapt to live pigs of different sizes and shapes.

[0049] (2) The present invention proposes an edge enhancement segmentation method based on gradient-guided level set. By this method, the pig trunk in the preprocessed CT scan image is segmented to remove the CT bed part in the image. Compared with the deficiencies of low efficiency and accuracy existing in traditional segmentation methods, the present invention represents the segmentation boundary with a level set function and continuously iteratively optimizes the level set function by integrating regional consistency measurement, edge consistency measurement, and a smoothing term, thereby gradually updating the segmentation boundary, effectively improving the segmentation effect of the CT bed part, and especially being able to obtain accurate segmentation results even in complex backgrounds, providing a high-quality data basis for subsequent deep learning segmentation and quantification.

[0050] (3) The present invention segments and removes internal organs in the CT scan image based on the bidirectional convolutional residual (BiConv-Res) framework. In the BiConv-Res framework, by optimizing the structure of the two-dimensional convolutional neural network and the bidirectional convolutional long short-term memory (BC-LSTM) and their combination method, more efficient feature extraction and context information fusion can be performed on each CT slice, and a more accurate visceral organ segmentation mask can be generated, thereby facilitating the improvement of the accuracy of visceral organ recognition and segmentation, effectively reducing errors, and ensuring the accuracy of the quantification results; at the same time, this method also has certain advantages in terms of computational efficiency and model simplicity.

[0051] (4) When the present invention identifies and quantifies the bones, lean meat, and fat of pigs, the intersection points of the Gaussian distribution are used to calculate the segmentation thresholds for the bones, lean meat, and fat, thereby facilitating the improvement of the accuracy of the segmentation and recognition of fat, lean meat, and bones. Description of the Drawings

[0052] Figure 1 It is a model diagram of the BiConv-Res framework according to an embodiment of the present invention;

[0053] Figure 2 It is a schematic diagram of the network structure of the BiConv-Res framework in an embodiment of the present invention;

[0054] Figure 3 It is a framework diagram of the R-Dense U-Net according to an embodiment of the present invention;

[0055] Figure 4 It is a diagram of the BC-LSTM and its internal structure according to an embodiment of the present invention;

[0056] Figure 5 It is a schematic diagram of the dataset annotation in an embodiment of the present invention;

[0057] Figure 6 It is a schematic diagram of the network structure process according to an embodiment of the present invention;

[0058] Figure 7Scatter plot of fat, lean meat, and bones obtained in the embodiments of the present invention;

[0059] Figure 8 Schematic diagram of the segmentation and quantification results in the embodiments of the present invention.

[0060] Figure 9 Flow framework diagram of the overall method of the present invention. Detailed implementation manners

[0061] The present invention provides an automatic segmentation and quantification method for the body composition of live pigs based on CT image scanning, obtains a CT scan image dataset of live pigs, and preprocesses it. In the data preprocessing stage, after all CT slices are standardized, denoised, contrast-enhanced, and voxel resampled, the dataset is divided into a training set (80%) and a test set (20%) by the stratified random sampling method to ensure that the distribution ratios of different tissues (fat, lean meat, bones) in the two types of datasets are consistent with the actual anatomical data, avoiding model training bias.

[0062] Then, the training set data is used to train and optimize the CT table segmentation network and the BiConv-Res model respectively to obtain an optimized CT table segmentation algorithm and a BiConv-Res segmentation algorithm. Specifically, in the training stage, a dual-path collaborative training strategy is adopted: First, the CT table segmentation network is based on the gradient-guided level set edge enhancement segmentation method, and the level set function φ(x, y) is iteratively updated through the joint optimization of the region consistency term (minimizing the gray difference between the foreground and the background), the edge consistency term (enhancing the CT table boundary gradient information), and the smoothing term (constraining the curvature of the segmentation boundary) to achieve the automatic high-precision segmentation of the CT table; Second, the BiConv-Res framework takes R-Dense U-Net and BC-LSTM as the core. R-Dense U-Net extracts two-dimensional slice features through dense residual blocks, and BC-LSTM uses the bidirectional convolutional LSTM module to fuse context temporal features in the three-dimensional space. During training, the Adam optimizer is used, and the loss function is a weighted combination of the Dice loss and the cross-entropy loss, and L2 regularization is added to prevent overfitting. After each round, the hyperparameters are adjusted through the validation set.

[0063] In the test stage, first, the test set CT images are input into the trained CT table segmentation algorithm, and the CT table area is accurately removed through the level set function; Subsequently, the BiConv-Res model performs three-dimensional segmentation on the image after removing the table, dynamically enhances the target organ features through the attention gate mechanism, generates a multi-class segmentation mask (including 14 types of internal organs such as the heart and liver), and removes the mis-segmented areas through connected component analysis, and finally retains only the voxels containing fat, lean meat, and bones.

[0064] In the tissue quantification stage, the distribution parameters of fat, lean meat, and bone are solved, the optimal threshold is calculated to complete voxel classification, and finally the volume of each tissue is calculated. Combining with the density parameters (fat 0.9 g / cm 3 、lean meat 1.06 g / cm 3 、bone 1.45 g / cm 3 ), it is converted into mass, and the percentage of its total living body mass is statistically calculated.

[0065] To further understand the content of the present invention, the present invention will be described in detail below in conjunction with the accompanying drawings and specific embodiments. However, it should be understood that these descriptions are only exemplary and do not intend to limit the scope of the present disclosure. In the following detailed description, for the sake of explanation, many specific details are set forth to provide a comprehensive understanding of the embodiments of the present disclosure. However, obviously, one or more embodiments can also be implemented without these specific details. In addition, in the following description, descriptions of well-known structures and technologies are omitted to avoid unnecessarily confusing the concepts of the present disclosure.

[0066] The terms used herein are only for describing specific embodiments and are not intended to limit the present disclosure. The terms "including", "comprising", etc. used herein indicate the presence of the described features, steps, operations, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, or components.

[0067] All terms used herein (including technical and scientific terms) have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification and should not be interpreted in an idealized or overly rigid manner.

[0068] Combined with Figure 6 、 Figure 9 As shown, the embodiment of the present invention provides an automatic segmentation and quantification method for the body composition of live pigs based on CT image scanning and deep learning, including the following steps;

[0069] S1: Obtain the CT scan image data of live pigs and preprocess it;

[0070] S2: Segment the trunk of the live pig in the preprocessed CT scan image based on the gradient-guided level set edge enhancement segmentation method to remove the CT table part in the image;

[0071] S3: Based on the bidirectional convolutional residual (BiConv-Res) framework, automatically segment the internal organs in the scan image after removing the CT table part, so as to effectively remove the internal organs of the live pig from the CT image;

[0072] S4: Identify and quantify the bone, lean meat, and fat of the live pig to obtain the mass fractions of each tissue.

[0073] According to the technical solution of the embodiment of the present invention, in S1, healthy Duroc boars are used as experimental samples, and the experimental samples are anesthetized by intramuscular injection; then the experimental samples are placed on a CT bed in a prone position, and the experimental samples are scanned by a CT scanner. The image matrix size is 512×512, the scanning direction is axial, and the thickness of each slice is 4.99 mm; all two-dimensional slices are stacked (each slice represents a cross-section in a live pig, and the CT slice consists of a two-dimensional pixel array. Each pixel corresponds to a voxel, ensuring that the intensity value of each voxel is measured during the CT scan. This intensity value represents the degree of X-ray absorption of the voxel, and its range is from -800 Hounsfield units (HU) to 200 HU. This range covers the different densities of internal organs, lean meat, and fat), that is, the three-dimensional CT scan images (three-dimensional models) of all live pigs are obtained, providing a basis for subsequent deep learning segmentation and quantification. All CT images are saved and downloaded in DICOM format, and according to the Hounsfield scale, the CT intensity is associated with each voxel for subsequent processing and analysis.

[0074] After the scanning is completed, the live weight data of each live pig is recorded; then the pig body sample is dissected, different types of tissues such as fat, lean meat, and bones are separated, and the weight of each part is accurately weighed and recorded for subsequent comparison with the segmentation and quantification results of the embodiment of the present invention.

[0075] Furthermore, a medical image processing software is used to semi-automatically label the key internal organs in the obtained two-dimensional slices to ensure that each internal organ is correctly identified in the dataset (the labeled image is as shown in Figure 5 ); then the marked 2D slices are stacked to form a three-dimensional model and preprocessing operations are performed on it. The preprocessing includes denoising, contrast enhancement, and voxel intensity value normalization to ensure the consistency of image quality and the accuracy of subsequent analysis.

[0076] Specifically, the contrast of the image can be adjusted by image enhancement techniques (such as sharpening and filtering) to enhance the contrast between the internal organs and the surrounding tissues; the image quality can be improved by correcting the noise and artifacts in the image; the differences between different CT scanning devices can be eliminated by normalizing the voxel intensity values; by resampling the CT slices, the consistency of voxel size is ensured, and at the same time, the information loss during the resampling process is reduced.

[0077] According to the technical solution of the embodiment of the present invention, in S2, the gradient-guided level set edge enhancement segmentation method is used to segment the pig trunk in the preprocessed CT scan image to remove the CT bed part in the image, specifically including:

[0078] S21. Remove the head and neck slices

[0079] Through observation, it is found that the head and neck of the pig occupy about the first 10%-12% of the total length. Therefore, these slices can be directly discarded without participating in the subsequent trunk segmentation.

[0080] S22. Influence and removal of the CT table

[0081] In CT scanning, the CT table is located under the pig body, but its high-intensity signal value is similar to the signal value range of the bone structure, which will affect the subsequent calculation and analysis. Therefore, in order to eliminate the influence of the CT table, it is necessary to remove the CT table area from the CT scan and only retain the pig body area. The traditional method usually uses mask filling operation to remove the CT table, but this method requires manual adjustment of the mask size according to the size of the live pig, cannot achieve automation, and limits the efficiency and accuracy of segmentation.

[0082] Therefore, the present invention proposes a gradient-guided level set edge enhancement segmentation method, that is, using the edge information of the image to guide the segmentation, and at the same time combining the regional gray information to distinguish the CT table and the background.

[0083] Specifically, the present invention first defines a level set function φ(x, y) to represent the segmentation boundary:

[0084] φ(x, y)>0 represents the foreground region (CT table);

[0085] φ(x, y)<0 represents the background region (non-CT table);

[0086] φ(x, y)=0 represents the segmentation boundary.

[0087] Then, the present invention further designs a consistency measure for the region and the edge. The region consistency measure is used to evaluate the consistency of the gray value distribution within the foreground region R1, and the edge consistency measure is used to evaluate the clarity of the boundary between the foreground R1 and the background region R2.

[0088] In order to ensure that the gray difference between the CT table and the background region is as small as possible, the present invention defines the gray mean values of the foreground and the background, where the gray mean value of the foreground region is c1 and the gray mean value of the background region is c2:

[0089]

[0090] Among them, R1 and R2 represent the foreground and the background regions respectively; I(x, y) is the gray value function of the image, representing the gray value at the position (x, y); represents the integral of the image gray function I(x, y) within the foreground region R1, that is, calculating the sum of all pixel gray values within the foreground region; It represents calculating the total number of pixels within the foreground region R1 in the foreground region.

[0091] Then the regional consistency metric formula is:

[0092]

[0093] E region E(φ) is used to measure the gray - level consistency between the foreground (CT table) and the background region in the segmentation result. Through the method of iterative optimization, by optimizing the segmentation boundary φ(x, y) to reduce E region (φ) to make it reach the minimum value, so that the gray - level values within the foreground and background regions are as close as possible to their respective means c1 and c2, to ensure that the segmentation boundary can divide the image into foreground and background regions with consistent gray levels, and further improve the accuracy of segmentation.

[0094] The boundary of the CT table usually has an obvious gray - level difference from the background. In the embodiments of the present invention, the image gradient is used to emphasize the edge of the CT table. The edge consistency metric formula is:

[0095]

[0096] Among them, Ω is the domain of definition of the CT image, that is, the set of all pixel points in the image; δ(φ(x, y)) is the Dirac function, whose value takes the maximum value at φ(x, y) = 0 and is 0 elsewhere. Therefore, only on the segmentation boundary does δ(φ(x, y)) have a significant value. By minimizing E edge (φ), the segmentation boundary φ(x, y) is made to align as closely as possible with the edge of the image.

[0097] To avoid irregular segmentation boundaries, the embodiments of the present invention further introduce a smoothing term to control the smoothness of the boundary, and the formula is expressed as:

[0098]

[0099] This term is used to constrain and measure the smoothness of the curve and prevent the generation of overly tortuous boundaries. represents the gradient of the level - set function, represents the normal direction of the boundary, and |Δφ| is the gradient amplitude. is the divergence operator, which is used to calculate the change rate of the unit normal vector field and is equivalent to the curvature of the segmentation boundary. By minimizing E smooth (φ), the segmentation boundary is made as smooth as possible.

[0100] Furthermore, by combining the regional consistency metric, the edge consistency metric, and the smoothing term, the total function is obtained as:

[0101] E(φ) = E region(φ) + α·E edge (φ) + β·E smooth (φ)

[0102] Gradually update the segmentation boundary φ(x, y) to gradually reduce the total function E(φ). The update formula is expressed as:

[0103]

[0104] where η is the learning rate, controlling the step size of each update, t is the number of iterations, is the partial derivative of the total function with respect to φ, representing the change direction under the current segmentation boundary.

[0105] Update φ(x, y) step by step through the above steps until the function E(φ) converges to the minimum value. The iterative optimization process can be summarized as the following steps:

[0106] First, initialize the segmentation boundary φ 0 (x, y), then calculate the regional consistency measure, edge consistency measure, and smooth term under the current segmentation boundary;

[0107] Subsequently, calculate the partial derivative of the total function Finally, update the segmentation boundary φ t+1 (x, y);

[0108] Repeat the iteration until the energy function E(φ) converges or reaches the maximum number of iterations.

[0109] During the iteration process, the level set function φ(x, y) will evolve according to the edge and regional information of the CT table, gradually approaching the true boundary of the CT table. Finally, when the iteration stops, the zero level set of the level set function φ(x, y) will correspond to the segmentation result of the CT table, that is, the position where φ(x, y) = 0 is the segmentation boundary. This method can effectively segment the CT table by combining regional information and edge information, and can obtain a relatively accurate segmentation result even in a complex background.

[0110] According to the technical solution of the embodiment of the present invention, in S3, based on the bidirectional convolutional residual (BiConv-Res) framework, automatically segment internal organs in the scanned image after removing the CT table part, so as to effectively remove the internal organs of live pigs (the internal organs include but are not limited to the heart, lungs, liver, stomach, spleen, kidneys, colon, cecum, esophagus, jejunum, uterine horns, bladder, ureters, and rectum). The model diagram and network structure schematic diagram of the BiConv-Res framework are respectively as Figure 1 、 Figure 2As shown. The BiConv-Res framework combines a two-dimensional convolutional neural network and a bidirectional convolutional long short-term memory, that is, it consists of two components: R-Dense U-Net and BC-LSTM. R-Dense U-Net is an improved U-Net for extracting intra-layer features from 2D slices, and BC-LSTM is used to extract hierarchical features. Finally, it is applied to each slice to generate the final segmentation map, X1 to X z represents the input slice.

[0111] Specifically, in the embodiment of the present invention, the Residual Dense U-Net (R-Dense U-Net) is used to extract and transfer intra-slice feature information, such as Figure 3 shown in (a) below. It includes a plurality of R-Dense blocks, and the specific number is controlled by the parameter N, and the value range of N is [32, 64, 128, 256, 512]. Each R-Dense block includes three consecutive 3×3 convolutional layers and realizes residual connection through a 1x1 convolutional layer to retain deep and shallow feature information. In each block, concatenation operations are used to merge features of different layers, and then addition operations are used to fuse multi-path information. Its Res-Attention path is a path containing an encoder and a decoder. The encoder downsamples through max pooling, and the decoder upsamples through transposed convolution. An attention mechanism is introduced at the skip connection to dynamically adjust the feature weights, suppress irrelevant background information, and enhance the features of the target organ. As Figure 3 shown in (b) below, it is used to further process the feature information. The size of the feature map is reduced through max pooling operations, and the size of the feature map is increased through transposed convolution operations. 3x3 convolution and ReLU are used to extract features and apply the ReLU activation function. The feature information of the encoder and the decoder is added together, and finally passes through an attention gate to generate a gating signal to further adjust the feature information.

[0112] Traditional U-Net only uses skip connections, while R-Dense U-Net introduces Residual Dense Blocks (R-Dense Blocks) within each level of the network layer. Through dense connection and residual learning, it enhances the feature reuse ability and solves the problem of gradient disappearance. An attention gate is integrated in the skip connection to dynamically filter out effective features through the gating signal. Compared with the simple splicing of traditional U-Net, the clarity of the segmentation boundary is significantly improved. The model of the present invention significantly improves the accuracy and robustness of complex organ segmentation compared with traditional U-Net and LSTM.

[0113] Figure 3As shown in (c), the internal structure of each R-Dense block is such that the residual input data first passes through two intermediate layers (N / 2) and then enters the final feature layer (N). During this process, the data undergoes feature extraction through a 3x3 convolutional layer with a ReLU activation function, and then the number of channels is adjusted through a 1x1 convolutional layer. Subsequently, the feature information of different layers is merged through a concatenation operation, and finally, the feature information of different paths is fused through an addition operation to output the final feature information.

[0114] The design of this module can effectively process and integrate multi-level feature information to enhance the network's expressive ability. These modules work together, enabling the R-Dense U-Net to effectively extract and transfer in-slice feature information, retain deep and shallow features, thereby improving the network's performance.

[0115] The BC-LSTM (Bidirectional Convolutional Long Short-Term Memory Network) is a deep learning model for extracting hierarchical features and improving context information fusion. Its structure consists of a series of BC-LSTM blocks (preferably including 5 consecutive BC-LSTM blocks in the embodiments of the present invention) and convolutional, deconvolutional, max-pooling, and 1×1 convolutional operations, as Figure 4 shown in (a). Each BC-LSTM block contains a bidirectional convolutional LSTM module that can transfer context information in two directions, thereby capturing long-term dependencies in time series data, as Figure 4 shown in (b). The convolutional LSTM further enhances the feature extraction ability by replacing the vector multiplication in the traditional LSTM gates with a convolutional operator. The green arrows represent 5×5 convolutions, the blue arrows represent max-pooling, the purple arrows represent deconvolutions, and the red arrows represent 1×1 convolutions.

[0116] Specifically, the BiConv-Res framework is used to predict the segmentation mask of visceral organs and remove the visceral tissues from the CT slices according to the prediction result, that is, the BiConv-Res framework performs feature extraction and context information fusion on each CT slice to predict the segmentation mask of visceral organs; then, according to the predicted segmentation mask of visceral organs, the visceral tissues are removed from the original CT slices to achieve effective segmentation and quantification of visceral organs.

[0117] According to the technical solution of the embodiments of the present invention, the identification and quantification of the bones, lean meat, and fat of live pigs in S4 are specifically carried out as follows:

[0118] S41. Voxel Classification and Segmentation: In the CT image of the live pig slice after removing the viscera, set the optimal segmentation threshold to classify and segment the bones, fat, and lean meat;

[0119] Suppose the CT image I(x, y) of a live pig has N voxels, and the CT value of each voxel is denoted as v i , the CT value histogram H(v) of all voxels is statistically calculated, where H(c) represents the number of voxels with a CT value of v. The CT value histogram consists of three types of tissues (fat, lean meat, and bone), and its distribution is fitted as follows:

[0120]

[0121] where π k is the weight of the k-th type of tissue, satisfying is a Gaussian distribution with a mean of μ k and a variance of :

[0122]

[0123] The expectation-maximization (EM) algorithm is used to solve for π k , μ k , to obtain the optimal three-tissue parameters. Let the means of fat, lean meat, and bone be μ1, μ2, and μ3 respectively. Then the optimal segmentation thresholds T1 and T2 are calculated using the intersection points of the Gaussian distributions:

[0124]

[0125] In this way, the optimal thresholds are obtained:

[0126] If v < T1, it is classified as fat;

[0127] If T1 ≤ v < T2, it is classified as lean meat;

[0128] If v ≥ T2, it is classified as bone.

[0129] S42. Voxel quantity calculation: The classified voxels are accurately counted to determine the voxel quantities of fat, lean meat, and bone.

[0130] S43. Volume calculation optimization: When calculating the volume of each tissue of the live pig, the corrected pixel spacing and slice thickness are used. The volume calculation formula is: Volume (mm 3 ) = number of voxels × pixel spacing (mm) × slice thickness (mm).

[0131] S44. Weight calculation: Based on the densities of fat, lean meat, and bone (0.9 g / cm³, 1.06 g / cm³, and 1.45 g / cm³ respectively in this embodiment), the weight of each tissue is calculated. The formula is: Weight = Volume × Density.

[0132] S45. Proportion calculation: Calculate the proportion of the weight of each tissue to the live weight of the whole pig, that is, obtain the relative mass proportion of each tissue.

[0133] Through the above technical solutions, the embodiments of the present invention can achieve accurate identification, segmentation and quantification of fat, lean meat and bones in pig slices. The specific segmentation results are as Figure 8 shown. Among them, there are six rows from top to bottom: The first row is the original cross-sectional CT image without preprocessing; the second row shows the part of the CT table that needs to be removed; the third row is the image after removing the CT table; the fourth row shows the predicted visceral organ mask; the fifth row is the image after removing the visceral organs, in which the distributions of fat, lean meat and bones are marked with different colors, and blue represents bones; the last row is the image with the bones highlighted, in which the bones are highlighted in a specific color.

[0134] Furthermore, in order to further evaluate and prove the accuracy of the method of the present invention, based on the above segmentation and identification results, accurately estimate the mass fractions of various tissues (fat, lean meat, bones) of live pigs, and conduct a comparative analysis with the results of artificial dissection. Specifically, first, count the data of all experimental samples, and calculate the mean value, standard deviation and corresponding coefficient of variation of the mass of each tissue estimated by the segmentation method based on the present invention. At the same time, calculate the mean value and standard deviation of the artificial dissection measurement values to evaluate the stability of the data. Subsequently, calculate the errors between the data obtained by the two methods, including absolute error and relative error, to evaluate the error range and accuracy of the segmentation method. In addition, the present invention also calculates the correlation coefficient and determination coefficient (R 2 ) of the two groups of data to measure the linear correlation between the two.

[0135] In order to further visually display the relationship between the tissue mass or proportion calculated by the segmentation method based on the present invention and the artificial dissection measurement values, the present invention further draws scatter plots of fat, lean meat and bones, and fits linear regression curves, as Figure 7 shown. Among them, the abscissa: represents the mass or proportion of each tissue calculated by the method based on the present invention; the ordinate: represents the corresponding measurement value obtained by artificial dissection; the red straight line: represents the linear fitting result of the data, that is, the regression curve. In addition, the regression equation and determination coefficient R 2 value are also marked in each figure to quantitatively measure the correlation between the prediction result and the artificial dissection measurement value. A higher R 2 value indicates a strong linear consistency between the two, thus verifying the effectiveness of the proposed method.

[0136] Combined with Figure 7 , analyze the fitting conditions of the mass and proportion of different tissues respectively, as follows:

[0137] (1) Analysis of the fitting curve of fat weight: This curve (Figure 7 In (a)) shows the linear relationship between the fat weight calculated by the CT segmentation method and the fat weight measured by artificial dissection. From the fitting results, it can be seen that there is a strong positive correlation between the two, and the R 2 value is relatively high, indicating that the method of the present invention has high accuracy in estimating fat mass.

[0138] (2) Analysis of the fitting curve of lean meat weight: This curve ( Figure 7 in (b)) describes the regression relationship between the predicted lean meat mass and the value measured by artificial dissection. Although there is a strong overall linear correlation, compared with fat, the slope of the fitting curve is smaller, indicating that there is a certain deviation in the prediction of lean meat mass, which may be related to tissue segmentation errors or density estimation deviations in CT images.

[0139] (3) Analysis of the fitting curve of bone weight: This curve ( Figure 7 in (c)) analyzes the relationship between the predicted bone weight and the value measured by artificial dissection. From the fitting results, the slope of this regression curve is close to 1, and the R 2 value is relatively high, indicating that the predicted result of bone is highly consistent with the value measured by artificial measurement, indicating that the method of the present invention has good reliability in estimating bone mass.

[0140] (4) Analysis of the fitting curve of fat ratio: This curve ( Figure 7 in (d)) shows the linear regression relationship between the predicted fat ratio and the value measured by artificial dissection. It can be seen from the figure that the slope of the fitting curve is close to 1, and the R 2 value is relatively high, indicating that the method of the present invention is relatively accurate in estimating the fat ratio.

[0141] (5) Analysis of the fitting curve of lean meat ratio: This curve ( Figure 7 in (e)) analyzes the relationship between the predicted lean meat ratio and the value measured by artificial dissection. From the results, the predicted result of the lean meat ratio still maintains a high correlation with the actual measured value, but its fitting slope is slightly lower than 1, indicating that the predicted value is slightly deviated from the value measured by artificial measurement.

[0142] (6) Analysis of the fitting curve of bone ratio: This curve ( Figure 7 in (f)) shows the fitting situation of the predicted bone ratio and the value measured by artificial dissection. The results show that the predicted result of the bone ratio has a good linear correlation with the value measured by artificial measurement, and the slope of the fitting curve is close to 1, indicating that the prediction method has high credibility in estimating the bone ratio.

[0143] Reliability of the comprehensive evaluation method: As can be seen from the results of the scatter plot and the fitted curve, the fat, lean meat, and bone mass and their ratios calculated by using the segmentation and quantification method of the present invention all have a high correlation with the artificial anatomical measurement values, and the determination coefficient R 2 value of most of the fitted curves is high. Especially in the estimation of the mass and ratio of fat and bone, the method shows high precision, verifying its feasibility in practical applications. Therefore, the method of the present invention can effectively achieve the automated quantitative estimation of various tissues of live pigs and maintain a high consistency with the artificial anatomical measurement values, can be used for the analysis of the body composition of live pigs, and has wide practical application value.

Claims

1. An automatic segmentation and quantification method for the body composition of live pigs based on CT image scanning, characterized in that, Including: S1. Obtain the CT scan image data of live pigs and preprocess it; S2. Segment the preprocessed CT scan image based on the gradient-guided level set edge enhancement segmentation method to remove the CT table part in the image; The gradient-guided level set edge enhancement segmentation method represents the segmentation boundary with the level set function φ(x, y), uses the edge information of the image to guide the segmentation, and combines the regional gray information to distinguish the CT table and the background; wherein, φ(x, y)=0 represents the segmentation boundary, greater than 0 represents the foreground region, and less than 0 represents the background region; S3. Predict the segmentation mask of internal organs based on the bidirectional convolutional residual framework, and further remove the internal organs of the live pigs from the scan image after removing the CT table part according to the prediction result; S4. Identify and quantify the bones, lean meat and fat of the live pigs to obtain the mass and mass ratio of each tissue.

2. The automatic segmentation and quantification method of live pig body composition based on CT image scanning according to claim 1, characterized in that, The preprocessing in S1 includes but is not limited to denoising, contrast enhancement and voxel intensity value normalization processing; And / or semi-automatically label the key internal organs in the CT scan image using medical image processing software before preprocessing the image in S1.

3. The automatic segmentation and quantification method of live pig body composition based on CT image scanning according to claim 1, characterized in that, The segmentation of the preprocessed CT scan image based on the gradient-guided level set edge enhancement segmentation method in S2 to remove the CT table part in the image includes: Initialize the segmentation boundary φ 0 (x, y), and calculate the regional consistency measure E under the current segmentation boundary region (φ), edge consistency measure E edge (φ), and smoothness term E smooth (φ); among them, the regional consistency measure is used to evaluate the consistency of the gray value distribution within the foreground region, the edge consistency measure is used to evaluate the clarity of the boundary between the foreground and background regions; the smoothness term is used to control the smoothness of the boundary; Fusing the region consistency measure, edge consistency measure, and smoothing term to obtain the energy function E(φ): E(φ) = E region (φ) + α · E edge (φ) + β · E smooth (φ); α and β are the corresponding weight coefficients, respectively, which are determined by iterative optimization; Calculate the partial derivative of the energy function E(φ) Gradually update the segmentation boundary φ t+1 (x, y): where η is the learning rate that controls the step size of each update, t is the number of iterations, is the partial derivative of the total function with respect to φ, representing the change direction under the current segmentation boundary; Iterate repeatedly until the energy function E(φ) converges or reaches the maximum number of iterations, that is, obtain the optimized segmentation boundary; Remove the CT table part in the CT scan image based on the optimized segmentation boundary.

4. The method for automatic segmentation and quantification of live pig body composition based on CT image scanning according to claim 3, characterized in that, Before segmenting the preprocessed CT scan image based on the gradient-guided level set edge enhancement segmentation method, directly discard the slices corresponding to the head and neck on the scan image, which do not participate in the subsequent trunk segmentation, where the total length of the head and neck occupies the first 10%-12% of the total length of the pig body.

5. The automatic segmentation and quantification method of live pig body composition based on CT image scanning according to any one of claims 1-4, characterized in that, The bidirectional convolutional residual framework in S3 includes a two-dimensional convolutional neural network R-Dense U-Net and a bidirectional convolutional long short-term memory BC-LSTM. R-Dense U-Net is used to extract intra-layer feature information from 2D slices, and BC-LSTM is used to extract hierarchical features; wherein: The R-Dense U-Net includes multiple R-Dense blocks. Each R-Dense block includes three consecutive convolutional layers and realizes residual connection through a 1x1 convolutional layer; within each block, connection operations are used to merge features of different layers, and then multi-path information is fused through addition operations; its Res-Attention path is a path containing an encoder and a decoder. The encoder downsamples through max pooling, and the decoder upsamples through transposed convolution, and an attention mechanism is introduced at the skip connection; The BC-LSTM includes a series of BC-LSTM blocks and convolutional, deconvolutional, max pooling and 1×1 convolutional operations. Each BC-LSTM block contains a bidirectional convolutional LSTM module, and the convolutional LSTM replaces the vector multiplication in the traditional LSTM gate with a convolutional operator.

6. The automatic segmentation and quantification method of live pig body composition based on CT image scanning according to any one of claims 1-4, characterized in that, The identification and quantification of the bones, lean meat and fat of the live pigs in S4 includes: Voxel Classification and Segmentation: In the CT images of the sliced pig carcasses after viscera removal, set the optimal segmentation threshold to classify and segment bones, fat, and lean meat; Voxel Quantity Calculation: Accurately count the classified voxels to determine the voxel quantities of fat, lean meat, and bones; Volume Calculation: When calculating the volumes of various pig tissues, use the corrected pixel spacing and slice thickness. The volume calculation formula is: Volume = Voxel Number × Pixel Spacing × Slice Thickness; Weight Calculation: Calculate the weights of each tissue based on the densities and volumes of fat, lean meat, and bones.

7. The method for automatically segmenting and quantifying the body composition of live pigs based on CT image scanning according to claim 6, wherein The voxel classification and segmentation specifically include: Perform statistical analysis on the voxels in the pig CT images, fit the CT value histogram to a Gaussian mixture model, and use the expectation-maximization algorithm to solve for the optimal three-class tissue parameters; Calculate the intersections of the Gaussian distributions to obtain the optimized segmentation thresholds T1 and T2; Use the optimized thresholds T1 and T2 to classify the voxels: voxels with v < T1 are classified as fat; voxels with T1 ≤ v < T2 are classified as lean meat; voxels with v ≥ T2 are classified as bones.

8. The automatic segmentation and quantification method of live pig body composition based on CT image scanning according to claim 7, characterized in that, The segmentation thresholds T1 and T2 are calculated as follows: where μ1, μ2, and μ3 are the mean CT intensity values of fat, lean meat, and bones respectively; σ1, σ2, and σ3 are the standard deviations of the CT intensity values of fat, lean meat, and bones respectively.

9. An automatic segmentation and quantification device for the body composition of live pigs based on CT image scanning, characterized in that, It includes: Data Acquisition and Preprocessing Module, used to acquire the CT scan image data of the pig and preprocess it; CT Table Segmentation Module, used to segment the preprocessed CT scan image based on the gradient-guided level set edge enhancement segmentation method to remove the CT table part in the image; The gradient-guided level set edge enhancement segmentation method represents the segmentation boundary with the level set function φ(x,y), uses the edge information of the image to guide the segmentation, and combines the regional gray information to distinguish the CT table and the background; where φ(x,y) = 0 represents the segmentation boundary, greater than 0 represents the foreground area, and less than 0 represents the background area; Internal Organ Segmentation Module, used to predict the segmentation mask of the internal organs based on the bidirectional convolutional residual framework and further remove the internal tissues of the pig from the scan image after removing the CT table part; and Bone, Lean Meat, and Fat Identification and Quantification Module, used to identify and quantify the bones, lean meat, and fat of the pig to obtain the mass and mass ratio of each tissue.