A computer vision-based system for estimating feed intake in dairy cow feeding areas

Through the computer vision-based U2-Net model and feature extraction sub-network, the problem of inaccurate estimation of dairy cow feed intake within a large field of view is solved, and high-precision, low-interference feed intake estimation is achieved to meet the needs of pastures.

CN119942458BActive Publication Date: 2025-09-16INNER MONGOLIA UNIV OF SCI & TECH

Patent Information

Application Number
CN202510091863.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-21
Publication Date
2025-09-16
Estimated Expiration
2045-01-21

AI Technical Summary

Technical Problem

Existing technologies make it difficult to accurately estimate the feed intake of dairy cows within a large field of view, especially at heights above 2.5 meters, where depth map data is unreliable, resulting in inaccurate feed intake estimates that cannot meet the actual needs of the ranch.

Method used

A computer vision-based method was used to segment the feed area using the U2-Net model. The feature extraction subnetwork and the feed intake estimation subnetwork were combined to estimate the overall feed intake at a viewing angle of 2.95 meters through RGB image processing and multi-scale pooling layers.

Benefits of technology

It achieves high-precision assessment of the overall feed intake of dairy cows within a wide field of view, reduces interference to dairy cows, reduces stress responses, saves time and labor costs, and improves estimation efficiency and accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119942458B_ABST
    Figure CN119942458B_ABST
Patent Text Reader

Abstract

A system for estimating the feed intake of dairy cows in feeding areas based on computer vision belongs to the technical field of estimating the feed intake of dairy cows in feeding areas. It aims to solve the problem that the existing feed intake estimation of dairy cows in feeding areas cannot meet the actual needs of pastures and the problem of inaccurate estimation. The present invention includes a data acquisition module for obtaining RGB images of the feed area before and after feeding dairy cows, a feed area segmentation module for processing and identifying the RGB images using an image segmentation model and extracting a mask image of the feed area; a data processing module for performing color matching on the mask images corresponding to before and after feeding dairy cows, obtaining the RGB images of the mask image area and then obtaining a difference image, and a total feed intake estimation module for estimating the total feed intake of the obtained difference image using a total feed intake estimation model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to a technical system for estimating feed intake in a feeding area of ​​a dairy cow. Background Art

[0002] Accurately estimating feed intake is a critical component of modern, intelligent dairy farm management. Dairy cow feed intake has a direct impact on cow health, genetic evaluation, and breeding. A balanced feed supply promotes healthy animal growth and improves production performance, such as milk production and meat quality. Conversely, excessive or insufficient feed intake can negatively impact cow health, leading to issues such as obesity and malnutrition. Therefore, accurately estimating feed intake is crucial for maintaining good dairy cow health and improving overall farm production efficiency.

[0003] Currently, methods for estimating feed intake can be broadly divided into two categories: behavioral and physiological modeling, and visual and image analysis. Behavioral and physiological modeling methods primarily rely on indicators such as a cow's feeding behavior, chewing time, and milk production efficiency, using regression models to infer feed intake. For example, by monitoring a cow's feeding behavior, chewing sounds can be used to estimate feed intake. Alternatively, pressure sensors can be used to estimate feed intake based on feeding and chewing times. These methods focus on analyzing the behavioral characteristics and physiological responses of individual cows to indirectly assess their feed intake.

[0004] Vision and image analysis methods use physical cameras, algorithms, and deep learning techniques to estimate changes in the feed pile before and after feeding, thereby determining the overall feed intake within the field of view. For example, an RGB-D (Red, Green, Blue, Depth) camera collects data at a height of no more than 1.5 meters above the ground. Feed troughs are loaded, and the depth images before and after simulated feeding are trained on a deep network model to estimate the corresponding feed intake.

[0005] Behavioral and physiological modeling methods provide relatively rough estimates, with poor robustness and accuracy. Compared to behavioral and physiological modeling methods, visual and image analysis methods focus more on the precise measurement of physical changes in feed, providing more intuitive and accurate feed intake data. However, the field of view presented by current existing technologies can only capture a single cow. Because when the shooting height exceeds 2.5 meters, the depth map will have a large number of holes and noise, making the depth map data unreliable, and the estimated feed intake is inaccurate. In summary, existing technologies are difficult to meet the actual needs of ranches. Summary of the Invention

