Cow back identification method, system, device and readable storage medium

By combining one-time feature extraction and gating algorithm, the problems of large calculation and high resource consumption in traditional cattle back recognition methods are solved, and an efficient cattle back recognition process is realized.

CN117975502BActive Publication Date: 2024-12-17BOYUN CHUANZHI (BEIJING) TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410053366.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-01-12
Publication Date
2024-12-17
Estimated Expiration
2044-01-12

AI Technical Summary

Technical Problem

Traditional cattle back recognition methods require multiple image feature extractions during cattle back detection and identity recognition, resulting in large amounts of calculations and high resource consumption.

Method used

The feature image is obtained through one feature extraction, and only one identity recognition is performed after the cattle back detection. The attention mask matrix and channel intensity matrix are combined with the gating algorithm for integrity detection and pose correction, reducing feature extraction operations.

Benefits of technology

This reduces the calculation amount and resource consumption in the cattle back identification process, improves the recognition efficiency, and realizes identity recognition without repeated feature extraction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117975502B_ABST
    Figure CN117975502B_ABST
Patent Text Reader

Abstract

The present application discloses a method, system, device and readable storage medium for identifying a cow's back, and relates to the field of biometric identification technology. The method for identifying a cow's back includes: obtaining an input original image, performing feature extraction on the original image to obtain a feature image; performing cow's back detection based on the feature image to obtain a cow's back detection result; performing identity recognition based on the cow's back detection result and the feature image to obtain an identity recognition result, and outputting the identity recognition result. The present application reduces the amount of recognition calculation for identifying a cow's identity based on its back, and reduces resource consumption.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of biometric identification technology, and in particular to a cow back identification method, system, device and readable storage medium. Background Art

[0002] In large-scale cattle farms, the key to achieving individualized, automated, and information-based daily refined management, tracking the health status of each cow and the traceability of milk and meat products lies in the identification of individual cows.

[0003] Traditional cattle individual identification can be done by physically marking a part of the body or embedding a microchip, and using radio frequency ID to distinguish cattle individuals. However, this method cannot prevent fraud, including copying tags and stealing equipment, and can also cause harm to the cattle themselves, so the use of AI (Artificial Intelligence) algorithms for individual identification has begun to emerge.

