A target recognition method based on lightweight neural network and its application
By improving the Densenet model and cooperating with multiple devices, the problem of balancing target detection accuracy and data processing volume on embedded devices is solved, high-precision and low-computation target recognition is achieved, and a high-availability architecture and hot deployment capabilities are provided.
Patent Information
- Application Number
- CN202110359604.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-04-02
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2041-04-02
Smart Images

Figure CN113505628B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of device identification, and relates to a target identification method based on a lightweight neural network and an application thereof. Background Art
[0002] Object detection is one of the important research directions in the field of computer vision. The traditional object detection method is to extract features by constructing feature descriptors and then classify the features using classifiers to achieve object detection, such as Histogram of Oriented Gradient (HOG) and Support Vector Machine (SVM). With the excellent performance of deep learning in the field of image classification, convolutional neural networks have begun to be widely used in various fields of computer vision. Using deep learning to achieve object detection in the field of object detection has become a new direction.
[0003] Traditional neural networks use fully connected layers to connect layers, while the weight sharing network of convolutional neural networks greatly reduces the amount of calculation and the complexity of the network model. The translation invariance of convolutional neural networks allows them to better process the features of images. A large number of convolutional neural networks have emerged based on image recognition methods, from the initial LeNet, AlexNet, ZFNext, VGGNet, Inception series, ResNet series to lightweight neural networks. These algorithms are modified based on Backbone and can achieve high accuracy. These technologies have been gradually used in other applications such as face recognition and smart warehousing.
[0004] Despite this, the technology still has the following defects: Due to the emergence of residual connections, it can stack deeper networks while ensuring accuracy, but this also increases the complexity and computational complexity of the network model. Some commercial computers can run these networks with superior GPUs and memory, but for some embedded devices with limited performance, the amount of data they process is too large to meet the requirements of timeliness and accuracy.
[0005] Therefore, it is of great practical significance to develop a target recognition method with high accuracy, small data processing volume and applicable to embedded devices with limited performance. Summary of the invention
[0006] The purpose of the present invention is to overcome the defects of the existing difficulty in achieving a good balance between accuracy and data processing volume and the high requirements for device hardware, and to provide a target recognition method with high accuracy and small data processing volume, which can be applied to embedded devices with limited performance. The target recognition method of the present invention greatly reduces the data processing volume while ensuring accuracy, and can greatly reduce the requirements for device hardware. In addition, the present invention provides a method for using multiple embedded devices to cooperate to implement the target recognition method of the present invention, which has great application prospects.
[0007] To achieve the above object, the present invention provides the following technical solutions:
[0008] A target recognition method based on a lightweight neural network, in which the target image is input into a trained Densenet improved model, and the trained Densenet improved model outputs the target category;
[0009] The improvement of the Densenet improved model compared to the Densenet model is that the Back Bone in the net block (Net Block) includes Channel Split, a first convolutional layer (first Conv), a second convolutional layer (second Conv), a third convolutional layer (third Conv), a first depth separation convolutional layer (first DWConv), a second depth separation convolutional layer (second DWConv), Concat, and Channel Shuffle, wherein Channel Split, the first convolutional layer (first Conv), the first depth separation convolutional layer (first DWConv), the second convolutional layer (second Conv), Concat, and Channel Shuffle are connected in sequence, the second depth separation convolutional layer (second DWConv), the third convolutional layer (third Conv) are connected in parallel with the first convolutional layer (first Conv), the first depth separation convolutional layer (first DWConv), and the second convolutional layer (second Conv), the second depth separation convolutional layer (second DWConv) is connected to Channel Split, and the third convolutional layer (third Conv) is connected to Concat. That is, after the output channels of Back Bone are distributed by Channel Split, part of them pass through the first convolution layer (first Conv), the first depth separation convolution layer (first DWConv), and the second convolution layer (second Conv), and the other part passes through the second depth separation convolution layer (second DWConv), the third convolution layer (third Conv), and then they are merged through Concat and then shuffled through Channel Shuffle and output to the next layer as the input of the next layer.
[0010] The present invention provides a target recognition method based on a lightweight neural network. It is the first time to propose a Densenet improved model obtained by combining the characteristics of the channel intention order of ShuffleNet, the residual network in ResNet, the channel segmentation in Inception, the multiple residual networks in DenseNet and the DWConv in MobileNet in a convolutional neural network. Compared with traditional networks and lightweight networks, the Densenet improved model further improves the accuracy and reduces the structure of the model. The target category recognition is completed by using the Densenet improved model, which not only has a small amount of data processing, but also has high recognition accuracy and has great application prospects.
[0011] As the preferred technical solution:
[0012] As described above, a target recognition method based on a lightweight neural network, the Densenet improved model includes a main convolutional layer (main Conv), a feature extraction layer (Pooling), a first network block, a transition layer (TransitionLayer), a second network block, and a classification layer (Classification Layer) connected in sequence; the first network block and the second network block have the same structure.
[0013] As described above, a target recognition method based on a lightweight neural network, the network block includes a first Back Bone, a second Back Bone, a third Back Bone and a fourth Back Bone connected in sequence, the output of the first Back Bone is also the input of the second Back Bone, the third Back Bone and the fourth Back Bone, and the output of the second Back Bone is also the input of the third Back Bone and the fourth Back Bone.
[0014] In the target recognition method based on a lightweight neural network as described above, the transition layer (TransitionLayer) includes a convolutional layer (Conv) and a feature extraction layer (Pooling);
[0015] The classification layer includes a global average pool and a Softmax classifier.
[0016] The Softmax classifier is used to calculate the classification probability of each sample, as follows:
[0017]
[0018] In the formula, s i represents the output value of the ith neuron of the Softmax classifier, s i=F·η, F is the image feature vector of a training sample, η is the corresponding weight, and n is the number of categories to be classified;
[0019] Then according to the probability y i The training error is calculated:
[0020]
[0021] When i = k, θ ik =1, i represents the i-th category. When the original input belongs to category i, y k * =1;
[0022] The training error is used to backpropagate from the last layer of the convolutional neural network, and the cross entropy is used as the loss function. The Adam adaptive gradient optimizer is optimized, the initial learning rate is set to 0.01, the training rounds are 100 times, and the TensorFlow2.0 framework is used for experiments. The trained model is saved.
[0023] In the above-mentioned target recognition method based on lightweight neural network, the ratio of the number of training sets to the number of test sets of the Densenet improved model is 4:1. The end point of model training is to reach a preset number of training times. The protection scope of the present invention is not limited to this, and the number of training sets and test sets can be set by those skilled in the art according to actual conditions.
[0024] The present invention also provides a device for applying the above-mentioned target recognition method based on lightweight neural network, including one or more processors, one or more memories, one or more programs and an input unit;
[0025] The input unit is used to input a target image;
[0026] The one or more programs are stored in the memory, and when the one or more programs are executed by the processor, the device executes the target recognition method based on lightweight neural network as described above.
[0027] In addition, the present invention also provides a device kit including the device as described above, including a central host and more than one device as described above (the hardware of the device and the central host may be different, for example, some have good performance and some have poor performance, and the deep learning model can be written in C++ or in Python, and the Densenet improved model can even be split into sub-models, each device corresponds to a sub-model, and the sub-models can also be written in different ways, either in C++ or in Python);
[0028] The device is communicatively connected with the central host.
[0029] The above device kit draws on the idea of XGBoost and adopts multiple embedded devices embedded with the target recognition method of the lightweight neural network of the present invention. While improving the system accuracy, it ensures that the system can still operate normally when some embedded devices are down. At the same time, hot deployment is also realized (upgrading the software while the application is running without restarting the application), which improves the availability of the system. At the same time, the device kit of the present invention can use different neural networks according to the hardware of the embedded device, and can also use different frameworks and languages to write neural networks.
[0030] The present invention sets up a high-availability architecture for intelligent warehousing based on a lightweight neural network. For deep learning writers, different languages and even different models can be used to run in the host. They only need to put the prediction structure into RabbitMQ, and the central host only needs to get the result from RabbitMQ, thus achieving decoupling between businesses. The advantage of this is that the number of embedded devices can be increased at any time, and different languages and models can be used considering the different hardware performance of embedded devices. When one of the embedded devices goes down, it will not affect the overall structure; when adding a new model, the original model does not need to be stopped, and hot deployment is truly realized. In the central host, considering the different complexity and accuracy of different models, we can manually assign them different initialization weights. In subsequent training, the host can adaptively adjust the weights according to the accuracy.
[0031] As the preferred technical solution:
[0032] In the device kit as described above, the device is an embedded device.
[0033] In the equipment kit described above, the central host runs the following program:
[0034] (1) The central host obtains the heartbeat packets sent by each device at regular intervals, confirms the online status of the device and removes offline devices;
[0035] (2) The central host sends the target image to each online device, and each online device runs the target recognition method based on the lightweight neural network as described above to obtain the target category;
[0036] (3) Each online device sends the target category it obtains to the central host, and the central host obtains the final result based on the target category obtained by each online device. The central host runs based on RabbitMQ (of course, it can be selected according to specific needs), and its specific operation process is as follows: the central host puts the image of the industrial device (goods) into RabbitMQ, and each embedded device will take the image from RabbitMQ, and then put the predicted result into RabbitMQ, and the central host will take the predicted result from RabbitMQ.
[0037] For the equipment kit described above, the specific scheme for obtaining the final result according to the target category obtained by each online device is to confirm the final result according to the election rule, that is, the highest prediction is the correct variety, or to confirm the final result according to the weight coefficient of each online device. With the weight adjustment algorithm, the initial 5 embedded devices (taking 5 embedded devices as an example) are all 0.2. If one of the machines predicts wrong n times multiple times, it will be in [0,2 n ], the new weight z = 0.2-x*0.01. When z is 0, the system will issue an alarm and remove the device. Suppose the predicted results and weights of the five machines are y 1 ,y 2 ,y 3 ,y 4 ,y 5 、z 1 、z 2 、z 3 、z 4 、z 5 , if y 1 ,y 2 ,y 3 Same, y 4 ,y 5 Same, z 1 +z 2 +z 3 >z 4 +z 5 , then the final result is y 1 Depending on the performance of the device and model, different weight value ratios can be set during initialization.
[0038] Beneficial effects:
[0039] (1) The object recognition method based on lightweight neural network of the present invention is the first to propose a Densenet improved model by combining the characteristics of ShuffleNet channel intention order, the residual network in ResNet, the channel segmentation in Inception, the multiple residual networks in DenseNet and the DWConv in MobileNet in the convolutional neural network. Compared with the traditional network and the lightweight network, the Densenet improved model further improves the accuracy and reduces the structure of the model. The target category recognition is completed by using the Densenet improved model, which not only has a small amount of data processing, but also has high recognition accuracy and has great application prospects.
[0040] (2) The device kit using the target recognition method based on a lightweight neural network of the present invention provides a high-availability architecture based on a lightweight neural network, which has good flexibility and can be processed in steps using embedded devices. When one of the embedded devices goes down, it will not affect the overall structure. When a new model is added, there is no need to stop the original model, thus truly realizing hot deployment and having great application prospects. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] Figure 1 It is a structural schematic diagram of the Densenet improved model of the present invention;
[0042] Figure 2 It is a schematic diagram of the operation flow of the equipment kit of the present invention. DETAILED DESCRIPTION
[0043] The specific implementation modes of the present invention are further described below in conjunction with the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments.
[0044] Example 1
[0045] A target recognition method based on a lightweight neural network, the steps are as follows:
[0046] (1) Train Densenet to improve the model:
[0047] Densenet improved model such as Figure 1 As shown, it includes a main convolution layer (main Conv), a feature extraction layer, a first network block, a transition layer, a second network block and a classification layer connected in sequence;
[0048] The first network block and the second network block have the same structure. The network block includes a first Back Bone, a second Back Bone, a third Back Bone and a fourth Back Bone which are connected in sequence. The output of the first Back Bone is also the input of the second Back Bone, the third Back Bone and the fourth Back Bone, and the output of the second Back Bone is also the input of the third Back Bone and the fourth Back Bone.
[0049] The Back Bone in the network block includes Channel Split, the first convolution layer, the second convolution layer, the third convolution layer, the first depth separation convolution layer, the second depth separation convolution layer, Concat, and Channel Shuffle, wherein Channel Split, the first convolution layer, the first depth separation convolution layer, the second convolution layer, Concat, and Channel Shuffle are connected in sequence, the second depth separation convolution layer and the third convolution layer are connected in parallel with the first convolution layer, the first depth separation convolution layer, and the second convolution layer, the second depth separation convolution layer is connected to Channel Split, and the third convolution layer is connected to Concat;
[0050] The transition layer includes sequentially connected convolutional layers and feature extraction layers;
[0051] The classification layer includes a sequentially connected average pooling layer and a Softmax classifier;
[0052] The Softmax classifier is used to calculate the classification probability of each sample, as follows:
[0053]
[0054] In the formula, s i represents the output value of the ith neuron of the Softmax classifier, s i =F·η, F is the image feature vector of a training sample, η is the corresponding weight, and n is the number of categories to be classified;
[0055] Then according to the probability y i The training error is calculated:
[0056]
[0057] When i = k, θ ik =1, i represents the i-th category. When the original input belongs to category i, y k * =1;
[0058] The training set was selected to train the Densenet improved model and the test set was selected to verify the trained Densenet improved model, and the trained Densenet improved model was obtained. The ratio of the training set to the test set was 4:1. The training process was as follows: the training error was used to backpropagate from the last layer of the convolutional neural network, and the cross entropy was used as the loss function. The Adam adaptive gradient optimizer was used for optimization. The initial learning rate was set to 0.01, and the training rounds were 100 times. The TensorFlow2.0 framework was used for experiments, and the trained model was saved.
[0059] (2) Input the target image into the Densenet improved model trained in step (1), and the trained Densenet improved model outputs the target category.
[0060] In order to verify the performance of the Densenet improved model of the present invention, this embodiment is experimented on a private data set, and the experimental results are shown in Table 1:
[0061] Table 1
[0062] Model SqueezeNet MobileNet The present invention Accuracy 94.92% 95.93% 98.71%
[0063] From the above results, it can be found that the improved Densenet model in the present invention has a slight improvement in accuracy compared with the traditional network.
[0064] It has been verified that the target recognition method based on lightweight neural network of the present invention is the first to propose a Densenet improved model obtained by combining the channel intention order characteristics of ShuffleNet in convolutional neural network, the residual network in ResNet, the channel segmentation in Inception, the multiple residual networks in DenseNet and the DWConv in MobileNet. Compared with the traditional network and the lightweight network, the Densenet improved model further improves the accuracy and reduces the structure of the model. The application of the Densenet improved model to complete target category recognition not only has a small amount of data processing, but also has high recognition accuracy, and has great application prospects.
[0065] Example 2
[0066] A kit includes a central host and five embedded devices, wherein the embedded devices are connected to the central host for communication;
[0067] The embedded device includes one or more processors, one or more memories, one or more programs and an input unit, the input unit is used to input a target image, the one or more programs are stored in the memory, and when the one or more programs are executed by the processor, the embedded device executes the same target recognition method based on a lightweight neural network as in Example 1;
[0068] The central host runs as Figure 2 The procedure shown:
[0069] (1) Central host (based on RabbitMQ Figure 2 (Run in mq) obtain the heartbeat packets sent regularly by each embedded device, confirm the online status of the embedded device and remove the offline embedded devices;
[0070] (2) The central host sends the target image to each online embedded device, and each online embedded device runs a target recognition method based on a lightweight neural network to obtain the target category;
[0071] (3) Each online embedded device sends the target category it obtains to the central host, and the central host obtains the final result based on the target category obtained by each online embedded device (specifically, the final result is confirmed based on the weight coefficient of each online embedded device).
[0072] For verification, this embodiment is experimented on a private data set, and the experimental results are shown in Table 2:
[0073] Table 2
[0074] Model Single device 5 embedded devices Accuracy 98.71% 99.21%
[0075] From the above results, we can find that the system integrating 5 devices not only improves availability but also slightly improves target recognition accuracy.
[0076] It has been verified that the equipment kit of the present invention provides a high-availability architecture based on lightweight neural networks, which has good flexibility and can be used for step-by-step processing using embedded devices. When one of the embedded devices goes down, it will not affect the overall structure. When adding a new model, there is no need to stop the original model, truly realizing hot deployment, which has great application prospects.
[0077] Although specific embodiments of the present invention are described above, those skilled in the art should understand that these are merely examples and that various changes or modifications may be made to these embodiments without violating the principles and essence of the present invention.
Claims
1. A target recognition method based on lightweight neural network, It is characterized in that Input the target image into the trained Densenet improved model, and the trained Densenet improved model outputs the target category; The improvement of the Densenet improved model compared to the Densenet model is that the Back Bone in the network block includes Channel Split, a first convolutional layer, a second convolutional layer, a third convolutional layer, a first depth separation convolutional layer, a second depth separation convolutional layer, Concat, and Channel Shuffle, wherein Channel Split, the first convolutional layer, the first depth separation convolutional layer, the second convolutional layer, Concat, and Channel Shuffle are connected in sequence, the second depth separation convolutional layer and the third convolutional layer are connected in parallel with the first convolutional layer, the first depth separation convolutional layer, and the second convolutional layer, the second depth separation convolutional layer is connected to ChannelSplit, and the third convolutional layer is connected to Concat; The Densenet improved model includes a main convolutional layer, a feature extraction layer, a first network block, a transition layer, a second network block, and a classification layer connected in sequence; the first network block and the second network block have the same structure; The network block includes a first Back Bone, a second Back Bone, a third Back Bone and a fourth Back Bone connected in sequence, the output of the first Back Bone is simultaneously the input of the second Back Bone, the third Back Bone and the fourth Back Bone, and the output of the second Back Bone is simultaneously the input of the third Back Bone and the fourth Back Bone; The transition layer includes a convolution layer and a feature extraction layer; The classification layer includes an average pooling layer and a Softmax classifier; Select a training set to train the Densenet improved model and select a test set to verify the trained Densenet improved model to obtain a trained Densenet improved model; The target image is input into the trained Densenet improved model, and the trained Densenet improved model outputs the target category.
2. According to claim 1, a target recognition method based on a lightweight neural network, It is characterized in that The ratio of the number of training sets to the number of test sets of the Densenet improved model is 4:
1.
3. A device using a target recognition method based on a lightweight neural network as described in any one of claims 1 to 2, It is characterized in that It includes one or more processors, one or more memories, one or more programs and an input unit; The input unit is used to input a target image; The one or more programs are stored in the memory, and when the one or more programs are executed by the processor, the device executes the target recognition method based on a lightweight neural network as described in any one of claims 1 to 2.
4. A system for intelligent warehousing, comprising the device as claimed in claim 3, It is characterized in that Includes a central host and one or more embedded devices; The device adopts the device as claimed in claim 3, and the device is communicatively connected with the central host; The central host puts the prediction structure into RabbitMQ and only needs to fetch the results from RabbitMQ, thus decoupling the business from other businesses. The central host runs the following program: (1) The central host obtains the heartbeat packets sent regularly by each device based on RabbitMQ, confirms the online status of the device and removes offline devices; (2) The central host sends the target image to each online device, and each online device runs the target recognition method based on a lightweight neural network as described in any one of claims 1 to 2 to obtain the target category; (3) Each online device sends the target category it obtains to the central host, and the central host obtains the final result based on the target category obtained by each online device.
5. The system for intelligent warehousing according to claim 4, It is characterized in that The specific scheme for obtaining the final result according to the target categories obtained by each online device is to confirm the final result according to the election rules or to confirm the final result according to the weight coefficient of each online device.
Citation Information
Patent Citations
An ultra-high-speed real-time target detection system and method based on a lightweight neural network
CN109685017A
