CN111310532A - Age identification method and device, electronic equipment and storage medium - Google Patents

Age identification method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN111310532A
CN111310532A CN201811521113.0A CN201811521113A CN111310532A CN 111310532 A CN111310532 A CN 111310532A CN 201811521113 A CN201811521113 A CN 201811521113A CN 111310532 A CN111310532 A CN 111310532A
Authority
CN
China
Prior art keywords
age
image
probability
target object
sample
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
CN201811521113.0A
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 Didi Infinity Technology and Development Co Ltd
Original Assignee
Beijing Didi Infinity Technology and 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 Didi Infinity Technology and Development Co Ltd filed Critical Beijing Didi Infinity Technology and Development Co Ltd
Priority to CN201811521113.0A priority Critical patent/CN111310532A/en
Publication of CN111310532A publication Critical patent/CN111310532A/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/168Feature extraction; Face representation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • 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/178Human faces, e.g. facial parts, sketches or expressions estimating age from face image; using age information for improving recognition

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Oral & Maxillofacial Surgery (AREA)
  • Health & Medical Sciences (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • General Physics & Mathematics (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Evolutionary Computation (AREA)
  • General Engineering & Computer Science (AREA)
  • Evolutionary Biology (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Artificial Intelligence (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • Human Computer Interaction (AREA)
  • Multimedia (AREA)
  • Image Analysis (AREA)

Abstract

The invention provides an age identification method, an age identification device, electronic equipment and a storage medium, and relates to the field of age identification. According to the age identification method, the obtained target identification image is input into a pre-trained age identification model, the probability that the target object in the target identification image is at each of a plurality of preset ages is obtained, and then the age of the target object is determined according to the probability that the target object is at each preset age and the weight of each age. Because the appearance of the target object at several adjacent ages does not change too much, when the model outputs the age of the target object, the probability of the age near the real age of the target object is higher, and furthermore, the problem of inaccurate model identification caused by the problems of the image (such as insufficient definition and higher probability of certain age far from the real age) is avoided by adopting a weighting calculation mode.

Description

Age identification method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of age identification, and in particular, to an age identification method, an age identification apparatus, an electronic device, and a storage medium.
Background
As the standard of living increases, users expect higher quality services. In order to ensure the quality of service and the pertinence of service, a large amount of user data is generally acquired before a user is served, so as to specify a more appropriate service policy. In practice, some user data is not easily available, such as the age of the user, and therefore, image recognition techniques are commonly used in the related art to determine the age of the user.
When determining the age of the user, firstly, a picture of the face of the user needs to be taken through a camera, and then the age of the user is determined according to the feature points on the picture of the face of the user by adopting an image recognition technology.
Disclosure of Invention
The invention aims to provide an age identification method, an age identification device, an electronic device and a storage medium.
In some embodiments, an age identification method comprises:
acquiring a target identification image;
inputting the target identification image into a pre-trained age identification model to obtain the probability that the target object in the target identification image is respectively at each of a plurality of preset ages;
and determining the age of the target object according to the probability that the target object is respectively preset for each age and the weight of each age.
In some embodiments, inputting the target recognition image into a pre-trained age recognition model, and obtaining a probability that the target object in the target recognition image is at each of a plurality of preset ages, includes:
extracting a face image of a target object from a target recognition image;
the face image of the target object is input into a pre-trained age identification model, and the probability that the target object is at each of a plurality of preset ages is obtained.
In some embodiments, inputting the target recognition image into a pre-trained age recognition model, and obtaining a probability that the target object in the target recognition image is at each of a plurality of preset ages, includes:
extracting a face image and a body image of a target object from a target recognition image;
and inputting the face image and the body image of the target object into a pre-trained age identification model to obtain the probability that the target object is at each of a plurality of preset ages.
In some embodiments, the body image of the target object comprises any one or more of:
hair images, extremity images and neck images.
In some embodiments, extracting a face image and a body image of the target object from the target recognition image comprises:
determining the face image position of a target object in a target recognition image;
and taking the face image position of the target object as a reference, and extracting the body image from the target recognition image according to the relative position relation between the face image position and the body image position.
In some embodiments, inputting the target recognition image into a pre-trained age recognition model, and obtaining a probability that the target object in the target recognition image is at each of a plurality of preset ages, includes:
inputting the target identification image into a pre-trained age identification model to obtain the probability of each preset age bracket of the target object in the target identification image;
determining the age of the target object according to the probability that the target object is each preset age and the weight of each age, wherein the method comprises the following steps:
and calculating the age of the target object according to the probability of the target object in each preset age group and the weight of each age group.
In some embodiments, calculating the age of the target object according to the probability of each age group and the weight of each age group, which are preset by the target object, respectively, includes:
and calculating the age value of the target object or the age range of the target object according to the preset probability of each age range of the target object and the weight of each age range.
In some embodiments, calculating the age value of the target object according to the probability of each age group and the weight of each age group that the target object is respectively preset comprises:
and calculating the age of the target object according to the intermediate value of each age group, the probability that the target object is preset for each age group and the weight of each age group.
In some embodiments, the age identification model is trained by:
inputting the sample identification images in the sample set into an age identification model to obtain the probability that the sample objects in the sample identification images are respectively at each preset age;
generating a loss function according to the probability that the reference object is preset for each age and the standard age of the sample identification image;
the age identification model is trained using the generated loss function.
In some embodiments, generating the loss function according to the probability of the reference object for each preset age and the standard age of the sample identification image respectively comprises: .
Generating a loss function according to the probability of the reference object for each reference age and the weight corresponding to each reference age; the reference age is an age whose difference from the standard age of the sample recognition image is less than a preset value.
In some embodiments, training an age identification model using the generated loss function comprises:
for each reference age, determining an adjusting coefficient of the reference age according to the number proportion of the sample identification images corresponding to the standard age with the same numerical value as the reference age;
adjusting the loss function according to the adjustment coefficient corresponding to the reference age;
and training the age identification model by using the adjusted loss function.
In some embodiments, inputting the sample identification images in the sample set into the age identification model, and obtaining the probability that the sample objects in the sample identification images are respectively at each preset age comprises:
extracting a face image of the sample object from the sample recognition image;
and inputting the face image of the sample object into the age identification model to obtain the probability that the sample object is at each of a plurality of preset ages.
In some embodiments, inputting the sample identification images in the sample set into the age identification model, and obtaining the probability that the sample objects in the sample identification images are respectively at each preset age comprises:
extracting a face image and a body image of the sample object from the sample recognition image;
and inputting the face image and the body image of the sample object into the age identification model to obtain the probability that the sample object is at each of a plurality of preset ages.
In some embodiments, a loss function is generated according to the probability of the reference object for each reference age and the corresponding weight of each reference age; the reference age is an age whose difference from the standard age of the sample recognition image is less than a preset value, and includes:
determining a sampling range according to the standard age of the sample identification image;
and generating a loss function according to the probability of each reference age corresponding to the determined sampling range and the weight corresponding to each reference age.
In some embodiments, a loss function is generated according to the probability of the reference object for each reference age and the corresponding weight of each reference age; the reference age is an age whose difference from the standard age of the sample recognition image is less than a preset value, and includes:
determining the weight corresponding to each reference age according to the calculation parameters of the reference ages; the calculated parameters of the reference age include at least one of: a value of the reference age, a difference between the reference age and the standard age;
and generating a loss function according to the probability of the reference object for each reference age and the corresponding weight of each reference age.
In some embodiments, an age identification device, comprising:
the first acquisition module is used for acquiring a target identification image;
the first input module is used for inputting the target identification image into a pre-trained age identification model to obtain the probability that the target object in the target identification image is respectively at each of a plurality of preset ages;
the first determining module is used for determining the age of the target object according to the probability that the target object is preset for each age and the weight of each age.
In some embodiments, a first input module, comprising:
a first extraction unit configured to extract a face image of a target object from a target recognition image;
the first input unit is used for inputting the face image of the target object into a pre-trained age identification model to obtain the probability that the target object is at each of a plurality of preset ages.
In some embodiments, a first input module, comprising:
a second extraction unit for extracting a face image and a body image of the target object from the target recognition image;
and the second input unit is used for inputting the face image and the body image of the target object into the pre-trained age identification model to obtain the probability that the target object is at each of a plurality of preset ages.
In some embodiments, the body image of the target object comprises any one or more of:
hair images, extremity images and neck images.
In some embodiments, the second extraction unit comprises:
the first determining subunit is used for determining the face image position of the target object in the target recognition image;
and the first extraction subunit is used for extracting the body image from the target recognition image according to the relative position relationship between the position of the face image and the position of the body image by taking the position of the face image of the target object as a reference.
In some embodiments, a first input module, comprising:
the third input unit is used for inputting the target identification image into a pre-trained age identification model to obtain the probability of each preset age bracket of the target object in the target identification image;
a first determination module comprising:
and the first determining unit is used for calculating the age of the target object according to the probability that the target object is respectively preset in each age group and the weight of each age group.
In some embodiments, the first determination unit comprises:
and the second determining subunit is used for calculating the age value of the target object or the age group of the target object according to the preset probability of each age group of the target object and the preset weight of each age group.
In some embodiments, the second determining subunit is further configured to calculate the age of the target object according to the median of each age group, the probability that the target object is each of the preset ages, and the weight of each age group.
In some embodiments, the age identification model is trained by:
the second input module is used for inputting the sample identification images in the sample set into the age identification model to obtain the probability that the sample objects in the sample identification images are respectively at each preset age;
the first generation module is used for generating a loss function according to the probability that the reference object is preset for each age and the standard age of the sample identification image;
and the first training module is used for training the age identification model by using the generated loss function.
In some embodiments, a first generation module comprises: .
The first generating unit is used for generating a loss function according to the probability of the reference object for each reference age and the weight corresponding to each reference age; the reference age is an age whose difference from the standard age of the sample recognition image is less than a preset value.
In some embodiments, a first training module, comprising:
a second determining unit configured to determine, for each reference age, an adjustment coefficient of the reference age based on a ratio of the number of sample identification images corresponding to a standard age having the same numerical value as the reference age;
the first adjusting unit is used for adjusting the loss function according to an adjusting coefficient corresponding to the reference age;
and the first training unit is used for training the age identification model by using the adjusted loss function.
In some embodiments, the second input module comprises:
a third extraction unit for extracting a face image of the sample object from the sample recognition image;
and the fourth input unit is used for inputting the face image of the sample object into the age identification model to obtain the probability that the sample object is respectively at each of a plurality of preset ages.
In some embodiments, the second input module comprises:
a fourth extraction unit for extracting a face image and a body image of the sample object from the sample recognition image;
and the fifth input unit is used for inputting the face image and the body image of the sample object into the age identification model to obtain the probability that the sample object is at each of a plurality of preset ages.
In some embodiments, the first generating unit includes:
the third determining subunit is used for determining a sampling range according to the standard age of the sample identification image;
and the first generation subunit is used for generating the loss function according to the probability of each reference age corresponding to the determined sampling range and the weight corresponding to each reference age.
In some embodiments, the first generating unit includes:
the fourth determining subunit is used for determining the weight corresponding to each reference age according to the calculation parameters of the reference ages; the calculated parameters of the reference age include at least one of: a value of the reference age, a difference between the reference age and the standard age;
and the second generation subunit is used for generating the loss function according to the probability that the reference object is respectively used as each reference age and the weight corresponding to each reference age.
In some embodiments, an electronic device comprises: a processor, a storage medium and a bus, the storage medium storing machine-readable instructions executable by the processor, the processor and the storage medium communicating via the bus when the electronic device is operating, the processor executing the machine-readable instructions to perform steps such as an age identification method when executed.
In some embodiments, a computer-readable storage medium has stored thereon a computer program which, when executed by a processor, performs steps such as an age identification method.
According to the age identification method, the obtained target identification image is input into a pre-trained age identification model, the probability that the target object in the target identification image is at each of a plurality of preset ages is obtained, and then the age of the target object is determined according to the probability that the target object is at each preset age and the weight of each age. In this method of determining the age of the target object, instead of directly setting the age with the highest probability of the model output as the age of the target object, the probabilities of different ages are weighted and the result of the weighting is set as the final age of the target object. Because the appearance of the target object at several adjacent ages does not change too much, when the age of the target object is output by the model, the probability of the age near the real age of the target object is higher, and furthermore, the accuracy of age determination is improved by adopting a weighting calculation mode, and the problem of inaccurate model identification caused by the problem of image self (such as low definition) is avoided.
In some embodiments, the method provided by the application also determines the probability of each age based on the face image and the body image simultaneously, and improves the accuracy of determining the probability of each age.
In some embodiments, in the method provided by the present application, when calculating the loss function used for training the age identification model, not only the probability of the standard age output by the age identification model but also the probabilities of a plurality of reference ages adjacent to the standard age are considered, and this way of calculating the loss function makes the trained model more suitable for the method of estimating age.
In some embodiments, the method provided by the present application further determines an adjustment coefficient according to a number ratio of the sample identification images corresponding to the standard age that is the same as the reference age, and adjusts the loss function according to the adjustment coefficient, so that the adjusted loss function has higher reliability.
In some embodiments, when the age identification model is trained, the method provided by the application further determines a sampling range according to the size of the standard age, and generates the loss function according to the probability of each reference age corresponding to the determined sampling range and the weight corresponding to each reference age, so that the determination of the loss function is more accurate.
In order to make the aforementioned and other objects, features and advantages of the present invention comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present invention and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained according to the drawings without inventive efforts.
Fig. 1 shows a basic flow chart of an age identification method provided by an embodiment of the present invention;
fig. 2 is a flowchart illustrating a process of training an age recognition model in the age recognition method according to an embodiment of the present invention;
fig. 3 is a detailed flowchart illustrating training of an age identification model after introducing an adjustment coefficient in the age identification method according to an embodiment of the present invention;
fig. 4 shows a schematic diagram of an electronic device provided in an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. The components of embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present invention, presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the present invention without making any creative effort, shall fall within the protection scope of the present invention.
In the related art, the deep learning neural network greatly promotes the development of the face recognition technology, so that the face recognition technology is applied to a plurality of technologies. For example, the face recognition technology can be applied to security technology, parking charging technology and age recognition technology.
The age recognition technology is applied by firstly taking a picture of the face of a user through a camera and then inputting the picture into an age recognition model, so that the age recognition model directly outputs the age of the user.
When the age of the user is output, the age identification model usually calculates the probability of the user for each age, and outputs the age with the highest probability as the actual age of the user. If the age identification model obtains that the probability of the user being 30 years old is 0.1; the probability of being 31 years old is 0.2; the probability of being 32 years old is 0.4; the probability of 33 years of age is 0.15; the probability of being 34 years old is 0.1; the probability of being 35 years old is 0.05. The actual age of the user output by the age identification model is 32 years.
However, in actual use, the way of determining the age is not ideal, and causes such a situation are many, for example, the situation is influenced by the image itself (for example, the definition of the image is not high enough), so that the features of the face captured by the age recognition model are not accurate enough, and further, the process of subsequently judging the age is inaccurate. For another example, each person may age at different rates or ages, some people may only look 20 years old at age 30, and some people may look like 35 years old at age 30. In view of this, the inventor of the present application believes that the above situation can be improved by adding a fault tolerance mechanism in the process of age identification.
Further, the present application provides an age identifying method, as shown in fig. 1, including:
s101, acquiring a target identification image;
s102, inputting the target identification image into a pre-trained age identification model to obtain the probability that the target object in the target identification image is of each of a plurality of preset ages;
s103, determining the age of the target object according to the probability that the target object is preset for each age and the weight of each age.
In step S101, the target recognition image is usually an image at least including a human face. The target recognition image may be an image obtained by photographing a specified person using an image pickup device such as a camera.
In step S102, the age recognition model trained in advance is obtained by training using a large number of sample recognition images. When the age recognition model is trained, in addition to providing the sample recognition images to the age recognition model, the model needs to be provided with the standard age of each sample recognition image (the real age of the person in the sample recognition image). Furthermore, the age recognition model may determine the features that the image corresponding to each standard age generally has according to the features in the sample recognition image and the standard ages of the sample recognition image, and after the target recognition image is input to the age recognition model in step S102, the age recognition model may first extract the features in the target recognition image using the convolution layer, and then determine the probability of each age among a plurality of ages in which the target object in the target recognition image is respectively preset according to the extracted features.
For example, the probability of each age corresponding to the target object in the age recognition image output by the age recognition model is shown in table 1 below:
TABLE 1
Figure BDA0001903252630000111
Figure BDA0001903252630000121
Table 1 shows probabilities corresponding to different ages (probabilities of ages not listed in table 1 are all 0), and in the related art, an age having the highest probability is usually used as the age of the target object, for example, age 33 in table 1 may be used as the age of the target object.
However, the inventors of the present application believe that this way of determining age is not very accurate, and that it is sometimes not accurate to consider only the age with the highest probability. As in the case shown in table 1, it can be seen that the probability that the target object is 33, 34, and 35 years old is large. In this case, if the age of 33 is directly output as an actual result, it may cause inaccuracy in determination of the actual result. For example, due to the influence of image definition, when the age identification model calculates the features of the target object, the features are not accurately extracted, so that the probability that the model considers the age a to be the maximum is caused, but in the result output by the model, there is a probability that the value of the maximum probability is relatively close, and the age corresponding to the relatively close probability may be the actual age of the target object. This is mainly because facial features of users of similar ages are relatively close, so targeting age 33 directly, as in table 1, is less accurate for the true age of favoring that. That is, when the probability of the age a is not significantly higher than the probabilities of each of the other ages, it may be inaccurate to directly take the age a as the age of the target object.
In view of this situation, the inventors of the present application believe that the age of the target object can be determined in a weighted calculation manner.
That is, in step S103, the age of the target object is determined based on the probability of each age that the target object is respectively preset, and the weight of each age. That is, in step S103, the actual age of the target object is determined based on the probability of each age output by the age identification model; alternatively, in step S103, the actual age of the target object is determined based on the probabilities of at least two ages output from the age recognition model.
Here, the preset each age may refer to each age output by the age recognition model; or may refer to a partial age output by the age identification model.
When each preset age is the one output by the age recognition model, if the output result of the age recognition model is the case shown in table 1, step S103 is executed to determine the age of the target object by considering at least the probability of each age from 30 to 39 years (since the probabilities of other ages are all 0, the final result is not affected even if the probabilities of the ages not listed in table 1 are considered).
When each preset age is a part of the age output by the age identification model, the implementation manners that can be selected in step S103 are more, and only the following are listed here:
implementation of the first step S103:
and determining the age of the target object according to the probability of the ages with the numerical values exceeding the preset threshold value and the weight of each age.
The implementation mode mainly avoids the influence of the probability of too small value on the final calculation. As in the case shown in table 1, if the preset threshold is 0.1, the parameters involved in determining the actual age of the target subject are only as follows: age 32, probability 0.12; age 33, probability 0.22; age 34, probability 0.21; age 35 with a probability of 0.20.
If the preset threshold is 0.2, the parameters involved in determining the actual age of the target subject are only as follows: age 33, probability 0.22; age 34, probability 0.21; age 35 with a probability of 0.20.
Further, after the probability and age that can participate in calculating the actual age of the target subject are determined using the preset threshold, the determined probability and age can be directly used to determine the actual age of the target subject.
Here, the size of the preset threshold may be a fixed value, for example, the size of the preset threshold may be 0.1, 0.2, 0.05, and so on. The size of the preset threshold value can also be determined according to the probability of each age output by the age identification model. For example, the average value of the probabilities that are output by the age recognition model and are each not 0 may be used as the preset threshold, and as shown in table 1, the average value of the probabilities of 30 to 39 years may be used as the preset threshold. That is, in the results corresponding to table 1, the preset threshold value is (0.02+0.06+0.12+0.22+0.21+0.20+0.08+0.05+0.03+0.01)/10 — 0.1.
Of course, in a specific implementation, an average value of the probabilities that the magnitude exceeds a predetermined value may be used as a preset threshold. If the predetermined value is 0.05, the preset threshold may be determined according to the average value of 0.06 (probability corresponding to age 31), 0.12 (probability corresponding to age 32), 0.22 (probability corresponding to age 33), 0.21 (probability corresponding to age 34), 0.20 (probability corresponding to age 35), and 0.08 (probability corresponding to age 36) according to the results shown in table 1.
Implementation of the second step S103:
and determining the age of the target object according to the probability of the ages with the highest probability and the weight of each age.
In a specific implementation, the probabilities of the ages output by the age identification model may be ranked first, for example, ranking the probabilities shown in table 1 may obtain the results shown in table 2:
TABLE 2
Rank order Age (age) Probability of
1 33 0.22
2 34 0.21
3 35 0.2
4 32 0.12
5 36 0.08
6 31 0.06
7 37 0.05
8 38 0.03
9 30 0.02
10 39 0.01
As can be seen from table 2, the probability of each age is the highest for the ranking, 33, and the probability of 39 is the lowest. Further, when step S103 is executed, if the age of the target object is determined based on the probability of 4 ages having the largest numerical value and the weight of each age, the age of the target object should be determined based on 0.12 (probability corresponding to age 32), 0.22 (probability corresponding to age 33), 0.21 (probability corresponding to age 34), and 0.20 (probability corresponding to age 35) in accordance with the case shown in table 2.
In both of the above two implementations, the age of the target object is determined based on the probability of a plurality of preset ages, and besides this, the age of the target object may be determined according to the probability that the target object belongs to a certain age group, and further, the following third implementation may be adopted to implement step S103.
Implementation of the third step S103:
step S102 may be implemented as follows:
step 1021, inputting the target identification image into a pre-trained age identification model to obtain the probability of each preset age bracket of the target object in the target identification image;
step S103 may be implemented as follows:
and step 1031, calculating the age of the target object according to the probability of each age group and the weight of each age group, which are preset by the target object respectively.
In step 1021, each predetermined age group is composed of multiple ages (usually a continuous plurality of ages), for example, the predetermined age group may be 30-35 years old, or 22-27 years old. In particular, each age group should be contiguous and disjoint (not repeated) (e.g., any one age value can only belong to one age group). For example, 0-50 years of age can be divided into the following age groups: 0-5 years old; 6-10 years old; 11-15 years old; 16-20 years old; 21-25 years old; 26-30 years old; 31-35 years old; 36-40 years old; age 41-45 years old; and age 46-50.
In step 1031, the calculated age of the target object may be a point value of the age of the target object, for example, the target object is 35 years old; it may also be a range of values (age bracket) in which the age of the target subject is, for example, 30-35 years old. Generally, it is more reasonable to output a certain age group as the age of the target object, mainly in a small age group, the adjacent age values cannot be accurately distinguished by the image recognition technology, for example, images in 30 years and 31 years are usually not obviously different, so outputting a certain age group as the age of the target object not only can improve the fault tolerance rate, but also can reduce the amount of model calculation, which is a preferable implementation manner.
In a specific implementation, if the point value of the age is output as the age of the target object, a corresponding calculated value (for example, a median of the ages of the age, a maximum value of the ages, and a minimum value of the ages) may be set for each age group, and then the age of the target object is calculated according to the calculated value of each age group, the weight of each age group, and the probability of each age group.
To ensure the accuracy of the calculation, it is common to use the median value of the ages of the age groups as the calculation value, that is, step 1031 can be implemented as follows:
and calculating the age of the target object according to the intermediate value of each age group, the probability that the target object is preset for each age group and the weight of each age group.
When the step 1031 is implemented specifically, it may be combined with the first two specific implementations, for example, the step 1031 may be implemented as follows:
and calculating the age of the target object according to the probability of the age groups with the probability exceeding a preset threshold value and the weight of each age group.
Here, the meaning of the preset threshold value may refer to the description in the foregoing, and the description is not repeated here.
Similarly, step 1031 may also be implemented as follows:
and calculating the age of the target object according to the probability of the age groups with the highest probability and the weight of each age group.
In the above several implementations, the weight is usually predetermined, for example, the weight corresponding to each age or age group is the same, or the weight corresponding to each age or age group is determined according to the probability of the age or age group (for example, the weight is larger if the probability is larger).
According to the probability that the target object is respectively preset for each age group and the weight of each age group, the method for calculating the age of the target object simplifies the calculated amount to a certain extent and also ensures certain calculation accuracy.
When the age of the target object is determined based on the probability that the target object belongs to a certain age group, the length of each age group (length means the number of ages included in the age group) may be the same or different. For example, the length of an older age group may be shorter and the length of an older age group may be longer. The length of different age groups is set mainly in consideration of the fact that the change rate of the face (the change degree of the face in unit time) of a person in different age groups is different. For example, the change rate of the face is higher in the juvenile period (0-15 years), and the closer to the middle-aged period (30-50 years), the lower the change rate of the face is, the older the face is, and the change rate of the face gradually increases.
In view of such a situation as described above, the applicant believes that the length of each age group can be set according to the face change rate of a person at different ages, and specifically, the shorter the length of the age group at the smaller age (near 0), the shorter the length of the age group at the larger age (near 100), and the longer the length of the age group at the closer age to the middle age (near 40).
In the scheme provided by the application, due to the adoption of a weighting calculation mode, the age of the target object is determined according to the probability that the target object is of each preset age and the weight of each age, so that the determined age of the target object is more accurate.
When the age recognition model is used to determine the probability that the target object is at each of a plurality of preset ages, the probability is usually calculated by facial recognition, and the facial features of the person are most obviously changed along with the change of the ages. Further, step S102 may be implemented as follows:
step 1022, extracting a face image of the target object from the target recognition image;
and 1023, inputting the face image of the target object into a pre-trained age identification model to obtain the probability that the target object is at each of a plurality of preset ages.
In step 1022, at least two ways of extracting the face image from the target recognition image are as follows:
in the first way of extracting the face image, the face image is extracted by adopting a foreground extraction way.
When a foreground extraction mode is adopted to extract a face image, a background image is acquired firstly, and then difference calculation is carried out on the background image and the foreground image so as to enable an image which exists in the foreground image but does not exist in the background image to be the face image.
However, the face image cannot be accurately obtained only by the foreground recognition method, because the extracted foreground image may not only include the face image, but also may include images of other parts (clothes) on the human body, images of other objects held by a hand, or images of scenes such as vehicles, trees, and the like. Furthermore, if only foreground recognition techniques are used to determine the face image, it is likely that the extracted foreground image will be too noisy. However, if the target recognition image is the head portrait photo of the user, it is faster to extract the face image by using the foreground extraction method.
Because the problem of excessive noise may exist when the face image is determined by only adopting the foreground recognition technology, the face image can be determined by adopting a characteristic recognition mode.
In other words, the second way of extracting the face image is to extract the face image by means of feature recognition.
When the feature recognition mode is implemented, feature points of a target recognition image are firstly extracted from the target recognition image, and then a face region is determined according to the feature points. Specifically, the feature points may be input into a face recognition model to determine a face image.
After the face image is determined, the face image is directly input into the pre-trained age identification model, that is, the probability that the target object is at each of a plurality of preset ages can be obtained.
As explained above, the facial features of a person change most obviously with age, and therefore, when the age of the target object is calculated, the face image should be mainly used, but there may be an inaccuracy in determining the age of the target object by using the face image, for example, the face image may be occluded (e.g., by sunglasses) and may not be clear enough, or when there is a light spot on the face image, the age of the target object may be determined according to the face image and may not be accurate enough.
For this case, the determination of the age of the target object may be aided by images at other locations of the target user. Specifically, step S102 may be implemented as follows:
step 1024, extracting a face image and a body image of the target object from the target identification image;
step 1025, inputting the face image and the body image of the target object into the pre-trained age identification model, and obtaining the probability that the target object is at each of a plurality of preset ages.
Compared with step 1022, in step 1024, in addition to the face image, a body image is extracted, and specifically, the way of extracting the body image may be the same as the way of extracting the face image, and will not be described again here.
Then, the face image and the body image extracted in step 1024 are input into the pre-trained age recognition model, so that the probability that the target object is at each of a plurality of preset ages can be obtained.
Here, the body image of the target object includes any one or more of the following images:
hair images, extremity images and neck images.
Specifically, the hair image may display not only the original hair of the human body but also a decoration such as a hair accessory worn on the hair. The age of the target object can be reflected to some extent by the ornaments such as hair ornaments worn on the hair.
The neck image may display not only the original neck of the human body but also a decoration such as a necklace worn on the neck. The texture of the neck (skin wrinkles) is the primary aid in identifying the age of the target user. Similarly, the necklace or the like worn on the neck can reflect the age of the target object to a certain extent.
The four-limb image may display not only the original four-limb image of the human body but also clothes worn on the four limbs. The length and texture of the limbs (skin wrinkles) are the main aids to confirm the age of the target user. Similarly, clothing worn on the limbs may reflect the age of the target subject to some extent.
As mentioned above, when determining the body image, a method of confirming the face image may be adopted, but no matter the foreground extraction or the feature recognition is adopted, the whole target recognition image needs to be traversed to complete the extraction, which may slow down the processing efficiency of the system. In view of the above situation, the inventor of the present application considers that, on the basis of determining a face image, a body image can be determined according to a preset relative position relationship between a face image position and a body image position.
That is, step 1024 may be implemented as follows:
step 10241, determining the face image position of the target object in the target recognition image;
and step 10242, taking the face image position of the target object as a reference, and extracting the body image from the target recognition image according to the relative position relation between the face image position and the body image position.
The specific implementation of step 10241 is implemented by foreground extraction or feature recognition, which is not described herein too much. In a specific implementation, after the step 10241 is finished, the face image can be extracted from the target recognition image directly according to the position of the face image.
Generally, the position of the face and the position of the body are relatively fixed, for example, the face is located below the hair, the face is located above the neck, and the neck is located above the limbs. Therefore, after the position of the face image is determined, the image surrounding the face image can be used as the body image. In most cases, the image above the face image and adjacent to the face image can be directly used as the hair image, and the image below the face image and adjacent to the face image can be used as the neck image.
In some cases, the sizes occupied by the face images in the target recognition images may be different due to the different shooting distances of different target recognition images, and therefore, in order to extract the body images more accurately or to make the noise in the extracted body images sufficiently low, the area of the face images should be considered when extracting the body images. This is mainly because the ratio of the face size and the body size is usually determined, and therefore, after the face size and the face position are determined, the position of the body image can be determined more accurately.
That is, step 1024 may be implemented as follows:
step 10243, determining the face image position and face image size of the target object in the target recognition image;
step 10244, extracting the body image from the target recognition image according to the face image position, the face image size, the relative position relationship between the face image position and the body image position, and the relative size relationship between the face image size and the body image size.
When implemented, step 10243 generally determines the size of the face image after the face image location is determined (the face image location determines the area where the face image is located, and the size of the area can be considered as the face image size).
When the step 10244 is implemented, the position of the body image is determined according to the position of the face image and the relative position relationship between the position of the face image and the position of the body image, the size of the body image is determined according to the size of the face image and the relative size relationship between the size of the face image and the size of the body image, and then the body image is extracted from the target recognition image according to the position of the body image and the size of the body image.
In this way, the position of the body image is determined from the relative relationship between the face image (position and size) and the body image (position and size), and the position and size of the body image can be calculated directly from the relative relationship recorded in advance without a large amount of calculation, and the body image can be extracted correspondingly.
The above description describes a process of identifying the age of the target object in the target identification image using the age identification model, and the following description describes a training process of the age identification model.
As shown in fig. 2, the age identification model is trained by the following steps:
s201, inputting a sample identification image in a sample set into an age identification model to obtain the probability that a sample object in the sample identification image is of each preset age;
s202, generating a loss function according to the probability that the reference object is preset for each age and the standard age of the sample identification image;
s203, the age identification model is trained using the generated loss function.
In step S201, the sample recognition image and the target recognition image are the same, and the sample recognition image may be an image obtained by photographing a designated person using an image acquisition device such as a camera.
After the sample recognition image is input into the age recognition model, the probability that the sample object in the sample recognition image is respectively at each preset age can be obtained.
As shown in table 3 below, an example of the probability that the sample object is respectively the preset each age is shown.
TABLE 3
Numbering Age (age) Probability of
1 20 0.04
2 21 0.02
3 22 0.08
4 23 0.21
5 24 0.21
6 25 0.22
7 26 0.09
8 27 0.05
9 28 0.02
10 29 0.01
As can be seen from table 3, the ages with higher probability are 23, 24 and 25.
In step S202, the main purpose is to generate a loss function. In the related art, the loss function is usually generated only according to the probability corresponding to the standard age. Here, the standard age refers to the actual age of the sample object in the sample recognition image, which is confirmed by investigation or by directly inquiring the sample object.
In the related art, when determining the loss function, only the probability corresponding to the standard age is considered, and therefore, there is a certain deviation when calculating the loss function.
But this way of calculation may be wrong. Referring to table 3, the three ages with higher probability are classified into 23, 24 and 25, and the three ages are sequentially adjacent.
If the standard age is 24, then the loss function is calculated based on 0.21 (the probability corresponding to age 24) only, as calculated in the related art. Further, the way of calculating the loss function in the related art may result in an excessively large loss function, and the excessively large loss function may excessively adjust the age recognition model in a subsequent process.
However, if the standard age is 24, the age recognition model should not be adjusted excessively, mainly the probabilities of 23 and 25 being similar to the age 24 are as high, and the facial features of the age 24 and the ages 23 and 25 do not differ too much, and the addition result of the probabilities of the ages 23 to 25 is already large, so that the inventor of the present application considers that, in the case of determining the age, the probability of the other ages should be considered instead of the probability corresponding to the standard age, and usually, the facial features of the persons corresponding to the other ages should be similar to the facial features of the persons corresponding to the standard age. That is, the preset facial features of the person corresponding to each age should be similar to the facial features of the person corresponding to the standard age.
Based on this idea, the loss function generated in step S202 does not only consider the probability corresponding to the standard age but also considers the probabilities corresponding to other ages, and therefore, the determined loss function is more reasonable. For the contents in table 3, the loss function generated in step S202 is usually smaller than the loss function generated by using only the probability corresponding to the standard age, so that the model is modified less by using the loss function generated in step S202, and the training speed of the model can be increased.
Specifically, for the case in table 3, if the standard age is 24, the loss function may be calculated in a weighted manner according to 0.21 (probability corresponding to age 23), 0.21 (probability corresponding to age 24), and 0.22 (probability corresponding to age 25).
Specifically, for a certain sample identification image, the loss function of the sample identification image can be calculated according to the following formula:
Figure BDA0001903252630000231
wherein p isi,kIdentifying for the sample a probability that the sample object in the image is K-age; k is a designated age value; v. ofi,sA weight corresponding to a specified reference age; n is the total number of sample identification images in the sample set.
Finally, the age recognition model is trained according to the loss function obtained in step S202, so that the age recognition model can be more reasonable.
By adopting the method provided by the application, the loss function is generated according to the preset probabilities of a plurality of ages and the standard ages of the sample identification images, so that the determination process of the loss function is more reasonable, and the facial features of people corresponding to adjacent ages are considered not to be changed too much.
Specifically, in step S201, the probability that the sample object in the sample identification image is respectively at each preset age may refer to the probability that the sample object in the sample identification image is respectively at each preset age value, or may refer to the probability that the sample object in the sample identification image is respectively at each preset age group.
As mentioned above, the facial features of the person corresponding to each preset age should be similar to the facial features of the person corresponding to the standard age, so that the loss function generated by using the probability corresponding to each preset age is more accurate. In actual use, the facial features of people corresponding to specific ages are relatively similar and are not easy to be accurately defined, or the influence of subjective judgment of a user is large. But generally, the predetermined age should be closer to the standard age. For example, the standard age is 24, the preset age may be 22-26.
Further, step S202 may be implemented as follows:
generating a loss function according to the probability of the reference object for each reference age and the weight corresponding to each reference age; the reference age is an age whose difference from the standard age of the sample recognition image is less than a preset value.
As shown in table 3, if the standard age is 24, the reference age may be 22-26, of course, the reference age may also be appropriately expanded, such as the reference age may be 21-27; alternatively, the reference age may be reduced as appropriate, for example, the reference age may be 23-25. Specifically, the reference ages are not necessarily distributed centering on the standard age, for example, the standard age is 24, and the reference age may be 23 to 28.
In a specific implementation, the larger the weight of the reference age is, the greater the influence on the loss function when generating the loss function according to the probability of the reference age is.
In particular implementations, the loss function can be controlled by controlling the sampling range (controlling the number of reference ages). Specifically, the step of generating the loss function according to the probability of the reference object for each reference age and the weight corresponding to each reference age may be performed as follows: the method comprises the steps of firstly determining a sampling range according to standard ages of sample identification images, and then generating a loss function according to the probability of each reference age corresponding to the sampling range and the weight corresponding to each reference age.
In a specific implementation, the following table in table 4 may be pre-established to illustrate the sampling range corresponding to each standard age.
TABLE 4
Figure BDA0001903252630000251
As can be seen from table 4, the larger the standard age is, the more the reference ages corresponding to the sampling ranges are, and the reference ages corresponding to the sampling ranges are distributed around the standard age (basically distributed by centering on the standard age) as a whole.
Generally, the closer the standard age is to 30 years, the more reference ages the sampling range corresponds to, that is, the more probability of the reference age can be used to generate the loss function, whereas, if the standard age is closer to 0 years, or closer to 100 years (which may also be more years), the less reference age the sampling range corresponds to, that is, the less probability of the reference age can be used to generate the loss function. The reason for setting the sampling range is mainly that the closer the age of the user is to 0 year old or 100 years old, the more the user changes the appearance every year, so the sampling range should be narrowed to avoid the error. In the range of 20-40 years old, the appearance of the users is not greatly different, so that the sampling range can be expanded appropriately.
In addition to controlling the sampling range, the efficiency and accuracy of training can be improved by controlling the weight of the reference age. In general, the reference weight of the probability corresponding to the standard age is the largest, and the weights of the probabilities of the remaining reference ages may be determined according to the difference between the reference age and the standard age. For example, if the standard age is 25, the probability corresponding to 25 is the largest in weight (for example, may be 0.5), the probabilities corresponding to 24 and 26 are the largest in number (for example, the reference weights corresponding to 24 and 26 may both be 0.2), the reference weight corresponding to 23 is the smallest in weight (for example, 0.1), and the probabilities corresponding to the remaining ages are 0, so that the weights are not described. That is, the weight corresponding to each reference age is determined according to the difference between the reference age and the standard age, specifically, the weight of the reference age is in negative correlation with the difference between the reference age and the standard age (the smaller the difference, the larger the weight). In other words, the larger the difference between the reference age and the standard age, the smaller the weight of the reference age.
In addition to considering the gap between the reference age and the standard age, it is also conceivable to determine the reference age weight according to the value of the reference age, mainly when the age is in the middle-young age, the face change degree of the person is small (the face of the person does not change excessively even after several years). Therefore, in determining the weight, if the reference ages are closer to 30 years, the difference between the weights of the two adjacent reference ages is smaller, or the reference ages are closer to 30 years, the more average the weight distribution is (that is, the closer the sampling range is to 30 years, the more average the weight distribution of the reference ages is), but overall, it may be maintained: the larger the difference between the reference age and the standard age, the smaller the weight of the reference age.
Specifically, a loss function is generated according to the probability of each reference age of the reference object and the weight corresponding to each reference age; the reference age is an age whose difference from the standard age of the sample identification image is smaller than a preset value, and may be implemented as follows:
determining the weight corresponding to each reference age according to the calculation parameters of the reference ages; the calculated parameters of the reference age include at least one of: a value of the reference age, a difference between the reference age and the standard age;
and generating a loss function according to the probability of the reference object for each reference age and the corresponding weight of each reference age.
That is, at the time of specific calculation, the weight may be adjusted only in consideration of the value of the reference age so that the closer to the target age (e.g., a certain age among 30-35 years, or a certain age group), the more average the weight distribution of the plurality of reference ages is; the weight of the reference age may also be determined considering only the difference between the reference age and the standard age so that the reference age closer to the standard age is weighted more heavily and the reference age farther from the standard age is weighted less heavily.
Of course, the value of the reference age and the difference between the reference age and the standard age may be considered when calculating the weight.
Two examples are listed below to illustrate the way in which the weights are set:
if the reference age is 25-28 and the standard age is 27, then 25 may correspond to a weight of 0.22; 26 may be 0.25; 27 may be 0.28; 28 may be 0.25.
If the reference age is 65-68 and the standard age is 67, the weight corresponding to 65 may be 0.08; 66 may be 0.16; 67 may be 0.59; 68 may be 0.17.
It can be seen from the above two examples that, of the weights of the reference ages which are farther from the age of 30, the difference between the weights of the two adjacent reference ages is larger, and the weights of the two groups of reference ages are set in such a way that the larger the difference between the reference ages and the standard age is, the smaller the weight of the reference age is.
Besides controlling the weight of each reference age, the determined loss function can be adjusted by the ratio of the number of samples, so that the loss function is more targeted, that is, as shown in fig. 3, step S203 can be implemented as follows:
s2031, for each reference age, determining an adjustment coefficient of the reference age based on the number ratio of the sample identification images corresponding to the standard age having the same value as the reference age;
s2032, adjusting the loss function according to the adjustment coefficient corresponding to the reference age;
and S2033, training the age identification model by using the adjusted loss function.
Specifically, in S2031, the main function of the adjustment coefficient is to adjust the size of the loss function (which can be understood as scaling). In the concrete implementation, each reference age can have a corresponding adjustment coefficient, so that when the loss function is adjusted, the loss function can be adjusted according to the adjustment coefficient corresponding to a specified reference age, or the average value of the adjustment coefficients is calculated according to the adjustment coefficient corresponding to each reference age, and the loss function is adjusted by using the average value of the adjustment coefficients; or calculating the summation value of the adjustment coefficients according to the adjustment coefficients corresponding to each reference age, and adjusting the loss function by using the summation value of the adjustment coefficients.
Of course, the adjustment factor may be the same adjustment factor shared by a plurality of consecutive reference ages. In this way, the loss function can be adjusted directly based on this common adjustment factor.
Specifically, the adjustment coefficient may be set in advance, or may be determined based on the number ratio of the sample identification images corresponding to the standard age having the same numerical value as the reference age. The number ratio here specifically means: the ratio of the number of sample identification images corresponding to the standard age that is the same as the numerical value of the reference age to the total number of sample identification images in the sample set.
The number of sample identification images corresponding to a standard age having the same numerical value as the reference age is the number of sample identification images corresponding to a standard age having the same numerical value as the specified reference age.
As shown in table 5, the number of sample identification images corresponding to each standard age is shown.
TABLE 5
Figure BDA0001903252630000281
In the statistical table 5, if the number of sample identification images with the standard age a (for example, 20 years old) is 55, the number of sample identification images corresponding to the standard age a is 55. Further, the number of sample identification images corresponding to the standard age 20 having the same numerical value as the reference age 20 is 55. Similarly, the number of sample identification images corresponding to the standard age 22 having the same value as the reference age 22 is 24.
Further, if the adjustment coefficient for scaling the loss function is determined based on the number of consecutive sample identification images corresponding to a plurality of standard ages having the same value as the reference age, the number of sample identification images corresponding to the plurality of standard ages having the same value as the reference age may be accumulated, and the adjustment coefficient for actually scaling the loss function may be determined based on the ratio of the accumulated result to all sample identification images in the sample set.
Specifically, referring to table 5, if only the data shown in table 5 are in the sample set and the reference ages are 25, 26, and 27, then according to the description in table 5, (29+43+34)/(55+36+24+40+47+29+43+34+50+42) ═ 111/400 ═ 0.2775, that is, according to the description in table 5, when the reference ages are only 25, 26, and 27, the adjustment coefficient may be determined according to 0.2775.
Specifically, the adjustment coefficient may be positively or negatively correlated with the ratio (the number of sample identification images corresponding to the standard age having the same value as the reference age). Through the experiments of the inventor, the adjustment coefficient can be relatively good in negative correlation with the ratio, and mainly, if the sample identification image corresponding to the reference age is relatively small, the knowledge that the age identification model can learn is limited, so that the adjustment coefficient should be increased for the reference age with the small sample identification image, that is, specifically, the adjustment coefficient can be relatively negative in proportion to the number of the sample identification images corresponding to the standard age with the same numerical value as the reference age, that is, the adjustment coefficient is smaller if the number of the sample identification images corresponding to the standard age with the same numerical value as the reference age is larger; the smaller the number proportion of the sample identification images corresponding to the standard age having the same numerical value as the reference age is, the larger the adjustment coefficient is.
Similarly to the identification process, when the sample identification image is input to the age identification model to find the probability that the sample object is at each of the preset multiple ages, only the face image of the sample object may be input to the age identification model to determine the probability that the sample object is at each of the preset multiple ages based only on the face image of the sample object. It is also possible to simultaneously input both the face image and the body image of the sample object into the age recognition model to simultaneously determine the probability that the sample object is each of the preset multiple ages from the face image and the body image of the sample object. Of course, the body image of the sample object includes any one or more of the following images of the sample object: hair images, extremity images and neck images. This part of the description, already discussed in the foregoing identification process, is not repeated here.
Corresponding to the above method, the present application also provides an age identifying device, comprising:
the first acquisition module is used for acquiring a target identification image;
the first input module is used for inputting the target identification image into a pre-trained age identification model to obtain the probability that the target object in the target identification image is respectively at each of a plurality of preset ages;
the first determining module is used for determining the age of the target object according to the probability that the target object is preset for each age and the weight of each age.
In some embodiments, a first input module, comprising:
a first extraction unit configured to extract a face image of a target object from a target recognition image;
the first input unit is used for inputting the face image of the target object into a pre-trained age identification model to obtain the probability that the target object is at each of a plurality of preset ages.
In some embodiments, a first input module, comprising:
a second extraction unit for extracting a face image and a body image of the target object from the target recognition image;
and the second input unit is used for inputting the face image and the body image of the target object into the pre-trained age identification model to obtain the probability that the target object is at each of a plurality of preset ages.
In some embodiments, the body image of the target object comprises any one or more of:
hair images, extremity images and neck images.
In some embodiments, the second extraction unit comprises:
the first determining subunit is used for determining the face image position of the target object in the target recognition image;
and the first extraction subunit is used for extracting the body image from the target recognition image according to the relative position relationship between the position of the face image and the position of the body image by taking the position of the face image of the target object as a reference.
In some embodiments, a first input module, comprising:
the third input unit is used for inputting the target identification image into a pre-trained age identification model to obtain the probability of each preset age bracket of the target object in the target identification image;
a first determination module comprising:
and the first determining unit is used for calculating the age of the target object according to the probability that the target object is respectively preset in each age group and the weight of each age group.
In some embodiments, the first determination unit comprises:
and the second determining subunit is used for calculating the age value of the target object or the age group of the target object according to the preset probability of each age group of the target object and the preset weight of each age group.
In some embodiments, the second determining subunit is further configured to calculate the age of the target object according to the median of each age group, the probability that the target object is each of the preset ages, and the weight of each age group.
In some embodiments, the age identification model is trained by:
the second input module is used for inputting the sample identification images in the sample set into the age identification model to obtain the probability that the sample objects in the sample identification images are respectively at each preset age;
the first generation module is used for generating a loss function according to the probability that the reference object is preset for each age and the standard age of the sample identification image;
and the first training module is used for training the age identification model by using the generated loss function.
In some embodiments, a first generation module comprises: .
The first generating unit is used for generating a loss function according to the probability of the reference object for each reference age and the weight corresponding to each reference age; the reference age is an age whose difference from the standard age of the sample recognition image is less than a preset value.
In some embodiments, a first training module, comprising:
a second determining unit configured to determine, for each reference age, an adjustment coefficient of the reference age based on a ratio of the number of sample identification images corresponding to a standard age having the same numerical value as the reference age;
the first adjusting unit is used for adjusting the loss function according to an adjusting coefficient corresponding to the reference age;
and the first training unit is used for training the age identification model by using the adjusted loss function.
In some embodiments, the second input module comprises:
a third extraction unit for extracting a face image of the sample object from the sample recognition image;
and the fourth input unit is used for inputting the face image of the sample object into the age identification model to obtain the probability that the sample object is respectively at each of a plurality of preset ages.
In some embodiments, the second input module comprises:
a fourth extraction unit for extracting a face image and a body image of the sample object from the sample recognition image;
and the fifth input unit is used for inputting the face image and the body image of the sample object into the age identification model to obtain the probability that the sample object is at each of a plurality of preset ages.
In some embodiments, the first generating unit includes:
the fourth determining subunit is used for determining the weight corresponding to each reference age according to the calculation parameters of the reference ages; the calculated parameters of the reference age include at least one of: a value of the reference age, a difference between the reference age and the standard age;
and the second generation subunit is used for generating the loss function according to the probability that the reference object is respectively used as each reference age and the weight corresponding to each reference age.
In correspondence with the above method, the present application also provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the method such as age identification.
As shown in fig. 4, a schematic view of an electronic device provided in an embodiment of the present application, the electronic device 1000 includes: the age identification method comprises a processor 1001, a memory 1002 and a bus 1003, wherein the memory 1002 stores execution instructions, when the electronic device runs, the processor 1001 and the memory 1002 communicate through the bus 1003, and the processor 1001 executes the steps of the age identification method stored in the memory 1002.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one logical division, and there may be other divisions when actually implemented, and for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of devices or units through some communication interfaces, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (32)

1. An age identification method, comprising:
acquiring a target identification image;
inputting the target identification image into a pre-trained age identification model to obtain the probability that the target object in the target identification image is respectively at each of a plurality of preset ages;
and determining the age of the target object according to the probability that the target object is respectively preset for each age and the weight of each age.
2. The method of claim 1, wherein inputting the target recognition image into a pre-trained age recognition model to obtain a probability that the target object in the target recognition image is at each of a plurality of preset ages comprises:
extracting a face image of a target object from a target recognition image;
and inputting the face image of the target object into a pre-trained age identification model to obtain the probability that the target object is at each of a plurality of preset ages.
3. The method of claim 1, wherein inputting the target recognition image into a pre-trained age recognition model to obtain a probability that the target object in the target recognition image is at each of a plurality of preset ages comprises:
extracting a face image and a body image of a target object from a target recognition image;
and inputting the face image and the body image of the target object into a pre-trained age identification model to obtain the probability that the target object is at each of a plurality of preset ages.
4. The method of claim 3,
the body image of the target object comprises any one or more of the following images:
hair images, extremity images and neck images.
5. The method of claim 3, wherein extracting the face image and the body image of the target object from the target recognition image comprises:
determining the face image position of a target object in a target recognition image;
and taking the face image position of the target object as a reference, and extracting the body image from the target recognition image according to the relative position relationship between the face image position and the body image position.
6. The method of claim 1, wherein inputting the target recognition image into a pre-trained age recognition model to obtain a probability that the target object in the target recognition image is at each of a plurality of preset ages comprises:
inputting the target identification image into a pre-trained age identification model to obtain the probability of each preset age bracket of the target object in the target identification image;
determining the age of the target object according to the probability that the target object is each preset age and the weight of each age, wherein the determining comprises the following steps:
and calculating the age of the target object according to the preset probability of each age group of the target object and the weight of each age group.
7. The method of claim 6, wherein calculating the age of the target object according to the probability of each age group and the weight of each age group that the target object is preset respectively comprises:
and calculating the age value of the target object or the age range of the target object according to the preset probability of each age range of the target object and the weight of each age range.
8. The method of claim 7, wherein calculating the age value of the target object according to the probability of each age group and the weight of each age group that the target object is preset respectively comprises:
and calculating the age of the target object according to the intermediate value of each age group, the preset probability of each age of the target object and the weight of each age group.
9. The method of claim 1, wherein the age identification model is trained by:
inputting the sample identification images in the sample set into an age identification model to obtain the probability that the sample objects in the sample identification images are respectively at each preset age;
generating a loss function according to the probability that the reference object is preset for each age and the standard age of the sample identification image;
training an age identification model using the generated loss function.
10. The method of claim 9, wherein generating the loss function according to the probability of the reference object for each preset age and the standard age of the sample identification image comprises: .
Generating a loss function according to the probability of the reference object for each reference age and the weight corresponding to each reference age; the reference age is an age whose difference from the standard age of the sample recognition image is less than a preset value.
11. The method of claim 10, wherein training an age identification model using the generated loss function comprises:
for each reference age, determining an adjusting coefficient of the reference age according to the number proportion of the sample identification images corresponding to the standard age with the same numerical value as the reference age;
adjusting the loss function according to the adjustment coefficient corresponding to the reference age;
and training the age identification model by using the adjusted loss function.
12. The method of claim 9, wherein inputting the sample identification images in the sample set into the age identification model to obtain the probability that the sample objects in the sample identification images are respectively at each preset age comprises:
extracting a face image of the sample object from the sample recognition image;
and inputting the face image of the sample object into an age identification model to obtain the probability that the sample object is at each of a plurality of preset ages.
13. The method of claim 9, wherein inputting the sample identification images in the sample set into the age identification model to obtain the probability that the sample objects in the sample identification images are respectively at each preset age comprises:
extracting a face image and a body image of the sample object from the sample recognition image;
and inputting the face image and the body image of the sample object into an age identification model to obtain the probability that the sample object is at each of a plurality of preset ages.
14. The method of claim 10, wherein the loss function is generated based on the probability of the reference object for each reference age and the corresponding weight for each reference age; the reference age is an age whose difference from the standard age of the sample recognition image is less than a preset value, and includes:
determining a sampling range according to the standard age of the sample identification image;
and generating a loss function according to the determined probability of each reference age corresponding to the sampling range and the weight corresponding to each reference age.
15. The method of claim 10, wherein the loss function is generated based on the probability of the reference object for each reference age and the corresponding weight for each reference age; the reference age is an age whose difference from the standard age of the sample recognition image is less than a preset value, and includes:
determining the weight corresponding to each reference age according to the calculation parameters of the reference ages; the calculated parameters of the reference age include at least one of: a value of the reference age, a difference between the reference age and the standard age;
and generating a loss function according to the probability of the reference object for each reference age and the corresponding weight of each reference age.
16. An age identifying device, comprising:
the first acquisition module is used for acquiring a target identification image;
the first input module is used for inputting the target identification image into a pre-trained age identification model to obtain the probability that the target object in the target identification image is respectively at each of a plurality of preset ages;
and the first determining module is used for determining the age of the target object according to the probability that the target object is respectively preset for each age and the weight of each age.
17. The apparatus of claim 16, wherein the first input module comprises:
a first extraction unit configured to extract a face image of a target object from a target recognition image;
the first input unit is used for inputting the face image of the target object into a pre-trained age identification model to obtain the probability that the target object is at each of a plurality of preset ages.
18. The apparatus of claim 16, wherein the first input module comprises:
a second extraction unit for extracting a face image and a body image of the target object from the target recognition image;
and the second input unit is used for inputting the face image and the body image of the target object into a pre-trained age identification model to obtain the probability that the target object is at each of a plurality of preset ages.
19. The apparatus of claim 17,
the body image of the target object comprises any one or more of the following images:
hair images, extremity images and neck images.
20. The apparatus of claim 18, wherein the second extraction unit comprises:
the first determining subunit is used for determining the face image position of the target object in the target recognition image;
and the first extraction subunit is used for extracting the body image from the target recognition image according to the relative position relationship between the position of the face image and the position of the body image by taking the position of the face image of the target object as a reference.
21. The apparatus of claim 16, wherein the first input module comprises:
the third input unit is used for inputting the target identification image into a pre-trained age identification model to obtain the probability of each preset age bracket of the target object in the target identification image;
a first determination module comprising:
and the first determining unit is used for calculating the age of the target object according to the probability that the target object is respectively preset in each age group and the weight of each age group.
22. The apparatus of claim 20, wherein the first determining unit comprises:
and the second determining subunit is used for calculating the age value of the target object or the age group of the target object according to the preset probability of each age group of the target object and the preset weight of each age group.
23. The apparatus of claim 21, wherein the second determining subunit is further configured to calculate the age of the target object according to the intermediate value of each age group, the probability of each age group that the target object is respectively preset, and the weight of each age group.
24. The apparatus of claim 16, wherein the age identification model is trained by:
the second input module is used for inputting the sample identification images in the sample set into the age identification model to obtain the probability that the sample objects in the sample identification images are respectively at each preset age;
the first generation module is used for generating a loss function according to the probability that the reference object is preset for each age and the standard age of the sample identification image;
and the first training module is used for training the age identification model by using the generated loss function.
25. The apparatus of claim 24, wherein the first generating module comprises: .
The first generating unit is used for generating a loss function according to the probability of the reference object for each reference age and the weight corresponding to each reference age; the reference age is an age whose difference from the standard age of the sample recognition image is less than a preset value.
26. The apparatus of claim 24, wherein the first training module comprises:
a second determining unit configured to determine, for each reference age, an adjustment coefficient of the reference age based on a ratio of the number of sample identification images corresponding to a standard age having the same numerical value as the reference age;
the first adjusting unit is used for adjusting the loss function according to an adjusting coefficient corresponding to the reference age;
and the first training unit is used for training the age identification model by using the adjusted loss function.
27. The apparatus of claim 24, wherein the second input module comprises:
a third extraction unit for extracting a face image of the sample object from the sample recognition image;
and the fourth input unit is used for inputting the face image of the sample object into an age identification model to obtain the probability that the sample object is at each of a plurality of preset ages.
28. The apparatus of claim 24, wherein the second input module comprises:
a fourth extraction unit for extracting a face image and a body image of the sample object from the sample recognition image;
and the fifth input unit is used for inputting the face image and the body image of the sample object into an age identification model to obtain the probability that the sample object is at each of a plurality of preset ages.
29. The apparatus of claim 25, wherein the first generating unit comprises:
the third determining subunit is used for determining a sampling range according to the standard age of the sample identification image;
and the first generation subunit is used for generating the loss function according to the determined probability of each reference age corresponding to the sampling range and the weight corresponding to each reference age.
30. The apparatus of claim 25, wherein the first generating unit comprises:
the fourth determining subunit is used for determining the weight corresponding to each reference age according to the calculation parameters of the reference ages; the calculated parameters of the reference age include at least one of: a value of the reference age, a difference between the reference age and the standard age;
and the second generation subunit is used for generating the loss function according to the probability that the reference object is respectively used as each reference age and the weight corresponding to each reference age.
31. An electronic device, comprising: a processor, a storage medium and a bus, the storage medium storing machine-readable instructions executable by the processor, the processor and the storage medium communicating via the bus when the electronic device is operating, the processor executing the machine-readable instructions to perform the steps of the age identification method according to any one of claims 1 to 15 when executed.
32. A computer-readable storage medium, having stored thereon a computer program which, when being executed by a processor, carries out the steps of the age identification method as claimed in any one of claims 1 to 15.
CN201811521113.0A 2018-12-12 2018-12-12 Age identification method and device, electronic equipment and storage medium Pending CN111310532A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811521113.0A CN111310532A (en) 2018-12-12 2018-12-12 Age identification method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811521113.0A CN111310532A (en) 2018-12-12 2018-12-12 Age identification method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN111310532A true CN111310532A (en) 2020-06-19

Family

ID=71161509

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811521113.0A Pending CN111310532A (en) 2018-12-12 2018-12-12 Age identification method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111310532A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112668455A (en) * 2020-12-24 2021-04-16 平安科技(深圳)有限公司 Face age identification method and device, terminal equipment and storage medium
WO2022038736A1 (en) * 2020-08-20 2022-02-24 日本電信電話株式会社 Age estimation model learning device, age estimation model learning method, and program

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104143079A (en) * 2013-05-10 2014-11-12 腾讯科技(深圳)有限公司 Method and system for face attribute recognition
CN107545249A (en) * 2017-08-30 2018-01-05 国信优易数据有限公司 A kind of population ages' recognition methods and device
US20180137421A1 (en) * 2016-11-11 2018-05-17 Yahoo Japan Corporation Information processing apparatus, information processing method, and non-transitory computer readable storage medium
CN108171209A (en) * 2018-01-18 2018-06-15 中科视拓(北京)科技有限公司 A kind of face age estimation method that metric learning is carried out based on convolutional neural networks
CN108197592A (en) * 2018-01-22 2018-06-22 百度在线网络技术(北京)有限公司 Information acquisition method and device

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104143079A (en) * 2013-05-10 2014-11-12 腾讯科技(深圳)有限公司 Method and system for face attribute recognition
US20140341422A1 (en) * 2013-05-10 2014-11-20 Tencent Technology (Shenzhen) Company Limited Systems and Methods for Facial Property Identification
US20180137421A1 (en) * 2016-11-11 2018-05-17 Yahoo Japan Corporation Information processing apparatus, information processing method, and non-transitory computer readable storage medium
CN107545249A (en) * 2017-08-30 2018-01-05 国信优易数据有限公司 A kind of population ages' recognition methods and device
CN108171209A (en) * 2018-01-18 2018-06-15 中科视拓(北京)科技有限公司 A kind of face age estimation method that metric learning is carried out based on convolutional neural networks
CN108197592A (en) * 2018-01-22 2018-06-22 百度在线网络技术(北京)有限公司 Information acquisition method and device

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2022038736A1 (en) * 2020-08-20 2022-02-24 日本電信電話株式会社 Age estimation model learning device, age estimation model learning method, and program
JP7464131B2 (en) 2020-08-20 2024-04-09 日本電信電話株式会社 Age estimation model learning device, age estimation model learning method, and program
CN112668455A (en) * 2020-12-24 2021-04-16 平安科技(深圳)有限公司 Face age identification method and device, terminal equipment and storage medium
CN112668455B (en) * 2020-12-24 2023-11-28 平安科技(深圳)有限公司 Face age identification method and device, terminal equipment and storage medium

Similar Documents

Publication Publication Date Title
US10109056B2 (en) Method for calibration free gaze tracking using low cost camera
CN106682632B (en) Method and device for processing face image
CN110110118A (en) Dressing recommended method, device, storage medium and mobile terminal
CN101482919A (en) Face collation apparatus
KR101700818B1 (en) Method and apparatus for estimating age or gender using face image
CN107992807B (en) Face recognition method and device based on CNN model
TWI691937B (en) Method and device for filtering light spot, computer readable storage medium, processor, gaze tracking equipment
CN105718873A (en) People stream analysis method based on binocular vision
JP2022527818A (en) Methods and systems for estimating geometric variables related to the user's eye
CN109725721B (en) Human eye positioning method and system for naked eye 3D display system
CN108460398A (en) Image processing method, device, cloud processing equipment and computer program product
CN111340758B (en) Novel efficient iris image quality evaluation method based on deep neural network
CN111008935A (en) Face image enhancement method, device, system and storage medium
CN111310532A (en) Age identification method and device, electronic equipment and storage medium
KR20190076858A (en) Improved age modelling method
CN111160229A (en) Video target detection method and device based on SSD (solid State disk) network
CN111680573B (en) Face recognition method, device, electronic equipment and storage medium
WO2021033314A1 (en) Estimation device, learning device, control method, and recording medium
CN116670718A (en) Method and apparatus for hair styling analysis
WO2017185452A1 (en) Image restoration method and system
CN114529962A (en) Image feature processing method and device, electronic equipment and storage medium
CN114943924B (en) Pain assessment method, system, equipment and medium based on facial expression video
JP6377566B2 (en) Line-of-sight measurement device, line-of-sight measurement method, and program
CN112102149A (en) Figure hair style replacing method, device, equipment and medium based on neural network
JP2008250407A (en) Image processing program and image processor

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
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20200619

WD01 Invention patent application deemed withdrawn after publication