[0004] By training algorithms and models, computers can learn and recognize different cows from a large amount of cow back image data to achieve cow identity recognition. For identity recognition based on the cow's back, it is necessary to first perform cow back detection to locate the position of the cow's back in the image. For identity recognition based on the cow's back, identity recognition usually undergoes integrity detection (such as detecting whether the cow's back is complete) and posture correction (such as correcting the posture of the cow's back) before performing feature recognition to obtain an identity recognition result. However, this identity recognition method requires feature extraction of the original image to locate the cow's back during cow back detection. In subsequent identity recognition, it is also necessary to re-extract features from the image of the identified cow's back area to perform identity recognition based on the extracted features. For example, feature extraction needs to be performed again during integrity detection and posture correction, which will result in multiple feature extractions on the image, resulting in a large amount of computational complexity and high resource consumption for identity recognition.

[0005] The preceding description is intended to provide general background information and does not necessarily constitute prior art. Summary of the invention

[0006] The main purpose of this application is to provide a cattle back identification method, device and computer-readable storage medium, aiming to solve the technical problem of how to reduce the identification calculation amount of cattle identity identification based on the cattle back and reduce resource consumption.

[0007] To achieve the above object, the present application provides a method for identifying a cow's back, the method comprising the following steps:

[0008] Acquire an input original image, perform feature extraction on the original image, and obtain a feature image;

[0009] Performing cow back detection based on the feature image to obtain a cow back detection result;

[0010] Based on the cow back detection result and the characteristic image, identity recognition is performed to obtain an identity recognition result, and the identity recognition result is output.

[0011] Optionally, the step of performing identity recognition based on the cow back detection result and the feature image, the method further includes:

[0012] Obtain a cow back matrix corresponding to the cow back detection result, wherein the cow back matrix includes an attention mask matrix and a channel strength matrix;

[0013] Inputting the bull back detection result and the bull back matrix into a preset threshold gating algorithm, and outputting a first gating result;

[0014] Identity recognition is performed based on the first gating result and the feature image.

[0015] Optionally, the step of performing identity recognition based on the first gating result and the feature image includes:

[0016] Performing integrity detection based on the first gating result and the feature image to obtain an integrity detection result;

[0017] Performing posture correction based on the integrity detection result and the feature image to obtain a posture correction result;

[0018] Identity recognition is performed based on the posture correction result and the feature image.

[0019] Optionally, the step of performing posture correction based on the integrity detection result and the feature image, the method further includes:

[0020] Obtaining an integrity matrix corresponding to the integrity detection result, wherein the integrity matrix includes an attention mask matrix and a channel strength matrix;

[0021] Inputting the integrity detection result and the integrity matrix into a preset XOR gating algorithm, and outputting a second gating result;

[0022] Perform posture correction based on the second gating result and the feature image.

[0023] Optionally, the step of performing identity recognition based on the posture correction result and the feature image includes:

[0024] Obtaining a posture correction matrix corresponding to the posture correction result, wherein the posture correction matrix includes an attention mask matrix and a channel strength matrix;

[0025] Inputting the posture correction result and the posture correction matrix into a preset posture gating algorithm, and outputting a third gating result;

[0026] Identity recognition is performed based on the third gating result and the feature image.

[0027] Optionally, the step of extracting features from the original image to obtain a feature image includes:

[0028] The original image is input into a preset feature extraction network model, and a feature image is output.

[0029] Optionally, the feature extraction network model includes one or more of a feature conversion model, a long-range attention model, and a guided random dropout model;

[0030] Wherein, the guided random dropout model is used to perform image enhancement processing on the image;

[0031] The feature conversion model is used to extract the original features in the image through the convolution layer, generate the perturbed features through the channel perturbation after fusing the similar features of the image through channel compression, and splice the original features and the perturbed features;

[0032] The long-range attention model is used to establish correlations between features corresponding to different image regions.

[0033] In addition, to achieve the above purpose, the present application also provides a cattle back identification system, the cattle back identification system comprising:

[0034] The feature extraction module is used to obtain an input original image, perform feature extraction on the original image, and obtain a feature image;

[0035] A cow back detection module, used to perform cow back detection based on the feature image to obtain a cow back detection result;

[0036] The identity recognition module is used to perform cattle identity recognition based on the cattle back detection result and the characteristic image, obtain an identity recognition result, and output the identity recognition result.

[0037] In addition, to achieve the above-mentioned purpose, the present application also provides a cow back identification device, including: a memory, a processor, and a cow back identification program stored on the memory and executable on the processor, wherein the cow back identification program implements the steps of the cow back identification method as described above when executed by the processor.

[0038] In addition, to achieve the above-mentioned purpose, the present application also provides a computer-readable storage medium, on which a cow back identification program is stored. When the cow back identification program is executed by a processor, the steps of the cow back identification method as described above are implemented.

[0039] In the present application, an input original image is obtained, and a feature extraction is performed on the original image to obtain a feature image; a cow back detection is performed based on the feature image to obtain a cow back detection result; identity recognition is performed based on the cow back detection result and the feature image to obtain an identity recognition result, and the identity recognition result is output. In this way, compared with the identity recognition method of extracting image features multiple times, in the embodiment of the present application, feature extraction is performed on the input original image to obtain a feature image with extracted features, a cow back detection is performed based on the feature image, and when the cow back detection finds that there is a cow back in the image, identity recognition is performed based on the feature image extracted before the cow back detection, so that during identity recognition, there is no need to perform image feature extraction operations, and only one image feature extraction operation needs to be performed in the entire cow back-based identity recognition process, thereby reducing the recognition calculation amount of cattle identity recognition based on the cow back and reducing resource consumption. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings.

[0041] Figure 1 It is a schematic diagram of the terminal\system structure of the hardware operating environment involved in the embodiment of the present application;

[0042] Figure 2 This is a flow chart of the first embodiment of the cow back identification method of the present application;

[0043] Figure 3 This is a schematic diagram of the overall network structure of the cow back identification method of this application;

[0044] Figure 4 This is a schematic diagram of the entire cycle of cow back identification in the cow back identification method of this application;

[0045] Figure 5 This is a schematic diagram of the implementation process of the guided random dropout model of the cow back identification method of this application;

[0046] Figure 6 This is a schematic diagram of the implementation flow of the feature conversion model of the cow back identification method of this application;

[0047] Figure 7 This is a schematic diagram of the implementation process of the long-range attention model of the cow back recognition method of this application;

[0048] Figure 8 This is a schematic diagram of the system structure of the cattle back identification system of this application. DETAILED DESCRIPTION

[0049] It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0050] Reference Figure 1 , Figure 1 This is a schematic diagram of the structure of a cow back identification device in the hardware operating environment involved in the embodiment of the present application.

[0051] like Figure 1 As shown, the cow back identification device may include: a processor 1001, such as a central processing unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a wireless fidelity (WIreless-FIdelity, WI-FI) interface). The memory 1005 may be a high-speed random access memory (Random Access Memory, RAM) memory, or a stable non-volatile memory (Non-Volatile Memory, NVM), such as a disk memory. The memory 1005 may also be a storage system independent of the aforementioned processor 1001.

[0052] Those skilled in the art will understand that Figure 1 The structure shown in the figure does not constitute a limitation on the cattle back identification device, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.

