Age classification method, overload detection method, device, equipment and storage medium
By seizing the whole-body and half-body images from the detected images and inputting them into the corresponding age classification model for fusion, the problem of low age classification accuracy in traditional monitoring systems in complex environments is solved, and more accurate age classification results are achieved.
Patent Information
- Application Number
- CN202411984263.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-27
- Publication Date
- 2025-05-13
AI Technical Summary
In complex environments such as public transportation, traditional monitoring systems have low accuracy in age classification results output by age classification models due to the high dynamics and uncertainties of video images.
By seizing the full-body image and half-body image from the detected image, the full-body image is input into the full-body age classification model, the half-body image is input into the half-body age classification model, and the results of the two models are fused to obtain the final target age classification result.
It realizes that the detection images taken in highly dynamic and uncertain environments can be obtained, and the age classification accuracy is improved.
Smart Images

Figure CN119992163A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of deep learning technology, and in particular to an age classification method, an overload detection method, an apparatus, a computer device and a storage medium. Background Art
[0002] With the continuous advancement of artificial intelligence technology, vision-based age classification technology is gradually being widely used in many fields, such as public safety and traffic monitoring. This technology can accurately judge the age of people by analyzing and interpreting key information in video images, providing strong support for various application scenarios. For example, in the field of public transportation, by obtaining images of drivers driving electric vehicles carrying passengers, the age of drivers and passengers can be classified. If both the driver and the passenger are adults, the electric vehicle is determined to be overloaded. If the driver is an adult and the passenger is a child, the electric vehicle is determined to be not overloaded.
[0003] However, in a complex environment such as public transportation, although traditional monitoring systems can provide real-time video images, since video images are often accompanied by a high degree of dynamics and uncertainty, there are great limitations in the recognition of personal identities and the distinction of ages, resulting in low accuracy of the age classification results output by the age classification model. Summary of the invention
[0004] Embodiments of the present invention provide an age classification method, an overload detection method, an apparatus, a computer device, and a storage medium to solve the problem of low accuracy of age classification results output by an age classification model.
[0005] An age classification method, comprising: Acquire detection images; Extracting a full-body image and a half-body image of the detection target from the detection image; Inputting the full-body image into a full-body age classification model to obtain a full-body age classification result, and inputting the half-body image into a half-body age classification model to obtain a half-body age classification result; The whole-body age classification result and the half-body age classification result are fused to obtain a target age classification result.
[0006] In the above method, optionally, the half-body age classification model includes a feature calibration module, and the feature calibration module is obtained by replacing the fully connected layer in the SE module with a convolutional layer.
[0007] In the above method, optionally, the step of extracting a full-body image and a half-body image of the detection target from the detection image includes: Preprocessing the detection image to obtain a standard image; Inputting the standard image into a target detection model to obtain a predicted detection frame of the detection target; Cutting out the full-body image from the standard image according to the predicted detection frame; The half-body image is captured from the full-body image according to a preset capture range.
[0008] In the above method, optionally, the whole body age classification model and the half body age classification model are trained in the following manner: Acquire a first age classification model and a second age classification model obtained by pre-training, wherein the first age classification model is obtained by training based on a half-body training image annotated with a half-body hard label, and the second age classification model is obtained by training based on a full-body training image annotated with a full-body hard label; Inputting the half-body training image into the first age classification model to obtain a half-body soft label of the half-body training image, and inputting the full-body training image into the second age classification model to obtain a full-body soft label of the full-body training image; Inputting the half-body training image marked with the half-body soft label into the half-body age classification model for training to obtain the trained half-body age classification model, and inputting the full-body training image marked with the full-body soft label into the full-body age classification model for training to obtain the trained full-body age classification model; Among them, the scale of the first age classification model is larger than that of the half-body age classification model, and the scale of the second age classification model is larger than that of the whole-body age classification model.
[0009] An overload detection method based on age classification, the method comprising: Acquire the image of the person in the battery vehicle; Extracting a driver's half-body image, a driver's full-body image, a passenger's half-body image, and a passenger's full-body image from the battery vehicle's passenger image; Inputting the driver's full-body image and the passenger's full-body image into a full-body age classification model to obtain a driver's full-body age classification result and a passenger's full-body age classification result, and inputting the passenger's half-body image and the driver's half-body image into a half-body age classification model to obtain a driver's half-body age classification result and a passenger's half-body age classification result; The passenger half-body age classification result and the passenger full-body age classification result are merged to obtain a passenger age classification result, and the driver half-body age classification result and the driver full-body age classification result are merged to obtain a driver age classification result; Whether the electric vehicle is overloaded is determined based on the driver age classification result and the passenger age classification result.
[0010] In the above method, optionally, judging whether the battery vehicle is overloaded according to the driver age classification result and the passenger age classification result includes: If the driver age classification result indicates that the driver belongs to the first group of people, and the passenger age classification result indicates that the passenger belongs to the first group of people, then it is determined that the battery vehicle is overloaded; If the driver age classification result indicates that the driver belongs to the first group of people, and the passenger age classification result indicates that the passenger belongs to the second group of people, it is determined that the electric vehicle is not overloaded.
[0011] An age classification device, comprising: A first image acquisition module, used to acquire a detection image; A first image capture module, used to capture a full-body image and a half-body image of the detection target from the detection image; A first age classification module, configured to input the full-body image into a full-body age classification model to obtain a full-body age classification result, and input the half-body image into a half-body age classification model to obtain a half-body age classification result; The first result fusion module is used to fuse the whole body age classification result and the whole body age classification result to obtain a target age classification result.
[0012] The above device, optionally, The half-body age classification model includes a feature calibration module, which is obtained by replacing the fully connected layer in the SE module with a convolutional layer.
[0013] A computer device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements any of the above-mentioned age classification methods when executing the computer program.
[0014] A computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements any of the age classification methods described above.
[0015] The above-mentioned age classification method, overload detection method, device, computer equipment and storage medium extract the full-body image and half-body image of the detection target from the detection image, then input the full-body image into the full-body age classification model to obtain the full-body age classification result, and input the half-body image into the half-body age classification model to obtain the half-body age classification result, and fuse the full-body age classification result and the half-body age classification result to obtain the target age classification result. It can be seen that the present invention fuses the full-body age classification result output by the full-body age classification model and the half-body age classification result output by the half-body age classification model through a joint reasoning strategy to obtain the final target age classification result, thereby realizing diversified model input and output, and can obtain more accurate age classification results based on the detection images taken in a highly dynamic and uncertain environment, thereby achieving the purpose of improving the accuracy of age classification. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.
[0017] Figure 1 This is a flow chart for implementing an age classification method disclosed in an embodiment of the present invention; Figure 2 It is a partial implementation flow chart of an age classification method disclosed in one embodiment of the present invention; Figure 3 This is a flow chart for implementing an age classification method disclosed in an embodiment of the present invention; Figure 4 It is a flow chart for implementing an overload detection method based on age classification disclosed in an embodiment of the present invention; Figure 5 is a schematic diagram of the structure of an age classification device in one embodiment of the present invention; Figure 6 It is a structural schematic diagram of a computer device in one embodiment of the present invention. DETAILED DESCRIPTION
[0018] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0019] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of 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 combinations thereof.
[0020] It should also be understood that the term "and / or" used in the present description and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
[0021] As used in the present specification and the appended claims, the term "if" may be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" may be interpreted as meaning "upon determination" or "in response to determining" or "upon detection of [described condition or event]" or "in response to detecting [described condition or event]", depending on the context.
[0022] In addition, in the description of the present specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0023] References to "one embodiment" or "some embodiments" etc. described in the present specification mean that one or more embodiments of the present invention include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the phrases "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. appearing in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0024] The present invention discloses an age classification method, an overload detection method, an apparatus, a computer device and a storage medium, which extracts a full-body image and a half-body image of a detection target from a detection image, and then inputs the full-body image into a full-body age classification model to obtain a full-body age classification result, and inputs the half-body image into a half-body age classification model to obtain a half-body age classification result, and fuses the full-body age classification result and the half-body age classification result to obtain a target age classification result. It can be seen that the present invention fuses the full-body age classification result output by the full-body age classification model and the half-body age classification result output by the half-body age classification model through a joint reasoning strategy to obtain the final target age classification result, thereby achieving diversified model input and output, and can obtain more accurate age classification results based on detection images captured in a highly dynamic and uncertain environment, thereby achieving the purpose of improving age classification accuracy. This will be described below through specific embodiments.
[0025] In one embodiment, Figure 1 FIG. 1 is a flowchart of an implementation method of an age classification method disclosed in this embodiment. The method is applicable to electronic devices with image processing capabilities, such as mobile phones, tablet computers, laptops, personal computers, and servers. The method in this embodiment specifically includes the following steps: S101: Acquire a detection image.
[0026] The detection image in this embodiment may be a surveillance image captured by a surveillance camera in various public scenes.
[0027] For example, taking a camera installed on the road as an example, the camera is used to obtain a full-scene image of the road, and then "people driving and riding electric vehicles" are used as detection targets. At least one detection image is obtained from the full-scene image through the age classification model. The detection image includes electric vehicles, drivers driving electric vehicles, and passengers riding electric vehicles.
[0028] S102: extracting a full-body image and a half-body image of the detection target from the detection image.
[0029] The full-body image refers to an image containing full-body features of the detection target, and the half-body image refers to an image containing at least upper-body features (such as the head and chest) of the detection target.
[0030] In a specific implementation, in this embodiment, a full-body image and a half-body image of the detection target can be respectively captured from the detection image through different target detection models, such as capturing a full-body image of the detection target from the detection image through a full-body detection model, and capturing a half-body image of the detection target from the detection image through a half-body detection model, or, first, capturing a full-body image of the detection target from the detection image through a full-body detection model, and then capturing a half-body image from the full-body image according to a preset ratio. In this embodiment, the specific method of capturing the full-body image and the half-body image of the detection target from the detection image is not limited. Among them, the target detection model in this embodiment includes but is not limited to any one of the R-CNN series models, the YOLO series models, etc.
[0031] In one embodiment, in this embodiment, the full body image and half body image of the detection target can be captured from the detection image through the following steps: Figure 2 As shown: S201: Preprocess the detection image to obtain a standard image.
[0032] In a specific implementation, preprocessing the detection image in this embodiment at least includes performing one or more preprocessing of resizing, normalization, denoising, color adjustment, etc. on the detection image.
[0033] Among them, resizing the detection image is a process of scaling the detection image to a specific size. Resizing the detection image to the characteristic size can ensure that all detection images have the same dimension. Among them, the method of resizing the detection image in this embodiment includes but is not limited to any one of the nearest neighbor interpolation, bilinear interpolation, bicubic interpolation, and area interpolation, which is not limited in this embodiment.
[0034] Normalization of the detection image is a process for adjusting the pixel value of the detection image to a specific range (usually a range of 0 to 1 or a range of -1 to 1). The normalized detection target is input into the target age classification model, which helps the model to better learn the image features of the detection image. Among them, the method of normalizing the detection image in this embodiment includes but is not limited to any one of Min-Max normalization, Z-score normalization, and neural network normalization, which is not limited in this embodiment.
[0035] Denoising the detection image is a process of reducing the noise in the detection image to make the detection image clearer. Among them, the method of denoising the detection image in this embodiment includes but is not limited to any one of mean filtering, median filtering and Gaussian filtering, etc., which is not limited in this embodiment.
[0036] Color adjustment of the detection image includes brightness adjustment, contrast adjustment, color correction, etc. Color adjustment of the detection image can improve the visual effect of the detection image and improve the learning effect of the target age classification model. Among them, the method of color adjustment of the detection image in this embodiment includes any one of a color correction algorithm based on supervised learning (such as polynomial regression method, artificial neural network method, etc.), a color adjustment method based on image processing software (professional image processing software, filters and color adjustment tools, etc.), etc., which is not limited in this embodiment.
[0037] S202: Input the standard image into the target detection model to obtain a predicted detection box of the detection target.
[0038] In a specific implementation, in this embodiment, the standard image can be input into the target detection model to predict the predicted coordinates of the detection target through the target detection model, and then the predicted detection frame of the detection target is determined based on the predicted coordinates. The predicted coordinates include the upper left corner coordinates and the lower right corner coordinates of the predicted detection frame, or the predicted coordinates include the lower left corner coordinates and the upper right corner coordinates of the predicted detection frame.
[0039] S203: extracting a full-body image from the standard image according to the predicted detection frame.
[0040] In a specific implementation, in this embodiment, a full-body image can be captured from a standard image according to a predicted detection frame through an image processing library (such as OpenCV), that is, a full-body image can be captured from a standard image according to the upper-left corner coordinates and the lower-right corner coordinates of the predicted detection frame, or a full-body image can be captured from a standard image according to the lower-left corner coordinates and the upper-right corner coordinates of the predicted detection frame.
[0041] S204: extracting a half-body image from the full-body image according to a preset interception range.
[0042] In a specific implementation, in this embodiment, the full-body image may be first resized so that the full-body image is scaled to a specific size, and then the half-body image may be cut out from the full-body image according to a preset cut-out range. The preset cut-out range may be a coordinate range in the full-body image coordinate system, the coordinate range including the upper left corner coordinates and the upper right corner coordinates in the full-body image coordinate system, and the half-body image may be cut out from the full-body image according to the upper left corner coordinates and the upper right corner coordinates, or the preset range may be the upper half of the full-body image, that is, the full-body image is evenly divided into an upper half image and a lower half image, and the upper half image is the half-body image.
[0043] Furthermore, in this embodiment, the head coordinates of the detection target can be first determined from the full-body image, and then the half-body image can be intercepted from the full-body image according to the head coordinates and a preset interception range. The interception range is the upper left corner coordinate interception range and the lower right corner coordinate interception range. The upper left corner coordinates are determined according to the head coordinates and the upper left corner coordinate interception range, and the lower right corner coordinates are determined according to the head coordinates and the lower right corner coordinate interception range.
[0044] For example, the upper left corner coordinate interception range can be (xa, y+b), and the lower right corner coordinate interception range can be (x+a, yb), where (x, y) is the head coordinate, and a and b are constants. In this way, the upper left corner coordinate can be determined according to the head coordinate and the upper left corner coordinate interception range, and the lower right corner coordinate can be determined according to the head coordinate and the lower right corner coordinate interception range.
[0045] S103: inputting the full-body image into the full-body age classification model to obtain a full-body age classification result, and inputting the half-body image into the half-body age classification model to obtain a half-body age classification result.
[0046] It can be understood that the full-body age classification model in this embodiment is used to detect targets in full-body images, while the half-body age classification model is used to detect targets in half-body images. The full-body age classification model will predict the full-body age classification result based on the full-body image, and the half-body model will predict the half-body age classification result based on the half-body image. The full-body age classification model outputs full-body age classification results based on global features based on the full-body image, while the half-body age classification model outputs full-body age classification results based on local features based on the half-body image, thereby outputting detection results from different angles. Among them, the full-body age classification model and the half-body age classification model in this embodiment include but are not limited to those trained based on any one of the R-CNN series models, the YOLO series models, etc.
[0047] S104: The full-body age classification result and the half-body age classification result are integrated to obtain a target age classification result.
[0048] It can be understood that the whole body age classification result and the half body age classification result are both probability distribution results of the target classification. Therefore, in this embodiment, the fusion of the whole body age classification result and the half body age classification result can be achieved by adding these two probability distribution results, that is, adding these two probability distribution results to obtain a new probability distribution, that is, the target age classification result.
[0049] For example, taking pedestrian age classification as an example, pedestrian age classification includes three categories, namely children, adults, and the elderly. Then, the probability distribution of the full-body age classification model output can be {0.6, 0.,5, 0.3}, and the probability distribution of the half-body age classification model output can be {0.5, 0.7, 0.3}. Then, the target age classification results after the probability distribution are added and averaged to be {0.55, 0.6, 0.3}. According to the target age classification results, it can be seen that the probability of the detection target belonging to an adult is the highest.
[0050] In summary, the present invention discloses an age classification method, which cuts out a full-body image and a half-body image of a detection target from a detection image, then inputs the full-body image into a full-body age classification model to obtain a full-body age classification result, and inputs the half-body image into a half-body age classification model to obtain a half-body age classification result, and fuses the full-body age classification result and the half-body age classification result to obtain a target age classification result. It can be seen that the present invention fuses the full-body age classification result output by the full-body age classification model and the half-body age classification result output by the half-body age classification model through a joint reasoning strategy to obtain the final target age classification result, thereby realizing diversified model input and output, and can obtain more accurate age classification results based on detection images captured in a highly dynamic and uncertain environment, thereby achieving the purpose of improving the accuracy of age classification.
[0051] In one embodiment, the half-body age classification model in this embodiment includes a feature calibration module, and the feature calibration module is obtained by replacing the fully connected layer in the SE module with a convolutional layer.
[0052] In a specific implementation, the half-body age classification model in this embodiment can be a RepViT model, which includes a feature calibration module. The feature calibration module is obtained by replacing the fully connected layer in the SE (Squeeze-Excitation) module with a convolutional layer. That is to say, after replacing the fully connected layer in the SE module with a convolutional layer, the feature calibration module in this embodiment can be obtained.
[0053] It should be noted that the full-body age classification model and the half-body age classification model in this embodiment can both be RepViT, but only the half-body age classification model contains the feature calibration module. The half-body age classification model itself only needs to extract the necessary features of the detection target. Therefore, by replacing the fully connected layer in the SE module with the convolutional layer to obtain the feature calibration module, the ability of the half-body age classification model to extract specific features can be improved to a certain extent.
[0054] In one embodiment, the whole body age classification model and half body age classification model in this embodiment are trained by the following method: S301: Acquire a first age classification model and a second age classification model obtained through pre-training.
[0055] The first age classification model is trained based on half-body training images annotated with half-body hard labels, and the second age classification model is trained based on full-body training images annotated with full-body hard labels. The half-body hard label refers to the specific category of the half-body training image (e.g., the detection target in the half-body training image is any one of an adult, a child, or an elderly person), and the full-body hard label refers to the specific category of the full-body training image. The half-body training image annotated with the half-body hard label is input into the first age classification model for iterative training, so that when the loss function of the first age classification model converges, the first age classification model is trained; the full-body training image annotated with the full-body hard label is input into the second age classification model for iterative training, so that when the loss function of the second age classification model converges, the second age classification model is trained.
[0056] S302: Input the half-body training image into the first age classification model to obtain a half-body soft label of the half-body training image, and input the full-body training image into the second age classification model to obtain a full-body soft label of the full-body training image.
[0057] Among them, the half-body soft label refers to the probability distribution obtained by the first age classification model for the half-body training image (for example, the probability of predicting that the half-body training image belongs to a child, an adult, or an elderly person is {0.6, 0.5, 0.3} respectively), and the full-body soft label refers to the probability distribution obtained by the second age classification model for the full-body training image. In other words, the half-body training image is input into the first age classification model, and the half-body age classification result of the half-body training image is obtained as the half-body soft label, and the full-body training image is input into the second age classification model, and the full-body age classification result of the full-body training image is obtained as the full-body soft label.
[0058] S303: inputting the half-body training image marked with half-body soft labels into the half-body age classification model for training to obtain a trained half-body age classification model, and inputting the full-body training image marked with full-body soft labels into the full-body age classification model for training to obtain a trained full-body age classification model.
[0059] Among them, the scale of the first age classification model is larger than that of the half-body age classification model, and the scale of the second age classification model is larger than that of the whole-body age classification model.
[0060] That is to say, when training the half-body age classification model, the half-body age classification model learns the soft labels output by the first age classification model based on the half-body training images, and the full-body age classification model learns the soft labels output by the second age classification model based on the full-body training images. This allows the half-body age classification model and the full-body age classification model to learn more fine-grained features, improve the training efficiency and training effect of the half-body age classification model and the full-body age classification model, and make the performance of the half-body age classification model and the full-body age classification model infinitely close to the first age classification model and the second age classification model.
[0061] To sum up, in this embodiment, the second age classification model and the first age classification model are used as teacher models, and the half-body age classification model and the whole-body age classification model are used as student models. Then, knowledge distillation is performed on the half-body age classification model and the whole-body age classification model through the second age classification model and the first age classification model, so that the half-body age classification model and the whole-body age classification model can have good performance with low computational complexity, which effectively improves the training efficiency and learning effect of the half-body age classification model and the whole-body age classification model.
[0062] It should be understood that the order of execution of the steps in the above embodiment does not necessarily mean 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 embodiment of the present invention.
[0063] In one embodiment, Figure 4 As shown, this embodiment discloses an overload detection method based on age classification, which is applicable to electronic devices with image processing capabilities, such as mobile phones, tablet computers, laptops, personal computers, servers and other devices. The method in this embodiment specifically includes the following steps: S401: Acquire an image of a person on a battery vehicle.
[0064] The image of the person on the battery vehicle in this embodiment may be a surveillance image captured by a surveillance camera in various public scenes.
[0065] For example, taking a camera installed on the road as an example, the full-scene image of the road is obtained through the camera, and then "people driving and riding electric vehicles" is taken as the detection target. At least one detection image is obtained from the full-scene image through the target detection model. The detection image includes the electric vehicle, the driver driving the electric vehicle, and the passengers riding the electric vehicle.
[0066] S402: extracting a driver's half-body image, a driver's full-body image, a passenger's half-body image, and a passenger's full-body image from the battery vehicle's passenger image.
[0067] It should be understood that in order to determine whether the battery car is overloaded, it is first necessary to determine whether there are two people on the battery car, namely the driver and the passenger. If there is only one person on the battery car, then the battery car is not overloaded, but if there are two people on the battery car, then the battery car may be overloaded. Therefore, it is necessary to extract the driver's half-body image, the driver's full-body image, the passenger's half-body image and the passenger's full-body image from the battery car's passenger image to further determine whether the battery car is overloaded. In a specific implementation, in this embodiment, different target detection models can be used to respectively capture the driver's half-body image, the driver's full-body image, the passenger's half-body image and the passenger's full-body image from the battery vehicle's passenger image. Alternatively, in this embodiment, the driver's full-body image and the passenger's full-body image can be first captured from the battery vehicle's passenger image, and then the driver's half-body image and the passenger's half-body image can be respectively captured from the driver's full-body image and the passenger's full-body image.
[0068] S403: Input the full-body image of the driver and the full-body image of the passenger into the full-body age classification model to obtain the full-body age classification result of the driver and the full-body age classification result of the passenger, and input the half-body image of the passenger and the half-body image of the driver into the half-body age classification model to obtain the half-body age classification result of the driver and the half-body age classification result of the passenger.
[0069] It can be understood that the full-body age classification model in this embodiment is used to detect targets on full-body images, while the half-body age classification model is used to detect targets on half-body images. The full-body age classification model will predict the full-body age classification result based on the full-body image, and the half-body model will predict the half-body age classification result based on the half-body image. The full-body age classification model outputs a full-body age classification result based on global features based on the full-body image, while the half-body age classification model outputs a full-body age classification result based on local features based on the half-body image, thereby outputting detection results from different angles. Therefore, the full-body image of the driver and the full-body image of the passenger are input into the full-body age classification model to obtain the full-body age classification result of the driver and the full-body age classification result of the passenger, and the half-body image of the passenger and the half-body image of the driver are input into the half-body age classification model to obtain the half-body age classification result of the driver and the half-body age classification result of the passenger. Among them, the full-body age classification model and the half-body age classification model in this embodiment include but are not limited to training based on any one of the models such as the R-CNN (Region-based Convolutional Neural Networks) series models, the YOLO (YOLO Only Live Once) series models and the RepViT (Representation Learning with Visual Tokens) model.
[0070] S404: The passenger half-body age classification result and the passenger full-body age classification result are integrated to obtain the passenger age classification result, and the driver half-body age classification result and the driver full-body age classification result are integrated to obtain the driver age classification result.
[0071] It can be understood that the passenger's half-body age classification result, the passenger's whole-body age classification result, the driver's half-body age classification result and the driver's whole-body age classification result are all probability distribution results of age classification. Therefore, in this embodiment, the passenger's age classification result can be obtained by adding the passenger's half-body age classification result and the passenger's whole-body age classification result, and the driver's age classification result can be obtained by adding the driver's half-body age classification result and the driver's whole-body age classification result.
[0072] S405: Determine whether the electric vehicle is overloaded based on the driver age classification results and the passenger age classification results.
[0073] If the driver's age classification result indicates that the driver belongs to the first category of people, and the passenger's age classification result indicates that the passenger belongs to the first category of people, then the electric vehicle is determined to be overloaded; if the driver's age classification result indicates that the driver belongs to the first category of people, and the passenger's age classification result indicates that the passenger belongs to the second category of people, then the electric vehicle is determined to be not overloaded.
[0074] To summarize, this embodiment uses a joint reasoning strategy to fuse the passenger's half-body age classification results and the passenger's full-body age classification results to obtain the passenger age classification results, and fuses the driver's half-body age classification results and the driver's full-body age classification results to obtain the driver age classification results, thereby achieving diversified model input and output. More accurate age classification results can be obtained based on detection images taken in a highly dynamic and uncertain environment, thereby achieving more accurate overload detection.
[0075] It should be understood that the order of execution of the steps in the above embodiment does not necessarily mean 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 embodiment of the present invention.
[0076] In one embodiment, Figure 5 FIG. 1 is a schematic diagram of the structure of an age classification device disclosed in this embodiment. The device is applicable to electronic devices with image processing capabilities, such as mobile phones, tablet computers, laptop computers, personal computers, servers and other devices. The device in this embodiment specifically includes the following steps: A first image acquisition module 501, used to acquire a detection image; A first image capture module 502, used to capture a full-body image and a half-body image of the detection target from the detection image; The first age classification module 503 is used to input the full-body image into the full-body age classification model to obtain a full-body age classification result, and input the half-body image into the half-body age classification model to obtain a half-body age classification result; The first result fusion module 504 is used to fuse the whole body age classification result and the whole body age classification result to obtain the target age classification result.
[0077] The present invention discloses an age classification device, which extracts a full-body image and a half-body image of a detection target from a detection image, then inputs the full-body image into a full-body age classification model to obtain a full-body age classification result, and inputs the half-body image into a half-body age classification model to obtain a half-body age classification result, and fuses the full-body age classification result and the half-body age classification result to obtain a target age classification result. It can be seen that the present invention fuses the full-body age classification result output by the full-body age classification model and the half-body age classification result output by the half-body age classification model through a joint reasoning strategy to obtain the final target age classification result, thereby realizing diversified model input and output, and can obtain more accurate age classification results based on detection images captured in a highly dynamic and uncertain environment, thereby achieving the purpose of improving the accuracy of age classification.
[0078] In one implementation, the half-body age classification model includes a feature calibration module, where the feature calibration module is obtained by replacing the fully connected layer in the SE module with a convolutional layer.
[0079] In one implementation, extracting a full-body image and a half-body image of a detection target from a detection image includes: Preprocess the detection image to obtain a standard image; Input the standard image into the target detection model to obtain the predicted detection box of the detected target; Extract the full body image from the standard image according to the predicted detection frame; A half-body image is cut out from the full-body image according to a preset cut-out range.
[0080] In one implementation, the whole body age classification model and the half body age classification model are trained in the following manner: Obtain a first age classification model and a second age classification model obtained by pre-training, wherein the first age classification model is trained based on a half-body training image annotated with a half-body hard label, and the second age classification model is trained based on a full-body training image annotated with a full-body hard label; Input the half-body training image into the first age classification model to obtain a half-body soft label of the half-body training image, and input the full-body training image into the second age classification model to obtain a full-body soft label of the full-body training image; Inputting the half-body training image marked with the half-body soft label into the half-body age classification model for training to obtain a trained half-body age classification model, and inputting the full-body training image marked with the full-body soft label into the full-body age classification model for training to obtain a trained full-body age classification model; Among them, the scale of the first age classification model is larger than that of the half-body age classification model, and the scale of the second age classification model is larger than that of the whole-body age classification model.
[0081] For the specific definition of the age classification device, please refer to the relevant definition of the age classification method above, which will not be repeated here. Each module in the above-mentioned age classification device can be implemented in whole or in part by software, hardware and their combination. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0082] In one embodiment, a schematic diagram of the structure of an overload detection device based on age classification disclosed in this embodiment is provided. The device is applicable to electronic devices with image processing capabilities, such as mobile phones, tablet computers, laptops, personal computers, and servers. The device in this embodiment specifically includes the following steps: The second image acquisition module is used to acquire an image of a person in the battery vehicle; The second image capture module captures a driver's half-body image, a driver's full-body image, a passenger's half-body image, and a passenger's full-body image from the battery vehicle's passenger image; The second age classification module is used to input the driver's full-body image and the passenger's full-body image into the full-body age classification model to obtain the driver's full-body age classification result and the passenger's full-body age classification result, and input the passenger's half-body image and the driver's half-body image into the half-body age classification model to obtain the driver's half-body age classification result and the passenger's half-body age classification result; The second result fusion module fuses the passenger half-body age classification result with the passenger full-body age classification result to obtain the passenger age classification result, and fuses the driver half-body age classification result with the driver full-body age classification result to obtain the driver age classification result; The overload judgment module is used to judge whether the electric vehicle is overloaded according to the driver age classification results and the passenger age classification results.
[0083] In summary, the present embodiment discloses an overload detection device based on age classification, which, through a joint reasoning strategy, fuses the passenger's half-body age classification result output by the half-body age classification model and the passenger's whole-body age classification result output by the whole-body age classification model to obtain the passenger age classification result, and fuses the driver's half-body age classification result and the driver's whole-body age classification result to obtain the driver age classification result, thereby achieving diversified model input and output, and obtaining more accurate age classification results based on the detection images taken in a highly dynamic and uncertain environment, thereby achieving more accurate battery vehicle overload detection.
[0084] In one implementation, the half-body age classification model includes a feature calibration module, where the feature calibration module is obtained by replacing the fully connected layer in the SE module with a convolutional layer.
[0085] For the specific definition of the overload detection device based on age classification, please refer to the relevant definition of the overload detection method based on age classification above, which will not be repeated here. Each module in the above-mentioned overload detection device based on age classification can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0086] The embodiment of the present application also discloses a computer device, which may be a server, and its internal structure diagram may be as shown in Figure 6As shown. The computer device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, an age classification method is implemented.
[0087] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the following steps are implemented: Acquire detection images; Extracting a full-body image and a half-body image of the detection target from the detection image; The full-body image is input into the full-body age classification model to obtain a full-body age classification result, and the half-body image is input into the half-body age classification model to obtain a half-body age classification result; The full-body age classification results and half-body age classification results are combined to obtain the target age classification results.
[0088] The present invention discloses a computer device. When a processor in the computer device runs a computer program stored in a memory, the processor extracts a full-body image and a half-body image of a detection target from a detection image, then inputs the full-body image into a full-body age classification model to obtain a full-body age classification result, and inputs the half-body image into a half-body age classification model to obtain a half-body age classification result, and fuses the full-body age classification result and the half-body age classification result to obtain a target age classification result. It can be seen that the present invention fuses the full-body age classification result output by the full-body age classification model and the half-body age classification result output by the half-body age classification model through a joint reasoning strategy to obtain the final target age classification result, thereby realizing diversified model input and output, and can obtain more accurate age classification results based on detection images captured in a highly dynamic and uncertain environment, thereby achieving the purpose of improving the accuracy of age classification.
[0089] In one implementation, the half-body age classification model includes a feature calibration module, where the feature calibration module is obtained by replacing the fully connected layer in the SE module with a convolutional layer.
[0090] In one implementation, extracting a full-body image and a half-body image of a detection target from a detection image includes: Preprocess the detection image to obtain a standard image; Input the standard image into the target detection model to obtain the predicted detection box of the detected target; Extract the full body image from the standard image according to the predicted detection frame; A half-body image is cut out from the full-body image according to a preset cut-out range.
[0091] In one implementation, the whole body age classification model and the half body age classification model are trained in the following manner: Obtain a first age classification model and a second age classification model obtained by pre-training, wherein the first age classification model is trained based on a half-body training image annotated with a half-body hard label, and the second age classification model is trained based on a full-body training image annotated with a full-body hard label; Input the half-body training image into the first age classification model to obtain a half-body soft label of the half-body training image, and input the full-body training image into the second age classification model to obtain a full-body soft label of the full-body training image; Inputting the half-body training image marked with the half-body soft label into the half-body age classification model for training to obtain a trained half-body age classification model, and inputting the full-body training image marked with the full-body soft label into the full-body age classification model for training to obtain a trained full-body age classification model; Among them, the scale of the first age classification model is larger than that of the half-body age classification model, and the scale of the second age classification model is larger than that of the whole-body age classification model.
[0092] The present application also discloses a computer-readable storage medium. When the instructions in the computer-readable storage medium are executed by a processor in a computer device, the computer device can execute the steps of any embodiment of an age classification method disclosed in the present invention. The computer-readable storage medium can be non-volatile or volatile.
[0093] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented: Acquire detection images; Extracting a full-body image and a half-body image of the detection target from the detection image; The full-body image is input into the full-body age classification model to obtain a full-body age classification result, and the half-body image is input into the half-body age classification model to obtain a half-body age classification result; The full-body age classification results and half-body age classification results are combined to obtain the target age classification results.
[0094] The present invention discloses a computer-readable storage medium. When a computer program stored on the computer-readable storage medium is executed by a processor, the whole body image and half body image of the detection target are cut out from the detection image, and then the whole body image is input into the whole body age classification model to obtain the whole body age classification result, and the half body image is input into the half body age classification model to obtain the half body age classification result, and the whole body age classification result and the half body age classification result are fused to obtain the target age classification result. It can be seen that the present invention fuses the whole body age classification result output by the whole body age classification model and the half body age classification result output by the half body age classification model through a joint reasoning strategy to obtain the final target age classification result, realizes diversified model input and output, and can obtain more accurate age classification results based on the detection image captured in a highly dynamic and uncertain environment, thereby achieving the purpose of improving the accuracy of age classification.
[0095] In one implementation, the half-body age classification model includes a feature calibration module, where the feature calibration module is obtained by replacing the fully connected layer in the SE module with a convolutional layer.
[0096] In one implementation, extracting a full-body image and a half-body image of a detection target from a detection image includes: Preprocess the detection image to obtain a standard image; Input the standard image into the target detection model to obtain the predicted detection box of the detected target; Extract the full body image from the standard image according to the predicted detection frame; A half-body image is cut out from the full-body image according to a preset cut-out range.
[0097] In one implementation, the whole body age classification model and the half body age classification model are trained in the following manner: Obtain a first age classification model and a second age classification model obtained by pre-training, wherein the first age classification model is trained based on a half-body training image annotated with a half-body hard label, and the second age classification model is trained based on a full-body training image annotated with a full-body hard label; Input the half-body training image into the first age classification model to obtain a half-body soft label of the half-body training image, and input the full-body training image into the second age classification model to obtain a full-body soft label of the full-body training image; Inputting the half-body training image marked with the half-body soft label into the half-body age classification model for training to obtain a trained half-body age classification model, and inputting the full-body training image marked with the full-body soft label into the full-body age classification model for training to obtain a trained full-body age classification model; Among them, the scale of the first age classification model is larger than that of the half-body age classification model, and the scale of the second age classification model is larger than that of the whole-body age classification model.
[0098] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0099] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.
[0100] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included in the protection scope of the present invention.
Claims
1. An age classification method, characterized in that: The method comprises: Acquire detection images; Extracting a full-body image and a half-body image of the detection target from the detection image; Inputting the full-body image into a full-body age classification model to obtain a full-body age classification result, and inputting the half-body image into a half-body age classification model to obtain a half-body age classification result; The whole-body age classification result and the half-body age classification result are fused to obtain a target age classification result.
2. The age classification method according to claim 1, characterized in that: The half-body age classification model includes a feature calibration module, and the feature calibration module is obtained by replacing the fully connected layer in the SE module with a convolutional layer.
3. The age classification method according to claim 1, characterized in that: The method of extracting a full-body image and a half-body image of the detection target from the detection image comprises: Preprocessing the detection image to obtain a standard image; Inputting the standard image into a target detection model to obtain a predicted detection frame of the detection target; Cutting out the full-body image from the standard image according to the predicted detection frame; The half-body image is captured from the full-body image according to a preset capture range.
4. The age classification method according to claim 1, characterized in that: The whole body age classification model and the half body age classification model are trained in the following manner: Acquire a first age classification model and a second age classification model obtained by pre-training, wherein the first age classification model is obtained by training based on a half-body training image annotated with a half-body hard label, and the second age classification model is obtained by training based on a full-body training image annotated with a full-body hard label; Inputting the half-body training image into the first age classification model to obtain a half-body soft label of the half-body training image, and inputting the full-body training image into the second age classification model to obtain a full-body soft label of the full-body training image; Inputting the half-body training image marked with the half-body soft label into the half-body age classification model for training to obtain the trained half-body age classification model, and inputting the full-body training image marked with the full-body soft label into the full-body age classification model for training to obtain the trained full-body age classification model; Among them, the scale of the first age classification model is larger than that of the half-body age classification model, and the scale of the second age classification model is larger than that of the whole-body age classification model.
5. An overload detection method based on age classification, characterized in that: The method comprises: Acquire the image of the person in the battery vehicle; Extracting a driver's half-body image, a driver's full-body image, a passenger's half-body image, and a passenger's full-body image from the battery vehicle's passenger image; Inputting the driver's full-body image and the passenger's full-body image into a full-body age classification model to obtain a driver's full-body age classification result and a passenger's full-body age classification result, and inputting the passenger's half-body image and the driver's half-body image into a half-body age classification model to obtain a driver's half-body age classification result and a passenger's half-body age classification result; The passenger half-body age classification result and the passenger full-body age classification result are merged to obtain a passenger age classification result, and the driver half-body age classification result and the driver full-body age classification result are merged to obtain a driver age classification result; Whether the electric vehicle is overloaded is determined based on the driver age classification result and the passenger age classification result.
6. The overload detection method based on age classification as claimed in claim 5, characterized in that: The determining whether the battery vehicle is overloaded according to the driver age classification result and the passenger age classification result includes: If the driver age classification result indicates that the driver belongs to the first group of people, and the passenger age classification result indicates that the passenger belongs to the first group of people, then it is determined that the battery vehicle is overloaded; If the driver age classification result indicates that the driver belongs to the first group of people, and the passenger age classification result indicates that the passenger belongs to the second group of people, it is determined that the electric vehicle is not overloaded.
7. An age classification device, characterized in that: The device comprises: A first image acquisition module, used to acquire a detection image; A first image capture module, used to capture a full-body image and a half-body image of the detection target from the detection image; A first age classification module, configured to input the full-body image into a full-body age classification model to obtain a full-body age classification result, and input the half-body image into a half-body age classification model to obtain a half-body age classification result; The first result fusion module is used to fuse the whole body age classification result and the whole body age classification result to obtain a target age classification result.
8. The age classification device according to claim 7, characterized in that: The half-body age classification model includes a feature calibration module, which is obtained by replacing the fully connected layer in the SE module with a convolutional layer.
9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the age classification method according to any one of claims 1 to 4 is implemented.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the age classification method according to any one of claims 1 to 4 is implemented.