R-D Faster R-CNN lactating sow posture recognition method
Through the dual-stream RGB-D Faster R-CNN method, combined with the feature fusion of RGB images and depth images, the problem of low recognition accuracy of a single data source is solved, high-precision recognition of sow postures is achieved, and the accuracy and accuracy of recognition are improved. robustness.
Patent Information
- Application Number
- CN202410812737.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-22
- Publication Date
- 2024-09-24
AI Technical Summary
The existing single RGB image or depth image is difficult to provide stable and accurate feature representation in pig behavior recognition, resulting in a bottleneck in recognition accuracy. Especially in sow posture recognition, RGB images cannot reflect target height information, and depth information is difficult to distinguish shapes. Similar gesture.
The dual-stream RGB-D Faster R-CNN method is used to extract RGB image and depth image features through two independent convolutional neural networks, and perform non-linear combination to fuse the features to generate a high-precision sow posture recognition model. Faster The R-CNN algorithm and RPN network generate regions of interest, combined with ROI Pooling and global average pooling layers, and are finally processed by classifiers and regressors to output recognition results.
It achieves high-precision recognition of sow posture, makes full use of RGB-D data information, improves the accuracy and robustness of recognition, and overcomes the limitations of information loss and recognition accuracy.
Smart Images

Figure CN118692148A
Abstract
Description
Technical Field
[0001] The present invention relates to multimodal target detection and recognition technology in the field of computer vision, and in particular to a lactating sow posture recognition method based on R-DFaster R-CNN. Background Art
[0002] The behavior of pigs in pig farms is a key indicator of their welfare and health status, and has a direct impact on the economic benefits of pig farms. In animal behavior monitoring technology, compared with traditional manual monitoring and sensor technology, automatic identification using computer vision has the advantages of low cost, high efficiency and non-contact, and can continuously provide valuable behavior information, providing strong support for pig farm management.
[0003] In recent years, the use of computer vision for pig behavior recognition has been widely studied. For example, in 2018, Xue Yueju et al. from South China Agricultural University used deep image data, introduced residual structure and CenterLoss to improve the FasterR-CNN algorithm to automatically identify five postures of lactating sows in free pens. The team's 2017 patent with the publication number of CN201710890676 used deep images, first used the DPM algorithm to detect sows, and then used the CNN network to identify the sow's posture in the detection frame. The patent with the publication number of CN107527351A used RGB images and FCN algorithms to automatically segment the sows in the scene. The team's 2019 patent with the publication number of CN109766856A used a simple two-stream Fasterrcnn model to identify the posture of lactating sows. In 2018, Xiao Deqin et al. of South China Agricultural University published a patent with the publication number CN108717523A, which disclosed a method for detecting estrus behavior of sows based on machine vision. The method first judges the mounting behavior, and then trains the neural network model to detect the behavior based on the displacement movement information of the estrus sow, the proximity of the boar and the mounting frequency. In 2016, Lao Fengdan et al. of China Agricultural University published a patent with the publication number CN104881636A, which disclosed a method and device for identifying the lying behavior of pigs. The method obtains the depth image and binary image of the pig, performs ellipse fitting on the binary image, and calculates the height from a specific point of the depth image to the ground, and finally identifies the lying behavior of the pig through threshold comparison. In 2017, Zhu Weixing et al. from Jiangsu University published a patent with publication number CN108090426A, which disclosed a method for identifying group-raised pigs based on machine vision. By collecting overhead videos of group-raised pigs, multi-scale and multi-directional features of individual pigs are extracted in the frequency domain, and tiny detail features of individual pigs are extracted in the spatial domain. After dimensionality reduction of the features, classifiers are trained to achieve identification and segmentation. In addition, the team published a patent with publication number CN107679463A, which disclosed an analysis method for identifying aggressive behavior of group-raised pigs using machine vision technology. The patent with publication number CN107437069A disclosed a contour-based method for identifying pig drinking water, etc.
[0004] In the field of computer vision, most studies on pig behavior recognition rely on RGB images or depth image data. However, this single data source is difficult to provide stable and accurate feature representation in practical applications, which limits the further improvement of recognition accuracy. When the camera converts a three-dimensional scene into a two-dimensional RGB image, information loss is inevitable. Although depth images can make up for this defect to a certain extent, due to the lack of key details such as texture and color in RGB images, the recognition difficulty increases significantly when facing target objects with similar shapes. Especially in the overhead shooting task of sow posture recognition, RGB images cannot reflect the height information of the target, which is an important factor in distinguishing different postures. At the same time, some postures of sows are very close in height and shape (such as prone and ventral), and it is difficult to achieve accurate distinction relying solely on depth information. Therefore, to improve the accuracy and robustness of pig behavior recognition, it is necessary to explore more comprehensive and efficient data fusion methods to make full use of the respective advantages of RGB images and depth images.
[0005] Therefore, the current technical challenge that needs to be solved urgently is how to develop a high-precision two-stream RGB-D FasterR-CNN method to effectively recognize the posture of sows. This method should be able to fully integrate the information of RGB images and depth images, thereby solving the problems of information loss and recognition accuracy bottlenecks, and providing new breakthroughs in pig behavior recognition research. Summary of the invention
[0006] The purpose of the present invention is to provide a method for recognizing the posture of sows using a dual-stream RGB-D Faster R-CNN, so as to realize automatic and more accurate posture recognition of sows in free pens. To achieve the above purpose, the specific invention contents are as follows:
[0007] The present invention proposes a back-end feature fusion strategy. Specifically, we use two independent convolutional neural networks (CNNs) to extract the features of RGB images and depth images respectively. Then, we effectively fuse these two features. Finally, these features are predicted and analyzed through a nonlinear combination (NOC) structure. Based on this strategy, we further expand the Faster R-CNN algorithm and design a dual-stream RGB-D Faster R-CNN algorithm. This algorithm can make full use of RGB-D data information to achieve high-precision recognition of sow posture. It includes the following steps:
[0008] S1. Collect RGB-D video images of lactating sows, including RGB images and depth images, and establish an RGB-D video image library for sow posture recognition;
[0009] S2. Based on the FasterR-CNN algorithm, two CNN networks are used to convolve the RGB image and the depth image respectively to obtain the RGB image feature map and the depth image feature map;
[0010] S3, for the RGB image feature map and the depth image feature map, use an RPN network to generate the region of interest RGB-ROI and D-ROI respectively;
[0011] S4. Use ROIPooling layer to pool each D-ROI and RGB-ROI to a fixed size;
[0012] S5. Use the NOC structured FastR-CNN to further extract fusion features from the pooled feature maps. After the global average pooling layer, the maps are processed by the classifier and regressor. The splicing fusion method is used for each set of processed data to fuse the features of the two. A dual-stream RGB-D Faster R-CNN sow posture recognition model is obtained, and the recognition results are output;
[0013] S6. Obtain training sets and test sets from the sow posture recognition RGB-D video image library, use the training set to train the two-stream RGB-D Faster R-CNN sow posture recognition model, use the test set to test the model performance, and finally select the best performance model by adjusting the parameters.
[0014] The specific process of step S1 is as follows:
[0015] S11, fix the RGB-D sensor to shoot and collect the RGB-D video image of the pig pen from above;
[0016] S12. Sampling the obtained RGB-D video image data to obtain a training set and a test set, where the training data set accounts for 70% and the test set accounts for 30% to test the model performance;
[0017] S13. In the training set and the test set, the depth images are preprocessed, including filtering denoising and image enhancement. Then, the preprocessed depth images are labeled with objects, that is, the outer bounding box and posture category of the object are labeled. The RGB images do not need to be processed.
[0018] The specific process of step S2 is as follows:
[0019] In the shared convolutional layer part of Faster R-CNN, two identical CNN networks are used to take depth images and RGB images as input respectively. The CNN network with depth images as input is Conv-D, and the CNN network with RGB images as input is Conv-RGB.
[0020] The specific process of step S3 is as follows:
[0021] In the RPN stage of the Faster R-CNN algorithm, an RPN network is used to generate the region of interest D-ROI of the depth image using the depth image feature map output by Conv-D as input; an RPN network is used to generate the region of interest RGB-ROI of the color image using the depth image feature map output by Conv-RGB as input;
[0022] The specific process of step S4 is as follows:
[0023] Each set of D-ROI and RGB-ROI is pooled to a fixed size using the ROI pooling layer.
[0024] The specific process of step S5 is as follows:
[0025] S51. Further extract features of the fixed-size ROIs through NOC;
[0026] S52. Fuse the features of the depth image and the color image. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Figure 1 This is a flowchart of the method for recognizing the posture of a lactating sow using a dual-stream RGB-D FasterR-CNN of the present invention. DETAILED DESCRIPTION
[0028] 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.
[0029] The present invention proposes a back-end feature fusion strategy. Specifically, we use two independent convolutional neural networks (CNNs) to extract the features of RGB images and depth images respectively. Then, we effectively fuse these two features. Finally, these features are predicted and analyzed through a nonlinear combination (NOC) structure. Based on this strategy, we further expand the Faster R-CNN algorithm and design a dual-stream RGB-D Faster R-CNN algorithm. This algorithm can make full use of RGB-D data information to achieve high-precision recognition of sow posture.
[0030] Figure 1The attached figure clearly shows the whole process. First, we use a CNN network (Conv-D) that specializes in processing depth images to extract features from the depth image, while another CNN network (Conv-RGB) that processes RGB images is responsible for extracting features from the RGB image. Next, we use the RPN (Region Proposal Network) network to generate the region of interest (D-ROI) of the depth image using the feature map of the depth image as input. Similarly, we use the feature map of the RGB image as input to generate the region of interest (RGB-ROI) of the RGB image. In order to unify the feature maps from these different sources to the same size, we apply the ROI-Pooling layer to the feature maps of the D-ROI and RGB-ROI respectively for pooling. After completing this step, we fuse the features of the RGB image and the depth image. Finally, we use FastR-CNN for ROI classification and recognition. At this stage, we use the NOC (Nonlinear Combination) structure for convolution operations, and then pass the results to the classifier and regressor for processing to obtain the final recognition results. This process makes full use of the information of RGB images and depth images to improve the accuracy and robustness of recognition.
[0031] Step 1: Collect RGB-D video images of lactating sows, including RGB images and depth images, and establish an RGB-D video image library for sow posture recognition;
[0032] Step 2: Based on the FasterR-CNN algorithm, two CNN networks are used to convolve the RGB image and the depth image respectively to obtain the RGB image feature map and the depth image feature map;
[0033] Step 3: For the RGB image feature map and the depth image feature map, use an RPN network to generate the region of interest RGB-ROI and D-ROI respectively;
[0034] Step 4: Use ROIPooling layer to pool each D-ROI and RGB-ROI to a fixed size;
[0035] Step 5: Use the NOC structure FastR-CNN to further extract fusion features from the pooled feature maps, and then pass them through the global average pooling layer to the classifier and regressor for processing. Use the splicing fusion method for each set of processed data to fuse the features of the two. A two-stream RGB-D Faster R-CNN sow posture recognition model is obtained, and the recognition results are output;
[0036] Step 6: Obtain the training set and test set from the sow posture recognition RGB-D video image library, use the training set to train the two-stream RGB-D Faster R-CNN sow posture recognition model, use the test set to test the model performance, and finally select the best performance model by adjusting the parameters.
[0037] The database establishment method in step 1 specifically includes:
[0038] 1) Data collection was performed on 28 pig pens. The pig pens were free pens, each containing a sow. Using Microsoft's Kinect v2.0 sensor, the pig pens were 2 to 2.3 meters above the ground, and the RGB-D data was acquired at a rate of 5 frames per second. The RGB image pixels acquired were 550*460, and the depth image pixels acquired were 420*483 resolution. The pixel value of the depth image reflects the distance between the object and the sensor.
[0039] 2) From the captured data, a group of continuous video images is randomly selected every 10 to 40 frames, and a total of 4 types of RGB-D image groups of postures, standing, sitting, prone, and lying on the abdomen, are randomly sampled as the original training set. Each group of RGB-D images includes an RGB image and its corresponding depth image. In the total data set, the training set accounts for about 70% and the test set accounts for about 30%.
[0040] 3) First, the depth image obtained after sampling is subjected to median filtering and adaptive histogram equalization to improve the contrast, while the RGB image is not preprocessed. In the manual annotation stage, for each set of RGB-D video image data, we manually annotate the depth image, that is, annotate the outer bounding box of the sow for each depth image in the dataset to obtain the coordinate position information of the sow in the image. In order to enhance the generalization ability and robustness of subsequent model training, the original training set data is augmented in the experiment, that is, clockwise rotation of 90 degrees, 180 degrees, and 270 degrees, as well as horizontal and vertical mirroring. The processed RGB-D data reaches 19,692 groups, which are used as training data sets for training models.
[0041] Table 1 Introduction to the four types of postures of lactating sows
[0042]
[0043] The method of step 2 based on the FasterR-CNN algorithm and using two CNN networks to convolve the RGB image and the depth image respectively includes:
[0044] Based on the FasterR-CNN algorithm, taking the mobilefile network as an example, the network structure first uses a series of convolutional layers and maxpooling layers of the mobilefile network structure to independently process the two types of data and extract the features of the two types of image data. Conv-D is used to extract deep image features, and Conv-RGB is used to extract RGB image features.
[0045] The method of step 3 using an RPN network to generate RGB-ROI and D-ROI of the region of interest for the RGB image feature map and the depth image feature map respectively specifically includes:
[0046] In the RPN stage, the feature maps of the dual-stream output share an RPN network, that is, the D-ROI is generated based on the depth map feature map, and the RGB-ROI is generated from the RGB image feature map through the RGB-D mapping relationship. For the RPN network, 15 anchor points of 5 area scales and 3 aspect ratios {1:1, 1:3, 3:1} are taken at each sliding window position.
[0047] In step 4, each D-ROI and RGB-ROI is pooled to a fixed size using the ROIPooling layer.
[0048] Two ROI-Pooling layers (spatial pyramid pooling layers) are used to generate D-ROI and RGB-ROI of different sizes in H*W grids, and the maximum value pooling method is adopted to generate a fixed-size feature map.
[0049] In step 5, the pooled feature maps are further extracted using the NOC structure of FastR-CNN. After the global average pooling layer, they are processed by the classifier and regressor. The splicing fusion method is used for each set of processed data to fuse the features of the two. The dual-stream RGB-D Faster R-CNN sow posture recognition model is obtained, and the recognition results are output:
[0050] 1) In the Fast R-CNN stage, the NOC structure consisting of four convolutional layers Conv6, Conv7, Conv8 and Conv9 is used to continue convolution of the fused feature map to promote the flow of information between the fused feature channels, thereby further abstracting the features of the RGB-D data. After the global average pooling layer, the classifier and regressor of Fast R-CNN are finally connected.
[0051] 2) The extracted features are fused through feature fusion method and the final result is output.
Claims
1. A method for recognizing the posture of a lactating sow based on RD Faster R-CNN, characterized in that: The steps include: S1. Collect RGB-D video images of lactating sows, including RGB images and depth images, and establish an RGB-D video image library for sow posture recognition; S2. Based on the FasterR-CNN algorithm, two CNN networks are used to convolve the RGB image and the depth image respectively to obtain the RGB image feature map and the depth image feature map; S3, for the RGB image feature map and the depth image feature map, use an RPN network to generate the region of interest RGB-ROI and D-ROI respectively; S4. Use ROIPooling layer to pool each D-ROI and RGB-ROI to a fixed size; S5. Use the NOC structured Fast R-CNN to further extract fusion features from the pooled feature maps. After the global average pooling layer, the maps are processed by the classifier and regressor. The splicing fusion method is used for each set of processed data to fuse the features of the two. A two-stream RGB-D Faster R-CNN sow posture recognition model is obtained, and the recognition results are output; S6. Obtain training sets and test sets from the sow posture recognition RGB-D video image library, use the training set to train the two-stream RGB-D Faster R-CNN sow posture recognition model, use the test set to test the model performance, and finally select the best performance model by adjusting the parameters.
2. The method for recognizing the posture of a lactating sow using RD Faster R-CNN according to claim 1, characterized in that: The specific process of step S1 is as follows: S11, fix the RGB-D sensor to shoot and collect the RGB-D video image of the pig pen from above; S12. Sampling the obtained RGB-D video image data to obtain a training set and a test set, where the training data set accounts for 70% and the test set accounts for 30% to test the model performance; S13. In the training set and the test set, the depth images are preprocessed, including filtering denoising and image enhancement. Then, the preprocessed depth images are labeled with objects, that is, the outer bounding box and posture category of the object are labeled. The RGB images do not need to be processed.
3. The method for recognizing the posture of a lactating sow using RD Faster R-CNN according to claim 1, characterized in that: The specific process of step S2 is as follows: In the shared convolutional layer part of Faster R-CNN, two identical CNN networks are used to take depth images and RGB images as input respectively. The CNN network with depth images as input is Conv-D, and the CNN network with RGB images as input is Conv-RGB.
4. The method for recognizing the posture of a lactating sow using RD Faster R-CNN according to claim 1, characterized in that: The specific process of step S3 is as follows: In the RPN stage of the Faster R-CNN algorithm, an RPN network is used to generate the region of interest D-ROI of the depth image using the depth image feature map output by Conv-D as input; an RPN network is used to generate the region of interest RGB-ROI of the color image using the depth image feature map output by Conv-RGB as input.
5. The method for recognizing the posture of a lactating sow using RD Faster R-CNN according to claim 1, characterized in that: The specific process of step S4 is as follows: Each set of D-ROI and RGB-ROI is pooled to a fixed size using the ROI pooling layer.
6. The method for recognizing the posture of a lactating sow using RD Faster R-CNN according to claim 1, characterized in that: The specific process of step S5 is as follows: S51, further extracting features from the ROIs of fixed size through NOC; S52: Fusing the features of the depth image and the color image.
Citation Information
Patent Citations
Lactating sow posture recognition method based on improved Faster-R-CNN
CN108830144A
method for recognizing the posture of a lactating sow through double-flow RGB-D Faster R-CNN
CN109766856A
Sign language alphabet spelling recognition method based on convolutional neural network
CN115359562A