[0053] like Figure 1 As shown, the memory 1005 as a computer-readable storage medium may include an operating system, a data storage module, a network communication module, a user interface module and a cow back recognition program.

[0054] exist Figure 1 In the cow's back identification device shown, the network interface 1004 is mainly used for data communication with other devices; the user interface 1003 is mainly used for data interaction with the user; the processor 1001 and the memory 1005 in the cow's back identification device of the present application can be set in the cow's back identification device, and the cow's back identification device calls the cow's back identification program stored in the memory 1005 through the processor 1001, and executes the cow's back identification method provided in the embodiment of the present application.

[0055] Please refer to Figure 2 , Figure 2This is a flowchart of the first embodiment of the cow back identification method of the present application. It should be noted that although the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than here.

[0056] In this embodiment, the cow back identification method of the present application is applied to the above-mentioned terminal device. It should be understood that based on different design requirements of actual applications, in different feasible implementation methods, the cow back identification method of the present application can of course be specifically applied to other terminal devices.

[0057] In this embodiment, if Figure 2 As shown, the cow back identification method comprises the following steps:

[0058] Step S10, obtaining an input original image, performing feature extraction on the original image, and obtaining a feature image;

[0059] The original image may be an image input by a user, which is used to identify the identity of the cattle contained in the image based on the original image, or it may be an original image captured by a camera, and the image captured by the camera is used as the input original image. It can be understood that the original image may be one or more images. If there are multiple original images, the cow back recognition method in this embodiment can be used for each original image to identify the identity of the cattle contained in the original image. Furthermore, if there are multiple original images, the input original images can also be preprocessed, such as unifying the size of the original images, unifying the image format, etc. For example, each original image can be scaled to 416*416 and unified into .jpg format images to facilitate subsequent processing steps. Feature extraction is performed on the original image after preprocessing.

[0060] Existing deep learning methods and feature extraction algorithms can be used to extract features from the original image to obtain a feature image. The proposed features include but are not limited to key texture, spot, shape and other image features.

[0061] Step S20, performing cow back detection based on the feature image to obtain a cow back detection result;

[0062] The feature image can be input into a preset cow back detection model, and the cow back detection result can be output. Specifically, the preset cow back detection model can use known computer vision technology and image processing algorithms, such as target detection algorithms, image segmentation algorithms, etc., to locate and extract the cow back area in the feature image or video to obtain the cow back detection result, that is, the cow back detection result includes the area where the cow back is located.

[0063] Step S30, performing identity recognition based on the cow back detection result and the feature image to obtain an identity recognition result, and outputting the identity recognition result.

[0064] In a possible implementation manner, the step of performing identity recognition based on the cow back detection result and the feature image, the method further includes:

[0065] Step S301, obtaining a cow back matrix corresponding to the cow back detection result, wherein the cow back matrix includes an attention mask matrix and a channel strength matrix;

[0066] The attention generation algorithm can be used to generate an attention mask corresponding to the feature object based on the features of the cow's back area, and obtain an attention mask matrix to indicate the important areas in the feature image. For example, the attention mask of the cow's back area is set to 1, and the attention masks of other areas are set to 0, thereby indicating that the area with the attention mask of 1 in the feature image is the important area, that is, the cow's back area is the important area.

[0067] The intensity of each channel in the feature image is calculated to obtain a channel intensity matrix, which is used to measure the importance of the channel for cattle identification.

[0068] Step S302, inputting the bull's back detection result and the bull's back matrix into a preset threshold gating algorithm, and outputting a first gating result;

[0069] The preset threshold gating algorithm can be specifically X1*(TOP k (Softmax(Att)*C s )>th), where X1 is the result of the cow back test, TOP k represents the first k maximum values, k is the preset value, Att represents the attention mask matrix, C s Represents the channel strength matrix, th is the preset threshold, TOP k (Sofmax(Att)*C s ) are greater than the preset threshold, the result is 1, and the first gated result output is the bull back detection result X1, TOP k (Sofmax(Att)*C s ) is less than or equal to the preset threshold, the result is 0, and the output first gating result is also zero.

[0070] Step S303: performing identity recognition based on the first gating result and the feature image.

[0071] In a possible implementation, the step of performing identity recognition based on the first gating result and the feature image includes:

[0072] Step S304, performing integrity detection based on the first gating result and the feature image to obtain an integrity detection result;

[0073] The feature image and the input first gated result can be input into a preset integrity recognition model, and the output is a complete phase detection result. Specifically, the preset integrity recognition model can use known image analysis and pattern recognition algorithms, such as feature extraction, target detection, and machine learning algorithms, to detect and recognize the feature image of the back area of ​​the cow to determine whether the cow back in the picture is complete. This module is used to detect the cow's tail, head, and body, and exclude any existing occlusion.

