A Method for Constructing Multi-Scale GCNN Network Models Based on Spatial Pyramid Pooling
By using a multi-scale GCNN network model based on spatial pyramid pooling, the problem of insufficient recognition ability of convolutional neural networks for images of different scales is solved, the network design is simplified, and the recognition and generalization abilities of the model are improved.
Patent Information
- Application Number
- CN202411386316.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-30
- Publication Date
- 2025-10-31
- Estimated Expiration
- 2044-09-30
AI Technical Summary
Existing convolutional neural networks have limited ability to recognize images with varying scales, and their network design is complex and training is difficult.
We employ a multi-scale GCNN network model based on spatial pyramid pooling. Through data preprocessing, network architecture design, model training, and evaluation optimization, we combine multi-scale input, convolutional layers, and spatial pyramid pooling layers, and use the cross-entropy loss function and Adam optimizer for model training and optimization.
It improves the model's robustness to scale changes, simplifies network design complexity, enhances the ability to recognize image details, reduces the risk of overfitting, and improves the model's generalization ability.
Smart Images

Figure CN119378602B_ABST
Abstract
Description
Technical Field
[0001] This invention pertains to algorithms related to growable convolutional neural networks (GCNN), specifically a method for constructing multi-scale GCNN network models based on spatial pyramid pooling. Background Technology
[0002] While Convolutional Neural Networks (CNNs) achieve some degree of translation, rotation, and scale invariance in handling multi-scale problems, their ability to recognize scale changes remains limited. Traditional methods involve increasing the size of the network model and applying scale jittering strategies to enhance the model's ability to recognize images at different scales, but this also increases model complexity and training difficulty, easily leading to overfitting. In contrast, Growing Convolutional Neural Networks (GCNNs) can dynamically adjust their network structure based on input samples, automatically finding a suitable structure for the complexity of the target task, and possesses a certain degree of online learning capability. Through its dynamic growth characteristic, GCNNs can progressively add new convolutional layers or adjust the parameters of existing layers during training, thus better adapting to data at different scales.
[0003] Existing methods still have the following problems in handling multi-scale problems:
[0004] (1) Limited scale recognition capability: Convolutional neural networks have limited ability to recognize images with different scales and lack an effective mechanism to handle multi-scale problems.
[0005] (2) Complex network design: Existing methods design different levels of filters and scale normalization operations, which increases the complexity of network model design and training difficulty. Summary of the Invention
[0006] This invention aims to solve at least one of the technical problems existing in the prior art; to this end, this invention proposes a method for constructing a multi-scale GCNN network model based on spatial pyramid pooling, which solves the technical problems of limited scale recognition capability, complex network model design and training difficulties in existing methods.
[0007] To achieve the above objectives, this invention provides a method for constructing a multi-scale GCNN network model based on spatial pyramid pooling, comprising:
[0008] Step 1: Data Preprocessing; Obtain the CIFAR-100 dataset and preprocess the images in the CIFAR-100 dataset, wherein the preprocessing includes: image scaling, normalization, and data augmentation;
[0009] Step 2: Network architecture design; In the GCNN model, a multi-scale input strategy is adopted, combining convolutional layers and spatial pyramid pooling layers to extract features from the preprocessed CIFAR-100 dataset images, and to construct a network structure that captures features at different scales and levels.
[0010] Step 3: Model training; The cross-entropy loss function is used to evaluate classification differences, and the Adam optimizer is used to update parameters. The model weights are iterated through the backpropagation algorithm to perform multi-scale feature learning and optimization on the GCNN network model.
[0011] Step 4: Model Evaluation and Optimization; The GCNN network model is evaluated and optimized according to the evaluation metrics, which include: accuracy, precision, recall, and F1 score.
[0012] Preferably, the image scaling includes: as the network grows from the input layer, the GCNN network performs a scaling operation on the input image, where T is the set of scaling ratios, T = {T1, ..., T}. N}, T i (i = 1, ..., N) represents the scaling ratio of the input image when the network grows at the i-th time in the input layer; five scaling ratios are set: T = {0.5, 0.75, 1.0, 1.25, 1.5}, which scale the image to 16×16, 24×24, 32×32, 40×40, and 48×48 pixels respectively; when T i =T N At this point, GCNN stops growing; let the input image be I, and the output of the first scale-transformed convolutional layer... and the output of the sampling layer
[0013]
[0014] Where k represents a 3×3 convolution kernel with stride of 1 and padding of 1, * represents the convolution operation, b represents the bias, down(.) represents the downsampling function, m×m represents the size of the sampling layer, b represents the bias, and σ represents the ReLU activation function;
[0015] The output of the second scale-transform convolutional layer and the output of the sampling layer
[0016]
[0017] This invention performs image scaling on images from the CIFAR-100 dataset, which helps improve the model's robustness to scale changes.
[0018] Preferably, the normalization normalizes the pixel values of each image in the CIFAR-100 dataset to the range of [0,1]; the data augmentation involves performing random horizontal flipping, random cropping, color jittering, and noise addition on the images during training.
[0019] This invention standardizes images from the CIFAR-100 dataset, which helps accelerate model training convergence while avoiding numerical computation issues. Data augmentation increases dataset diversity, reduces the risk of overfitting, and improves the model's generalization ability.
[0020] Preferably, the feature extraction of images from the preprocessed CIFAR-100 dataset by combining convolutional layers and spatial pyramid pooling layers includes: processing images of different sizes using spatial pyramid pooling layers (SPP), where the number of spatial blocks in the second level of the SPP layer is n×n, and the output of the last convolutional layer... If the size is a×a, then the size of the sampling window for the second level is Step size is and These represent the floor and floor operations, respectively. This means that the fixed-size window of the second sampling layer in GCNN is replaced with an adaptive window size, proportional to the input image. Assume the SPP layer contains L pooling levels, with n spatial blocks per level. j ×n j (j=1,…,L), then the output of the entire SPP layer is The dimension is defined by M, where M represents the number of filters in the last convolutional layer. Through adaptive pooling and multi-level spatial pooling, input images of different scales are converted into fixed-length feature vectors.
[0021] By processing images of different sizes, the SPP layer can adaptively adjust the window size, enabling the model to capture features at different scales and enhancing the model's ability to recognize image details.
[0022] Preferably, the step of using the cross-entropy loss function to evaluate classification differences and using the Adam optimizer for parameter updates includes:
[0023] During training, the cross-entropy loss function is used to calculate the loss caused by the difference between the predicted probability distribution and the actual class of each sample;
[0024] The Adam optimizer was used with an initial learning rate of 0.001 and parameters β1 = 0.9 and β2 = 0.999. The model was trained for 100 epochs. In each epoch, mini-batch SGD with a batch size of 128 was used for training. At the end of each epoch, the validation loss and accuracy were calculated using the validation set.
[0025] This invention optimizes the model using the cross-entropy loss function and the Adam optimizer, which helps the model converge to the optimal solution more quickly.
[0026] Preferably, the evaluation of the GCNN network model based on evaluation metrics includes:
[0027] The model was evaluated using a test dataset, and accuracy, precision, recall, and F1 score were calculated on the test set. The classification performance of the model for different categories was analyzed by plotting a confusion matrix. The scale invariance of the GCNN structure was evaluated by comparing the classification performance at different scales for input images at different scales.
[0028] Preferably, optimizing the GCNN network model based on model evaluation metrics includes:
[0029] Based on the model's evaluation metrics, adjust the number of pooling layers and spatial blocks in the SPP layer; adjust the adaptive window size and stride of the SPP layer based on the size of the input image; and use a learning rate decay strategy to ensure stable convergence of the model in the later stages of training.
[0030] Compared with the prior art, the beneficial effects of the present invention are:
[0031] (1) By using multi-scale input and spatial pyramid pooling layer (SPP), this invention can effectively process images of different sizes, enhancing the model's ability to recognize scale changes. This adaptive pooling method can retain more information about the image and improve the model's accuracy.
[0032] (2) This invention reduces design complexity by optimizing the network architecture. By utilizing spatial pyramid pooling layers, the complexity of traditional methods, which require careful design of different levels of filters and scale normalization operations, can be avoided, thus simplifying the design and training process of the network model. Attached Figure Description
[0033] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0034] Figure 1 This is a flowchart of the present invention;
[0035] Figure 2 This is a schematic diagram illustrating the specific steps of the present invention. Detailed Implementation
[0036] The technical solution of the present invention will be clearly and completely described below with reference to the embodiments. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0037] Please see Figure 1 The first aspect of this invention provides a method for constructing a multi-scale GCNN network model based on spatial pyramid pooling, comprising:
[0038] Step 1: Data preprocessing;
[0039] The images in the CIFAR-100 dataset are preprocessed, including image scaling, normalization, and data augmentation. The CIFAR-100 dataset contains 60,000 32×32 color images, divided into 100 classes. Each class has 600 images, with 50,000 used for training and 10,000 used for testing.
[0040] Normalization normalizes the pixel values of each image to the range of [0,1].
[0041] Data augmentation involves randomly flipping, cropping, color jittering, and adding noise to images during training.
[0042] Image scaling includes: as GCNN grows from the input layer of the network, a certain scale adjustment operation is performed on the input image. Let T be the set of scaling ratios, T = {T1, ..., T}. N}, T i (i = 1, ..., N) represents the scaling ratio of the input image when the network grows from the input layer for the i-th time; five scaling ratios are set: T = {0.5, 0.75, 1.0, 1.25, 1.5}, which scale the images to 16×16, 24×24, 32×32, 40×40, and 48×48 pixels respectively; multi-scale transformation is performed on each image in the CIFAR-100 dataset, and the scaling ratio satisfies the following three principles:
[0043] Diversity: Covering a sufficient number of scale levels ensures that the model learns effectively at different scales.
[0044] Relevance: The scaling ratio should match the characteristics of the dataset and the requirements of the task, and adapt to different detailed requirements.
[0045] Balance: Balance computing resources and model performance, and avoid excessive scaling of layers that would increase the amount of computation.
[0046] When T i =T N At this point, GCNN stops growing; let the input image be I, and the output of the first scale-transformed convolutional layer... and the output of the sampling layer
[0047]
[0048] Where k represents a 3×3 convolution kernel with stride of 1 and padding of 1, * represents the convolution operation, b represents the bias, down(.) represents the downsampling function, m×m represents the size of the sampling layer, b represents the bias, and σ represents the ReLU activation function;
[0049] The output of the second scale-transform convolutional layer and the output of the sampling layer
[0050]
[0051] Step Two: Network Architecture Design;
[0052] In the GCNN model, multi-scale input, convolutional layers, and spatial pyramid pooling layers are used to process images of different sizes; let the number of spatial blocks in the second level of the SPP layer be n×n, and the output of the last convolutional layer... If the size is a×a, then the sampling window size for this level is Step size is and These represent the floor and floor operations, respectively. This means that the fixed-size window of the second sampling layer in GCNN is replaced with an adaptive window size, proportional to the input image. Assume the SPP layer contains L pooling levels, with n spatial blocks per level. j ×n j (j=1,…,L), then the output of the entire SPP layer is The dimension is defined by M, where M represents the number of filters in the last convolutional layer. Through adaptive pooling and multi-level spatial pooling, input images of different scales are converted into fixed-length feature vectors.
[0053] Step 3: Model training;
[0054] The model employs a cross-entropy loss function and the Adam optimizer for multi-scale feature learning and optimization. The cross-entropy loss function calculates the loss caused by the difference between the predicted probability distribution and the actual class for each sample. The Adam optimizer is used with an initial learning rate of 0.001 and parameters β1 = 0.9 and β2 = 0.999, resulting in rapid convergence to the global optimum. The model is trained for 100 epochs. In each epoch, mini-batch SGD with a batch size of 128 is used for training. At the end of each epoch, the validation loss and accuracy are calculated using the validation set.
[0055] Step 4: Model Evaluation and Optimization;
[0056] Evaluate model performance and optimize the model based on evaluation metrics. The evaluation uses a test dataset to assess the model, primarily calculating accuracy, precision, recall, and F1 score on the test set. The model's classification performance across different categories is analyzed by plotting a confusion matrix. For input images at different scales, the scale invariance of the GCNN structure is evaluated by comparing classification performance at each scale.
[0057] Optimizing the model based on evaluation metrics includes: adjusting the number of pooling layers and spatial blocks in the SPP layer according to the evaluation metrics; adjusting the adaptive window size and stride of the SPP layer according to the size of the input image; and using a learning rate decay strategy to ensure stable convergence of the model in the later stages of training.
[0058] The working principle of this invention is as follows: Images from the CIFAR-100 dataset are preprocessed, including normalization, data augmentation, and multi-scale scaling. Then, a GCNN network architecture is designed, using multi-scale input, convolutional layers, and spatial pyramid pooling layers to process images of different sizes. The model is then trained using the cross-entropy loss function and the Adam optimizer for a total of 100 epochs, with each epoch having a specific training method and validation operation. Finally, the model is evaluated using a test dataset, and its performance is measured through multiple metrics to optimize the model accordingly.
[0059] The above embodiments are only used to illustrate the technical methods of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical methods of the present invention without departing from the spirit and scope of the technical methods of the present invention.
Claims
1. A method for constructing a multi-scale GCNN network model based on spatial pyramid pooling, characterized in that, include: Step 1: Data preprocessing; Obtain the CIFAR-100 dataset and preprocess the images in the CIFAR-100 dataset, wherein the preprocessing includes: image scaling, normalization, and data augmentation; Step 2: Network architecture design; In the GCNN model, a multi-scale input strategy is adopted, combining convolutional layers and spatial pyramid pooling layers to extract features from the preprocessed CIFAR-100 dataset images, and to construct a network structure that captures features at different scales and levels. Step 3: Model training; The cross-entropy loss function is used to evaluate classification differences, and the Adam optimizer is used to update parameters. The model weights are iterated through the backpropagation algorithm to perform multi-scale feature learning and optimization on the GCNN network model. Step 4: Model Evaluation and Optimization; The GCNN network model is evaluated and optimized according to the evaluation metrics, which include: accuracy, precision, recall, and F1 score. The image scaling includes: as the network grows from the input layer, the GCNN network performs a scaling operation on the input image, setting... For scaling ratio set, , This indicates that the network is in the input layer. The scaling ratio used to adjust the scale of the input image during each growth; when At that time, GCNN stopped growing; let the input image be... The output of the first scale-transformed convolutional layer and the output of the sampling layer ; in, This indicates a step size of 1 and a padding value of 1. Convolution kernel, This represents the convolution operation. Indicates bias. Represents the downsampling function. Indicates the size of the sampling layer. Represents the ReLU activation function; The output of the second scale-transform convolutional layer and the output of the sampling layer : ; The method of combining convolutional layers and spatial pyramid pooling layers to extract features from preprocessed CIFAR-100 dataset images includes: using spatial pyramid pooling layers (SPP) to process images of different sizes, where the number of spatial blocks in the second level of the SPP layer is set to... The output of the last convolutional layer The size is The sampling window size for the second level is... Step size is , and These represent the floor and floor operations, respectively. This means that the fixed-size window of the second sampling layer in GCNN has been changed to an adaptive window size, proportional to the input image. Assume the SPP layer contains... There are 1 pooling level, and the number of space blocks in each level is 1. Then the output of the entire SPP layer is Dimension, among which, This indicates the number of filters in the last convolutional layer. Through adaptive pooling and multi-level spatial pooling, input images of different scales are converted into feature vectors of fixed length.
2. The method for constructing a multi-scale GCNN network model based on spatial pyramid pooling according to claim 1, characterized in that, The standardization normalizes the pixel values of each image in the CIFAR-100 dataset to the range of [0,1]; the data augmentation involves randomly horizontally flipping, randomly cropping, color jittering, and adding noise to the images during training.
3. The method for constructing a multi-scale GCNN network model based on spatial pyramid pooling according to claim 1, characterized in that, The selection of the cross-entropy loss function to evaluate classification differences and the use of the Adam optimizer for parameter updates include: During training, the cross-entropy loss function is used to calculate the loss caused by the difference between the predicted probability distribution and the actual class of each sample; The Adam optimizer was used with an initial learning rate of 0.001 and parameters β1=0.9 and β2=0.
999. The model was trained for 100 epochs. In each epoch, mini-batch SGD with a batch size of 128 was used for training. At the end of each epoch, the validation loss and accuracy were calculated using the validation set.
4. The method for constructing a multi-scale GCNN network model based on spatial pyramid pooling according to claim 1, characterized in that, The evaluation of the GCNN network model based on evaluation metrics includes: The model was evaluated using a test dataset, and accuracy, precision, recall, and F1 score were calculated on the test set. The classification performance of the model for different categories was analyzed by plotting a confusion matrix. The scale invariance of the GCNN structure was evaluated by comparing the classification performance at different scales for input images at different scales.
5. The method for constructing a multi-scale GCNN network model based on spatial pyramid pooling according to claim 1, characterized in that, The optimization of the GCNN network model based on model evaluation metrics includes: Based on the model's evaluation metrics, adjust the number of pooling layers and spatial blocks in the SPP layer; adjust the adaptive window size and stride of the SPP layer based on the size of the input image; and use a learning rate decay strategy to ensure stable convergence of the model in the later stages of training.
Citation Information
Patent Citations
Remote sensing image classification method based on attention mechanism deep Contourlet network
CN110728224A
Occluded pedestrian re-identification method combining spatial transformation network and multi-scale feature extraction
CN112396036A