Cat face detection method, device, equipment and medium

By collecting video stream data in real time, judging potential identification objects, determining fill light parameters for fill light and cat eye detection, the problem of low accuracy of cat face detection is solved, and the accuracy of cat face recognition is significantly improved.

CN119516579AInactive Publication Date: 2025-02-25SHENZHEN ZHIHUI BOJIA TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411580788.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-07
Publication Date
2025-02-25
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

In the prior art, the accuracy of cat face detection is not high, mainly due to the diversity and complexity of cat face characteristics, the error detection rate is high.

Method used

The camera collects video stream data in real time, determines whether a potential identification object appears, and determines the fill light parameters based on the location information to fill light, collects the video stream data during the fill light process, and performs cat eye detection on the data. If cat eye is detected, identification information will be generated.

Benefits of technology

The response of cat's eyes was detected after filling light operation, which improved the accuracy of cat's face recognition and reduced the error detection rate.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 00000000_0000_ABST
    Figure 00000000_0000_ABST
Patent Text Reader

Abstract

The invention relates to a cat face detection method and device, equipment and a medium. The method comprises the steps of collecting first video stream data in a preset area in real time through a camera; judging whether a potential identification object appears in the first video stream data or not; if the potential identification object appears, determining position information corresponding to the potential identification object; determining light supplementing parameters according to the position information, wherein the light supplementing parameters comprise a plurality of groups of corresponding light supplementing intensities and light supplementing durations; controlling a light supplement lamp to supplement light according to the light supplement parameters, and collecting second video stream data in the light supplement process; performing cat eye detection on the second video stream data, and judging whether the second video stream contains a cat eye or not; and if the cat eye is included, generating identification information of detecting the cat face. According to the invention, the accuracy of cat face recognition is greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer vision technology, and in particular to a cat face detection method, device, equipment and medium. Background Art

[0002] As an important task in the field of computer vision, cat face detection is closely related to the rapid progress of computer vision and artificial intelligence technology. With the continuous evolution of technology, cat face detection has shown great application potential in many fields, including but not limited to AI monitoring, urban pet management, smart pet devices, and smart pet access control. These application scenarios require not only high accuracy of cat face detection, but also the ability to adapt to complex and changing environmental conditions to ensure effective recognition of cat faces under various lighting, angles, and postures.

[0003] In the smart pet access control system, the application of cat face detection technology is particularly critical. By real-time monitoring and accurate identification of cat faces, the system can quickly respond to door opening commands and provide convenient access for pets. At the same time, combined with the pet identification and filing function, cat face detection can also synchronously obtain information about pets and their owners, achieving precise and efficient pet management. In addition, in AI monitoring and urban pet management, cat face detection technology helps monitoring personnel to promptly detect and handle abnormal situations, ensure pet safety, and maintain urban order.

[0004] However, although cat face detection technology has shown broad application prospects in many fields, the existing technology still has the problem of low accuracy of cat face detection. This is mainly due to the diversity and complexity of cat face features. In complex and changeable actual application scenarios, existing cat face detection algorithms often have difficulty in accurately identifying cat faces, resulting in a high false positive rate. Summary of the invention

[0005] The main purpose of the present invention is to provide a cat face detection method, device, equipment and medium to solve the problem of low accuracy of cat face detection in the prior art.

[0006] To achieve the above object, the first aspect of the present invention provides a cat face detection method, which is applied to an electronic device, wherein the electronic device includes a camera and a fill light, and the method includes:

[0007] Collecting first video stream data in a preset area in real time through the camera;

[0008] Determining whether a potential identifiable object appears in the first video stream data;

[0009] If the potential identification object appears, determining the location information corresponding to the potential identification object;

[0010] Determine fill light parameters according to the position information, the fill light parameters including multiple groups of corresponding fill light intensities and fill light durations;

[0011] Controlling the fill light to perform fill light according to the fill light parameters, and collecting the second video stream data during the fill light process;

[0012] Performing cat's eye detection on the second video stream data to determine whether the second video stream contains a cat's eye;

[0013] If the cat's eyes are included, identification information that a cat's face is detected is generated.

[0014] Furthermore, the step of determining whether a potential identification object appears in the first video stream data includes:

[0015] Extracting a single frame image from the first video stream data at a preset time interval;

[0016] Determine whether the single frame image currently acquired has changed compared with the single frame image extracted last time;

[0017] If yes, the single frame image currently captured is input into a pre-trained target detection model, where the target detection model is pre-trained to identify whether there is a cat in the image;

[0018] Obtaining the output result of the target detection model, and determining whether the output result indicates that there is a cat;

[0019] If so, it is determined that the potential identifiable object appears, and a bounding box is generated outside the potential identifiable object.