[0006] The present invention aims to solve the problem that the existing estimation of feed intake in the feeding area of ​​dairy cows cannot meet the actual needs of the pasture and the estimation is inaccurate.

[0007] A computer vision-based system for estimating feed intake in a dairy cow's feeding area, comprising:

[0008] Data acquisition module: used to obtain RGB images of the feed area before and after feeding dairy cows;

[0009] Feed area segmentation module: uses the image segmentation model to process the RGB image, identify and extract the mask image of the feed area;

[0010] Data processing module: Perform color matching on the mask images corresponding to before and after feeding the cows to obtain the RGB image of the feed area corresponding to the mask image; obtain a difference image based on the RGB image of the feed area in the mask images corresponding to before and after feeding the cows;

[0011] Overall feed intake estimation module: uses an overall feed intake estimation model to estimate the overall feed intake of the acquired difference image; the overall feed intake estimation model includes a feature extraction subnetwork and a feed intake estimation subnetwork;

[0012] Feature extraction subnetwork: used to extract features from the difference image obtained after processing by the data processing module;

[0013] Feed intake estimation subnetwork: The feature map obtained by the feature extraction subnetwork is passed through a multi-scale pooling layer and spliced, passed through a fully connected layer, and then processed by an activation function, and then passed through a fully connected layer to map the feature vector into a scalar value, that is, the estimated value of feed intake.

[0014] Furthermore, the image segmentation model image adopts U 2 -Net model.

[0015] Furthermore, the U 2 The -Net model has an encoder-decoder structure. The encoder consists of four layers of RSU submodules and two layers of RSU4F submodules, denoted as encode_1 to encode_6 respectively. The decoder consists of one layer of RSU4F submodule and four layers of RSU submodules, denoted as decode_5 to decode_1 respectively. Starting from the salient image of the last layer of encode_6, it is fused layer by layer with the salient image of each layer of the decoder. Finally, a 1×1 Conv and a Sigmoid function are used to generate the final saliency mask image.

[0016] Furthermore, the process of color matching the mask images corresponding to the cows before and after feeding includes:

[0017] For the generated mask image, the RGB image of the corresponding feed area is implanted into the mask image area to obtain the RGB image of the feed area in the mask image.

[0018] Furthermore, the processing process of the feature extraction subnetwork includes:

[0019] The difference image obtained after processing by the data processing module is recorded as the original difference image, and the original difference image is sent to the feature extraction sub-network. The processing is divided into two paths. One path performs a maximum pooling operation on the original difference image; the other path sends the original difference image to the backbone network of the feature extraction sub-network for deeper feature extraction;

[0020] The backbone network of the feature extraction subnetwork is based on the RseNet network architecture, including 4 layers of Residual submodules. Each Residual submodule consists of several Bottleneck Blocks, and each Bottleneck Block includes three convolution layers, namely 1×1 convolution, 3×3 convolution, and 1×1 convolution.

[0021] Furthermore, the specific structure of the 4-layer Residual submodule of the backbone network of the feature extraction subnetwork is as follows: the first layer contains 3 Bottleneck Blocks; the second layer contains 4 Bottleneck Blocks; the third layer contains 23 Bottleneck Blocks; the fourth layer contains 3 Bottleneck Blocks; each Bottleneck Block contains a skip connection.

[0022] Furthermore, the original difference image is fed into the feature extraction subnetwork, and the processing is divided into two paths as follows:

[0023] First, the input difference image I undergoes the first 2×2 Max Pooling to obtain the feature map F1; I then undergoes 1×1 convolution and the first layer of Residual submodule to obtain the feature map F1′; F1′ is downsampled to obtain F1' downsample Then concatenate it with F1 to get the feature map F1″;

