Method, device, equipment and storage medium for identifying object categories in images

Dynamic model pruning training driven by feature graph information entropy solves the problem of difficult deployment of convolutional neural networks on resource-constrained devices, improves recognition accuracy and efficiency, and saves memory and time.

CN114612719BActive Publication Date: 2025-09-26ZHEJIANG ZHONGZHIDA TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202210242523.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-11
Publication Date
2025-09-26
Estimated Expiration
2042-03-11

AI Technical Summary

Technical Problem

Existing convolutional neural networks are difficult to deploy on resource-constrained devices, the model's image recognition performance is poor, and it is difficult to balance pruning rate and accuracy, resulting in inaccurate recognition and a long time consumption.

Method used

A model pruning method based on feature graph information entropy is adopted. The target object category recognition model is obtained through round-by-round pruning training. The information entropy is used to measure the amount of feature graph information, and the filter weights are pruned dynamically. The training is carried out round by round and pruned in the last round.

Benefits of technology

This improves the model's image recognition performance, increases the accuracy of object type recognition, saves memory space, and reduces inference time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114612719B_ABST
    Figure CN114612719B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for identifying object categories in an image, comprising the following steps: receiving a target image to be identified; performing an identification operation on an object in the target image using a target object category identification model obtained through pruning training based on feature map information entropy to obtain a target object category; and outputting the target object category. Application of the method for identifying object categories in an image provided by the present invention improves the image recognition performance of the model, increases the accuracy of identifying the type of object in the image, saves memory space, and reduces inference time. The present invention also discloses an apparatus, device, and storage medium for identifying object categories in an image, which have corresponding technical effects.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image recognition technology, and in particular to a method, device, equipment and computer-readable storage medium for identifying object categories in an image. Background Art

[0002] Thanks to advances in deep learning theory, convolutional neural networks (CNNs) have become increasingly deep and widely used. Research on CNNs for image recognition is gaining increasing attention, demonstrating their significant advantages in this field. However, as CNNs' recognition performance improves, the model depth and parameters increase, resulting in increased space and computational complexity. Consequently, deploying deep neural network models on resource-constrained devices, such as smartphones and medical monitors, has become challenging. Consequently, extensive research has been conducted on network compression to adapt to devices with limited storage capacity.

[0003] Network pruning, the most commonly used model compression method, has been well-established on mainstream hardware. Its goal is to identify and remove unimportant weights or filters in a network model, generating a more compact subnetwork while minimizing performance loss. Therefore, determining the fundamentals of weight and filter importance is crucial for network pruning. However, while current filter pruning methods strive for higher pruning rates, they are limited by machine computation time, labor requirements, and the increasing loss of accuracy as the pruning rate increases. This results in a poor trade-off between pruning rate and model accuracy, leading to poor image recognition performance, inaccurate identification of object types in images, high memory usage, and time-consuming category inference.

[0004] In summary, how to effectively solve the problems of poor image recognition performance of the model, inaccurate recognition of the type of objects in the image, large memory space usage, and long category reasoning time is an issue that technicians in this field urgently need to solve. Summary of the Invention

[0005] The purpose of the present invention is to provide a method for identifying the category of objects in an image, which improves the image recognition performance of the model, improves the accuracy of identifying the type of objects in the image, saves memory space, and reduces reasoning time; another purpose of the present invention is to provide an apparatus, device and computer-readable storage medium for identifying the category of objects in an image.

[0006] In order to solve the above technical problems, the present invention provides the following technical solutions:

[0007] A method for identifying object categories in an image, comprising:

[0008] receiving a target image to be identified;

[0009] Using a target object category recognition model obtained by pruning training based on feature map information entropy, an object in the target image is recognized to obtain a target object category;

[0010] An output operation is performed on the target object category.

[0011] In a specific embodiment of the present invention, a pruning training process of the target object category recognition model is further included, and the pruning training process of the target object category recognition model includes:

[0012] The pre-built neural network model is trained using the pre-selected training image set to obtain the current object category recognition model;

[0013] Get the pruning rate and number of original output channels corresponding to each convolutional layer in the current object category recognition model;

[0014] Calculating the target number of pruned channels corresponding to each convolutional layer according to each pruning rate and each original output channel number;

[0015] Get the preset number of pruning rounds;

[0016] The current object category recognition model is pruned round by round in combination with the preset pruning round number and the target channel number to obtain the target object category recognition model.

[0017] In a specific embodiment of the present invention, performing a round-by-round pruning operation on the current object category recognition model in combination with the preset number of pruning rounds and the target number of channels includes:

