CN111382612A - Animal face detection method and device - Google Patents

Animal face detection method and device Download PDF

Info

Publication number
CN111382612A
CN111382612A CN201811625637.4A CN201811625637A CN111382612A CN 111382612 A CN111382612 A CN 111382612A CN 201811625637 A CN201811625637 A CN 201811625637A CN 111382612 A CN111382612 A CN 111382612A
Authority
CN
China
Prior art keywords
animal face
image
animal
face
face detection
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201811625637.4A
Other languages
Chinese (zh)
Inventor
孙克强
王权
刘庭皓
钱晨
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Sensetime Technology Development Co Ltd
Original Assignee
Beijing Sensetime Technology Development Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Sensetime Technology Development Co Ltd filed Critical Beijing Sensetime Technology Development Co Ltd
Priority to CN201811625637.4A priority Critical patent/CN111382612A/en
Publication of CN111382612A publication Critical patent/CN111382612A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V40/00Recognition of biometric, human-related or animal-related patterns in image or video data
    • G06V40/10Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
    • G06V40/16Human faces, e.g. facial parts, sketches or expressions
    • G06V40/161Detection; Localisation; Normalisation
    • G06V40/165Detection; Localisation; Normalisation using facial parts and geometric relationships

Abstract

The present disclosure relates to an animal face detection method and apparatus. The method comprises the following steps: acquiring an animal face image; inputting the animal face image into an animal face detection network, and outputting face key points in the animal face image through the animal face detection network; wherein the animal face detection network is trained by using a sample image set containing a plurality of animal face sample images, the animal face sample images are set to be cut from an original image containing an animal face, and the image cutting center points of the animal face sample images are higher than the center points of the animal face in the original image. By utilizing the embodiment provided by the disclosure, the face key points in the animal face image can be quickly and accurately identified.

Description

