Rainbow trout fillet intermuscular fat content prediction model and construction method and application thereof
By constructing a prediction model of intermuscular fat content of rainbow trout fillets based on computer vision, using image processing and random forest model, the problem of low measurement efficiency and accuracy in the existing technology is solved, and the rapid intermuscular fat content of rainbow trout fillets is achieved. , accurate measurement has promoted the development of rainbow trout meat breeding.
Patent Information
- Application Number
- CN202411243423.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-05
- Publication Date
- 2024-12-31
AI Technical Summary
The prior art lacks effective and fast methods to determine the intermuscular fat content of rainbow trout fillets, resulting in low measurement efficiency and accuracy, affecting the development of rainbow trout meat breeding.
Build a computer vision-based prediction model of intermuscular fat content in rainbow trout fillets, obtain the fish fillet images by taking a photo box, use image processing technology to remove background and binarization, extract color feature parameters, combine with random forest models to predict, and optimize model parameters to Improve accuracy.
The rapid and accurate measurement of the intermuscular fat content of rainbow trout fillets was achieved. R2 can reach more than 90%, the correlation coefficients of the true value and the predicted value are greater than 0.9, and it has good generalization ability, which has promoted the development of rainbow trout meat breeding.
Smart Images

Figure CN119228913A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the fields of nutrition detection, pattern recognition and computer vision technology, and relates to a rainbow trout fillet intramuscular fat content prediction model and its construction method and application, and specifically relates to a method for constructing a rainbow trout fillet intramuscular fat content prediction model based on computer vision. The present invention constructs a prediction model for measuring the intramuscular fat content of rainbow trout fillets through color images, and applies the model to the selection and breeding of rainbow trout meat quality. Background Art
[0002] As a cold-water economic fish that is widely farmed around the world, rainbow trout is deeply loved by domestic and foreign consumers for its rich high-quality protein and polyunsaturated fatty acid content. Since it was introduced to China in 1959, rainbow trout farming has been promoted and developed in more than 20 provinces across the country, forming a specific model with plateau reservoirs and mountain freshwater ponds as the main farming environment. In addition, in recent years, with the effective development of the Yellow Sea cold water mass and the successful application of deep-sea farming cage technology, China's salmon and trout farming industry is transforming from traditional land-based farming to deep-sea marine farming.
[0003] Over the past few decades, as the production of rainbow trout has steadily increased, the focus of the rainbow trout aquaculture industry has shifted from increasing production to improving the quality of fillets. The fat content of fish flesh is a key factor affecting its quality, affecting attributes such as taste, flavor, color and shelf life. The fat content of rainbow trout fillets is approximately 4-18%. Within a specific range, increasing the fat content in fish flesh can improve the flavor and overall acceptability of the fillet. However, too much fat content can pose processing challenges, resulting in a reduced firmness, increased greasiness and an enhanced fishy smell in the fillet. In rainbow trout fillets, the fat is mainly located in the white stripes in the connective tissue, called intermuscular fat, which separates the red muscle tissue into vertical blocks, giving the fillet a distinct red and white striped pattern. In livestock animals, the intermuscular fat of the meat is thick and affects the taste, so it is removed during processing. In contrast, salmonid fillets such as rainbow trout retain the intermuscular fat, and the resulting red and white stripes are a key indicator for consumers to evaluate the quality of the fillet.
[0004] Intramuscular fat content is an important factor affecting the quality and flavor of rainbow trout fillets, but there is currently a lack of effective and quick methods for its determination. Currently, there are limited methods for measuring the intramuscular fat content of rainbow trout fillets, mainly because the separation of intramuscular fat and muscle is extremely difficult and requires a lot of time and labor costs. Technologies such as X-ray computed tomography and magnetic resonance imaging can provide information on the distribution of intramuscular fat in fish fillets, but the equipment for these methods is expensive.
[0005] Based on this, the present invention provides a method for determining the intramuscular fat content of rainbow trout fillets, which greatly improves the efficiency and accuracy of determining the intramuscular fat content of rainbow trout fillets, and will strongly promote the development of rainbow trout meat quality trait breeding. Summary of the invention
[0006] The purpose of the present invention is to solve the above problems existing in the prior art, and propose a prediction model for the intramuscular fat content of rainbow trout fillets, a construction method and an application thereof. The model of the present invention can accurately predict the intramuscular fat content of rainbow trout fillets. 2 It can reach more than 90%, the Pearson correlation coefficient between the true value and the predicted value is greater than 0.9, and the 5-fold cross validation shows that the model stability is greater than 0.7, and it has good generalization ability.
[0007] The technical solution of the present invention is:
[0008] A method for constructing a prediction model for intramuscular fat content of rainbow trout fillets comprises the following steps:
[0009] S1. Unify the photographing environment of the photographing box, select rainbow trout fillet samples and place them in the photographing box, take a bird's-eye view of the sample cross section, and obtain a sample image with an image size of 6016*4016 pixels;
[0010] S2, remove the image background by combining the red channel information of the image and set it to transparent; binarize the transparent background image by using the blue channel information, set the fat block to white, and the muscle block to black, and count the proportion of white pixels to the total pixels of the binary image, which is recorded as the intermuscular fat ratio IIMF% of the image;
[0011] The intramuscular fat percentage (IIMF%) of the image is calculated as follows: IIMF%=intermuscular fat area pixels / (intermuscular fat area pixels+muscle area pixels).
[0012] S3, extracting the color information of the image from the transparent background image obtained in step S2, that is, the characteristic parameters of the image, including the average value and standard deviation of the red channel (R), the average value and standard deviation of the green channel (G), the average value and standard deviation of the blue channel (B), the average value and standard deviation of the hue (H), the average value and standard deviation of the saturation (S), the average value and standard deviation of the brightness (I), the average value and standard deviation of the lightness channel (L), the average value and standard deviation of the green-red channel (a), and the average value and standard deviation of the blue-yellow channel (b);
[0013] S4, manually cutting the muscle and intramuscular fat of rainbow trout fillet samples, weighing them respectively, and calculating the true value of the intramuscular fat content IMF%;
[0014] S5. A random forest model is established according to IIMF%, image feature parameters and the true value IMF% of the intermuscular fat content, and the model is optimized and trained to obtain a model for predicting the intermuscular fat content of rainbow trout fillets.
[0015] Furthermore, in step S1, adult rainbow trout is used as a sample source, and no less than 110 pieces of back and belly fillets are taken, each piece having a size of 4 cm*3 cm.
[0016] The number of the above fish fillets is 110 or more, and the model is optimized by expanding the number of rainbow trout fillet samples. By continuously increasing the sample size for model training, the accuracy, precision and stability of the model can be continuously improved.
[0017] Furthermore, in step S1, LED lights are used to adjust the lighting in the photo box, and a black light-absorbing board is used as the background to unify the photo environment.
[0018] Furthermore, in step S2, the image is imported into Python software for processing, the RGB channels of the image are separated, and the foreground and background are distinguished using the R channel threshold of the image. An R value greater than 150 is identified as the foreground, and an R value less than 150 is identified as the background, and the background pixels are converted to transparent pixels.
[0019] Furthermore, in step S2, the obtained transparent background image is binarized using the blue channel information. For each pixel, the pixel with a B channel value greater than 140 is identified as a fat block and converted to a white pixel, and the pixel with a B channel value less than 140 is identified as a muscle block and converted to a black pixel. Then, it is converted into a grayscale format, and each pixel in the grayscale image is locally analyzed to check the number of white and black pixels in an 11x11 neighborhood. If the number of black pixels exceeds a threshold of 5, the current pixel is set to black, thereby further purifying the image.
[0020] Furthermore, in step S5, the IIMF% obtained in step S2 and the characteristic parameters of all images obtained in step S3 are used as predictor variables, and the IMF% obtained in step S4 is used as the target variable to construct a random forest model.
[0021] Furthermore, in step S5, parameter optimization is performed by GridSearchCV to find the optimal number of trees, maximum depth, minimum number of samples required for internal node splitting, and minimum number of samples required for leaf nodes. The optimization process is based on 5-fold cross validation and R 2The score was used as the scoring criterion. The random forest regressor with the best model parameters and SelectFromModel were used to select important features based on the median threshold. Feature selection was performed and the selected features were used to retrain the model. The stability of the model under the selected features was evaluated using 5-fold cross validation.
[0022] The present invention also provides a rainbow trout fillet intramuscular fat content prediction model constructed by the above construction method.
[0023] The present invention further provides the application of the rainbow trout fillet intramuscular fat content prediction model constructed by the above construction method in rainbow trout breeding.
[0024] Beneficial effects of the present invention:
[0025] The present invention is based on computer vision to quickly determine the content of intramuscular fat in rainbow trout fillets, uses RGB color information of rainbow trout fillet images to remove image background, binarizes the images, obtains intermuscular fat distribution characteristics and proportions, extracts 18 color feature values of the images, establishes a random forest model of the intermuscular fat content of rainbow trout fillets according to the feature values and actual fat content measurement values, and finally predicts the intermuscular fat content of rainbow trout fillets through the model, thereby achieving rapid and accurate measurement of the intermuscular fat content of rainbow trout fillets.
[0026] The model of the present invention can well predict the intramuscular fat content of rainbow trout fillets and is applied to the breeding of rainbow trout meat quality, which has good application significance. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Figure 1 This is a picture of background removal and binarization result of a rainbow trout fillet picture provided by the present invention;
[0028] Figure 2 Correlation between the predicted and true values of intramuscular fat content in rainbow trout fillets using the random forest model. DETAILED DESCRIPTION
[0029] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0030] In order to further understand the present invention, the present invention will be further described in conjunction with the accompanying drawings and embodiments.
[0031] The present invention provides a method for constructing a rainbow trout fillet intramuscular fat content prediction model, comprising the following steps:
[0032] 1. Data acquisition, including:
[0033] S1. Use a photo box with two LED lights inside. Use the LED lights to adjust the lighting inside the photo box. Lay a black light-absorbing board as the background to unify the photo environment. Fix the camera on the top of the photo box with the camera lens perpendicular to the background board. When the fish is placed in the photo box, use the camera to automatically focus to find the best parameters and then take a photo. The camera used in this experiment is a full-frame mirrorless digital camera.
[0034] Select rainbow trout fillet samples (for example, adult rainbow trout is used as the sample source, and 110 back and belly fillets are taken, each of which is about 4 cm*3 cm in size), place the samples on a black background plate in a photo box, and use a white LED light to fill in the sample light. Use a digital camera to take a bird's-eye view of the sample cross section to obtain a rainbow trout fillet sample image with an image size of 6016*4016 pixels.
[0035] S2. Remove the image background by combining the red channel information of the image. Specifically, import the image into the computer, use Python software to process the image, separate the RGB channels of the image, use the red channel (R) information of the image to distinguish the foreground and background of the image, identify the R channel threshold greater than 150 as the foreground, and the R value less than 150 as the background, convert the background pixels to transparent pixels, and perform morphological closing operations through a 15*15 rectangular structure element to improve the results;
[0036] The obtained transparent background image is binarized according to the blue channel (B) information to obtain a binary image. Specifically, the obtained transparent background image is traversed, and for each pixel, the B channel value greater than 140 is identified as a fat block, and the pixel is converted to a white pixel. The B channel value less than 140 is identified as a muscle block, and the pixel is converted to a black pixel. Then it is converted to a grayscale format, and each pixel in the grayscale image is locally analyzed to check the number of white and black pixels in an 11x11 neighborhood. If the number of black pixels exceeds a threshold of 5, the current pixel is set to black, thereby further purifying the image. The proportion of white pixels to the total pixels of the binary image is counted, and recorded as the image intermuscular fat ratio (IIMF%); IIMF% = intermuscular fat area pixels / (intermuscular fat area pixels + muscle area pixels).
[0037] Background removal and binarization of rainbow trout fillet images Figure 1 As shown, Figure 1 (1) To take pictures, Figure 1 (2) is the mask image before background removal. Figure 1 (3) is the image after background removal. Figure 1 (4) is a binary image.
[0038] S3. Traverse the transparent background image file obtained in the above steps, and extract the color information of the image, including the average value and standard deviation of the red channel (R), the average value and standard deviation of the green channel (G), the average value and standard deviation of the blue channel (B), the average value and standard deviation of the hue (H), the average value and standard deviation of the saturation (S), the average value and standard deviation of the brightness (I), the average value and standard deviation of the lightness channel (L), the average value and standard deviation of the green-red channel (a), and the average value and standard deviation of the blue-yellow channel (b).
[0039] S4. Manually cut the muscle and intermuscular fat of rainbow trout fillets, weigh them respectively, and calculate the true value of the intermuscular fat content (IMF%) of the fillets. The calculation formula of IMF% is: IMF%=intermuscular fat weight / (intermuscular fat weight+muscle weight).
[0040] 2. Model construction, including:
[0041] S5. The image information of 110 rainbow trout fillets was extracted, and the IMF%, IIMF% and 18 color feature parameters were preliminarily statistically analyzed using R language. IIMF% and all color feature parameters were used as predictor variables (as shown in Table 1), and the true intramuscular fat content IMF% of each rainbow trout fillet was used as the target variable. A random forest model was constructed, and the predicted value of the intramuscular fat content (EIMF%) of the fillet was calculated.
[0042] GridSearchCV is used to optimize the parameters and find the optimal number of trees, maximum depth, minimum number of samples required for internal node splitting, and minimum number of samples required for leaf nodes. The optimization process is based on 5-fold cross validation and R 2 The score was used as the scoring criterion. The random forest regressor with the best model parameters and SelectFromModel were used to select important features based on the median threshold. Feature selection was performed and the selected features were used to retrain the model. The stability of the model under the selected features was evaluated using 5-fold cross validation.
[0043] Table 1 Statistics of rainbow trout fillet image features
[0044]
[0045] The maximum depth of the decision tree obtained by this model is 10, the leaf node contains at least 2 samples, the minimum number of samples required to split the internal node is 5, the number of trees in the forest is 200, and the random forest model R trained using the selected features and the above optimal parameters 2 The R obtained by 5-fold cross validation is 0.92 2 The predicted value of intramuscular fat content (EIMF%) of rainbow trout fillet predicted by this model and its true value IMF% content have a strong linear regression relationship, R2 is 0.9440 (see Figure 2 ).
[0046] The model results are saved and uploaded to the cloud for easy running on all devices. When calculating new rainbow trout fillet images, the trained model can be downloaded from the cloud and used directly.
[0047] The above description is only a preferred embodiment of the present invention, and is not intended to limit the present invention. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art can still modify the technical solutions described in the above embodiments, or replace some of the technical features therein by equivalents. Any modification, equivalent replacement, modification, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for constructing a prediction model for intramuscular fat content of rainbow trout fillets, characterized in that: The following steps are involved: S1. Unify the photographing environment of the photographing box, select rainbow trout fillet samples and place them in the photographing box, take a bird's-eye view of the sample cross section, and obtain a sample image with an image size of 6016*4016 pixels; S2, remove the image background by combining the red channel information of the image and set it to transparent; binarize the transparent background image by using the blue channel information, set the fat block to white, and the muscle block to black, and count the proportion of white pixels to the total pixels of the binary image, which is recorded as the intermuscular fat ratio IIMF% of the image; S3, extracting characteristic parameters of the image from the transparent background image obtained in step S2, including the average value and standard deviation of the red channel, green channel, blue channel, hue, saturation, brightness, lightness channel, green-red channel, and blue-yellow channel; S4, manually cutting the muscle and intramuscular fat of rainbow trout fillet samples, weighing them respectively, and calculating the true value of the intramuscular fat content IMF%; S5. A random forest model is established according to IIMF%, image feature parameters and the true value IMF% of the intermuscular fat content, and the model is optimized and trained to obtain a model for predicting the intermuscular fat content of rainbow trout fillets.
2. The construction method according to claim 1, characterized in that: In step S1, adult rainbow trout is used as a sample source, and no less than 110 pieces of back and belly fillets are taken, each piece having a size of 4 cm*3 cm.
3. The construction method according to claim 1, characterized in that: In step S1, LED lights are used to adjust the lighting in the photo box, and a black light-absorbing board is used as the background to unify the photo environment.
4. The construction method according to claim 1, characterized in that: In step S2, the image is imported into Python software for processing, the RGB channels of the image are separated, and the foreground and background are distinguished by the R channel threshold of the image. The R value greater than 150 is identified as the foreground, and the R value less than 150 is identified as the background, and the background pixels are converted to transparent pixels.
5. The construction method according to claim 1, characterized in that: In step S2, the obtained transparent background image is binarized using the blue channel information. For each pixel, the pixel with a B channel value greater than 140 is identified as a fat block and converted to a white pixel, and the pixel with a B channel value less than 140 is identified as a muscle block and converted to a black pixel. Then, it is converted into a grayscale format, and each pixel in the grayscale image is locally analyzed to check the number of white and black pixels in an 11x11 neighborhood. If the number of black pixels exceeds a threshold of 5, the current pixel is set to black, thereby further purifying the image.
6. The construction method according to claim 1, characterized in that: In step S5, the IIMF% obtained in step S2 and the characteristic parameters of all images obtained in step S3 are used as predictor variables, and the IMF% obtained in step S4 is used as the target variable to construct a random forest model.
7. The construction method according to claim 1, characterized in that: In step S5, parameter optimization is performed by GridSearchCV to find the optimal number of trees, maximum depth, minimum number of samples required for internal node splitting, and minimum number of samples required for leaf nodes. The optimization process is based on 5-fold cross validation and R 2 The score was used as the scoring criterion. The random forest regressor with the best model parameters and SelectFromModel were used to select important features based on the median threshold. Feature selection was performed and the selected features were used to retrain the model. The stability of the model under the selected features was evaluated using 5-fold cross validation.
8. A prediction model for intramuscular fat content in rainbow trout fillets constructed according to the construction method according to any one of claims 1 to 7.
9. Application of the rainbow trout fillet intramuscular fat content prediction model constructed according to any one of claims 1 to 7 in rainbow trout breeding.
Citation Information
Patent Citations
Pork intramuscular fat content nondestructive testing method based on computer vision
CN105701805A
Image processing method and system
CN110060260A