[0024] After F1 undergoes a second 2×2 Max Pooling, the feature map F2 is obtained. After F1″ undergoes a 1×1 convolution and a second layer of Residual submodule, the feature map F2′ is obtained. F2′ is obtained by downsampling. downsample Then concatenate it with F2 to get the feature map F2″;

[0025] Then F2 undergoes a third 2×2 MaxPooling to obtain the feature map F3; F2″ then undergoes a 1×1 convolution and the third layer of Residual submodule to obtain the feature map F3′; F3′ is downsampled to obtain F3' downsample Then concatenate it with F3 to obtain the feature map F3″;

[0026] Then, F3″ is subjected to 1×1 convolution and the fourth layer of Residual submodule to obtain the feature map F4′;

[0027] The feature map F4′ is first normalized, and then the Query, Key, and Value are calculated. The Query and Key are then matrix multiplied to obtain the corresponding energy map A1. The softmax function is then applied to obtain the attention map A2. The Value is then multiplied by A2 to obtain the weighted feature map A3. Finally, A3 is concatenated with the residual of the feature map F4′ and output.

[0028] Furthermore, in the feed intake estimation subnetwork, the Swish activation function is used during activation function processing.

[0029] Furthermore, the overall feed intake estimation model is pre-trained. During the training process of the overall feed intake estimation model, different difference images need to be used to train the overall feed intake estimation model; in the process of obtaining different difference images, a permutation and combination method needs to be used to subtract the same pile of feed images from each other according to the relationship before and after the feed to obtain difference images.

[0030] Furthermore, the loss function used in the training process of the overall feed intake estimation model is as follows:

[0031]

[0032] Where n is the number of samples, y i is the true label of the total feed intake of the i-th sample, is the model's predicted value for the overall feed intake of the i-th sample.

[0033] The beneficial effects brought about by the technical solution of the present invention are:

[0034] Based on actual production needs, this paper designs and implements a system for estimating the total feed intake of dairy cows at a viewing angle of 2.95 meters. This system not only has a wide field of view, ensuring high-precision assessment of the total feed intake of dairy cows to meet the actual needs of dairy farms, but also enhances its adaptability to different environments.

[0035] This non-contact feed intake estimation method effectively reduces disturbance to dairy cows and reduces the stress caused by sensor equipment estimating feed intake, thereby helping to maintain cow health and improve productivity. Furthermore, through visual data processing and feature extraction, this method significantly saves time and labor costs. Compared to traditional processing methods, visual image analysis reduces operational complexity, making overall feed intake estimation of dairy cows more efficient. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] Figure 1 This is a schematic diagram of the processing flow of the feed intake estimation system for dairy cows in feeding areas based on computer vision;

[0037] Figure 2 Provides an overall deployment diagram for data collection;

[0038] Figure 3 is the camera field of view;

[0039] Figure 4 Schematic diagram of the U2-Net model structure;

[0040] Figure 5 This is the preprocessing effect diagram of a single image;

[0041] Figure 6 This is the difference diagram before and after simulated feeding;

[0042] Figure 7 Model diagram for estimating overall feed intake;

[0043] Figure 8 Graph of the multi-scale feature fusion process. DETAILED DESCRIPTION

[0044] Based on actual production needs, this application designs and implements a system for estimating the total feed intake of dairy cows at a viewing angle of 2.95 meters. This system not only boasts a wide field of view, ensuring high-precision assessment of the total feed intake of dairy cows, but also enhances adaptability to diverse environments. This provides a more practical technology for optimizing feed costs, genetic evaluation, breeding cattle, and ensuring dairy cow health.

[0045] Specific implementation method 1: Combination Figure 1 To explain this embodiment,

[0046] This embodiment is a computer vision-based system for estimating feed intake in a dairy cow's feeding area, including:

[0047] Data acquisition module: A binocular camera is used to obtain RGB images before and after feeding. These images serve as the basic data source for subsequent analysis.