[0020] Furthermore, the electronic device further comprises an infrared distance measuring device, and if the potential identification object appears, the step of determining the position information corresponding to the potential identification object comprises:

[0021] Extracting coordinate information of the bounding box from the single-frame image, the coordinate information including upper left corner coordinates and lower right corner coordinates;

[0022] Calculate the center point coordinates of the potential identification object according to the upper left corner coordinates and the lower right corner coordinates;

[0023] Determine the object direction of the potential identification object relative to the infrared ranging device according to the central coordinates;

[0024] Controlling the infrared ranging device to transmit an infrared signal in the direction of the object, and receiving the reflected signal, and calculating the straight-line distance between the potential identification object and the infrared ranging device;

[0025] The position information of the potential identification object in the three-dimensional space is calculated based on the straight-line distance and the center point coordinates.

[0026] Furthermore, the step of determining fill light parameters according to the position information includes:

[0027] Calculating the fill light distance between the potential identifiable object and the fill light, and the fill light orientation of the potential identifiable object relative to the fill light according to the position information;

[0028] According to a preset fill light distance-light intensity correspondence relationship, a fill light intensity sequence corresponding to the fill light distance is generated, and the fill light intensity sequence is combined with a preset fill light duration sequence to generate the fill light parameters.

[0029] Furthermore, the step of controlling the fill light to perform fill light according to the fill light parameters and collecting the second video stream data during the fill light process includes:

[0030] Controlling the fill light to turn to the fill light position;

[0031] Controlling the fill light to perform fill light in sequence according to the fill light intensity and corresponding fill light duration;

[0032] Under each of the fill light intensity conditions, the potential identifiable object is tracked and captured by a camera to obtain the second video stream data.

[0033] Furthermore, the step of performing cat's eye detection on the second video stream data to determine whether the second video stream contains a cat's eye includes:

[0034] Extracting the last frame of image captured within the fill light duration of each fill light intensity from the second video stream data, and generating an image combination, wherein the image combination includes a plurality of images and corresponding fill light intensities;

[0035] Determining whether each image in the image combination contains eye information;

[0036] If yes, extracting the eye information from each image in the image combination;

[0037] Input each of the eye information and the corresponding fill light intensity into a pre-trained cat eye recognition model to determine whether the eye information matches the cat eye;

[0038] If so, it is determined that the second video stream contains Cat's Eye.

[0039] Furthermore, the steps of the cat's eye recognition model include:

[0040] Obtain a training data set and a verification data set, wherein the training data set includes multiple groups of eye sample images under different light intensities and corresponding labels, and the eye sample images include cat eye images and non-cat eye images;

[0041] The training data set is input into a preset neural network model, and a loss function is set, and training is performed by supervised learning to obtain a temporary recognition model, wherein the loss function formula is:

[0042]

[0043] in, represents the loss function, y i represents the true label, Represents the predicted label, and N represents the number of samples;

[0044] Using the verification data set to verify the temporary recognition model to obtain a verification result;

[0045] Determine whether the verification result is passed;

[0046] If passed, the temporary recognition model is used as the cat's eye recognition model.

[0047] A second aspect of the present invention provides a cat face detection device, which is arranged in an electronic device, wherein the electronic device includes a camera and a fill light, and the device includes:

[0048] A collection module, used for collecting first video stream data in a preset area in real time through the camera;

[0049] A first determination module, used to determine whether a potential identification object appears in the first video stream data;

[0050] A position determination module, used for determining the position information corresponding to the potential identification object if the potential identification object appears;

[0051] A fill light parameter determination module, used to determine fill light parameters according to the position information, wherein the fill light parameters include a plurality of groups of corresponding fill light intensities and fill light durations;

[0052] A fill light module, used for controlling the fill light to perform fill light according to the fill light parameters, and collecting the second video stream data during the fill light process;

[0053] A second judgment module is used to perform cat's eye detection on the second video stream data to determine whether the second video stream contains a cat's eye;

[0054] The cat face determination module is used to generate identification information of the detected cat face if the cat's eyes are included.

[0055] A third aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the steps of the above-mentioned cat face detection method when executed by a processor.

[0056] A fourth aspect of the present invention provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above-mentioned cat face detection method when executing the computer program.

[0057] The cat face detection method, device, equipment and medium provided by the present invention, the method collects the first video stream data in a preset area in real time through a camera, and determines whether a potential identifiable object appears in the first video stream data; if the potential identifiable object appears, determines the position information corresponding to the potential identifiable object; determines the fill light parameters according to the position information, and the fill light parameters include multiple groups of corresponding fill light intensities and fill light durations; controls the fill light to perform fill light according to the fill light parameters, and collects the second video stream data during the fill light process; performs cat eye detection on the second video stream data to determine whether the second video stream contains cat eyes; if the cat eyes are contained, generates identification information of the detected cat face; after identifying the potential identifiable object, further performs fill light operation on the potential identifiable object according to the position information of the object, and further detects the reaction of the cat eyes after the fill light operation, because the cat eyes have a special change response to the change of light intensity, thereby greatly improving the accuracy of cat face recognition. BRIEF DESCRIPTION OF THE DRAWINGS

