Target classification method and system based on a sparsified network
By using a sparse network method, the sparsity ratio is determined iteratively by binary division to prune the target classification network, which solves the problems of lengthy pruning process and impact on accuracy, and achieves efficient classification and resource conservation.
Patent Information
- Application Number
- CN202111466781.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-03
- Publication Date
- 2025-11-25
- Estimated Expiration
- 2041-12-03
AI Technical Summary
In existing technologies, the pruning process of target classification networks is lengthy and has a significant impact on classification accuracy, resulting in a bottleneck in classification efficiency.
A sparse network approach is adopted, which determines the sparsity of the original layer through a binary search iterative method. The network is then pruned based on the classification accuracy threshold and replaced with sparse layers to form a sparse network for target classification.
While ensuring classification accuracy, an efficient pruned network structure can improve running speed and reduce computing resource requirements.
Smart Images

Figure CN114399656B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of target classification, and particularly relates to a target classification method and system based on a sparse network. BACKGROUND
[0002] The task of target classification is to identify the category of objects in a picture (in some cases, the confidence corresponding to the category is also given), and common methods include using HoG and SIFT features of an image in combination with an SVM classifier, a traditional BP neural network algorithm, and a convolutional neural network algorithm.
[0003] In the above method, target classification based on a convolutional neural network generally has better accuracy, but similar target classification networks involve many parameters and relatively complex operation processes, and often have a bottleneck in classification efficiency.
[0004] A feasible method for improving the classification efficiency of a target classification network is to prune (i.e., sparsify) the network, and ignore relatively unimportant parameters and calculation processes in the network, so as to achieve better classification efficiency.
[0005] However, the pruning process of the prior art for a target classification network is quite dependent on empirical parameters, and thus leads to a long pruning process and a high impact on classification accuracy, and therefore, how to provide a target classification method based on efficient pruning has become a technical problem that needs to be solved in the industry. SUMMARY
[0006] The present application provides a target classification method and system based on a sparse network, to solve the defects of a long pruning process and a high impact on classification accuracy in the prior art, and to realize target classification based on efficient pruning.
[0007] The present application provides a target classification method based on a sparse network, comprising:
[0008] obtaining an input image;
[0009] inputting the input image into a sparse network to obtain a target classification result;
[0010] The sparse network refers to a network in which a sparse layer is used to replace an original layer of a classification network; the classification network is trained based on samples and labels; the sparse layer is obtained by sparsifying the parameters of the original layer according to a sparsity of the original layer; and the sparsity of the original layer is determined based on a bisection method iteration with a classification accuracy threshold of the classification network as a constraint.
[0011] According to the target classification method based on a sparse network provided by the present application, the sparsity of the original layer is determined based on the following steps:
[0012] sparsify the original layer parameters with a set of iterative sparsity;
[0013] If the classification accuracy of the classification network after sparsification is less than the classification accuracy threshold, the iterative sparsity is updated downward based on the dichotomy; if the classification accuracy of the classification network after sparsification is not less than the classification accuracy threshold, the iterative sparsity is updated upward based on the dichotomy.
[0014] The step of sparsifying the original layer parameters with a set of iterative sparsity is iterated until a set of iterative stop conditions is met, and then the iterative sparsity is determined as the sparsity of the original layer.
[0015] According to the target classification method based on a sparsified network provided by the application, before the step of sparsifying the original layer parameters with a set of iterative sparsity, the method further comprises:
[0016] If it is determined that the classification accuracy of the classification network after sparsification with the detection sparsity belongs to a set of exit conditions, the iteration is stopped and the sparsity of the original layer is determined as 0.
[0017] The detection sparsity is a set of sparsities.
[0018] According to the target classification method based on a sparsified network provided by the application, the step of updating the iterative sparsity downward based on the dichotomy if the classification accuracy of the classification network after sparsification is less than the classification accuracy threshold comprises:
[0019] The left boundary of the sparsity and the right boundary of the sparsity are determined; the left boundary of the sparsity is less than the right boundary of the sparsity.
[0020] If the classification accuracy of the classification network after sparsification is less than the classification accuracy threshold, the right boundary of the sparsity is updated as the iterative sparsity, and the mean value of the iterative sparsity and the left boundary of the sparsity is taken as the updated iterative sparsity.
[0021] According to the target classification method based on a sparsified network provided by the application, the step of updating the iterative sparsity upward based on the dichotomy if the classification accuracy of the classification network after sparsification is not less than the classification accuracy threshold comprises:
[0022] The left boundary of the sparsity and the right boundary of the sparsity are determined; the left boundary of the sparsity is less than the right boundary of the sparsity.
[0023] If the classification accuracy of the classification network after sparsification is not less than the classification accuracy threshold, the left boundary of the sparsity is updated as the iterative sparsity, and the mean value of the iterative sparsity and the right boundary of the sparsity is taken as the updated iterative sparsity.
[0024] According to the target classification method based on the sparse network provided by the application, the input image is collected by a vehicle-mounted image collection device; and the target classification result is a traffic signal lamp classification result, including a red traffic light, a red read-second traffic light, a yellow traffic light, a yellow read-second traffic light, a green traffic light or a green read-second traffic light.
[0025] The application further provides a target classification system based on a sparse network, comprising:
[0026] An acquisition module is configured to acquire an input image.
[0027] A classification module is configured to input the input image into a sparse network to obtain a target classification result.
[0028] The sparse network refers to a network in which an original layer of a classification network is replaced by a sparse layer; the classification network is trained based on samples and labels; the sparse layer is obtained by sparsifying parameters of the original layer according to a sparsity of the original layer; and the sparsity of the original layer is determined based on a bisection method with a classification accuracy threshold of the classification network as a constraint.
[0029] The application further provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the target classification method based on the sparse network according to any one of the above embodiments when executing the program.
[0030] The application further provides a non-transitory computer-readable storage medium having a computer program stored thereon, wherein the computer program is executable on a processor to implement the steps of the target classification method based on the sparse network according to any one of the above embodiments.
[0031] The application further provides a computer program product comprising a computer program, wherein the computer program is executable on a processor to implement the steps of the target classification method based on the sparse network according to any one of the above embodiments.
[0032] The target classification method and system based on the sparse network provided by the application can determine the sparsity of the original layer by using the bisection method, can give different sparsity values according to the importance (the degree of influence on the final accuracy of the classification network) of different original layers, and can sparsify the original layer according to the sparsity to obtain a sparse layer on this basis. The method of implementing target classification by using the sparse network comprising the sparse layer can efficiently prune the network structure under the premise of ensuring the classification accuracy, thereby further improving the running speed of the network and reducing the demand for computing resources. BRIEF DESCRIPTION OF DRAWINGS
[0033] In order to make the technical solutions in the present application or the prior art clearer, the accompanying drawings needed in the embodiments or prior art description will be briefly introduced. Obviously, the accompanying drawings in the following description are only some embodiments of the present application, and all other drawings obtained by those of ordinary skill in the art without creative work based on these drawings also belong to the protection scope of the present application.
[0034] Figure 1 is a flowchart of the target classification method based on the sparse network provided by the present application;
[0035] Figure 2 is a dynamic step flowchart provided by an embodiment of the present application;
[0036] Figure 3 is a raw layer sparse flowchart provided by an embodiment of the present application;
[0037] Figure 4 is a structural diagram of an electronic device provided by the present application;
[0038] Figure 5 is a structural diagram of the target classification system based on the sparse network provided by the present application.
[0039] Reference signs:
[0040] 1: acquisition module; 2: classification module; 410: processor;
[0041] 420: communication interface; 430: memory; 440: communication bus. DETAILED DESCRIPTION
[0042] In order to make the technical solutions in the present application or the prior art clearer, the accompanying drawings needed in the embodiments or prior art description will be briefly introduced. Obviously, the accompanying drawings in the following description are only some embodiments of the present application, and all other drawings obtained by those of ordinary skill in the art without creative work based on these drawings also belong to the protection scope of the present application.
[0043] The present application will be described below in combination with Figure 1 , Figure 2 a target classification method based on a sparse network.
[0044] As shown in Figure 1 , an embodiment of the present application provides a target classification method based on a sparse network, comprising:
[0045] Step 200, acquiring an input image;
[0046] Step 400, input the input image into the sparsification network to obtain a target classification result.
[0047] The sparsification network refers to a network in which a sparsification layer is used to replace an original layer of a classification network; the classification network is trained based on samples and labels; the sparsification layer is obtained by sparsifying parameters of the original layer according to a sparsity of the original layer; and the sparsity of the original layer is determined based on bisection iteration with a classification accuracy threshold of the classification network as a constraint.
[0048] Further, Figure 2 The method of the embodiment is shown in the form of dynamic steps, including:
[0049] Step 102, for any original layer of the classification network, a sparsity of the original layer is determined based on bisection iteration with a classification accuracy threshold of the classification network as a constraint, and parameters of the original layer are sparsified according to the sparsity of the original layer to obtain a sparsification layer.
[0050] Step 104, the original layer of the classification network is replaced by the sparsification layer to obtain a sparsification network.
[0051] Step 106, the input image is run in the sparsification network to obtain a target classification result.
[0052] The classification network is trained based on samples and labels.
[0053] In the embodiment, the classification network is a trained network, and the execution of steps 102 and 104 can sparsify (i.e., prune) the trained classification network, thereby reducing relatively redundant parameters in the classification network and further reducing the calculation resource requirement of the classification network and increasing the classification efficiency.
[0054] The constraint condition of step 102, i.e., the classification accuracy threshold of the classification network, refers to a threshold for constraining the classification accuracy of the classification network when any original layer is sparsified at a given sparsity and other original layer structures remain unchanged.
[0055] The specific form of the classification accuracy threshold can be a form in which an absolute value of the classification accuracy of the classification network when any original layer is sparsified at a given sparsity and other original layer structures remain unchanged is set as a threshold; or a form in which a difference between the classification accuracy of the classification network when any original layer is sparsified at a given sparsity and other original layer structures remain unchanged and the original accuracy of the classification network is set as a threshold.
[0056] In the embodiment, the sparsity is defined as a ratio of the number of pruned parameters to the number of original parameters.
[0057] In a preferred embodiment, before step 106 is performed, the target classification method based on the sparsification network further comprises:
[0058] The sparsification network is secondarily trained based on the secondary training samples and the secondary training labels.
[0059] That is, the present embodiment comprises the following steps in sequence: classification network construction, first training, sensitivity analysis to determine the sparsity of each layer (step 102), pruning to obtain a sparsification network (step 104), second training, and application of inference (step 106).
[0060] In a preferred embodiment, step 102 is performed for each original layer of the classification network, so as to determine the sparsity corresponding to each original layer of the classification network, and further sparsify each original layer of the classification network based on the corresponding sparsity to obtain a sparsification network.
[0061] The present embodiment has the following beneficial effects:
[0062] By determining the sparsity of the original layer by dichotomy, different sparsity values can be given to different original layers according to their importance (degree of influence on the final accuracy of the classification network), and on this basis, the original layer is sparsified at the sparsity to obtain a sparsification layer, and the method of using the sparsification network comprising the sparsification layer to realize target classification can efficiently prune the network structure while ensuring the classification accuracy, thereby further improving the running speed of the network and reducing the demand for computing resources.
[0063] According to the above embodiment, in the present embodiment:
[0064] The sparsity of the original layer is determined based on the following steps (i.e., the step of determining the sparsity of the original layer based on the classification accuracy threshold of the classification network as a constraint by dichotomy iteration comprises):
[0065] The parameters of the original layer are sparsified at the set iteration sparsity;
[0066] If the classification accuracy of the classification network after sparsification is less than the classification accuracy threshold, the iteration sparsity is updated downward based on dichotomy; if the classification accuracy of the classification network after sparsification is not less than the classification accuracy threshold, the iteration sparsity is updated upward based on dichotomy;
[0067] The step of sparsifying the parameters of the original layer at the set iteration sparsity is iterated until the set iteration stop condition is met, and the iteration sparsity is determined as the sparsity of the original layer.
[0068] If the classification accuracy of the classification network after the sparsification is less than the classification accuracy threshold, then the step of updating the iterative sparsity based on the dichotomy downward comprises:
[0069] determining a sparsity left boundary and a sparsity right boundary; the sparsity left boundary is less than the sparsity right boundary;
[0070] If the classification accuracy of the classification network after the sparsification is less than the classification accuracy threshold, then the sparsity right boundary is updated as the iterative sparsity, and the mean of the iterative sparsity and the sparsity left boundary is taken as the updated iterative sparsity.
[0071] If the classification accuracy of the classification network after the sparsification is not less than the classification accuracy threshold, then the step of updating the iterative sparsity based on the dichotomy upward comprises:
[0072] determining a sparsity left boundary and a sparsity right boundary; the sparsity left boundary is less than the sparsity right boundary;
[0073] If the classification accuracy of the classification network after the sparsification is not less than the classification accuracy threshold, then the sparsity left boundary is updated as the iterative sparsity, and the mean of the iterative sparsity and the sparsity right boundary is taken as the updated iterative sparsity.
[0074] In a preferred embodiment, the iteration stopping condition can be that the number of iterations reaches a set iteration upper limit, or that the difference between the iterative sparsities in adjacent iteration steps is less than a set iteration difference threshold, or that the difference between the sparsity left boundary and the sparsity right boundary is less than a set iteration difference threshold.
[0075] Further, as shown in FIG. 10, the embodiment also gives another original layer sparsification process, which specifically comprises: Figure 3
[0076] Step 1021, setting a rough division sparsity table;
[0077] In a preferred embodiment, the rough division sparsity table R0=[r1, r2…rm] is set, where ri is the ith sparsity value in the rough division sparsity table, m is the number of elements in the rough division sparsity table, and r1, r2…rm take values increasing in turn; m i m
[0078] Step 1022, sparsifying the initial layer with the ith sparsity value in the rough division sparsity table and calculating the first accuracy of the classification network; where i is the ordering number of the sparsity value from small to large, and the initial value is 1;
[0079] Step 1023, determining whether the difference between the first accuracy rate and the original accuracy rate of the classification model is greater than a first threshold value: if yes, updating i=i+1 and returning to step 1022; if no, entering step 1024;
[0080] It is worth noting that the difference between the first accuracy rate and the original accuracy rate of the classification model is obtained by subtracting the first accuracy rate from the original accuracy rate of the classification model;
[0081] In a preferred embodiment, the determination of step 1023 can also be based on the absolute value threshold of the first accuracy rate, that is, determining whether the first accuracy rate is greater than a set threshold value;
[0082] Step 1024, setting the maximum value as the i-th sparse rate value in the coarse division sparse rate table, defining a fine division sparse rate table including n elements, and sorting the sparse rate values from small to large; defining the first element as the left boundary and the n-th element as the right boundary;
[0083] Step 1025, determining whether the left boundary sequence number is not greater than the right boundary sequence number: if yes, entering step 1026; if no, entering step 1028;
[0084] Step 1026, using the j-th element in the fine division sparse rate table to sparsify the initial layer, and calculating the second accuracy rate of the classification network; wherein j is the value obtained by rounding down the average of the left boundary sequence number and the right boundary sequence number;
[0085] Step 1027, determining whether the difference between the second accuracy rate and the original accuracy rate of the classification model is less than a second threshold value: if yes, updating the left boundary sequence number to j+1 and returning to step 1025; if no, updating the right boundary sequence number to j-1 and returning to step 1025;
[0086] It is worth noting that the difference between the second accuracy rate and the original accuracy rate of the classification model is obtained by subtracting the second accuracy rate from the original accuracy rate of the classification model;
[0087] In a preferred embodiment, the determination of step 1027 can also be based on the absolute value threshold of the second accuracy rate, that is, determining whether the second accuracy rate is greater than a set threshold value;
[0088] Step 1028, determining the sparse rate value of the initial layer as the value of the j-th element in the fine division sparse rate table.
[0089] The above process can further improve the execution efficiency of step 102 by dividing the determination process of the sparse rate into coarse division and fine division on the basis of the traditional dichotomy, so as to determine the sparse rate of the original layer more quickly and efficiently.
[0090] According to any of the above embodiments, in the present embodiment:
[0091] Before the step of sparsifying the original layer parameter with the set iteration sparsity, further comprising (i.e. before the step of determining the sparsity of the original layer based on bisection iteration with the classification accuracy threshold of the classification network as constraint for any original layer of the classification network) :
[0092] If it is determined that the classification accuracy of the classification network after sparsifying the original layer with the detection sparsity belongs to the set exit set, the iteration is stopped and the sparsity of the original layer is determined as 0;
[0093] The detection sparsity is a set sparsity.
[0094] The embodiment further adds the step of early stopping based on the bisection method of determining the sparsity of the original layer, and determines the importance (i.e. the influence on the classification accuracy of the classification network) of the original layer by setting a relatively low detection sparsity, and if the classification accuracy of the classification network decreases relatively high (or the absolute value is relatively low) after sparsifying the original layer with the detection sparsity, the original layer is determined as an important layer, and the sparsification operation of the layer is terminated. The method of the embodiment can further improve the sparsification efficiency on the basis of the above embodiment.
[0095] Further, in a preferred embodiment, the input image is obtained by a vehicle-mounted image acquisition device; and the target classification result is a traffic signal lamp classification result, including a red traffic light, a red read-second traffic light, a yellow traffic light, a yellow read-second traffic light, a green traffic light or a green read-second traffic light.
[0096] The target classification device based on the sparsification network provided by the present application is described below, and the target classification device based on the sparsification network described below can be referred to each other.
[0097] As Figure 5 shown, the embodiment of the present application further provides a target classification system based on a sparsification network, comprising:
[0098] The acquisition module 1 is used for acquiring an input image;
[0099] The classification module 2 is used for inputting the input image into the sparsification network to obtain a target classification result;
[0100] The sparse network refers to a network in which a sparse layer is used to replace an original layer of a classification network; the classification network is obtained based on samples and labels; the sparse layer is obtained by sparsifying parameters of the original layer according to a sparsity of the original layer; and the sparsity of the original layer is determined based on a bisection method with a classification accuracy threshold of the classification network as a constraint.
[0101] In this embodiment, the sparse network is obtained by running a network pruning system based on a classification network, and the network pruning system includes:
[0102] A sparsity module is configured to determine, for any original layer of a classification network, a sparsity of the original layer based on a bisection method with a classification accuracy threshold of the classification network as a constraint, and to sparsify parameters of the original layer according to the sparsity of the original layer to obtain a sparse layer.
[0103] A sparsification module is configured to replace an original layer of the classification network with the sparse layer to obtain a sparse network.
[0104] The classification network is obtained based on samples and labels.
[0105] Further, the sparsity module includes:
[0106] An iteration submodule is configured to sparsify parameters of an original layer at a set iteration sparsity.
[0107] An updating submodule is configured to determine, if a classification accuracy of the classification network after sparsification is less than a classification accuracy threshold, to update the iteration sparsity downward based on a bisection method, and if the classification accuracy of the classification network after sparsification is not less than the classification accuracy threshold, to update the iteration sparsity upward based on the bisection method.
[0108] A conclusion submodule is configured to return to the step of sparsifying parameters of the original layer at the set iteration sparsity for iteration until a set iteration stop condition is met, and then to determine the iteration sparsity as the sparsity of the original layer.
[0109] The updating submodule includes:
[0110] A boundary unit is configured to determine a sparsity left boundary and a sparsity right boundary; the sparsity left boundary is less than the sparsity right boundary.
[0111] The right boundary updating unit is configured to:
[0112] If the classification accuracy of the classification network after sparsification is less than the classification accuracy threshold, the sparsity right boundary is updated to the iteration sparsity, and the iteration sparsity and a mean value of the sparsity left boundary are used as an updated iteration sparsity.
[0113] Left boundary update unit, used for:
[0114] If the classification accuracy of the classification network after sparsification is not less than the classification accuracy threshold, then the left bound of the sparsity rate is updated to the iterative sparsity rate, and the average of the iterative sparsity rate and the right bound of the sparsity rate is used as the updated iterative sparsity rate.
[0115] Furthermore, the network pruning system also includes:
[0116] The early termination module is used for:
[0117] If it is determined that after sparsifying the original layer with the detection sparsity, the classification accuracy of the classification network belongs to the set exit set, then the iteration is stopped and the sparsity of the original layer is determined to be 0;
[0118] The detection sparsity rate is a set sparsity rate.
[0119] Figure 4 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 4 As shown, the electronic device may include a processor 410, a communication interface 420, a memory 430, and a communication bus 440. The processor 410, communication interface 420, and memory 430 communicate with each other via the communication bus 440. The processor 410 can call logical instructions in the memory 430 to execute a target classification method based on a sparse network. This method includes: acquiring an input image; inputting the input image into a sparse network to obtain a target classification result; the sparse network refers to a network in which the original layers of the classification network are replaced by sparse layers; the classification network is trained based on samples and labels; the sparse layers are obtained by sparsifying the parameters of the original layers according to the sparsity rate of the original layers; the sparsity rate of the original layers is determined iteratively based on a binary search method, constrained by a classification accuracy threshold of the classification network.
[0120] Further, the logic instructions in the memory 430 described above can be implemented in the form of software functional units and sold or used as standalone products, and can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application or parts of the present application that essentially contribute to the prior art or parts of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disk, and various media that can store program codes.
[0121] In another aspect, the present application also provides a computer program product, which comprises a computer program, the computer program can be stored on a non-transitory computer readable storage medium, and the computer program can be executed by a processor to enable a computer to perform the target classification method based on the sparse network provided by the above-mentioned methods, the method comprising: obtaining an input image; inputting the input image into a sparse network to obtain a target classification result; the sparse network refers to a network in which an original layer of a classification network is replaced by a sparse layer; the classification network is obtained by training based on samples and labels; the sparse layer is obtained by sparsifying parameters of the original layer according to a sparsity of the original layer; and the sparsity of the original layer is determined based on bisection method iteration with a classification accuracy threshold of the classification network as a constraint.
[0122] In yet another aspect, the present application also provides a non-transitory computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement the target classification method based on the sparse network provided by the above-mentioned methods, the method comprising: obtaining an input image; inputting the input image into a sparse network to obtain a target classification result; the sparse network refers to a network in which an original layer of a classification network is replaced by a sparse layer; the classification network is obtained by training based on samples and labels; the sparse layer is obtained by sparsifying parameters of the original layer according to a sparsity of the original layer; and the sparsity of the original layer is determined based on bisection method iteration with a classification accuracy threshold of the classification network as a constraint.
[0123] The device embodiments described above are merely illustrative, wherein the units described as separate components can or can not be physically separate, and the components displayed as units can or can not be physical units, i.e., can be located in one place, or can be distributed to multiple network units. Part or all of the modules can be selected to achieve the purposes of the embodiments according to actual needs. Those skilled in the art can understand and implement without creative labor.
[0124] Through the description of the above embodiments, those skilled in the art can clearly understand that the embodiments can be realized by means of software and the necessary general hardware platform, and of course can also be realized by hardware. Based on such understanding, the above technical solutions can be embodied in the form of a software product, which can be stored in a computer readable storage medium, such as a ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute the methods described in each embodiment or some parts of the embodiments.
[0125] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: it can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement to part of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A target classification method based on sparse networks, characterized in that, include: Obtain the input image; The input image is fed into a sparse network to obtain the target classification result; The sparse network refers to a network in which the original layers of the classification network are replaced by sparse layers; The classification network is trained based on samples and labels; The sparsification layer is obtained by sparsifying the parameters of the original layer according to the sparsity rate of the original layer; the sparsity rate of the original layer is determined iteratively based on the binary search method, with the classification accuracy threshold of the classification network as a constraint. The sparsity of the original layer is determined based on the following steps: The original layer parameters are sparsified using a set iteration sparsity rate; If the classification accuracy of the classification network after sparsification is less than the classification accuracy threshold, the iterative sparsity is updated downward based on the binary search method. If the classification accuracy of the classification network after sparsification is not less than the classification accuracy threshold, then the iterative sparsity is updated upward based on the binary search method. The process of iterating the original layer parameters with the set iterative sparsity rate is repeated until the set iteration stop condition is met, and then the iterative sparsity rate is determined as the sparsity rate of the original layer.
2. The target classification method based on sparse networks according to claim 1, characterized in that, Before the step of sparsifying the original layer parameters with a set iterative sparsity rate, the method further includes: If it is determined that after sparsifying the original layer with the detection sparsity, the classification accuracy of the classification network belongs to the set exit set, then the iteration is stopped and the sparsity of the original layer is determined to be 0; The detection sparsity rate is a set sparsity rate.
3. The target classification method based on sparse networks according to claim 1, characterized in that, If the classification accuracy of the classification network after sparsification is less than the classification accuracy threshold, the step of updating the iterative sparsity rate downward based on the binary search method includes: Determine the left and right bounds of the sparsity ratio; the left bound of the sparsity ratio is less than the right bound of the sparsity ratio. If the classification accuracy of the classification network after sparsification is less than the classification accuracy threshold, then the right boundary of the sparsity rate is updated to the iterative sparsity rate, and the average of the iterative sparsity rate and the left boundary of the sparsity rate is used as the updated iterative sparsity rate.
4. The target classification method based on sparse networks according to claim 1, characterized in that, If the classification accuracy of the classification network after sparsification is not less than the classification accuracy threshold, then the step of updating the iterative sparsity rate upward based on the binary search method includes: Determine the left and right bounds of the sparsity ratio; the left bound of the sparsity ratio is less than the right bound of the sparsity ratio. If the classification accuracy of the classification network after sparsification is not less than the classification accuracy threshold, then the left bound of the sparsity rate is updated to the iterative sparsity rate, and the average of the iterative sparsity rate and the right bound of the sparsity rate is used as the updated iterative sparsity rate.
5. The target classification method based on sparse networks according to any one of claims 1 to 4, characterized in that, The input image is acquired by an in-vehicle image acquisition device; the target classification result is a traffic light classification result, including red traffic light, red countdown traffic light, yellow traffic light, yellow countdown traffic light, green traffic light, or green countdown traffic light.
6. A target classification system based on sparse networks, characterized in that, include: The acquisition module is used to acquire the input image; The classification module is used to input the input image into a sparse network to obtain the target classification result; The sparse network refers to a network in which the original layers of the classification network are replaced by sparse layers; The classification network is trained based on samples and labels; The sparsification layer is obtained by sparsifying the parameters of the original layer according to the sparsity rate of the original layer; the sparsity rate of the original layer is determined iteratively based on the binary search method with the classification accuracy threshold of the classification network as a constraint; the sparsity rate of the original layer is determined based on the following steps: sparsifying the parameters of the original layer with a set iterative sparsity rate. If the classification accuracy of the classification network after sparsification is less than the classification accuracy threshold, the iterative sparsity is updated downward based on the binary search method. If the classification accuracy of the classification network after sparsification is not less than the classification accuracy threshold, then the iterative sparsity rate is updated upward based on the binary search method; the step of sparsifying the original layer parameters with the set iterative sparsity rate is returned for iteration until the set iteration stop condition is met, and then the iterative sparsity rate is determined as the sparsity rate of the original layer.
7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the steps of the target classification method based on sparse networks as described in any one of claims 1 to 5.
8. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the target classification method based on sparse networks as described in any one of claims 1 to 5.
9. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the target classification method based on sparse networks as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Improved sparseness self-adaptive matching pursuit algorithm based on dichotomy
CN107612555A
Image classification method and device, electronic equipment and storage medium
CN111539460A
Efficient image classification method based on structured pruning
US20210049423A1