[0074] Then, it can be understood that when the first gating result is zero, no processing is actually required in the subsequent identity recognition process, that is, direct empty processing.

[0075] Step S305, performing posture correction based on the integrity detection result and the feature image to obtain a posture correction result;

[0076] The feature image and the integrity detection result can be input into a preset feature point correction model, and the posture correction result can be output.

[0077] In a possible implementation manner, the step of performing posture correction based on the integrity detection result and the feature image, the method further includes:

[0078] Step S3051, obtaining an integrity matrix corresponding to the integrity detection result, wherein the integrity matrix includes an attention mask matrix and a channel strength matrix;

[0079] It should be noted that the integrity matrix is ​​a matrix output by the integrity recognition model, and the attention mask matrix and channel strength matrix included in it are independent of each other from the attention mask matrix and channel strength matrix included in the cowback matrix.

[0080] Step S3052, inputting the integrity detection result and the integrity matrix into a preset XOR gating algorithm, and outputting a second gating result;

[0081] The preset XOR gating algorithm can be specifically X2*XOR(Sigmoid(Softmax(Att)*C s )), where X2 is the integrity detection result, Sigmoid represents the activation function, Att is the attention mask matrix, and C s Represents the channel intensity matrix, XOR is an exclusive OR operation, the result of the exclusive OR operation is 1 or 0, XOR(Sigmoid(Softmax(Att)*C s )) When the result is 1, the second gating result output is the integrity detection result X2, XOR(Sigmoid(Softmax(Att)*C s ))When the result is 0, the output second gated result is also zero.

[0082] Then, it can be understood that when the second gating result is zero, no processing is actually required in the subsequent identity recognition process, that is, direct empty processing.

[0083] Step S3053: Perform posture correction based on the second gating result and the feature image.

[0084] In this embodiment, the feature image and the second gated result are input into a preset feature point correction model to perform posture correction, and the posture correction result is output. Specifically, the preset feature point correction model can use a known three-dimensional posture estimation algorithm and an image processing algorithm to analyze key feature points on the back of the cow, such as the spine line or key bone points, to correct the posture of the back and adjust it to a standard posture feature, so as to correct the posture feature of the cow's back and ensure accurate recognition of subsequent models.

[0085] Step S306: performing identity recognition based on the posture correction result and the feature image.

[0086] The feature image and the posture correction result can be input into a preset recognition model, and the identity recognition result can be output.

[0087] In a possible implementation, the step of performing identity recognition based on the posture correction result and the feature image includes:

[0088] Step S3061, obtaining a posture correction matrix corresponding to the posture correction result, wherein the posture correction matrix includes an attention mask matrix and a channel strength matrix;

[0089] It should be noted that the posture correction matrix is ​​the matrix output by the feature point correction model, and the attention mask matrix and channel strength matrix included in it are independent of each other, and the attention mask matrix and channel strength matrix included in the cowback matrix are independent of each other. That is, in each processing step, the attention mask matrix and the channel strength matrix are the matrices output by the corresponding model, and are independent of each other.

[0090] Step S3062, inputting the posture correction result and the posture correction matrix into a preset posture gating algorithm, and outputting a third gating result;

[0091] The preset attitude gating algorithm can be specifically X3*(∑ i∈keypoints TOP k (Sigmoid(Att i *C s(i)))=len(AlignIndexes)), where X3 is the posture correction result, Sigmoid represents the activation function, Att is the attention mask matrix, and C s Represents the channel strength matrix, TOP k represents the first k maximum values, k is the preset value, keypoints is the key feature point, i represents the i-th key feature point, AlignIndexes represents the key feature point index, len represents the length operation, ∑ i∈ keypoints TOP k (Sigmoid(Att i *C s When (i))) is equal to len(AlignIndexes), the result is 1, and the third gated result output is the posture correction result X3, ∑ i∈keypoints TOP k (Sigmoid(Att i *C s When (i))) is not equal to len(AlignIndexes), the result is 0 and the output third gated result is also zero.

[0092] Then, it can be understood that when the third gating result is zero, no processing is actually required in the subsequent identity recognition process, that is, direct empty processing.

[0093] Step S3063: Perform identity recognition based on the third gating result and the feature image.

[0094] In this embodiment, the feature image and the third gating result are input into a preset recognition model, and the identity recognition result is output. Specifically, the preset recognition model can use known deep learning and feature extraction algorithms, such as recognition algorithms based on convolutional neural networks (CNN) or other deep learning architectures, to extract specific parts of information from the corrected back features and perform high-dimensional feature encoding. Extract key information from the back features of the cattle, such as spot patterns, texture features, or shape features, and encode them into high-dimensional feature vectors. Based on the high-dimensional feature vectors, the identity recognition result is obtained. The identity recognition result includes but is not limited to the unique identity of the cattle, such as the breed, age, etc. of the cattle. In this embodiment,

