Image recognition method and device and electronic equipment
By calculating the degree of discreteness between the angles of the eyes and the bridge of the nose in the image, accurately distinguishing the face of the advertising face from the pedestrian face, solving the problem of inaccurate recognition in security monitoring, and achieving efficient and accurate recognition effect.
Patent Information
- Application Number
- CN202311427555.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-31
- Publication Date
- 2025-05-02
AI Technical Summary
In the field of security monitoring, the identification of pedestrian faces and faces in billboards or other promotional methods is inaccurate, resulting in the mixed portrait images of advertising and portrait images of normal pedestrians, forming a valuable portrait data set.
By obtaining multiple images containing the same face, the angle between the straight line where both eyes are located and the straight line where the nose bridge is located in each image is calculated, and the degree of dispersion of the angle deviation is calculated. If the degree of discreteness is less than the preset threshold, it is determined to be an advertising face, otherwise it is determined to be a pedestrian face.
It realizes accurate distinction between advertising faces and pedestrian faces, improves recognition accuracy and efficiency, reduces the misrecognition rate, and saves computing resources.
Smart Images

Figure CN119919969A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to an image recognition method, device and electronic device. Background Art
[0002] In the field of security monitoring, distinguishing pedestrian faces from faces on billboards or other forms of publicity is a challenging task. Usually, this distinction requires extracting meaningful information from videos or images. In particular, posters for advertising are often posted at bus stops, community access control points, and other locations, and the spokespersons in the posters are also captured by surveillance cameras. The collected advertising portrait images are mixed with normal pedestrian portrait images, forming a worthless portrait dataset.
[0003] The related technology uses the following method to distinguish pedestrian faces from advertisement faces:
[0004] 1. Manually annotate faces in billboards to form a blacklist library. If the face in the recognized image is a face in the blacklist library, it is determined to be the face of the advertisement. This method consumes a lot of manpower and cannot identify billboards taken by new spokespersons.
[0005] Second, by manually marking the visual area of the camera device, the locations where the posters may be posted are filtered out. This method may also filter out pedestrians passing through this visual area.
[0006] Third, a threshold is set by the number of images containing the same face in the images collected within a preset time length, and if the threshold is exceeded, it is considered to be an advertising face. This method is relatively simple and crude, and may cause normal pedestrians who move frequently under the camera device to be identified as advertising faces. Summary of the invention
[0007] The embodiments of the present application provide an image recognition method, device and electronic device for solving the problem of inaccurate recognition of advertising faces and pedestrian faces in the related art.
[0008] In a first aspect, an embodiment of the present application provides an image recognition method, the method comprising:
[0009] Get multiple images containing the same face;
[0010] Determine the angle between the straight line where the eyes are located and the straight line where the bridge of the nose is located in each acquired image, and determine the discrete degree value according to the deviation of each acquired angle;
[0011] If the discrete degree value is less than a preset threshold, it is determined that the human face in each acquired image is an advertisement face; otherwise, it is determined that the human face in each acquired image is a pedestrian face.
[0012] In a second aspect, an embodiment of the present application further provides an image recognition device, the device comprising:
[0013] An acquisition module, used for acquiring multiple images containing the same face;
[0014] A determination module is used to determine the angle between the straight line where the eyes are located and the straight line where the bridge of the nose is located in each acquired image, and determine the discrete degree value according to the deviation of each acquired angle;
[0015] The processing module is used to determine that the human face in each acquired image is an advertisement face if the discrete degree value is less than a preset threshold value, otherwise, determine that the human face in each acquired image is a pedestrian face.
[0016] In a third aspect, an embodiment of the present application further provides an electronic device, which includes at least a processor and a memory, and the processor is used to implement the steps of the image recognition method as described in any one of the above items when executing a computer program stored in the memory.
[0017] In an embodiment of the present application, an electronic device acquires multiple images containing the same face; determines the angle between the straight line where the eyes are located and the straight line where the nose bridge is located in each acquired image, and determines the discrete degree value according to the deviation of each acquired angle; if the discrete degree value is less than a preset threshold value, the face in each acquired image is determined to be an advertisement face, otherwise, the face in each acquired image is determined to be a pedestrian face. Since in an embodiment of the present application, the electronic device determines the discrete degree value according to the angle between the straight line between the eyes and the straight line where the nose bridge is located in each image, and then distinguishes the advertisement face and the pedestrian face according to the discrete degree value, since the angle between the line segment between the eyes and the line segment at the nose bridge in the advertisement face usually does not change or changes slightly, while the angle between the line segment between the eyes and the line segment at the nose bridge of the pedestrian face changes greatly as the pedestrian moves, the advertisement face and the pedestrian face can be accurately identified by the discrete degree value and the preset threshold value. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0019] Figure 1 A schematic diagram of an image recognition process provided in an embodiment of the present application;
[0020] Figure 2A schematic diagram of multiple images provided in an embodiment of the present application;
[0021] Figure 3 A schematic diagram of another plurality of images provided in an embodiment of the present application;
[0022] Figure 4 A schematic diagram of another plurality of images provided in an embodiment of the present application;
[0023] Figure 5 A schematic diagram of another plurality of images provided in an embodiment of the present application;
[0024] Figure 6 A schematic diagram of the types of key points identified by a key point identification algorithm provided in an embodiment of the present application;
[0025] Figure 7 A detailed process diagram of image recognition provided by an embodiment of the present application;
[0026] Figure 8 A schematic diagram of the structure of an image recognition device provided in an embodiment of the present application;
[0027] Fig. 9 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0028] The present application will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present application.
[0029] In order to accurately distinguish between faces in advertisements and faces of pedestrians, the embodiments of the present application provide an image recognition method, device, and electronic device.
[0030] The image recognition method includes: acquiring multiple images containing the same human face; determining the angle between the straight line where the eyes are located and the straight line where the nose bridge is located in each acquired image, and determining a discrete degree value according to the deviation of each acquired angle; if the discrete degree value is less than a preset threshold value, determining that the human face in each acquired image is an advertisement face, otherwise, determining that the human face in each acquired image is a pedestrian face.
[0031] Figure 1 A schematic diagram of an image recognition process provided in an embodiment of the present application, the process includes the following steps:
[0032] S101: Acquire multiple images containing the same face.
[0033] The image recognition method provided in the embodiment of the present application is applied to an electronic device, which may be an acquisition device, a PC, a server or other intelligent device.
[0034] In order to recognize the advertising face and the pedestrian face, the electronic device can first obtain multiple images containing the same face.
[0035] Among them, images containing the same face can be in the same data set, and the electronic device can obtain a preset number of images from the data set.
[0036] It should be noted that the faces in the posters containing advertising faces are highly recognizable and have a high accuracy in clustering. The face images in the same data set are all of the same natural person, and a data set of all face images is obtained. All face images in the data set are of the same person, but the same face may belong to multiple data sets.
[0037] In an embodiment of the present application, if an electronic device obtains multiple images containing the same face in a data set, then in an actual scenario, a large number of face images are stored in the data set of the same face. The present application does not need to calculate all the face images, but only needs to select some to participate in the calculation. Since the final judgment of the advertising face and the pedestrian face in the present application depends on the discreteness of the data results, the number of images can be referred to as the length of the time series sequence. If the length of the time series sequence is too short, it will affect the recognition accuracy of the algorithm. Generally, this value is between 50-100. If images are obtained from a data set, the number of images obtained exceeds half of the number of images in the data set.
[0038] S102: Determine the angle between the straight line where the eyes are located and the straight line where the bridge of the nose is located in each acquired image, and determine a discrete degree value according to the deviation of each acquired angle.
[0039] In actual scenes, the bridge of the nose has three-dimensionality in the entire facial structure. When mapped to a two-dimensional image containing a human face, it will form different angles with the horizontal line where the eyes are located due to different shooting angles. In order to recognize advertising faces and pedestrian faces, the electronic device can determine the angle between the straight line where the eyes are located and the straight line where the nose bridge is located in each acquired image. Specifically, the electronic device can pre-store a trained straight line determination model, and the electronic device can input the image into the trained straight line determination model. The model determines the straight line where the eyes are located and the straight line where the nose bridge is located respectively. The electronic device can determine the angle between the straight line where the eyes are located and the straight line where the nose bridge is located based on the straight line where the eyes are located and the straight line where the nose bridge is located. In this way, the electronic device can determine the angle between the straight line where the eyes are located and the straight line where the nose bridge is located in each image.
[0040] After determining the angle between the straight line where the eyes are located and the straight line where the bridge of the nose is located in each image, the electronic device may determine the discreteness value according to the deviation of each angle obtained. Specifically, the electronic device may determine the average value of each determined angle, and for each angle, determine the absolute value of the difference between the angle and the average value, and determine the sum of each absolute value obtained as the discreteness value.
[0041] S103: If the discrete degree value is less than a preset threshold, determining that the human face in each acquired image is an advertisement face; otherwise, determining that the human face in each acquired image is a pedestrian face.
[0042] In order to identify the faces of advertisements and the faces of pedestrians, the electronic device locally stores a preset threshold value. After determining the discrete degree value, the electronic device can determine whether the discrete degree value is less than the preset threshold value. If the discrete degree value is less than the preset threshold value, it means that the angle deviation between the straight line where the eyes are located and the straight line where the nose bridge is located in each image is small, and it can be determined that the face in each acquired image is an advertisement face. If the discrete degree value is not less than the preset threshold value, it means that the angle between the straight line where the eyes are located and the straight line where the nose bridge is located in each image is large. At this time, it can be determined that the face in each acquired image is a pedestrian's face.
[0043] That is to say, the electronic device performs logical judgment according to the discreteness judgment method mode and calculates the discreteness of multiple images. If the algorithm parameters (i.e., the discrete judgment threshold, that is, the threshold less than the preset threshold described in the embodiment of the present application) are met, the multiple images and the faces in the multiple images are determined as advertising faces, and the data sets corresponding to the multiple images are determined as advertising face image data sets, and the results are recorded.
[0044] In the embodiment of the present application, the face in the poster containing the advertising face is a two-dimensional image. When the monitoring and acquisition equipment takes pictures, the shooting angle has a negligible effect on the angle between the nose bridge and the eye level. In addition, a normal natural person will not maintain the same posture for a long time during the process of being collected by the monitoring equipment. This solution uses this feature to distinguish between the faces of pedestrians and the faces of advertising people. Among them, the faces of pedestrians can also be called real faces.
[0045] This application uses fixed algorithm logic, without the need for manual labeling or repeated training of data, to achieve the recognition function of advertising face image data sets. Specifically, there is no need for manual data labeling, and advertising faces with new features can be automatically and intelligently recognized. And the accuracy rate is high. After long-term field testing, this application can accurately screen out advertising faces. The missed detection rate is less than 5%, and the false detection rate does not exceed 1%. In addition, the algorithm performance of this application is high, and the algorithm can achieve very impressive results using a smaller data set, saving computing resources. The solution involved in this application is real-time and reliable, and meets the trustworthy characteristics.
[0046] In the embodiment of the present application, the electronic device determines the discrete degree value according to the angle between the straight line between the eyes and the straight line where the nose bridge is located in each image, and then distinguishes the advertising faces and the pedestrian faces according to the discrete degree value. Since the angle between the line segment between the eyes and the line segment at the nose bridge in the advertising face usually does not change or changes slightly, while the angle between the line segment between the eyes and the line segment at the nose bridge of the pedestrian face changes greatly as the pedestrian moves, the discrete degree value and the preset threshold value can be used to accurately identify the advertising faces and the pedestrian faces.
[0047] In order to accurately determine the discrete degree value, based on the above embodiment, in the embodiment of the present application, determining the discrete degree value according to the obtained deviation of each angle includes:
[0048] Determine a first number of angles whose deviation from a preset angle is greater than a threshold value, and a second number of angles whose deviation from the preset angle is less than a threshold value, among each of the acquired angles;
[0049] If the first number is greater than the second number, the ratio of the total number of acquired images to the first number is determined as the discrete degree value; otherwise, the total number of acquired images and the second number are determined as the discrete degree value.
[0050] In order to accurately determine the discrete degree value, the electronic device can determine a first number of angles in each acquired angle whose deviation from a preset angle is greater than a threshold, wherein the preset angle can be 45° and the threshold can be 0, and can determine a second number of angles in each acquired angle whose deviation from the preset angle is less than the threshold.
[0051] After determining the first number and the second number, the largest value of the first number and the second number can be determined. If the first number is greater than the second number, the total number of acquired images and the first number are determined as the third degree value. If the first number is not greater than the second number, the total number of acquired images and the second number are determined as discrete degree values.
[0052] The method for determining the discrete degree value provided in the embodiment of the present application can be called a continuous counting method. In a possible implementation, if a first number of angles in each acquired angle whose deviation from a preset angle is greater than a threshold exceeds a preset number, the faces in the multiple images can be determined as advertising faces, or if a second number of angles in each acquired angle whose deviation from the preset angle is less than a threshold exceeds a preset number, the faces in the multiple images can also be determined as advertising faces; otherwise, the faces in the multiple images can be determined as faces of pedestrians.
[0053] Figure 2 A schematic diagram of multiple images provided in an embodiment of the present application.
[0054] Figure 2 Below each image in (the upper and lower parts described here are Figure 2 The a in the upper and lower parts is the deviation between the obtained angle and the preset angle, where Figure 2 The number of corresponding deviations less than 0 in the multiple images is relatively large, exceeding a preset number, and therefore the faces in the multiple images can be determined as advertising faces.
[0055] Figure 3 A schematic diagram of another type of multiple images provided in an embodiment of the present application.
[0056] Figure 3 Below each image in (the upper and lower parts described here are Figure 3 The a in the upper and lower parts is the deviation between the obtained angle and the preset angle, where Figure 3 The number of corresponding deviations greater than 0 in the multiple images is relatively large, exceeding a preset number, so the faces in the multiple images can be determined as advertising faces.
[0057] Figure 4 A schematic diagram of another type of multiple images provided in an embodiment of the present application.
[0058] Figure 4 Below each image in (the upper and lower parts described here are Figure 4 The a in the upper and lower parts is the deviation between the obtained angle and the preset angle, where Figure 4 The number of deviations greater than 0 and the number of deviations less than 0 in the multiple images do not exceed the preset number, so the faces in the multiple images can be determined as faces of pedestrians.
[0059] Figure 5 A schematic diagram of another type of multiple images provided in an embodiment of the present application.
[0060] Figure 5 Below each image in (the upper and lower parts described here are Figure 5The a in the upper and lower parts is the deviation between the obtained angle and the preset angle, where Figure 5 The number of deviations greater than 0 and the number of deviations less than 0 in the multiple images do not exceed the preset number, so the faces in the multiple images can be determined as faces of pedestrians.
[0061] In order to accurately determine the discrete degree value, based on the above embodiments, in the embodiment of the present application, determining the discrete degree value according to the deviation of each angle obtained includes:
[0062] The obtained variance of each angle is determined as a discrete degree value.
[0063] In order to accurately determine the discrete degree value, after acquiring each angle, the electronic device may determine the variance of each acquired angle, and determine the variance as the discrete degree value.
[0064] It should be noted that if the face in each image is an advertisement face, the angle between the line segment between the eyes and the line segment at the bridge of the nose in each image usually does not change or changes little, then each angle obtained is relatively close, and the corresponding variance obtained is smaller, that is, the determined discrete degree value is smaller; if the face in each image is a pedestrian's face, then the angle between the line segment between the eyes and the line segment at the bridge of the nose in each image usually does not change or changes little, then each angle obtained has a large deviation, and the corresponding variance obtained is larger, and the determined discrete degree value is larger at this time.
[0065] In order to obtain multiple images, based on the above embodiments, in the embodiment of the present application, the step of obtaining multiple images containing the same face includes:
[0066] Acquire multiple candidate images;
[0067] Face recognition is performed on each acquired candidate image, and multiple candidate images containing the same face are determined as acquired images.
[0068] In order to obtain multiple images containing the same face, the electronic device may first obtain multiple candidate images, wherein the multiple candidate images are images containing a face. Specifically, the acquisition device may send each acquired image to the electronic device, the electronic device randomly obtains some images from the received images, and inputs the images into a pre-trained face recognition model to obtain the area where each face output by the face recognition model is located, and the electronic device determines the sub-image of the area where each face is located as a candidate image.
[0069] After acquiring multiple candidate images, the electronic device can perform face recognition on the multiple candidate images, determine the multiple candidate images containing the same face as the acquired images, and then determine whether the face in each image containing the same face is an advertisement face or a pedestrian face.
[0070] In a possible implementation, the electronic device may sort multiple images containing the same face according to acquisition time or structuring time.
[0071] In order to accurately identify the faces of advertisements and pedestrians, based on the above embodiments, in the embodiment of the present application, after acquiring multiple images containing the same face, and before determining the angle between the straight line where the eyes are located and the straight line where the nose bridge is located in each acquired image, the method further includes:
[0072] Determining a time length for acquiring the plurality of images according to the acquired time when the plurality of images are acquired;
[0073] Determine whether the time length exceeds a preset time length. If so, perform a subsequent step of determining an angle between a straight line where the eyes are located and a straight line where the bridge of the nose is located in each acquired image.
[0074] In actual scenarios, pedestrians may not change within a short period of time, and it is impossible to accurately distinguish between advertising faces and pedestrian faces. Therefore, in an embodiment of the present application, after acquiring multiple images containing the same face, the electronic device can determine the time length for collecting the multiple images based on the time when the multiple images were collected, and in order to accurately identify advertising faces and pedestrian faces, the electronic device locally stores a preset time length. After acquiring the time length for collecting multiple images, the electronic device can determine whether the time length exceeds the preset time length. If the time length exceeds the preset time length, the subsequent step of determining the angle between the straight line where the eyes are located and the straight line where the nose bridge is located in each image is executed. Among them, the preset time length is the time unit when performing time series calculation. It can generally be set to 5 minutes.
[0075] In order to accurately identify the faces of advertisements and pedestrians, based on the above embodiments, in the embodiment of the present application, after acquiring multiple images containing the same face, and before determining the angle between the straight line where the eyes are located and the straight line where the nose bridge is located in each acquired image, the method further includes:
[0076] If the time length does not exceed the preset time length, then obtain the earliest first target image and the latest second target image among the multiple images, obtain images whose acquisition time is the preset time length before the time when the first target image is acquired, or whose acquisition time is the preset time length after the time when the second target image is acquired, and which contain the same face, and add the acquired images to the multiple images until the time length corresponding to the multiple images after addition exceeds the preset time length, and for the multiple images after addition, perform the subsequent step of determining the angle between the straight line where the eyes are located and the straight line where the bridge of the nose is located in each acquired image.
[0077] After acquiring multiple images containing the same face, if the time length for collecting the multiple images does not exceed the preset time length, the electronic device can add other images to the multiple images until the time length for collecting the added multiple images exceeds the preset time length.
[0078] Specifically, if the time length for which the multiple images are not collected does not exceed the preset time length, the electronic device obtains the earliest first target image and the latest second target image collected from the multiple images. After obtaining the first target image and the second target image, an image whose collection time is a preset time length before the time when the first target image is collected and whose included face is the same as the face in the multiple images can be obtained, or an image whose collection time is a preset time length after the time when the second target image is collected and whose included face is the same as the face in the multiple images can be obtained. After obtaining the image, the image is added to the multiple images, and it is determined whether the time length for which the multiple images are added exceeds the preset time length. The multiple images can be referred to as a subsequence, and the process can be referred to as extending the length of the subsequence forward or backward.
[0079] If the length of time over which the added multiple images are captured exceeds the preset length of time, a subsequent step of determining the angle between the straight line where the eyes are located and the straight line where the bridge of the nose is located in each acquired image is performed for the added multiple images.
[0080] It should be noted that the multiple images are face images with a non-continuous time sequence relationship. The present application is equivalent to providing a method for screening out non-living advertising face images from face images with a non-continuous time sequence relationship.
[0081] In the embodiment of the present application, the electronic device can map the subsequence (i.e., the multiple images described in the embodiment of the present application) according to the unit of the preset time length, and the data at the same time point are merged into the same time point. For example, if the unit of the preset time length is minutes, the time after mapping of the images captured at 10:57:19 and 10:57:20 is 10:57, and any one of the two images is retained.
[0082] In order to determine the angle between the straight line where the eyes are located and the straight line where the bridge of the nose is located in the image, based on the above embodiments, in the embodiment of the present application, the angle between the straight line where the eyes are located and the straight line where the bridge of the nose is located in each acquired image includes:
[0083] Using key point recognition algorithm, determine the type and location of each facial key point in multiple images acquired;
[0084] The straight line where the eyes are located is determined according to the positions of the eyes in the multiple images, and the straight line where the nose bridge is located is determined according to the position of the nose bridge; and the angle between the straight line where the eyes are located and the straight line where the nose bridge is located is determined.
[0085] In order to determine the angle between the straight line where the eyes are located and the straight line where the nose bridge is located in the image, the electronic device can first use a key point recognition algorithm to select multiple images containing the same face to perform key point detection. Determine the type and location of each facial key point in the multiple images obtained, and obtain the location of the nose bridge point and the left and right (the left and right described here are the left and right in the actual scene) eye points, determine the straight line where the eyes are located based on the location of the eyes in the multiple images, determine the straight line where the nose bridge is located based on the location of the nose bridge, and then determine the angle between the straight line where the eyes are located and the straight line where the nose bridge is located. Among them, the key point recognition algorithm can recognize 68 key points on the face.
[0086] It should be noted that if the key point recognition algorithm fails to recognize the key points in a certain image, the image will be removed from the multiple images.
[0087] In order to accurately determine the straight line where the eyes are located, based on the above embodiments, in the embodiment of the present application, determining the straight line where the eyes are located according to the positions of the eyes in the multiple images includes:
[0088] According to the positions of each type of key points related to the eyes, the positions of the center points of both eyes are determined;
[0089] According to the position of the center point of both eyes, determine the straight line where both eyes are located.
[0090] In order to accurately determine the straight line where the eyes are located, the electronic device can determine the positions of the center points of the eyes according to the positions of each type of key points related to the eyes, and determine the straight line where the eyes are located according to the positions of the center points of the eyes.
[0091] Figure 6 A schematic diagram of the types of key points identified by a key point identification algorithm provided in an embodiment of the present application.
[0092] Depend on Figure 6 It can be seen that the key point recognition algorithm can respectively identify the position of each key point from key point 1 to key point 68, wherein key points 37 to key point 42 are key points of each type related to the left eye (the left and right described here are the left and right in the actual scene), and key points 43 to key point 48 are key points of each type related to the right eye (the left and right described here are the left and right in the actual scene). The electronic device can determine the position of the center point of the left eye (the left and right described here are the left and right in the actual scene) according to the positions of key points 37 to key point 42, and determine the position of the center point of the right eye (the left and right described here are the left and right in the actual scene) according to the positions of key points 43 to key point 48. Among them, key points 28 to key point 31 are key points of each type related to the bridge of the nose, and the straight line where the bridge of the nose is located is determined according to the positions of key points 28 to key point 31.
[0093] Specifically, the electronic device can calculate the angle between the straight line connecting the center points of the two eyes and the straight line at the bridge of the nose, and perform normalization conversion to obtain the calculation result value of a single face image, that is, the angle.
[0094] The technical points of this application include: 1. Acquire multiple images containing the same face; 2. Identify the key points of the face in the image one by one; 3. The angle between the straight line where the eyes are located and the straight line where the nose bridge is located; 4. Determine whether it is an advertising face through discrete situations.
[0095] Figure 7 A detailed process diagram of image recognition provided in an embodiment of the present application includes the following steps:
[0096] S701: Acquire multiple images in any data set.
[0097] S702: Obtain the length of time during which the multiple images are captured.
[0098] S703: Determine whether the time length exceeds the preset time length, if so, execute S705, if not, execute S704.
[0099] S704: Acquire the earliest first target image and the latest second target image among the multiple images, acquire images whose acquisition time is a preset time before the time when the first target image is acquired, or whose acquisition time is a preset time after the time when the second target image is acquired, and contain images of the same face, add the acquired images to the multiple images, and execute S702.
[0100] S705: Using a key point recognition algorithm, determine the type and location of each facial key point in the acquired multiple images.
[0101] S706: Determine the straight line where the eyes are located according to the positions of the eyes in the multiple images, and determine the straight line where the nose bridge is located according to the position of the nose bridge; and determine the angle between the straight line where the eyes are located and the straight line where the nose bridge is located.
[0102] S707: Determine a discrete degree value according to the obtained deviation of each angle.
[0103] S708: Determine whether the discrete degree value is less than a preset threshold value, if so, execute S709, otherwise, execute S710.
[0104] S709: Determine whether the human face in each acquired image is an advertisement face.
[0105] S710: Determine whether a face in each acquired image is a face of a pedestrian.
[0106] The electronic device may perform the above-mentioned image recognition on each data set.
[0107] Figure 8 A schematic diagram of the structure of an image recognition device provided in an embodiment of the present application, the device comprising:
[0108] An acquisition module 801 is used to acquire multiple images containing the same face;
[0109] A determination module 802 is used to determine the angle between the straight line where the eyes are located and the straight line where the bridge of the nose is located in each acquired image, and determine a discrete degree value according to the deviation of each acquired angle;
[0110] The processing module 803 is used to determine that the human face in each acquired image is an advertisement face if the discrete degree value is less than a preset threshold value; otherwise, determine that the human face in each acquired image is a pedestrian face.
[0111] Furthermore, the determination module 802 is specifically used to determine a first number of angles whose deviation from a preset angle is greater than a threshold value, and a second number of angles whose deviation from the preset angle is less than a threshold value in each acquired angle; if the first number is greater than the second number, the first number is determined as a discrete degree value, otherwise, the second number is determined as a discrete degree value.
[0112] Furthermore, the determination module 802 is specifically configured to determine the obtained variance of each angle as a discrete degree value.
[0113] Furthermore, the acquisition module 801 is specifically used to acquire multiple candidate images; perform face recognition on each acquired candidate image, and determine multiple candidate images containing the same face as the acquired images.
[0114] Furthermore, the determination module 802 is also used to determine the time length for acquiring the multiple images based on the time when the multiple images are acquired; and to determine whether the time length exceeds a preset time length. If so, a subsequent step of determining the angle between the straight line where the eyes are located and the straight line where the bridge of the nose is located in each acquired image is executed.
[0115] Furthermore, the determination module 802 is also used to obtain the earliest first target image and the latest second target image captured among the multiple images if the time length does not exceed the preset time length, obtain images whose acquisition time is a preset time length before the time when the first target image is captured, or whose acquisition time is a preset time length after the time when the second target image is captured, and contain images of the same face, add the acquired images to the multiple images until the time length corresponding to the multiple images after addition exceeds the preset time length, and perform the subsequent step of determining the angle between the straight line where the eyes are located and the straight line where the bridge of the nose is located in each acquired image for the multiple images after addition.
[0116] Furthermore, the determination module 802 is specifically used to use a key point recognition algorithm to determine the type and position of each facial key point in the multiple images obtained; determine the straight line where the eyes are located according to the positions of the eyes in the multiple images, and determine the straight line where the nose bridge is located according to the position of the nose bridge; and determine the angle between the straight line where the eyes are located and the straight line where the nose bridge is located.
[0117] Furthermore, the determination module 802 is specifically configured to determine the position of the center point of both eyes according to the position of each type of key point related to the eyes; and determine the straight line where the two eyes are located according to the position of the center point of the two eyes.
[0118] Fig. 9The present invention provides a schematic diagram of an electronic device structure according to an embodiment of the present invention. Based on the above embodiments, the present invention further provides an electronic device, such as Fig. 9 As shown, it includes: a processor 901, a communication interface 902, a memory 903 and a communication bus 904, wherein the processor 901, the communication interface 902, and the memory 903 communicate with each other through the communication bus 904;
[0119] The memory 903 stores a computer program. When the program is executed by the processor 901, the processor 901 performs the following steps:
[0120] Get multiple images containing the same face;
[0121] Determine the angle between the straight line where the eyes are located and the straight line where the bridge of the nose is located in each acquired image, and determine the discrete degree value according to the deviation of each acquired angle;
[0122] If the discrete degree value is less than a preset threshold, it is determined that the human face in each acquired image is an advertisement face; otherwise, it is determined that the human face in each acquired image is a pedestrian face.
[0123] Further, the processor 901 is specifically configured to determine a first number of angles whose deviation from a preset angle is greater than a threshold value, and a second number of angles whose deviation from the preset angle is less than a threshold value, among each of the acquired angles;
[0124] If the first number is greater than the second number, the first number is determined as the discrete degree value; otherwise, the second number is determined as the discrete degree value.
[0125] Furthermore, the processor 901 is specifically configured to determine the obtained variance of each angle as a discrete degree value.
[0126] Furthermore, the processor 901 is specifically configured to obtain a plurality of candidate images;
[0127] Face recognition is performed on each acquired candidate image, and multiple candidate images containing the same face are determined as acquired images.
[0128] Further, the processor 901 is further configured to determine a time length for acquiring the plurality of images according to the acquired time when the plurality of images are acquired;
[0129] Determine whether the time length exceeds a preset time length. If so, perform a subsequent step of determining an angle between a straight line where the eyes are located and a straight line where the bridge of the nose is located in each acquired image.
[0130] Furthermore, the processor 901 is also used to obtain the earliest first target image and the latest second target image captured among the multiple images if the time length does not exceed the preset time length, obtain images whose acquisition time is a preset time length before the time when the first target image is captured, or whose acquisition time is a preset time length after the time when the second target image is captured, and contain images of the same face, add the acquired images to the multiple images until the time length corresponding to the multiple images after addition exceeds the preset time length, and perform the subsequent step of determining the angle between the straight line where the eyes are located and the straight line where the bridge of the nose is located in each acquired image for the multiple images after addition.
[0131] Furthermore, the processor 901 is specifically configured to use a key point recognition algorithm to determine the type and location of each facial key point in the acquired multiple images;
[0132] The straight line where the eyes are located is determined according to the positions of the eyes in the multiple images, and the straight line where the nose bridge is located is determined according to the position of the nose bridge; and the angle between the straight line where the eyes are located and the straight line where the nose bridge is located is determined.
[0133] Furthermore, the processor 901 is specifically configured to determine the position of the center point of both eyes according to the position of each type of key point related to the eyes;
[0134] According to the position of the center point of both eyes, determine the straight line where both eyes are located.
[0135] The communication bus mentioned in the above server can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0136] The communication interface is used for communication between the above electronic device and other devices.
[0137] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0138] The above-mentioned processor can be a general-purpose processor, including a central processing unit, a network processor (Network Processor, NP), etc.; it can also be a digital signal processing processor (Digital Signal Processing, DSP), an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, etc.
[0139] On the basis of the above embodiments, an embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program executable by an electronic device, and when the program is run on the electronic device, the electronic device implements the following steps when executing:
[0140] The memory stores a computer program, and when the program is executed by the processor, the processor performs the following steps:
[0141] Get multiple images containing the same face;
[0142] Determine the angle between the straight line where the eyes are located and the straight line where the bridge of the nose is located in each acquired image, and determine the discrete degree value according to the deviation of each acquired angle;
[0143] If the discrete degree value is less than a preset threshold, it is determined that the human face in each acquired image is an advertisement face; otherwise, it is determined that the human face in each acquired image is a pedestrian face.
[0144] In a possible implementation manner, determining the discrete degree value according to the obtained deviation of each angle includes:
[0145] Determine a first number of angles whose deviation from a preset angle is greater than a threshold value, and a second number of angles whose deviation from the preset angle is less than a threshold value, among each of the acquired angles;
[0146] If the first number is greater than the second number, the first number is determined as the discrete degree value; otherwise, the second number is determined as the discrete degree value.
[0147] In a possible implementation manner, determining the discrete degree value according to the obtained deviation of each angle includes:
[0148] The obtained variance of each angle is determined as a discrete degree value.
[0149] In a possible implementation, acquiring multiple images containing the same face includes:
[0150] Acquire multiple candidate images;
[0151] Face recognition is performed on each acquired candidate image, and multiple candidate images containing the same face are determined as acquired images.
[0152] In a possible implementation, after acquiring multiple images containing the same face and before determining the angle between the straight line where the eyes are located and the straight line where the nose bridge is located in each acquired image, the method further includes:
[0153] Determining a time length for acquiring the plurality of images according to the acquired time when the plurality of images are acquired;
[0154] Determine whether the time length exceeds a preset time length. If so, perform a subsequent step of determining an angle between a straight line where the eyes are located and a straight line where the bridge of the nose is located in each acquired image.
[0155] In a possible implementation, after acquiring multiple images containing the same face and before determining the angle between the straight line where the eyes are located and the straight line where the nose bridge is located in each acquired image, the method further includes:
[0156] If the time length does not exceed the preset time length, then obtain the earliest first target image and the latest second target image among the multiple images, obtain images whose acquisition time is the preset time length before the time when the first target image is acquired, or whose acquisition time is the preset time length after the time when the second target image is acquired, and which contain the same face, and add the acquired images to the multiple images until the time length corresponding to the multiple images after addition exceeds the preset time length, and for the multiple images after addition, perform the subsequent step of determining the angle between the straight line where the eyes are located and the straight line where the bridge of the nose is located in each acquired image.
[0157] In a possible implementation manner, determining the angle between the straight line where the eyes are located and the straight line where the bridge of the nose is located in each acquired image includes:
[0158] Using key point recognition algorithm, determine the type and location of each facial key point in multiple images acquired;
[0159] The straight line where the eyes are located is determined according to the positions of the eyes in the multiple images, and the straight line where the nose bridge is located is determined according to the position of the nose bridge; and the angle between the straight line where the eyes are located and the straight line where the nose bridge is located is determined.
[0160] In a possible implementation manner, determining the straight line where the eyes are located according to the positions of the eyes in the multiple images includes:
[0161] According to the positions of each type of key points related to the eyes, the positions of the center points of both eyes are determined;
[0162] According to the position of the center point of both eyes, determine the straight line where both eyes are located.
[0163] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0164] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0165] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0166] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0167] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. An image recognition method, characterized in that: The method comprises: Get multiple images containing the same face; Determine the angle between the straight line where the eyes are located and the straight line where the bridge of the nose is located in each acquired image, and determine the discrete degree value according to the deviation of each acquired angle; If the discrete degree value is less than a preset threshold, it is determined that the human face in each acquired image is an advertisement face; otherwise, it is determined that the human face in each acquired image is a pedestrian face.
2. The method according to claim 1, characterized in that Determining the discrete degree value according to the obtained deviation of each angle includes: Determine a first number of angles whose deviation from a preset angle is greater than a threshold value, and a second number of angles whose deviation from the preset angle is less than a threshold value, among each of the acquired angles; If the first number is greater than the second number, the first number is determined as the discrete degree value; otherwise, the second number is determined as the discrete degree value.
3. The method according to claim 1, characterized in that Determining the discrete degree value according to the obtained deviation of each angle includes: The obtained variance of each angle is determined as a discrete degree value.
4. The method according to claim 1, characterized in that: The obtaining of multiple images containing the same face includes: Acquire multiple candidate images; Face recognition is performed on each acquired candidate image, and multiple candidate images containing the same face are determined as acquired images.
5. The method according to claim 1, characterized in that After acquiring multiple images containing the same face, and before determining the angle between the straight line where the eyes are located and the straight line where the nose bridge is located in each acquired image, the method further includes: Determining a time length for acquiring the plurality of images according to the acquired time when the plurality of images are acquired; Determine whether the time length exceeds a preset time length. If so, perform a subsequent step of determining an angle between a straight line where the eyes are located and a straight line where the bridge of the nose is located in each acquired image.
6. The method according to claim 5, characterized in that After acquiring multiple images containing the same face, and before determining the angle between the straight line where the eyes are located and the straight line where the nose bridge is located in each acquired image, the method further includes: If the time length does not exceed the preset time length, then obtain the earliest first target image and the latest second target image among the multiple images, obtain images whose acquisition time is the preset time length before the time when the first target image is acquired, or whose acquisition time is the preset time length after the time when the second target image is acquired, and which contain the same face, and add the acquired images to the multiple images until the time length corresponding to the multiple images after addition exceeds the preset time length, and for the multiple images after addition, perform the subsequent step of determining the angle between the straight line where the eyes are located and the straight line where the bridge of the nose is located in each acquired image.
7. The method according to claim 1, characterized in that Determining the angle between the straight line where the eyes are located and the straight line where the bridge of the nose is located in each acquired image includes: Using key point recognition algorithm, determine the type and location of each facial key point in multiple images acquired; The straight line where the eyes are located is determined according to the positions of the eyes in the multiple images, and the straight line where the nose bridge is located is determined according to the position of the nose bridge; and the angle between the straight line where the eyes are located and the straight line where the nose bridge is located is determined.
8. The method according to claim 7, characterized in that Determining the straight line where the two eyes are located according to the positions of the two eyes in the multiple images includes: According to the positions of each type of key points related to the eyes, the positions of the center points of both eyes are determined; According to the position of the center point of both eyes, determine the straight line where both eyes are located.
9. An image recognition device, characterized in that: The device comprises: An acquisition module, used for acquiring multiple images containing the same face; A determination module is used to determine the angle between the straight line where the eyes are located and the straight line where the bridge of the nose is located in each acquired image, and determine the discrete degree value according to the deviation of each acquired angle; The processing module is used to determine that the human face in each acquired image is an advertisement face if the discrete degree value is less than a preset threshold value, otherwise, determine that the human face in each acquired image is a pedestrian face.
10. An electronic device, characterized in that: The electronic device comprises at least a processor and a memory, and the processor is used to implement the steps of the image recognition method as described in any one of claims 1 to 8 when executing a computer program stored in the memory.
Citation Information
Cited By
Character recognition method, system and device and medium
CN121708625A