[0058] Figure 1 is a schematic flow chart of a cat face detection method in one embodiment of the present invention;

[0059] Figure 2 is a schematic block diagram of the structure of a cat face detection device in one embodiment of the present invention;

[0060] Figure 3 It is a schematic block diagram of the structure of a computer device according to an embodiment of the present invention.

[0061] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0062] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.

[0063] Reference Figure 1 The embodiment of the present invention provides a cat face detection method, which is applied to an electronic device, wherein the electronic device includes a camera and a fill light, and the method includes:

[0064] S1, collecting first video stream data in a preset area in real time through the camera;

[0065] S2, determining whether a potential identification object appears in the first video stream data;

[0066] S3. If the potential identification object appears, determine the location information corresponding to the potential identification object;

[0067] S4. Determine fill light parameters according to the position information, where the fill light parameters include multiple groups of corresponding fill light intensities and fill light durations;

[0068] S5, controlling the fill light to perform fill light according to the fill light parameters, and collecting the second video stream data during the fill light process;

[0069] S6, performing cat's eye detection on the second video stream data to determine whether the second video stream contains a cat's eye;

[0070] S7. If the cat's eyes are included, identification information of the detected cat face is generated.

[0071] In the present invention, in the above step S1, the camera of the electronic device is usually in a continuously turned-on device, and a preset area monitored by the camera is pre-set. The preset area can be adjusted according to actual needs, such as being set to a pet activity area or a doorway, etc. The camera collects video stream data in the preset area in real time at a preset frame rate (such as 30 frames per second), that is, the first video stream data. The first video stream data includes a series of continuous image frames.

[0072] In the above step S2, an image processing algorithm (such as background subtraction, motion detection, etc.) is used to determine whether a potential identifiable object appears in the video stream.

[0073] In a specific embodiment, the potential identification object can be any moving object, and when there is a moving object, the subsequent steps are entered for further identification, so as to reduce the amount of calculation for subsequent processing and improve the operating efficiency of the system.

[0074] In another specific implementation, the step S2 of determining whether a potential identifiable object appears in the first video stream data includes:

[0075] S201, extracting a single frame image from the first video stream data at a preset time interval;

[0076] S202, determining whether the single frame image currently acquired has changed compared with the single frame image extracted last time;

[0077] S203: If yes, input the currently acquired single frame image into a pre-trained target detection model, where the target detection model is pre-trained to identify whether there is a cat in the image;

[0078] S204, obtaining the output result of the target detection model, and determining whether the output result indicates that there is a cat;

[0079] S205: If yes, determine that the potential identifiable object appears, and generate a bounding box outside the potential identifiable object.

[0080] In this embodiment, in the above step S201, the amount of data for image processing is reduced by setting the above preset duration, while ensuring sufficient capture capability of dynamic changes in the first video stream. The above preset duration can be set to, for example, 0.5 seconds or 1 second.

[0081] In the above step S202, it is possible to determine whether a single frame image has changed by calculating the pixel difference between the two frames, structural similarity (such as SSIM) or using image feature point matching. By comparing image changes, image frames containing dynamic objects can be quickly screened out, reducing unnecessary calculations for subsequent target detection.

[0082] In the above steps S203-S204, if the currently extracted single frame image has changed compared with the last time, it indicates that a new dynamic object may have appeared. The single frame image is input into a pre-trained target detection model. The above target detection model is a deep learning model, which has been trained with a large amount of cat image data to identify whether there is a cat in the image. The target detection model performs target detection on the input single frame image and outputs the detection result, indicating whether there is a cat in the image.

[0083] Specifically, the target detection model can adopt the YOLOv8 model or other target detection models in the prior art. Before performing cat face detection, the single frame image can also be preprocessed. For example, the single frame image is preprocessed by normalization, equalization and other methods; the image is convolved by a trained neural network model to extract features, and cat image detection is performed based on the extracted features; the detection result is compared with a set threshold, and if the confidence in the detection result exceeds the set threshold, it is determined whether there is a cat in the image.

[0084] In the above step S205, if the output result of the target detection model indicates that there is a cat in the image, the electronic device will determine that a potential identifiable object appears in the current image. The above potential identifiable object is a cat detected by the target detection model, but because there may be misjudgment, it is first regarded as a potential identifiable object. If it passes the detection of the subsequent steps, it is then regarded as a confirmed cat face. For the needs of the subsequent detection steps, a bounding box is generated around the identified potential identifiable object to clearly identify the location of the potential identifiable object.