[0095] It should be noted that when any of the first gated results, the second gated results, and the third gated results is zero, no processing is actually performed in the subsequent identity recognition process, that is, empty processing. The final actual processing effect can be understood as directly inputting the processing results and the feature image (cow back detection result, integrity detection result, or posture correction result) into the preset recognition model, outputting the identity recognition result, and marking the identity recognition result as a pseudo-identity recognition result for user reference. For example, when multiple original images are included, the corresponding original images marked as pseudo-identity recognition results are screened out for further processing by the user, such as the user correcting the identity recognition result based on the original image, etc.

[0096] In this embodiment, an input original image is obtained, and features are extracted from the original image to obtain a feature image; a cow back detection is performed based on the feature image to obtain a cow back detection result; identity recognition is performed based on the cow back detection result and the feature image to obtain an identity recognition result, and the identity recognition result is output. In this way, compared with the identity recognition method of extracting image features multiple times, in this embodiment, feature extraction is performed on the input original image to obtain a feature image with extracted features, and a cow back detection is performed based on the feature image. When a cow back is detected in the image, identity recognition is performed based on the feature image extracted before the cow back detection. Therefore, during identity recognition, there is no need to perform feature extraction operations on the image, and only one image feature extraction operation needs to be performed in the entire cow back-based identity recognition process, thereby reducing the recognition calculation amount of cattle identity recognition based on the cow back and reducing resource consumption.

[0097] Further, in order to help understand the technical concept or working principle of the present application, a specific embodiment is listed, referring to Figure 3-4 As shown, the cow back identification process in this specific embodiment is:

[0098] S1. Receive an input original image, such as a 416*416 original image.

[0099] S2. Based on the preset shared feature extraction network model, extract the features in the original image, output the feature image, and input the feature image output by the shared feature extraction network model into the cow back detection subnet, integrity subnet, posture correction subnet and recognition subnet.

[0100] S3. The cow back detection subnet is used to detect the cow back area in the image or video. This subnet uses computer vision, such as target detection or image segmentation algorithms, to locate and extract the cow back area in the input image or video. Specifically, a preset cow back detection model can be used to locate the cow back position in the feature image, and the cow back detection result is output. The cow back detection result is input into the preset threshold gating algorithm, and the gating result is output. Neurons are selectively activated or closed according to the preset threshold to control the flow of information in the network. The gating result is input into the integrity detection subnet. It should be noted that when the gating result is zero, the integrity detection subnet does not need to perform any processing, that is, empty processing ( Figure 3 In the actual processing flow of identity recognition, there is no need to judge whether the gating result is zero. The gating result flows directly to the integrity detection subnet. However, when the gating result is zero, no processing is required in the subsequent process. Therefore, Figure 3 The empty processing branch is shown in . There is no need to perform the calculation of whether the gating result is zero, which further reduces the amount of calculation. It can be understood that when the gating result is zero, the actual subsequent subnet does not need to perform any calculation, and the amount of calculation is zero, which greatly reduces the amount of calculation.

[0101] S4. The integrity subnet is used to judge the integrity of the cow's back area, that is, whether there are defects or damages on the cow's back. This subnet uses image processing, pattern recognition algorithms or deep learning models to analyze the characteristics of the cow's back area and judge its integrity status. For example, the integrity can be judged by comparing the cow's back area with a predefined complete cow's back template or by detecting missing or abnormal features. Specifically, a preset integrity recognition model can be used to perform integrity detection of the cow's back based on the input feature image and the cow's back detection result (actually the gating result of the previous gating output), and the integrity detection result is output. The integrity detection result is input into the preset XOR gating algorithm, and the gated result is output, and the gated result is input into the posture correction subnet. It should be noted that when the gating result is zero, the posture correction subnet does not need to perform any processing, that is, empty processing ( Figure 3 In the actual process of identity recognition, there is no need to judge whether the gated result is zero. The gated result flows directly to the posture correction subnet. However, when the gated result is zero, no processing is required in the subsequent process. Figure 3 An empty processing branch is shown in .

[0102] S5. The posture correction subnet is used to correct or estimate the posture of the cow. This subnet uses a computer vision algorithm or a deep learning model to analyze the shape, angle or posture information of the cow's back area, and perform corresponding corrections or estimates. For example, the key points or bone structure of the back can be detected, and then corrections or estimates can be performed according to a predefined standard posture to ensure the accuracy of subsequent recognition. Specifically, a preset feature point correction model can be used to perform a posture correction operation based on the feature image and the integrity detection result (actually the gated result of the previous gated output), and the posture correction result is output. The posture correction result is input into the preset posture gating algorithm, and the gated result is output, and the gated result is input into the recognition subnet. It should be noted that when the gated result is zero, the recognition subnet can directly perform identity recognition based on the feature image, obtain a pseudo-identity recognition result, and perform a pseudo-output, or the recognition subnet directly outputs the original image or feature image.

[0103] S6. The identification subnet is used to identify the identity of the cow. The subnet receives the cow back area extracted by the cow back detection subnet as input, and applies the identification algorithm to infer the identity of each cow. The identification algorithm may include feature extraction, feature matching or deep learning methods, which are used to compare and match the cow back area with the pre-stored cow identity information. Specifically, a preset recognition model can be used. When the output results of any of the cow back subnet, integrity subnet and posture correction subnet are valid, the identity of the cow is identified based on the feature image and the posture correction result (actually the gated result of the previous gated output), and the identity recognition result is output. When the output results of any of the cow back subnet, integrity subnet and posture correction subnet are invalid, a pseudo identity recognition result (i.e., pseudo output) is output through the identification subnet.

[0104] In this specific embodiment, the same feature extraction network is reused in different subnets to avoid repeated feature extraction processes and reduce the amount of computation. The intermediate processing results of each subnet are input and output by gate control. The gating algorithm uses extremely small computational effort to determine whether the output of the upper subnet is compliant and valid, thereby achieving multi-subnet end-to-end reasoning to improve the overall identity recognition processing speed. The overall running time does not exceed 16 milliseconds, and the recognition efficiency can reach 60fps.

[0105] It should be noted that the above specific embodiments are only used to understand the present application and do not constitute a limitation on the specific process of cow back identification in the present application. More simple transformations based on this technical concept are all within the scope of protection of the present application.

[0106] Further, based on the above-mentioned first embodiment of the present application, a second embodiment of the cow back identification method of the present application is proposed. In this embodiment, the step of extracting features from the original image to obtain a feature image includes:

[0107] Step A10, inputting the original image into a preset feature extraction network model, and outputting a feature image.

[0108] The preset feature extraction network can be a known image feature extraction network, such as a CNN network, etc. In this embodiment, preferably, a feature conversion model, a long-range attention model and a guided random inactivation model are constructed, referring to Figure 3 As shown in the figure, the constructed feature conversion model, long-term attention model and guided random inactivation model are embedded into the known feature extraction network to obtain the final feature extraction network model ( Figure 3 The shared feature extraction network shown in is used to improve the feature extraction effect of the existing feature extraction network.

[0109] In a possible implementation, the feature extraction network model includes one or more of a feature conversion model, a long-range attention model, and a guided random dropout model;

[0110] Wherein, the guided random dropout model is used to perform image enhancement processing on the image;

[0111] Reference Figure 5 As shown in the figure, the guided random dropout model (Guided Dropout Module) selects neurons with low activation intensity for training. Specifically, for the input image, the activation area is divided, neurons with higher than the average activation value are selected for discarding, and the mean (Mean) and variance (std) of the activation values ​​of all retained neurons are balanced so that their output satisfies the Gaussian distribution. By selecting neurons with low activation intensity for training, the overall model can effectively enhance the information of the prediction results, so that the model can adapt to some extreme conditions (such as camera blur and loss of RGB decoding channels due to network problems), improve the stability of the model, and then improve the stability of feature extraction.

[0112] The feature conversion model is used to extract the original features in the image through the convolution layer, generate the perturbed features through the channel perturbation after fusing the similar features of the image through channel compression, and splice the original features and the perturbed features;

[0113] The feature transformation model (Feat Transform Module) is used to perturb the feature map to generate more diverse features, and fuse similar features through channel compression to improve the learning ability of the network and reduce the computation of redundant features. Figure 6As shown, the feature conversion model includes a 3*3 convolution layer for feature extraction to obtain the extracted original features, a 1*1 convolution layer for channel compression to fuse similar features, and after channel compression, a perturbation feature is generated by channel perturbation, and the original feature and the perturbation feature are spliced ​​and output. In this embodiment, a more diverse feature representation is generated by perturbing the feature map to increase the robustness and learning ability of the network, and by fusing similar features and reducing the computation of redundant features, the expressiveness and computational efficiency of the features are improved.

[0114] The long-range attention model is used to establish correlations between features corresponding to different image regions.

[0115] The Long-Range Attention Module is used to establish long-range correlations between different features and expand the network's receptive field. This module captures long-range dependencies between features, enhances the perception of global context, and improves the distinction between cows. Figure 7 As shown in the figure, the long-range attention model divides the input image into multiple image patches, extracts features from each image patch, and compresses and embeds features through a fully connected layer to obtain the feature matrix E of all image patches. T A correlation matrix is ​​obtained, which includes the similarity between each image block and other image blocks, so that the top K image blocks with the highest correlation with each image block can be queried. In this embodiment, the long-range attention model can suggest the correlation between a certain feature and a long-distance feature, so that the network can perceive a wider field of view. The correlation between features can also make cattle with different identities more distinguishable, and have a larger angle in the cosine space feature.

[0116] In addition, the present application also provides a cattle back identification system, referring to Figure 8 , the cattle back identification system comprises:

[0117] The feature extraction module 10 is used to obtain an input original image, perform feature extraction on the original image, and obtain a feature image;

[0118] A cow back detection module 20, configured to perform cow back detection based on the feature image to obtain a cow back detection result;

[0119] The identity recognition module 30 is used to perform identity recognition based on the cow back detection result and the feature image, obtain an identity recognition result, and output the identity recognition result.

[0120] The identity recognition module 30 is also used for:

[0121] Obtain a cow back matrix corresponding to the cow back detection result, wherein the cow back matrix includes an attention mask matrix and a channel strength matrix;

[0122] Inputting the bull back detection result and the bull back matrix into a preset threshold gating algorithm, and outputting a first gating result;

[0123] Identity recognition is performed based on the first gating result and the feature image.

[0124] The identity recognition module 30 is further used to: perform integrity detection based on the first gating result and the feature image to obtain an integrity detection result;

[0125] Performing posture correction based on the integrity detection result and the feature image to obtain a posture correction result;

[0126] Identity recognition is performed based on the posture correction result and the feature image.

[0127] The identity recognition module 30 is also used for:

[0128] Obtaining an integrity matrix corresponding to the integrity detection result, wherein the integrity matrix includes an attention mask matrix and a channel strength matrix;

[0129] Inputting the integrity detection result and the integrity matrix into a preset XOR gating algorithm, and outputting a second gating result;

[0130] Perform posture correction based on the second gating result and the feature image.

[0131] The identity recognition module 30 is further used to: obtain a posture correction matrix corresponding to the posture correction result, wherein the posture correction matrix includes an attention mask matrix and a channel strength matrix;

[0132] Inputting the posture correction result and the posture correction matrix into a preset posture gating algorithm, and outputting a third gating result;

[0133] Identity recognition is performed based on the third gating result and the feature image.

[0134] The feature extraction module is further used for:

[0135] The original image is input into a preset feature extraction network model, and a feature image is output.

[0136] Optionally, the feature extraction network model includes one or more of a feature conversion model, a long-range attention model, and a guided random dropout model;

[0137] Wherein, the guided random dropout model is used to perform image enhancement processing on the image;

[0138] The feature conversion model is used to extract the original features in the image through the convolution layer, generate the perturbed features through the channel perturbation after fusing the similar features of the image through channel compression, and splice the original features and the perturbed features;

[0139] The long-range attention model is used to establish the correlation between the features corresponding to different image regions. The cow back recognition system provided by the present invention adopts the cow back recognition method in any embodiment. Compared with the prior art, the beneficial effects of the cow back recognition system provided by the embodiment of the present invention are the same as the beneficial effects of the cow back recognition method provided by the above embodiment, and the other technical features in the cow back recognition system are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.

[0140] In addition, to achieve the above-mentioned purpose, the present application also provides a computer-readable storage medium, on which a cow back identification program is stored. When the cow back identification program is executed by a processor, the steps of the cow back identification method as described above are implemented.

[0141] The specific implementation of the computer-readable storage medium of the present application is basically the same as the above-mentioned embodiments of the cow back identification method, and will not be repeated here.

[0142] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.

[0143] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0144] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a computer-readable storage medium (such as ROM / RAM, disk, CD) as described above, including a number of instructions for a terminal device (which can be a mobile phone, computer, cloud server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present application.

[0145] The above are only preferred embodiments of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. A method for identifying a cow's back, characterized in that: The cow back identification method comprises the following steps: Acquire an input original image, perform feature extraction on the original image, and obtain a feature image; Performing cow back detection based on the feature image to obtain a cow back detection result; Obtain a cow back matrix corresponding to the cow back detection result, wherein the cow back matrix includes an attention mask matrix and a channel strength matrix; The bull back detection result and the bull back matrix are input into a preset threshold gating algorithm, and a first gating result is output, wherein the preset threshold gating algorithm is , X1 is the result of the cow back test, TOP k represents the first k maximum values, k is the preset value, Att represents the attention mask matrix, C s represents the channel strength matrix, th is the preset threshold; Performing integrity detection based on the first gating result and the feature image to obtain an integrity detection result; Performing posture correction based on the integrity detection result and the feature image to obtain a posture correction result; Performing integrity detection based on the first gating result and the feature image to obtain an integrity detection result; Obtaining an integrity matrix corresponding to the integrity detection result, wherein the integrity matrix includes an attention mask matrix and a channel strength matrix; The integrity detection result and the integrity matrix are input into a preset XOR gating algorithm, and a second gating result is output, wherein the preset XOR gating algorithm is , X2 is the integrity detection result, Sigmoid represents the activation function, Att is the attention mask matrix, C s Represents the channel strength matrix, XOR is the exclusive OR operation; Performing posture correction based on the second gating result and the feature image to obtain a posture correction result; Obtaining a posture correction matrix corresponding to the posture correction result, wherein the posture correction matrix includes an attention mask matrix and a channel strength matrix; The posture correction result and the posture correction matrix are input into a preset posture gating algorithm, and a third gating result is output, wherein the preset posture gating algorithm is: , X3 is the posture correction result, Sigmoid represents the activation function, Att is the attention mask matrix, C s Represents the channel strength matrix, TOP k Indicates the first k maximum values, k is the preset value, keypoints is the key feature point, i is the i-th key feature point, AlignIndexes is the key feature point index, and len is the length operation; Perform identity recognition based on the third gating result and the feature image to obtain an identity recognition result, and output the identity recognition result.

2. The method for identifying a cow's back as claimed in claim 1, characterized in that: The step of extracting features from the original image to obtain a feature image comprises: The original image is input into a preset feature extraction network model, and a feature image is output.

3. The method for identifying the back of a cow as claimed in claim 2, characterized in that: The feature extraction network model includes one or more of a feature conversion model, a long-range attention model, and a guided random dropout model; Wherein, the guided random dropout model is used to perform image enhancement processing on the image; The feature conversion model is used to extract the original features in the image through the convolution layer, generate the perturbed features through the channel perturbation after fusing the similar features of the image through channel compression, and splice the original features and the perturbed features; The long-range attention model is used to establish correlations between features corresponding to different image regions.

4. A cattle back identification system, characterized in that: The cattle back identification system comprises: The feature extraction module is used to obtain an input original image, perform feature extraction on the original image, and obtain a feature image; A cow back detection module, used for performing cow back detection based on the feature image to obtain a cow back detection result; An identity recognition module, used to obtain a cow back matrix corresponding to the cow back detection result, wherein the cow back matrix includes an attention mask matrix and a channel strength matrix; The bull back detection result and the bull back matrix are input into a preset threshold gating algorithm, and a first gating result is output, wherein the preset threshold gating algorithm is , X1 is the result of the cow back test, TOP k represents the first k maximum values, k is the preset value, Att represents the attention mask matrix, C s represents the channel strength matrix, th is the preset threshold; Performing integrity detection based on the first gating result and the feature image to obtain an integrity detection result; Performing posture correction based on the integrity detection result and the feature image to obtain a posture correction result; Performing integrity detection based on the first gating result and the feature image to obtain an integrity detection result; Obtaining an integrity matrix corresponding to the integrity detection result, wherein the integrity matrix includes an attention mask matrix and a channel strength matrix; The integrity detection result and the integrity matrix are input into a preset XOR gating algorithm, and a second gating result is output, wherein the preset XOR gating algorithm is , X2 is the integrity detection result, Sigmoid represents the activation function, Att is the attention mask matrix, C s Represents the channel strength matrix, XOR is the exclusive OR operation; Performing posture correction based on the second gating result and the feature image to obtain a posture correction result; Obtaining a posture correction matrix corresponding to the posture correction result, wherein the posture correction matrix includes an attention mask matrix and a channel strength matrix; The posture correction result and the posture correction matrix are input into a preset posture gating algorithm, and a third gating result is output, wherein the preset posture gating algorithm is: , X3 is the posture correction result, Sigmoid represents the activation function, Att is the attention mask matrix, C s Represents the channel strength matrix, TOP k Indicates the first k maximum values, k is the preset value, keypoints is the key feature point, i is the i-th key feature point, AlignIndexes is the key feature point index, and len is the length operation; Perform identity recognition based on the third gating result and the feature image to obtain an identity recognition result, and output the identity recognition result.

5. A cattle back identification device, characterized in that: The cattle back identification device comprises: a memory, a processor and a cattle back identification program stored in the memory and executable on the processor. When the cattle back identification program is executed by the processor, the steps of the cattle back identification method according to any one of claims 1 to 3 are implemented.

6. A readable storage medium, characterized in that: The readable storage medium comprises a computer-readable storage medium, on which a cattle back identification program is stored. When the cattle back identification program is executed by a processor, the steps of the cattle back identification method according to any one of claims 1 to 3 are implemented.

Citation Information

Patent Citations

  • Mass invoice identification method and system, and storage medium

    CN113920294A

  • Method for judging health condition of dairy cow through dairy cow behavior recognition based on video skeleton

    CN116543462A