High-performance image detection model training method, system, equipment and medium
By dividing the convolutional neural network into modules and using statistical and reinforcement learning algorithms to build a high-performance neural network model, the problem of high resource consumption when training lightweight convolutional neural networks in the existing technology is solved, and efficient and excellent image detection model training is achieved.
Patent Information
- Application Number
- CN202411598842.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-11
- Publication Date
- 2025-02-28
AI Technical Summary
The prior art requires pre-defined neural network structural space when training lightweight convolutional neural networks, which leads to high consumption of time and computing resources, and relies on manually defined construction rules, which is not the optimal lightweight network.
The existing convolutional neural network is divided into multiple neural network modules, and the main neural network modules are obtained through adjacency matrix representation and statistical learning algorithm. A high-performance neural network model is constructed in combination with reinforcement learning algorithms to generate high-performance convolutional neural networks, and the image detection model is trained based on this.
The cost of manually defining neural network structures is reduced, training efficiency and model performance is improved, and the generated image detection model is lightweight and high-performance, suitable for image recognition and detection tasks.
Smart Images

Figure CN119539019A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of artificial intelligence technology, and in particular, relates to a high-performance image detection model training method, system, device and medium. Background Art
[0002] Convolutional neural network models are widely used in computer vision tasks such as image classification, object detection, and target tracking, and have achieved great success. Convolutional neural networks not only include the exploration of network structure, but also the application of model compression technologies such as knowledge distillation and pruning, which promotes the application of deep learning technology in mobile and embedded terminals, and has made important contributions in the fields of smart home, security, autonomous driving, smart ocean, etc.
[0003] The existing lightweight convolutional neural network usually adopts a network structure search algorithm. Specifically, based on the ENAS algorithm, the neural network structure in the predefined space is traversed, training is performed in the training set, and the network is screened according to its performance in the validation set to select a lightweight model with excellent performance.
[0004] The disadvantages of the above-mentioned prior art are: 1. The above-mentioned technical solution needs to predefine a space of neural network structures. Since there is no prior knowledge, in order to obtain a neural network with excellent performance, the space needs to contain as many network structures as possible. At the same time, in order to obtain the potential of the network structure in the space, the pre-selected network needs to be trained to obtain the corresponding performance, which consumes a lot of time and computing resources. 2. Although there are a large number of network structures in the predefined space, all possible network structure construction rules are pre-defined manually. Therefore, the above-mentioned technical solution is heavily dependent on the manually set rules for building the network, and the network structure based on the artificial pre-defined construction is not the optimal lightweight network. Summary of the invention
[0005] The embodiments of the present application provide a high-performance image detection model training method, system, device and medium, which can solve at least one of the above-mentioned prior art problems.
[0006] In a first aspect, an embodiment of the present application provides a high-performance image detection model training method, comprising:
[0007] Divide the existing convolutional neural network into multiple neural network modules;
[0008] Representing the plurality of neural network modules respectively in the form of adjacency matrices, and obtaining a main neural network module among the plurality of neural network modules by using a statistical learning algorithm based on the adjacency matrix;
[0009] Based on the main neural network modules, a high-performance neural network model is constructed using a reinforcement learning algorithm to obtain a high-performance convolutional neural network;
[0010] Based on the high-performance convolutional neural network, an image detection model is trained, and a cross entropy loss function is used as an optimization target for image detection model training to obtain a difference measure between the predicted probability distribution of the image detection model and the true label.
[0011] Furthermore, the multiple neural network modules are represented by using adjacency matrices respectively, including:
[0012] Based on the computing nodes of the neural network module and the operators between different computing nodes, the plurality of neural network modules are sequentially converted into a directed acyclic graph, wherein the operators are the convolution kernel size and the pooling layer size;
[0013] The directed acyclic graph is converted into an adjacency matrix, wherein the rows and columns of the adjacency matrix represent computing nodes, and the element values of the adjacency matrix represent the connection relationship between different computing nodes and the operators between different computing nodes.
[0014] Furthermore, based on the adjacency matrix, a statistical algorithm is used to obtain a main neural network module among the plurality of neural network modules, including:
[0015] Splicing the plurality of adjacency matrices into a set matrix F by column, wherein each column of the set matrix F represents a neural network module;
[0016] The set matrix is decomposed using a non-negative matrix decomposition algorithm to obtain F=W×D, where W represents a non-negative weight matrix, D represents a matrix containing the main neural network modules, and the number of columns in the matrix D represents the number of main neural network modules.
[0017] Furthermore, based on the main neural network module, a high-performance neural network model is constructed using a reinforcement learning algorithm to obtain a high-performance convolutional neural network, including:
[0018] Using a recurrent neural network as a controller for constructing a high-performance neural network model, wherein the number of output values of the controller is consistent with the number of neural network modules of the generated high-performance convolutional neural network;
[0019] Initializing a plurality of the main neural network modules as an original data set, and randomly dividing the original data set into a training set and a validation set;
[0020] Training is performed alternately on the training set and the validation set to generate a high-performance neural network model, wherein an output result of the high-performance neural network model is a high-performance convolutional neural network.
[0021] Furthermore, the alternate training on the training set and the validation set to generate a high-performance neural network model includes:
[0022] Initializing a first weight of the controller by a random method, wherein the first weight is a performance of a neural network generated by the controller;
[0023] Training and generating a primary convolutional neural network on the training set, and evaluating the first weight of the controller on the validation set;
[0024] Using the first weight obtained by evaluation in the validation set as a reward indicator, and training the controller on the training set;
[0025] The training of the controller and the evaluation of the first weight of the controller are performed alternately until the evaluation result of the primary convolutional neural network generated on the training set in the verification set is in an optimal state, thereby obtaining a high-performance neural network model, wherein the optimal state is a state in which the performance improvement efficiency of the primary convolutional neural network is lower than a preset threshold.
[0026] Furthermore, the image detection model is trained based on the high-performance convolutional neural network, including:
[0027] Using the high-performance convolutional neural network as a backbone network, an image detection model is constructed, and the image detection model is used for image recognition and classification;
[0028] Pre-training and initializing the second weight of the backbone network;
[0029] Based on Retina Net, the backbone network is trained using the Adam W optimizer.
[0030] Further, the pre-training initialization of the second weight of the backbone network includes:
[0031] Using images in Image Net as a training set, preprocessing the images in the training set to generate training samples;
[0032] Based on the Adam W optimizer, the training samples are input into a high-performance convolutional neural network for multiple trainings to obtain a second weight, which is the initialization weight of the backbone network.
[0033] In a second aspect, the embodiment of the present application provides a high-performance image detection model training system, including:
[0034] The first processing module is used to divide the existing convolutional neural network into multiple neural network modules;
[0035] The second processing module is used to represent the plurality of neural network modules respectively in the form of an adjacency matrix, and based on the adjacency matrix, obtain a main neural network module among the plurality of neural network modules by using a statistical learning algorithm;
[0036] The third processing module is used to construct a high-performance neural network model based on the main neural network module using a reinforcement learning algorithm to obtain a high-performance convolutional neural network;
[0037] The fourth processing module is used to train the image detection model based on the high-performance convolutional neural network, use the cross entropy loss function as the optimization target of the image detection model training, and obtain the difference measure between the predicted probability distribution of the image detection model and the true label.
[0038] In a third aspect, an embodiment of the present application provides a terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned high-performance image detection model training method when executing the computer program.
[0039] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, including: the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the above-mentioned high-performance image detection model training method is implemented.
[0040] Compared with the prior art, the embodiments of the present invention have the following beneficial effects:
[0041] The present invention is based on the existing lightweight convolutional neural network, takes the neural network module of the lightweight convolutional neural network as the learning starting point, learns its lightweight characteristics through a statistical learning algorithm, and constructs a high-performance neural network model at the same time. A high-performance convolutional neural network is generated through the high-performance neural network model, and a lightweight and high-performance image detection model is generated based on the high-performance convolutional neural network training, thereby realizing image recognition and detection tasks. In addition, the neural network module used to train the high-performance convolutional neural network is based on learning from the existing convolutional neural network, and has strong reliability, so there is no need to manually predefine a new neural network structure, thereby reducing the cost of manually testing the neural network structure. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0043] Figure 1It is a flowchart of a high-performance image detection model training method provided by one embodiment of the present invention;
[0044] Figure 2 It is a structural schematic diagram of a high-performance image detection model training system provided by one embodiment of the present invention;
[0045] Figure 3 It is a schematic diagram of the structure of the terminal device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0046] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0047] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.
[0048] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0049] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.
[0050] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0051] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0052] See also Figure 1 As shown, the present invention is a high-performance image detection model training method, comprising the following steps:
[0053] S100, dividing the existing convolutional neural network into multiple neural network modules;
[0054] In the design of convolutional neural networks, modular ideas are usually adopted to divide convolutional neural networks into multiple independent modules. Specifically, a complete convolutional neural network is composed of multiple different types of layers or modules, which work together to complete complex image recognition or processing tasks. Each layer or module has its specific function and role, such as the convolution layer is used to extract features, the pooling layer is used for dimensionality reduction, and the fully connected layer is used for classification. The module contains multiple layers, and the layers or modules are connected in a certain order. Therefore, in this application, according to the existing convolutional neural network model, modules with similar types and the same functions are obtained, and the feasibility of connecting them in series to form a neural network module is determined by analyzing the characteristics and functions of these modules. The modules with similar types and the same functions are connected in sequence in a certain order, so as to obtain multiple neural network modules, which is convenient for the subsequent generation of high-performance convolutional neural networks.
[0055] In one embodiment, a clustering algorithm is used to cluster the module set in the convolutional neural network model. By calculating the similarity between the modules, the modules with the most similar functions and types are divided into the same category to obtain several categories of modules. A representative module is selected from each category as the typical module of the category, and the feasibility of connecting these typical modules in series to form a neural network module is determined by analyzing the input and output characteristics of these typical modules. A search algorithm is used to enumerate all possible serial sequences to construct a series of potential candidate neural network modules, and an optimal module serial sequence is obtained according to the complexity and expected function of the candidate modules. Based on the optimal module serial sequence, the corresponding typical modules are connected in series in this order to form a neural network module.
[0056] In this embodiment, the neural network module used to train a high-performance convolutional neural network is based on learning from an existing convolutional neural network and has strong reliability, thereby eliminating the need to manually predefine a new neural network structure, thereby reducing the cost of manually testing the neural network structure.
[0057] In this embodiment, an existing lightweight convolutional neural network is adopted, and the neural network module of the lightweight convolutional neural network is taken as the learning starting point. Its lightweight characteristics are learned through a statistical learning algorithm, so that the finally generated image detection model has the advantage of being lightweight and easier to deploy and apply.
[0058] S200, respectively representing the plurality of neural network modules in the form of an adjacency matrix, and obtaining a main neural network module among the plurality of neural network modules by using a statistical learning algorithm based on the adjacency matrix;
[0059] In this embodiment, the multiple neural network modules divided out are represented by an adjacency matrix to clearly show the connection relationship and structural characteristics between the neural network modules, and the elements in the adjacency matrix can represent the direct connection strength between the modules or whether there is a connection. This representation method is intuitive and easy to understand and analyze. In addition, by analyzing the adjacency matrix through a statistical learning algorithm, those neural network modules that play a key role in the convolutional neural network, that is, the main neural network modules, can be identified, thereby reducing the complexity of neural network model training and helping to improve the generalization ability of the model. At the same time, through a statistical learning algorithm, a neural network module with a higher frequency of occurrence can be found from the existing lightweight convolutional neural network as the main neural network module, which is conducive to the neural network model learning its lightweight characteristics from the existing lightweight convolutional neural network.
[0060] In some embodiments, the multiple neural network modules are represented by adjacency matrices respectively, including:
[0061] Based on the computing nodes of the neural network module and the operators between different computing nodes, the plurality of neural network modules are sequentially converted into a directed acyclic graph, wherein the operators are the convolution kernel size and the pooling layer size;
[0062] The directed acyclic graph is converted into an adjacency matrix, wherein the rows and columns of the adjacency matrix represent computing nodes, and the element values of the adjacency matrix represent the connection relationship between different computing nodes and the operators between different computing nodes.
[0063] In one embodiment, all computing nodes in the neural network module are obtained, and the dependency relationship between different computing nodes is established according to their topological structure and connection relationship in the neural network module. By analyzing the data flow between the computing nodes, the order between the computing nodes is determined to form a directed graph. According to the topologically sorted computing node sequence, a directed acyclic graph is constructed. The sorted computing nodes are used as nodes of a directed acyclic graph, and directed edges are added between corresponding nodes according to the connection relationship of the computing nodes in the neural network module, wherein the directed edges are provided with operators of two corresponding computing nodes.
[0064] In one embodiment, a set of all computing nodes in a directed acyclic graph is obtained, and the number of rows and columns of the adjacency matrix is determined according to the number of computing nodes. By traversing all directed edges in the directed acyclic graph, the starting computing node and the target computing node of each edge are obtained, and the operator corresponding to the directed edge connecting them is obtained, and the operator is the convolution kernel size and the pooling layer size, such as 3x3 convolution layer and 3x3 pooling layer. According to the index of the starting computing node and the target computing node of each edge in the computing node set, the operator information is filled in the position of the corresponding row and column in the adjacency matrix to obtain the position of the operator in the adjacency matrix. By analyzing the connection relationship between the computing nodes, the element value of the corresponding position in the adjacency matrix is judged. If there is an edge between two computing nodes, 1 is filled in the corresponding position in the adjacency matrix, otherwise 0 is filled in. According to the position of the operator in the adjacency matrix and the connection relationship between the computing nodes, a complete adjacency matrix representation is finally obtained. The row and column indexes in the adjacency matrix represent the computing nodes. An element value of 1 indicates that there is a connection relationship between the corresponding computing nodes, and the element value also includes the operators between the computing nodes. When the element value is 0, it indicates that there is no connection relationship between the corresponding computing nodes.
[0065] In one embodiment, the method of obtaining a main neural network module among the plurality of neural network modules by using a statistical algorithm based on the adjacency matrix includes:
[0066] Splicing the plurality of adjacency matrices into a set matrix F by column, wherein each column of the set matrix F represents a neural network module;
[0067] The set matrix F is decomposed by a non-negative matrix decomposition algorithm to obtain F=W×D, wherein W represents a non-negative weight matrix, D represents a matrix containing the main neural network modules, and the number of columns in the matrix D represents the number of main neural network modules.
[0068] In this embodiment, multiple neural network modules are represented by adjacency matrices, and multiple adjacency matrices are spliced together to form a new set matrix F. The set matrix F is decomposed using a non-negative matrix decomposition algorithm to obtain the product of two matrices, that is, F = W × D, where W represents a non-negative weight matrix, and the elements in the matrix represent the weights or importance of the adjacency matrices of different neural network modules in the set matrix; D represents a matrix containing main neural network modules, and each column in the matrix D represents a main neural network module, and the number of columns represents the number of main neural network modules.
[0069] In this embodiment, the decomposed matrices W and D are non-negative and can also be regarded as adjacency matrices. When the number of columns in the matrix D is r, it means that r main neural network modules can be constructed in the set matrix F.
[0070] S300, based on the main neural network module, a high-performance neural network model is constructed using a reinforcement learning algorithm to obtain a high-performance convolutional neural network;
[0071] In some embodiments, the step S300 includes:
[0072] Using a recurrent neural network as a controller for constructing a high-performance neural network model, wherein the number of output values of the controller is consistent with the number of neural network modules of the generated high-performance convolutional neural network;
[0073] Initializing a plurality of the main neural network modules as an original data set, and randomly dividing the original data set into a training set and a validation set;
[0074] Training is performed alternately on the training set and the validation set to generate a high-performance neural network model, wherein an output result of the high-performance neural network model is a high-performance convolutional neural network.
[0075] In this embodiment, a recurrent neural network is used as a controller for building a high-performance neural network model. The recurrent neural network model has a natural ability to process sequence data and can capture the timing information and dependencies in the input data, thereby improving the performance of the model. At the same time, the recurrent neural network also has high memory capacity and flexibility, thereby building a more complex high-performance neural network model.
[0076] In this embodiment, the output of the high-performance neural network model generated by training is controlled by a recurrent neural network, and each output value corresponds to a decision, that is, a controller is used to generate a high-performance convolutional neural network corresponding to the main neural network module. Therefore, the number of output values of the controller is consistent with the number of neural network modules of the generated high-performance convolutional neural network.
[0077] In this embodiment, the r main neural network modules obtained in step S200 are initialized as the original data set, and the original data set is randomly divided into a training set and a verification set. Specifically, the training set accounts for 90% of the original data set and is used to train the controller, while the remaining 10% is used as a verification set to verify the convolutional neural network generated by the controller. In this process, in order to reduce the difficulty of training and avoid overfitting, the controller training and verification are performed alternately. After multiple iterations of training, a high-performance neural network model is obtained. The trained high-performance neural network model can output a high-performance convolutional neural network.
[0078] In this embodiment, a random partitioning method is adopted to randomly shuffle the data in the original data set and then divide it in proportion to obtain a training set and a validation set.
[0079] In some embodiments, the alternating training on the training set and the validation set to generate a high-performance neural network model includes:
[0080] Initializing a first weight of the controller by a random method, wherein the first weight is a performance of a convolutional neural network generated by the controller;
[0081] Training and generating a primary convolutional neural network on the training set, and evaluating the first weight of the controller on the validation set;
[0082] Using the first weight obtained by evaluation in the validation set as a reward indicator, and training the controller on the training set;
[0083] The training of the controller and the evaluation of the first weight of the controller are performed alternately until the evaluation result of the primary convolutional neural network generated on the training set in the verification set is in an optimal state, thereby obtaining a high-performance neural network model, wherein the optimal state is a state in which the performance improvement efficiency of the primary convolutional neural network is lower than a preset threshold.
[0084] In this embodiment, a first weight of the controller is initialized by a random method, and a high-performance neural network model is trained by the initialized controller, thereby improving the generalization of the high-performance neural network model. Specifically, according to the structure and parameters of the recurrent neural network, a specific distribution, such as a normal distribution, is used to randomly initialize the first weight of the recurrent neural network, obtain the initialized first weight, input the first weight into the recurrent neural network, and generate the corresponding neural network. The performance of the neural network on the training set is obtained, such as the loss function value and the accuracy. If the loss function value is high, the parameters of the first weight initialization are adjusted, such as changing the mean or variance of the initialization distribution to reduce the performance fluctuation of the initial model. Restart the training of the controller, use the adjusted first weight initialization to perform network training, and obtain the performance of the network on the training set again. Compare the performance of the model on the training set before and after the adjustment, judge the effect of the first weight initialization strategy by the change of the loss function and the accuracy, and then determine the final optimized first weight initialization scheme, select the best performing initialization parameter as the first weight of the controller, and ensure that the high-performance neural network model has stable performance and good generalization ability.
[0085] In this embodiment, a training set is used to train the controller so that it can generate a primary convolutional neural network, and then the generated primary convolutional neural network is verified by data in a validation set. The performance of the primary convolutional neural network generated by the controller is obtained by evaluating the first weight of the controller. A reward mechanism is used to use the performance of the primary convolutional neural network generated by the controller as a reward indicator to train the controller. Specifically, the performance of the primary convolutional neural network on the validation set is obtained. The training feedback information of the controller is obtained through the performance. The performance includes the loss function value and the accuracy. The training feedback information includes positive feedback and negative feedback. If the performance is excellent, the controller will obtain positive feedback from the training, indicating that the parameters and training of the current high-performance neural network model are good. If the training strategy is effective, the controller will strengthen it in the next iterative training and continue training. If the performance is not good, the controller will get negative feedback from the training. At this time, the specific parameters that need to be optimized, such as learning rate, number of layers or activation function, will be identified, and the training strategy of the controller will be adjusted in the hope of performance improvement. The performance of the adjusted neural network on the same data set will be obtained again. After obtaining the positive feedback training feedback information, the controller will enter the next iterative training. Through the alternating iterative training of the controller, the performance improvement efficiency of the generated primary convolutional neural network is lower than the preset threshold, so that the convolutional neural network obtained by the trained high-performance neural network model has excellent performance, that is, a high-performance convolutional neural network, and is easy to deploy and apply.
[0086] S400: Based on the high-performance convolutional neural network, an image detection model is trained, a cross entropy loss function is used as an optimization target for image detection model training, and a difference measure between a predicted probability distribution of the image detection model and a true label is obtained.
[0087] In this embodiment, the high-performance convolutional neural network generated by the output of the high-performance neural network model is applied to the image classification task, and the trained high-performance convolutional neural network is further adjusted in the target detection task to make it more suitable for image recognition, thereby improving the accuracy of the target detection task in image recognition and improving its usability.
[0088] In some embodiments, the step S400 includes:
[0089] Using the high-performance convolutional neural network as a backbone network, an image detection model is constructed, and the image detection model is used for image recognition and classification;
[0090] Pre-training and initializing the second weight of the backbone network;
[0091] Based on Retina Net, the backbone network is trained using the Adam W optimizer.
[0092] In this embodiment, the image detection process generally includes image recognition tasks and target detection tasks, and a high-performance convolutional neural network is used as the backbone network, so that the generated image detection model has high performance and lightweight characteristics.
[0093] In this embodiment, the open source Retina Net is used as the basic framework of the image detection model to achieve efficient and accurate detection functions. The Adam W optimizer with label smoothing function is used to help prevent overfitting and improve the performance of the image detection model. Specifically, the Adam W optimizer is used to perform parallel training with batches of 16 on 8 graphics cards to accelerate the convergence of the model.
[0094] In this embodiment, the cross entropy loss function is used as the optimization target of model training to obtain the difference measure between the model prediction probability distribution and the true label. Through the forward propagation process, the input image data is sent to the model, and after operations such as convolution and pooling, the model's predicted probability distribution for each category is obtained. The true category label of the image in the data set is obtained, and it is converted into a probability distribution form through one-hot encoding to determine the supervision signal of the training sample. According to the predicted probability distribution and the label probability distribution, the cross entropy formula is used to calculate the difference between the two distributions element by element to obtain the cross entropy loss value of each sample. By averaging the cross entropy loss values of the training samples, the average cross entropy loss of the current model on the training set is obtained as an indicator for evaluating the performance of the model. The back propagation algorithm is used to calculate the gradient of the model parameters according to the average cross entropy loss, and the model parameters are updated by optimization algorithms such as gradient descent to gradually reduce the loss function value. The above steps are continuously iterated, and the model performance is evaluated on the validation set after each epoch. Whether to end the training is determined according to the early stopping strategy to obtain the image classification model with the best performance.
[0095] In some embodiments, the pre-training initialization of the second weight of the backbone network includes:
[0096] Using images in Image Net as a training set, preprocessing the images in the training set to generate training samples;
[0097] Based on the Adam W optimizer, the training samples are input into a high-performance convolutional neural network for multiple trainings to obtain the second weight, which is the initialization weight of the backbone network.
[0098] In this embodiment, images in Image Net are used as training sets for the image detection model. Image Net is a large-scale image database with a large data scale and diverse categories. The target detection model can learn rich feature representations, and then train an image detection model with strong generalization ability and capable of recognizing a variety of objects.
[0099] In this embodiment, according to the images in the Image Net training set, the image size is adjusted to 224×224 pixels by random cropping to obtain training image data of uniform size. By performing a horizontal flip operation on the cropped image, a mirror-symmetrical image is obtained to expand the diversity of the training data. The hybrid data enhancement technology is used to mix the cropped image with other images in a certain proportion to obtain a new image containing multiple image features, thereby improving the adaptability of the target detection model to complex scenes. Through the automatic enhancement algorithm, the contrast, brightness, saturation, etc. of the cropped image are randomly adjusted to obtain images under a variety of different styles and lighting conditions, thereby enhancing the robustness of the target detection model. The random erasing method is used to randomly select a rectangular area on the cropped image, and its pixel value is set to zero or a random value to simulate the occlusion in the real scene, thereby improving the generalization ability of the target detection model. The image after the above data enhancement processing is used as a training sample and input into a training model with a high-performance convolutional neural network as the backbone network for training, thereby obtaining a high-performance image detection model with good generalization and robustness on the Image Net data set. Apply the trained image detection model to the actual image recognition task, determine the category of the image based on the prediction results of the image detection model, and achieve accurate recognition and classification of unknown images.
[0100] In this embodiment, a high-performance convolutional neural network is trained on 8 graphics cards, and the Adam W optimizer is used to train the high-performance convolutional neural network multiple times to obtain the second weight of the backbone network. Through multiple trainings, it is ensured that the trained image detection model has stable performance and good generalization ability.
[0101] See also Figure 2 As shown, the present invention also provides a high-performance image detection model training system, the system comprising:
[0102] The first processing module 201 is used to divide the existing convolutional neural network into multiple neural network modules;
[0103] The second processing module 202 is used to represent the multiple neural network modules respectively in the form of adjacency matrices, and based on the adjacency matrices, obtain the main neural network module among the multiple neural network modules by using a statistical learning algorithm;
[0104] The third processing module 203 is used to construct a high-performance neural network model based on the main neural network module using a reinforcement learning algorithm to obtain a high-performance convolutional neural network;
[0105] The fourth processing module 204 is used to train the image detection model based on the high-performance convolutional neural network, use the cross entropy loss function as the optimization target of the image detection model training, and obtain the difference measure between the predicted probability distribution of the image detection model and the true label.
[0106] It is understandable that if Figure 1 The contents of the high-performance image detection model training method embodiment shown in the figure are all applicable to the high-performance image detection model training system embodiment. The functions specifically implemented by the high-performance image detection model training system embodiment are similar to those in the embodiment shown in the figure. Figure 1 The high performance image detection model training method embodiment shown is the same as that shown in FIG. Figure 1 The beneficial effects achieved by the high-performance image detection model training method embodiment shown are also the same.
[0107] It should be noted that the information interaction, execution process and other contents between the above-mentioned systems are based on the same concept as the embodiment of the method of the present invention. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.
[0108] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the system can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0109] See also Figure 3 As shown, an embodiment of the present invention further provides a computer device 3, comprising: a memory 302 and a processor 301 and a computer program 303 stored on the memory 302. When the computer program 303 is executed on the processor 301, a high-performance image detection model training method as described in any one of the above methods is implemented.
[0110] The computer device 3 may be a computing device such as a desktop computer, a notebook, a PDA, or a cloud server. The computer device 3 may include, but is not limited to, a processor 301 and a memory 302. Those skilled in the art will appreciate that Figure 3 It is only an example of computer device 3 and does not constitute a limitation on computer device 3. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components, for example, it may also include input and output devices, network access devices, etc.
[0111] The processor 301 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0112] In some embodiments, the memory 302 may be an internal storage unit of the computer device 3, such as a hard disk or memory of the computer device 3. In other embodiments, the memory 302 may also be an external storage device of the computer device 3, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the computer device 3. Further, the memory 302 may also include both an internal storage unit of the computer device 3 and an external storage device. The memory 302 is used to store an operating system, an application program, a boot loader (BootLoader), data, and other programs, such as the program code of the computer program, etc. The memory 302 may also be used to temporarily store data that has been output or is to be output.
[0113] An embodiment of the present invention also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, a high-performance image detection model training method as described in any one of the above methods is implemented.
[0114] In this embodiment, if the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, the steps of the above-mentioned various method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium can at least include: any entity or device that can carry the computer program code to the camera / terminal device, recording medium, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium. For example, a USB flash drive, a mobile hard disk, a disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.
[0115] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A high-performance image detection model training method, characterized in that: include: Divide the existing convolutional neural network into multiple neural network modules; Representing the plurality of neural network modules respectively in the form of adjacency matrices, and obtaining a main neural network module among the plurality of neural network modules by using a statistical learning algorithm based on the adjacency matrix; Based on the main neural network modules, a high-performance neural network model is constructed using a reinforcement learning algorithm to obtain a high-performance convolutional neural network; Based on the high-performance convolutional neural network, an image detection model is trained, and a cross entropy loss function is used as an optimization target for image detection model training to obtain a difference measure between the predicted probability distribution of the image detection model and the true label.
2. The method according to claim 1, characterized in that The method of representing the plurality of neural network modules respectively by using adjacency matrices includes: Based on the computing nodes of the neural network module and the operators between different computing nodes, the plurality of neural network modules are sequentially converted into a directed acyclic graph, wherein the operators are the convolution kernel size and the pooling layer size; The directed acyclic graph is converted into an adjacency matrix, wherein the rows and columns of the adjacency matrix represent computing nodes, and the element values of the adjacency matrix represent the connection relationship between different computing nodes and the operators between different computing nodes.
3. The method according to claim 1, characterized in that The method of obtaining a main neural network module among the plurality of neural network modules based on the adjacency matrix by using a statistical algorithm includes: Splicing the plurality of adjacency matrices into a set matrix F by column, wherein each column of the set matrix F represents a neural network module; The set matrix is decomposed using a non-negative matrix decomposition algorithm to obtain F=W×D, where W represents a non-negative weight matrix, D represents a matrix containing the main neural network modules, and the number of columns in the matrix D represents the number of main neural network modules.
4. The method according to claim 1, characterized in that Based on the main neural network module, a high-performance neural network model is constructed using a reinforcement learning algorithm to obtain a high-performance convolutional neural network, including: Using a recurrent neural network as a controller for constructing a high-performance neural network model, wherein the number of output values of the controller is consistent with the number of neural network modules of the generated high-performance convolutional neural network; Initializing a plurality of the main neural network modules as an original data set, and randomly dividing the original data set into a training set and a validation set; Training is performed alternately on the training set and the validation set to generate a high-performance neural network model, wherein an output result of the high-performance neural network model is a high-performance convolutional neural network.
5. The method according to claim 4, characterized in that The alternate training on the training set and the validation set to generate a high-performance neural network model includes: Initializing a first weight of the controller by a random method, wherein the first weight is a performance of a neural network generated by the controller; Training and generating a primary convolutional neural network on the training set, and evaluating the first weight of the controller on the validation set; Using the first weight obtained by evaluation in the validation set as a reward indicator, and training the controller on the training set; The training of the controller and the evaluation of the first weight of the controller are performed alternately until the evaluation result of the primary convolutional neural network generated on the training set in the verification set is in an optimal state, thereby obtaining a high-performance neural network model, wherein the optimal state is a state in which the performance improvement efficiency of the primary convolutional neural network is lower than a preset threshold.
6. The method according to claim 1, characterized in that The image detection model is trained based on the high-performance convolutional neural network, including: Using the high-performance convolutional neural network as a backbone network, an image detection model is constructed, and the image detection model is used for image recognition and classification; Pre-training and initializing the second weight of the backbone network; Based on Retina Net, the backbone network is trained using the Adam W optimizer.
7. The method according to claim 6, characterized in that The pre-training initialization of the second weight of the backbone network includes: Using images in Image Net as a training set, preprocessing the images in the training set to generate training samples; Based on the Adam W optimizer, the training samples are input into a high-performance convolutional neural network for multiple trainings to obtain a second weight, where the second weight is the initialization weight of the backbone network.
8. A high-performance image detection model training system, characterized in that: include: The first processing module is used to divide the existing convolutional neural network into multiple neural network modules; The second processing module is used to represent the plurality of neural network modules respectively in the form of an adjacency matrix, and based on the adjacency matrix, obtain a main neural network module among the plurality of neural network modules by using a statistical learning algorithm; The third processing module is used to construct a high-performance neural network model based on the main neural network module using a reinforcement learning algorithm to obtain a high-performance convolutional neural network; The fourth processing module is used to train the image detection model based on the high-performance convolutional neural network, use the cross entropy loss function as the optimization target of the image detection model training, and obtain the difference measure between the predicted probability distribution of the image detection model and the true label.
9. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.