[0085] This embodiment determines whether a potential identification object appears in the first video stream data and defines an accurate target area through the above steps S201-S205, which not only improves the accuracy of cat face detection, reduces the amount of data processing in subsequent steps, but also ensures the efficiency of the entire detection process.

[0086] In the above step S3, after the potential identification object is detected, the electronic device uses an image processing algorithm to determine the specific position information of the object in the video frame. The position information may include the center coordinates, bounding box, etc. of the object.

[0087] In a specific embodiment, the electronic device further includes an infrared distance measuring device, and if the potential identification object appears, the step S3 of determining the position information corresponding to the potential identification object includes:

[0088] S301, extracting coordinate information of the bounding box from the single-frame image, the coordinate information including upper left corner coordinates and lower right corner coordinates;

[0089] S302, calculating the center point coordinates of the potential identification object according to the upper left corner coordinates and the lower right corner coordinates;

[0090] S303, determining the object direction of the potential identification object relative to the infrared ranging device according to the central coordinates;

[0091] S304, controlling the infrared ranging device to transmit an infrared signal in the direction of the object, and receiving a reflected signal, and calculating a straight-line distance between the potential identification object and the infrared ranging device;

[0092] S305: Calculate the position information of the potential identification object in the three-dimensional space according to the straight-line distance and the center point coordinates.

[0093] In this embodiment, in the above step S301, the potential object is identified by the target detection model in the previous step, and a bounding box is generated around it. The coordinate information of the bounding box extracted in this step usually includes the upper left corner coordinates (x1, y1) and the lower right corner coordinates (x2, y2). These two coordinate points define the position and size of the bounding box in the image, which are used for the subsequent calculation of the center point coordinates and the object direction.

[0094] In the above step S302, the calculation formula of the above center point coordinates is: c =(x1+x2) / 2,y c =(y1+y2) / 2. The center point coordinates are used to indicate the approximate position of the potential recognition object in the image.

[0095] In the above step S303, the object direction of the potential identification object relative to the infrared ranging device can be calculated based on the center point coordinates and the installation position and installation direction of the infrared ranging device. For example, this can be achieved by calculating the angle between the line connecting the center point coordinates and the center point of the infrared ranging device and the main optical axis of the infrared ranging device.

[0096] In the above step S304, after determining the direction of the object, the electronic device controls the infrared ranging device to transmit an infrared signal in the direction of the object. After encountering the potential identification object, the infrared signal will be reflected back and received by the infrared ranging device. By measuring the time difference from the emission to the reception of the infrared signal, the propagation distance of the infrared signal in the air is calculated, and then the straight-line distance between the potential identification object and the infrared ranging device is obtained.

[0097] In the above step S305, after obtaining the straight-line distance and center point coordinates between the potential identification object and the infrared ranging device, the position information of the potential identification object in three-dimensional space can be calculated. For example, the position information can be expressed as three-dimensional spatial coordinates in the spatial coordinate axis, or it can be expressed as a relative position with respect to a fixed object. The embodiment of the present invention does not impose any special constraints on this, as long as it can reflect the direction of the potential identification object (relative angle with the camera), the straight-line distance with the camera / fill light / infrared ranging device, etc. Therefore, the position information can provide accurate target position information for subsequent steps such as fill light parameter determination and cat's eye detection, thereby improving the accuracy and reliability of the entire cat face detection system.

[0098] This embodiment effectively determines the position information of the potential identification object in the three-dimensional space through the above steps S301-305, and provides accurate target area and distance information for subsequent processing steps.

[0099] In the above step S4, fill light parameters are determined based on the position information of the potential recognition object and the preset fill light strategy. The fill light parameters include multiple sets of corresponding fill light intensity and fill light duration. For example, when the object is close to the camera, a lower fill light intensity and a shorter fill light duration can be selected; when the ambient light is weak, the fill light intensity and fill light duration can be increased.

[0100] In a specific implementation, the step S4 of determining fill light parameters according to the position information includes:

[0101] S401, calculating the fill light distance between the potential identifiable object and the fill light, and the fill light orientation of the potential identifiable object relative to the fill light according to the position information;

[0102] S402: Generate a fill light intensity sequence corresponding to the fill light distance according to a preset fill light distance-light intensity correspondence relationship, and combine the fill light intensity sequence with a preset fill light duration sequence to generate the fill light parameters.

[0103] In this embodiment, in the above step S401, the calculation of the fill light distance can be achieved by calculating the straight-line distance between the center point of the potential identifiable object and the center point of the fill light. The calculation of the fill light orientation needs to be based on the installation position and direction of the fill light and the position information of the potential identifiable object, and the azimuth of the potential identifiable object relative to the fill light is obtained through geometric calculation. In order to reduce calculations, the fill light can be installed near the camera, so that the straight-line distance in the aforementioned position information can be directly used as the fill light distance, and the relative angle can be used as the fill light orientation.