[0048] In this embodiment, a horizontal aluminum bar is set at a height of 2.95 meters from the ground. The binocular camera is installed at a suitable position on the bar, such as Figure 2 As shown, to ensure that the shooting range of multiple cows can be covered from this perspective, as shown Figure 3 As shown. The data acquisition module is one of the core components of this application, and is intended to provide high-quality basic data for subsequent image processing and analysis. In the early stage of developing the model of the present invention, the module designed two different data set acquisition schemes to meet the research needs at different stages. The first type of data set is specially designed for training the segmentation model, with the aim of allowing the model to learn and understand the visual characteristics of feed under various conditions, thereby improving its recognition accuracy and adaptability. This type of data set is crucial to ensuring that the model can accurately distinguish feed from other background elements under different lighting conditions. The second type of data set focuses more on exploring the impact of sunlight on the color perception of feed, and combines it with the simulation of the natural eating behavior of dairy cows to gain a deeper understanding of how environmental factors affect the visual recognition of feed, while intuitively capturing the changes in the amount of feed intake of dairy cows before and after feeding. In the actual use process after the development of the model of the present invention is completed, the images of dairy cows before and after eating are directly collected (without collecting the two types of data in the way of training the model), and the feed area segmentation module is directly used for segmentation processing.

[0049] Feed area segmentation module: Use the trained image segmentation model to process the RGB image to accurately identify and extract the mask image of the feed area, ensuring that the feed and background elements can be clearly distinguished.

[0050] Since the original RGB images obtained from the cattle farm are snapshots of the real scene, they contain feed and various objects in the surrounding environment. The feed region segmentation module can accurately extract the area where the feed is located from the complex background. This outputs a new image, called a mask image. In this new image, only the feed area will be marked (usually white), while the background and other objects will be blocked (usually black). This method is particularly suitable for processing images with a large field of view and can effectively eliminate interference from non-feed objects, thus laying the foundation for subsequent more accurate estimation of feed changes. Compared with traditional methods, this method is more in line with the needs of practical applications.

[0051] The image segmentation model in this embodiment adopts U 2 -Net model, which is an encoder-decoder structure, such as Figure 4As shown in the figure. The encoder includes four layers of RSU (Residual U-block) submodules and two layers of RSU4F (Factorized Residual U-block) submodules, denoted as encode_1 to encode_6 respectively; the decoder includes one layer of RSU4F submodule and four layers of RSU submodules, denoted as decode_5 to decode_1 respectively. The salient image of the last layer, encode_6, is fused with the salient images of each decoder layer, and the final saliency mask image is generated through a 1×1 Conv and a Sigmoid function. This design enables the model to capture detailed features while maintaining high resolution, making it very suitable for segmentation tasks of objects with complex textures such as feed.

[0052] It should be noted that each decoder generates a saliency map based on the feature map of the current decoder layer. Since the network generates feature maps of different sizes at different decoder layers, the size of the saliency map of each layer is also different and is usually smaller than the input image size. Because the saliency maps of each layer are of different sizes, in order to be able to splice these saliency maps (i.e., fuse them together), an upsampling operation is required so that they can be spliced ​​with the saliency maps of other layers. Finally, all the spliced ​​saliency maps (restored to the original image size through upsampling) are further processed through a 1×1 convolutional layer. The role of the 1×1 convolutional layer is to reduce the number of channels and usually compress the spliced ​​saliency maps to a single-channel output. Next, a Sigmoid function is used to map the output to the range [0,1], ultimately generating a binary saliency map (i.e., saliency mask). This mask represents the salient areas in the image. Figure 4 The encoder-decoder shown in does not show 1×1Conv and a Sigmoid function.

[0053] The data processing module receives the mask image and uses a color matching algorithm to further optimize the feed area, generating an image that reflects the actual feed distribution. These processed feed images are paired in a time series (i.e., before and after feeding) and compared at the pixel level to calculate the difference between them, forming a difference image. This process assigns a label value representing the feed quality before and after feeding for each sample, visually demonstrating feed consumption. Finally, the difference image and its corresponding label value are fed into the feed intake estimation module.

