Pet identification method and device
By calculating the texture complexity difference value of the nose pattern area and background area in the pet image and adjusting the focus distance of the shooting equipment, the problem of inaccurate pet identity recognition in the prior art is solved, and high-quality nose pattern images are obtained and accurate pet identity recognition is achieved.
Patent Information
- Application Number
- CN202510128254.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-05
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2045-02-05
AI Technical Summary
The problem of inaccurate or unrecognizable pet identity recognition in the prior art is mainly due to the difficulty in obtaining high-quality nose mark images.
By shooting a pet image by shooting a device, obtain the texture complexity of the nose and background areas, calculate the texture complexity difference value, adjust the focus distance to obtain a high-quality nose and image, and determine the identity of the pet based on the image.
Accurate identification of pets is achieved, ensuring high-quality nose pattern images are obtained, thereby improving the accuracy of identity recognition.
Smart Images

Figure CN119559672B_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of computer vision and artificial intelligence technology, and in particular, to a pet identification method and device. Background Art
[0002] With the development of society, more and more people keep pets, such as dogs. As a result, pet identification has become increasingly important. For example, nose print recognition. However, pets are different from humans. They will not actively cooperate in taking photos, which makes it more difficult to obtain high-quality nose print images. And pet identification based on nose print images with unclear nose print features has the problem of inaccurate pet identification or even failure to identify. Summary of the invention
[0003] The embodiments of the present application provide a pet identification method and device, which can solve the problem of inaccurate pet identification or the problem of being unable to identify pets in the prior art.
[0004] In a first aspect, an embodiment of the present application provides a pet identification method, comprising:
[0005] Taking a pet image based on a photographing device; wherein the pet image includes a nose print area and a background area;
[0006] Obtaining the first texture complexity of the nose print area , and obtaining the second texture complexity of the background area ;
[0007] Based on the first texture complexity And the second texture complexity , determine the texture complexity difference value;
[0008] Based on the texture complexity difference value, determine the focus distance adjustment amount ;
[0009] Based on the focus distance adjustment amount Adjusting the focus distance of the photographing device, and photographing the pet based on the photographing device after the focus distance is adjusted to obtain a nose print image;
[0010] The identity of the pet is determined based on the nose print image.
[0011] In a second aspect, an embodiment of the present application provides a pet identification device, comprising:
[0012] A shooting module, used for shooting a pet image based on a shooting device; wherein the pet image includes a nose print area and a background area;
[0013] An acquisition module, used to acquire the first texture complexity of the nose print area , and obtaining the second texture complexity of the background area ;
[0014] A difference value determination module is used to determine the difference value based on the first texture complexity. And the second texture complexity , determine the texture complexity difference value;
[0015] An adjustment amount determination module, used to determine the focus distance adjustment amount based on the texture complexity difference value ;
[0016] An adjustment module, used to adjust the amount based on the focus distance Adjusting the focus distance of the photographing device, and photographing the pet based on the photographing device after the focus distance is adjusted to obtain a nose print image;
[0017] An identity determination module is used to determine the identity of the pet based on the nose print image.
[0018] In a third aspect, an embodiment of the present application provides a computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the pet identification method described in any one of the first aspects above is implemented.
[0019] In a fourth aspect, an embodiment of the present application provides 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 pet identification method described in any one of the first aspects above is implemented.
[0020] In a fifth aspect, an embodiment of the present application provides a computer program product. When the computer program product is run on a computer device, the computer device executes the pet identification method described in any one of the first aspects above.
[0021] Compared with the prior art, the embodiment of the present application has the following beneficial effects: based on a photographing device taking a pet image, wherein the pet image includes a nose print area and a background area, a first texture complexity of the nose print area is obtained. , and obtaining the second texture complexity of the background area , based on the first texture complexity And the second texture complexity , determine the texture complexity difference value, and determine the focus distance adjustment amount based on the texture complexity difference value , based on the focus distance adjustment amount The focus distance of the shooting device is adjusted, and the pet is photographed by the shooting device after the focus distance is adjusted to obtain a nose print image, and the identity of the pet is determined based on the nose print image. The texture complexity of the nose print area and the background area is calculated, and the texture complexity difference value between the nose print and the background in the image is identified. The focus distance adjustment amount is determined based on the texture complexity difference value, and the focus distance of the shooting device is adjusted by the focus distance adjustment amount to ensure that a high-quality nose print image is obtained, thereby accurately identifying the identity of the pet.
[0022] It can be understood that the beneficial effects of the second to fifth aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0024] Figure 1 It is a flowchart of a pet identification method provided by an embodiment of the present application;
[0025] Figure 2 is a structural schematic diagram of a pet identification device provided in one embodiment of the present application;
[0026] Figure 3 It is a structural diagram of a computer device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0027] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0028] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.
[0029] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0030] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.
[0031] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0032] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0033] Figure 1 A schematic flow chart of a pet identification method provided by the present application is shown.
[0034] S101, photographing a pet image using a photographing device; wherein the pet image includes a nose print area and a background area.
[0035] The shooting device may be a variety of types of camera devices, and the specific selection depends on the application scenario and requirements. In step S101, the selection of the shooting device should be able to meet the requirement of obtaining a clear nose print image.
[0036] The nose print area refers to the texture area on the surface of the pet's nose. This area contains the texture of the pet's nose, similar to human fingerprints. The nose print is highly unique and stable and can be used as an important feature for pet identification.
[0037] The background area refers to the part of the pet image other than the nose print area, including other parts of the pet's face, hair, eyes, ears, and surrounding environment. The texture complexity of the background area is usually lower than that of the nose print area, and may contain features such as the pet's hair texture, eye reflection, and ear shape, but these features are not as important as the nose print area for pet identification.
[0038] In pet identification technology, the distinction between the nose print area and the background area is crucial to improving the accuracy of identification. By analyzing the texture complexity of the nose print area and comparing it with the texture complexity of the background area, the pet's nose print features can be more accurately extracted and identified, thereby achieving efficient pet identification.
[0039] S102, obtaining a first texture complexity of the nose print area , and obtaining the second texture complexity of the background area .
[0040] Texture complexity is a quantitative indicator used to describe the richness of texture details in an image. In pet identification technology, texture complexity is used to evaluate the texture features of the nose print area and the background area for effective image processing and identification.
[0041] Among them, texture complexity can be calculated by various methods, including but not limited to gray level co-occurrence matrix, local binary pattern, wavelet transform, etc.
[0042] The texture complexity of the nose print area is usually higher because the nose print has rich details. The texture complexity of the background area may be lower because the background may be relatively uniform or the texture does not change much. In some cases, the texture complexity of the background may also be higher, depending on the specific content of the background.
[0043] By comparing the texture complexity of the nose print area and the background area, the difference between the two can be determined. This difference helps to identify and separate the nose print area, thereby improving the accuracy of pet identification.
[0044] S103, based on the first texture complexity And the second texture complexity , determine the texture complexity difference value.
[0045] Wherein, determining the first texture complexity and the second texture complexity The first ratio , the first ratio As the texture complexity difference value, this texture complexity difference value can be used in subsequent image processing steps to help identify and separate the nose print area.
[0046] S104: Determine a focus distance adjustment amount based on the texture complexity difference value. .
[0047] Among them, the focus distance adjustment amount The calculation formula is:
[0048] ;
[0049] Among them, β is the basic proportional coefficient; is an adjustment coefficient used to adjust the focus distance according to the texture complexity ratio of the nose print area to the background area; is the first ratio; is a first area of the nose print region; is the total area of the pet image; is a function of a first area of the nose print region and a total area of the pet image.
[0050] Among them, β is the basic proportional coefficient, which provides a basic adjustment amount for the focus distance adjustment. It can be set according to the initial settings of the camera or the average performance in a specific environment. For example, if the camera focuses well under normal lighting conditions, β can be set to a smaller value, such as 0.5 or 1.0, to avoid over-adjustment.
[0051] Wherein, based on the texture complexity difference value, the focus distance adjustment amount is determined , including the following:
[0052] Case 1: When the first ratio is greater than the first preset threshold, the control The value of remains unchanged, and .
[0053] Case 2: When the first ratio is less than the first preset threshold and greater than the second preset threshold, the stability of the focus position of the shooting device within the preset time period is determined; wherein the first preset threshold is greater than the second preset threshold; if the focus position of the shooting device is in a stable state, the focus ratio is increased. The value of, and .
[0054] Case 3: If the focus position of the camera is in an unstable state, the control The value of remains unchanged, and ,in, is the focus stability coefficient.
[0055] Case 4: When the first ratio is less than the second preset threshold, for example, the first ratio is less than 1, indicating that the nose print texture is not as complex as the background texture, YOLOv5 and BiSeNet combined with target detection and semantic segmentation can be used to identify and locate the nose print area, thereby achieving precise focus and capturing clear images. Specifically:
[0056] The pet image is processed using YOLOv5, features are extracted through a convolutional neural network to obtain a high-level feature map, and the pet image is recognized based on YOLOv5 to obtain a target detection result; the pet image is processed using a detail branch of BiSeNet to obtain low-level features; the pet image is processed using a semantic branch of BiSeNet to obtain high-level features; the high-level feature map, the low-level features and the high-level features are fused to obtain a fused feature map; the fused feature map is received based on BiSeNet, and attention is refined on the fused feature map to obtain a semantic segmentation result; the nose print area is obtained according to the target detection result and the semantic segmentation result; the shutter button of the shooting device is controlled to be in a half-pressed state to obtain a focus frame; the shutter button of the shooting device is maintained in the half-pressed state, and the shooting device is moved so that the nose print area is in the focus frame; the shutter button of the shooting device is controlled to be in a fully pressed state to shoot the pet to obtain the nose print image.
[0057] Among them, when the first ratio If the value is greater than the first preset threshold, for example, greater than 3, it means that the texture complexity ratio is high, and it is considered that the texture complexity of the nose print area is significant enough, and there is no need to further adjust the focus distance according to the area ratio, nor is there any need to adjust the focus distance. . Then control The value of remains unchanged, and At this time, If it is large enough (larger than the first preset threshold), The value of remains unchanged, and In the case of The calculation formula shows that it has led to Increase, so that the camera is more inclined to focus on the nose area with more complex texture.
[0058] When the first ratio If the value is smaller than the first preset threshold and larger than the second preset threshold, for example, larger than 1 and smaller than 3, it means that the texture complexity of the nose print area is higher than that of the background area, but the difference is not particularly significant. In this case, the following measures should be taken:
[0059] Determine whether the focus position is stable within a preset time period. If the focus position is stable, it means that the focus system of the camera has successfully locked the focus on the nose print area, that is, the focus system of the camera can continuously focus on the nose print area, which indicates that the nose print area is an important feature in the image, even if the texture complexity of the nose print area is not significantly superior to that of the background area. In this case, keep This means that the adjustment of the focus distance is not affected by the ratio of the nose pattern area to the total area, because the focus is already stabilized in the nose pattern area. The value of can further ensure the focus system's preference for the nose pattern area. Even when the texture complexity is not much different, increasing the value of γ can make the focus system more inclined to focus on the nose pattern area with more complex textures. This helps to further optimize the focus quality on the basis of focus stability and ensure the clarity of the nose pattern area.
[0060] The above method helps to prioritize focusing on this key area when the texture complexity of the nose print area is not particularly high but the focus position is stable, thereby improving image quality and recognition accuracy.
[0061] If the focus position is unstable, it will cause focus instability because the focus system may switch back and forth between similar texture areas instead of focusing stably on one area. Because of this difference, the focus system does not have enough texture information to distinguish which area should be focused. To increase the weight of the nose pattern area, reduce the focus system's wandering between different areas, and help the focus system focus more on the nose pattern area. In summary, when the texture complexity is not enough to distinguish the focus area, the area information is used It can help the focus system make more reasonable decisions. Although the texture complexity of the nose print area is not high, it is reasonable to increase its weight if its area is relatively large.
[0062] in, is the focus stability coefficient, and its size may need to be adjusted according to the area of the nose print area. If the nose print area is small, a larger value to increase its weight; conversely, if the area is larger, the smaller A value of may be sufficient. It can be adjusted dynamically based on real-time focus feedback and image analysis results to adapt to different shooting conditions. and settings The purpose is to improve the stability and accuracy of the focusing system by increasing the weight of the nose pattern area when the focus is unstable.
[0063] When the first ratio is less than the second preset threshold, the nose print texture is less complex than the background texture, and the following processing is required:
[0064] In step a, the pet images are loaded and preprocessed, which may include resizing, normalizing pixel values, and enhancing images to meet the input requirements of the YOLOv5 model. The convolutional neural network of the YOLOv5 model extracts features from the preprocessed images, identifies features such as edges, textures, and shapes in the pet images, and gradually builds higher-level feature representations. As the convolutional network goes deeper, low-level features (such as edges and textures) are combined into more complex high-level features (such as parts or entirety of an object). These high-level feature maps contain key information about the target objects in the pet images. Afterwards, the YOLOv5 model uses these high-level feature maps to quickly and accurately identify the target objects in the pet images and provide basic information for subsequent image processing tasks (such as extraction of the nose print area).
[0065] In step b, the dual-branch structure of BiSeNet (including detail branch and semantic branch) is adopted to simultaneously capture the local details and global semantic information of the image.
[0066] Detail branch: This branch is designed as a shallow wide channel to capture low-level details and generate high-resolution feature representations. It extracts fine-grained spatial information in the image through a smaller network structure and direct convolution operations, thereby retaining rich spatial details.
[0067] Semantic branch: Compared with the detail branch, the semantic branch is a deep narrow channel used to obtain high-level semantic context. This branch captures high-level semantic features of the image through a deep network and obtains global context information.
[0068] Through these two branches, BiSeNet is able to process both the details and semantic information of the image, which is crucial for semantic segmentation tasks. In pet image processing, the detail branch may help identify the subtle textures of the pet, while the semantic branch helps understand the contextual relationship of the pet in the environment.
[0069] The design of BiSeNet also includes a feature fusion module and an attention optimization module, which are used to further optimize feature representation and improve segmentation performance. The feature fusion module is used to integrate features from the detail branch and the semantic branch, while the attention optimization module is used to enhance the semantic information of the features, thereby improving the accuracy of segmentation. In summary, based on BiSeNet, while maintaining real-time processing capabilities, it can effectively process pet images and perform accurate semantic segmentation.
[0070] Step c, fuse the high-level feature map, the low-level features and the high-level features to obtain a fused feature map. Specifically: Use YOLOv5 to extract the high-level feature map (Feature Map Y) of the pet image. Use the detail branch of BiSeNet to extract the low-level features (Feature Map B_s). Use the semantic branch of BiSeNet to extract the high-level features (Feature Map B_c). Perform dimensionality reduction on Feature Map Y and convert it into a compact feature representation (Compact Y) through global average pooling and fully connected layers. Enhance Feature Map B_s and Feature Map B_c and highlight important areas through the Spatial Attention Mechanism (SAM). Concatenate CompactY and Feature Map B_s in the channel dimension to form an intermediate feature map (Intermediate Feature Map, IFM_s). Concatenate IFM_s and Feature Map B_c in the spatial dimension to form an extended feature map (Extended Feature Map, EFM). A Multi-Scale Feature Fusion Module (MSFFM) is designed, which contains multiple parallel convolutional layers, each with different convolution kernel sizes to capture features of different scales. EFM is input into MSFFM to obtain Multi-Scale Fusion Feature (MSFF). A Feature Selective Enhancement Module (FSEM) is introduced to perform weighted enhancement on MSFF by learning the importance of different features. FSEM contains multiple attention mechanisms, each of which focuses on a different subset of features and selects the most informative features through a competition mechanism. The output of MSFF processed by FSEM is used as the final fused feature map (Final Fusion Feature Map, FFFM). Finally, an Optimization Module (OM) is used to fine-tune FFFM to adapt to specific task requirements, such as object detection or semantic segmentation.
[0071] In the embodiment of the present application, the feature fusion of three dimensions, channel, space and scale, is combined to provide a comprehensive feature representation. Dynamic selection and enhancement of features are achieved through FSEM, so that the model can adaptively focus on key features. MSFFM ensures the effective fusion of features of different scales and improves the model's ability to recognize objects of different sizes. A novel and efficient feature fusion method is provided to improve the performance of image processing tasks.
[0072] Step d, based on the fused feature map received by BiSeNet, the fused feature map is refined by attention to obtain the semantic segmentation result. Specifically: the obtained fused feature map FFFM is input into the BiSeNet model. This fused feature map contains rich low-level details and high-level semantic information. BiSeNet uses its unique attention mechanism to process the fused feature map. This attention mechanism can identify the key areas in the feature map and enhance the feature representation of these areas, thereby improving the accuracy of segmentation. The detail branch of BiSeNet continues to process the fused feature map to capture finer spatial details. At the same time, the semantic branch processes the fused feature map to extract more abstract semantic information. BiSeNet fuses the features of the detail branch and the semantic branch through its feature fusion module FFM. This module combines low-level detail information and high-level semantic information through layer-by-layer feature fusion. Based on feature fusion, BiSeNet applies the attention refinement module ARM to further strengthen the important features in the feature map, so that the model can pay more attention to the key parts of the image. The feature map after attention refinement is sent to the output layer of BiSeNet to generate the final semantic segmentation result. The result is a pixel-wise classification map where each pixel is assigned to a specific class label, enabling accurate segmentation of different regions in the pet image.
[0073] Step e: obtaining the nose print area according to the target detection result and the semantic segmentation result.
[0074] From the object detection results provided by YOLOv5, the facial region of the pet is identified and a bounding box is generated. Using the semantic segmentation results of BiSeNet, the pixel-level classification of the facial region of the pet is identified, providing a detailed segmentation map of the facial region, where each pixel is labeled as belonging to a part of the face. The bounding box information of the object detection is fused with the pixel-level information of the semantic segmentation, which can be achieved by superimposing the bounding box on the segmentation map or by restricting the segmentation result within the bounding box to enhance the feature representation of the nose print region. An attention mechanism is applied to the fused feature map to further highlight the features of the nose print region. In the fused feature map that highlights the features of the nose print region, the nose print region is identified. The bounding box of the object detection is used to accurately locate the nose print region and the final nose print region is output. This can be an exact bounding box or a pixel-level mask of the nose print region. Through this process, it can be ensured that the nose print region is accurately extracted from the pet image.
[0075] Step f, controlling the shutter button of the photographing device to be in a half-pressed state to obtain a focus frame; maintaining the shutter button of the photographing device in the half-pressed state, moving the photographing device so that the nose print area is in the focus frame; controlling the shutter button of the photographing device to be in a full-pressed state, photographing the pet, and obtaining the nose print image. Specifically:
[0076] Aim the camera at the nose print area of the pet, and control the shutter button of the camera device to be half-pressed through control commands until the camera emits a prompt sound or displays focus confirmation (usually a green focus frame). After the camera confirms the focus, keep the shutter button half-pressed and do not release it completely. This step is to lock the focus and ensure that the camera does not refocus on other areas. While keeping the shutter button half-pressed, control the camera device to move gently through control commands so that the nose print area is in the focus frame. This step is to recompose and ensure that the position of the nose print area in the picture meets your requirements. Once the nose print area is in the focus frame and the composition is satisfactory, control the shutter button of the camera device to be fully pressed through control commands, shoot the pet, and obtain the nose print image.
[0077] Among them, although the above control instructions are all called control instructions, their corresponding functions are different and will not be described in detail here.
[0078] Through the above steps, the focus and composition of the shooting equipment can be controlled more accurately to ensure that high-quality pet nose print images are captured.
[0079] S105, based on the focus distance adjustment amount The focusing distance of the photographing device is adjusted, and the pet is photographed based on the photographing device after the focusing distance is adjusted to obtain a nose print image.
[0080] Among them, the focus distance adjustment amount and current focus distance The sum of the values is used as the adjusted focus distance. ; Based on the adjusted focus distance The pet is photographed to obtain the nose print image.
[0081] S106, determining the identity of the pet based on the nose print image.
[0082] Among them, the identity of the pet is determined by comparing the nose print image with the nose print data in the database.
[0083] In the embodiment of the present application, a pet image is captured by a photographing device, wherein the pet image includes a nose print area and a background area, and a first texture complexity of the nose print area is obtained. , and obtaining the second texture complexity of the background area , based on the first texture complexity And the second texture complexity , determine the texture complexity difference value, and determine the focus distance adjustment amount based on the texture complexity difference value , based on the focus distance adjustment amount The focus distance of the shooting device is adjusted, and the pet is photographed by the shooting device after the focus distance is adjusted to obtain a nose print image, and the identity of the pet is determined based on the nose print image. The texture complexity of the nose print area and the background area is calculated, and the texture complexity difference value between the nose print and the background in the image is identified. The focus distance adjustment amount is determined based on the texture complexity difference value, and the focus distance of the shooting device is adjusted by the focus distance adjustment amount to ensure that a high-quality nose print image is obtained, thereby accurately identifying the identity of the pet.
[0084] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0085] Figure 2 A structural block diagram of a pet identification device provided in an embodiment of the present application is shown. For ease of explanation, only the parts related to the embodiment of the present application are shown.
[0086] Reference Figure 2 , the pet identification device comprises:
[0087] A shooting module, used for shooting a pet image based on a shooting device; wherein the pet image includes a nose print area and a background area;
[0088] An acquisition module, used to acquire the first texture complexity of the nose print area , and obtaining the second texture complexity of the background area ;
[0089] A difference value determination module is used to determine the difference value based on the first texture complexity. And the second texture complexity , determine the texture complexity difference value;
[0090] An adjustment amount determination module, used to determine the focus distance adjustment amount based on the texture complexity difference value ;
[0091] An adjustment module, used to adjust the amount based on the focus distance Adjusting the focus distance of the photographing device, and photographing the pet based on the photographing device after the focus distance is adjusted to obtain a nose print image;
[0092] An identity determination module is used to determine the identity of the pet based on the nose print image.
[0093] It should be noted that the information interaction, execution process and other contents between the above-mentioned modules are based on the same concept as the method embodiment of the present application. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.
[0094] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 3 As shown. The computer device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a pet identification method is implemented.
[0095] Those skilled in the art will understand that Figure 3 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0096] In one embodiment, a computer device is provided, comprising: a memory, a processor, and a pet identification program stored in the memory and executable on the processor, wherein the pet identification program, when executed by the processor, implements the steps of the pet identification method described in any of the above embodiments.
[0097] In one embodiment, a computer-readable storage medium is provided, on which a pet identification program is stored. When the pet identification program is executed by a processor, the steps of the pet identification method described in any of the above embodiments are implemented.
[0098] In one embodiment, a computer program product is provided, the computer program product comprising a pet identification program, and the pet identification program, when executed by a processor, implements the steps of the pet identification method as described in any of the above embodiments.
[0099] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0100] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0101] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A pet identification method, characterized in that: include: Taking a pet image based on a photographing device; wherein the pet image includes a nose print area and a background area; Obtaining the first texture complexity of the nose print area , and obtaining the second texture complexity of the background area ; Based on the first texture complexity And the second texture complexity , determine the texture complexity difference value; Based on the texture complexity difference value, determine the focus distance adjustment amount ; Based on the focus distance adjustment amount Adjusting the focus distance of the photographing device, and photographing the pet based on the photographing device after the focus distance is adjusted to obtain a nose print image; determining the identity of the pet based on the nose print image; Wherein, the first texture complexity is based on And the second texture complexity , determining a texture complexity difference value, including: determining the first texture complexity and the second texture complexity , and taking the first ratio as the texture complexity difference value; Among them, the focus distance adjustment amount The calculation formula is: ; Among them, β is the basic proportional coefficient, is the adjustment factor, is the first ratio, is the first area of the nose print region, is the total area of the pet image, is a function of a first area of the nose print region and a total area of the pet image; Wherein, the focus distance adjustment amount is determined based on the texture complexity difference value. ,include: When the first ratio is greater than a first preset threshold, the control The value of remains unchanged, and ; When the first ratio is less than the first preset threshold and greater than the second preset threshold, the stability of the focus position of the photographing device within the preset time period is determined; wherein the first preset threshold is greater than the second preset threshold; If the focus position of the photographing device is in a stable state, increase The value of, and ; When the first ratio is less than the second preset threshold, the pet image is processed using YOLOv5, features are extracted through a convolutional neural network to obtain a high-level feature map, and the pet image is recognized based on YOLOv5 to obtain a target detection result; Processing the pet image using the detail branch of BiSeNet to obtain low-level features; Processing the pet image using the semantic branch of BiSeNet to obtain high-level features; Fusing the high-level feature map, the low-level features, and the high-level features to obtain a fused feature map; Based on BiSeNet, the fused feature map is received and attention is refined to obtain the semantic segmentation result; Obtaining the nose print region according to the target detection result and the semantic segmentation result; Controlling the shutter button of the photographing device to be in a half-pressed state to obtain a focus frame; Maintaining the shutter button of the photographing device in the half-pressed state, moving the photographing device so that the nose print area is in the focus frame; Controlling the shutter button of the photographing device to be in a fully pressed state, photographing the pet, and obtaining the nose print image; Wherein, the focusing distance adjustment amount is based on The method comprises: adjusting the focus distance of the photographing device, photographing the pet based on the photographing device after adjusting the focus distance, and obtaining a nose print image, including: The focus distance adjustment amount and current focus distance The sum of the values is used as the adjusted focus distance. ; Based on the adjusted focus distance The pet is photographed to obtain the nose print image.
2. The pet identification method according to claim 1, characterized in that: The method further comprises: If the focus position of the photographing device is in an unstable state, control The value of remains unchanged, and ,in, is the focus stability coefficient.
3. A pet identification device, characterized in that: include: A shooting module, used for shooting a pet image based on a shooting device; wherein the pet image includes a nose print area and a background area; An acquisition module, used to acquire the first texture complexity of the nose print area , and obtaining the second texture complexity of the background area ; A difference value determination module is used to determine the difference value based on the first texture complexity. And the second texture complexity , determine the texture complexity difference value; An adjustment amount determination module, used to determine the focus distance adjustment amount based on the texture complexity difference value ; An adjustment module, used to adjust the amount based on the focus distance Adjusting the focus distance of the photographing device, and photographing the pet based on the photographing device after the focus distance is adjusted to obtain a nose print image; an identity determination module, configured to determine the identity of the pet based on the nose print image; Wherein, the first texture complexity is based on And the second texture complexity , determining a texture complexity difference value, including: determining the first texture complexity and the second texture complexity , and taking the first ratio as the texture complexity difference value; Among them, the focus distance adjustment amount The calculation formula is: ; Among them, β is the basic proportional coefficient, is the adjustment factor, is the first ratio, is the first area of the nose print region, is the total area of the pet image, is a function of a first area of the nose print region and a total area of the pet image; Wherein, the focus distance adjustment amount is determined based on the texture complexity difference value. ,include: When the first ratio is greater than a first preset threshold, the control The value of remains unchanged, and ; When the first ratio is less than the first preset threshold and greater than the second preset threshold, the stability of the focus position of the photographing device within the preset time period is determined; wherein the first preset threshold is greater than the second preset threshold; If the focus position of the photographing device is in a stable state, increase The value of, and ; When the first ratio is less than the second preset threshold, the pet image is processed using YOLOv5, features are extracted through a convolutional neural network to obtain a high-level feature map, and the pet image is recognized based on YOLOv5 to obtain a target detection result; Processing the pet image using the detail branch of BiSeNet to obtain low-level features; Processing the pet image using the semantic branch of BiSeNet to obtain high-level features; Fusing the high-level feature map, the low-level features, and the high-level features to obtain a fused feature map; Based on BiSeNet, the fused feature map is received and attention is refined to obtain the semantic segmentation result; Obtaining the nose print region according to the target detection result and the semantic segmentation result; Controlling the shutter button of the photographing device to be in a half-pressed state to obtain a focus frame; Maintaining the shutter button of the photographing device in the half-pressed state, moving the photographing device so that the nose print area is in the focus frame; Controlling the shutter button of the photographing device to be in a fully pressed state, photographing the pet, and obtaining the nose print image; Wherein, the focusing distance adjustment amount is based on The method comprises: adjusting the focus distance of the photographing device, photographing the pet based on the photographing device after adjusting the focus distance, and obtaining a nose print image, including: The focus distance adjustment amount and current focus distance The sum of the values is used as the adjusted focus distance. ; Based on the adjusted focus distance The pet is photographed to obtain the nose print image.
4. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 2 is implemented.
5. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 2 is implemented.
6. A computer program product, characterized in that When the computer program product is executed on a computer device, the computer device is caused to execute the method according to any one of claims 1 to 2.
Citation Information
Patent Citations
Auxiliary shooting method, terminal equipment and computer readable storage medium
CN113037990A
Pet identity verification method based on living body detection and related product
CN114973315A