Convolutional Neural Networks for Identity Recognition, Electronic Devices and Storage Media
By processing animal head and body images through convolutional neural networks, generating vectors to be identified and matching them with the image system, the high cost and harm of chip implantation methods are solved, and efficient and accurate animal identification is achieved.
Patent Information
- Application Number
- CN202111440965.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-30
- Publication Date
- 2025-10-31
- Estimated Expiration
- 2041-11-30
AI Technical Summary
In existing technologies, animal identification through chip implantation has problems such as high identification costs, complex operation, and easy errors, as well as causing harm to animals.
By employing convolutional neural network technology, images of an animal's head and body are acquired, and feature data is extracted using the convolutional neural network to generate a vector to be identified. This vector is then matched with vectors stored in the image system to determine the animal's identity information.
It reduces identification costs, improves the accuracy of identification, avoids harm to animals, and simplifies the operation process.
Smart Images

Figure CN114049656B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image recognition technology, and in particular to identity recognition methods, electronic devices and storage media based on convolutional neural networks. Background Technology
[0002] Animal identification typically employs microchip technology, which involves implanting a chip into the animal's body. For example, an RFID chip can be injected subcutaneously into a cat using an RFID chip injector. Since the chip is linked to the animal's identification information, a reader corresponding to the chip is used to read this information when identification is needed, thus achieving identification.
[0003] In related technologies, identification methods using implanted chips require multiple instruments. The chip, chip injector, and card reader all increase the identification cost. They also require operators to have professional skills to complete the implantation and reading of the chip, which can easily lead to operational errors and reduce the accuracy of identification. Moreover, implanting chips can also easily cause harm to animals. Summary of the Invention
[0004] To address or partially address the problems existing in related technologies, this application provides an identity recognition method, electronic device, and storage medium based on convolutional neural networks, which can reduce recognition costs, improve the accuracy of identity recognition, and avoid harming animals.
[0005] The first aspect of this application provides an identity recognition method based on a convolutional neural network, comprising:
[0006] Collect head and body images of the animal to be identified;
[0007] The head image and the body image are processed by a convolutional neural network of the image system to generate a vector to be identified;
[0008] The vector to be identified is matched with the stored vector in the image system, and the identity information of the animal to be identified is determined based on the matching result.
[0009] In one embodiment, the step of processing the head image and the body image using a convolutional neural network of an image system to generate a vector to be identified includes:
[0010] The head image and the body image are processed by the head convolutional neural network and the body convolutional neural network of the image system to obtain the head vector corresponding to the head image and the body vector corresponding to the body image, respectively.
[0011] The head vector and the body vector are fused to generate the vector to be identified.
[0012] In one implementation, fusing the head vector and the body vector to generate the vector to be identified includes:
[0013] Multiply the head vector by a preset head coefficient to obtain the head vector to be fused; or multiply the body vector by a preset body coefficient to obtain the body vector to be fused.
[0014] The body vector and the head vector are fused to generate the vector to be identified.
[0015] In one embodiment, matching the vector to be identified with the stored vectors in the image system, and determining the identity information of the animal to be identified based on the matching result, includes:
[0016] Calculate the spatial distance between the vector to be identified and each stored vector in the image system;
[0017] The stored vectors whose spatial distance from the vector to be identified is less than a preset distance threshold are determined as the matching vectors that match the animal to be identified;
[0018] The matching result is obtained based on the matching vector and the preset mapping relationship, and the identity information of the animal to be identified is determined based on the matching result.
[0019] In one implementation, determining the stored vector whose spatial distance from the vector to be identified is less than a preset distance threshold as the matching vector further includes:
[0020] When there are multiple stored vectors whose spatial distance to the vector to be identified is less than a preset distance threshold, the stored vector with the smallest spatial distance is selected as the matching vector that matches the animal to be identified.
[0021] In one embodiment, when there are multiple stored vectors whose spatial distance to the vector to be identified is less than a preset distance threshold, selecting the stored vector with the smallest spatial distance as the matching vector to be identified further includes:
[0022] When there are multiple storage vectors with the smallest spatial distance, select multiple storage vectors as matching vectors;
[0023] The matching results corresponding to multiple matching vectors are determined according to the preset mapping relationship, and output for the user to check.
[0024] In one embodiment, matching the vector to be identified with the stored vectors in the image system, and determining the identity information of the animal to be identified based on the matching result, includes:
[0025] Calculate the spatial distance between the vector to be identified and each stored vector in the image system; and calculate the probability that the animal to be identified belongs to each animal species based on the head image and / or the body image through the species identification network in the image system.
[0026] A matching result is obtained based on the spatial distance and the probability, and the identity information of the animal to be identified is determined based on the matching result.
[0027] In one implementation, obtaining a matching result based on the spatial distance and the probability, and determining the identity information of the animal to be identified based on the matching result, includes:
[0028] Based on the spatial distance and the probability, a matching coefficient between the animal information stored in the image system and the animal to be identified is calculated using a preset algorithm.
[0029] Based on the matching coefficient, the animal information that matches the animal to be identified is selected as the matching result, and the identity information of the animal to be identified is determined based on the matching result.
[0030] A second aspect of this application provides an electronic device, comprising:
[0031] Processor; and
[0032] A memory that stores executable code, which, when executed by the processor, causes the processor to perform the method described above.
[0033] A third aspect of this application provides a computer-readable storage medium having executable code stored thereon, which, when executed by a processor of an electronic device, causes the processor to perform the method described above.
[0034] The technical solution provided in this application can include the following beneficial effects: This application acquires images of an animal's head and body, generates a vector to be identified based on the head and body images, compares the vector to be identified with the stored vector corresponding to the animal information stored in the image system, obtains a matching result corresponding to the vector to be identified, and determines the animal's identity information based on the matching result. The solution provided in this application can achieve identification without chip implantation, is simple to operate, has low operating costs, and will not cause harm to the animal.
[0035] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit this application. Attached Figure Description
[0036] The above and other objects, features and advantages of this application will become more apparent from the following description of exemplary embodiments of this application in conjunction with the accompanying drawings, wherein the same reference numerals generally represent the same components.
[0037] Figure 1 This is a flowchart illustrating an identity recognition method based on a convolutional neural network, as shown in an embodiment of this application.
[0038] Figure 2 This is a flowchart illustrating another embodiment of the identity recognition method based on a convolutional neural network.
[0039] Figure 3 This is a flowchart illustrating another embodiment of the identity recognition method based on a convolutional neural network.
[0040] Figure 4 yes Figure 3 The embodiment illustrates a flowchart of a convolutional neural network processing image.
[0041] Figure 5 This is a schematic diagram of the structure of an electronic device shown in an embodiment of this application. Detailed Implementation
[0042] Embodiments of this application will now be described in more detail with reference to the accompanying drawings. While embodiments of this application are shown in the drawings, it should be understood that this application may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided to make this application more thorough and complete, and to fully convey the scope of this application to those skilled in the art.
[0043] The terminology used in this application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. The singular forms “a,” “the,” and “the” used in this application and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to and includes any or all possible combinations of one or more of the associated listed items.
[0044] It should be understood that although the terms "first," "second," "third," etc., may be used in this application to describe various information, this information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, without departing from the scope of this application, first information may also be referred to as second information, and similarly, second information may also be referred to as first information. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this application, "multiple" means two or more, unless otherwise explicitly specified.
[0045] In related technologies, identification methods using implanted chips require multiple instruments. The chip, chip injector, and card reader all increase the identification cost. Furthermore, operators need to have professional skills to complete the implantation and reading of the chip. The process is prone to operational errors, which reduces the accuracy of identification. Moreover, implanting chips can easily cause harm to animals.
[0046] To address the aforementioned issues, this application provides an identity recognition method based on convolutional neural networks, which can reduce recognition costs, improve the accuracy of identity recognition, and avoid harming animals.
[0047] The technical solutions of the embodiments of this application are described in detail below with reference to the accompanying drawings.
[0048] Figure 1 This is a flowchart illustrating an identity recognition method based on a convolutional neural network, as shown in an embodiment of this application.
[0049] See Figure 1 This embodiment provides an identity recognition method based on a convolutional neural network, the method comprising:
[0050] Step S101: Collect head and body images of the animal to be identified.
[0051] This involves using image acquisition devices, such as cameras, mobile phones, or webcams, to capture images of the animal's head and body. The head image can include the animal's face, which can be a frontal view or an image taken from a specific angle. The body image can include images of the animal's limbs, torso, and tail. For example, with a cat, multiple head images can be captured from different angles to obtain facial features and head shape; side-view images of the cat's body, such as its left side, can also be captured to obtain information about the cat's limbs, torso, tail, as well as its coat color, body shape, and other physical characteristics.
[0052] Step S102: The head image and body image are processed by the convolutional neural network of the image system to generate the vector to be identified.
[0053] The image system incorporates a convolutional neural network (CNN). A CNN is a type of feedforward neural network that includes convolutional computations and has a deep structure; it is one of the representative algorithms of deep learning. CNNs possess representation learning capabilities and can perform translation-invariant classification of input information according to their hierarchical structure. By processing the head and body images using the CNN, various feature data of the head and body images are obtained, thereby generating corresponding multidimensional vectors, which are the vectors to be identified.
[0054] Step S103: Match the vector to be identified with the stored vector in the image system, and determine the identity information of the animal to be identified based on the matching result.
[0055] The image system stores identification information for multiple animals, along with corresponding multi-dimensional vectors, known as stored vectors. Therefore, there is a mapping relationship between the stored vectors and the stored animal identification information. Matching the vector to be identified with the stored vectors yields a matching result. Based on the matching result and the mapping relationship, the identification information of the animal to be identified can be determined.
[0056] The process can begin by matching the target vector obtained from either the head or body image with a stored head vector, filtering the matching results. If multiple matching results are found, the target vector obtained from the other head or body image can then be matched to obtain the final result. Alternatively, the target vectors obtained from both the head and body images can be combined for matching, and the animal's identity information can be determined based on the matching results.
[0057] This embodiment acquires head and body images of an animal, uses a convolutional neural network to extract feature data from these images, and generates a vector to be identified. This vector is then compared with stored vectors corresponding to animal identification information in the image system to obtain a matching result. Based on this matching result, the animal's identity information is determined. This design eliminates the need for chip implantation, enabling animal identification. The operation is simple, low-cost, and does not harm the animal. Furthermore, acquiring both head and body images simultaneously ensures sufficient data for image recognition, improving accuracy and preventing errors due to limited data. It also reduces the possibility of insufficient data for rapid identification due to an overwhelming number of results.
[0058] In one embodiment, acquiring head and body images of the animal to be identified may include: guiding the user to take head and body images of the animal to be identified, providing feedback to the user on adjustment methods based on preset image standards, and acquiring head and body images that meet the image standards during the user's shooting process.
[0059] The system can be connected to an image acquisition device via a convolutional neural network. The image acquisition device can then output prompts to guide the user to capture images of the animal's head and body. Each head and body image has preset image standards, such as angle, brightness, and sharpness; however, this embodiment does not specifically limit these image standards. Based on these preset image standards, the system can provide feedback to the user on adjustments. For example, if the user's shooting angle is too far off, the system can prompt the user to adjust the angle; if the lighting is too dim, the system can prompt the user to take supplemental lighting measures. The user can take multiple photos or videos. During the shooting process, multiple images or recorded images that meet the image standards can be captured to facilitate subsequent image recognition.
[0060] In this embodiment, to facilitate shooting, the NCAST (Ncast Image Recognition Tracking System) target shape feature detection method can also be used to track the image. As long as the head or body enters the tracking area, the image system can lock and track the image, so that the image acquisition device centers on the locked target image and controls the image acquisition device to perform corresponding scaling strategies.
[0061] This embodiment facilitates user shooting operations and reduces operational difficulty by connecting a convolutional neural network and an image acquisition device. Compared with chip implantation and card reader reading in related technologies, it improves the implementation efficiency of the recognition scheme and simplifies the recognition method.
[0062] In one embodiment, before acquiring the head and body images of the animal to be identified, the method further includes: recording the animal's identity information in the image system. This identity information may include the animal's name, head image, body image, breed, age, and information about its owner or supervisor. Using the animal's head and body images, a multi-dimensional vector of the animal can be generated as a storage vector, so that when identifying the identity information, the vector to be identified can be compared with the stored vector.
[0063] Figure 2 This is a flowchart illustrating another embodiment of the identity recognition method based on a convolutional neural network.
[0064] See Figure 2This embodiment provides an identity recognition method based on a convolutional neural network, the method comprising:
[0065] Step S201: Collect head and body images of the animal to be identified.
[0066] Regarding step S201, it has already been explained in step S101 and will not be repeated here. In this embodiment, prompts can also be set to guide the user to take pictures of the head and body of the animal to be identified, and to provide feedback to the user on the adjustment method according to the preset image standards; and to collect head and body images that meet the image standards during the user's shooting process.
[0067] Step S202: The head image and body image are processed by the head convolutional neural network and body convolutional neural network of the image system to obtain the head vector corresponding to the head image and the body vector corresponding to the body image, respectively.
[0068] In the image system, head convolutional neural networks and body convolutional neural networks, trained through neural network training, are used to process head and body images of the animal to be identified. Since images have a pixel matrix, a digital matrix can be set up to correspond to it in the computer. Each pixel is represented by a numerical value, indicating either RGB or grayscale. Different images correspond to different digital matrices, but they exhibit certain characteristics in their numerical distribution. For example, for the head, regardless of its location in the image, the corresponding numerical values will follow a certain pattern, thus enabling the identification of head and body images.
[0069] The head and body images are processed by extracting data features through a multi-layered structure of a convolutional neural network, transforming them into multi-dimensional head and body vectors, respectively. For example, a 1024-dimensional head vector and a 1024-dimensional body vector, but not limited to these; the dimensions can be adjusted according to the required accuracy.
[0070] Each head image and each body image can be converted into a multi-dimensional vector. Taking 1024-dimensional vectors as an example, multiple head images are converted into multiple 1024-dimensional head vectors. The average of these multiple 1024-dimensional head vectors is then obtained to obtain an average 1024-dimensional head vector. Similarly, an average 1024-dimensional body vector is obtained. This design increases the robustness of recognition (robustness refers to the ability of computer software to avoid crashing or freezing under conditions such as input errors, disk failures, network overload, or intentional attacks) and reduces smile discrepancies caused by factors such as angle.
[0071] Step S203: The head vector and body vector are fused to generate the vector to be identified.
[0072] The head and body vectors are multi-dimensional vectors. Adding and fusing them generates even more dimensional vectors. For example, fusing a 1024-dimensional head vector and a 1024-dimensional body vector can generate a 2048-dimensional vector to be identified, but this is not a limitation. This design increases the dimensionality of the vectors, thereby improving the accuracy of recognition. Furthermore, compared to matching one head vector and one body vector separately, fusing the head and body vectors improves recognition efficiency. Moreover, fusing the head and body vectors can improve the accuracy of the filtering process. For example, in the stored vectors, there are stored vector A and stored vector B. Stored vector B corresponds to the same animal as the vector to be identified. However, one of the head vector and body vector of stored vector A has a higher matching degree with the vector to be identified. Therefore, when identifying the animal by matching one of the head vector and the other of the head vector and the body vector, it might select stored vector A, whose head vector is a better match, while failing to obtain a matching result because the body vector of stored vector A does not match the vector to be identified. This embodiment avoids this situation by fusing the head vector and body vector before matching, thus improving the efficiency and accuracy of the identity recognition method.
[0073] In order to allocate the importance of the head and body in the matching process as needed, in one embodiment, step S203, fusing the head vector and body vector to generate a vector to be identified, includes: multiplying the head vector by a preset head coefficient to obtain a head vector to be fused; or multiplying the body vector by a preset body coefficient to obtain a body vector to be fused; and fusing the body vector and head vector to generate a vector to be identified.
[0074] Among them, the head coefficient or body coefficient is a coefficient used to amplify or shrink the vector. When fusing the body vector and the head vector, the coefficient can be used to amplify or shrink the vector, thereby realizing the weight distribution.
[0075] For example, the vector to be identified = head vector + β body vector; β is the body coefficient. When β is large, its product with the body vector is also large, having a greater impact on the vector to be identified, thus affecting the matching result. Similarly, when β is small, its product with the body vector is also small, having a smaller impact on the vector to be identified, with the head vector primarily determining the matching result, and the body vector playing a supporting role. This design allows for the allocation of the influence of the head image and body image on the matching according to actual needs, meeting personalized requirements in different scenarios.
[0076] Step S204: Calculate the spatial distance between the vector to be identified and each stored vector in the image system.
[0077] The vector to be identified and the stored vector have multiple corresponding vectors. The spatial distance between the vector to be identified and the stored vector, i.e., the Euclidean distance, can be calculated by a convolutional neural network, which can represent the degree of matching between the vector to be identified and the stored vector. For example, the smaller the spatial distance, the closer the distance, and the better the match.
[0078] Step S205: Determine the stored vector whose spatial distance from the vector to be identified is less than a preset distance threshold as the matching vector that matches the animal to be identified.
[0079] A distance threshold can be preset to determine the maximum distance between the stored vector and the vector to be identified. For example, when the distance threshold is 5, if the spatial distance between the stored vector and the vector to be identified is less than 5, it will be identified as a matching vector; if it is greater than 5, it will be excluded. This setting can avoid recognition errors and improve recognition accuracy.
[0080] In one embodiment, a stored vector whose spatial distance from the vector to be identified is less than a preset distance threshold is determined as a matching vector; the method further includes: when there are multiple stored vectors whose spatial distance from the vector to be identified is less than the preset distance threshold, the stored vector with the smallest spatial distance is selected as the matching vector that matches the animal to be identified.
[0081] For example, if the preset distance threshold is 5, and the image system contains multiple stored vectors whose spatial distances to the vector to be identified are all less than 5 (e.g., 1, 2, 3, and 4 respectively), then the stored vector with the smallest spatial distance (e.g., 1) is selected as the matching vector for the animal to be identified. If no stored vector has a spatial distance less than or equal to 5 with the vector to be identified (meaning all stored vectors in the image system have a spatial distance greater than 5 with the vector to be identified), then the image system is considered unsuitable.
[0082] To avoid the possibility of identification errors, a number of outputs can be set. For example, when there are 10 stored vectors with a spatial distance less than the distance threshold, if the number of outputs is 6, then the 6 matching vectors with the smallest distance among the 10 stored vectors will be selected.
[0083] In other embodiments, when there are multiple stored vectors whose spatial distance is less than a preset distance threshold, the preset distance can be lowered. For example, if the preset distance threshold is 5, and there are 4 stored vectors in the image system whose spatial distance to the vector to be identified is less than 5, namely 1, 2, 3 and 4, the preset distance threshold can be adaptively lowered, for example, to 3. In this way, the stored vector with a spatial distance of 4 can be excluded, thereby improving accuracy.
[0084] In one embodiment, when there are multiple stored vectors whose spatial distance to the vector to be identified is less than a preset distance threshold, the stored vector with the smallest spatial distance is selected as the matching vector to be identified; the embodiment further includes: when there are multiple stored vectors with the smallest spatial distance, multiple stored vectors are selected as matching vectors; and the matching results corresponding to the multiple matching vectors are determined according to a preset mapping relationship, and output for user verification.
[0085] For example, if there are multiple stored vectors in the image system that have the same and smallest spatial distance from the vector to be identified, these stored vectors can be selected as matching vectors to determine the matching results corresponding to multiple matching vectors. Thus, multiple matching results can be output for the user to check. The output matching results can be the head image and body image in the animal identification information stored in the image system.
[0086] In some use cases, if an animal has a designated person in charge or owner, the user can use that person's password or phone number to further verify the animal's identity. Since the animal's identity information stored in the image system can include the animal's name, head image, body image, breed, age, and information about its person in charge or owner, when multiple results exist, the user can input the animal's corresponding password, the last four digits of its phone number, or verify via SMS. If the password, last four digits of the phone number, or verification phone number matches the stored identity information, it can be determined that a match has been found with the animal to be identified, facilitating further filtering to determine the correct animal's identity.
[0087] Step S206: Obtain the matching result based on the matching vector and the preset mapping relationship, and determine the identity information of the animal to be identified based on the matching result.
[0088] Step S206 has already been described in step S103 and will not be repeated here. It should be noted that the preset mapping relationship is the mapping relationship between the stored vectors generated from the head and body images in the animal's identity information and the identity information itself when the animal's identity information is entered into the image system. Based on this mapping relationship, the corresponding identity information can be determined when the stored vector is determined, thereby identifying the animal's identity information.
[0089] Figure 3 This is a flowchart illustrating another embodiment of the identity recognition method based on a convolutional neural network.
[0090] Compared to Figure 1 and Figure 2 This embodiment also adds a variety identification function to further improve the identification accuracy.
[0091] See Figure 3 This embodiment provides an identity recognition method based on a convolutional neural network, the method comprising:
[0092] Step S301: Collect head and body images of the animal to be identified.
[0093] The explanation of step S301 is the same as that of step S101, and will not be repeated here.
[0094] Step S302: The head image and body image are processed by the convolutional neural network of the image system to generate the vector to be identified.
[0095] The explanation of step S302 is the same as that of step S102, and will not be repeated here.
[0096] Step S303: Calculate the spatial distance between the vector to be identified and each stored vector in the image system; and calculate the probability that the animal to be identified belongs to each animal species based on the head image and / or body image through the species identification network in the image system.
[0097] This involves calculating the spatial distance between the vector to be identified and each stored vector, yielding a distance value, such as 1, 2, or 3. It also calculates the probability of identifying each species of animal based on the head and / or body images, for example, see [link to relevant documentation]. Figure 4 The body image is transmitted to a breed recognition network. The network uses body features such as fur, color, body shape, and tail to determine the probability that the animal belongs to a particular breed. In this embodiment, the image system stores multiple animal breeds, such as orange tabby cats, Persian cats, and Siamese cats. Each breed has distinct distinguishing features. The breed recognition network compares various features in the body image of the animal to calculate the probability that the animal belongs to each breed.
[0098] Step S304: Obtain matching results based on spatial distance and probability, and determine the identity information of the animal to be identified based on the matching results.
[0099] In this embodiment, the identity information most likely corresponding to the animal to be identified can be calculated based on spatial distance and probability. For example, the orange cat "Mao Mao" with id 1 has corresponding stored vectors and breed information. The spatial distance between the target animal's identification vector and the stored vector is 1, and the calculated probability that the target animal is an orange cat is 0.98, which is the highest among all breed probabilities. The probability of it being a Persian cat is 0.85, and the probability of it being a Siamese cat is 0.2, etc., which are less than 0.98. Therefore, it can be determined that the target animal matches the orange cat "Mao Mao" with id 1. If multiple stored vectors have the same spatial distance to the target vector, and these stored vectors correspond to the same cat breed, or the calculated breed probabilities are the same, multiple matching results can be output for manual verification.
[0100] In one embodiment, a matching result is obtained based on spatial distance and probability, and the identity information of the animal to be identified is determined based on the matching result; this includes: calculating the matching coefficient between the animal information stored in the image system and the animal to be identified using a preset algorithm based on spatial distance and probability; filtering out the animal information that matches the animal to be identified as the matching result based on the matching coefficient; and determining the identity information of the animal to be identified based on the matching result.
[0101] In this algorithm, the breed probability can be used as a penalty term to adjust the spatial distance value through a preset algorithm, thereby obtaining a matching coefficient. For example, the preset algorithm may include the formula K = L / P, where K is the matching coefficient, representing the spatial distance after magnification or reduction, L is the spatial distance between the vector to be identified and the stored vector, and P is the probability. It can be understood that the larger the probability value of P, the closer it is to 1, the smaller the result. Therefore, the magnitude of the breed probability L can be used to adjust the spatial distance L between multidimensional vectors, thereby obtaining the adjusted spatial distance, which is the matching coefficient K. For example, if the spatial distance L1 = 1 between the animal to be identified and the first stored vector, and the animal corresponding to this stored vector is an orange cat, the probability that the animal to be identified is an orange cat is P1 = 0.8. If the spatial distance L2 = 2 between the animal to be identified and the second stored vector, and the animal corresponding to this stored vector is a Persian cat, the probability that the animal to be identified is a Persian cat is P2 = 0.5, then K1 = 1 / 0.8 = 1.25, K2 = 2 / 0.5 = 4. K1 is less than K2, indicating that the animal corresponding to the first stored vector is a better match for the animal to be identified. In this embodiment, the smaller the spatial distance between the vector to be identified and the stored vector, the greater the probability that the animal to be identified is the species corresponding to the stored vector, and the smaller the final matching coefficient, and the higher the degree of matching between the two.
[0102] In one embodiment, to adjust the influence of variety probability on the matching coefficient, an adjustment parameter α can be set, and the variety probability can be adjusted by adjusting this parameter. For example, the formula can be modified as follows:
[0103] K = L × α / P
[0104] The value of α can adjust the degree of influence of breed probability on the matching result. It can be understood that the larger the difference between α and 1, the larger or smaller the value of α / P, and the greater the influence on the matching coefficient. α can be 1, averaging the weights of probability and spatial distance; it can be set greater than 1 to amplify the result of α / P; or it can be set less than 1 to reduce the result of α / P, thereby changing the influence on the matching coefficient. This embodiment does not impose specific limitations on the value of α and can adjust it according to the actual situation. For example, if the vector to be identified is a 2048-dimensional multidimensional vector, and it is compared with the stored vector of an orange cat in the image system, the spatial distance is calculated to be 1, denoted as L = 1; and the probability that the animal to be identified belongs to the orange cat breed is 0.5. If α is 2, it can be substituted into the algorithm to calculate K = 1 × 2 / 0.5 = 4, thus the matching coefficient between the animal to be identified and the orange cat is 4.
[0105] In one embodiment, to further improve accuracy, the formula could also be:
[0106]
[0107] Where K is the matching coefficient, representing the spatial distance after magnification or reduction; L is the spatial distance between the vector to be identified and the stored vector; α is an adjustment parameter; and P is the variety probability. This setting avoids the situation where the matching coefficient K is too large when the probability P is too small, making the variety probability term more stable in calculation with less numerical fluctuation, and also effectively improving accuracy.
[0108] This embodiment calculates the spatial distance between the animal to be identified and the stored vector, as well as the probability that the animal belongs to each animal species. The spatial distance is magnified and reduced by the probability to obtain the adjusted spatial distance as a matching coefficient. The matching coefficient is used to determine the degree of matching between the animal to be identified and the animals stored in the image system, thereby determining the matching result of the animal to be identified. This improves the accuracy of the identification method and allows for the adjustment of the weight of the species probability according to user needs, thus improving the personalization of the identification method in different scenarios.
[0109] Corresponding to the aforementioned application function implementation method embodiments, this application also provides an electronic device, a storage medium, and corresponding embodiments.
[0110] Figure 5 This is a schematic diagram of the structure of an electronic device shown in an embodiment of this application.
[0111] See Figure 5 The electronic device 1000 includes a memory 1010 and a processor 1020.
[0112] The processor 1020 can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor.
[0113] Memory 1010 may include various types of storage units, such as system memory, read-only memory (ROM), and permanent storage devices. ROM may store static data or instructions required by processor 1020 or other modules of the computer. Permanent storage devices may be read-write storage devices. Permanent storage devices may be non-volatile storage devices that retain stored instructions and data even when the computer is powered off. In some embodiments, permanent storage devices use mass storage devices (e.g., magnetic or optical disks, flash memory) as permanent storage devices. In other embodiments, permanent storage devices may be removable storage devices (e.g., floppy disks, optical drives). System memory may be a read-write storage device or a volatile read-write storage device, such as dynamic random access memory. System memory may store some or all of the instructions and data required by the processor during operation. Furthermore, memory 1010 may include any combination of computer-readable storage media, including various types of semiconductor memory chips (e.g., DRAM, SRAM, SDRAM, flash memory, programmable read-only memory), and disks and / or optical disks may also be used. In some embodiments, the memory 1010 may include a removable storage device that is readable and / or writable, such as a laser disc (CD), a read-only digital multifunction optical disc (e.g., DVD-ROM, dual-layer DVD-ROM), a read-only Blu-ray disc, a high-density optical disc, a flash memory card (e.g., SD card, mini SD card, Micro-SD card, etc.), a magnetic floppy disk, etc. Computer-readable storage media do not contain carrier waves or transient electronic signals transmitted wirelessly or via wired connections.
[0114] The memory 1010 stores executable code, which, when processed by the processor 1020, can cause the processor 1020 to execute part or all of the methods described above.
[0115] Furthermore, the method according to this application can also be implemented as a computer program or computer program product, which includes computer program code instructions for performing some or all of the steps in the method described above.
[0116] Alternatively, this application may be implemented as a computer-readable storage medium (or a non-transitory machine-readable storage medium or a machine-readable storage medium) storing executable code (or computer program or computer instruction code) thereon, which, when executed by a processor of an electronic device (or server, etc.), causes the processor to perform part or all of the steps of the methods described above according to this application.
[0117] The various embodiments of this application have been described above. These descriptions are exemplary and not exhaustive, nor are they limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen to best explain the principles, practical application, or improvement of the technology in the market, or to enable others skilled in the art to understand the embodiments disclosed herein.
Claims
1. An identity recognition method based on a convolutional neural network, characterized in that, include: Collect head and body images of the animal to be identified; The head image and the body image are processed by a convolutional neural network of an image system to generate a vector to be identified; wherein, the head image and the body image are processed by a head convolutional neural network and a body convolutional neural network of an image system to obtain a head vector corresponding to the head image and a body vector corresponding to the body image, respectively; the head vector and the body vector are fused to generate a vector to be identified. The process involves matching the vector to be identified with the stored vectors in the image system, and determining the identity information of the animal to be identified based on the matching results. Specifically, this includes calculating the spatial distance between the vector to be identified and each stored vector in the image system; calculating the probability that the animal to be identified belongs to each animal species using the species identification network in the image system based on the head image and / or the body image; calculating the matching coefficient between the animal information stored in the image system and the animal to be identified using a preset algorithm based on the spatial distance and the probability; selecting the animal information that matches the animal to be identified as the matching results based on the matching coefficient; and determining the identity information of the animal to be identified based on the matching results. The matching coefficient K is calculated using the following formula. Where L is the spatial distance between the vector to be identified and the stored vector, P is the probability that the animal to be identified belongs to each animal species, and α is an adjustment parameter.
2. The method according to claim 1, characterized in that, The step of fusing the head vector and the body vector to generate a vector to be identified includes: Multiply the head vector by a preset head coefficient to obtain the head vector to be fused; or multiply the body vector by a preset body coefficient to obtain the body vector to be fused. The body vector and the head vector are fused to generate the vector to be identified.
3. The method according to claim 1, characterized in that, The step of matching the vector to be identified with the stored vector in the image system, and determining the identity information of the animal to be identified based on the matching result, includes: Calculate the spatial distance between the vector to be identified and each stored vector in the image system; The stored vectors whose spatial distance from the vector to be identified is less than a preset distance threshold are determined as the matching vectors that match the animal to be identified; The matching result is obtained based on the matching vector and the preset mapping relationship, and the identity information of the animal to be identified is determined based on the matching result.
4. The method according to claim 3, characterized in that, The step of determining a stored vector whose spatial distance from the vector to be identified is less than a preset distance threshold is a matching vector; it also includes: When there are multiple stored vectors whose spatial distance to the vector to be identified is less than a preset distance threshold, the stored vector with the smallest spatial distance is selected as the matching vector that matches the animal to be identified.
5. The method according to claim 4, characterized in that, When there are multiple stored vectors whose spatial distance to the vector to be identified is less than a preset distance threshold, selecting the stored vector with the smallest spatial distance as the matching vector to be identified further includes: When there are multiple storage vectors with the smallest spatial distance, select multiple storage vectors as matching vectors; The matching results corresponding to multiple matching vectors are determined according to the preset mapping relationship, and output for the user to check.
6. An electronic device, characterized in that, include: processor; as well as A memory having executable code stored thereon, which, when executed by the processor, causes the processor to perform the method as described in any one of claims 1-5.
7. A computer-readable storage medium having executable code stored thereon, which, when executed by a processor of an electronic device, causes the processor to perform the method as described in any one of claims 1-5.
Citation Information
Patent Citations
Target object recognition method and device
CN111144378A
Dairy cow individual identity recognition method fusing multi-region depth features
CN111259978A
Animal identity recognition method, device and system
CN112785620A