[0054] The data processing module is primarily responsible for color matching the mask image (a binary black and white feed area mask image), optimizing image quality, and generating a difference image. This process then matches the color of the white feed area in the mask image with the feed area in the original color image. This creates a new image with a black background and the feed area retaining its original color. Because each color-matched image only represents a single state of the feed at the current moment and cannot convey the amount of feed change, this module compares the two color-matched feed images and calculates the difference between them to generate a difference image. This visual representation of the amount of feed change occurs.

[0055] The specific implementation method is as follows:

[0056] First, all RGB images before and after simulated feeding were color-matched with the mask image generated using segmentation techniques. To perform color matching on the mask image, the feed details from the original RGB image were transferred to the white portion of the mask image. This resulted in a segmented image of the feed area with the original feed color details, rather than a mask image with the feed area remaining white. In actual processing, color matching involves extracting the corresponding pixel value from the original RGB image for each white pixel (value 255) in the mask image and assigning it to the corresponding point in the white area of ​​the mask image.

[0057] Then, these color-matched images are cropped to a standard size of 360 × 1080 pixels, as shown in Figure 5 shown.

[0058] To assess changes in cow feed intake, a permutation and combination method was used to subtract two images of the same feed pile from each other before and after feeding to generate difference images. For example, the first image of the same feed pile was taken before feeding (a1), followed by a photo taken after the cow entered and finished eating and then left (a2), a photo taken after the cow entered and finished eating and then left (a3), a photo taken after the cow entered and finished eating and then left (a4), and a photo taken after the cow entered and finished eating and then left (a5). The difference images representing feed intake are a2-a1, a3-a2, a4-a3, a5-a4, a3-a1, a4-a1, a4-a2, a5-a1, a5-a2, and a5-a3, resulting in C(5,2) = 10 matching methods. Given that the cow's single feed intake does not exceed 10 kg under the conditions of this application, the weight change reflected in the difference images was kept within this range. To prevent negative values ​​from affecting the integrity of feature extraction, an absolute value operation was used to preserve the complete difference information.

[0059] Finally, 8,000 difference images were selected from the processed images for further analysis. Given that the large size of these images may cause excessive time and computing resources to be consumed during the training phase, this application downsampled these difference images and converted them into a smaller 120×360 pixel format, such as Figure 6 As shown. In addition, data enhancement methods such as random horizontal flipping, random vertical flipping and random rotation are also applied to increase data diversity and prevent overfitting. A total of 16,000 difference images and their corresponding weight differences are obtained, and divided into training sets and test sets in a ratio of 8:2. The training set and test set are used to train and test the total feed intake estimation model in the total feed intake estimation module. Through continuous feature extraction and model training, the model gradually fits the true label value, thereby obtaining a model that can estimate the total feed intake within the field of view. In actual use (actual estimation), the difference image of this module can be directly sent to the feed intake estimation module for estimation.

[0060] Overall feed intake estimation module: uses the overall feed intake estimation model to estimate the overall feed intake of the acquired difference images.

[0061] The overall feed intake estimation model (DMS-RGB-Net) proposed in this application mainly includes image feature extraction and feed intake estimation. Figure 7 As shown in the figure. In the feature extraction process, the difference image undergoes a series of multi-scale fusion processes and a self-attention mechanism to reduce the impact of noise during feature extraction. While extracting subtle features, it also considers global connections and the correlations between each subtle feature, thus minimizing the impact of light-induced color changes on the feed surface. In the feed intake estimation process, the extracted feature vectors are linearly transformed through a fully connected layer, and nonlinearity is introduced through an activation function to ultimately estimate feed intake.

[0062] Feature extraction part:

[0063] First, the difference image obtained after processing by the data processing module is recorded as the original difference image and sent to the feature extraction part. Then, the processing of the feature map is divided into two paths. One path performs a maximum pooling operation on the original difference image; the other path sends the original difference image to the backbone network of the feature extraction part for deeper feature extraction.

[0064] The backbone network of the feature extraction part is based on the RseNet network architecture. Each Residual submodule consists of several BottleneckBlocks, and each BottleneckBlock includes three convolution layers, namely 1×1 convolution, 3×3 convolution, and 1×1 convolution. In this embodiment, the entire feature extraction backbone network is composed of 4 layers of Residual submodules, and the specific structure is as follows: the first layer contains 3 BottleneckBlocks; the second layer contains 4 BottleneckBlocks; the third layer contains 23 BottleneckBlocks; and the fourth layer contains 3 BottleneckBlocks. Each BottleneckBlock contains a skip connection, which allows the gradient to be passed directly to the previous layer, thereby effectively alleviating the common problems of gradient disappearance and gradient explosion during deep network training.

[0065] Furthermore, the network considers that as the viewing angle expands, the overall feeding area also expands. Furthermore, based on the feeding behavior of individual cows, the feed intake distribution pattern is funnel-shaped, with a large feeding area in the center and smaller areas around the edges. Through downsampling and corresponding residual block processing, combined with feature map concatenation and convolution operations, the network effectively integrates multi-scale feature information. This structure captures not only local details but also global structure. This rich feature set helps the model make more accurate predictions in complex tasks.

[0066] More specifically, the difference image goes through the detailed steps of the two paths, such as Figure 8 As shown:

[0067] First, the input difference image I undergoes the first 2×2 MaxPooling to obtain the feature map F1, as shown in formula (1). I then undergoes 1×1 convolution and the first layer of Residual submodule to obtain a 360×180×64 feature map F1′. F1′ is obtained by downsampling to F1' downsample Then concatenate it with F1 to obtain the feature map F1″, as shown in formula (2).

[0068]

[0069] After F1 undergoes a second 2×2 Max Pooling, the feature map F2 is obtained, as shown in formula (3). After F1″ undergoes a 1×1 convolution and the second layer of Residual submodule, a 180×60×128 feature map F2′ is obtained. F2′ is obtained by downsampling. downsample Then concatenate it with F2 to obtain the feature map F2″, as shown in formula (4).

[0070]

[0071] Then F2 is subjected to the third 2×2 MaxPooling to obtain the feature map F3, as shown in formula (5). F2″ is further subjected to 1×1 convolution and the third layer of Residual submodule to obtain the 90×30×256 feature map F3′. F3′ is obtained by downsampling operation to obtain F3' downsample Then concatenate it with F3 to obtain the feature map F3″, as shown in formula (6).

[0072]

[0073] Finally, F3″ undergoes 1×1 convolution and the fourth layer of Residual submodule to obtain a 45×15×512 feature map F4′.

[0074] After multi-scale feature fusion, the relationships between the subtle features obtained by the model are relatively complex. To allow the features at each position to interact with the features at other positions, this application introduces a self-attention mechanism, which makes the model more robust to input changes.

[0075] The specific process is as follows: In order to improve numerical stability, the feature map F4′ is first normalized and then the Query, Key, and Value are calculated; the Query and Key are then matrix multiplied to obtain the corresponding energy map A1, as shown in Equation (7); the softmax function is then applied to obtain the attention map A2, as shown in Equation (8); the Value is then multiplied by A2 to obtain the weighted feature map A3, as shown in Equation (9); finally, A3 is connected to the residual of the feature map F4′ and output.

[0076] A1=Query×Key T (7)

[0077] A2=softmax(A1) (8)

[0078] A3=A2×Value (9)

[0079] Feed intake estimation: In the feed intake estimation part, the feature map obtained after the self-attention mechanism is passed through a multi-scale pooling layer. Specifically, three adaptive average pooling layers of different scales are used:

[0080] (1) Global average pooling, capturing the global information of the entire feature map;

[0081] (2) Medium-scale pooling to capture information in local areas;

[0082] (3) Small-scale pooling to capture finer-grained local information.

[0083] The specific process is as follows: After processing through the self-attention mechanism, the feature map of each channel is simultaneously pooled at three different scales: global average pooling, medium-scale pooling, and small-scale pooling. Outputs of 1x1, 2x2, and 4x4 sizes are then obtained. Finally, these three pooling results are concatenated.

[0084] The concatenated high-dimensional features are mapped to a lower-dimensional space through a fully connected layer. Nonlinearity is introduced through the Swish activation function (SiLU). Finally, another fully connected layer maps the feature vector to a scalar value, i.e., the estimated feed intake.

