Age identification method and device, computer equipment and medium
By extracting temporal trajectories from video frame images and filtering high-confidence results, the problem of low age classification accuracy caused by low-quality images is solved, and higher age recognition accuracy is achieved.
Patent Information
- Application Number
- CN202511154197.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-15
- Publication Date
- 2025-12-19
AI Technical Summary
Existing human age classification models have low accuracy in outputting age classification results when the image quality is low.
By extracting the temporal trajectory of the detected target from video frame images of video data, each trajectory image is input into the human age classification model to obtain the age classification result and prediction confidence. The number of results with prediction confidence greater than a threshold is selected, and it is determined whether they are greater than the first threshold to determine the final age recognition result.
It improves the accuracy of age recognition results and reduces the impact of low-quality trajectory images in time-series trajectories on the accuracy of human age classification models.
Smart Images

Figure CN121170840A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer vision, and in particular to an age recognition method and device, a computer device and a medium. BACKGROUND
[0002] In a human age classification task, a human age classification model is usually obtained by classifying a single frame image to obtain an age classification result of a detection target in the image. However, the quality of the single frame image directly affects the accuracy of the age classification result output by the human age classification model. For example, if the image is blurred or occluded, the quality of the image will be reduced. Inputting the low-quality image into the human age classification model will reduce the classification accuracy of the human age classification model.
[0003] Therefore, when the image quality is low, the age classification result output by the existing human age classification model has the problem of low accuracy. SUMMARY
[0004] Embodiments of the present application provide an age recognition method, device, computer device and medium to solve the problem of low accuracy of the age classification result output by the existing human age classification model when the image quality is low.
[0005] In a first aspect, the present application provides an age recognition method, comprising: extracting a time sequence track corresponding to each detection target from a video frame image of video data, the time sequence track comprising a track image of the detection target sorted in time sequence; inputting each track image in the time sequence track into a human age classification model respectively to obtain an age classification result of the detection target in each track image and a corresponding prediction confidence; determining a result number of target results with a prediction confidence greater than a preset confidence threshold from the age classification result, and determining whether the result number is greater than a preset first threshold; if the result number is greater than the first threshold, taking the target result as an age recognition result of the detection target.
[0006] The above age recognition method can optionally comprise the following steps. selecting the track image from the time sequence track as a first target image in time sequence according to the time sequence; calculating a target similarity between the first target image and a second target image in a sliding window; determining whether the target similarity is greater than a preset similarity threshold. if the target similarity is greater than the similarity threshold, adding the first target image into the sliding window as the second target image, and returning to perform the step of selecting the track image from the time sequence trajectory as the first target image in turn according to the time sequence; if the target similarity is less than or equal to the similarity threshold, discarding the first target image from the time sequence trajectory to obtain an updated first track, and returning to perform the step of selecting the track image from the time sequence trajectory as the first target image in turn according to the time sequence; inputting each frame of the track image in the first track into a human age classification model to obtain an age classification result of the detected target in each frame of the track image and a corresponding prediction confidence.
[0007] The above age recognition method can optionally calculate a target similarity between the first target image and a second target image in the sliding window, including: extracting an image feature vector of the first target image and an average feature vector of all the second target images in the sliding window; calculating the target similarity based on the image feature vector and the average feature vector.
[0008] The above age recognition method can optionally have a first quantity for the length of the sliding window. Before the first target image is added into the sliding window as the second target image, the method further includes: determining whether the number of the second target images in the sliding window reaches the first quantity; if the number of the second target images reaches the first quantity, removing the second target image that is added first from the sliding window.
[0009] The above age recognition method can optionally include, after the first target image is discarded from the time sequence trajectory to obtain an updated first track, further including: recording a discard number of the first target image that is discarded continuously; determining whether the discard number is greater than a preset second threshold; if the discard number is greater than the second threshold, emptying the sliding window and discarding the time sequence trajectory.
[0010] The above age recognition method can optionally include inputting each frame of the track image in the first track into a human age classification model to obtain an age classification result of the detected target in each frame of the track image and a corresponding prediction confidence, including: clustering the trajectory images in the time sequence trajectory into two image data clusters; updating the image data cluster with the largest number of images as a second trajectory; screening the same trajectory images from the first trajectory and the second trajectory as target trajectories; inputting each frame of the trajectory images in the target trajectory into a human age classification model to obtain an age classification result of the detected target in each frame of the trajectory images and a corresponding prediction confidence.
[0011] The above age recognition method can optionally extract a time sequence trajectory corresponding to each detected target from a video frame image of video data, including: performing target detection on each frame of the video frame image to obtain a target detection box corresponding to each detected target in the video frame image; performing multi-target tracking on each detected target based on the target detection box to obtain a target identifier and time sequence information corresponding to each target detection box; obtaining the time sequence trajectory corresponding to the detected target from the video frame image based on the target identifier and the time sequence information.
[0012] The above age recognition method can optionally obtain the confidence threshold value in the following manner: obtain a test set, the test set including test images; input the test images into the human age classification model to obtain a test age result of a test target in each frame of the test images and a corresponding test confidence; determine a precision of the test age result from the test confidence, and a target confidence when a preset target precision is reached; calculate an average confidence of all the target confidences, and use the average confidence as the confidence threshold value.
[0013] The above age recognition method can optionally include the following steps after using the target result as the age recognition result of the detected target: label the target result as an age label of each frame of the trajectory images to obtain a training sample set; input the training sample set into the human age classification model to obtain an age classification result corresponding to each trajectory image; calculate a classification loss value of the human age classification model based on the age label and the age classification result; determine that the human age classification model is sufficiently trained when the classification loss value meets a preset training end condition.
[0014] In a second aspect, the present application provides an age recognition device, comprising: a trajectory generation module configured to extract a time sequence trajectory corresponding to each detection target from a video frame image of video data, the time sequence trajectory comprising trajectory images of the detection target sorted in time sequence; an age prediction module configured to input each of the trajectory images in the time sequence trajectory into a human age classification model respectively to obtain an age classification result and a corresponding prediction confidence of the detection target in each of the trajectory images; a result judgment module configured to determine a result number of target results with the prediction confidence greater than a preset confidence threshold from the age classification result, and judge whether the result number is greater than a preset first threshold; an age recognition module configured to take the target result as an age recognition result of the detection target when the result number is greater than the first threshold.
[0015] In a third aspect, the present application provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the age recognition method of any one of the above aspects when executing the computer program.
[0016] In a fourth aspect, the present application provides a computer readable storage medium, wherein the computer readable storage medium stores a computer program, and the computer program is executable by a processor to implement the age recognition method of any one of the above aspects.
[0017] The age recognition method, device, computer device and medium method, device, computer device and storage medium, by extracting the time sequence track corresponding to each detection target from the video frame image of the video data, the time sequence track includes the track image of the detection target in time sequence order; each frame of the track image in the time sequence track is input into the human age classification model respectively, to obtain the age classification result of the detection target in each frame of the track image and the corresponding prediction confidence; from the age classification result, the result quantity of the target result with the prediction confidence greater than the preset confidence threshold is determined, and whether the result quantity is greater than the preset first threshold is judged; if the result quantity is greater than the first threshold, the target result is taken as the age recognition result of the detection target. It can be seen that, by the human age classification model, the age classification of the track image in the time sequence track is performed, the age classification result of the detection target in each frame of the track image and the corresponding prediction confidence are obtained, then the target result with the prediction confidence greater than the confidence threshold is screened out from the age classification result, high-confidence aggregation of the age classification result is realized, and whether the result quantity of the target result is greater than the preset first threshold is determined to evaluate the track consistency of the track image in the time sequence track, when the result quantity of the target result is greater than the first threshold, the target result is taken as the age recognition result of the detection target, compared with the age recognition method based on the single frame image in the prior art, the influence of the low-quality track image in the time sequence track on the recognition accuracy of the human age classification model is reduced, and the purpose of improving the accuracy of the age recognition result is achieved. BRIEF DESCRIPTION OF DRAWINGS
[0018] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed to be used in the description of the embodiments of the present application will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0019] Figure 1 is an implementation flowchart of the age recognition method in an embodiment of the present application; Figure 2 is a partial implementation flowchart of the age recognition method in an embodiment of the present application; Figure 3 is a partial implementation flowchart of the age recognition method in an embodiment of the present application; Figure 4 is a partial implementation flowchart of the age recognition method in an embodiment of the present application; Figure 5 is a partial implementation flowchart of the age recognition method in an embodiment of the present application; Figure 6 is a partial implementation flowchart of the age recognition method in an embodiment of the present application; Figure 7 is a part of implementation flowchart of the age recognition method in an embodiment of the present application; Figure 8 is a part of implementation flowchart of the age recognition method in an embodiment of the present application; Figure 9 is a part of implementation flowchart of the age recognition method in an embodiment of the present application; Figure 10 is a schematic diagram of the age recognition device in an embodiment of the present application; Figure 11 is a schematic diagram of the computer device in an embodiment of the present application. DETAILED DESCRIPTION
[0020] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are some of the embodiments of the present application, but not all of the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the scope of protection of the present application.
[0021] It should be understood that when used in the specification and the appended claims of the present application, the term “comprising” indicates the presence of the described features, integers, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof.
[0022] It should also be understood that the term “and / or” used in the specification and the appended claims of the present application means any combination of one or more of the associated listed items and all possible combinations, and includes these combinations.
[0023] As used in the specification and the appended claims of the present application, the term “if” can be interpreted as “when” or “upon” or “in response to a determination” or “in response to detecting” depending on the context. Similarly, the phrase “if it is determined” or “if [a described condition or event] is detected” can be interpreted as meaning “upon determining” or “in response to determining” or “upon detecting [a described condition or event]” or “in response to detecting [a described condition or event]” depending on the context.
[0024] In addition, in the description of the present application and the appended claims, the terms “first”, “second”, “third”, etc. are only used for differentiation in description, and cannot be understood as indicating or implying relative importance.
[0025] Reference in the specification to "one embodiment" or "some embodiments" means that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment of the application. The appearances of the phrase "in one embodiment" or "in some embodiments" in various places in the specification are not necessarily all referring to the same embodiment, however, unless otherwise specifically stated. The terms "including," "comprising," "having" and variations thereof herein are meant to be open-ended terms that can cover the presence of subs tants of one or more features, structures, or characteristics, but do not exclude the presence of others.
[0026] The application discloses an age recognition method and device, computer equipment and medium. The method comprises the following steps: extracting a time sequence track corresponding to each detection target from a video frame image of video data, wherein the time sequence track comprises a track image of the detection target in time sequence; inputting each track image in the time sequence track into a human age classification model respectively to obtain an age classification result of the detection target in each track image and a corresponding prediction confidence; determining a result quantity of a target result with a prediction confidence greater than a preset confidence threshold from the age classification result, and judging whether the result quantity is greater than a preset first threshold; and if the result quantity is greater than the first threshold, taking the target result as an age recognition result of the detection target. It can be seen that the application classifies the track image in the time sequence track by the human age classification model to obtain the age classification result of the detection target in each track image and the corresponding prediction confidence, then selects the target result with the prediction confidence greater than the confidence threshold from the age classification result, realizes high-confidence aggregation of the age classification result, and evaluates the track consistency of the track image in the time sequence track by determining whether the result quantity of the target result is greater than the preset first threshold, and takes the target result as the age recognition result of the detection target when the result quantity of the target result is greater than the first threshold, thereby reducing the influence of low-quality track images in the time sequence track on the recognition accuracy of the human age classification model, and achieving the purpose of improving the accuracy of the age recognition result. The following will be described by specific embodiments.
[0027] In one embodiment, as shown in Figure 1 An age recognition method is provided, which is suitable for electronic devices with image and data processing capabilities, such as mobile phones, tablet computers, notebook computers, personal computers, servers and the like. The method comprises the following steps: S101: Extracting a time sequence track corresponding to each detection target from a video frame image of video data.
[0028] The time sequence track includes a track image of the detection target in time sequence, that is, each monitoring target corresponds to a time sequence track, and the track image in the time sequence track is an image based on the detection target in each frame of video frame image.
[0029] In an embodiment, the video data in the embodiment can be video data collected by any one or more of video data collection devices such as a camera, an industrial camera, a video camera, etc. For example, pedestrian video data collected by a traffic camera installed at a traffic intersection.
[0030] In an embodiment, the embodiment can first obtain continuous video frame images from the video data, and then perform target detection on each frame of video frame image by a target detection algorithm to obtain a human body detection box of each detection target in the video frame image, and then obtain a human body detection box corresponding to each detection target from the human body detection box according to a multi-target tracking algorithm, and sort the human body detection boxes in time sequence to obtain a time sequence track. Thus, by obtaining the time sequence track, the identity consistency of the detection target in the track image in the same time sequence track is ensured, the problem of mixed identities of detection targets in the image in the prior art is solved, and the age recognition accuracy is improved. It should be noted that the time sequence track in the embodiment can be a human body detection box, and the track image refers to an image in the human body detection box in the video frame image, or can be an image cut out from the human body detection box in the video frame image, which is not limited in the embodiment.
[0031] S102: input each frame of track image in the time sequence track into the human body age classification model respectively to obtain an age classification result and a corresponding prediction confidence of the detection target in each frame of track image.
[0032] It can be understood that the track images of the time sequence track come from the same detection target, but since the monitoring target is always in a moving state in the video data, the detection target in different track images may be different due to different postures, different distances, and whether there is an occlusion, etc. Therefore, when each frame of track image in the time sequence track is input into the human body age classification model, the age classification result and the corresponding prediction confidence output by the human body age classification model may be different. The greater the prediction confidence, the higher the credibility of the corresponding age classification result.
[0033] In a specific implementation, the human age classification model in this embodiment includes, but is not limited to, any one or a combination of multiple models of a CNN series model, a generative adversarial network, an RNN model, and a variant model thereof, and the like. In this embodiment, no limitation is made. After the trajectory image is input into the human age classification model, the human age classification model outputs a probability distribution based on an age category, and the age category corresponding to the maximum probability value in the probability distribution is selected as the age classification result. The age category can be a specific age, such as 20 years old, 30 years old, and 60 years old, or the age category can be an age range, such as children (0-14 years old), teenagers (15-24 years old), adults (18-45 years old), middle-aged people (45-65 years old), and the elderly (65 years old and above), and the like. In this embodiment, no limitation is made to the specific age category.
[0034] S103: From the age classification result, determine the result quantity of the target result whose prediction confidence is greater than the preset confidence threshold, and determine whether the result quantity is greater than a preset first threshold.
[0035] It can be understood that in this embodiment, the age classification result whose prediction confidence is greater than the confidence threshold, i.e., the target result, is screened out, and the result quantity of the target result is counted. If the result quantity is greater than the first threshold, it indicates that the reliability of the age classification result is verified based on the multi-frame consistency, and at this time, the target result is taken as the age recognition result of the detection target. If the result quantity is less than or equal to the first threshold, it indicates that the reliability of the age classification result cannot be verified based on the multi-frame consistency, so the corresponding time sequence trajectory is discarded, and the age recognition result corresponding to the detection target in the time sequence trajectory is not output.
[0036] In a specific implementation, in this embodiment, the prediction confidence corresponding to each age classification result can be traversed to determine whether the prediction confidence corresponding to each age classification result is greater than the confidence threshold. If the prediction confidence corresponding to the age classification result is greater than the confidence threshold, the result quantity of the target result is recorded as 1, and then the prediction confidence corresponding to the next age classification result is obtained for determination. If the prediction confidence corresponding to the age classification result is less than or equal to the confidence threshold, the prediction confidence corresponding to the next age classification result is directly obtained for determination. In this way, until the prediction confidence corresponding to all age classification results is traversed, the final result quantity is output, and it is determined whether the result quantity is greater than the preset first threshold.
[0037] S104: If the result quantity is greater than the first threshold, the target result is taken as the age recognition result of the detection target.
[0038] It can be understood that the target result corresponding to different trajectory images may correspond to different age categories, therefore, the number of target results of the same category needs to be counted, and the target result with the largest number is screened out as the age recognition result of the detected target in the time sequence trajectory. Thus, the target result obtained through multi-frame aggregation is used as the age recognition result of the detected target in the time sequence trajectory, avoiding the problem of low accuracy of the age recognition result predicted by a single frame image, and the accuracy of the generated age recognition result is significantly better than that of the age recognition result generated based on a single frame image in the prior art.
[0039] For example, there are five target results, which are 19 years old, 20 years old, 21 years old, 20 years old, and 20 years old. Obviously, the number of target results of 20 years old is the largest, and therefore, the target result of 20 years old is used as the age recognition result of the detected target in the time sequence trajectory.
[0040] In summary, the present application discloses an age recognition method, which extracts a time sequence trajectory corresponding to each detected target from a video frame image of video data, the time sequence trajectory including trajectory images of the detected target sorted in time sequence; each frame of trajectory image in the time sequence trajectory is input into a human age classification model to obtain age classification results and corresponding prediction confidence of the detected target in each frame of trajectory image; the number of target results with prediction confidence greater than a preset confidence threshold is determined from the age classification results, and it is judged whether the number of results is greater than a preset first threshold; if the number of results is greater than the first threshold, the target result is used as the age recognition result of the detected target. It can be seen that the present application classifies the age of the trajectory image in the time sequence trajectory by the human age classification model to obtain the age classification result and the corresponding prediction confidence of the detected target in each frame of trajectory image, then selects the target result with prediction confidence greater than the confidence threshold from the age classification result, realizes high-confidence aggregation of the age classification result, and evaluates the trajectory consistency of the trajectory image in the time sequence trajectory by determining whether the number of target results is greater than the preset first threshold. When the number of target results is greater than the first threshold, the target result is used as the age recognition result of the detected target. Compared with the age recognition method realized based on a single frame image in the prior art, the influence of low-quality trajectory images in the time sequence trajectory on the recognition accuracy of the human age classification model is reduced, and the purpose of improving the accuracy of the age recognition result is achieved.
[0041] In one embodiment, as shown in Figure 2 the step S102 in the above embodiment can be implemented by the following steps: S201: Selecting a trajectory image as a first target image from the time sequence trajectory in time sequence.
[0042] It can be understood that in the embodiment, the trajectory images are sequentially obtained from the time sequence trajectory in time sequence, each time a trajectory image is obtained, the trajectory image is taken as the first target image to execute the subsequent steps, until the trajectory images in the time sequence trajectory are all taken as the first target image to execute the subsequent steps, the process ends, and the final updated first trajectory is obtained.
[0043] S202: Calculate the target similarity between the first target image and the second target image in the sliding window.
[0044] In one embodiment, if there is no second target image in the sliding window, the first target image is added to the sliding window as the second target image. For example, when the first target image is the first frame trajectory image selected from the time sequence trajectory, the first target image has not been added to the sliding window as the second target image, so there is no second target image in the sliding window, and the first target image can be directly added to the sliding window as the second target image, without the need for target similarity calculation.
[0045] In one embodiment, if there is one frame of second target image in the sliding window, the target similarity between the first target image and the second target image is calculated. Specifically, in the embodiment, the first feature vector of the first target image and the second feature vector of the second target image can be extracted, and then the target similarity is calculated based on the first feature vector and the second feature vector.
[0046] In one embodiment, if there are multiple frames of second target images in the sliding window, the target similarity between the first target image and the multiple frames of second target images is calculated. Specifically, in the embodiment, the first feature vector of the first target image and the second feature vector of each frame of second target image can be extracted, and then the average feature vector of the second feature vectors is calculated, and the target similarity is calculated based on the first feature vector and the target feature vector. Alternatively, in the embodiment, the similarity average of the first feature vector and each second feature vector can be calculated as the target similarity.
[0047] S203: Determine whether the target similarity is greater than a preset similarity threshold.
[0048] If the target similarity is greater than the similarity threshold, the first target image is added to the sliding window as a second target image, and the step of sequentially selecting the trajectory image from the time sequence trajectory as the first target image in time sequence is returned to execute, that is, step S201 is returned to execute. If the similarity threshold is less than or equal to the similarity threshold, the target image is discarded from the time sequence trajectory to obtain an updated first trajectory, and the step of sequentially selecting the trajectory image from the time sequence trajectory as the first target image in time sequence is returned to execute, that is, step S201 is returned to execute. After the trajectory images in the time sequence trajectory are executed as the first target image after the subsequent steps, the process ends, and the final updated first trajectory is obtained.
[0049] S204: If the target similarity is greater than the similarity threshold, the first target image is added to the sliding window as a second target image, and the step of sequentially selecting the trajectory image from the time sequence trajectory as the first target image in time sequence is returned to execute.
[0050] It can be understood that when the target similarity of the first target image and the second target image is greater than the similarity threshold, it means that the first target image and the second target image meet the trajectory consistency requirement, and therefore the first target image is added to the sliding window as the second target image. In this way, the second target image in the sliding window will be more and more, and the second target image to be calculated will be more and more when calculating the target similarity of the first target image and the second target image in the sliding window. After the trajectory images in the time sequence trajectory are executed as the first target image after the subsequent steps, the process ends, and the final updated first trajectory is obtained.
[0051] S205: If the target similarity is less than or equal to the similarity threshold, the first target image is discarded from the time sequence trajectory to obtain an updated first trajectory, and the step of sequentially selecting the trajectory image from the time sequence trajectory as the first target image in time sequence is returned to execute.
[0052] It can be understood that when the target similarity of the first target image and the second target image is less than or equal to the similarity threshold, it means that the first target image and the second target image do not meet the trajectory consistency requirement, and therefore the target image is discarded from the time sequence trajectory to obtain an updated first trajectory. In this way, all trajectory images that do not meet the trajectory consistency requirement in the time sequence trajectory are removed to obtain the final updated first trajectory.
[0053] S206: Input each frame of trajectory image in the first trajectory into the human body age classification model to obtain the age classification result of the detected target in each frame of trajectory image and the corresponding prediction confidence.
[0054] It can be understood that, in the embodiment, by discarding the first target image in the time sequence track that does not meet the track consistency requirement, the track image with low quality in the time sequence track can be removed, and the updated first track is obtained, so as to enhance the track consistency of the track image in the first track, improve the quality of the track image in the first track, and effectively improve the age recognition accuracy when the age recognition is performed on the track image in the first track.
[0055] It should be noted that, in the embodiment, the first target image discarded from the time sequence track will not participate in the subsequent age recognition step, that is, the discarded first target image does not need to be subjected to age recognition, and only the track image in the updated first track is subjected to age recognition.
[0056] In one embodiment, as shown in Figure 3 the step S202 in the above embodiment can be implemented by the following steps: S301: Extracting the image feature vector of the first target image and the average feature vector of all the second target images in the sliding window.
[0057] S302: Calculating the target similarity based on the image feature vector and the average feature vector.
[0058] In a specific implementation, in the embodiment, the image feature vector of the first target image and the average feature vector of all the second target images in the sliding window can be extracted by using any one or more of feature vector extraction methods such as a convolutional neural network (CNN), an autoencoder (Autoencoder), a color histogram, and a gray level co-occurrence matrix (GLCM), and the embodiment is not limited in this regard. Specifically, in the embodiment, the first feature vector (i.e., the image feature vector) of the first target image can be extracted first, then the second feature vector of the second target image is extracted, and the average feature vector of the second feature vector is calculated, and then the target similarity is calculated based on the image feature vector and the average feature vector.
[0059] Further, in the embodiment, the length of the sliding window is the first number, and before the step S204, the embodiment further includes the following steps, as shown in Figure 4 . S401: Determining whether the number of the second target images in the sliding window reaches the first number.
[0060] S402: If the number of the second target images reaches the first number, removing the second target image that is added first from the sliding window.
[0061] Specifically, the first quantity in this embodiment can be set according to actual needs, for example, the first quantity can be 8 frames, 10 frames, or 12 frames, etc. The first quantity is not limited in this embodiment. If the quantity of the second target images does not reach the first quantity, it means that the sliding window is not full, and the second target images can continue to be added. If the quantity of the second target images reaches the first quantity, it means that the sliding window is full, and the second target images cannot continue to be added. Therefore, if it is desired to continue to add the second target images to the sliding window, the first added second target image needs to be removed from the sliding window. In this way, a frame of image position can be emptied in the sliding window to add a new second target image to the sliding window. In this way, the quantity of the second target images in the sliding window can be kept at the first quantity, and the second target images in the sliding window can be continuously updated, which can effectively ensure the continuity in time of the first target image selected from the time sequence track and the second target image in the sliding window, and at the same time, the quantity of the second target images in the sliding window can be limited, which is beneficial to reducing the calculation amount of the target similarity of the first target image and the second target image, and is beneficial to improving the accuracy of age recognition.
[0062] In one embodiment, after step S205, the embodiment further includes the following steps, as shown in Figure 5 S501: Record the discard quantity of the continuously discarded first target images.
[0063] S502: Determine whether the discard quantity is greater than a preset second threshold.
[0064] S503: If the discard quantity is greater than the second threshold, empty the sliding window and discard the time sequence track.
[0065] That is, when a frame of first target image is discarded, the discard quantity is recorded as 1, and it is determined whether the discard quantity is greater than the second threshold. If the discard quantity is less than or equal to the second threshold, the discard quantity is recorded as 2 when the next frame of first target image is discarded, and it is continuously determined whether the discard quantity is greater than the second threshold. In this way, when the discard quantity is greater than the second threshold, the sliding window is emptied and the time sequence track is discarded. It should be noted that if the discard quantity is greater than the second threshold before the discard quantity is greater than the second threshold, the discard quantity is recorded as 0, and the discard quantity of the continuously discarded first target images is recorded again when the next first target image is discarded. It can be understood that when the discard quantity is greater than the second threshold, the track consistency of the track images in the time sequence track is poor, and the time sequence track can be discarded. The age of the next detected target in the time sequence track is identified. In this way, over-processing of the current time sequence track can be avoided, and a training sample with low image quality can be generated.
[0066] In one embodiment, as Figure 6 As shown, step S206 in the above embodiment can be implemented by the following steps: S601: Cluster the trajectory images in the time sequence trajectory into two image data clusters.
[0067] It can be understood that when the trajectory images in the time sequence trajectory are clustered into two image data clusters, if there are some trajectory images in the time sequence trajectory that are obviously different from other trajectory images, the trajectory images that are obviously different from other trajectory images in the time sequence trajectory can be clustered into two image data clusters. The trajectory images that are obviously different can be images in which the human body is largely occluded, images in which the human body is not fully displayed, or images in which blurring is more serious, and the like, which are not limited in the embodiment.
[0068] In a specific implementation, the image feature vectors of each frame of trajectory images in the time sequence trajectory can be extracted in the embodiment, and then the clustering of the trajectory images is implemented by clustering the image feature vectors, to obtain two image data clusters. The clustering algorithm used for clustering the image feature vectors includes, but is not limited to, any one of K-Means algorithm, K-Medoids algorithm, DBSCAN, and the like, which are not limited in the embodiment.
[0069] For example, taking the clustering of the trajectory images in the time sequence trajectory into two image data clusters by using the K-Means algorithm as an example, the K value of the algorithm can be set to 2 in the embodiment, and then the trajectory images in the time sequence trajectory are clustered into two image data clusters based on the K-Means algorithm.
[0070] S602: Update the image data cluster with the largest number of images as the second trajectory.
[0071] It can be understood that when the extracted time sequence trajectory has high quality, if the time sequence trajectory is obtained by using a target detection model and a multi-target tracking algorithm with high precision, the trajectory images that are obviously different should account for a smaller part of the time sequence trajectory.
[0072] In one embodiment, after the trajectory images in the time sequence trajectory are clustered into two image data clusters by using the clustering algorithm in the embodiment, the image data cluster with the largest number of images can be updated as the second trajectory, and the image data cluster with a smaller number of images is discarded.
[0073] In another embodiment, after the trajectory images in the time sequence trajectory are clustered into two image data clusters by the clustering algorithm in this embodiment, the center point of each image data cluster can be obtained respectively, and then the average distance of the trajectory images in each cluster to the center point is calculated respectively, the image data cluster with smaller average distance is selected and updated as the second trajectory, while the image data cluster with larger average distance is discarded, or the variance of the trajectory images in each cluster to the center point is calculated respectively, the image data cluster with smaller variance is selected and updated as the second trajectory, while the image data cluster with larger variance is discarded.
[0074] S603: Filtering the same trajectory images from the first trajectory and the second trajectory as the target trajectory.
[0075] It can be understood that the first trajectory and the second trajectory in this embodiment are obtained by different methods, so that the trajectory images contained in the first trajectory and the second trajectory are different. Therefore, in order to further filter the trajectory images, the intersection of the trajectory images in the first trajectory and the second trajectory can be taken as the target trajectory in this embodiment, that is, the same trajectory images are filtered from the first trajectory and the second trajectory as the target trajectory, thereby further improving the quality of the trajectory images in the target trajectory after filtering and ensuring the trajectory consistency of the trajectory images in the target trajectory.
[0076] S604: Inputting each frame of trajectory image in the target trajectory into the human age classification model to obtain the age classification result of the detected target in each frame of trajectory image and the corresponding prediction confidence.
[0077] It can be understood that the intersection of the first trajectory and the second trajectory updated by two methods in this embodiment obtains the target trajectory, which not only realizes the complementary advantages of the two methods and further improves the quality of the trajectory images in the target trajectory, but also significantly improves the identity consistency of the detected target in the target trajectory, solves the problem of high mislabeling rate caused by mixed identities of the detected target in the training image in the prior art, and the trajectory purity rate can reach more than 99%. When the trajectory images in the target trajectory are subsequently identified by age, the accuracy of age identification can be improved.
[0078] It should be noted that the image data cluster with fewer discarded images in this embodiment will no longer participate in the subsequent age identification step, and the trajectory images in the discarded image data cluster do not need to be identified by age again, and only the trajectory images in the target trajectory need to be identified by age.
[0079] In one embodiment, as shown in Figure 7 the step S101 in the above embodiment can be implemented by the following steps: S701: performing target detection on each frame of video frame image respectively to obtain the target detection box corresponding to each detected target in the video frame image.
[0080] It can be understood that there can be no detection target, one detection target or multiple detection targets in each frame of video frame image, so when the target detection is performed on the video frame image, if there is no detection target in the video frame image, the target detection frame cannot be obtained, and if there are multiple detection targets in the video frame image, the target detection frame corresponding to each detection target can be obtained.
[0081] Specifically, in the embodiment, the target detection of the video frame image can be implemented by any one of the R-CNN series detection model and the YOLO series detection model to obtain the target detection frame corresponding to each detection target in the video frame image, and the target detection model for implementing the target detection is not limited in the embodiment.
[0082] S702: Based on the target detection frame, multi-target tracking is performed on each detection target to obtain the target identifier and time sequence information corresponding to each target detection frame.
[0083] It can be understood that when the target detection frame corresponding to the same detection target appears in the continuous multiple frames of video frame images, the multi-target tracking based on the target detection frame can obtain the target detection frame of the detection target in the continuous multiple frames of video frame images, and the time sequence identifier is labeled on the target detection frame.
[0084] In a specific implementation, in the embodiment, any one of the BoT-SORT algorithm, the DeepSORT algorithm and the like can be used to implement the multi-target tracking on each detection target to obtain the target identifier and time sequence information corresponding to each target detection frame, and the specific algorithm for implementing the multi-target tracking is not limited in the embodiment.
[0085] S703: Based on the target identifier and the time sequence information, a time sequence track corresponding to the monitoring target is obtained from the video frame image.
[0086] In a specific implementation, in the embodiment, the target detection frame corresponding to the detection target can be determined based on the target identifier, then the corresponding track image is intercepted from the video frame image based on the target detection frame corresponding to the detection target, and then the track image is sorted in time sequence based on the time sequence information to obtain the time sequence track.
[0087] In summary, in the embodiment, the time sequence track is generated by the target detection algorithm and the multi-target tracking algorithm, which can significantly improve the generation efficiency of the time sequence track and improve the integrity and continuity of the track compared with the manual annotation for generating the time sequence track.
[0088] In one embodiment, as shown in Figure 8 The confidence threshold in the above embodiment can be obtained by the following steps: S801: Obtain a test set, and the test set includes test images.
[0089] In specific implementation, the test set obtained in the embodiment can be one or more, and each test set can include one or more test trajectories. The test trajectory can be a time sequence trajectory obtained through manual annotation, or can be a test trajectory extracted from video data based on a target detection algorithm and a multi-target tracking algorithm.
[0090] S802: input the test image into the human age classification model to obtain a test age result of the test target in each frame of the test image and a corresponding test confidence.
[0091] In the test set, the test images can have the same age label, or the test images can have different age labels.
[0092] In specific implementation, when the test set includes test images with the same age label, the test image is input into the human age classification model to obtain a test age result of the test target in each frame of the test image and a corresponding test confidence. Then, the accuracy of the test age result is determined from the test confidence, and the target confidence when the target accuracy reaches a preset target accuracy. When the test set includes test images with different age labels, the test image is input into the human age classification model to obtain a test age result of the test target in each frame of the test image and a corresponding test confidence. Then, the test age result is classified according to the category of the age label to obtain a test age result corresponding to each category of age label and a test confidence. For the test age result corresponding to each category of age label and the test confidence, the accuracy of the test age result is determined from the test confidence, and the target confidence when the target accuracy reaches a preset target accuracy.
[0093] S803: determine the accuracy of the test age result from the test confidence, and the target confidence when the target accuracy reaches a preset target accuracy.
[0094] The accuracy of the test age result refers to the percentage of correct results in the test age result.
[0095] In specific implementation, the target accuracy in the embodiment can be set according to actual requirements. For example, the target accuracy can be any one of 90%, 95%, or 99%, and the embodiment is not limited in this regard. The test age result with a test confidence greater than or equal to the target confidence is selected from the test age result, and the accuracy of the selected test age result needs to reach the target accuracy.
[0096] For example, taking the target accuracy rate as 90%, and taking 10 frames of test images with the same age label in the test set as an example, the test age results of the 10 frames of test images output by the human body age classification model only have one test age result error, and the test confidence of the test age result is 0.9, 0.92, 0.8, 0.84, 0.88, 0.95, 0.98, 0.85, 0.88, 0.93 respectively. At this time, 0.8 is selected as the target confidence, so that the target accuracy rate of the human body age classification model is 90%. That is, when the target confidence is 0.8, the number of test age results greater than or equal to the target confidence is 10, and there is one error test age result. Therefore, the condition of the target accuracy rate being 90% is met, and thus it can be determined that the target confidence in the test set is 0.8.
[0097] For example, taking the target accuracy rate as 80%, and taking 10 frames of test images with the same age label in the test set as an example, the test age results of the 10 frames of test images output by the human body age classification model, and the test confidence corresponding to the test age result is 0.9, 0.92, 0.8, 0.84, 0.88, 0.95, 0.98, 0.85, 0.88, 0.93. Among them, the test age results corresponding to the test confidence 0.8, 0.84 and 0.92 are wrong. 0.9 is selected as the target confidence. At this time, the test confidence greater than or equal to 0.9 is 0.9, 0.92, 0.93, 0.95, 0.98. Among them, it is known that the test age result corresponding to 0.92 is wrong. At this time, the accuracy of the test age result corresponding to the five test confidences selected based on the target confidence of 0.9 reaches 80%, and thus it can be determined that the target confidence is 0.9.
[0098] S804: Calculate the average confidence of all target confidences, and take the average confidence as the confidence threshold.
[0099] It should be understood that when there are multiple test sets, there should be multiple corresponding target confidences. Therefore, the average confidence of the target confidences is calculated as the confidence threshold. If there is only one test set, the target confidence is taken as the confidence threshold.
[0100] In summary, in the embodiment, the target confidences on multiple test sets can provide more reliable decision basis for the actual application of the model by combining the advantages of statistical stability, risk control, business adaptability and the like, and is conducive to improving the accuracy of the finally determined age label.
[0101] In one embodiment, as shown in FIG. 1 1, Figure 9 The embodiment can further include the following steps after step S104: S901: Label the target result as the age label of each frame trajectory image to obtain a training sample set.
[0102] That is, in this embodiment, the target result is labeled as the age label of each frame trajectory image, and the trajectory images corresponding to multiple different detection targets and the corresponding age labels jointly constitute the training sample set. The number of detection targets that can be included in the training image and the number of trajectory images corresponding to the detection targets are not limited in this embodiment. For the process of obtaining the trajectory image and the corresponding age label, please refer to the above embodiment, which will not be described here.
[0103] S902: Input the training sample set into the human age classification model to obtain the age classification result corresponding to each trajectory image.
[0104] S903: Calculate the classification loss value of the human age classification model based on the age label and the age classification result.
[0105] In a specific implementation, in this embodiment, the age label and the age classification result can be input into a classification loss function to obtain the classification loss value of the human age classification model. The classification loss function in this embodiment includes but is not limited to any one of cross-entropy loss function (Cross-Entropy Loss), mean squared error loss (Mean Squared Error, MSE), etc.
[0106] S904: When the classification loss value meets the preset training end condition, it is determined that the human age classification model is fully trained.
[0107] It can be understood that the human age classification model in this embodiment can be an untrained model or a model trained based on a small amount of training samples. After the target result is labeled as the age label of each frame trajectory image, the trajectory images with the same age label are obtained, and the estimation images labeled with the age label in the multiple time sequence trajectory labels jointly constitute the training sample set. The training sample set is input into the human age classification model for training to improve the age classification accuracy of the human age classification model, and then the trained human age classification model is used to perform the age classification task.
[0108] In one embodiment, the training end condition in this embodiment can be that when the classification loss value converges, it is determined that the human age classification model is fully trained. If the classification loss value converges, it is determined that the human age classification model is fully trained. If the classification loss value does not converge, return to step S902, that is, return to the step of inputting the training image into the human age classification model to obtain the age classification result corresponding to each trajectory image, to iteratively train the human age classification model until the classification loss value converges and it is determined that the human age classification model is fully trained.
[0109] In another embodiment, the training termination condition in this embodiment can be: when the classification loss value is less than a preset loss value threshold, it is determined that the human age classification model has been sufficiently trained; if the classification loss value is less than the loss value threshold, it is determined that the human age classification model has been sufficiently trained; if the classification loss value is greater than or equal to the loss value threshold, then return to step S902, that is, return to the step of inputting the training image into the human age classification model to obtain the age classification result corresponding to each trajectory image, so as to iteratively train the human age classification model until the classification loss value is less than the loss value threshold, and it is determined that the human age classification model has been sufficiently trained.
[0110] It should be noted that the above-mentioned training termination condition is only a partial implementation method in this embodiment. The training termination condition in this embodiment may also include: determining whether the cumulative number of training iterations of the human age classification model has reached a preset threshold; if the number of training iterations reaches the threshold, it is determined that the human age classification model has been sufficiently trained; if the number of training iterations has not reached the threshold, the process returns to step S902, that is, returning to the step of inputting the training sample set into the human age classification model to obtain the age classification result corresponding to each trajectory image, to iteratively train the human age classification model until the number of training iterations reaches the threshold, thus determining that the human age classification model has been sufficiently trained. Therefore, this embodiment does not limit the training termination condition.
[0111] In summary, the human age classification model training method disclosed in this embodiment, based on the training sample set obtained by labeling trajectory images of classification results disclosed in the above embodiment, can effectively improve the classification accuracy and generalization of the human age classification model.
[0112] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0113] In one embodiment, an age recognition device is provided, which corresponds one-to-one with the age recognition methods described in the above embodiments. For example... Figure 10 As shown, the age recognition device includes a trajectory generation module, an age prediction module, a result judgment module, and an age recognition module. Detailed descriptions of each functional module are as follows: The trajectory generation module 1001 is used to extract the temporal trajectory corresponding to each detected target from the video frame images of the video data. The temporal trajectory includes trajectory images of the detected targets arranged in chronological order. The age prediction module 1002 is configured to input each frame of trajectory image in the time sequence trajectory into the human age classification model respectively to obtain an age classification result of the detected target in each frame of trajectory image and a corresponding prediction confidence; The result judgment module 1003 is configured to determine a result quantity of the target result whose prediction confidence is greater than a preset confidence threshold from the age classification result, and judge whether the result quantity is greater than a preset first threshold; The age recognition module 1004 is configured to take the target result as the age recognition result of the detected target when the result quantity is greater than the first threshold.
[0114] In summary, the age recognition device is disclosed, which extracts a time sequence trajectory corresponding to each detected target from a video frame image of video data, the time sequence trajectory including trajectory images of the detected target sorted in time sequence; inputs each frame of trajectory image in the time sequence trajectory into the human age classification model respectively to obtain an age classification result of the detected target in each frame of trajectory image and a corresponding prediction confidence; determines a result quantity of the target result whose prediction confidence is greater than a preset confidence threshold from the age classification result, and judges whether the result quantity is greater than a preset first threshold; and takes the target result as the age recognition result of the detected target when the result quantity is greater than the first threshold. It can be seen that the age classification of the trajectory image in the time sequence trajectory is performed by the human age classification model to obtain the age classification result of the detected target in each frame of trajectory image and the corresponding prediction confidence, then the target result whose prediction confidence is greater than the confidence threshold is screened from the age classification result to realize high-confidence aggregation of the age classification result, and whether the result quantity of the target result is greater than the preset first threshold is determined to evaluate the trajectory consistency of the trajectory image in the time sequence trajectory, and the target result is taken as the age recognition result of the detected target when the result quantity of the target result is greater than the first threshold. Compared with the age recognition method based on a single frame of image in the prior art, the influence of the low-quality trajectory image in the time sequence trajectory on the recognition accuracy of the human age classification model is reduced, and the purpose of improving the accuracy of the age recognition result is achieved.
[0115] In one embodiment, the age prediction module 1002 can be configured to: select the trajectory image from the time sequence trajectory as the first target image in time sequence; calculate a target similarity between the first target image and the second target image in the sliding window; judge whether the target similarity is greater than a preset similarity threshold; if the target similarity is greater than the similarity threshold, add the first target image into the sliding window as the second target image, and return to execute the step of selecting the trajectory image from the time sequence trajectory as the first target image in time sequence; If the target similarity is less than or equal to the similarity threshold, discarding the first target image from the time sequence track, obtaining an updated first track, and returning to perform the step of sequentially selecting a track image from the time sequence track as the first target image according to time sequence; Inputting each track image in the first track into the human age classification model to obtain an age classification result of the detected target in each track image and a corresponding prediction confidence.
[0116] In an embodiment, the age prediction module 1002 can be configured to: extract an image feature vector of the first target image and an average feature vector of all the second target images in the sliding window; based on the image feature vector and the average feature vector, calculate the target similarity.
[0117] In an embodiment, the length of the sliding window is a first quantity, and the age prediction module 1102 can be configured to: Before adding the first target image into the sliding window as a second target image, further comprising: determining whether the number of the second target images in the sliding window reaches the first quantity; if the number of the second target images reaches the first quantity, removing the first added second target image from the sliding window.
[0118] In an embodiment, the age prediction module 1002 can be further configured to: record a discard quantity of consecutively discarded first target images; determine whether the discard quantity is greater than a preset second threshold; if the discard quantity is greater than the second threshold, empty the sliding window and discard the time sequence track.
[0119] In an embodiment, the age prediction module 1002 can be configured to: cluster the track images in the time sequence track into two image data clusters; update the image data cluster with the largest number of images as a second track; select the same track images from the first track and the second track as a target track; input each track image in the target track into the human age classification model to obtain an age classification result of the detected target in each track image and a corresponding prediction confidence.
[0120] In an embodiment, the track generation module 1001 is configured to: perform target detection on each video frame image to obtain a target detection frame corresponding to each detected target in the video frame image; Based on the target detection frame, multi-target tracking is performed on each detection target to obtain target identification and time sequence information corresponding to each target detection frame; Based on the target identification and time sequence information, a time sequence track corresponding to the detection target is obtained from the video frame image.
[0121] In one embodiment, the confidence threshold is obtained by: Obtain a test set, including test images in the test set; Input the test image into the human age classification model to obtain the test age result of the test target in each test image and the corresponding test confidence; From the test confidence, determine the accuracy of the test age result, and the target confidence when the preset target accuracy is reached; Calculate the average confidence of all target confidences, and take the average confidence as the confidence threshold.
[0122] In one embodiment, the model training model is also included, which is used to: Label the target result as the age label of each track image to obtain a training sample set; Input the training sample set into the human age classification model to obtain the age classification result corresponding to each track image; Based on the age label and the age classification result, the classification loss value of the human age classification model is calculated; When the classification loss value meets the preset training end condition, it is determined that the human age classification model is fully trained.
[0123] The specific limitations of the age recognition device can be referred to the limitations of the age recognition method in the above, which will not be repeated here. Each module in the above age recognition device can be realized by software, hardware and their combination. The above modules can be embedded in or independent of the processor in the computer device in hardware form, or can be stored in the memory in the computer device in software form, so that the processor can call and execute the operations corresponding to the above modules.
[0124] In an embodiment, as shown in Figure 11 , a computer device is provided, including a memory, a processor and a computer program stored in the memory and executable on the processor, and the processor executes the computer program to implement the age recognition method in the above embodiments, such as Figure 1 The age recognition method shown in Figures 2 to 9 , to avoid repetition, which will not be repeated here. Alternatively, the processor executes the computer program to implement the functions of each module / unit in the age recognition device embodiment, such as Figure 10 The functions of the age recognition device shown in , to avoid repetition, which will not be repeated here.
[0125] In an embodiment, a computer readable storage medium is provided, and the computer readable storage medium stores a computer program. The computer program is executed by a processor to implement the age identification method in the above embodiments, for example Figure 1 the age identification method shown in the above embodiments, or Figures 2 to 9 the age identification method shown in the above embodiments, or Figure 10 the age identification method shown in the above embodiments, or
[0126] Those skilled in the art can understand that all or part of the processes in the above embodiments can be completed by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer readable storage medium. When the computer program is executed, the processes of the above embodiments can be included. Any reference to memory, storage, database or other medium in the embodiments provided by the present application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration but not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct RAM bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0127] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the division of the above functional units and modules is exemplified. In actual applications, the above functions can be completed by different functional units and modules according to needs, that is, the internal structure of the device is divided into different functional units or modules to complete all or part of the above described functions.
[0128] The above-described embodiments are only used to illustrate the technical solutions of the present application, and are not intended to limit the present application; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: it can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement for part of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application.
Claims
1. An age recognition method characterized by, The method comprises the following steps: extracting a time sequence track corresponding to each detection target from a video frame image of video data, the time sequence track comprising trajectory images of the detection target in time sequence order; inputting each trajectory image in the time sequence track into a human age classification model respectively to obtain an age classification result of the detection target in each trajectory image and a corresponding prediction confidence; determining a result number of target results with a prediction confidence greater than a preset confidence threshold from the age classification result, and judging whether the result number is greater than a preset first threshold; if the result number is greater than the first threshold, taking the target result as an age recognition result of the detection target.
2. The age identification method of claim 1, wherein, inputting each trajectory image into a human age classification model respectively to obtain an age classification result of the detection target in each trajectory image and a corresponding prediction confidence, comprising: selecting the trajectory images from the time sequence track in turn as first target images according to the time sequence order; calculating a target similarity of the first target image and a second target image in a sliding window; judging whether the target similarity is greater than a preset similarity threshold; if the target similarity is greater than the similarity threshold, adding the first target image into the sliding window as the second target image, and returning to execute the step of selecting the trajectory images from the time sequence track in turn as first target images according to the time sequence order; if the target similarity is less than or equal to the similarity threshold, discarding the first target image from the time sequence track to obtain an updated first track, and returning to execute the step of selecting the trajectory images from the time sequence track in turn as first target images according to the time sequence order; inputting each trajectory image in the first track into a human age classification model to obtain an age classification result of the detection target in each trajectory image and a corresponding prediction confidence.
3. The age identification method of claim 2, wherein, calculating a target similarity of the first target image and a second target image in a sliding window, comprising: extracting an image feature vector of the first target image and an average feature vector of all the second target images in the sliding window; calculating the target similarity based on the image feature vector and the average feature vector.
4. The age identification method of claim 2, wherein, the length of the sliding window is a first number: before the first target image is added into the sliding window as the second target image, further comprising: judging whether the number of the second target images in the sliding window reaches the first number; if the number of the second target images reaches the first number, removing the second target image added first from the sliding window.
5. The age identification method of claim 2, wherein, after the first target image is discarded from the time sequence track to obtain an updated first track, further comprising: recording a discard number of the first target image discarded in succession; judging whether the discard number is greater than a preset second threshold; if the discard number is greater than the second threshold, emptying the sliding window and discarding the time sequence track.
6. The age identification method of claim 2, wherein, inputting each frame of the track image in the first track into a human age classification model to obtain an age classification result of the detected target in each frame of the track image and a corresponding prediction confidence, including: clustering the track images in the time sequence track into two image data clusters; updating the image data cluster with the largest number of images as a second track; filtering out the same track image from the first track and the second track as a target track; inputting each frame of the track image in the target track into a human age classification model to obtain an age classification result of the detected target in each frame of the track image and a corresponding prediction confidence.
7. The age identification method of claim 1, wherein, extracting a time sequence track corresponding to each detected target from a video frame image of video data, including: performing target detection on each frame of the video frame image respectively to obtain a target detection box corresponding to each detected target in the video frame image; performing multi-target tracking on each detected target based on the target detection box to obtain a target identifier and time sequence information corresponding to each target detection box; obtaining the time sequence track corresponding to the detected target from the video frame image based on the target identifier and the time sequence information.
8. The age identification method of claim 1, wherein, The confidence threshold is obtained by the following method: obtaining a test set, the test set including test images; inputting the test image into the human age classification model to obtain a test age result of a test target in each frame of the test image and a corresponding test confidence; determining the accuracy of the test age result from the test confidence, and determining a target confidence when the accuracy reaches a preset target accuracy; calculating an average confidence of all the target confidences, and taking the average confidence as the confidence threshold.
9. The age identification method according to any one of claims 1 to 8, wherein, After taking the target result as the age recognition result of the detected target, further including: labeling the target result as an age label of each frame of the track image to obtain a training sample set; inputting the training sample set into the human age classification model to obtain an age classification result corresponding to each track image; calculating a classification loss value of the human age classification model based on the age label and the age classification result; determining that the human age classification model is sufficiently trained when the classification loss value meets a preset training end condition.
10. An age identification device, characterized by, including: a track generation module configured to extract a time sequence track corresponding to each detected target from a video frame image of video data, the time sequence track including track images of the detected target sorted in time sequence; an age prediction module configured to input each frame of the track image in the time sequence track into a human age classification model to obtain an age classification result of the detected target in each frame of the track image and a corresponding prediction confidence; a result judgment module configured to determine a result number of target results with a prediction confidence greater than a preset confidence threshold from the age classification result, and judge whether the result number is greater than a preset first threshold; an age recognition module configured to take the target result as an age recognition result of the detected target when the result number is greater than the first threshold.
11. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, The computer program is executed by the processor to implement the age identification method in any one of claims 1 to 9.
12. A computer-readable storage medium, the computer-readable storage medium storing a computer program, characterized in that, The computer program is executed by the processor to implement the age identification method in any one of claims 1 to 9.
