A resampling method for updating deep regression forest leaf nodes
By introducing a sample resampling method into the deep regression forest model and combining it with a deep residual convolutional neural network to update the density distribution of leaf nodes, the problem of insufficient prediction of the deep regression forest model on imbalanced datasets is solved, and the accuracy of the model is significantly improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- YANGTZE DELTA REGION INST (QUZHOU) UNIV OF ELECTRONIC SCI & TECH OF CHINA
- Filing Date
- 2022-12-14
- Publication Date
- 2026-07-21
Smart Images

Figure CN115828175B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of machine learning and is mainly used to improve the performance of deep regression forest models; it is primarily applied to regression prediction problems of imbalanced datasets. Background Technology
[0002] Age estimation using algorithms is a challenging task: because age depends on precise features, estimating accurate age values presents a significant challenge. Besides fundamental features influencing age such as skull shape and facial feature placement, factors like facial disguises (such as beards and glasses) add obstacles to automatic facial age estimation. Skin infections, makeup, diet, changes in skin texture during adulthood, and childhood facial shape changes also mask facial age. Complex facial expressions such as smiling, frowning, laughing, and crying can create wrinkles on the forehead, cheeks, around the eyes, mouth, or nose, affecting accurate age estimation. Real-world environmental factors such as posture, occlusion, lighting, color patterns, and race also impact age estimation; even human observational estimations of age can have significant biases.
[0003] Meanwhile, real-world face datasets often exhibit an imbalanced distribution, with a small number of classes containing the vast majority of sample points, while the remaining classes contain very few sample points, forming a long-tailed distribution. Training on such imbalanced datasets can cause age estimation algorithms to become biased, maintaining stable high prediction accuracy on classes with more data, while performing poorly on classes with less data.
[0004] Deep Regression Forests (DRFs) treat the increase in age as a continuously changing ordered sequence. Based on the classic machine learning algorithm Random Forest (RF), DRFs treat age estimation as a regression problem. Ideally, each leaf node in a DRF corresponds to a compact and uniform subset of the dataset, thus the probability density distribution at each leaf node is considered a Gaussian distribution. The prediction result of each tree in a DRF is calculated by weighting the means of the distributions at the leaf nodes, where the weights are the probability of a sample reaching each leaf node. When DRFs are applied to imbalanced datasets, the density distribution of leaf nodes, updated with samples during training, significantly affects the final prediction. The means of the density distributions of different leaf nodes tend to concentrate more within the label range corresponding to the category with more data, thus hindering the prediction of categories with less data. References: W. Shen, Y. Guo, Y. Wang, K. Zhao, B. Wang and A. Yuille. (2018, June). DeepRegression Forests for Age Estimation. In Conference on Computer Vision and Pattern Recognition (pp. 2304-2313). To improve the predictive performance of Deep Regression Forests (DRF) models, resampling, a method commonly used to address imbalanced datasets, has attracted our attention. This method resamples the data, directly altering the original data distribution by reducing the number of head samples or increasing the number of tail samples, forcing the imbalanced distribution of the sample data to become balanced. The batch of samples obtained in this way no longer exhibits imbalanced characteristics, thus ensuring that the updated leaf nodes have representative means in each category, which is beneficial for predicting tail data. This invention considers algorithms for solving the age estimation problem from the perspective of imbalanced datasets, introducing a sample-based resampling method into the Deep Regression Forest model, solving the problems of existing methods, and improving the overall predictive performance of the model. Summary of the Invention
[0005] This invention is a sample resampling method to solve the problem of imbalanced dataset distribution. Based on the number of samples of different categories in the training dataset, the density distribution on the leaf nodes is updated by using the batch samples obtained after resampling in the deep regression forest model, thereby obtaining a more balanced leaf node distribution result. This makes the model more accurate in predicting the data of the tail category and improves the overall performance of the model under imbalanced datasets.
[0006] This method first constructs a deep learning model with a deep residual convolutional neural network as the backbone and a deep regression forest network as the classifier, using the AgeDB dataset as the experimental data source. The dataset is divided into training, test, and validation sets, ensuring an imbalanced sample distribution on the training set and a similar data distribution between the test and validation sets. The model is trained on the training set, and after each iteration, it is validated using the validation set. The parameters and network structure of the best-performing model are selected and saved. Finally, the model's prediction accuracy is tested on the test set. This method emphasizes introducing a sample resampling method during model training to update the mean of leaf nodes, thereby improving model performance. This method, from the perspective of sample distribution, mainly performs the following tasks: 1) Constructing a model based on a deep residual convolutional neural network with the addition of a deep regression forest; 2) Analyzing the characteristics of the imbalanced dataset, determining the distribution type of the samples, and dividing the imbalanced dataset according to the number of samples in each class; 3) Reassigning weights based on the number of samples in the three subsets obtained from the division, constructing a batch of samples obtained by non-uniform probability sampling for updating the leaf node mean, thus avoiding the situation where the samples used to update the leaf nodes still have an imbalanced distribution; 4) Training on the preprocessed imbalanced dataset AgeDB, using MAE to evaluate the model's performance on the test set, and comparing it with methods that do not use resampling to update the density distribution on the leaf nodes. Through the above work, it is verified that this invention can obtain targeted weights for resampling to update parameters based on the distribution state of imbalanced samples, further improving the model's performance in imbalanced data environments, and showing improvement effects under different deep neural network frameworks, making it a highly applicable sample resampling method.
[0007] To facilitate the description of the present invention, some terms are first defined.
[0008] Definition 1: Residual Convolutional Neural Network (ResNet). By adding "residual connections" to a convolutional network, the degradation phenomenon that occurs in deep networks during training is solved, greatly increasing the trainable depth of the neural network. Compared with traditional convolutional neural networks, residual networks have the advantages of being easier to train and optimize. In this invention, the residual convolutional neural network we use is the ResNet50 network.
[0009] Definition 2: VGG Network. VGG networks demonstrate that increasing network depth can significantly impact final performance. Compared to the previous AlexNet network, VGG networks are deeper, have more parameters, and offer better performance and portability. Due to their structured design and simple, stackable convolutional blocks, they perform well on many datasets. In this invention, we use the VGG16 network and its pre-trained model, VGG-Face, which is also based on the VGG16 architecture for face recognition.
[0010] Definition 3: Max Pooling and Average Pooling. Max pooling and average pooling are two methods for achieving image smoothing. Specifically, both operations first divide the input image into several sub-regions according to rules. Max pooling selects the maximum value of all pixels in the sub-region as the output of the pooling layer. Average pooling uses the average value of all pixels in the sub-region as the output of the pooling layer. ;in It is located in The value of the pixel, This represents the number of pixels contained in the sub-region.
[0011] Definition 4: ReLU activation function. Also known as the rectified linear unit, it is a commonly used activation function in artificial neural networks. It usually refers to nonlinear functions represented by the ramp function and its variants. Its expression is: .
[0012] Definition 5: Batch Normalization. Batch normalization can accelerate the convergence speed during model training, making the training process more stable and avoiding gradient explosion or vanishing phenomena. Specifically, it calculates the mean and variance of different samples in the same channel for a mini-batch of images, normalizes the data, and introduces two learnable parameters to amplify the differences between normalized samples. This method has been proven to effectively improve the performance of deep neural network models.
[0013] Definition 6: Mean Absolute Error. The Mean Absolute Error (MAE) is used in this method to measure the model's predictive accuracy. Specifically, it involves first calculating the absolute value of the error between the model's predicted value and its true value for each test sample, and then averaging the absolute errors over all test samples; the expression is as follows:
[0014] ;
[0015] in Indicates the number of test samples. This represents the model's predicted value. This represents the true value, i.e., the sample label; the smaller the mean absolute error (MAE), the better the model performance.
[0016] Definition 7: L1 Loss Function. A loss function is used to measure the difference between the model's predicted and actual values. By calculating the loss between the two, and then backpropagating the loss, the model's network parameters are updated, thereby reducing the gap between the actual and predicted values. This method uses the L1 loss function, and its calculation formula is as follows:
[0017] ;
[0018] in This represents the number of samples in a single batch. For the true value, These are the model's predicted values.
[0019] The technical solution of this invention is a resampling method for updating forest leaf nodes in deep regression, the method comprising:
[0020] Step 1: Preprocess the experimental dataset;
[0021] Images of real-world objects are acquired, with a larger number of images for some categories and fewer for others, resulting in an unbalanced distribution of image data. These real-world images are then labeled according to the categories of the objects within them, and the images are scaled and cropped while ensuring that each experimental image is the same size.
[0022] Step 2: Construct a deep neural network feature extraction module;
[0023] The deep neural network feature extraction module used in this method is constructed from ResNet50 deep residual convolutional neural network and VGG16 deep neural network, respectively. For ResNet50, its first layer is a convolutional neural network layer, the second to fifth layers are residual network layers, and the last layer is an average pooling layer; for VGG16, its first thirteen layers are convolutional neural network layers, and the last three layers are fully connected layers; for the input image... The output of the feature extraction model is the feature representation of the image. See [link to convolutional neural network layer structure] for details. Figure 1 See residual block structure. Figure 2 See ResNet50 for deep residual convolutional neural networks. Figure 3 See VGG16 deep neural network. Figure 4 ,
[0024] Step 3: Construct a deep neural network prediction module;
[0025] The deep neural network prediction module used in this method is constructed from a deep regression forest. The deep regression forest used in this method consists of five trees, each with a depth of six, where different leaf nodes... Upper Gaussian distribution The mean and variance of the dataset samples were obtained using the K-Means algorithm. Clustering was performed to obtain; The partitioning function for the intermediate internal nodes with parameters is the sigmoid function. To achieve: ,in This refers to the feature extraction module constructed in step 2. Established The correspondence between features in the sample and the internal nodes of the tree is thus established. Falling into leaf node probability ,Tree For the sample The prediction results are as follows:
[0026] ;
[0027] See Deep Regressive Forest Network Figure 5 ;
[0028] Step 4: Analyze and calculate the weights for resampling imbalanced samples;
[0029] This step is crucial to this method. By analyzing the dataset, the distribution of samples in each category approximates a Gaussian distribution, i.e. :
[0030] ;
[0031] Traditional methods often define resampling weights as being related to the inverse of the sample distribution function. However, due to the large number of age categories and significant imbalance in age datasets, the difference between the head and tail data can be substantial. Generating a weight for each category for subsequent resampling cannot yield accurate results for each category. Therefore, we group the categories to address this issue. Based on the number of samples in each category, we divide all categories into three groups: the group with the most samples (Many group), the group with a moderate number of samples (Medium group), and the group with the fewest samples (Few group). This grouping fully utilizes the distribution patterns of the dataset. Furthermore, we calculate the corresponding resampling weights for each category within each group. We aim for the model to focus more on learning the categories with fewer samples (Few group) while not neglecting the categories with more samples (Many group).
[0032] Now assume that there are a total of Categories The number of samples corresponding to each category is Now, based on the threshold of the number of samples per category and The dataset samples are divided, assuming this... Of the three categories, *a* categories were assigned to the Many group, *b* categories to the Medium group, and *c* categories to the Few group. The sum of the sample sizes for each category within the three groups is as follows: , and We directly set the sampling weights in the resampling process based on the overall data distribution, so that the probability of a sample being sampled from each category is directly related to the total number of samples in its group:
[0033] ;
[0034] Step 5: Update the leaf node mean using a batch of samples with a balanced distribution;
[0035] Based on the sampling weights of the three categories obtained in step 4, the initially imbalanced dataset is resampled to obtain a batch of samples with a more balanced distribution across categories. This batch is specifically used to update the mean of the Gaussian distribution at the leaf nodes during training. and variance :
[0036] ;
[0037] ;
[0038] in With sample Reaching the leaf node The probability is related.
[0039] Step 6: Train the deep neural network model;
[0040] Based on steps 2 and 3, a deep neural network model is constructed. The L1 loss is used as the objective function to train the model, and the Adam momentum optimizer is used to complete the gradient update. The batch size is set, and all training samples are divided according to the batch size and then fed into the neural network model to obtain the predicted value of each sample. After training each epoch, the leaf node mean is updated using the balanced batch samples obtained by the resampling strategy in steps 4 and 5. The network parameters are updated through backpropagation until the training ends.
[0041] Step 7: Evaluate model performance using MAE;
[0042] The model was trained using steps 3, 4, 5, and 6, while maintaining the model parameters and network structure. The model's feature extraction module and prediction head were used to perform feature representation and prediction on images in an imbalanced test set. Then, MAE was used to evaluate the effectiveness of the model's feature representation and prediction accuracy.
[0043] The innovation of this article lies in:
[0044] (1) This invention establishes a resampling method for updating the leaf node distribution of a deep regression forest based on the imbalanced distribution of the dataset. By identifying the distribution state of the dataset samples, the dataset samples are grouped into categories, and resampling is performed with corresponding weights. This updates the leaf node distribution that affects the prediction results, making the mean of the leaf nodes span all sample categories as much as possible, and further improving the performance of the model under imbalanced training data.
[0045] (2) Experiments have shown that this method improves the prediction accuracy of deep neural network models on imbalanced datasets. Under the same neural network framework, the prediction accuracy of this method is 13.47% and 9.05% higher than that of the method that directly updates the leaf node distribution with imbalanced batch samples on VGG16 and ResNet50 frameworks, respectively, under the MAE evaluation index. The test results are shown in Table 1. Attached Figure Description
[0046] Figure 1 This is a diagram of the convolutional network block structure of the method of the present invention.
[0047] Figure 2 This is a block structure diagram of the residual convolutional neural network of the method of the present invention.
[0048] Figure 3 This is a diagram of the ResNet50 residual convolutional neural network structure of the method of this invention.
[0049] Figure 4 This is a structural diagram of the deep neural network VGG16 of the method of the present invention.
[0050] Figure 5 This is a diagram of the deep regression forest network structure of the method of this invention. Detailed Implementation
[0051] Step 1: Preprocess the dataset;
[0052] Download the AgeDB dataset (https: / / ibug.doc.ic.ac.uk / resources / agedb / ). AgeDB is a dataset for face age estimation tasks, and its data distribution closely resembles the age distribution of the real-world population. Face age estimation is generally a regression task; therefore, before using this dataset, our method first preprocesses it. Since age is an integer, the labels can be discretized into 102 groups (categories) from 0 to 101 years old. After preprocessing, we found that the number of samples in the younger (generally less than 20 years old) or older (generally greater than 80 years old) categories is relatively small, while the number of samples in the middle-aged category is relatively large, indicating an imbalanced dataset. We divide this data into training, testing, and validation sets; the training set includes 12,200 face images and their corresponding age labels, while the testing and validation sets each contain 2,100 well-balanced face images and their corresponding labels for subsequent model training and testing tasks.
[0053] Step 2: Construct a deep neural network feature extraction module;
[0054] The deep neural network feature extraction module used in this method is constructed from ResNet50 deep residual convolutional neural network and VGG16 deep neural network, respectively. For ResNet50, its first layer is a convolutional neural network layer, the second to fifth layers are residual network layers, and the last layer is an average pooling layer; for VGG16, its first thirteen layers are convolutional neural network layers, and the last three layers are fully connected layers; for the input image... The output of the feature extraction model is the feature representation of the image. See [link to convolutional neural network layer structure] for details. Figure 1 See residual block structure. Figure 2 See ResNet50 for deep residual convolutional neural networks. Figure 3 See VGG16 deep neural network. Figure 4 ,
[0055] Step 3: Construct a deep neural network prediction module;
[0056] The deep neural network prediction module used in this method is constructed from a deep regression forest. The deep regression forest used in this method consists of five trees, each with a depth of six, where different leaf nodes... Upper Gaussian distribution The mean of the dataset samples is calculated using the K-Means algorithm. Clustering was performed to obtain; The partitioning function for the intermediate internal nodes with parameters is the sigmoid function. To achieve: ,in This refers to the feature extraction module constructed in step 2. Established The correspondence between features in the sample and the internal nodes of the tree is thus established. Falling into leaf node probability ,Tree For the sample The prediction results are as follows:
[0057] ;
[0058] See Deep Regressive Forest Network Figure 5 ;
[0059] Step 4: Analyze and calculate the weights for resampling imbalanced samples;
[0060] This step is crucial to this method. By analyzing the dataset, the distribution of samples in each category approximates a Gaussian distribution, i.e. :
[0061] ;
[0062] Traditional methods often define resampling weights as being related to the inverse of the sample distribution function. However, due to the large number of age categories and significant imbalance in age datasets, the difference between the head and tail data can be substantial. Generating a weight for each category for subsequent resampling cannot yield accurate results for each category. Therefore, we group the categories to address this issue. Based on the number of samples in each category, we divide all categories into three groups: the group with the most samples (Many group), the group with a moderate number of samples (Medium group), and the group with the fewest samples (Few group). This grouping fully utilizes the distribution patterns of the dataset. Furthermore, we calculate the corresponding resampling weights for each category within each group. We aim for the model to focus more on learning the categories with fewer samples (Few group) while not neglecting the categories with more samples (Many group).
[0063] Now assume that there are a total of Categories The number of samples corresponding to each category is Now, based on the threshold of the number of samples per category and The dataset samples are divided, assuming this... Of the three categories, *a* categories were assigned to the Many group, *b* categories to the Medium group, and *c* categories to the Few group. The sum of the sample sizes for each category within the three groups is as follows: , and We directly set the sampling weights in the resampling process based on the overall data distribution, so that the probability of a sample being sampled from each category is directly related to the total number of samples in its group:
[0064] ;
[0065] Step 5: Update the leaf node mean using a batch of samples with a balanced distribution;
[0066] Based on the sampling weights of the three categories obtained in step 4, the initially imbalanced dataset is resampled to obtain a batch of samples with a more balanced distribution across categories. This batch is specifically used to update the mean of the Gaussian distribution at the leaf nodes during training. and variance :
[0067] ;
[0068] ;
[0069] in With sample Reaching the leaf node The probability is related.
[0070] Step 6: Train the deep neural network model;
[0071] Based on steps 2 and 3, a deep neural network model is constructed. The model is trained using L1 loss as the objective function, and the Adam momentum optimizer is used for gradient updates. A batch size is set, and all training samples are divided according to this batch size before being fed into the neural network model to obtain predicted values for each sample. After each epoch of training, the leaf node mean is updated using the balanced batch samples obtained from the resampling strategy in steps 4 and 5. Network parameters are then updated through backpropagation until training is complete. Furthermore, this method introduces a validation set during training. After each iteration of the entire training dataset, the MAE (Magnitude of Effect) metric is used to evaluate the performance of the current model on the validation set. The model with the smallest MAE value is selected, and its parameters and network structure are saved.
[0072] Step 7: Evaluate model performance using MAE;
[0073] The model was trained using steps 3, 4, 5, and 6, maintaining the model parameters and network structure. The model's feature extraction module and prediction head were used to represent and predict features on images in an imbalanced test set. Then, the MAE (Model-Aspect Representation) was used to evaluate the effectiveness of the model's feature representation and prediction accuracy. The test results are shown in Table 1. As can be seen from Table 1, regardless of the deep neural network used for feature extraction, the sample resampling method proposed in this invention can further reduce the model's MAE score on the test set and improve the model's accuracy on the test set.
[0074] Image size: 224*224;
[0075] Learning rate: 0.001;
[0076] Training batch size M: 256;
[0077] Number of iterations: 90;
[0078] Table 1 presents the experimental results of the method of this invention. Here, ALL represents the MAE index across the entire test set, and Many, Medium, and Few represent the MAE indexes in the three groups, respectively.
[0079]
Claims
1. A resampling method for updating forest leaf nodes in deep regression, the method comprising: Step 1: Preprocess the experimental dataset; We acquire images of real-world objects, with some categories having a larger number of images and others having fewer, resulting in an unbalanced distribution of image data. We then label these real-world images according to the categories of the objects within them, scale and crop the images, and ensure that each experimental image is the same size. Step 2: Construct a deep neural network feature extraction module; The deep neural network feature extraction module is constructed using ResNet50 and VGG16 deep neural networks, respectively. For ResNet50, the first layer is a convolutional neural network layer, the second to fifth layers are residual network layers, and the last layer is an average pooling layer. For VGG16, the first thirteen layers are convolutional neural network layers, and the last three layers are fully connected layers. For the input image... The output of the feature extraction model is the feature representation of the image. ; Step 3: Construct a deep neural network prediction module; The deep neural network prediction module used is constructed from a deep regression forest; the deep regression forest used in this method consists of five trees, each with a depth of six, where different leaf nodes... Upper Gaussian distribution The mean and variance of the dataset samples were obtained using the K-Means algorithm. Clustering was performed to obtain; by The partitioning function for the intermediate internal nodes with parameters is the sigmoid function. To achieve: ,in This refers to the feature extraction module constructed in step 2. Established The correspondence between features in the sample and the internal nodes of the tree is thus established. Falling into leaf node probability ,Tree For the sample The prediction results are as follows: ; Step 4: Analyze and calculate the weights for resampling imbalanced samples; Analysis of the dataset reveals that the distribution of samples in each category approximates a Gaussian distribution. : ; Based on the number of samples in each category, all categories are divided into three groups: the category with the most samples is grouped into one group, defined as the Many group; the category with a moderate number of samples is grouped into one group, defined as the Medium group; and the category with the fewest samples is grouped into one group, defined as the Few group. For the samples of each category in each group, the corresponding resampling weight is calculated. There are a total of Categories The number of samples corresponding to each category is Based on the threshold of the number of samples per category and Divide the dataset samples. ,this Of the three categories, *a* categories were assigned to the Many group, *b* categories to the Medium group, and *c* categories to the Few group. The sum of the sample sizes for each category within the three groups is as follows: , and Based on the overall data distribution, set sampling weights in the resampling process so that the probability of a sample being sampled in each category is directly related to the total number of samples in its group. ; Step 5: Update the leaf node mean using a batch of samples with a balanced distribution; Based on the sampling weights of the three categories obtained in step 4, the initially imbalanced dataset is resampled to obtain a batch of samples with a more balanced distribution across categories. This batch is specifically used to update the mean of the Gaussian distribution at the leaf nodes during training. and variance : ; ; in With sample Reaching the leaf node Probability-related; Step 6: Train the deep neural network model; Based on steps 2 and 3, a deep neural network model is constructed. The L1 loss is used as the objective function to train the model, and the Adam momentum optimizer is used to complete the gradient update. The batch size is set, all training samples are divided according to the batch size, and then fed into the neural network model to obtain the predicted value of each sample. After training each epoch, the leaf node mean is updated using the balanced batch samples obtained by the resampling strategy in steps 4 and 5. The network parameters are updated through backpropagation until the training ends. Step 7: Evaluate model performance using MAE; The model was trained using steps 3, 4, 5, and 6, while maintaining the model parameters and network structure. The model's feature extraction module and prediction head were used to perform feature representation and prediction on images in an imbalanced test set. Then, MAE was used to evaluate the effectiveness of the model's feature representation and prediction accuracy.