[0085] When the output of the fully connected layer passes through the Swish activation function (SiLU), nonlinearity is introduced to enhance the expressive power of the model. The calculation method of Swish is shown in formula (10):

[0086] Swish(x)=x i ·σ(x) (10)

[0087] Where σ(x) is the Sigmoid function, and its calculation method is shown in formula (11):

[0088]

[0089] Among them, x is the eigenvector, x i The output range of the Sigmoid function is between (0,1), which acts as a "gate" in the Swish function to control the input x i The degree of passing. When x i When x is positive, the output of the Sigmoid function is close to 1, which means that x i Almost completely passed; when x i When x is negative, the output of the Sigmoid function is close to 0, which means that x i is suppressed, but not completely truncated to 0. This can adaptively adjust its output to better capture complex patterns in the data.

[0090] The loss function used in training the overall feed intake estimation model using the training set is as follows:

[0091] To update the model parameters, this application uses MSE-LOSS as the loss function, which measures the mean square error between the model prediction value and the true value. The calculation method is shown in formula (12):

[0092]

[0093] Where n is the number of samples, yi is the true label (target value) of the total feed intake of the i-th sample, is the model's predicted value for the overall feed intake of the i-th sample.

[0094] After obtaining the trained overall feed intake estimation model, in actual use, the difference image obtained by the data processing module can be directly sent to the feed intake estimation module for estimation.

[0095] For the first time, a segmentation model was used to isolate the feed area within an image, addressing the impact of other interference factors within a large field of view. In the feed intake estimation module, a ResNet architecture, self-attention mechanism, and multi-scale fusion technology were innovatively combined to design and implement a deep learning model for estimating overall feed intake within the camera's field of view. Furthermore, this application conducted experiments in a real-world environment, and the entire process only required RGB images, significantly reducing costs.

[0096] The present invention may have many other embodiments. Without departing from the spirit and essence of the present invention, those skilled in the art may make various corresponding changes and modifications based on the present invention, but these corresponding changes and modifications should all fall within the scope of protection of the claims attached to the present invention.

Claims

1. A computer vision-based system for estimating feed intake in a dairy cow's feeding area, characterized in that: include: Data acquisition module: used to obtain RGB images of the feed area before and after feeding dairy cows; Feed area segmentation module: uses the image segmentation model to process the RGB image, identify and extract the mask image of the feed area; Data processing module: Perform color matching on the mask images corresponding to before and after feeding the cows to obtain the RGB image of the feed area corresponding to the mask image; obtain a difference image based on the RGB image of the feed area in the mask images corresponding to before and after feeding the cows; Overall feed intake estimation module: uses an overall feed intake estimation model to estimate the overall feed intake of the acquired difference image; the overall feed intake estimation model includes a feature extraction subnetwork and a feed intake estimation subnetwork; Feature extraction subnetwork: used to extract features from the difference image obtained after processing by the data processing module; Feed intake estimation subnetwork: The feature map obtained by the feature extraction subnetwork is passed through a multi-scale pooling layer and spliced, passed through a fully connected layer, and then processed by an activation function. Finally, a fully connected layer is used to map the feature vector into a scalar value, i.e., the feed intake estimate. The process of feeding the original difference image into the feature extraction subnetwork is as follows: First, the input difference image I undergoes the first 2×2 Max Pooling to obtain the feature map F1; I then undergoes 1×1 convolution and the first layer of Residual submodule to obtain the feature map F1′; F1′ is downsampled to obtain F′ 1downsample Then concatenate it with F1 to get the feature map F1″; F1 undergoes a second 2×2 Max Pooling to obtain the feature map F2; F1″ then undergoes a 1×1 convolution and the second layer of Residual submodule to obtain the feature map F2′; F2′ is downsampled to obtain F′ 2downsample Then concatenate it with F2 to get the feature map F2″; Then F2 undergoes a third 2×2 MaxPooling to obtain the feature map F3; F2″ then undergoes a 1×1 convolution and the third layer of Residual submodule to obtain the feature map F3′; F3′ is downsampled to obtain F′ 3downsample Then concatenate it with F3 to obtain the feature map F3″; Then, F3″ is subjected to 1×1 convolution and the fourth layer of Residual submodule to obtain the feature map F4′; The feature map F4′ is first normalized, and then the Query, Key, and Value are calculated. The Query and Key are then matrix multiplied to obtain the corresponding energy map A1. The softmax function is then applied to obtain the attention map A2. The Value is then multiplied by A2 to obtain the weighted feature map A3. Finally, A3 is concatenated with the residual of the feature map F4′ and output.

2. The computer vision-based system for estimating feed intake in a dairy cow's feeding area according to claim 1, characterized in that: The image segmentation model image adopts U 2 -Net model.

3. The computer vision-based system for estimating feed intake in a dairy cow's feeding area according to claim 2, characterized in that: The U 2 The -Net model has an encoder-decoder structure. The encoder consists of four layers of RSU submodules and two layers of RSU4F submodules, denoted as encode_1 to encode_6 respectively. The decoder consists of one layer of RSU4F submodule and four layers of RSU submodules, denoted as decode_5 to decode_1 respectively. Starting from the salient image of the last layer of encode_6, it is fused layer by layer with the salient image of each layer of the decoder. Finally, a 1×1 Conv and a Sigmoid function are used to generate the final saliency mask image.

4. The computer vision-based system for estimating feed intake in a dairy cow's feeding area according to claim 1, characterized in that: The process of color matching the mask images before and after feeding the cows includes: For the generated mask image, the RGB image of the corresponding feed area is implanted into the mask image area to obtain the RGB image of the feed area in the mask image.

5. The computer vision-based system for estimating feed intake in a dairy cow's feeding area according to claim 1, characterized in that: The processing process of the feature extraction subnetwork includes: The difference image obtained after processing by the data processing module is recorded as the original difference image, and the original difference image is sent to the feature extraction sub-network. The processing is divided into two paths. One path performs a maximum pooling operation on the original difference image; the other path sends the original difference image to the backbone network of the feature extraction sub-network for deeper feature extraction; The backbone network of the feature extraction subnetwork is based on the RseNet network architecture, including 4 layers of Residual submodules. Each Residual submodule consists of several Bottleneck Blocks, and each Bottleneck Block includes three convolution layers, namely 1×1 convolution, 3×3 convolution, and 1×1 convolution.

6. The computer vision-based system for estimating feed intake in a dairy cow's feeding area according to claim 5, characterized in that: The specific structure of the 4-layer Residual submodule of the backbone network of the feature extraction subnetwork is as follows: the first layer contains 3 BottleneckBlocks; the second layer contains 4 BottleneckBlocks; the third layer contains 23 BottleneckBlocks; the fourth layer contains 3 BottleneckBlocks; each Bottleneck Block contains a skip connection.

7. The computer vision-based system for estimating feed intake in a dairy cow's feeding area according to claim 1, characterized in that: In the feed intake estimation subnetwork, the Swish activation function is used when processing the activation function.

8. The computer vision-based system for estimating feed intake in a dairy cow's feeding area according to claim 5, 6 or 7, characterized in that: The overall feed intake estimation model is pre-trained. During the training process of the overall feed intake estimation model, different difference images need to be used to train the overall feed intake estimation model; in the process of obtaining different difference images, a permutation and combination method is needed to subtract the same pile of feed images from each other according to the relationship before and after the feed to obtain difference images.

9. The computer vision-based system for estimating feed intake in a dairy cow's feeding area according to claim 8, characterized in that: The loss function used in the training of the overall feed intake estimation model is as follows: Where n is the number of samples, y i is the true label of the total feed intake of the i-th sample, is the model's predicted value for the overall feed intake of the i-th sample.

Citation Information

Patent Citations

  • Virtual food box defect generation method and system based on neural network

    CN114359269A

  • Low-power-consumption monitoring awakening method, device and equipment based on human shape recognition

    CN118982847A

Cited By

  • Animal metabolic abnormality detection method and system based on multi-source sensing fusion

    CN121453998A