Method for training age prediction model, age prediction method and related device
By sorting image samples by age group labeling and calculating relevant values, the problem of low age prediction accuracy caused by reliance on manual labeling in existing technologies is solved, achieving higher recognition accuracy and generalization ability.
Patent Information
- Application Number
- CN202211400336.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-08
- Publication Date
- 2025-11-11
- Estimated Expiration
- 2042-11-08
AI Technical Summary
Existing age prediction methods rely on the accuracy of manually labeled data, resulting in poor model generalization and low recognition accuracy, especially when the amount of data is small or the labeling is inaccurate.
By sorting image samples by age group labeling range, calculating the correlation values between sample features, and updating the age prediction model parameters based on the sequence number, the reliance on manual labeling is reduced. Siamese networks are used to extract features and calculate correlation values to identify image age.
It improves the accuracy and recognition precision of age prediction models, reduces the difficulty and error rate of data annotation, and enhances the generalization ability of models.
Smart Images

Figure CN115937932B_ABST
Abstract
Description
Technical Field
[0001] This invention relates primarily to the field of computer processing technology, and in particular to training methods for age prediction models, age prediction methods, and related equipment. Background Technology
[0002] Age prediction refers to identifying the age of people in images through image analysis. Age prediction is a crucial task in artificial intelligence, with broad application prospects in areas such as intelligent business, security monitoring, social media, recommendation systems, and demographics.
[0003] Current main age prediction methods predict the age of individuals from single facial or human images. The accuracy of these methods largely depends on the accuracy of the data labels, i.e., the age annotation performed manually on the images. There are two main methods for data collection and annotation: the first is offline collection, where the age of the subject is known before image acquisition; the second is online collection, where one data analyst subjectively annotates the image or multiple data analysts annotate the same image and then average the results. The first method is more difficult to implement and has a smaller dataset, leading to poorer model generalization and stability. The second method, due to the subjective factors in the manual annotation process, results in inaccurate annotations, further contributing to low model recognition accuracy. Summary of the Invention
[0004] The purpose of this application is to provide a training method for an age prediction model, an age prediction method, and an electronic device, which effectively solves the recognition error caused by labeling errors and improves the prediction accuracy of the model.
[0005] In a first aspect, this application provides a training method for an age prediction model, comprising: acquiring a sample set composed of images of different age groups, wherein each image sample in the sample set has a corresponding age group labeling range; sorting each image sample according to the age group labeling range to obtain a sorted sample set, wherein each image sample in the sorted sample set has a corresponding serial number; extracting features from any two image samples in the sorted sample set using the age prediction model; calculating a first correlation value between the features of any two image samples in the sorted sample set; calculating a loss function value based on the serial number of any two image samples and the first correlation value between the features of any two image samples; and updating the parameters of the age prediction model according to the loss function value to obtain an age prediction model with optimal parameters.
[0006] This application sorts images of different age groups according to their labeled age ranges, then calculates the first correlation value between the features of any two image samples in the sorted sample set; next, based on the index of any two image samples, it calculates a loss function value according to the first correlation value between their features; finally, it updates the parameters of the age prediction model based on the loss function value, obtaining the optimal age prediction model. This application does not require all data to be accurately labeled with age, greatly reducing the labeling difficulty of age prediction model data with large amounts of data, while ensuring the accuracy of data labeling.
[0007] In one implementation of the first aspect, the image samples are sorted according to the age group annotation range to obtain a sorted sample set, including: obtaining the age group annotation range of each image sample; sorting the image samples according to the age group annotation range of each image sample in order from youngest to oldest to obtain a sorted sample set; when at least two image samples are in the same age group annotation range, setting at least two image samples to the same sequence number.
[0008] This application sorts image samples from youngest to oldest to obtain a sorted sample set. This eliminates the need to accurately label all data with age, reducing the difficulty of labeling data for age prediction models. Furthermore, when image samples of similar or nearly identical ages exist, the sequence numbers of each image sample in the sorted sample set can be reused, thus reducing the tediousness of sequence numbering in the data labeling process.
[0009] In one implementation of the first aspect, a first correlation value between the features of any two image samples in the sorted sample set is calculated, wherein any two image samples include a first image and a second image, including: obtaining the feature distance between the features of the first image and the features of the second image; obtaining the hyperbolic tangent function value corresponding to the feature distance; and using the hyperbolic tangent function value corresponding to the feature distance as the first correlation value between the features of two image samples with adjacent serial numbers.
[0010] In this application, the features of any two image samples in the sorted sample set are vectors with a certain length. This application calculates the feature distance between the features of any two image samples and then calculates the corresponding hyperbolic tangent function value for the feature distance between the features of any two image samples, which can better measure the correlation of the features extracted from the two images.
[0011] In one implementation of the first aspect, the feature distance between the features of the first image and the features of the second image is obtained. The features of both the first and second images include several elements. The method includes: obtaining the current element in the features of the first image and the current element in the features of the second image; subtracting the current element of the first image from the current element of the second image to obtain the difference of the current element; calculating the cube of the difference of the current element to obtain the cube of the difference corresponding to the current element; traversing all elements in the features of the first image and all elements in the features of the second image to obtain the cube of the difference corresponding to all elements; summing the cubes of the difference corresponding to all elements to obtain the sum of the cubes of the elements; and using the sum of the cubes of the elements as the feature distance between the features of the first image and the features of the second image.
[0012] In this application, the features of the first image and the second image each have several elements. When calculating the feature distance between the features of the first image and the features of the second image, it is necessary to consider the error between each element of the first image and the second image, that is, the difference between the current element of the first image and the current element of the second image. Then, the difference between all elements is cubed and superimposed to obtain the superimposed result as the feature distance between the features of the first image and the features of the second image.
[0013] In one implementation of the first aspect, the loss function value is calculated based on the sequence number of any two image samples and the first correlation value between the features of any two image samples, including: obtaining the sequence number of any two image samples based on the sequence number of each image sample in the sorted sample set; obtaining the second correlation value between the features of any two image samples based on the sequence number of any two image samples; and calculating the mean square error between the first correlation value and the second correlation value to obtain the loss function value.
[0014] In this application, the true correlation value between the features of any two image samples can be obtained by using the sequence numbers of any two sorted image samples, i.e., the second correlation value; then the mean square error between the first correlation value and the true correlation value is calculated to obtain the loss function value.
[0015] In one implementation of the first aspect, a second correlation value between the features of any two image samples is obtained based on their indexes, wherein the indexes of any two image samples include the index of the first image and the index of the second image, and the method includes: when the index of the first image is less than the index of the second image, setting the second correlation value between the features of any two image samples to a first preset value; when the index of the first image is greater than the index of the second image, setting the second correlation value between the features of any two image samples to a second preset value; and when the index of the first image is equal to the index of the second image, setting the second correlation value between the features of any two image samples to a third preset value.
[0016] In this application, the sequence number of the first image is compared with the sequence number of the second image. Based on the comparison results of different sequence numbers, the true correlation between the two images can be determined. This application obtains the model's label by using the sequence number of the image samples, rather than using manually labeled true age values. This greatly reduces the labeling difficulty of age prediction model data with large amounts of data and ensures the accuracy of data labeling. It improves upon the inaccurate labeling that occurred in the past when labeling subjective age values.
[0017] Secondly, this application provides an age prediction method, comprising: acquiring an image to be identified and an image database containing reference images of several different age groups; extracting features of the image to be identified and features of the reference images of several different age groups in the image database using an age prediction model; calculating a third correlation value between the features of the image to be identified and the features of the reference images of several different age groups; and identifying the age corresponding to the image to be identified based on the third correlation value.
[0018] This application first acquires the image to be identified and several reference images representing different age groups; then, it uses an age prediction model to extract features from the image to be identified and the reference images representing different age groups; next, it calculates the third correlation value between the features of the image to be identified and the features of the reference images representing different age groups; finally, it identifies the age corresponding to the image to be identified based on the third correlation value. This application calculates the age value of the image to be identified by judging the differences between the identified image and the reference images in the image database, i.e., whether the age is too large, too small, or too close, thus significantly improving the accuracy of image labeling and effectively enhancing recognition precision.
[0019] In one implementation of the second aspect, a third correlation value is calculated between the features of the image to be identified and the features of several reference images of different age groups, wherein the several reference images of different age groups each have a corresponding labeled age value. This includes: when multiple images in the several reference images of different age groups have the same labeled age value, obtaining the features of the multiple images; obtaining the average value of the features of the multiple images; and calculating the third correlation value between the features of the image to be identified and the average value of the features of the multiple images.
[0020] In this application, when multiple images share the same labeled age value, the application first obtains the average value of the features of the multiple images, and then calculates the third correlation value between the features of the image to be identified and the average value of the features of the multiple images. This application further identifies the age corresponding to the image to be identified by calculating the third correlation value between the features of the image to be identified and the average value of the features of the multiple images, rather than calculating the third correlation value for each image with the same labeled age value. Therefore, this application can reduce the computational load, effectively improve the model's computational efficiency, and also improve the recognition accuracy.
[0021] In one implementation of the second aspect, identifying the age corresponding to the image to be identified based on the third correlation value includes: sorting several images of different age groups in ascending order of age label values to obtain a sorted image set; obtaining the current image in the sorted image set; when the current image is the first image in the sorted image set, and the third correlation value between the features of the image to be identified and the features of the first image is less than a first minimum correlation threshold, the labeled age value of the first image is taken as the age of the image to be identified; when the current image is the last image in the sorted image set, and the third correlation value between the features of the image to be identified and the features of the last image is greater than a first maximum correlation threshold, the labeled age value of the last image is taken as the age of the image to be identified; when the third correlation value between the features of the image to be identified and the features of the current image is between the first minimum correlation threshold and the first maximum correlation threshold, the labeled age value of the current image is taken as the age of the image to be identified.
[0022] In this application, because several images of different age groups are sorted in ascending order of age label values, when the third correlation value between the feature of the image to be identified and the feature of the first image is less than the first minimum correlation threshold, the age of the image to be identified is determined to be consistent with the age of the youngest image in the sorted image set; when the third correlation value between the feature of the image to be identified and the feature of the last image is greater than the first maximum correlation threshold, the age of the image to be identified is determined to be consistent with the age of the oldest image in the sorted image set; in addition, when the third correlation value between the feature of the image to be identified and the feature of the current image is between the first minimum correlation threshold and the first maximum correlation threshold, this application can use the labeled age value of the current image as the age of the image to be identified.
[0023] In one implementation of the second aspect, identifying the age corresponding to the image to be identified based on the third correlation value includes: obtaining the previous image of the current image in the sorted image set; when the third correlation value between the features of the image to be identified and the features of the current image is less than a first minimum correlation threshold, and the third correlation value between the features of the image to be identified and the features of the previous image is greater than a first maximum correlation threshold, by calculating... Obtain the age of the image to be identified, where AGE is the age of the image to be identified. n Age is the labeled age value for the current image. n-1 The labeled age value is the same as the one in the previous image. This is the third correlation value between the features of the image to be identified and the features of the current image. This is the third correlation value between the features of the image to be identified and the features of the previous image.
[0024] This application can calculate the specific age of an image to be identified based on different threshold ranges of the third correlation value. The age value is calculated by judging the differences between the identified image and the ages of different images in the image database—that is, whether the age is too large, too small, or close. This application fully adapts to the methods used in the data labeling process, significantly improving the accuracy of image labeling and effectively enhancing recognition precision.
[0025] In one implementation of the second aspect, identifying the age corresponding to the image to be identified based on the third correlation value further includes: when the third correlation value between the features of the image to be identified and the features of any one of the reference images of several different age groups is less than the second minimum correlation threshold, the age range of the image to be identified is determined to be less than the labeled age value of any one of the images; when the third correlation value between the features of the image to be identified and the features of any one of the reference images of several different age groups is greater than the second maximum correlation threshold, the age range of the image to be identified is determined to be greater than the labeled age value of any one of the images; when the third correlation value between the features of the image to be identified and the features of any one of the reference images of several different age groups is between the second minimum correlation threshold and the second maximum correlation threshold, the age of the image to be identified is determined to be equal to the labeled age value of any one of the images.
[0026] This application can also accurately match the age range of the image to be identified based on the third correlation value, further improving the accuracy of image labeling and effectively enhancing recognition precision.
[0027] Thirdly, this application provides a training device for an age prediction model, comprising: a sample acquisition module for acquiring a sample set composed of images of different age groups, wherein each image sample in the sample set has a corresponding age group labeling range; a sorting module for sorting each image sample according to the age group labeling range to obtain a sorted sample set, wherein each image sample in the sorted sample set has a corresponding serial number; a first feature extraction module for extracting features from any two image samples in the sorted sample set using the age prediction model; a first correlation calculation module for calculating a first correlation value between the features of any two image samples in the sorted sample set; a loss value calculation module for calculating a loss function value based on the serial number of any two image samples and the first correlation value between the features of any two image samples; and a model update module for updating the parameters of the age prediction model according to the loss function value to obtain an age prediction model with optimal parameters.
[0028] Fourthly, this application provides an age prediction device, comprising: a data acquisition module for acquiring an image to be identified and several reference images of different age groups; a second feature extraction module for extracting features of the image to be identified and features of several reference images of different age groups using an age prediction model; a second correlation calculation module for calculating third correlation values between the features of the image to be identified and the features of several reference images of different age groups; and an age prediction module for identifying the age corresponding to the image to be identified based on the third correlation values.
[0029] Fifthly, this application provides an electronic device comprising: a memory storing a plurality of instructions; and a processor loading instructions from the memory to execute steps in any of the above-described training methods for age prediction models or steps in any of the age prediction methods.
[0030] Sixthly, this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by an electronic device, implements the steps in the training method of any of the above-described age prediction models or the steps in any of the age prediction methods.
[0031] As described above, the training method, age prediction method, and related equipment for the age prediction model provided in this application have the following advantages:
[0032] Beneficial effects:
[0033] This application sorts images of different age groups according to their age range, calculates the first correlation value between the features of any two image samples in the sorted sample set, calculates a loss function value based on the first correlation value between the features of any two image samples, and updates the parameters of the age prediction model based on the loss function value to obtain the optimal age prediction model. Furthermore, this application can extract features from the image to be identified and features from several reference images of different age groups in an image database using the age prediction model; calculate the third correlation value between the features of the image to be identified and the features of several reference images of different age groups; and finally identify the age corresponding to the image to be identified based on the third correlation value. This application calculates the age value of the image to be identified by judging the differences between the identified image and the reference images in the image database (i.e., whether the age is too large, too small, or too close), which significantly improves the accuracy of image labeling and effectively enhances recognition precision. Moreover, it eliminates the need to accurately label all data, greatly reducing the labeling difficulty of age prediction model data with large amounts of data and ensuring the accuracy of data labeling. Attached Figure Description
[0034] Figure 1 This is a schematic diagram illustrating an application scenario according to an embodiment of this application.
[0035] Figure 2a This is a flowchart illustrating a training method for an age prediction model according to an embodiment of this application.
[0036] Figure 2b This is a schematic diagram illustrating the age aging sorting and labeling according to an embodiment of this application.
[0037] Figure 3a This is a flowchart illustrating an age prediction method according to an embodiment of this application.
[0038] Figure 3b This is a schematic diagram illustrating the construction of an image database according to an embodiment of this application.
[0039] Figure 4 This is a schematic diagram of the structure of a training device for an age prediction model according to an embodiment of this application.
[0040] Figure 5 This is a schematic diagram of the structure of an age prediction device according to an embodiment of this application.
[0041] Figure 6 This is a schematic diagram of the structure of an electronic device according to an embodiment of this application. Detailed Implementation
[0042] The following specific examples illustrate the implementation of this application. Those skilled in the art can easily understand other advantages and effects of this application from the content disclosed in this specification. This application can also be implemented or applied through other different specific embodiments, and various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of this application. It should be noted that, unless otherwise specified, the following embodiments and features in the embodiments can be combined with each other.
[0043] It should be noted that the illustrations provided in the following embodiments are only schematic representations of the basic concept of this application. Therefore, the drawings only show the components related to this application and are not drawn according to the actual number, shape and size of the components in the actual implementation. In the actual implementation, the form, quantity and proportion of each component can be arbitrarily changed, and the layout of the components may also be more complex.
[0044] The following embodiments of this application provide a training method for an age prediction model, an age prediction method, and an electronic device. Specifically, the training device or age prediction device for the age prediction model can be integrated into an electronic device, which can be a terminal, a server, or other similar device. The terminal can be a mobile phone, tablet computer, smart Bluetooth device, laptop computer, or personal computer (PC), etc.; the server can be a single server or a server cluster composed of multiple servers.
[0045] In some embodiments, the training device or age prediction device of the age prediction model may also be integrated into multiple electronic devices. For example, the training device or age prediction device of the age prediction model may be integrated into multiple servers, and the training method or age prediction method of the age prediction model of this application may be implemented by multiple servers.
[0046] In some embodiments, the server may also be implemented as a terminal.
[0047] For example, refer to Figure 1 The electronic device may include an image sensor 10, a storage terminal 11, a model training server 12, an age prediction server 13, etc. The image sensor 10 can be used to capture facial images, and the storage terminal 11 can be used to store facial images. The image sensor 10, the storage terminal 11, the model training server 12 and the age prediction server 13 communicate with each other, which will not be described in detail here.
[0048] The model training server 12 may include a processor and memory. The model training server 12 can acquire a sample set composed of images from different age groups, where each image sample in the sample set has a corresponding age group labeling range; sort the image samples according to their age group labeling ranges to obtain a sorted sample set, where each image sample has a corresponding index; extract features from any two image samples in the sorted sample set using an age prediction model; calculate the first correlation value between the features of any two image samples in the sorted sample set; calculate a loss function value based on the index of any two image samples and the first correlation value between their features; and update the parameters of the age prediction model based on the loss function value to obtain the optimal age prediction model.
[0049] The age prediction server 13 may also include a processor and memory. The age prediction server 13 can acquire an image to be identified and an image database containing reference images of several different age groups; extract features of the image to be identified and features of the reference images of several different age groups in the image database using an age prediction model; calculate the third correlation value between the features of the image to be identified and the features of the reference images of several different age groups; and identify the age corresponding to the image to be identified based on the third correlation value.
[0050] The model training server 12 and the age prediction server 13 can be the same server or different servers; this is not limited here.
[0051] The technical solutions in the embodiments of this application will be described in detail below with reference to the accompanying drawings.
[0052] like Figure 2a As shown, with model training server 12 as the execution entity, this embodiment provides a training method for an age prediction model, including steps S210 to S260, as follows:
[0053] S210, Model training server 12 acquires a sample set made up of images of different age groups.
[0054] In this embodiment, each image sample in the sample set has a corresponding age group labeling range. The age group labeling range can be infancy, adolescence, youth, middle age, and old age, etc. This invention can collect image data for various ages, such as infancy, adolescence, youth, middle age, and old age. The age data needs to cover all age groups and come from different people, and the number of images collected from the same person should not exceed a preset number, such as three images. This embodiment collects a large number of image samples from different age groups, and the selected images are also diverse, thereby increasing the accuracy and generalization ability of the model.
[0055] S220 and model training server 12 sort each image sample according to the age group labeling range to obtain the sorted sample set.
[0056] In this embodiment, each image sample in the sorted sample set has a corresponding serial number. For example, when an image sample is within the age range of a toddler, the serial number is set to 1; when an image sample is within the age range of a teenager, the serial number is set to 2; when an image sample is within the age range of a young adult, the serial number is set to 3; when an image sample is within the age range of a middle-aged adult, the serial number is set to 4; and when an image sample is within the age range of an elderly adult, the serial number is set to 5.
[0057] In one embodiment, the image samples are sorted according to the age group annotation range to obtain a sorted sample set, including: obtaining the age group annotation range of each image sample; and sorting the image samples according to the age group annotation range of each image sample from youngest to oldest to obtain a sorted sample set.
[0058] In this embodiment, the image samples are sorted from youngest to oldest to obtain a sorted sample set. This eliminates the need to label all data with accurate age, reducing the difficulty of labeling data for age prediction models.
[0059] In one embodiment, the image samples are sorted according to the age group annotation range to obtain a sorted sample set, and the method further includes: when at least two image samples are in the same age group annotation range, the at least two image samples are set to the same serial number.
[0060] In this embodiment, when there are image samples of similar or nearly the same age, the sequence number of each image sample in the sorted sample set can be reused, thereby reducing the tedious problem of sequence numbering in the data annotation process.
[0061] For example, during image annotation, the image order of each sample in the dataset is randomly shuffled. In each round, a preset number of images are selected as a group of data, such as 32 images. Then, the images in a group are sorted from youngest to oldest, starting with the index 1. When images are of similar or identical ages, the index can be reused. For example, a group of data could be 1, 1, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 8, 9, 10, 11, 12, 12, 12, 13, 14, 15, 16, 17, 18, 19. The 32 images labeled in each round are then kept as a group; this process is repeated until all images in the collected dataset are grouped into groups of 32 and all have been annotated and sorted.
[0062] like Figure 2bAs shown, in this embodiment, the image samples can be sorted in order from youngest to oldest. Figure 2b The first image in the sequence is the youngest image, and its sequence number is set to 1; the second and third images are of similar age, and both the second and third images are set to 2.
[0063] S230, Model Training Server 12 uses the age prediction model to extract features from any two image samples in the sorted sample set.
[0064] In this embodiment, the age prediction model can be a Siamese network. Two image samples are input into the same network (with identical parameters and structure). Then, each network receives the features corresponding to the two image samples. The distance between the corresponding features of the two image samples is calculated. If the distance is close, the two image samples are considered to belong to the same class; if they are far apart, they are considered to belong to different classes. This embodiment can use two CNNs with identical parameters to extract features from the images. Alternatively, this embodiment can select a mainstream recognition network, keeping the structure unchanged, but randomly initializing the network parameters during training. For example, if age recognition is needed based on a face image, a face recognition network is used; if age recognition is needed based on a human body image, a human re-identification network is used.
[0065] S240, Model Training Server 12 calculates the first correlation value between the features of any two image samples in the sorted sample set.
[0066] In one embodiment, calculating a first correlation value between features of any two image samples in the sorted sample set, wherein any two image samples include a first image and a second image, includes: obtaining a feature distance between features of the first image and features of the second image; obtaining a hyperbolic tangent function value corresponding to the feature distance; and using the hyperbolic tangent function value corresponding to the feature distance as the first correlation value between features of two image samples with adjacent serial numbers.
[0067] In this embodiment, the features of any two image samples in the sorted sample set are vectors with a certain length. This application calculates the feature distance between the features of any two image samples and then calculates the corresponding hyperbolic tangent function value for the feature distance between the features of any two image samples, which can better measure the correlation operation of the features extracted from the two images.
[0068] In one embodiment, the feature distance between features of a first image and features of a second image is obtained, wherein the features of the first image and features of the second image each include several elements, including: obtaining the current element in the features of the first image and the current element in the features of the second image; subtracting the current element of the first image from the current element of the second image to obtain the difference of the current element; calculating the cube of the difference of the current element to obtain the cube of the difference corresponding to the current element; traversing all elements in the features of the first image and all elements in the features of the second image to obtain the cube of the difference corresponding to all elements; summing the cubes of the difference corresponding to all elements to obtain the sum of the cubes of the elements; and using the sum of the cubes of the elements as the feature distance between the features of the first image and features of the second image.
[0069] In this embodiment, the features of the first image and the second image each have several elements. When calculating the feature distance between the features of the first image and the features of the second image, it is necessary to consider the error between each element of the first image and the second image, that is, the difference between the current element of the first image and the current element of the second image. Then, the cube of the difference between all elements is calculated and superimposed to obtain the superimposed result as the feature distance between the features of the first image and the features of the second image.
[0070] For example, in this embodiment, the feature X of the first image is [x1, x2, ... x]. L The features of the second image are Y = [y1, y2, ... y]. L The feature vector has a length of L, where xL is the Lth floating-point value in the first image feature, and y... L The Lth floating-point value in the second image feature is calculated. Obtain the first correlation value between the features of any two image samples in the sorted sample set. The first correlation value s is used as the correlation metric for the features extracted from the two images.
[0071] S250 and model training server 12 calculate the loss function value based on the sequence number of any two image samples and the first correlation value between the features of any two image samples.
[0072] In one embodiment, the loss function value is calculated based on the sequence number of any two image samples and the first correlation value between the features of any two image samples, including: obtaining the sequence number of any two image samples based on the sequence number of each image sample in the sorted sample set; obtaining the second correlation value between the features of any two image samples based on the sequence number of any two image samples; and calculating the mean square error between the first correlation value and the second correlation value to obtain the loss function value.
[0073] In this embodiment, the true correlation value between the features of any two image samples can be obtained by using the sequence numbers of any two sorted image samples, i.e., the second correlation value; then the mean square error between the first correlation value and the true correlation value is calculated to obtain the loss function value.
[0074] For example, the sample set can be divided into several groups, with two images in each group forming a pair of samples. The mean squared error between the first correlation value and the true correlation value can be calculated to obtain the loss function value. s i This represents the correlation result calculated for the i-th sample pair, i.e., the first correlation value between the features of the i-th sample pair; This represents the true result of the i-th sample pair, which is the second correlation value between the features of the i-th sample pair.
[0075] In one embodiment, a second correlation value between the features of any two image samples is obtained based on their sequence numbers, wherein the sequence numbers of any two image samples include the sequence number of the first image and the sequence number of the second image. This includes: when the sequence number of the first image is less than the sequence number of the second image, setting the second correlation value between the features of the two image samples to a first preset value; when the sequence number of the first image is greater than the sequence number of the second image, setting the second correlation value between the features of the two image samples to a second preset value; and when the sequence number of the first image is equal to the sequence number of the second image, setting the second correlation value between the features of the two image samples to a third preset value.
[0076] In this embodiment, the sequence number of the first image is compared with the sequence number of the second image. Based on the comparison results of different sequence numbers, the true correlation between the two images can be determined. This application obtains the model's label by using the sequence number of the image samples, rather than using manually labeled true age values. This greatly reduces the labeling difficulty of age prediction model data under large amounts of data and ensures the accuracy of data labeling. It improves upon the inaccurate labeling that occurred in the past when labeling subjective age values.
[0077] For example, any two image samples include a first image a and a second image b, where the index I of the first image a within the group is... a The second image b has the following sequence number I within the group. b The second correlation value between the features of any two image samples That is, when the first image a is in the group number I a The index I of the second image b within the group is smaller than the index of the second image b. b At that time, the second correlation value between the features of any two image samples -1; when the first image a is in the group with index I a The index I of the second image b within the group is greater than bAt that time, the second correlation value between the features of any two image samples The value is 1, when the first image a is in the group with index I. a Equal to the index I of the second image b within the group b At that time, the second correlation value between the features of any two image samples It is 0.
[0078] S260, Model Training Server 12 updates the parameters of the age prediction model based on the loss function value, and obtains the age prediction model with optimal parameters.
[0079] In this embodiment, the sample set can be divided into a training set and a test set based on quantity. For example, 80% of the image samples can be used as training data, and 20% as test data. Then, a maximum number of loops is set, for example, 100,000. Each time, a set of data, such as 32 images, is fed in. An age prediction model is used to extract feature vectors, resulting in 32 eigenvectors. Among the 32 feature vectors, a correlation metric s is calculated between every two feature vectors. m,n and s m,n , These are represented by the metrics calculated for the m-th and n-th image samples, and their true results, respectively. This embodiment also calculates the loss function value for this set of samples using a loss function, and updates the network parameters based on the loss function value using the chained gradient propagation method in deep learning. Furthermore, to avoid repetition, this embodiment selects the next set of data and repeats the operation. Once all data has been fed into the model for learning, this is recorded as one large iteration. Each large iteration saves the model parameters and tests the model using a test set, recording the mean squared error (MSE) between the test data and the labeled values, i.e., the accuracy. After the loop ends, the model with the smallest error (i.e., the highest accuracy) on the test set is selected as the optimal model.
[0080] This application sorts images of different age groups according to their labeled age ranges, then calculates the first correlation value between the features of any two image samples in the sorted sample set; next, based on the index of any two image samples, it calculates a loss function value according to the first correlation value between their features; finally, it updates the parameters of the age prediction model based on the loss function value, obtaining the optimal age prediction model. This application does not require all data to be accurately labeled with age, greatly reducing the labeling difficulty of age prediction model data with large amounts of data, while ensuring the accuracy of data labeling.
[0081] like Figure 3a As shown, using age prediction server 13 as the execution entity, this embodiment provides an age prediction method, including:
[0082] S310, Age Prediction Server 13 acquires the image to be identified and reference images with several different age groups.
[0083] In this embodiment, an image database can be established, dividing people aged 1 to 100 into different age groups, collecting image data of different genders, quantities, and age groups, and storing it in the image database. For example, this embodiment can collect at least two images of men and women aged 1 to 100.
[0084] S320, the age prediction server 13 uses an age prediction model to extract features of the image to be identified and features of several reference images of different age groups.
[0085] In this embodiment, an age prediction model can be used to extract feature vectors from each image in the image database. The information stored in the image database for each image can include the feature vector and the corresponding age. For example... Figure 3b As shown, the feature extraction module corresponds to the age prediction model in this embodiment, and extracts image features through the feature extraction module. After the image database is built in this embodiment, feature vectors corresponding to different age labels can be obtained. When the same age label corresponds to multiple feature vectors, the feature set corresponding to that age label can be obtained.
[0086] In this application, mainstream face recognition networks or human ReID recognition networks can be selected as age prediction models according to the target type. The age prediction model can be a twin network, for example, two CNN networks with the same parameters can be used as the age prediction model of this application, etc.
[0087] S330, the age prediction server 13 calculates the third correlation value between the features of the image to be identified and the features of several reference images of different age groups.
[0088] In one embodiment, a third correlation value is calculated between the features of the image to be identified and the features of several reference images of different age groups, wherein the several reference images of different age groups each have a corresponding labeled age value. This includes: when multiple images in the several reference images of different age groups have the same labeled age value, obtaining the features of the multiple images; obtaining the average value of the features of the multiple images; and calculating the third correlation value between the features of the image to be identified and the average value of the features of the multiple images.
[0089] Specifically, in this embodiment, features are extracted from the image to be recognized, and simultaneously compared with the age features Z = [z1, z2, ... z] in the image database. L Calculate the age-related metrics, z LFor the Lth age feature in the image database, if there are multiple features for the same age in the database, it is necessary to calculate the average value. That is, when there are multiple images with the same labeled age value, this application can first obtain the average value of the features of multiple images, and then calculate the third correlation value between the feature of the image to be identified and the average value of the features of multiple images.
[0090] This embodiment further identifies the age corresponding to the image to be identified by calculating the third correlation value between the features of the image to be identified and the average value of the features of multiple images, rather than calculating the third correlation value one by one between multiple images with the same labeled age value. Therefore, this application can reduce the amount of calculation, effectively improve the model calculation efficiency, and also improve the recognition accuracy.
[0091] S340, the age prediction server 13 identifies the age corresponding to the image to be identified based on the third correlation value.
[0092] This application first acquires the image to be identified and an image database containing reference images of several different age groups. Then, it uses an age prediction model to extract features from the image to be identified and the reference images of several different age groups in the image database. Next, it calculates the third correlation value between the features of the image to be identified and the features of the reference images of several different age groups. Finally, it identifies the age corresponding to the image to be identified based on the third correlation value. This application calculates the age value of the image to be identified by judging the differences between the identified image and the reference images in the image database—that is, whether the age is too large, too small, or close—thus significantly improving the accuracy of image labeling and effectively enhancing recognition precision.
[0093] In one embodiment, identifying the age corresponding to the image to be identified based on a third correlation value includes: sorting several images of different age groups in ascending order of age label values to obtain a sorted image set; obtaining the current image in the sorted image set; when the current image is the first image in the sorted image set, and the third correlation value between the features of the image to be identified and the features of the first image is less than a first minimum correlation threshold, the labeled age value of the first image is taken as the age of the image to be identified; when the current image is the last image in the sorted image set, and the third correlation value between the features of the image to be identified and the features of the last image is greater than a first maximum correlation threshold, the labeled age value of the last image is taken as the age of the image to be identified; when the third correlation value between the features of the image to be identified and the features of the current image is between the first minimum correlation threshold and the first maximum correlation threshold, the labeled age value of the current image is taken as the age of the image to be identified.
[0094] In this embodiment, because several images of different age groups are sorted in ascending order of age label values, when the third correlation value between the feature of the image to be identified and the feature of the first image is less than the first minimum correlation threshold, the age of the image to be identified is determined to be consistent with the age of the youngest image in the sorted image set; when the third correlation value between the feature of the image to be identified and the feature of the last image is greater than the first maximum correlation threshold, the age of the image to be identified is determined to be consistent with the age of the oldest image in the sorted image set; in addition, when the third correlation value between the feature of the image to be identified and the feature of the current image is between the first minimum correlation threshold and the first maximum correlation threshold, this application can use the labeled age value of the current image as the age of the image to be identified.
[0095] In one embodiment, identifying the age corresponding to the image to be identified based on a third correlation value includes: obtaining the previous image of the current image in a sorted image set; when the third correlation value between the features of the image to be identified and the features of the current image is less than a first minimum correlation threshold, and the third correlation value between the features of the image to be identified and the features of the previous image is greater than a first maximum correlation threshold, by calculating... Obtain the age of the image to be identified, where AGE is the age of the image to be identified. n Age is the labeled age value for the current image. n-1 The labeled age value is the same as the one in the previous image. This is the third correlation value between the features of the image to be identified and the features of the current image. This is the third correlation value between the features of the image to be identified and the features of the previous image.
[0096] Specifically, for example, an image database has N age labels, each corresponding to one or more feature data points, where n represents the age sequence number sorted from smallest to largest. n This indicates the corresponding age, i.e., the labeled age value of the current image; This represents the average metric value calculated between the features of the image to be identified and one or more features related to the age; it corresponds to the third correlation value between the features of the image to be identified and the features of the current image. In this embodiment, the first minimum correlation threshold can be set to -0.3, and the first maximum correlation threshold can be set to 0.3. This is achieved through calculation... The age of the image to be identified can be obtained. Age1 is the first age label value in the sorted image database. N This represents the Nth age label value in the sorted image database. This is the third correlation value between the features of the image to be identified and the features of the first image. This is the third correlation value between the features of the image to be identified and the features of the Nth image.
[0097] This application can calculate the specific age of an image to be identified based on different threshold ranges of the third correlation value. The age value is calculated by judging the differences between the identified image and the ages of different images in the image database—that is, whether the age is too large, too small, or close. This application fully adapts to the methods used in the data labeling process, significantly improving the accuracy of image labeling and effectively enhancing recognition precision.
[0098] In one embodiment, identifying the age corresponding to the image to be identified based on the third correlation value further includes: when the third correlation value between the features of the image to be identified and the features of any one of the reference images of different age groups is less than a second minimum correlation threshold, determining the age range of the image to be identified to be less than the labeled age value of any one of the reference images; when the third correlation value between the features of the image to be identified and the features of any one of the reference images of different age groups is greater than a second maximum correlation threshold, determining the age range of the image to be identified to be greater than the labeled age value of any one of the reference images; when the third correlation value between the features of the image to be identified and the features of any one of the reference images of different age groups is between the second minimum correlation threshold and the second maximum correlation threshold, determining the age of the image to be identified to be equal to the labeled age value of any one of the reference images.
[0099] This embodiment can iterate through the results of the average measurement values to find and determine the age range of the identified image and calculate the specific age. In this embodiment, the second minimum correlation threshold can be set to the same value as the first minimum correlation threshold, or it can be set to a different value. Similarly, the second maximum correlation threshold can be set to the same value as the first maximum correlation threshold, or it can be set to a different value. For example, in this embodiment, the second minimum correlation threshold can be set to -0.3, and the second maximum correlation threshold can be set to 0.3. Then, based on the thresholds, it can be determined whether the age is greater than, less than, or equal to the threshold. This embodiment can accurately match the age range of the image to be identified based on the third correlation value, further improving the accuracy of image labeling and effectively enhancing recognition precision.
[0100] This application first collects target images, selecting facial or human images captured by a camera based on the target. After manual annotation (grouping) of the images according to the annotation method described in this invention, the aging degree within each group is ranked. The data can be divided into training and testing datasets. Then, a recognition network is designed, selecting mainstream facial recognition networks or human ReID recognition networks as age prediction models based on the target type. The age prediction model can be a Siamese network, optimized using the loss function designed in this invention; subsequently, a stochastic gradient descent optimizer is used to train the Siamese network. This application uses the age prediction model as a feature extraction module to establish an age feature library. Training data or other reference images can be selected, and the degree of age segmentation for inclusion in the library can be arbitrarily chosen. The more segmented the segmentation, the more accurate the age recognition, but the greater the computational load for age lookup. This application uses the trained age prediction model as a feature extraction module to extract features from the selected data and include them in the library, thereby completing the age prediction feature library designed in this application, i.e., the image database. Additionally, this application can use a camera to capture images to be recognized, which are human or facial images. The features of the images to be recognized are extracted using the trained feature extraction module. This application can utilize the features of the image to be identified, calculate a metric value with all features in the feature library, and calculate the identification age value based on the metric value.
[0101] This application reduces the difficulty of labeling age prediction model data under large amounts of image data while ensuring the accuracy of data labeling. It improves upon the inaccuracy of labeling in past subjective age value labeling. The labeling method in this invention does not require considering the accurate age of all data; it only needs to sort the data within each group from youngest to oldest. Furthermore, unlike methods that directly identify age, this application calculates the age value by judging the difference between the ages of the identified image and reference images in the database—that is, whether the age is too large, too small, or too close. This method is fully compatible with the aforementioned data labeling methods, significantly improving the accuracy of image labeling and effectively enhancing recognition precision.
[0102] The training method and protection scope of the age prediction model in this application are not limited to the execution order of the steps listed in this embodiment. Any solution implemented by adding, subtracting or replacing steps in the prior art based on the principles of this application is included within the protection scope of this application.
[0103] This application also provides a training device for an age prediction model and an age prediction device. The training device for the age prediction model can implement the training method for the age prediction model of this application, and the age prediction device can implement the age prediction method of this application. However, the implementation device for the training method of the age prediction model of this application includes, but is not limited to, the structure of the training device for the age prediction model listed in this embodiment, and the implementation device for the age prediction method includes, but is not limited to, the structure of the age prediction device listed in this embodiment. All structural modifications and substitutions of the prior art made based on the principles of this application are included within the protection scope of this application.
[0104] like Figure 4 As shown, this application also provides a training device for an age prediction model, comprising: 410, a sample acquisition module, used to acquire a sample set made of images of different age groups, wherein each image sample in the sample set has a corresponding age group labeling range; 420, a sorting module, used to sort each image sample according to the age group labeling range to obtain a sorted sample set, wherein each image sample in the sorted sample set has a corresponding sequence number; 430, a first feature extraction module, used to extract features of any two image samples in the sorted sample set using the age prediction model; 440, a first correlation calculation module, used to calculate a first correlation value between the features of any two image samples in the sorted sample set; 450, a loss value calculation module, used to calculate a loss function value based on the sequence number of any two image samples and the first correlation value between the features of any two image samples; and 460, a model update module, used to update the parameters of the age prediction model according to the loss function value to obtain an age prediction model with optimal parameters.
[0105] This application sorts images of different age groups according to their labeled age ranges, then calculates the first correlation value between the features of any two image samples in the sorted sample set; next, based on the index of any two image samples, it calculates a loss function value according to the first correlation value between their features; finally, it updates the parameters of the age prediction model based on the loss function value, obtaining the optimal age prediction model. This application does not require all data to be accurately labeled with age, greatly reducing the labeling difficulty of age prediction model data with large amounts of data, while ensuring the accuracy of data labeling.
[0106] In one embodiment, the sorting module 420 includes a first sorting module, which is configured to: obtain the age range of each image sample; and sort the image samples in order from youngest to oldest based on the age range of each image sample to obtain a sorted sample set.
[0107] This application sorts the image samples from youngest to oldest to obtain a sorted sample set, eliminating the need to label all data with accurate age, thus reducing the difficulty of labeling data for age prediction models.
[0108] In one embodiment, the sorting module 420 includes a second sorting module, which is configured to set at least two image samples to the same sequence number when at least two image samples are in the same age group labeling range.
[0109] In this application, when there are image samples of similar or nearly identical ages, the sequence number of each image sample in the sorted sample set can be reused, thereby reducing the tedious problem of sequence numbering in the data annotation process.
[0110] In one embodiment, any two image samples include a first image and a second image. The first correlation calculation module 440 includes a correlation calculation submodule, which is configured to: obtain the feature distance between the features of the first image and the features of the second image; obtain the hyperbolic tangent function value corresponding to the feature distance; and use the hyperbolic tangent function value corresponding to the feature distance as the first correlation value between the features of two adjacent image samples.
[0111] In this application, the features of any two image samples in the sorted sample set are vectors with a certain length. This application calculates the feature distance between the features of any two image samples and then calculates the corresponding hyperbolic tangent function value for the feature distance between the features of any two image samples, which can better measure the correlation of the features extracted from the two images.
[0112] In one embodiment, the features of the first image and the features of the second image each include several elements. The relevant calculation submodule includes a feature distance calculation module, which is configured to: obtain the current element in the features of the first image and the current element in the features of the second image; subtract the current element of the first image from the current element of the second image to obtain the difference of the current element; calculate the cube of the difference of the current element to obtain the cube of the difference corresponding to the current element; traverse all elements in the features of the first image and all elements in the features of the second image to obtain the cube of the difference corresponding to all elements; add the cubes of the difference corresponding to all elements to obtain the sum of the cubes of the elements; and use the sum of the cubes of the elements as the feature distance between the features of the first image and the features of the second image.
[0113] In this application, the features of the first image and the second image each have several elements. When calculating the feature distance between the features of the first image and the features of the second image, it is necessary to consider the error between each element of the first image and the second image, that is, the difference between the current element of the first image and the current element of the second image. Then, the difference between all elements is cubed and superimposed to obtain the superimposed result as the feature distance between the features of the first image and the features of the second image.
[0114] In one embodiment, the loss value calculation module 450 includes a mean squared error calculation module, which is configured to: obtain the sequence number of any two image samples based on the sequence number of each image sample in the sorted sample set; obtain a second correlation value between the features of any two image samples according to the sequence number of any two image samples; calculate the mean squared error between the first correlation value and the second correlation value to obtain the loss function value.
[0115] In this application, the true correlation value between the features of any two image samples can be obtained by using the sequence numbers of any two sorted image samples, i.e., the second correlation value; then the mean square error between the first correlation value and the true correlation value is calculated to obtain the loss function value.
[0116] In one embodiment, the sequence numbers of any two image samples include the sequence number of the first image and the sequence number of the second image. The mean square error calculation module includes a mean square error calculation submodule, which is configured to: set a second correlation value between the features of any two image samples to a first preset value when the sequence number of the first image is less than the sequence number of the second image; set a second correlation value between the features of any two image samples to a second preset value when the sequence number of the first image is greater than the sequence number of the second image; and set a second correlation value between the features of any two image samples to a third preset value when the sequence number of the first image is equal to the sequence number of the second image.
[0117] In this application, the sequence number of the first image is compared with the sequence number of the second image. Based on the comparison results of different sequence numbers, the true correlation between the two images can be determined. This application obtains the model's label by using the sequence number of the image samples, rather than using manually labeled true age values. This greatly reduces the labeling difficulty of age prediction model data with large amounts of data and ensures the accuracy of data labeling. It improves upon the inaccurate labeling that occurred in the past when labeling subjective age values.
[0118] like Figure 5As shown, this application also provides an age prediction device, including: 510, a data acquisition module for acquiring an image to be identified and several reference images of different age groups; 520, a second feature extraction module for extracting features of the image to be identified and features of several reference images of different age groups using an age prediction model; 530, a second correlation calculation module for calculating a third correlation value between the features of the image to be identified and the features of several reference images of different age groups; and 540, an age prediction module for identifying the age corresponding to the image to be identified based on the third correlation value.
[0119] This application first acquires the image to be identified and several reference images representing different age groups; then, it uses an age prediction model to extract features from the image to be identified and the reference images representing different age groups; next, it calculates the third correlation value between the features of the image to be identified and the features of the reference images representing different age groups; finally, it identifies the age corresponding to the image to be identified based on the third correlation value. This application calculates the age value of the image to be identified by judging the differences between the identified image and the reference images in the image database, i.e., whether the age is too large, too small, or too close, thus significantly improving the accuracy of image labeling and effectively enhancing recognition precision.
[0120] In one embodiment, several reference images of different age groups each have corresponding labeled age values. The second correlation calculation module includes a second correlation calculation submodule, which is configured to: when multiple images in several reference images of different age groups have the same labeled age value, obtain the features of multiple images; obtain the average value of the features of multiple images; and calculate a third correlation value between the features of the image to be identified and the average value of the features of multiple images.
[0121] In this application, when multiple images share the same labeled age value, the application first obtains the average value of the features of the multiple images, and then calculates the third correlation value between the features of the image to be identified and the average value of the features of the multiple images. This application further identifies the age corresponding to the image to be identified by calculating the third correlation value between the features of the image to be identified and the average value of the features of the multiple images, rather than calculating the third correlation value for each image with the same labeled age value. Therefore, this application can reduce the computational load, effectively improve the model's computational efficiency, and also improve the recognition accuracy.
[0122] In one embodiment, the age prediction module 540 includes a first age prediction module, which is configured to: sort several images of different age groups in ascending order of age label values to obtain a sorted image set; obtain the current image in the sorted image set; when the current image is the first image in the sorted image set, and the third correlation value between the features of the image to be identified and the features of the first image is less than a first minimum correlation threshold, use the labeled age value of the first image as the age of the image to be identified; when the current image is the last image in the sorted image set, and the third correlation value between the features of the image to be identified and the features of the last image is greater than a first maximum correlation threshold, use the labeled age value of the last image as the age of the image to be identified; when the third correlation value between the features of the image to be identified and the features of the current image is between the first minimum correlation threshold and the first maximum correlation threshold, use the labeled age value of the current image as the age of the image to be identified.
[0123] In this application, because several images of different age groups are sorted in ascending order of age label values, when the third correlation value between the feature of the image to be identified and the feature of the first image is less than the first minimum correlation threshold, the age of the image to be identified is determined to be consistent with the age of the youngest image in the sorted image set; when the third correlation value between the feature of the image to be identified and the feature of the last image is greater than the first maximum correlation threshold, the age of the image to be identified is determined to be consistent with the age of the oldest image in the sorted image set; in addition, when the third correlation value between the feature of the image to be identified and the feature of the current image is between the first minimum correlation threshold and the first maximum correlation threshold, this application can use the labeled age value of the current image as the age of the image to be identified.
[0124] In one embodiment, the age prediction module 540 includes a second age prediction module, which is configured to: acquire the previous image of the current image in the sorted image set; when the third correlation value between the features of the image to be identified and the features of the current image is less than a first minimum correlation threshold, and the third correlation value between the features of the image to be identified and the features of the previous image is greater than a first maximum correlation threshold, by calculating... The age of the image to be identified is obtained, where AGE is the age of the image to be identified, Agen is the labeled age value of the current image, and Agen-1 is the labeled age value of the previous image. This is the third correlation value between the features of the image to be identified and the features of the current image. This is the third correlation value between the features of the image to be identified and the features of the previous image.
[0125] This application can calculate the specific age of an image to be identified based on different threshold ranges of the third correlation value. The age value is calculated by judging the differences between the identified image and the ages of different images in the image database—that is, whether the age is too large, too small, or close. This application fully adapts to the methods used in the data labeling process, significantly improving the accuracy of image labeling and effectively enhancing recognition precision.
[0126] In one embodiment, the age prediction module 540 includes a third age prediction module, which is configured to: determine the age range of the image to be identified as less than the labeled age value of any one of the reference images of different age groups when the third correlation value between the features of the image to be identified and the features of any one of the reference images of different age groups is less than the second minimum correlation threshold; determine the age range of the image to be identified as greater than the labeled age value of any one of the reference images when the third correlation value between the features of the image to be identified and the features of any one of the reference images of different age groups is greater than the second maximum correlation threshold; and determine the age of the image to be identified as equal to the labeled age value of any one of the reference images when the third correlation value between the features of the image to be identified and the features of any one of the reference images of different age groups is between the second minimum correlation threshold and the second maximum correlation threshold.
[0127] This application can also accurately match the age range of the image to be identified based on the third correlation value, further improving the accuracy of image labeling and effectively enhancing recognition precision.
[0128] In practice, the above modules can be implemented as independent entities or combined in any way to be implemented as the same or several entities. For the specific implementation of the above modules, please refer to the previous method implementation examples, which will not be repeated here.
[0129] As can be seen from the above, this application reduces the difficulty of labeling age prediction model data under large amounts of image data while ensuring the accuracy of data labeling. It improves upon the inaccuracy issues that occurred in previous subjective age value labeling. The labeling method in this invention does not require considering the accurate age of all data; it only needs to sort the data within each group from youngest to oldest. Furthermore, unlike methods that directly identify age, this application calculates the age value by judging the differences between the identified image and the ages of reference images in the database—that is, whether the age is too large, too small, or too close. This method is fully compatible with the aforementioned data labeling methods, significantly improving the accuracy of image labeling and effectively enhancing recognition precision.
[0130] In the embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, or methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For instance, the division of modules / units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or units may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection of apparatuses or modules or units may be electrical, mechanical, or other forms.
[0131] The modules / units described as separate components may or may not be physically separate. The components shown as modules / units may or may not be physical modules; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules / units can be selected to achieve the objectives of the embodiments of this application, depending on actual needs. For example, the functional modules / units in the various embodiments of this application may be integrated into one processing module, or each module / unit may exist physically separately, or two or more modules / units may be integrated into one module / unit.
[0132] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0133] This application also provides an electronic device, which can be a terminal, a server, or other similar device. The terminal can be a mobile phone, tablet computer, smart Bluetooth device, laptop computer, personal computer, etc.; the server can be a single server or a server cluster composed of multiple servers, etc.
[0134] In some embodiments, the training device or age prediction device for the age prediction model provided in this application may also be integrated into multiple electronic devices. For example, the training device or age prediction device for the age prediction model may be integrated into multiple servers, with multiple servers implementing the training method or age prediction method for the age prediction model of this application. Alternatively, the training device or age prediction device for the age prediction model may be integrated into multiple servers, with multiple servers implementing the training method or age prediction method for the age prediction model of this application.
[0135] In this embodiment, a server will be used as an example for detailed description. For example, ... Figure 6 As shown, it illustrates a schematic diagram of the server structure involved in an embodiment of this application. Specifically:
[0136] The server may include components such as a processor 610 with one or more processing cores, a memory 620 with one or more computer-readable storage media, a power supply 630, an input module 640, and a communication module 650. Those skilled in the art will understand that... Figure 6 The server architecture shown does not constitute a limitation on the server and may include more or fewer components than illustrated, or combine certain components, or have different component arrangements. Wherein:
[0137] The processor 610 is the control center of the server, connecting various parts of the server through various interfaces and lines. It performs various server functions and processes data by running or executing software programs and / or modules stored in the memory 620, and by calling data stored in the memory 620, thereby providing overall monitoring of the server. In some embodiments, the processor 610 may include one or more processing cores; in some embodiments, the processor 610 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may also not be integrated into the processor 610.
[0138] The memory 620 can be used to store software programs and modules. The processor 610 executes various functional applications and data processing by running the software programs and modules stored in the memory 620. The memory 620 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the server, etc. In addition, the memory 620 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 620 may also include a memory controller to provide the processor 610 with access to the memory 620.
[0139] The server also includes a power supply 630 that supplies power to the various components. In some embodiments, the power supply 630 can be logically connected to the processor 610 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. The power supply 630 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.
[0140] The server may also include an input module 640, which can be used to receive input numeric or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.
[0141] The server may also include a communication module 650. In some embodiments, the communication module 650 may include a wireless module, through which the server can perform short-range wireless transmission, thereby providing users with wireless broadband internet access. For example, the communication module 650 can be used to help users send and receive emails, browse web pages, and access streaming media.
[0142] Although not shown, the server may also include a display unit, etc., which will not be described in detail here. Specifically, in this embodiment, the processor 610 in the server loads the executable files corresponding to the processes of one or more applications into the memory 620 according to the following instructions, and the processor 610 runs the applications stored in the memory 620, thereby realizing the various functions of the age prediction model training device or the age prediction device.
[0143] In some embodiments, this application also provides a computer-readable storage medium. Those skilled in the art will understand that all or part of the steps in the methods of the above embodiments can be implemented by a program instructing a processor, and the program can be stored in a computer-readable storage medium. The storage medium is a non-transitory medium, such as random access memory, read-only memory, flash memory, hard disk, solid-state drive, magnetic tape, floppy disk, optical disk, and any combination thereof. The above storage medium can be any available medium accessible to a computer or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., digital video disc (DVD)), or a semiconductor medium (e.g., solid-state disk (SSD)).
[0144] This application embodiment may also provide a computer program product, which includes one or more computer instructions. When the computer instructions are loaded and executed on a computing device, all or part of the flow or function according to the embodiments of this application is generated. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, or data center to another website, computer, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means.
[0145] When the computer program product is executed by a computer, the computer performs the method described in the foregoing method embodiments. The computer program product may be a software installation package; when the foregoing method is required, the computer program product can be downloaded and executed on the computer.
[0146] The descriptions of the processes or structures corresponding to the above figures each have their own emphasis. For parts of a process or structure that are not described in detail, please refer to the relevant descriptions of other processes or structures.
[0147] The above embodiments are merely illustrative of the principles and effects of this application and are not intended to limit this application. Any person skilled in the art can modify or alter the above embodiments without departing from the spirit and scope of this application. Therefore, all equivalent modifications or alterations made by those skilled in the art without departing from the spirit and technical concept disclosed in this application should still be covered by the claims of this application.
Claims
1. A training method for an age prediction model, characterized in that, The method includes: Obtain a sample set composed of images of different age groups, wherein each image sample in the sample set has a corresponding age group labeling range; The image samples are sorted according to the age group labeling range to obtain a sorted sample set, and each image sample in the sorted sample set has a corresponding serial number. The features of any two image samples in the sorted sample set are extracted using an age prediction model. Calculate the first correlation value between the features of any two image samples in the sorted sample set; Based on the index of any two image samples, calculate the loss function value according to the first correlation value between the features of any two image samples; The parameters of the age prediction model are updated based on the loss function value to obtain the age prediction model with optimal parameters.
2. The method according to claim 1, characterized in that, The step of sorting the image samples according to the age group labeling range to obtain the sorted sample set includes: Obtain the age range annotation for each image sample; Based on the age range of each image sample, the image samples are sorted in order from youngest to oldest to obtain a sorted sample set. When at least two image samples are within the same age group labeling range, the at least two image samples are assigned the same serial number.
3. The method according to claim 1 or 2, characterized in that, The calculation of the first correlation value between the features of any two image samples in the sorted sample set, wherein the any two image samples include a first image and a second image, includes: Obtain the feature distance between the features of the first image and the features of the second image; Obtain the hyperbolic tangent function value corresponding to the feature distance; The hyperbolic tangent function value corresponding to the feature distance is used as the first correlation value between the features of two adjacent image samples.
4. The method according to claim 3, characterized in that, The step of obtaining the feature distance between the features of the first image and the features of the second image, wherein the features of the first image and the features of the second image each include several elements, including: Obtain the current element from the features of the first image and the current element from the features of the second image; Subtract the current element of the first image from the current element of the second image to obtain the difference of the current element; Calculate the cube of the difference of the current element to obtain the cube of the difference corresponding to the current element; Traverse all elements in the features of the first image and all elements in the features of the second image to obtain the cube of the difference for each element. Add the cubes of the differences of all the elements to obtain the sum of the cubes of the elements; The sum of the cubes of the elements is used as the feature distance between the features of the first image and the features of the second image.
5. The method according to claim 1, characterized in that, The step of calculating the loss function value based on the sequence number of any two image samples and the first correlation value between the features of the any two image samples includes: Based on the sequence number corresponding to each image sample in the sorted sample set, obtain the sequence number of any two image samples; The second correlation value between the features of any two image samples is obtained based on their sequence numbers. The mean square error between the first correlation value and the second correlation value is calculated to obtain the loss function value.
6. The method according to claim 5, characterized in that, The step of obtaining a second correlation value between the features of any two image samples based on their indexes, wherein the indexes of the two image samples include the indexes of the first image and the second image, includes: When the sequence number of the first image is less than the sequence number of the second image, the second correlation value between the features of any two image samples is set to the first preset value; When the sequence number of the first image is greater than the sequence number of the second image, the second correlation value between the features of any two image samples is set to a second preset value. When the sequence number of the first image is equal to the sequence number of the second image, the second correlation value between the features of any two image samples is set to a third preset value.
7. An age prediction method, characterized in that, include: Acquire the image to be identified and several reference images of different age groups; The features of the image to be identified and the features of several reference images of different age groups are extracted using an age prediction model. Calculate the third correlation value between the features of the image to be identified and the features of the reference images of different age groups; The age corresponding to the image to be identified is determined based on the third correlation value.
8. The method according to claim 7, characterized in that, The calculation of a third correlation value between the features of the image to be identified and the features of the several reference images of different age groups, wherein the several reference images of different age groups each have a corresponding labeled age value, including: When multiple reference images of different age groups have the same labeled age value, the features of the multiple images are obtained; Obtain the average value of the features of the multiple images; Calculate a third correlation value between the features of the image to be identified and the average value of the features of the plurality of images.
9. The method according to claim 7 or 8, characterized in that, The step of identifying the age corresponding to the image to be identified based on the third correlation value includes: The reference images of different age groups are sorted in ascending order of age label values to obtain a sorted image set. Obtain the current image from the sorted image set; When the current image is the first image in the sorted image set, and the third correlation value between the features of the image to be identified and the features of the first image is less than the first minimum correlation threshold, the labeled age value of the first image is taken as the age of the image to be identified. When the current image is the last image in the sorted image set, and the third correlation value between the features of the image to be identified and the features of the last image is greater than the first maximum correlation threshold, the labeled age value of the last image is taken as the age of the image to be identified. When the third correlation value between the features of the image to be identified and the features of the current image is between the first minimum correlation threshold and the first maximum correlation threshold, the labeled age value of the current image is taken as the age of the image to be identified.
10. The method according to claim 7, characterized in that, The step of identifying the age corresponding to the image to be identified based on the third correlation value includes: The reference images of different age groups are sorted in ascending order of age label values to obtain a sorted image set. Obtain the current image from the sorted image set; Obtain the previous image of the current image in the sorted image set; When the third correlation value between the features of the image to be identified and the features of the current image is less than the first minimum correlation threshold, and the third correlation value between the features of the image to be identified and the features of the previous image is greater than the first maximum correlation threshold, the result is obtained by calculation. The age of the image to be identified is obtained, where AGE is the age of the image to be identified. n Age is the labeled age value of the current image. n-1 The labeled age value of the previous image. This is the third correlation value between the features of the image to be identified and the features of the current image. It is the third correlation value between the features of the image to be identified and the features of the previous image.
11. The method according to claim 7, characterized in that, The step of identifying the age corresponding to the image to be identified based on the third correlation value further includes: When the third correlation value between the features of the image to be identified and the features of any one of the reference images of different age groups is less than the second minimum correlation threshold, the age range of the image to be identified is determined to be less than the labeled age value of any one of the reference images. When the third correlation value between the features of the image to be identified and the features of any one of the reference images of different age groups is greater than the second maximum correlation threshold, the age range of the image to be identified is determined to be greater than the labeled age value of any one of the reference images. When the third correlation value between the features of the image to be identified and the features of any one of the several reference images of different age groups is between the second minimum correlation threshold and the second maximum correlation threshold, the age of the image to be identified is determined to be equal to the labeled age value of any one of the reference images.
12. A training device for an age prediction model, characterized in that, The device includes: The sample acquisition module is used to acquire a sample set made up of images of different age groups, wherein each image sample in the sample set has a corresponding age group labeling range; The sorting module is used to sort the image samples according to the age group labeling range to obtain a sorted sample set, wherein each image sample in the sorted sample set has a corresponding serial number. The first feature extraction module is used to extract features from any two image samples in the sorted sample set using an age prediction model. The first correlation calculation module is used to calculate the first correlation value between the features of any two image samples in the sorted sample set. The loss calculation module is used to calculate the loss function value based on the sequence number of any two image samples and the first correlation value between the features of the any two image samples. The model update module is used to update the parameters of the age prediction model based on the loss function value, so as to obtain the age prediction model with optimal parameters.
13. An age prediction device, characterized in that, The device includes: The data acquisition module is used to acquire the image to be identified and several reference images of different age groups; The second feature extraction module is used to extract features of the image to be identified and features of several reference images of different age groups using an age prediction model. The second correlation calculation module is used to calculate the third correlation value between the features of the image to be identified and the features of the several reference images of different age groups; An age prediction module is used to identify the age corresponding to the image to be identified based on the third correlation value.
14. An electronic device, characterized in that, The electronic device includes: The memory stores multiple instructions; A processor that loads instructions from the memory to perform steps in the training method of the age prediction model as claimed in any one of claims 1 to 6 or steps in the age prediction method as claimed in any one of claims 7 to 11.
15. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by an electronic device, the program implements the steps in the training method of the age prediction model according to any one of claims 1 to 6 or the steps in the age prediction method according to any one of claims 7 to 11.
Citation Information
Patent Citations
Age estimation method based on multi-output convolution neural network and ordered regression
CN105975916A
Systems and Methods for Facial Age Identification
US20140334734A1