[0104] In the above step S402, the above preset fill light distance-light intensity correspondence relationship is based on experimental data or experience, and is pre-set in the memory of the electronic device. The fill light duration sequence is set according to actual needs. For example, in order to ensure image quality, a longer fill light duration can be set; and in order to save energy, a shorter fill light duration can be set.

[0105] In the above step S5, according to the determined fill light parameters, the fill light is controlled to turn on and perform fill light operation. The fill light illuminates the potential identification object area within the specified light intensity and duration. At the same time, the camera continues to collect video stream data during the fill light process, that is, the second video stream data.

[0106] In a specific embodiment, the step S5 of controlling the fill light to perform fill light according to the fill light parameters and collecting the second video stream data during the fill light process includes:

[0107] S501, controlling the fill light to turn to the fill light position;

[0108] S502, controlling the fill light to perform fill light in sequence according to the fill light intensity and corresponding fill light duration;

[0109] S503: Under each fill light intensity condition, the potential identifiable object is tracked and collected by a camera to obtain the second video stream data.

[0110] In this embodiment, in the above step S501, the filling light can be turned by a turning mechanism, such as a stepping motor, a servo motor, etc. By controlling the filling light to turn to the filling light orientation, it is ensured that the filling light fills the potential recognition object in the correct direction, thereby improving the filling light effect and image quality.

[0111] In the above step S502, the fill light is controlled by the dimming mechanism and timer of the fill light to perform fill light in sequence according to the fill light intensity and the corresponding fill light duration. The dimming control can be achieved by changing the input voltage, current or duty cycle of the fill light, so as to adjust the light intensity of the fill light. The timer is used to record the fill light duration of the fill light under each light intensity condition to ensure that the fill light can perform fill light according to the preset fill light duration.

[0112] In the above step S503, during the fill light process, the camera is used to track and collect the potential identifiable object to obtain the second video stream data during the fill light process. Furthermore, the aforementioned preset area can be further reduced to the area where the potential identifiable object is located by adjusting the focal length of the camera, thereby facilitating the improvement of the speed of subsequent image processing.

[0113] In the above step S6, cat's eye detection is performed on the second video stream data. In a specific implementation, a cat's eye detection model trained by a deep learning algorithm (such as a convolutional neural network CNN) can be used for detection. The cat's eye detection model can identify cat's eye features in a video frame and determine whether a cat's eye exists.

[0114] In a specific embodiment, the step S6 of performing cat's eye detection on the second video stream data to determine whether the second video stream contains a cat's eye includes:

[0115] S601, extracting the last frame of image collected within the fill light duration of each fill light intensity from the second video stream data, and generating an image combination, wherein the image combination includes multiple images and corresponding fill light intensities;

[0116] S602, determining whether each image in the image combination contains eye information;

[0117] S603: If yes, extract the eye information from each image in the image combination;

[0118] S604, inputting each of the eye information and the corresponding fill light intensity into a pre-trained cat eye recognition model to determine whether the eye information matches the cat eye;

[0119] S605: If yes, determine that the second video stream contains Cat's Eye.

[0120] In this embodiment, in the above step S601, the last frame of image captured within the fill light duration of each fill light intensity is extracted from the second video stream data, so as to obtain a clear image of the potential identifiable object under each fill light condition. And it is ensured that the eyes of the potential identifiable object have received light stimulation for a sufficient time and made a corresponding eye response. The extracted images are arranged in the order of fill light intensity to generate an image combination containing multiple images and corresponding fill light intensity.

[0121] In the above step S602, image processing techniques (such as edge detection, morphological processing, etc.) are used to determine whether each image in the image combination contains eye information. Eye information generally includes features such as eye shape, color, texture, pupil size, etc.

[0122] In the above step S603, eye information is extracted from the image containing eye information using image processing technology (such as image segmentation, feature extraction, etc.). The extracted eye information will include key features such as the shape, size, and position of the eye, and the shape, size, and position of the pupil. These features will be used as input data for subsequent cat's eye detection, and will be used for matching and judging with the pre-trained cat's eye recognition model.

[0123] In the above step S604, each extracted eye information and the corresponding fill light intensity are input into a pre-trained cat's eye recognition model. The cat's eye recognition model is a classifier based on machine learning or deep learning technology, which can classify and judge the input eye information to determine whether it matches the cat's eye. The training process of the cat's eye recognition model usually includes collecting a large amount of image data containing cat's eyes, extracting eye information as features, and then using these features and corresponding labels (i.e., whether it is a cat's eye) to train the model. The trained model will be able to accurately identify whether the eye information matches the cat's eye.