[0018] Obtaining each feature map output by each convolutional layer;

[0019] Calculating the information entropy of each feature map to obtain the information entropy corresponding to each feature map;

[0020] For each convolutional layer, the information entropy is sorted by size to obtain a sorting result;

[0021] Calculating the difference between the original output channel number and the target channel number to obtain the pruned channel number;

[0022] According to the sorting result, the feature map of the number of pruned channels is selected from the end with the smaller information entropy, and each of the selected feature maps is determined as a target feature map;

[0023] Obtaining a model weight of a current object category recognition model; wherein the model weight includes a filter weight;

[0024] performing a zero operation on the filter weights corresponding to each of the target feature maps;

[0025] Determining whether the preset number of pruning rounds has been reached;

[0026] If not, performing a training operation on the current object category recognition model obtained by resetting the filter weights using the training image set to obtain the reset filter weights, and repeating the step of obtaining the feature maps output by each convolutional layer;

[0027] If so, a pruning operation is performed on the channels in each of the convolutional layers whose filter weights are zero.

[0028] In a specific embodiment of the present invention, information entropy calculation is performed on each of the feature maps to obtain information entropy corresponding to each of the feature maps, including:

[0029] For each convolutional layer, obtaining the maximum and minimum values ​​of the filter weights corresponding to each of the feature maps;

[0030] Get the preset number of partitions;

[0031] Calculating the weight span corresponding to each of the convolutional layers according to the maximum value, the minimum value, and the preset number of partitions;

[0032] Performing vector flattening operations on the filter weights corresponding to the feature maps to obtain target vectors;

[0033] Performing an average partitioning operation on each of the target vectors according to the preset number of partitions to obtain weighted partitions;

[0034] Calculating the probability that the filter weight corresponding to each feature map is in each weight partition according to the weight span, and obtaining each probability calculation result;

[0035] The information entropy corresponding to each of the feature maps is calculated according to the probability calculation results.

[0036] A device for identifying object categories in an image, comprising:

[0037] An image receiving module, configured to receive a target image to be identified;

[0038] An object category recognition module is used to perform an identification operation on the object in the target image using a target object category recognition model obtained by pruning training based on feature map information entropy to obtain the target object category;

[0039] The object category output module is used to perform output operations on the target object category.

[0040] In a specific embodiment of the present invention, a pruning training module is further included, and the pruning training module includes:

[0041] The model training submodule is used to train the pre-built neural network model using the pre-selected training image set to obtain the current object category recognition model;

[0042] The pruning rate and channel number acquisition submodule is used to obtain the pruning rate and original output channel number corresponding to each convolutional layer in the current object category recognition model;

[0043] A channel number calculation submodule is used to calculate the target number of channels after pruning corresponding to each convolutional layer according to each pruning rate and each original output channel number;

[0044] The pruning round number acquisition submodule is used to obtain the preset pruning round number;

[0045] The model pruning submodule is used to perform round-by-round pruning operations on the current object category recognition model in combination with the preset number of pruning rounds and the target number of channels to obtain the target object category recognition model.

[0046] In a specific embodiment of the present invention, the model pruning submodule includes:

[0047] A feature map acquisition unit, configured to acquire each feature map output by each convolutional layer;

[0048] An information entropy calculation unit is used to calculate the information entropy of each of the feature maps to obtain the information entropy corresponding to each of the feature maps;

[0049] A sorting result obtaining unit is used to sort the information entropy of each convolution layer to obtain a sorting result;

[0050] a pruned channel number calculation unit, configured to perform a difference calculation on the original output channel number and the target channel number to obtain the pruned channel number;

[0051] a feature map selection unit, configured to select, according to the sorting result, a feature map with a smaller number of pruned channels from the end with smaller information entropy, and determine each of the selected feature maps as a target feature map;

[0052] A model weight acquisition unit, configured to acquire a model weight of a current object category recognition model; wherein the model weight includes a filter weight;

[0053] A weight reset unit, used to reset the filter weights corresponding to each target feature map to zero;

[0054] A judging unit, configured to judge whether the preset number of pruning rounds has been reached;

[0055] a weight resetting unit configured to, when it is determined that the preset number of pruning rounds has not been reached, perform a training operation on the current object category recognition model obtained by resetting the filter weights using the training image set to obtain reset filter weights, and repeatedly perform the step of obtaining the feature maps output by each convolutional layer;

[0056] The channel pruning unit is configured to perform a pruning operation on the channels in each of the convolutional layers whose filter weights are zero when it is determined that the preset number of pruning rounds has been reached.

[0057] In a specific embodiment of the present invention, the information entropy calculation unit includes:

[0058] A maximum and minimum value acquisition subunit, configured to obtain, for each convolutional layer, the maximum and minimum values ​​of the filter weights corresponding to each of the feature maps;

[0059] A partition number acquisition subunit is used to obtain a preset partition number;

[0060] A weight span calculation subunit, configured to calculate the weight span corresponding to each of the convolutional layers according to the maximum value, the minimum value, and the preset number of partitions;

[0061] A vector obtaining subunit is used to perform vector flattening operations on the filter weights corresponding to each of the feature maps to obtain each target vector;

[0062] A weight partition obtaining subunit is used to perform an average partitioning operation on each of the target vectors according to the preset number of partitions to obtain each weight partition;

[0063] A probability calculation subunit, configured to calculate the probability that the filter weight corresponding to each of the feature maps is in each weight partition according to the weight span, and obtain each probability calculation result;

[0064] The information entropy calculation subunit is used to calculate the information entropy corresponding to each of the feature maps according to the probability calculation results.

[0065] A device for identifying object categories in an image, comprising:

[0066] memory for storing computer programs;

[0067] A processor is configured to implement the steps of the method for identifying the category of an object in an image as described above when executing the computer program.

[0068] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the method for identifying object categories in an image as described above.

[0069] The method for identifying object categories in an image provided by the present invention includes: receiving a target image to be identified; performing an identification operation on an object in the target image using a target object category identification model obtained by pruning training based on feature map information entropy to obtain a target object category; and outputting the target object category.

[0070] The above technical solution demonstrates that by using information entropy to characterize the information content of feature maps, effectively measuring the amount of information contained in the feature maps output by each layer of the neural network, and performing model pruning training based on information entropy to obtain a target object category recognition model, the model pruning operation has a more theoretical basis and significantly reduces the probability of model pruning errors. This achieves a good trade-off between pruning rate and model accuracy, improving the model's image recognition performance and the accuracy of identifying object types in images, saving memory space, and reducing inference time.

[0071] Correspondingly, the present invention also provides an apparatus, device and computer-readable storage medium for identifying object categories in images corresponding to the above-mentioned method for identifying object categories in images, which have the above-mentioned technical effects and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0072] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0073] Figure 1 1 is a flowchart of an implementation of a method for identifying object categories in an image according to an embodiment of the present invention;

[0074] Figure 2 is another implementation flow chart of the method for identifying object categories in an image in an embodiment of the present invention;

[0075] Figure 3 1 is a structural block diagram of a device for identifying object categories in an image according to an embodiment of the present invention;

[0076] Figure 4 This is a structural block diagram of a device for identifying object categories in an image according to an embodiment of the present invention;

[0077] Figure 5 This is a schematic diagram of the specific structure of a device for identifying object categories in an image provided by this embodiment. DETAILED DESCRIPTION

[0078] In order to enable those skilled in the art to better understand the present invention, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments. Obviously, the embodiments described are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0079] See also Figure 1 , Figure 1 This is a flowchart of an implementation of a method for identifying object categories in an image according to an embodiment of the present invention. The method may include the following steps:

[0080] S101: Receive a target image to be identified.

[0081] When it is necessary to identify the category of an object in an image, the target image to be identified is sent to the object category identification control center, and the object category identification control center receives the target image to be identified.

[0082] The object category recognition control center may be a pre-set controller capable of receiving an image to be recognized and controlling a processor pre-deployed with a model for recognizing the type of object in the image.

[0083] S102: Using the target object category recognition model obtained by pruning training based on feature map information entropy, an object in the target image is recognized to obtain the target object category.

[0084] The pre-established object category recognition model is pruned and trained based on the feature map information entropy to obtain a target object category recognition model. After receiving the target image to be recognized, the target object category recognition model obtained by pruning training based on the feature map information entropy is used to perform recognition operations on the object in the target image to obtain the target object category.

[0085] The object category recognition model may be a VGG-16 neural network model.

[0086] S103: Perform output operation on the target object category.

[0087] After identifying the target object category of the object in the target image, the target object category is output, allowing the user to clearly understand the target object category of the object in the target image. By pre-pruning the object category recognition model based on the information entropy of the feature map, the memory space occupied by the object category recognition model is saved and the time consumed by the object category inference operation is reduced.

[0088] The above technical solution demonstrates that by using information entropy to characterize the information content of feature maps, effectively measuring the amount of information contained in the feature maps output by each layer of the neural network, and performing model pruning training based on information entropy to obtain a target object category recognition model, the model pruning operation has a more theoretical basis and significantly reduces the probability of model pruning errors. This achieves a good trade-off between pruning rate and model accuracy, improving the model's image recognition performance and the accuracy of identifying object types in images, saving memory space, and reducing inference time.

[0089] It should be noted that, based on the above embodiment, the embodiment of the present invention also provides corresponding improved solutions. In subsequent embodiments, the same steps or corresponding steps as those in the above embodiment can be referenced to each other, and the corresponding beneficial effects can also be referenced to each other, and will not be described in detail in the following improved embodiments.

[0090] See also Figure 2 , Figure 2 FIG. 5 is another implementation flow chart of a method for identifying object categories in an image according to an embodiment of the present invention. The method may include the following steps:

[0091] S201: Using a pre-selected training image set to train a pre-built neural network model to obtain a current object category recognition model.

[0092] A neural network model is pre-built, and a training image set, such as CIFAR-10, is selected for training the neural network model. The pre-built neural network model is trained using the pre-selected training image set to obtain the current object category recognition model, i.e., the object category recognition model that has not undergone model pruning.

[0093] S202: Obtain the pruning rate and the number of original output channels corresponding to each convolutional layer in the current object category recognition model.

[0094] Pre-train each convolution layer L for the current object category recognition model i Set the pruning rate P i ∈[0,1), where i is the number of convolutional layers of the current object category recognition model. After training the current object category recognition model without model pruning, obtain the pruning rate and the number of original output channels N corresponding to each convolutional layer in the current object category recognition model. i+1 .

[0095] S203: Calculate the target number of pruned channels corresponding to each convolutional layer according to each pruning rate and each original output channel number.

[0096] After obtaining the pruning rate and the number of original output channels corresponding to each convolutional layer in the current object category recognition model, the number of target channels after pruning corresponding to each convolutional layer is calculated according to each pruning rate and each original output channel number, which is N i+1 ×(1-P i ).

[0097] S204: Obtain a preset number of pruning rounds.

[0098] The number of pruning rounds for the pre-trained object category recognition model is preset, and after calculating the target number of pruned channels corresponding to each convolutional layer, the preset number of pruning rounds is obtained.

[0099] S205: Performing round-by-round pruning operations on the current object category recognition model in combination with a preset number of pruning rounds and a target number of channels to obtain a target object category recognition model.

[0100] After calculating the target number of pruned channels for each convolutional layer and obtaining the preset number of pruning rounds, the current object category recognition model is pruned round by round based on the preset number of pruning rounds and the target number of channels to obtain the target object category recognition model. During the model pruning process, the information entropy of the feature maps output by each channel in each convolutional layer obtained during each training round can be used to determine the channels to be pruned.

[0101] In a specific embodiment of the present invention, a pruning operation is performed on the current object category recognition model in a round-by-round manner in combination with a preset number of pruning rounds and a target number of channels, including the following steps:

[0102] Step 1: Get the feature maps output by each convolutional layer;

[0103] Step 2: Calculate the information entropy of each feature map to obtain the information entropy corresponding to each feature map;

[0104] Step 3: For each convolutional layer, sort the information entropy to obtain the sorting result;

[0105] Step 4: Calculate the difference between the original output channel number and the target channel number to obtain the pruned channel number;

[0106] Step 5: According to the sorting results, select the feature map with the smallest number of pruned channels from the end with the smallest information entropy, and determine each selected feature map as the target feature map;

[0107] Step 6: Obtain the model weight of the current object category recognition model; wherein the model weight includes the filter weight;

[0108] Step 7: Set the filter weights corresponding to each target feature map to zero;

[0109] Step 8: Determine whether the preset number of pruning rounds has been reached. If not, proceed to step 9; if so, proceed to step 10.

[0110] Step 9: Use the training image set to train the current object category recognition model obtained by resetting the filter weights to obtain the reset filter weights, and repeat step 1;

[0111] Step 10: Prune the channels with zero filter weights in each convolutional layer.

[0112] For the convenience of description, the above ten steps can be combined for explanation.

[0113] After obtaining the preset number of pruning rounds and the target number of channels after pruning corresponding to each convolutional layer, obtain each feature map output by each convolutional layer, calculate the information entropy of each feature map, and obtain the information entropy corresponding to each feature map. For each convolutional layer, sort the information entropy by size to obtain the sorting result. Calculate the difference between the original output channel number and the target channel number to obtain the number of pruned channels, which is N i+1 ×P i . According to the sorting result, the feature map with the number of pruned channels is selected from the end with the smaller information entropy, and each selected feature map is determined as the target feature map. The model weight of the current object category recognition model is obtained. The model weight includes the filter weight. The filter weight corresponding to each target feature map is reset to zero, that is, the channel corresponding to each target feature map is pre-pruned but not truly pruned. Determine whether the preset pruning round number epoch has been reached. If not, it means that the number of model pruning training rounds has not reached the originally set number of rounds, and pruning training needs to be continued. The current object category recognition model obtained by resetting the filter weights using the training image set is trained to obtain the reset filter weights, and the feature maps output by each convolutional layer are obtained to continue the next round of pruning training. If so, it means that the number of model pruning training rounds has reached the originally set number of rounds, and the pruning training is completed. The channels with zero filter weights in each convolutional layer are pruned. By resetting the filter weights to zero instead of removing them in each round of pruning training, the filter weights that were reset to zero in the previous round will have a chance to be reset to non-zero weights during the model training before each round of pruning. Only after the last round of pruning will the N weights of each convolutional layer in the obtained model be removed. i+1 ×P i filters to obtain the pruned compressed model.

[0114] The neural network pruning method based on feature graph information entropy provided by an embodiment of the present invention uses the concept of information entropy to measure the amount of information contained in a feature graph. During the pruning process, this method employs a dynamic pruning approach. After loading the weights of a pre-trained model, the model is re-trained and the weights of unimportant channel filters are reset to zero in each round. After a preset number of training and pruning rounds, the filters with zero weights are removed in the final round. This method achieves a good compromise between increased pruning rate and loss of model accuracy, effectively alleviating the impact of increased pruning rate on model accuracy in traditional pruning algorithms, saving memory space, and reducing inference time.

[0115] It should be noted that the method for sorting the information entropies may be from small to large or from large to small, and the embodiment of the present invention does not limit this.

[0116] In a specific embodiment of the present invention, performing information entropy calculation on each feature map to obtain the information entropy corresponding to each feature map may include the following steps:

[0117] Step 1: For each convolutional layer, obtain the maximum and minimum values ​​of the filter weights corresponding to each feature map;

[0118] Step 2: Get the preset number of partitions;

[0119] Step 3: Calculate the weight span corresponding to each convolutional layer based on the maximum value, minimum value and preset number of partitions;

[0120] Step 4: Perform vector flattening operations on the filter weights corresponding to each feature map to obtain each target vector;

[0121] Step 5: Perform average partitioning operations on each target vector according to the preset number of partitions to obtain weighted partitions;

[0122] Step 6: Calculate the probability that the filter weight corresponding to each feature map is in each weight partition according to the weight span, and obtain the calculation results of each probability;

[0123] Step 7: Calculate the information entropy corresponding to each feature map based on the probability calculation results.

[0124] For the convenience of description, the above seven steps can be combined for explanation.

[0125] After obtaining the output size of each convolutional layer as h i ×w i Each feature map of After that, for each convolutional layer, obtain the filter weights corresponding to each feature map and obtain the maximum value of each filter weight and minimum value Get the preset number of partitions n, set n = 10, and calculate the weight span corresponding to each convolution layer according to the maximum value, minimum value and the preset number of partitions Perform vector flattening operations on the filter weights corresponding to each feature map to obtain the target vectors The probability that the filter weights corresponding to each feature map are in each weight partition is calculated according to the weight span, and the probability calculation results are obtained. The probability that the filter weights corresponding to each feature map are in each weight partition can be calculated by the following formula:

[0126]

[0127] After obtaining the probability calculation results, the information entropy corresponding to each feature map is calculated based on the probability calculation results. The information entropy corresponding to each feature map can be calculated using the following formula:

[0128]

[0129] This completes the calculation of the information entropy of each feature map.

[0130] The embodiment of the present invention dynamically prunes the pre-established object category recognition model, and does not change the channel size of the model during the epoch training and pruning phase, so that each layer of the model pruning is based on the complete original model, which is more conducive to model training and the selection of the final compression model. Only in the last round are the filters whose weights are reset to zero removed to obtain the final compression model, and there is no need to further retrain on the dataset to recover the accuracy loss, thus saving time. In addition, the embodiment of the present invention adopts filter-level pruning, which is a structural pruning method. The pruned model obtained through structural pruning only requires a basic linear algebra subroutine library to achieve performance improvement, which is more flexible in actual implementation.

[0131] S206: Receive a target image to be identified.

[0132] S207: Using the target object category recognition model obtained by pruning training based on the feature map information entropy, a recognition operation is performed on the object in the target image to obtain the target object category.

[0133] S208: Perform output operation on the target object category.

[0134] Corresponding to the above method embodiment, the present invention further provides a device for identifying object categories in an image. The device for identifying object categories in an image described below and the method for identifying object categories in an image described above can refer to each other.

[0135] See also Figure 3 , Figure 3This is a structural block diagram of a device for identifying object categories in an image according to an embodiment of the present invention. The device may include:

[0136] An image receiving module 31 is used to receive a target image to be identified;

[0137] An object category recognition module 32 is configured to perform a recognition operation on an object in a target image using a target object category recognition model obtained by pruning training based on feature map information entropy to obtain a target object category;

[0138] The object category output module 33 is used to output the target object category.

[0139] The above technical solution demonstrates that by using information entropy to characterize the information content of feature maps, effectively measuring the amount of information contained in the feature maps output by each layer of the neural network, and performing model pruning training based on information entropy to obtain a target object category recognition model, the model pruning operation has a more theoretical basis and significantly reduces the probability of model pruning errors. This achieves a good trade-off between pruning rate and model accuracy, improving the model's image recognition performance and the accuracy of identifying object types in images, saving memory space, and reducing inference time.

[0140] In a specific embodiment of the present invention, a pruning training module is further included, and the pruning training module includes:

[0141] The model training submodule is used to train the pre-built neural network model using the pre-selected training image set to obtain the current object category recognition model;

[0142] The pruning rate and channel number acquisition submodule is used to obtain the pruning rate and original output channel number corresponding to each convolutional layer in the current object category recognition model;

[0143] The channel number calculation submodule is used to calculate the target number of channels after pruning for each convolutional layer based on the pruning rate and the number of original output channels;

[0144] The pruning round number acquisition submodule is used to obtain the preset pruning round number;

[0145] The model pruning submodule is used to perform round-by-round pruning operations on the current object category recognition model in combination with the preset number of pruning rounds and the target number of channels to obtain the target object category recognition model.

[0146] In a specific embodiment of the present invention, the model pruning submodule includes:

[0147] A feature map acquisition unit, used to obtain each feature map output by each convolutional layer;

[0148] An information entropy calculation unit is used to calculate the information entropy of each feature map respectively to obtain the information entropy corresponding to each feature map;

[0149] The sorting result obtaining unit is used to sort the information entropy of each convolution layer to obtain the sorting result;

[0150] A pruning channel number calculation unit is used to calculate the difference between the original output channel number and the target channel number to obtain the pruned channel number;

[0151] A feature map selection unit is used to select a feature map with a smaller number of pruned channels from the end with smaller information entropy according to the sorting result, and determine each selected feature map as a target feature map;

[0152] A model weight acquisition unit, configured to acquire the model weight of the current object category recognition model; wherein the model weight includes the filter weight;

[0153] The weight reset unit is used to reset the filter weights corresponding to each target feature map to zero;

[0154] A judgment unit, used to judge whether a preset number of pruning rounds has been reached;

[0155] a weight resetting unit configured to, when it is determined that the preset number of pruning rounds has not been reached, perform a training operation on the current object category recognition model obtained by resetting the filter weights using the training image set to obtain reset filter weights, and repeatedly execute the step of obtaining feature maps output by each convolutional layer;

[0156] The channel pruning unit is used to prune the channels with zero filter weights in each convolutional layer when it is determined that a preset number of pruning rounds has been reached.

[0157] In a specific embodiment of the present invention, the information entropy calculation unit includes:

[0158] The maximum and minimum value acquisition subunit is used to obtain the maximum and minimum values ​​of the filter weights corresponding to each feature map for each convolutional layer;

[0159] A partition number acquisition subunit is used to obtain a preset partition number;

[0160] The weight span calculation subunit is used to calculate the weight span corresponding to each convolutional layer according to the maximum value, minimum value and preset number of partitions;

[0161] The vector acquisition subunit is used to perform vector flattening operations on the filter weights corresponding to each feature map to obtain each target vector;

[0162] The weight partition obtaining subunit is used to perform an average partitioning operation on each target vector according to a preset number of partitions to obtain each weight partition;

[0163] The probability calculation subunit is used to calculate the probability that the filter weight corresponding to each feature map is in each weight partition according to the weight span, and obtain the probability calculation results;

[0164] The information entropy calculation subunit is used to calculate the information entropy corresponding to each feature map according to the probability calculation results.

[0165] Corresponding to the above method embodiment, see Figure 4 , Figure 4 This is a schematic diagram of a device for identifying object categories in an image provided by the present invention. The device may include:

[0166] Memory 332, for storing computer programs;

[0167] The processor 322 is configured to implement the steps of the method for identifying the category of an object in an image in the above method embodiment when executing a computer program.

[0168] For details, please refer to Figure 5 , Figure 5 The present embodiment provides a schematic diagram of the specific structure of a device for identifying the category of an object in an image. The device for identifying the category of an object in an image may vary greatly due to different configurations or performances. The device may include a processor (central processing unit, CPU) 322 (for example, one or more processors) and a memory 332. The memory 332 stores one or more computer applications 342 or data 344. The memory 332 may be a temporary storage or a permanent storage. The program stored in the memory 332 may include one or more modules (not shown in the figure), each of which may include a series of instruction operations in the data processing device. Furthermore, the processor 322 may be configured to communicate with the memory 332 to execute a series of instruction operations in the memory 332 on the device 301 for identifying the category of an object in an image.

[0169] The device 301 for identifying object categories in images may further include one or more power supplies 326 , one or more wired or wireless network interfaces 350 , one or more input and output interfaces 358 , and / or one or more operating systems 341 .

[0170] The steps in the method for identifying the category of an object in an image described above can be implemented by the structure of a device for identifying the category of an object in an image.

[0171] Corresponding to the above method embodiment, the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the following steps can be implemented:

[0172] A target image to be identified is received; an object in the target image is identified using a target object category recognition model obtained by pruning training based on feature map information entropy to obtain a target object category; and the target object category is output.

[0173] The computer-readable storage medium may include: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, etc., which can store program codes.

[0174] For an introduction to the computer-readable storage medium provided by the present invention, please refer to the above method embodiment, and the present invention will not elaborate on it here.

[0175] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from the other embodiments. References to the same or similar parts between the various embodiments are sufficient. The devices, apparatuses, and computer-readable storage media disclosed in the embodiments are described briefly because they correspond to the methods disclosed in the embodiments. For relevant details, refer to the description of the methods.

[0176] This document uses specific examples to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only intended to help understand the technical solutions and core concepts of the present invention. It should be noted that those skilled in the art can make various improvements and modifications to the present invention without departing from the principles of the present invention, and such improvements and modifications also fall within the scope of protection of the claims of the present invention.

Claims

1. A method for identifying object categories in an image, characterized in that: include: receiving a target image to be identified; Using a target object category recognition model obtained by pruning training based on feature map information entropy, an object in the target image is recognized to obtain a target object category; performing an output operation on the target object category; The method further includes a pruning training process for the target object category recognition model, wherein the pruning training process for the target object category recognition model includes: The pre-built neural network model is trained using the pre-selected training image set to obtain the current object category recognition model; Get the pruning rate and original output channel number corresponding to each convolutional layer in the current object category recognition model; Calculating the target number of pruned channels corresponding to each convolutional layer according to each pruning rate and each original output channel number; Get the preset number of pruning rounds; Performing round-by-round pruning operations on the current object category recognition model in combination with the preset pruning round number and the target channel number to obtain the target object category recognition model; Performing a round-by-round pruning operation on the current object category recognition model in combination with the preset number of pruning rounds and the target number of channels includes: Obtaining each feature map output by each convolutional layer; Calculating the information entropy of each feature map to obtain the information entropy corresponding to each feature map; For each convolutional layer, sort the information entropy by size to obtain a sorting result; Calculating the difference between the original output channel number and the target channel number to obtain the pruned channel number; According to the sorting result, the feature map of the number of pruned channels is selected from the end with the smaller information entropy, and each of the selected feature maps is determined as a target feature map; Obtaining a model weight of a current object category recognition model; wherein the model weight includes a filter weight; performing a zero operation on the filter weights corresponding to each of the target feature maps; Determining whether the preset number of pruning rounds has been reached; If not, performing a training operation on the current object category recognition model obtained by resetting the filter weights using the training image set to obtain the reset filter weights, and repeating the step of obtaining the feature maps output by each convolutional layer; If so, a pruning operation is performed on the channels in each of the convolutional layers whose filter weights are zero.

2. The method for identifying object categories in an image according to claim 1, wherein: The information entropy of each feature map is calculated to obtain the information entropy corresponding to each feature map, including: For each convolutional layer, obtaining the maximum and minimum values ​​of the filter weights corresponding to each of the feature maps; Get the preset number of partitions; Calculating the weight span corresponding to each of the convolutional layers according to the maximum value, the minimum value, and the preset number of partitions; Performing vector flattening operations on the filter weights corresponding to the feature maps to obtain target vectors; Performing an average partitioning operation on each of the target vectors according to the preset number of partitions to obtain weighted partitions; Calculating the probability that the filter weight corresponding to each feature map is in each weight partition according to the weight span, and obtaining each probability calculation result; The information entropy corresponding to each of the feature maps is calculated according to the probability calculation results.

3. A device for identifying object categories in an image, characterized in that: include: An image receiving module, configured to receive a target image to be identified; An object category recognition module is used to perform an identification operation on the object in the target image using a target object category recognition model obtained by pruning training based on feature map information entropy to obtain the target object category; An object category output module, configured to output the target object category; It also includes a pruning training module, which includes: The model training submodule is used to train the pre-built neural network model using the pre-selected training image set to obtain the current object category recognition model; The pruning rate and channel number acquisition submodule is used to obtain the pruning rate and original output channel number corresponding to each convolutional layer in the current object category recognition model; A channel number calculation submodule is used to calculate the target number of channels after pruning corresponding to each convolutional layer according to each pruning rate and each original output channel number; The pruning round number acquisition submodule is used to obtain the preset pruning round number; a model pruning submodule, configured to perform a round-by-round pruning operation on the current object category recognition model in combination with the preset number of pruning rounds and the target number of channels to obtain the target object category recognition model; The model pruning submodule includes: A feature map acquisition unit, configured to acquire each feature map output by each convolutional layer; An information entropy calculation unit is used to calculate the information entropy of each of the feature maps to obtain the information entropy corresponding to each of the feature maps; A sorting result obtaining unit is used to sort the information entropy of each convolution layer to obtain a sorting result; a pruned channel number calculation unit, configured to perform a difference calculation on the original output channel number and the target channel number to obtain the pruned channel number; a feature map selection unit, configured to select, according to the sorting result, a feature map with a smaller number of pruned channels from the end with smaller information entropy, and determine each of the selected feature maps as a target feature map; A model weight acquisition unit, configured to acquire a model weight of a current object category recognition model; wherein the model weight includes a filter weight; A weight reset unit, used to reset the filter weights corresponding to each target feature map to zero; A judging unit, configured to judge whether the preset number of pruning rounds has been reached; a weight resetting unit configured to, when it is determined that the preset number of pruning rounds has not been reached, perform a training operation on the current object category recognition model obtained by resetting the filter weights using the training image set to obtain reset filter weights, and repeatedly perform the step of obtaining the feature maps output by each convolutional layer; The channel pruning unit is configured to perform a pruning operation on the channels in each of the convolutional layers whose filter weights are zero when it is determined that the preset number of pruning rounds has been reached.

4. The device for identifying object categories in an image according to claim 3, wherein: The information entropy calculation unit includes: A maximum and minimum value acquisition subunit, configured to obtain, for each convolutional layer, the maximum and minimum values ​​of the filter weights corresponding to each of the feature maps; A partition number acquisition subunit is used to obtain a preset partition number; A weight span calculation subunit, configured to calculate the weight span corresponding to each of the convolutional layers according to the maximum value, the minimum value, and the preset number of partitions; A vector obtaining subunit is used to perform vector flattening operations on the filter weights corresponding to each of the feature maps to obtain each target vector; A weight partition obtaining subunit is used to perform an average partitioning operation on each of the target vectors according to the preset number of partitions to obtain each weight partition; A probability calculation subunit, configured to calculate the probability that the filter weight corresponding to each of the feature maps is in each weight partition according to the weight span, and obtain each probability calculation result; The information entropy calculation subunit is used to calculate the information entropy corresponding to each of the feature maps according to the probability calculation results.

5. A device for identifying object categories in an image, characterized in that: include: memory for storing computer programs; A processor, configured to implement the steps of the method for identifying the category of an object in an image as claimed in any one of claims 1 to 2 when executing the computer program.

6. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the method for identifying the category of an object in an image according to any one of claims 1 to 2.

Citation Information

Patent Citations

  • Target detection method and device

    CN108010060A

  • Data processing method and device and storage medium

    CN111062477A

  • Class-based filter pruning method

    CN113850373A

  • Convolutional neural network channel pruning method

    CN113902113A