Animal face detection method and device
Technical Field
The disclosure relates to the technical field of computer vision, in particular to a method and a device for detecting an animal face.
Background
With the rapid development of social civilization and economic level, the caring degree of people for pets is gradually improved. People are also more and more willing to spend time and money to improve the living environment of pets, whether from the aspects of physical health, mental health, safety and the like. Therefore, some intelligent products facing pets appear in the market at present, so as to help people to better care for the pets.
The animal face detection technology is popular for a large number of pet users, and is beneficial to realizing animal face verification, and the animal face verification can be applied to application scenes such as pet access control, pet identity authentication and the like, and helps the pet users to manage health information, safety information and the like of pets. However, there is no technique in the related art that can accurately detect the face of an animal.
Therefore, there is a need in the art for a rapid and accurate animal face detection technique.
Disclosure of Invention
To overcome the problems in the related art, the present disclosure provides an animal face detection method and apparatus.
According to a first aspect of embodiments of the present disclosure, there is provided an animal face detection method, including:
acquiring an animal face image;
inputting the animal face image into an animal face detection network, and outputting face key points in the animal face image through the animal face detection network; wherein the animal face detection network is trained by using a sample image set containing a plurality of animal face sample images, the animal face sample images are set to be cut from an original image containing an animal face, and the image cutting center points of the animal face sample images are higher than the center points of the animal face in the original image.
The technical scheme provided by the embodiment of the disclosure can have the following beneficial effects: the animal face detection method provided by each embodiment of the present disclosure may intercept an animal face sample image centered on an animal face from an image including the animal face, and use the animal face as a training sample of an animal face detection network. In some scenarios where accurate recognition of an animal's face is required, sufficient animal face sample images are required in training the animal face detection network. With the various embodiment methods of the present disclosure, images that include only an animal face may be processed, and these images may include more than an animal face. Sufficient sample data can be provided for training the animal face detection network in the above mode.
Optionally, in an embodiment of the present disclosure, the animal face sample image is configured to be cut from the original image in the following manner:
determining a plurality of feature points of the animal face in the original image;
calculating an image interception central point according to the positions of the plurality of feature points, wherein the calculated image interception central point moves upwards relative to the central point of the animal face;
and intercepting the animal face sample image taking the animal face as the center by taking the image intercepting center point as the center.
The technical scheme provided by the embodiment of the disclosure can have the following beneficial effects: by the image intercepting method of the embodiment, the intercepted animal face sample image can contain the whole face of the animal, especially for a vertical ear animal, and the animal face sample image can comprise an ear part of the animal.
Optionally, in an embodiment of the present disclosure, the calculating an image capturing center point according to the positions of the plurality of feature points includes:
respectively acquiring coordinate values of the plurality of feature points;
and calculating to obtain coordinate values of the image interception center point based on the coordinate values of the plurality of feature points.
The technical scheme provided by the embodiment of the disclosure can have the following beneficial effects: based on the coordinate values of the plurality of feature points, the coordinate value of the image capturing center point can be accurately calculated.
Optionally, in an embodiment of the present disclosure, the calculating the coordinate values of the image capturing center point based on the coordinate values of the plurality of feature points includes:
calculating an average value of coordinate values of the plurality of feature points;
and taking the average value as a coordinate value of the image interception center point.
The technical scheme provided by the embodiment of the disclosure can have the following beneficial effects: by utilizing the average value of the coordinate values of the characteristic points, the coordinate value of the intercepted central point of the image can be quickly and accurately calculated.
Optionally, in an embodiment of the present disclosure, the plurality of feature points include an ear tip, an eye tail, a mouth corner, and a cheek widest point in the face of the animal.
The technical scheme provided by the embodiment of the disclosure can have the following beneficial effects: and selecting some special points in the face of the animal, so that the center point of the calculated image interception is higher than the center point of the face of the animal.
Optionally, in an embodiment of the present disclosure, the acquiring the facial image of the animal includes:
acquiring an image to be processed, and intercepting an image of the face of the animal from the image to be processed.
The technical scheme provided by the embodiment of the disclosure can have the following beneficial effects: the application scene of the animal face image is expanded, namely the animal face image can be cut out from the image to be processed containing the animal face.
Optionally, in an embodiment of the present disclosure, the animal face detection network is configured to be trained as follows:
acquiring a plurality of original images containing animal faces, and intercepting an animal face sample image from the original images;
respectively labeling a plurality of face key points in the animal face sample image, wherein the plurality of face key points are respectively used for determining the positions of different parts in the animal face;
inputting the animal face sample image marked with the plurality of face key points into an animal face detection network to generate a prediction result;
iteratively adjusting the network parameters based on differences between the prediction results and the plurality of facial key points until the differences meet preset requirements.
The technical scheme provided by the embodiment of the disclosure can have the following beneficial effects: and obtaining the animal face detection network based on neural network training.
Optionally, in an embodiment of the present disclosure, the sample image set further includes a plurality of derivative images, and the derivative images are configured to be obtained by performing at least one of the following operations on the animal face sample image: translation, rotation, magnification, reduction, increase background noise.
The technical scheme provided by the embodiment of the disclosure can have the following beneficial effects: and the number of samples in the sample image set is increased, and the detection accuracy of the animal face detection network is improved.
Optionally, in an embodiment of the present disclosure, the sample image set further includes a plurality of generated images, and the generated images are configured to input a plurality of the animal face sample images as sample data into a challenge generation network, and the images are generated via the challenge generation network.
The technical scheme provided by the embodiment of the disclosure can have the following beneficial effects: and the number of samples in the sample image set is increased, and the detection accuracy of the animal face detection network is improved.
Optionally, in an embodiment of the present disclosure, the sample images in the sample image set further include edge information of the animal face, and the edge information is configured to be detected by using an edge detection algorithm on the sample images.
The technical scheme provided by the embodiment of the disclosure can have the following beneficial effects: reducing the effect of background noise on the animal face detection network.
Optionally, in an embodiment of the present disclosure, the method further includes:
adding a decorative image in the animal face image based on the facial keypoints.
The technical scheme provided by the embodiment of the disclosure can have the following beneficial effects: the animal face image with the detected face key points is applied to an application scene of animal decoration, and the requirements of users are met.
Optionally, in an embodiment of the present disclosure, the animal face image, the animal face sample image includes an animal face image of an animal of the following categories: felines, canines, lagomorphs, murines.
The technical scheme provided by the embodiment of the disclosure can have the following beneficial effects: the technical scheme of the disclosure can be applied to the detection of the facial key points of various animals.
According to a second aspect of the embodiments of the present disclosure, there is provided an animal face detection apparatus including:
the image acquisition module is used for acquiring an animal face image;
the face detection module is used for inputting the animal face image into an animal face detection network and outputting face key points in the animal face image through the animal face detection network; wherein the animal face detection network is trained by using a sample image set containing a plurality of animal face sample images, the animal face sample images are set to be cut from an original image containing an animal face, and the image cutting center points of the animal face sample images are higher than the center points of the animal face in the original image.
Optionally, in an embodiment of the present disclosure, the animal face sample image is configured to be cut from the original image in the following manner:
determining a plurality of feature points of the animal face in the original image;
calculating an image interception central point according to the positions of the plurality of feature points, wherein the calculated image interception central point moves upwards relative to the central point of the animal face;
and intercepting the animal face sample image taking the animal face as the center by taking the image intercepting center point as the center.
Optionally, in an embodiment of the present disclosure, the calculating an image capturing center point according to the positions of the plurality of feature points includes:
respectively acquiring coordinate values of the plurality of feature points;
and calculating to obtain coordinate values of the image interception center point based on the coordinate values of the plurality of feature points.
Optionally, in an embodiment of the present disclosure, the calculating the coordinate values of the image capturing center point based on the coordinate values of the plurality of feature points includes:
calculating an average value of coordinate values of the plurality of feature points;
and taking the average value as a coordinate value of the image interception center point.
Optionally, in an embodiment of the present disclosure, the plurality of feature points include an ear tip, an eye tail, a mouth corner, and a cheek widest point in the face of the animal.
Optionally, in an embodiment of the present disclosure, the image obtaining module includes:
and the image acquisition submodule is used for acquiring an image to be processed and intercepting an image of the face of the animal from the image to be processed.
Optionally, in an embodiment of the present disclosure, the animal face detection network is configured to be trained as follows:
acquiring a plurality of original images containing animal faces, and intercepting an animal face sample image from the original images;
respectively labeling a plurality of face key points in the animal face sample image, wherein the plurality of face key points are respectively used for determining the positions of different parts in the animal face;
inputting the animal face sample image marked with the plurality of face key points into an animal face detection network to generate a prediction result;
iteratively adjusting the network parameters based on differences between the prediction results and the plurality of facial key points until the differences meet preset requirements.
Optionally, in an embodiment of the present disclosure, the sample image set further includes a plurality of derivative images, and the derivative images are configured to be obtained by performing at least one of the following operations on the animal face sample image: translation, rotation, magnification, reduction, increase background noise.
Optionally, in an embodiment of the present disclosure, the sample image set further includes a plurality of generated images, and the generated images are configured to input a plurality of the animal face sample images as sample data into a challenge generation network, and the images are generated via the challenge generation network.
Optionally, in an embodiment of the present disclosure, the sample images in the sample image set further include edge information of the animal face, and the edge information is configured to be detected by using an edge detection algorithm on the sample images.
Optionally, in an embodiment of the present disclosure, the apparatus further includes:
and the decoration module is used for adding a decoration image in the animal face image based on the face key points.
Optionally, in an embodiment of the present disclosure, the animal face image, the animal face sample image includes an animal face image of an animal of the following categories: felines, canines, lagomorphs, murines.
According to a third aspect of the embodiments of the present disclosure, there is provided an electronic apparatus including:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to: the above-described animal face detection method is performed.
According to a fourth aspect of embodiments of the present disclosure, there is provided a non-transitory computer-readable storage medium having instructions which, when executed by a processor, enable the processor to perform the above-described animal face detection method.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and together with the description, serve to explain the principles of the disclosure.
Fig. 1 is a method flow diagram illustrating a method of animal face detection according to an exemplary embodiment.
Fig. 2 is a method flow diagram illustrating a method of animal face detection according to an exemplary embodiment.
FIG. 3 is a schematic diagram of a scenario shown in accordance with an exemplary embodiment.
FIG. 4 is a schematic diagram of a scenario shown in accordance with an exemplary embodiment.
FIG. 5 is a schematic diagram of a scenario shown in accordance with an exemplary embodiment.
Fig. 6 is a method flow diagram illustrating a method of animal face detection according to an exemplary embodiment.
Fig. 7 is a block configuration diagram illustrating an animal face detection apparatus according to an exemplary embodiment.
FIG. 8 is a block diagram of an apparatus according to an exemplary embodiment.
FIG. 9 is a block diagram of an apparatus according to an exemplary embodiment.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of devices and apparatus consistent with certain aspects of the present disclosure, as detailed in the appended claims.
In order to facilitate those skilled in the art to understand the technical solutions provided by the embodiments of the present disclosure, a technical environment for implementing the technical solutions is described below.
In a scene example of the present disclosure, when a pet (such as a cat, a dog, a hamster, a rabbit) is photographed by using a photographing APP with a beauty decoration function, a camera of a photographing device (such as a smart phone) in which the photographing APP is installed faces the face of the pet, and the photographing APP can automatically identify key points of the face of the pet. Based on the face key points, decorative small images can be set on the pet image displayed by the photographing device. For example, a cap, bow, cheek blush on the cheeks, glasses on the eyes, scarves, bells, etc. are decorated on the pet's head, under the chin. The user presses the photographing button to capture the pet face image with decorations. For the user, the enjoyment of the interaction with the pet is greatly increased.
Therefore, in the application scenario, it is important to accurately identify the facial key points of the pet. If the wrong face key point is recognized or the key point cannot be recognized, the face decoration function in the shooting APP cannot be realized, or the decoration is decorated to the wrong position, so that poor user experience is caused, and the shooting APP is caused to run off when the user is serious.
In embodiments of the present disclosure, keypoints in an animal face may be determined using an animal face detection network. The animal face detection network can be obtained by training a plurality of animal face sample images marked with face key points as training samples. It can be found that in real life, when the face beautifying function is used for taking a picture, most of the time, only the face is placed in the picture taking frame. Therefore, acquiring a plurality of animal face sample images as sample data is an essential step in training the animal face detection network. However, facial images of animals are not as rich as facial images, and many of the images of animals are mostly full-body photographs of animals. Therefore, how to obtain enough training samples from these existing animal images is an important issue.
Based on the practical technical requirements similar to those described above, the animal face detection method provided by the present disclosure can acquire training samples for training an animal face detection network from an existing image containing an animal face, and provide sufficient sample data for training an accurate animal face detection network.
The animal face detection method according to the present disclosure will be described in detail below with reference to fig. 1. Fig. 1 is a method flow diagram of one embodiment of a method of animal face detection provided by the present disclosure. Although the present disclosure provides method steps as illustrated in the following examples or figures, more or fewer steps may be included in the method based on conventional or non-inventive efforts. In steps where no necessary causal relationship exists logically, the order of execution of the steps is not limited to that provided by the disclosed embodiments.
Specifically, as shown in fig. 1, one embodiment of the method for detecting an animal face provided by the present disclosure may include:
s101: an image of the animal's face is acquired.
S103: inputting the animal face image into an animal face detection network, and outputting face key points in the animal face image through the animal face detection network; wherein the animal face detection network is trained by using a sample image set containing a plurality of animal face sample images, the animal face sample images are set to be cut from an original image containing an animal face, and the image cutting center points of the animal face sample images are higher than the center points of the animal face in the original image.
In an embodiment of the present disclosure, the animal face image may include an image centered on an animal face. In one embodiment, the animal facial image may comprise an image cut from the image to be identified.
In an embodiment of the present disclosure, in the process of training the animal face detection network, an original image containing an animal face may be acquired. The original image may include, for example, a whole-body image of the animal, a distant view image with the animal's face, a close view image, an image of the animal's face in a background scene (e.g., a grass, quilt, window, etc.), and so forth. The original image may be captured by a camera, and may also be obtained from a network, a standard image library, or other third-party image library, and the obtaining manner of the original image is not limited in the present disclosure. In addition, in order to adapt to the posture of the animal face, the original images of various postures such as a front, a side, a head-up, a head-down and the like can be included, and the disclosure is not limited herein.
In the embodiment of the present disclosure, in order to adapt to some application scenarios based on animal face images, an animal face sample image may be extracted from the original image. In many application scenarios based on the animal face sample image, the animal face is used as the center of the animal face sample image regardless of the posture of the animal face, and therefore, in the present embodiment, the intercepted animal face sample image may be centered on the animal face.
The animal face is different from the human face in that each part in the human face is concentrated, but the parts of the animal face, particularly the ear parts, are less concentrated and are more dispersed from the position relationship of other parts. Such animals may include, for example, animals of the following classes: felines, canines, lagomorphs, murines, and the like. Based on this, as shown in fig. 2, in one embodiment of the present disclosure, the animal face sample image is set to be cut out from the original image in the following manner:
s201: determining a plurality of feature points of the animal face in the original image.
S203: and calculating an image interception central point according to the positions of the plurality of feature points, wherein the calculated image interception central point moves upwards relative to the central point of the animal face.
S205: and intercepting the animal face sample image taking the animal face as the center by taking the image intercepting center point as the center.
In the disclosed embodiment, a plurality of feature points may be determined in the animal face of the original image. Then, according to the positions of the plurality of feature points, an image interception central point is calculated, wherein the calculated image interception central point moves upwards relative to the central point of the animal face. Based on the technical requirements, the face of the animal is relatively scattered in various parts, particularly in the ear parts. If the animal face (including the ear with the higher position) is located at the center position of the animal face sample image, the center point of the animal face sample image to be intercepted is located at the center position of the animal face sample imageThe center point of the animal face is above, otherwise, the ear part of the missing part in the intercepted animal face sample image can be caused. It is known from experience that the centre point of the animal's face is often located at a point in the animal's face above the tip of the nose. In one embodiment, the center point of the animal face may be calculated using all key points in the animal face, as shown in fig. 3, for example, the all key points may include a plurality of key points of the animal face, such as ear tip, ear root, eye corner, eye tail, nose tip, mouth corner, upper lip center, lower lip center, lowest point of chin, and widest part of cheek. Based on this, in one embodiment, the coordinate position (x) of the center point of the animal's facec1,yc1) Can be calculated by using the following formula:
Figure BDA0001927928860000081
wherein N is the number of all key points in the face of the animal, (x)i,yi) Is the coordinate position of the key point.
In one embodiment of the present disclosure, the plurality of feature points may include some key points selected from all key points in the animal face, and as shown in fig. 4, the plurality of feature points may include the widest points of the ear tip, the eye tail, the mouth corner and the cheek in the animal face. Coordinate position (x) of the image interception center pointc2,yc2) The coordinate values of the plurality of feature points may be obtained by calculation, and in an embodiment, the coordinate values of the plurality of feature points may include an average value, and the expression formula may be:
Figure BDA0001927928860000091
wherein M is the number of the characteristic points in the animal face, (x)i,yi) Is the coordinate position of the feature point.
For example, as shown in fig. 5, the position where the average value of the feature point coordinate values in fig. 4 is calculated by the above formula (2) is the O point in fig. 5. In an embodiment of the present disclosure, after the image truncation center point is determined, an animal face sample image centered on the animal face may be truncated centering on the image truncation center point. In one example, based on the above equation (2), it can be determined that the horizontal and vertical coordinates of the upper left corner and the lower right corner of the animal face sample image are:
Figure BDA0001927928860000092
Figure BDA0001927928860000093
Figure BDA0001927928860000094
Figure BDA0001927928860000095
wherein L is a predefined side length of the animal face sample image. As shown in fig. 5, an image of a sample of an animal face with a side length L can be cut out in the above manner.
It should be noted that, the selection of the plurality of feature points is not limited to the above manner, and if it can be realized that the calculated image capturing center point is located above the center of the animal face, and the captured animal face sample image can include all animal face parts, and the animal face is taken as the center of the animal face sample image, all of the manners belong to the protection scope of the embodiment of the present disclosure. The calculation method of the image capturing center point is not limited to the above method, and for example, weight values may be set for the plurality of feature points, and the coordinate value of the image capturing center point may be calculated based on the coordinate values of the plurality of feature points and the weight values. In addition, the manner of cutting the animal face sample image with the image cutting center point as the center is not limited to the above-mentioned manner, and for example, images of various shapes such as a rectangle, a circle, and an ellipse may be cut.
In this embodiment, the layout of the plurality of feature points may be increased with the weight of the animal ear, so that the image capturing center point is located above the center of the animal face. Therefore, the animal face sample image intercepted based on the image interception central point can completely contain all animal face parts such as animal ears, and the whole animal face is positioned in the center of the animal face sample image, so that the application scenes such as pet decoration photographing are met. In addition, by capturing the center point of the image calculated by the above formula (2), even when the pet is in the side face posture, the captured animal face sample image can still include all animal face parts such as ears centering on the animal face.
In one embodiment of the present disclosure, after the animal face sample image is acquired, a sample image set containing the animal face sample image may be used as a training sample of the animal face detection network for identifying face key points in an animal face. As shown in fig. 6, in one embodiment, the animal face detection network may be configured to be trained in the following manner:
s601: a plurality of original images containing animal faces are obtained, and an animal face sample image is intercepted from the original images.
S603: and respectively labeling a plurality of face key points in the animal face sample image, wherein the plurality of face key points are respectively used for determining the positions of different parts in the animal face.
S605: and inputting the animal face sample image marked with the plurality of face key points into an animal face detection network to generate a prediction result.
S607: iteratively adjusting the network parameters based on differences between the prediction results and the plurality of facial key points until the differences meet preset requirements.
In this embodiment, in the process of training the animal face detection network by using the animal face sample image as a training sample, a plurality of face key points may be labeled in the animal face sample image, and the plurality of face key points may be respectively used to determine positions of different parts in the animal face. In one embodiment, the plurality of facial key points may include all of the key points, such as the cat image shown in fig. 3, for example, may include a plurality of key points of an animal's face, such as ear tip, ear root, eye corner, eye tail, nose tip, mouth corner, upper lip center, lower lip center, chin nadir, and cheek widest point. After the plurality of facial key points are labeled, the animal face sample image labeled with the plurality of facial key points can be input into an animal face detection network, and a prediction result is generated. The prediction results may include a plurality of predicted facial keypoints identified by the animal face detection network. Since the labeled plurality of facial key points can be used as supervision information of a training process, iterative adjustment is performed on network parameters in the animal face detection network based on differences between the prediction result and the plurality of facial key points until the differences meet preset requirements. It should be noted that the animal face detection network of the present disclosure may be based on a supervised machine learning method, and the machine learning may include K nearest neighbor, decision tree, naive bayes, logistic regression, deep neural network, etc., and the present disclosure does not limit the training manner of the animal face detection network.
The detection accuracy of the animal face detection network is usually dependent on more training samples, but the number of the samples of the animal face sample image is small, and the animal face sample image is difficult to obtain. Thus, the number of samples in the sample image set can be augmented based on the existing animal face sample image. In one embodiment of the present disclosure, the sample image set further includes a plurality of derivative images, and the derivative images are configured to be obtained by performing at least one of the following operations on the animal face sample image: translation, rotation, magnification, reduction, increase background noise. Then, the animal face sample image and the plurality of derived images can be used as a training sample of an animal face detection network together, and the animal face detection network is obtained through training. For a specific training mode, reference may be made to the above embodiments, and details of the present disclosure are not repeated herein.
In another embodiment of the present disclosure, the sample image set further comprises a plurality of generated images, the generated images being arranged to input a plurality of the animal face sample images as sample data into a challenge generation network (GAN), images generated via the challenge generation network. In this embodiment, a plurality of the animal face sample images may be input as sample data to a countermeasure generation network, and a plurality of generated images may be generated via the GAN. Since GAN includes a Generative Model (Generative Model) and a discriminant Model (discriminant Model), a relatively real image of an animal face sample can be generated. Thus, in this way, more sample data can be generated based on the existing small number of animal face sample images.
In one embodiment of the present disclosure, the animal face sample image has more background noise due to structural features on the face of the cat, such as the cat's ear being a point that is farther from the rest of the face. Therefore, the animal face is subjected to edge extraction, the influence of background noise on the animal face detection network is reduced, and based on the edge information, the sample images in the sample image set further comprise edge information of the animal face, and the edge information is set to be detected by an edge detection algorithm on the sample images.
In this embodiment, the edge detection algorithm may include at least one of image filtering, image detection, and image positioning, and the utilized edge detection operator may include one of differential edge detection, roberts operator, Sobel operator, Prewitt operator, Kirsch operator, and Laplace operator.
In the embodiment of the present disclosure, after the animal face image is input into the animal face detection network, the face key points in the animal face image are output through the animal face detection network. In one example, the animal face detection network may be provided as a module in various applications, such as in an electronic product having a camera function. In a typical application scenario, the animal face detection network may be provided in a camera APP. The animal face detection network can perform calculation processing on the shot or shot to-be-identified animal face sample image to determine the face key points of the animal face in the to-be-identified animal face sample image.
In one embodiment of the present disclosure, a decoration image may be further added to the sample image of the face of the animal to be recognized based on the face key points.
The animal face detection method provided by each embodiment of the present disclosure may intercept an animal face sample image centered on an animal face from an image including the animal face, and use the animal face as a training sample of an animal face detection network. In some scenarios where accurate recognition of an animal's face is required, sufficient animal face sample images are required in training the animal face detection network. With the various embodiment methods of the present disclosure, images that include only an animal face may be processed, and these images may include more than an animal face. Sufficient sample data can be provided for training the animal face detection network in the above mode.
Fig. 7 shows a block diagram of an animal face detection apparatus 700 according to an embodiment of the present disclosure, as shown in fig. 7, the apparatus 700 comprising:
an image acquisition module 701, configured to acquire an animal face image;
a face detection module 703, configured to input the animal face image into an animal face detection network, and output a face key point in the animal face image through the animal face detection network; wherein the animal face detection network is trained by using a sample image set containing a plurality of animal face sample images, the animal face sample images are set to be cut from an original image containing an animal face, and the image cutting center points of the animal face sample images are higher than the center points of the animal face in the original image.
Optionally, in an embodiment of the present disclosure, the animal face sample image is configured to be cut from the original image in the following manner:
determining a plurality of feature points of the animal face in the original image;
calculating an image interception central point according to the positions of the plurality of feature points, wherein the calculated image interception central point moves upwards relative to the central point of the animal face;
and intercepting the animal face sample image taking the animal face as the center by taking the image intercepting center point as the center.
Optionally, in an embodiment of the present disclosure, the calculating an image capturing center point according to the positions of the plurality of feature points includes:
respectively acquiring coordinate values of the plurality of feature points;
and calculating to obtain coordinate values of the image interception center point based on the coordinate values of the plurality of feature points.
Optionally, in an embodiment of the present disclosure, the calculating the coordinate values of the image capturing center point based on the coordinate values of the plurality of feature points includes:
calculating an average value of coordinate values of the plurality of feature points;
and taking the average value as a coordinate value of the image interception center point.
Optionally, in an embodiment of the present disclosure, the plurality of feature points include an ear tip, an eye tail, a mouth corner, and a cheek widest point in the face of the animal.
Optionally, in an embodiment of the present disclosure, the image obtaining module includes:
and the image acquisition submodule is used for acquiring an image to be processed and intercepting an image of the face of the animal from the image to be processed.
Optionally, in an embodiment of the present disclosure, the animal face detection network is configured to be trained as follows:
acquiring a plurality of original images containing animal faces, and intercepting an animal face sample image from the original images;
respectively labeling a plurality of face key points in the animal face sample image, wherein the plurality of face key points are respectively used for determining the positions of different parts in the animal face;
inputting the animal face sample image marked with the plurality of face key points into an animal face detection network to generate a prediction result;
iteratively adjusting the network parameters based on differences between the prediction results and the plurality of facial key points until the differences meet preset requirements.
Optionally, in an embodiment of the present disclosure, the sample image set further includes a plurality of derivative images, and the derivative images are configured to be obtained by performing at least one of the following operations on the animal face sample image: translation, rotation, magnification, reduction, increase background noise.
Optionally, in an embodiment of the present disclosure, the sample image set further includes a plurality of generated images, and the generated images are configured to input a plurality of the animal face sample images as sample data into a challenge generation network, and the images are generated via the challenge generation network.
Optionally, in an embodiment of the present disclosure, the sample images in the sample image set further include edge information of the animal face, and the edge information is configured to be detected by using an edge detection algorithm on the sample images.
Optionally, in an embodiment of the present disclosure, the apparatus further includes:
and the decoration module is used for adding a decoration image in the animal face image based on the face key points.
Optionally, in an embodiment of the present disclosure, the animal face image, the animal face sample image includes an animal face image of an animal of the following categories: felines, canines, lagomorphs, murines.
An embodiment of the present disclosure further provides an electronic device, including: a processor; a memory for storing processor-executable instructions; wherein the processor is configured as the apparatus according to the above embodiments.
The electronic device may be provided as a terminal, server, or other form of device.
Fig. 8 is a block diagram illustrating an electronic device 800 in accordance with an example embodiment. For example, the electronic device 800 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, or the like terminal.
Referring to fig. 8, electronic device 800 may include one or more of the following components: processing component 802, memory 804, power component 806, multimedia component 808, audio component 810, input/output (I/O) interface 812, sensor component 814, and communication component 816.
The processing component 802 generally controls overall operation of the electronic device 800, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing components 802 may include one or more processors 820 to execute instructions to perform all or a portion of the steps of the apparatus described above. Further, the processing component 802 can include one or more modules that facilitate interaction between the processing component 802 and other components. For example, the processing component 802 can include a multimedia module to facilitate interaction between the multimedia component 808 and the processing component 802.
The memory 804 is configured to store various types of data to support operations at the electronic device 800. Examples of such data include instructions for any application or device operating on the electronic device 800, contact data, phonebook data, messages, pictures, videos, and so forth. The memory 804 may be implemented by any type or combination of volatile or non-volatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disks.
The power supply component 806 provides power to the various components of the electronic device 800. The power components 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the electronic device 800.
The multimedia component 808 includes a screen that provides an output interface between the electronic device 800 and a user. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front facing camera and/or a rear facing camera. The front camera and/or the rear camera may receive external multimedia data when the electronic device 800 is in an operation mode, such as a shooting mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
The audio component 810 is configured to output and/or input audio signals. For example, the audio component 810 includes a Microphone (MIC) configured to receive external audio signals when the electronic device 800 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals may further be stored in the memory 804 or transmitted via the communication component 816. In some embodiments, audio component 810 also includes a speaker for outputting audio signals.
The I/O interface 812 provides an interface between the processing component 802 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to: a home button, a volume button, a start button, and a lock button.
The sensor assembly 814 includes one or more sensors for providing various aspects of state assessment for the electronic device 800. For example, the sensor assembly 814 may detect an open/closed state of the electronic device 800, the relative positioning of components, such as a display and keypad of the electronic device 800, the sensor assembly 814 may also detect a change in the position of the electronic device 800 or a component of the electronic device 800, the presence or absence of user contact with the electronic device 800, orientation or acceleration/deceleration of the electronic device 800, and a change in the temperature of the electronic device 800. Sensor assembly 814 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 814 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 816 is configured to facilitate wired or wireless communication between the electronic device 800 and other devices. The electronic device 800 may access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 further includes a Near Field Communication (NFC) module to facilitate short-range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the electronic device 800 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, micro-controllers, microprocessors or other electronic components for performing the above-described means.
In an exemplary embodiment, a non-transitory computer-readable storage medium, such as the memory 804, is also provided that includes computer program instructions executable by the processor 820 of the electronic device 800 to perform the above-described apparatus.
Fig. 9 is a block diagram illustrating an electronic device 1900 in accordance with an example embodiment. For example, the electronic device 1900 may be provided as a server. Referring to fig. 9, electronic device 1900 includes a processing component 1922 further including one or more processors and memory resources, represented by memory 1932, for storing instructions, e.g., applications, executable by processing component 1922. The application programs stored in memory 1932 may include one or more modules that each correspond to a set of instructions. Further, the processing component 1922 is configured to execute instructions to perform the apparatus described above.
The electronic device 1900 may also include a power component 1926 configured to perform power management of the electronic device 1900, a wired or wireless network interface 1950 configured to connect the electronic device 1900 to a network, and an input/output (I/O) interface 1958. The electronic device 1900 may operate based on an operating system stored in memory 1932, such as Windows Server, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, or the like.
In an exemplary embodiment, a non-transitory computer readable storage medium, such as the memory 1932, is also provided that includes computer program instructions that are executable by the processing component 1922 of the electronic device 1900 to perform the above-described apparatus.
The present disclosure may be a system, apparatus, and/or computer program product. The computer program product may include a computer-readable storage medium having computer-readable program instructions embodied thereon for causing a processor to implement various aspects of the present disclosure.
The computer readable storage medium may be a tangible device that can hold and store the instructions for use by the instruction execution device. The computer readable storage medium may be, for example, but not limited to, an electronic memory device, a magnetic memory device, an optical memory device, an electromagnetic memory device, a semiconductor memory device, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a Static Random Access Memory (SRAM), a portable compact disc read-only memory (CD-ROM), a Digital Versatile Disc (DVD), a memory stick, a floppy disk, a mechanical coding device, such as punch cards or in-groove projection structures having instructions stored thereon, and any suitable combination of the foregoing. Computer-readable storage media as used herein is not to be construed as transitory signals per se, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through a waveguide or other transmission medium (e.g., optical pulses through a fiber optic cable), or electrical signals transmitted through electrical wires.
The computer-readable program instructions described herein may be downloaded from a computer-readable storage medium to a respective computing/processing device, or to an external computer or external storage device via a network, such as the internet, a local area network, a wide area network, and/or a wireless network. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers and/or edge servers. The network adapter card or network interface in each computing/processing device receives computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in a computer-readable storage medium in the respective computing/processing device.
The computer program instructions for carrying out operations of the present disclosure may be assembler instructions, Instruction Set Architecture (ISA) instructions, machine-related instructions, microcode, firmware instructions, state setting data, or source or object code written in any combination of one or more programming languages, including an object oriented programming language such as Smalltalk, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The computer-readable program instructions may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider). In some embodiments, the electronic circuitry that can execute the computer-readable program instructions implements aspects of the present disclosure by utilizing the state information of the computer-readable program instructions to personalize the electronic circuitry, such as a programmable logic circuit, a Field Programmable Gate Array (FPGA), or a Programmable Logic Array (PLA).
Various aspects of the present disclosure are described herein with reference to flowchart illustrations and/or block diagrams of apparatus, apparatus (systems) and computer program products according to embodiments of the disclosure. It will be understood that each block of the flowchart illustrations and/or block diagrams, and combinations of blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer-readable program instructions.
These computer-readable program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions/acts specified in the flowchart and/or block diagram block or blocks. These computer-readable program instructions may also be stored in a computer-readable storage medium that can direct a computer, programmable data processing apparatus, and/or other devices to function in a particular manner, such that the computer-readable medium storing the instructions comprises an article of manufacture including instructions which implement the function/act specified in the flowchart and/or block diagram block or blocks.
The computer readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other devices to cause a series of operational steps to be performed on the computer, other programmable apparatus or other devices to produce a computer implemented process such that the instructions which execute on the computer, other programmable apparatus or other devices implement the functions/acts specified in the flowchart and/or block diagram block or blocks.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, apparatus, and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of instructions, which comprises one or more executable instructions for implementing the specified logical function(s). In some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
Having described embodiments of the present disclosure, the foregoing description is intended to be exemplary, not exhaustive, and not limited to the disclosed embodiments. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen in order to best explain the principles of the embodiments, the practical application, or improvements made to the technology in the marketplace, or to enable others of ordinary skill in the art to understand the embodiments disclosed herein.