[0124] In a specific embodiment, the steps of the cat's eye recognition model include:

[0125] S01. Obtain a training data set and a verification data set, wherein the training data set includes multiple groups of eye sample images under different light intensities and corresponding labels, and the eye sample images include cat's eye images and non-cat's eye images;

[0126] S01. Input the training data set into a preset neural network model, set a loss function, and perform training processing by supervised learning to obtain a temporary recognition model, wherein the loss function formula is:

[0127]

[0128] in, represents the loss function, y i represents the true label, Represents the predicted label, and N represents the number of samples;

[0129] S02, using the verification data set to verify the temporary recognition model to obtain a verification result;

[0130] S03, judging whether the verification result is passed;

[0131] S04: If passed, the temporary recognition model is used as the cat's eye recognition model.

[0132] In the above step S605, if the cat's eye recognition model determines that the eye information matches the cat's eye, then it is determined that the second video stream contains the cat's eye. This determination result can provide a basis for subsequent processing, such as triggering an alarm, recording a log, sending a notification, etc.

[0133] Through the above steps S601-S605, based on the special cat's eye reaction to light of different light intensities, the cat's eye detection can be accurately performed on the second video stream data, and it can be determined whether the second video stream contains a cat's eye.

[0134] In the above step S7, when the cat's eye is detected, the presence of the cat's face is confirmed and identification information of the detected cat's face is generated. The identification information may include the location, size, timestamp, etc. of the cat's face. At the same time, subsequent operations may be further triggered, such as opening the door, recording a log, sending a notification, etc.

[0135] The embodiment of the present invention collects the first video stream data in a preset area in real time through a camera, and determines whether a potential identifiable object appears in the first video stream data; if the potential identifiable object appears, determines the position information corresponding to the potential identifiable object; determines the fill light parameters according to the position information, and the fill light parameters include multiple groups of corresponding fill light intensities and fill light durations; controls the fill light to perform fill light according to the fill light parameters, and collects the second video stream data during the fill light process; performs cat's eye detection on the second video stream data to determine whether the second video stream contains cat's eyes; if the cat's eyes are contained, generates identification information of the detected cat face; after identifying the potential identifiable object, further performs fill light operation on the potential identifiable object according to the position information of the object, and further detects the reaction of the cat's eyes after the fill light operation, because the cat's eyes have a special change response to changes in light intensity, thereby greatly improving the accuracy of cat face recognition.

[0136] Reference Figure 2 In an embodiment of the present invention, a cat face detection device is provided, which is arranged in an electronic device, wherein the electronic device includes a camera and a fill light, and the device includes:

[0137] The acquisition module 10 is used to acquire the first video stream data in a preset area in real time through the camera;

[0138] A first determination module 20, configured to determine whether a potential identification object appears in the first video stream data;

[0139] A position determination module 30, configured to determine position information corresponding to the potential identification object if the potential identification object appears;

[0140] A fill light parameter determination module 40, configured to determine fill light parameters according to the position information, wherein the fill light parameters include a plurality of corresponding groups of fill light intensities and fill light durations;

[0141] A fill light module 50 is used to control the fill light to perform fill light according to the fill light parameters and collect the second video stream data during the fill light process;

[0142] A second determination module 60 is used to perform cat's eye detection on the second video stream data to determine whether the second video stream contains a cat's eye;

[0143] The cat face determination module 70 is used to generate identification information of the detected cat face if the cat's eyes are included.

[0144] In a specific embodiment, the first determination module 20 includes:

[0145] An extraction unit, configured to extract a single frame image from the first video stream data at a preset time interval;

[0146] A first judging unit, used to judge whether the single frame image currently acquired has changed compared with the single frame image extracted last time;

[0147] A target detection unit, for inputting the currently acquired single frame image into a pre-trained target detection model if a change occurs, wherein the target detection model is pre-trained to identify whether there is a cat in the image;

[0148] A second judgment unit is used to obtain the output result of the target detection model and judge whether the output result is that there is a cat;

[0149] The bounding box generating unit is used to determine the presence of the potential identifiable object if there is a cat, and to generate a bounding box outside the potential identifiable object.

[0150] In a specific embodiment, the electronic device further includes an infrared distance measuring device, and the position determination module 30 includes:

[0151] A coordinate extraction unit, used to extract the coordinate information of the boundary box from the single frame image, wherein the coordinate information includes the coordinates of the upper left corner and the coordinates of the lower right corner;

[0152] A center point coordinate calculation unit, used to calculate the center point coordinates of the potential identification object according to the upper left corner coordinates and the lower right corner coordinates;

[0153] An object direction calculation unit, used to determine the object direction of the potential identification object relative to the infrared ranging device according to the central coordinates;

