Cattle face detection method and device, electronic equipment and storage medium
Through transfer learning technology, the features of the heat map teacher model are transferred to the cattle face key point detection model, solving the problem of low detection accuracy caused by the small scale of the regression model, and achieving high-precision cattle face detection under small-scale models.
Patent Information
- Application Number
- CN202410996582.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-23
- Publication Date
- 2024-12-13
- Estimated Expiration
- 2044-07-23
AI Technical Summary
Among the existing methods for detecting key points of cow faces, the small scale of the regression model leads to low detection accuracy, making it difficult to achieve high-precision cow face detection.
By obtaining the pre-labeled original cow face marking image, the cow face heat map model is trained to obtain the heat map teacher model, and the reference cow face image is used to mark the key points, and the target cow face marking image is generated, and the heat map teacher is then used to mark the heat map image. The features of the model are transferred to the key point detection model, forming a key point detection student model, and transfer learning is carried out to improve detection accuracy.
When the model scale is small, the student model of key point detection can have high-precision detection accuracy, which improves the accuracy of cow face detection and is suitable for cow face recognition in insured claims scenarios such as dairy insurance.
Smart Images

Figure CN119131832A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the fields of financial technology and artificial intelligence technology, and in particular to a cow face detection method and device, electronic equipment and storage medium. Background Art
[0002] In insurance claims scenarios in the financial field, it is usually necessary to process relevant claims data. For example, in insurance claims scenarios for cows, it is usually necessary to perform key point detection on the cow's face (such as detecting feature points such as the eyes, nose, ears, and contours of the cow's face) to achieve recognition of the cow's face.
[0003] At present, the common method for detecting key points of cow faces is to use regression models to perform key point detection on cow face images. However, when using regression models to perform key point detection on cow face images, the scale of the regression model is small, resulting in low accuracy of cow face detection. Therefore, how to improve the accuracy of cow face detection has become a technical problem that needs to be solved urgently. Summary of the invention
[0004] The main purpose of the embodiments of the present application is to propose a cow face detection method and device, an electronic device and a storage medium, aiming to improve the accuracy of cow face detection.
[0005] To achieve the above objective, a first aspect of an embodiment of the present application proposes a cow face detection method, the method comprising:
[0006] Acquire an original cow face labeled image, wherein the original cow face labeled image is a labeled image pre-labeled with cow face key points;
[0007] Training a preset cow face heat map model based on the original cow face labeled image to obtain a heat map teacher model;
[0008] Based on the heat map teacher model, key points of a preset reference cow face image are marked to obtain a target cow face marked image, wherein the reference cow face image is a non-annotated image;
[0009] Based on the original cow face labeled image, the target cow face labeled image and the heat map teacher model, transfer learning is performed on a preset key point detection model to obtain a key point detection student model;
[0010] The key point detection student model is used to perform key point detection on the target cow face image.
[0011] In some embodiments, the key point detection model includes a key point coordinate detection branch model and a key point confidence detection branch model, and the key point detection student model is obtained by performing transfer learning on the preset key point detection model based on the original cow face labeled image, the target cow face labeled image and the heat map teacher model, including:
[0012] Merging the original cow face labeled image and the target cow face labeled image to obtain a cow face training image;
[0013] Obtaining a teacher model key point feature of the heat map teacher model, wherein the teacher model key point feature is used to characterize the key point feature of the cow face training image extracted by the heat map teacher model;
[0014] Using the key point detection model to extract key point features of the cow face training image, and obtaining key point features of the student model;
[0015] Based on the key point coordinate detection branch model, the coordinates of the key point features are estimated to obtain the key point estimated coordinates;
[0016] Based on the key point confidence detection branch model, the confidence of the key point feature is estimated to obtain the key point estimation confidence;
[0017] Based on the key point features of the teacher model, the key point features of the student model, the cow face training image, the key point estimated coordinates and the key point estimated confidence, calculating the overall loss data of the key point detection model;
[0018] Based on the overall loss data, the key point detection model is adjusted in parameters to obtain the key point detection student model.
[0019] In some embodiments, the cow face training image includes the cow face key point coordinates and the cow face key point confidence, and the calculating the overall loss data of the key point detection model based on the teacher model key point features, the student model key point features, the cow face training image, the key point estimated coordinates and the key point estimated confidence includes:
[0020] Based on the key point features of the student model and the key point features of the teacher model, calculating the key point feature loss data of the key point detection model;
[0021] Based on the key point coordinates of the cow face and the estimated key point coordinates, calculating the key point position loss data of the key point detection model;
[0022] Based on the confidence of the key points of the cow face and the estimated confidence of the key points, calculating the key point confidence loss data of the key point detection model;
[0023] The key point feature loss data, the key point position loss data and the key point confidence loss data are combined to obtain the overall loss data.
[0024] In some embodiments, the calculating the key point feature loss data of the key point detection model based on the key point features of the student model and the key point features of the teacher model includes:
[0025] Obtaining the feature quantity of the key point features of the student model;
[0026] Performing a logarithmic operation on the key point features of the student model to obtain a logarithmic value of the student features;
[0027] Performing a logarithmic operation on the key point features of the teacher model to obtain a logarithmic value of the teacher feature;
[0028] Calculate the difference between the teacher's characteristic logarithm value and the student's characteristic logarithm value to obtain the characteristic logarithm difference;
[0029] Performing product processing on the characteristic logarithm difference and the teacher characteristic logarithm value to obtain a characteristic product value;
[0030] The average value of the feature product values is calculated based on the number of features to obtain the key point feature loss data.
[0031] In some embodiments, the calculating the key point position loss data of the key point detection model based on the key point coordinates of the cow face and the estimated key point coordinates includes:
[0032] Determining the number of key points of the target cow face image based on the estimated coordinates of the key points;
[0033] Calculate the absolute difference between the coordinates of the key points of the cow face and the estimated coordinates of the key points to obtain the coordinate difference;
[0034] If the coordinate difference is less than the preset coordinate difference, the coordinate difference is squared to obtain the square of the difference, and the square of the difference is merged based on the number of key points to obtain the key point position loss data;
[0035] If the coordinate difference is greater than or equal to the preset coordinate difference, the difference between the coordinate difference and the preset target value is calculated to obtain the target difference, and the target difference is merged based on the number of key points to obtain the key point position loss data.
[0036] In some embodiments, the heat map teacher model includes a feature extraction layer and an activation function layer, and the key point marking of a preset reference cow face image based on the heat map teacher model to obtain a target cow face marked image includes:
[0037] Using the feature extraction layer to extract features from the reference cow face image to obtain cow face key points;
[0038] Calculate the key point confidence of the key points of the cow face based on the activation function layer;
[0039] Filtering target key points from the cow face key points based on the key point confidence;
[0040] The reference cow face image is marked based on the target key points to obtain the target cow face marked image.
[0041] In some embodiments, the cow face key point marked image includes cow face image data and key point marked data, the cow face heat map model includes a convolution pooling layer and a fully connected layer, and the preset cow face heat map model is trained based on the cow face key point marked image to obtain a heat map teacher model, including:
[0042] Performing feature extraction on the cow face image data based on the convolution pooling layer to obtain a cow face feature image, wherein the cow face feature image includes cow face feature pixels;
[0043] Calculating the confidence of the cow face feature pixel points based on the fully connected layer to obtain the confidence of the cow face feature points;
[0044] Filter out target key feature points whose confidence level of the cow face feature points is greater than a preset confidence level from the cow face feature pixel points;
[0045] Based on the target key feature points and the key point marking data, calculating the key point loss data of the cow face heat map model;
[0046] The parameters of the cow face heat map model are adjusted based on the key point loss data to obtain the heat map teacher model.
[0047] To achieve the above-mentioned purpose, a second aspect of an embodiment of the present application proposes a cow face detection device, the device comprising:
[0048] A cow face image acquisition module, used to acquire an original cow face marked image, wherein the original cow face marked image is a marked image pre-marked with cow face key points;
[0049] A teacher model generation module, used for training a preset cow face heat map model based on the original cow face labeled image to obtain a heat map teacher model;
[0050] A cow face image marking module, used for marking key points of a preset reference cow face image based on the heat map teacher model to obtain a target cow face marked image, wherein the reference cow face image is a non-annotated image;
[0051] A student model generation module, used to perform transfer learning on a preset key point detection model based on the original cow face labeled image, the target cow face labeled image and the heat map teacher model to obtain a key point detection student model;
[0052] The cow face key point detection module is used to perform key point detection on the target cow face image using the key point detection student model.
[0053] To achieve the above objectives, a third aspect of an embodiment of the present application proposes an electronic device, which includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the method described in the first aspect is implemented.
[0054] To achieve the above-mentioned purpose, the fourth aspect of an embodiment of the present application proposes a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method described in the first aspect is implemented.
[0055] The cow face detection method and device, electronic device and storage medium proposed in the present application train a preset cow face heat map model by using an original cow face labeled image with cow face key points in advance to obtain a heat map teacher model, thereby improving the accuracy of the heat map teacher model and the accuracy of cow face detection. Furthermore, based on the original cow face labeled image and the target cow face labeled image, the features of the heat map teacher model are transferred to a pre-constructed key point detection model to obtain a key point detection student model, so that the key point detection student model can still have a high-precision detection accuracy rate when the model scale is small, thereby improving the accuracy of the key point detection model for cow face detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] Figure 1 is a flow chart of a cow face detection method provided by an embodiment of the present application;
[0057] Figure 2 yes Figure 1 Flow chart of step S102 in FIG.
[0058] Figure 3 yes Figure 1 Flow chart of step S103 in FIG.
[0059] Figure 4 yes Figure 1 Flow chart of step S104 in FIG.
[0060] Figure 5 yes Figure 4 Flow chart of step S406 in FIG.
[0061] Figure 6 yes Figure 5Flow chart of step S501 in FIG.
[0062] Figure 7 yes Figure 5 Flow chart of step S502 in FIG.
[0063] Figure 8 is a schematic diagram of the structure of a cow face detection device provided in an embodiment of the present application;
[0064] Fig. 9 It is a schematic diagram of the hardware structure of the electronic device provided in the embodiment of the present application. DETAILED DESCRIPTION
[0065] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. 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.
[0066] It should be noted that, although the functional modules are divided in the device schematic diagram and the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart. The terms "first", "second", etc. in the specification, claims and the above drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0067] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0068] First, some nouns involved in this application are analyzed:
[0069] Transfer learning: Transfer learning is a machine learning method that aims to apply knowledge and experience learned from one task to another related task. In transfer learning, the model learns from one domain (called the source domain) and applies this knowledge to improve learning performance in another domain (called the target domain). This method uses source domain data to help learn in the target domain, especially when data in the target domain is scarce or expensive. Through transfer learning, the learning speed of new tasks can be accelerated, performance can be improved, and training data requirements can be reduced. Transfer learning includes a variety of techniques and methods, such as feature extraction, domain adaptation, and transfer models, to help models better handle data in new domains. This makes transfer learning widely used in fields such as speech recognition, image recognition, and natural language processing.
[0070] Graph Convolutional Neural Network: Graph Convolutional Network (GCN) is a deep learning model for processing graph structured data. Unlike traditional convolutional neural networks (CNNs) that process regularized grid data (such as images), graph convolutional neural networks are specifically designed to process node and edge relationships in graph data. In a graph convolutional neural network, each node represents an entity in the graph, and each edge represents the relationship between nodes. Graph convolutional neural networks perform feature extraction and representation learning of graph data by learning the neighborhood information between nodes. By performing local connection and aggregation operations on the graph structure, graph convolutional neural networks can effectively capture local structures and global features in graph data.
[0071] In insurance claims scenarios in the financial field, it is usually necessary to process relevant claims data. For example, in insurance claims scenarios for cows, it is usually necessary to perform key point detection on the cow's face (such as detecting feature points such as the eyes, nose, ears, and contours of the cow's face) to achieve recognition of the cow's face.
[0072] At present, the common method for detecting key points of cow faces is to use regression models to perform key point detection on cow face images. However, when using regression models to perform key point detection on cow face images, the scale of the regression model is small, resulting in low accuracy of cow face detection. Therefore, how to improve the accuracy of cow face detection has become a technical problem that needs to be solved urgently.
[0073] Based on this, the embodiments of the present application provide a cow face detection method and device, an electronic device and a storage medium, aiming to improve the accuracy of cow face detection.
[0074] The cow face detection method and device, electronic device and storage medium provided in the embodiments of the present application are specifically illustrated through the following embodiments. First, the cow face detection method in the embodiments of the present application is described.
[0075] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Artificial Intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
[0076] AI basic technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics, etc. AI software technologies mainly include computer vision technology, robotics technology, biometrics technology, speech processing technology, natural language processing technology, and machine learning / deep learning.
[0077] The cow face detection method provided in the embodiment of the present application relates to the fields of financial technology and artificial intelligence technology. The cow face detection method provided in the embodiment of the present application can be applied to a terminal, can be applied to a server side, or can be software running in a terminal or a server side. In some embodiments, the terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, etc.; the server side can be configured as an independent physical server, or can be configured as a server cluster or a distributed system composed of multiple physical servers, or can be configured as a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms; the software can be an application that implements the cow face detection method, etc., but is not limited to the above forms.
[0078] The present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.
[0079] Figure 1 is an optional flowchart of the cow face detection method provided in the embodiment of the present application. Figure 1 The method may include but is not limited to steps S101 to S105.
[0080] Step S101, obtaining an original cow face labeled image, wherein the original cow face labeled image is a labeled image pre-labeled with cow face key points;
[0081] Step S102, training a preset cow face heat map model based on the original cow face labeled image to obtain a heat map teacher model;
[0082] Step S103, marking key points of a preset reference cow face image based on the heat map teacher model to obtain a target cow face marked image, wherein the reference cow face image is a non-annotated image;
[0083] Step S104, based on the original cow face labeled image, the target cow face labeled image and the heat map teacher model, transfer learning is performed on the preset key point detection model to obtain a key point detection student model;
[0084] Step S105, using the key point detection student model to perform key point detection on the target cow face image.
[0085] Steps S101 to S105 shown in the embodiment of the present application are to obtain the original cow face marked image by searching for the marked image with cow face key points in advance, and use the obtained original cow face marked image to train the pre-built cow face heat map model to obtain the heat map teacher model. Secondly, use the heat map teacher model to mark the key points of the reference cow face image without marked cow face key points to obtain the target cow face marked image. Then, based on the target cow face marked image and the original cow face marked image, the features in the heat map teacher model are transferred to the pre-built key point detection model to obtain the key point detection student model. Finally, use the key point detection student model to perform key point detection on the target cow face image that needs to be detected. Therefore, the present application obtains a heat map teacher model by training a preset cow face heat map model using an original cow face labeled image with cow face key points in advance, thereby improving the accuracy of the heat map teacher model and the accuracy of cow face detection. Furthermore, based on the original cow face labeled image and the target cow face labeled image, the features of the heat map teacher model are transferred to a pre-built key point detection model to obtain a key point detection student model, so that the key point detection student model can still have a high-precision detection accuracy rate when the model scale is small, thereby improving the accuracy of the key point detection model for cow face detection.
[0086] In one application scenario, taking the insurance claim of dairy cows as an example, the prior art usually only uses a small-scale regression model to detect the cow's face. Although the detection speed is fast, the accuracy is not high, and detection errors are prone to occur, resulting in errors in the insurance claim of dairy cows. The present application can use the original cow face labeled images that are pre-labeled with key points such as cow ears, cow eyes, and cow face contours to train a large-scale, high-precision cow face heat map model, thereby obtaining a trained heat map teacher model. Furthermore, the trained heat map teacher model is used to mark the key points of the non-labeled reference cow face image, and the target cow face labeled image can be obtained. Secondly, according to the original cow face labeled images and the target cow face labeled images, the features of the heat map teacher model in the training process are transferred to the pre-built small-scale key point detection model, which can ensure that the key point detection model has the accuracy of the heat map teacher model and the processing speed of the key point detection model, so that the small-scale regression model has extremely high cow face detection accuracy. Finally, the key point detection student model is used to detect cow face images that need to be insured for dairy cow insurance claims, which can accurately and quickly identify key points such as cow ears, cow eyes and cow face contours.
[0087] In step S101 of some embodiments, the original cow face labeled image may be a labeled image with cow face characteristic parts such as cow face ears, cow face eyes and cow face contours. The present application may obtain the original cow face labeled image by manually labeling key points of the non-labeled cow face image, or may obtain the original cow face labeled image by searching the network for labeled images that are pre-labeled with cow face key points.
[0088] In step S102 of some embodiments, the preset cow face heat map model can be a graph convolutional neural network with a heat map as output. It should be noted that the present application uses the heat map teacher model after the cow face heat map model is trained as the teacher model for transfer learning. Therefore, the design requirements of the cow face heat map model are mainly high precision. The pre-set cow face heat map model is trained using the original cow face labeled image to obtain the heat map teacher model.
[0089] It should be noted that the original cow face marked image includes cow face image data and key point marked data, wherein the cow face image data may be pixel data of an unlabeled cow face image, and the key point marked data may be data such as key point locations marked in the original cow face marked image and corresponding marked names. In addition, the pre-built cow face heat map model includes a convolutional pooling layer and a fully connected layer, wherein the convolutional pooling layer is used to extract features from the cow face image data, and the fully connected layer is used to calculate the confidence that the features of the cow face image data belong to each type of key point location.
[0090] See also Figure 2In some embodiments, step S102 may include but is not limited to steps S201 to S205:
[0091] Step S201, performing feature extraction on the cow face image data based on a convolution pooling layer to obtain a cow face feature image, wherein the cow face feature image includes cow face feature pixels;
[0092] Step S202, calculating the confidence of the cow face feature pixel points based on the fully connected layer to obtain the confidence of the cow face feature point;
[0093] Step S203, selecting target key feature points whose confidence level of cow face feature points is greater than a preset confidence level from cow face feature pixel points;
[0094] Step S204, calculating key point loss data of the cow face heat map model based on the target key feature points and key point labeling data;
[0095] Step S205, adjusting the parameters of the cow face heat map model based on the key point loss data to obtain a heat map teacher model.
[0096] In step S201 and step S202 of some embodiments, the convolution pooling layer of the cow face heat map model is used to extract features of the cow face image data, so as to obtain a pixel image containing cow face features, i.e., a cow face feature image, and then the fully connected layer of the cow face heat map model is used to calculate the confidence of each cow face feature pixel point in the cow face feature image to obtain the confidence of the cow face feature point.
[0097] It should be noted that in order to improve the accuracy of the cow face heat map model, the convolution pooling layer of the cow face heat map model can be set to a multi-layer structure, and the specific level needs to be determined according to the actual situation.
[0098] In step S203 of some embodiments, the preset confidence level may be a preset confidence level value for screening target key feature points. After obtaining the confidence level of the cow face feature points, the target key feature points are screened out from the cow face feature pixel points, wherein the target key feature points refer to cow face feature pixel points whose confidence level is greater than the preset confidence level.
[0099] In steps S204 and S205 of some embodiments, the key point loss data between the target key feature points and the key point marking data are calculated through a preset heat map loss function, and then the parameters in the cow face heat map model are adjusted according to the key point loss data, and the cow face heat map model after the adjusted parameters is trained until the key point loss data is less than a preset first loss threshold.
[0100] Specifically, the present application can calculate the key point loss data between the target key feature points and the key point label data through the following heat map loss function:
[0101]
[0102] Among them, L h,i represents the key point loss data of the i-th key point labeled data, N represents the number of target key feature points, z i represents the label of the i-th key point labeled data, Represents the pixel value of the i-th target key feature point.
[0103] In steps S201 to S205 illustrated in the present embodiment, features are extracted from the cow face image data through a convolutional pooling layer to obtain a cow face feature image containing cow face feature pixels, and then the confidence of the cow face feature pixels is calculated using a fully connected layer to obtain the confidence of the cow face feature points. Furthermore, target key feature points whose confidence of the cow face feature points is greater than a preset confidence are screened out from the cow face feature pixels, and then the key point loss data of the cow face heat map model is calculated based on the target key feature points and the key point marking data. Finally, the parameters of the cow face heat map model are adjusted based on the key point loss data, and the step of extracting features from the cow face image data using a convolutional pooling layer is returned until the key point loss data is less than the preset first loss threshold, thereby obtaining a trained heat map teacher model, thereby ensuring the accuracy of the heat map teacher model and improving the accuracy of cow face detection using the heat map teacher model.
[0104] In step S103 of some embodiments, the reference cow face image may be an unlabeled image without any key point labeling. After obtaining the trained heat map teacher model, in order to increase the training data of the student model, the heat map teacher model may be used to label the key points of the preset reference cow face image to obtain a target cow face labeled image labeled with cow face key points.
[0105] It should be noted that the trained heat map teacher model includes a feature extraction layer and an activation function layer, wherein the feature extraction layer has a similar function to the above-mentioned convolutional pooling layer, and the activation function layer has a similar function to the above-mentioned fully connected layer.
[0106] Specifically, see Figure 3 In some embodiments, step S103 may include but is not limited to steps S301 to S304:
[0107] Step S301, using a feature extraction layer to extract features from a reference cow face image to obtain cow face key points;
[0108] Step S302, calculating the key point confidence of the key points of the cow face based on the activation function layer;
[0109] Step S303, selecting target key points from the cow face key points based on the key point confidence;
[0110] Step S304: label the reference cow face image based on the target key points to obtain a target cow face labeled image.
[0111] In steps S301 to S303 of some embodiments, the method of extracting features from a reference cow face image using a feature extraction layer to obtain cow face key points is similar to the method of extracting features from cow face image data based on a convolution pooling layer to obtain a cow face feature image. The method of calculating the key point confidence of cow face key points based on an activation function layer is similar to the method of calculating the confidence of cow face feature pixels based on a fully connected layer to obtain the confidence of cow face feature points. The method of screening out target key points from cow face key points based on key point confidence is similar to the method of screening out target key feature points whose confidence is greater than a preset confidence from cow face feature pixels. Therefore, they are not described one by one.
[0112] In step S304 of some embodiments, after the target key point is determined, the label confidence of the target key point is calculated using the heat map teacher model to determine the key point label of the target key point, and then the reference cow face image is marked according to the key point label of the target key point to obtain the target cow face marked image, wherein the label confidence may be the confidence of each label of the target key point provided by the output layer of the heat map teacher model. For example, the output layer of the heat map teacher model may have labels such as cow ears, cow noses, cow eyes, and cow face contours. The label confidence of the target key point 1 may be 0.1 for cow ears, 0.15 for cow noses, 0.7 for cow eyes, and 0.05 for cow face contours.
[0113] In steps S301 to S303 shown in the present embodiment, the feature extraction layer and the activation function layer in the heat map teacher model are used to determine the key point confidence of the cow face key points in the reference cow face image, and then the target key points are screened out from the cow face key points according to the key point confidence. Finally, the reference cow face image is marked according to the target key points to obtain the target cow face marked image, which can ensure that the obtained target cow face marked image meets the accuracy of the heat map teacher model, so that the target cow face marked image can be used as training data to participate in the training of the student model.
[0114] In step S104 of some embodiments, after obtaining the original cow face labeled image and the target cow face labeled image, the pre-constructed key point detection model is trained using the original cow face labeled image and the target cow face labeled image as training data to obtain a key point detection student model, and in the process of training the key point detection model, the features of the original cow face labeled image and the target cow face labeled image extracted by the key point detection model are made to be the same as the features of the original cow face labeled image and the target cow face labeled image extracted by the heat map teacher model, thereby realizing transfer learning from the heat map teacher model to the key point detection student model.
[0115] It is important to note that the preset key point detection model, as the student model in transfer learning, does not need to be too large, so as to improve the processing efficiency of the key point detection model. Furthermore, to ensure that the key point detection model can learn from the heat map teacher model, the level of the feature extraction module used to extract image features in the key point detection model must be the same as the level of the feature extraction layer in the heat map teacher model.
[0116] It is also necessary to know that the key point detection model includes a key point coordinate detection branch model and a key point confidence detection branch model, wherein the key point coordinate detection branch model is used to output the key point position coordinates in the training image data, and the key point confidence detection branch model is used to output the label confidence of the key point in the training image data.
[0117] See also Figure 4 In some embodiments, step S104 may include but is not limited to steps S401 to S407:
[0118] Step S401, merging the original cow face labeled image and the target cow face labeled image to obtain a cow face training image;
[0119] Step S402, obtaining the teacher model key point features of the heat map teacher model, wherein the teacher model key point features are used to characterize the key point features of the cow face training image extracted by the heat map teacher model;
[0120] Step S403, using the key point detection model to extract key point features of the cow face training image to obtain key point features of the student model;
[0121] Step S404, estimating the coordinates of the key point features based on the key point coordinate detection branch model to obtain the key point estimated coordinates;
[0122] Step S405, estimating the confidence of the key point features based on the key point confidence detection branch model to obtain the key point estimated confidence;
[0123] Step S406, calculating the overall loss data of the key point detection model based on the key point features of the teacher model, the key point features of the student model, the cow face training image, the key point estimated coordinates and the key point estimated confidence;
[0124] Step S407: Based on the overall loss data, adjust the parameters of the key point detection model to obtain a key point detection student model.
[0125] In step S401 of some embodiments, the original cow face labeled image and the target cow face labeled image are merged to obtain a cow face training image suitable for training a key point detection model.
[0126] In step S402 of some embodiments, by searching for the intermediate features output during the training process of the heat map teacher model, and searching for the intermediate features output during the key point annotation process of the reference cow face image using the heat map teacher model, the key point features of each cow face training image in the heat map teacher model, that is, the key point features of the teacher model, can be obtained.
[0127] In step S403 of some embodiments, key point detection models are used to extract features in the cow face training image, thereby obtaining key point features of the student model.
[0128] In step S404 and step S405 of some embodiments, the key point coordinate detection branch model is used to perform coordinate estimation calculation on the extracted key point features of the student model, and the estimated coordinates of the key point features of the student model, i.e., the key point estimated coordinates, are obtained. The key point confidence detection branch model is used to perform confidence estimation calculation on the extracted key point features of the student model, and the estimated confidence of the key point features of the student model, i.e., the key point estimated confidence, is obtained.
[0129] In step S406 of some embodiments, the overall loss data of the key point detection model is calculated using the overall loss function pre-set in the key point detection model based on the key point features of the teacher model output by the heat map teacher model, the cow face training image, the key point features of the student model output by the key point detection model, the key point estimated coordinates and the key point estimated confidence.
[0130] It is important to know that the cow face training image includes the cow face key point coordinates and the cow face key point confidence.
[0131] See also Figure 5 In some embodiments, step S406 may include but is not limited to steps S501 to S504:
[0132] Step S501, calculating the key point feature loss data of the key point detection model based on the key point features of the student model and the key point features of the teacher model;
[0133] Step S502, calculating key point position loss data of the key point detection model based on the key point coordinates of the cow face and the estimated key point coordinates;
[0134] Step S503, calculating key point confidence loss data of the key point detection model based on the key point confidence of the cow face and the key point estimated confidence;
[0135] Step S504, merging the key point feature loss data, the key point position loss data and the key point confidence loss data to obtain the overall loss data.
[0136] In step S501 of some embodiments, a key point feature loss function pre-set in the key point detection model is used to calculate the loss value between the key point features of the student model and the key point features of the teacher model to obtain key point feature loss data.
[0137] See also Figure 6 In some embodiments, step S501 may include but is not limited to steps S601 to S606:
[0138] Step S601, obtaining the feature quantity of key point features of the student model;
[0139] Step S602, performing logarithmic operation on the key point features of the student model to obtain the logarithmic value of the student features;
[0140] Step S603, performing logarithmic operation on the key point features of the teacher model to obtain the logarithmic value of the teacher feature;
[0141] Step S604, calculating the difference between the teacher's characteristic logarithm value and the student's characteristic logarithm value to obtain the characteristic logarithm difference;
[0142] Step S605, multiplying the feature logarithm difference and the teacher feature logarithm value to obtain a feature product value;
[0143] Step S606, calculating the average value of the feature product values based on the number of features to obtain key point feature loss data.
[0144] In step S601 of some embodiments, the number of features can be obtained by calculating the number of key point features of the student model.
[0145] In some embodiments, in steps S602 to S606, by numbering the key point features of the student model and the key point features of the teacher model, the index labels of the key point features of the student model and the index labels of the key point features of the teacher model can be obtained. Furthermore, the number of layers of the feature extraction module in the key point detection model is the same as the number of layers of the feature extraction layer in the heat map teacher model. Therefore, the number of key point features of the student model and the number of key point features of the teacher model are the same, so the index labels of the key point features of the student model and the index labels of the key point features of the teacher model can correspond one-to-one.
[0146] Furthermore, the key point feature loss data can be calculated using the following formula:
[0147]
[0148] Among them, L f,i represents the key point feature loss data of the key point feature of the student model with index label i, i represents the index label of the key point feature of the student model, N represents the number of features, and f i represents the key point feature of the teacher model with index label i, Represents the key point features of the student model with index label i.
[0149] In steps S601 to S606 shown in this embodiment, the number of key point features of the student model is obtained to obtain the number of features, and then the key point feature loss data between the key point features of the student model and the key point features of the teacher model are calculated based on the number of features using a preset key point feature loss function. The degree of learning of the key point detection model on the heat map teacher model can be observed, thereby ensuring that the accuracy of the trained key point detection student model is the same as that of the heat map teacher model, thereby improving the accuracy of cow face detection.
[0150] In step S502 of some embodiments, a key point position loss function pre-set in the key point detection model is used to calculate the loss value between the key point coordinates of the cow face and the key point estimated coordinates to obtain the key point position loss data.
[0151] See also Figure 7 In some embodiments, step S502 may include but is not limited to steps S701 to S704:
[0152] Step S701, determining the number of key points of the target cow face image based on the estimated coordinates of the key points;
[0153] Step S702, calculating the absolute difference between the key point coordinates of the cow face and the estimated key point coordinates to obtain the coordinate difference;
[0154] Step S703, if the coordinate difference is less than the preset coordinate difference, square the coordinate difference to obtain the square of the difference, and merge the square of the difference based on the number of key points to obtain the key point position loss data;
[0155] Step S704, if the coordinate difference is greater than or equal to the preset coordinate difference, the difference between the coordinate difference and the preset target value is calculated to obtain the target difference, and the target difference is merged based on the number of key points to obtain the key point position loss data.
[0156] In step S701 of some embodiments, the number of key points of the target cow face image can be obtained by checking the number of estimated coordinates of the key points.
[0157] In steps S702 to S704 of some embodiments, by numbering the cow face key point coordinates and the key point estimated coordinates, the index labels of the cow face key point coordinates and the index labels of the key point estimated coordinates can be obtained. Furthermore, the number of key point features of the student model is the same as the number of key point features of the teacher model. Therefore, the index labels of the cow face key point coordinates and the index labels of the key point estimated coordinates can correspond one to one.
[0158] Furthermore, the key point position loss data can be calculated using the following formula:
[0159]
[0160] Among them, L r,i represents the key point position loss data of the estimated coordinates of the key point with index label i, M represents the number of key points, δ represents the offset coefficient, i represents the index label of the estimated coordinates of the key point i, x i Represents the coordinates of the key points on the cow face with index label i, Represents the estimated coordinates of the key point with index label i.
[0161] In steps S701 to S704 shown in this embodiment, the number of key points of the target cow face image is determined by obtaining the number of key point estimated coordinates, and then the key point position loss data between the cow face key point coordinates and the key point estimated coordinates are calculated based on the number of key points using a preset key point position loss function. The degree of deviation of the key points can be observed, so that the positions of the key points will not be offset during the training process of the key point detection model, thereby improving the accuracy of cow face detection.
[0162] In step S503 of some embodiments, a key point confidence loss function preset in the key point detection model is used to calculate the loss value between the key point confidence of the cow face and the key point estimated confidence to obtain key point confidence loss data.
[0163] In detail, the key point confidence loss data can be calculated using the following formula:
[0164]
[0165] Among them, L s represents the key point confidence loss data, y represents the key point confidence of the cow face, Indicates the estimated confidence of key points.
[0166] In step S504 of some embodiments, after obtaining the key point feature loss data, the key point position loss data and the key point confidence loss data, the key point feature loss data, the key point position loss data and the key point confidence loss data are merged to obtain the overall loss data.
[0167] In detail, the overall loss data can be calculated using the following formula:
[0168] L=λ1L r +λ2L s +λ3L f Formula (5)
[0169] Wherein, L represents the overall loss data, λ1 represents the first hyperparameter for balancing the key point feature loss data, key point position loss data and key point confidence loss data, λ2 represents the second hyperparameter for balancing the key point feature loss data, key point position loss data and key point confidence loss data, λ3 represents the third hyperparameter for balancing the key point feature loss data, key point position loss data and key point confidence loss data, L r Represents the key point feature loss data, L s Represents the key point position loss data, L f Represents key point confidence loss data.
[0170] In steps S501 to S504 shown in the present embodiment, by calculating the key point feature loss data of the key point detection model, the similarity between the key point detection model and the heat map teacher model can be improved, thereby improving the accuracy of the key point detection model. By calculating the key point position loss data of the key point detection model, the accuracy of the key point detection model in detecting the key point position can be improved. By calculating the key point confidence loss data of the key point detection model, the accuracy of the key point detection model in detecting the label confidence of the key point can be improved.
[0171] In step S407 of some embodiments, after determining the overall loss data, if the overall loss data meets the expected loss data target, the key point detection model under the current parameters is directly used as the key point detection student model; if the overall loss data does not meet the expected loss data target, the parameters of the key point detection model are adjusted according to the overall loss data, and the model is retrained until the overall loss data meets the expected loss data target, thereby obtaining a trained key point detection model, i.e., a key point detection student model.
[0172] In steps S401 to S407 shown in this embodiment, the training data set of the key point detection model is expanded by merging the original cow face labeled image and the target cow face labeled image, thereby improving the training effect of the key point detection model. Then, the key point features of the teacher model obtained by extracting features of the cow face training image using the heat map teacher model provide learning data for the transfer learning of the key point detection model. Furthermore, the key point coordinate detection branch model is used to estimate the coordinates of the key point features to obtain the key point estimated coordinates. The key point confidence detection branch model is used to estimate the confidence of the key point features to obtain the key point estimated confidence. The output data of the key points of the cow face training image can be determined. Then, according to the key point features of the teacher model, the key point features of the student model, the cow face training image, the key point estimated coordinates and the key point estimated confidence, the overall loss data of the key point detection model is calculated. According to the overall loss data, the parameters of the key point detection model are adjusted to obtain a trained key point detection student model, so that the key point detection student model has the advantages of both the key point detection model and the heat map teacher model, thereby improving the accuracy of cow face detection.
[0173] In step S105 of some embodiments, the target cow face image may be a cow face image of a cow insured in cow insurance. After receiving the target cow face image, the trained key point detection student model can be used to perform key point detection on the target cow face image, thereby achieving cow face detection on the target cow face image.
[0174] The present application obtains a heat map teacher model by training a preset cow face heat map model with original cow face labeled key points in advance, thereby improving the accuracy of the heat map teacher model and the accuracy of cow face detection. Furthermore, based on the original cow face labeled image and the target cow face labeled image, the features of the heat map teacher model are transferred to a pre-built key point detection model to obtain a key point detection student model, so that the key point detection student model can still have a high-precision detection accuracy rate when the model scale is small, thereby improving the accuracy of the key point detection model for cow face detection.
[0175] See also Figure 8The embodiment of the present application also provides a cow face detection device, which can implement the above cow face detection method, and the device includes:
[0176] The cow face image acquisition module 801 is used to acquire an original cow face labeled image, wherein the original cow face labeled image is a labeled image pre-labeled with cow face key points;
[0177] The teacher model generation module 802 is used to train the preset cow face heat map model based on the original cow face labeled image to obtain a heat map teacher model;
[0178] The cow face image marking module 803 is used to mark key points of a preset reference cow face image based on a heat map teacher model to obtain a target cow face marked image, wherein the reference cow face image is a non-annotated image;
[0179] The student model generation module 804 is used to perform transfer learning on the preset key point detection model based on the original cow face labeled image, the target cow face labeled image and the heat map teacher model to obtain a key point detection student model;
[0180] The cow face key point detection module 805 is used to perform key point detection on the target cow face image using the key point detection student model.
[0181] The specific implementation of the cow face detection device is basically the same as the specific implementation of the cow face detection method described above, and will not be repeated here.
[0182] The embodiment of the present application also provides an electronic device, the electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the above-mentioned cow face detection method when executing the computer program. The electronic device can be any intelligent terminal including a tablet computer, a car computer, etc.
[0183] See also Fig. 9 , Fig. 9 The hardware structure of an electronic device of another embodiment is illustrated, and the electronic device includes:
[0184] The processor 901 may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present application;
[0185] The memory 902 can be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 902 can store an operating system and other application programs. When the technical solution provided in the embodiment of this specification is implemented by software or firmware, the relevant program code is stored in the memory 902, and the processor 901 calls and executes the cow face detection method of the embodiment of this application;
[0186] Input / output interface 903, used to implement information input and output;
[0187] Communication interface 904, used to realize communication interaction between the device and other devices, which can be realized through wired mode (such as USB, network cable, etc.) or wireless mode (such as mobile network, WI FI, Bluetooth, etc.);
[0188] A bus 905 that transmits information between various components of the device (e.g., the processor 901, the memory 902, the input / output interface 903, and the communication interface 904);
[0189] The processor 901 , the memory 902 , the input / output interface 903 and the communication interface 904 are connected to each other in communication within the device via a bus 905 .
[0190] An embodiment of the present application also provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the above-mentioned cow face detection method is implemented.
[0191] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0192] The cow face detection method, cow face detection device, electronic device and storage medium provided in the embodiments of the present application train a preset cow face heat map model by using an original cow face labeled image with cow face key points in advance to obtain a heat map teacher model, thereby improving the accuracy of the heat map teacher model and the accuracy of cow face detection. Furthermore, based on the original cow face labeled image and the target cow face labeled image, the features of the heat map teacher model are transferred to a pre-constructed key point detection model to obtain a key point detection student model, so that the key point detection student model can still have a high-precision detection accuracy rate when the model scale is small, thereby improving the accuracy of the key point detection model for cow face detection.
[0193] The embodiments described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0194] Those skilled in the art will appreciate that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than shown in the figures, or a combination of certain steps, or different steps.
[0195] The device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0196] Those skilled in the art will appreciate that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices may be implemented as software, firmware, hardware, or a suitable combination thereof.
[0197] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0198] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0199] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the above units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. The mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0200] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0201] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0202] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including multiple instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, referred to as ROM), random access memory (Random Access Memory, referred to as RAM), disk or optical disk and other media that can store programs.
[0203] The preferred embodiments of the present invention are described above with reference to the accompanying drawings, but the scope of the rights of the present invention is not limited thereto. Any modification, equivalent substitution and improvement made by a person skilled in the art without departing from the scope and essence of the present invention should be within the scope of the rights of the present invention.
Claims
1. A cow face detection method, characterized in that: The method comprises: Acquire an original cow face labeled image, wherein the original cow face labeled image is a labeled image pre-labeled with cow face key points; Training a preset cow face heat map model based on the original cow face labeled image to obtain a heat map teacher model; Based on the heat map teacher model, key points of a preset reference cow face image are marked to obtain a target cow face marked image, wherein the reference cow face image is a non-annotated image; Based on the original cow face labeled image, the target cow face labeled image and the heat map teacher model, transfer learning is performed on a preset key point detection model to obtain a key point detection student model; The key point detection student model is used to perform key point detection on the target cow face image.
2. The method according to claim 1, characterized in that: The key point detection model includes a key point coordinate detection branch model and a key point confidence detection branch model. Based on the original cow face labeled image, the target cow face labeled image and the heat map teacher model, transfer learning is performed on the preset key point detection model to obtain a key point detection student model, including: Merging the original cow face labeled image and the target cow face labeled image to obtain a cow face training image; Obtaining a teacher model key point feature of the heat map teacher model, wherein the teacher model key point feature is used to characterize the key point feature of the cow face training image extracted by the heat map teacher model; Using the key point detection model to extract key point features of the cow face training image, and obtaining key point features of the student model; Based on the key point coordinate detection branch model, the coordinates of the key point features are estimated to obtain the key point estimated coordinates; Based on the key point confidence detection branch model, the confidence of the key point feature is estimated to obtain the key point estimation confidence; Based on the key point features of the teacher model, the key point features of the student model, the cow face training image, the key point estimated coordinates and the key point estimated confidence, calculating the overall loss data of the key point detection model; Based on the overall loss data, the key point detection model is adjusted in parameters to obtain the key point detection student model.
3. The method according to claim 2, characterized in that The cow face training image includes the cow face key point coordinates and the cow face key point confidence, and the overall loss data of the key point detection model is calculated based on the teacher model key point features, the student model key point features, the cow face training image, the key point estimated coordinates and the key point estimated confidence, including: Based on the key point features of the student model and the key point features of the teacher model, calculating the key point feature loss data of the key point detection model; Based on the key point coordinates of the cow face and the estimated key point coordinates, calculating the key point position loss data of the key point detection model; Based on the confidence of the key points of the cow face and the estimated confidence of the key points, calculating the key point confidence loss data of the key point detection model; The key point feature loss data, the key point position loss data and the key point confidence loss data are combined to obtain the overall loss data.
4. The method according to claim 2, characterized in that: The calculating the key point feature loss data of the key point detection model based on the key point features of the student model and the key point features of the teacher model includes: Obtaining the feature quantity of the key point features of the student model; Performing a logarithmic operation on the key point features of the student model to obtain a logarithmic value of the student features; Performing a logarithmic operation on the key point features of the teacher model to obtain a logarithmic value of the teacher feature; Calculate the difference between the teacher's characteristic logarithm value and the student's characteristic logarithm value to obtain the characteristic logarithm difference; Performing product processing on the characteristic logarithm difference and the teacher characteristic logarithm value to obtain a characteristic product value; The average value of the feature product values is calculated based on the number of features to obtain the key point feature loss data.
5. The method according to claim 2, characterized in that: The step of calculating the key point position loss data of the key point detection model based on the key point coordinates of the cow face and the estimated key point coordinates includes: Determining the number of key points of the target cow face image based on the estimated coordinates of the key points; Calculate the absolute difference between the coordinates of the key points of the cow face and the estimated coordinates of the key points to obtain the coordinate difference; If the coordinate difference is less than the preset coordinate difference, the coordinate difference is squared to obtain the square of the difference, and the square of the difference is merged based on the number of key points to obtain the key point position loss data; If the coordinate difference is greater than or equal to the preset coordinate difference, the difference between the coordinate difference and the preset target value is calculated to obtain the target difference, and the target difference is merged based on the number of key points to obtain the key point position loss data.
6. The method according to any one of claims 1 to 5, characterized in that: The heat map teacher model includes a feature extraction layer and an activation function layer. The key points of a preset reference cow face image are marked based on the heat map teacher model to obtain a target cow face marked image, including: Using the feature extraction layer to extract features from the reference cow face image to obtain cow face key points; Calculate the key point confidence of the key points of the cow face based on the activation function layer; Filtering target key points from the cow face key points based on the key point confidence; The reference cow face image is marked based on the target key points to obtain the target cow face marked image.
7. The method according to any one of claims 1 to 5, characterized in that: The cow face key point marked image includes cow face image data and key point marked data, the cow face heat map model includes a convolution pooling layer and a fully connected layer, and the preset cow face heat map model is trained based on the cow face key point marked image to obtain a heat map teacher model, including: Performing feature extraction on the cow face image data based on the convolution pooling layer to obtain a cow face feature image, wherein the cow face feature image includes cow face feature pixels; Calculating the confidence of the cow face feature pixel points based on the fully connected layer to obtain the confidence of the cow face feature points; Filter out target key feature points whose confidence level of the cow face feature points is greater than a preset confidence level from the cow face feature pixel points; Based on the target key feature points and the key point marking data, calculating the key point loss data of the cow face heat map model; The parameters of the cow face heat map model are adjusted based on the key point loss data to obtain the heat map teacher model.
8. A cow face detection device, characterized in that: The device comprises: A cow face image acquisition module, used to acquire an original cow face marked image, wherein the original cow face marked image is a marked image pre-marked with cow face key points; A teacher model generation module, used for training a preset cow face heat map model based on the original cow face labeled image to obtain a heat map teacher model; A cow face image marking module, used for marking key points of a preset reference cow face image based on the heat map teacher model to obtain a target cow face marked image, wherein the reference cow face image is a non-annotated image; A student model generation module, used to perform transfer learning on a preset key point detection model based on the original cow face labeled image, the target cow face labeled image and the heat map teacher model to obtain a key point detection student model; The cow face key point detection module is used to perform key point detection on the target cow face image using the key point detection student model.
9. An electronic device, characterized in that: The electronic device comprises a memory and a processor, the memory stores a computer program, and the processor implements the cow face detection method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the cow face detection method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Cow face detection and cow face key point positioning method based on convolutional neural network
CN114332956A