Claims (10)

1. An animal face detection method, comprising:
acquiring an animal face image;
inputting the animal face image into an animal face detection network, and outputting face key points in the animal face image through the animal face detection network; wherein the animal face detection network is trained by using a sample image set containing a plurality of animal face sample images, the animal face sample images are set to be cut from an original image containing an animal face, and the image cutting center points of the animal face sample images are higher than the center points of the animal face in the original image.
2. The animal face detection method according to claim 1, wherein the animal face sample image is set to be cut out from the original image in the following manner:
determining a plurality of feature points of the animal face in the original image;
calculating an image interception central point according to the positions of the plurality of feature points, wherein the calculated image interception central point moves upwards relative to the central point of the animal face;
and intercepting the animal face sample image taking the animal face as the center by taking the image intercepting center point as the center.
3. The animal face detection method according to claim 2, wherein the calculating of the image cut center point from the positions of the plurality of feature points includes:
respectively acquiring coordinate values of the plurality of feature points;
and calculating to obtain coordinate values of the image interception center point based on the coordinate values of the plurality of feature points.
4. The animal face detection method according to claim 3, wherein the calculating of the coordinate values of the image capturing center point based on the coordinate values of the plurality of feature points includes:
calculating an average value of coordinate values of the plurality of feature points;
and taking the average value as a coordinate value of the image interception center point.
5. An animal face detection apparatus, comprising:
the image acquisition module is used for acquiring an animal face image;
the face detection module is used for inputting the animal face image into an animal face detection network and outputting face key points in the animal face image through the animal face detection network; wherein the animal face detection network is trained by using a sample image set containing a plurality of animal face sample images, the animal face sample images are set to be cut from an original image containing an animal face, and the image cutting center points of the animal face sample images are higher than the center points of the animal face in the original image.
6. An animal face detection apparatus as claimed in claim 5 wherein the animal face sample image is arranged to be truncated from the original image in the following manner:
determining a plurality of feature points of the animal face in the original image;
calculating an image interception central point according to the positions of the plurality of feature points, wherein the calculated image interception central point moves upwards relative to the central point of the animal face;
and intercepting the animal face sample image taking the animal face as the center by taking the image intercepting center point as the center.
7. The animal face detection device according to claim 6, wherein the calculating of the image cut center point from the positions of the plurality of feature points comprises:
respectively acquiring coordinate values of the plurality of feature points;
and calculating to obtain coordinate values of the image interception center point based on the coordinate values of the plurality of feature points.
8. The animal face detection device according to claim 7, wherein said calculating coordinate values of an image cut center point based on the coordinate values of the plurality of feature points includes:
calculating an average value of coordinate values of the plurality of feature points;
and taking the average value as a coordinate value of the image interception center point.
9. An electronic device, comprising:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to: performing the animal face detection method of any one of claims 1 to 4.
10. A non-transitory computer readable storage medium having instructions that, when executed by a processor, enable the processor to perform the animal face detection method of any one of claims 1-4.
CN201811625637.4A 2018-12-28 2018-12-28 Animal face detection method and device Pending CN111382612A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811625637.4A CN111382612A (en) 2018-12-28 2018-12-28 Animal face detection method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811625637.4A CN111382612A (en) 2018-12-28 2018-12-28 Animal face detection method and device