[0154] An infrared distance measuring unit, used to control the infrared distance measuring device to transmit an infrared signal in the direction of the object, receive the reflected signal, and calculate the straight-line distance between the potential identification object and the infrared distance measuring device;

[0155] A position calculation unit is used to calculate the position information of the potential identification object in the three-dimensional space according to the straight-line distance and the center point coordinates.

[0156] In a specific embodiment, the fill light parameter determination module 40 includes:

[0157] A fill light orientation calculation unit, used to calculate the fill light distance between the potential identifiable object and the fill light, and the fill light orientation of the potential identifiable object relative to the fill light according to the position information;

[0158] The fill light parameter generating unit is used to generate a fill light intensity sequence corresponding to the fill light distance according to a preset fill light distance-intensity correspondence relationship, and combine the fill light intensity sequence with a preset fill light duration sequence to generate the fill light parameters.

[0159] In a specific embodiment, the fill light module 50 includes:

[0160] A steering control unit, used for controlling the fill light to be steered to the fill light orientation;

[0161] A fill light control unit, used for controlling the fill light to sequentially perform fill light according to the fill light intensity and the corresponding fill light duration;

[0162] The video acquisition unit is used to track and capture the potential identifiable object through a camera under each of the fill light intensity conditions to obtain the second video stream data.

[0163] In a specific embodiment, the second determination module 60 includes:

[0164] An image combination generating unit, configured to extract the last frame of image acquired within the fill light duration of each fill light intensity from the second video stream data, and generate an image combination, wherein the image combination includes a plurality of images and corresponding fill light intensities;

[0165] A third judging unit, used to judge whether each image in the image combination contains eye information;

[0166] an eye extraction unit, configured to extract the eye information from each image in the image combination if the eye information is contained;

[0167] A fourth judgment unit is used to input each of the eye information and the corresponding fill light intensity into a pre-trained cat eye recognition model to judge whether the eye information matches the cat eye;

[0168] The cat's eye determination unit is used to determine that the second video stream contains a cat's eye if the cat's eye is matched.

[0169] In a specific embodiment, the cat face detection device further includes the cat eye recognition model, and the steps of the cat eye recognition model include:

[0170] Obtain a training data set and a verification data set, wherein the training data set includes multiple groups of eye sample images under different light intensities and corresponding labels, and the eye sample images include cat eye images and non-cat eye images;

[0171] The training data set is input into a preset neural network model, and a loss function is set, and training is performed by supervised learning to obtain a temporary recognition model, wherein the loss function formula is:

[0172]

[0173] in, represents the loss function, y i represents the true label, Represents the predicted label, and N represents the number of samples;

[0174] Using the verification data set to verify the temporary recognition model to obtain a verification result;

[0175] Determine whether the verification result is passed;

[0176] If passed, the temporary recognition model is used as the cat's eye recognition model.

[0177] For the specific implementation of each module in the above device embodiment, please refer to the above method embodiment, which will not be repeated here.

[0178] Reference Figure 3 In an embodiment of the present invention, a computer device is also provided. The computer device may be a server, and its internal structure may be as follows: Figure 3 As shown. The computer device includes a processor, a memory, a display screen, an input device, a network interface and a database connected through a system bus. Among them, the processor designed by the computer 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 the corresponding data in this embodiment. 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, the above-mentioned cat face detection method is implemented.

[0179] Those skilled in the art will understand that Figure 3 The structure shown in the figure is merely a block diagram of a portion of the structure related to the solution of the present invention, and does not constitute a limitation on the computer device to which the solution of the present invention is applied.

[0180] An embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the above method is implemented. It can be understood that the computer-readable storage medium in this embodiment can be a volatile readable storage medium or a non-volatile readable storage medium.

[0181] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed 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 provided by the present invention and used in the embodiments can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double-speed data rate SDRAM (SSRSDRAM), 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.

[0182] The embodiments of the present invention can acquire and process relevant data based on artificial intelligence technology. Artificial Intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.

[0183] AI basic technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics, etc. AI software technologies mainly include computer vision technology, robotics technology, biometrics technology, speech processing technology, natural language processing technology, and machine learning / deep learning.

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

[0185] The above description is only a preferred embodiment of the present invention, and does not limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made by using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A cat face detection method, characterized in that: Applied to an electronic device, the electronic device includes a camera and a fill light, and the method includes: Collecting first video stream data in a preset area in real time through the camera; Determining whether a potential identifiable object appears in the first video stream data; If the potential identification object appears, determining the location information corresponding to the potential identification object; Determine fill light parameters according to the position information, the fill light parameters including multiple groups of corresponding fill light intensities and fill light durations; Controlling the fill light to perform fill light according to the fill light parameters, and collecting the second video stream data during the fill light process; Performing cat's eye detection on the second video stream data to determine whether the second video stream contains a cat's eye; If the cat's eyes are included, identification information that a cat's face is detected is generated.

2. The cat face detection method according to claim 1, characterized in that: The step of determining whether a potential identification object appears in the first video stream data comprises: Extracting a single frame image from the first video stream data at a preset time interval; Determine whether the single frame image currently acquired has changed compared with the single frame image extracted last time; If yes, the single frame image currently captured is input into a pre-trained target detection model, where the target detection model is pre-trained to identify whether there is a cat in the image; Obtaining the output result of the target detection model, and determining whether the output result indicates that there is a cat; If so, it is determined that the potential identifiable object appears, and a bounding box is generated outside the potential identifiable object.

3. The cat face detection method according to claim 2, characterized in that: The electronic device further includes an infrared distance measuring device. If the potential identification object appears, the step of determining the position information corresponding to the potential identification object includes: Extracting coordinate information of the bounding box from the single-frame image, the coordinate information including upper left corner coordinates and lower right corner coordinates; Calculate the center point coordinates of the potential identification object according to the upper left corner coordinates and the lower right corner coordinates; Determine the object direction of the potential identification object relative to the infrared ranging device according to the central coordinates; Controlling the infrared ranging device to transmit an infrared signal in the direction of the object, and receiving the reflected signal, and calculating the straight-line distance between the potential identification object and the infrared ranging device; The position information of the potential identification object in the three-dimensional space is calculated based on the straight-line distance and the center point coordinates.

4. The cat face detection method according to claim 1, characterized in that: The step of determining fill light parameters according to the position information comprises: Calculating the fill light distance between the potential identifiable object and the fill light, and the fill light orientation of the potential identifiable object relative to the fill light according to the position information; According to a preset fill light distance-light intensity correspondence relationship, a fill light intensity sequence corresponding to the fill light distance is generated, and the fill light intensity sequence is combined with a preset fill light duration sequence to generate the fill light parameters.

5. The cat face detection method according to claim 4, characterized in that: The step of controlling the fill light to perform fill light according to the fill light parameters and collecting the second video stream data during the fill light process includes: Controlling the fill light to turn to the fill light position; Controlling the fill light to perform fill light in sequence according to the fill light intensity and corresponding fill light duration; Under each of the fill light intensity conditions, the potential identifiable object is tracked and captured by a camera to obtain the second video stream data.

6. The cat face detection method according to claim 1, characterized in that: The step of performing cat's eye detection on the second video stream data to determine whether the second video stream contains a cat's eye includes: Extracting the last frame of image captured within the fill light duration of each fill light intensity from the second video stream data, and generating an image combination, wherein the image combination includes a plurality of images and corresponding fill light intensities; Determining whether each image in the image combination contains eye information; If yes, extracting the eye information from each image in the image combination; Input each of the eye information and the corresponding fill light intensity into a pre-trained cat eye recognition model to determine whether the eye information matches the cat eye; If so, it is determined that the second video stream contains Cat's Eye.

7. The cat face detection method according to claim 6, characterized in that: The steps of the cat's eye recognition model include: Obtain a training data set and a verification data set, wherein the training data set includes multiple groups of eye sample images under different light intensities and corresponding labels, and the eye sample images include cat eye images and non-cat eye images; The training data set is input into a preset neural network model, and a loss function is set, and training is performed by supervised learning to obtain a temporary recognition model, wherein the loss function formula is: in, represents the loss function, y i represents the true label, Represents the predicted label, and N represents the number of samples; Using the verification data set to verify the temporary recognition model to obtain a verification result; Determine whether the verification result is passed; If passed, the temporary recognition model is used as the cat's eye recognition model.

8. A cat face detection device, characterized in that: The device is arranged in an electronic device, the electronic device includes a camera and a fill light, and the device includes: A collection module, used for collecting first video stream data in a preset area in real time through the camera; A first determination module, used to determine whether a potential identification object appears in the first video stream data; A position determination module, used for determining the position information corresponding to the potential identification object if the potential identification object appears; A fill light parameter determination module, used to determine fill light parameters according to the position information, wherein the fill light parameters include a plurality of groups of corresponding fill light intensities and fill light durations; A fill light module, used for controlling the fill light to perform fill light according to the fill light parameters, and collecting the second video stream data during the fill light process; A second judgment module is used to perform cat's eye detection on the second video stream data to determine whether the second video stream contains a cat's eye; The cat face determination module is used to generate identification information of the detected cat face if the cat's eyes are included.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the cat face detection method according to any one of claims 1 to 7 are implemented.

10. A computer device comprising a memory and a processor, wherein a computer program is stored in the memory, wherein: When the processor executes the computer program, the steps of the cat face detection method according to any one of claims 1 to 7 are implemented.