Publications (1)

Publication Number Publication Date
CN111382612A true CN111382612A (en) 2020-07-07

Family

ID=71216419

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811625637.4A Pending CN111382612A (en) 2018-12-28 2018-12-28 Animal face detection method and device

Country Status (1)

Country Link
CN (1) CN111382612A (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2005267454A (en) * 2004-03-19 2005-09-29 Seiko Epson Corp Image trimming device and method
CN107358157A (en) * 2017-06-07 2017-11-17 阿里巴巴集团控股有限公司 A kind of human face in-vivo detection method, device and electronic equipment
WO2017215669A1 (en) * 2016-06-17 2017-12-21 北京市商汤科技开发有限公司 Method and device for object recognition, data processing device, and computing device
CN107704817A (en) * 2017-09-28 2018-02-16 成都品果科技有限公司 A kind of detection algorithm of animal face key point
CN108073914A (en) * 2018-01-10 2018-05-25 成都品果科技有限公司 A kind of animal face key point mask method

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2005267454A (en) * 2004-03-19 2005-09-29 Seiko Epson Corp Image trimming device and method
WO2017215669A1 (en) * 2016-06-17 2017-12-21 北京市商汤科技开发有限公司 Method and device for object recognition, data processing device, and computing device
CN107358157A (en) * 2017-06-07 2017-11-17 阿里巴巴集团控股有限公司 A kind of human face in-vivo detection method, device and electronic equipment
CN107704817A (en) * 2017-09-28 2018-02-16 成都品果科技有限公司 A kind of detection algorithm of animal face key point
CN108073914A (en) * 2018-01-10 2018-05-25 成都品果科技有限公司 A kind of animal face key point mask method

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
于奥运;: "基于深度学习的犬种识别研究", 现代计算机(专业版) *

Similar Documents

Publication Publication Date Title
CN108764091B (en) Living body detection method and apparatus, electronic device, and storage medium
US10956714B2 (en) Method and apparatus for detecting living body, electronic device, and storage medium
US10264177B2 (en) Methods and systems to obtain desired self-pictures with an image capture device
US10645332B2 (en) Subtitle displaying method and apparatus
CN108197586B (en) Face recognition method and device
CN105631408B (en) Face photo album processing method and device based on video
CN105488527B (en) Image classification method and device
CN109257645B (en) Video cover generation method and device
US10007841B2 (en) Human face recognition method, apparatus and terminal
EP3179408A2 (en) Picture processing method and apparatus, computer program and recording medium
CN110956061B (en) Action recognition method and device, and driver state analysis method and device
CN107692997B (en) Heart rate detection method and device
CN111553864B (en) Image restoration method and device, electronic equipment and storage medium
CN110287671B (en) Verification method and device, electronic equipment and storage medium
CN111241887B (en) Target object key point identification method and device, electronic equipment and storage medium
CN109934275B (en) Image processing method and device, electronic equipment and storage medium
CN107730448B (en) Beautifying method and device based on image processing
CN106980840A (en) Shape of face matching process, device and storage medium
CN111047526A (en) Image processing method and device, electronic equipment and storage medium
CN110598504A (en) Image recognition method and device, electronic equipment and storage medium
CN104580886A (en) Photographing control method and device
US11961278B2 (en) Method and apparatus for detecting occluded image and medium
EP3641280A1 (en) Unlocking of a mobile terminal by face-recognition of a slidable camera
CN111144266B (en) Facial expression recognition method and device
CN107977636B (en) Face detection method and device, terminal and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination