Protective gear identification method, device, electronic device and storage medium
The method optimizes protective gear recognition by adjusting network depth and width for hardware performance and using a feature pyramid structure to enhance recognition speed and accuracy in high-data-volume environments.
Patent Information
- Application Number
- CN202210215860.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-07
- Publication Date
- 2024-12-20
- Estimated Expiration
- 2042-03-07
AI Technical Summary
Existing protective gear monitoring technologies face challenges with high data volume, low efficiency, and accuracy due to manual monitoring and inadequate electronic monitoring systems, especially in places with large traffic flow.
A method and device for protective gear recognition using a training network that adjusts to hardware parameters, changes data formats, and incorporates a feature pyramid structure and anchor-free method to improve recognition speed and accuracy.
Enhances the speed and accuracy of protective gear recognition by optimizing network depth and width for hardware performance, reducing errors, and improving model convergence and recognition speed.
Smart Images

Figure CN114595759B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to computer technology, and more particularly to a protective gear identification method, device, electronic device and storage medium. Background Art
[0002] With the increase of respiratory diseases and industrial unsafe factors, it is necessary to do a good job of safety protection in different places to prevent unfortunate events from happening to people in the places. Because people have strong subjective initiative, the impulse of special events and the decline of memory will have a certain impact on safety protection. Doing a good job of monitoring protective gear in different places has become a key link in improving public safety protection. The existing monitoring of safety protection in different places is mainly manual monitoring and reminders. For places with large traffic flow, the disadvantages of manual monitoring and reminders will be highlighted. It can be seen that the monitoring of safety protection in different places is urgent to move from manual to electronic. The existing protective gear monitoring technology cannot achieve a good monitoring effect of protective gear in different places due to the large amount of monitoring data and high requirements for monitoring equipment, as well as low monitoring efficiency and accuracy. Summary of the invention
[0003] The present invention provides a protective gear recognition method, device, electronic equipment and storage medium to achieve the effect of quickly recognizing safety protective gear in an image.
[0004] In a first aspect, an embodiment of the present invention provides a protective gear identification method, the method comprising:
[0005] Obtaining the image to be detected, the hardware parameters of the terminal and the original training data, and building a training network according to the hardware parameters;
[0006] The data format of the original training data is changed to a target format to obtain target training data, and the training network is initially trained according to the initial data set to obtain an initial recognition model;
[0007] Training the initial recognition model according to the target training data to obtain a protective gear recognition model;
[0008] The image to be detected is input into the protective gear recognition model to obtain a detection result of the image to be detected.
[0009] Further, building a training network according to the hardware parameters includes:
[0010] Determine the target depth and target width of the backbone network of the training network according to the hardware parameters;
[0011] Building the backbone network for extracting image features in the image to be detected according to the target depth and the target width;
[0012] A feature pyramid structure for detecting a feature map of the image to be detected is added to the residual network of the training network, and an anchor-free method and a decoupling head for predicting a detection result of the image to be detected are added to the residual network, wherein the feature map of the image to be detected is constructed according to image features in the image to be detected.
[0013] Further, determining the target depth and target width of the backbone network of the training network according to the hardware parameters includes:
[0014] Setting multiple groups of parameters, each group of parameters in the multiple groups of parameters includes a depth parameter and a width parameter, and performing simulation tests on the hardware parameters according to the training network corresponding to each group of parameters to obtain the accuracy and transmission rate corresponding to each group of parameters;
[0015] A parameter combination corresponding to the fastest transmission rate with an accuracy greater than a preset threshold is selected as the target depth and target width of the backbone network.
[0016] Furthermore, building the backbone network according to the target depth and the target width includes:
[0017] Adding a convolutional layer to the backbone network, and using the convolutional layer to scale the channel data of the backbone network so that the depth and width of the backbone network reach the target depth and the target width;
[0018] Batch normalization and an activation function for forming a bottleneck layer are added after the convolution layer to obtain the backbone network.
[0019] Further, the data format of the original training data is changed to a target format to obtain target training data, including:
[0020] Determine a detection target corresponding to the image to be detected, and determine a target format corresponding to the original training data according to the category corresponding to the detection target;
[0021] The format of the original training data is changed according to the target format corresponding to the original training data to obtain the target training data.
[0022] Further, the training network is initially trained according to the initial data set to obtain an initial recognition model, including:
[0023] Training the backbone network in the training network according to the target detection data in the initial data set to obtain initial parameters corresponding to the backbone network;
[0024] The initial parameters are updated to the backbone network to obtain the initial recognition model.
[0025] Furthermore, after the image to be detected is input into the protective gear recognition model and the detection result of the image to be detected is obtained, the following steps are included:
[0026] Generate warning information according to the detection result of the image to be detected, and display the warning information.
[0027] In a second aspect, an embodiment of the present invention provides a protective gear identification device, the device comprising:
[0028] A network building module is used to obtain the image to be detected, the hardware parameters of the terminal and the original training data, and to build a training network according to the hardware parameters;
[0029] An initial training module, used to change the data format of the original training data to a target format to obtain target training data, and to perform initial training on the training network according to the initial data set to obtain an initial recognition model;
[0030] A model training module, used to train the initial recognition model according to the target training data to obtain a protective gear recognition model;
[0031] The image detection module is used to input the image to be detected into the protective gear recognition model to obtain the detection result of the image to be detected.
[0032] In a third aspect, an embodiment of the present invention provides an electronic device, the electronic device comprising:
[0033] one or more processors;
[0034] a storage device for storing one or more programs,
[0035] When the one or more programs are executed by the one or more processors, the one or more processors implement the protective gear identification method.
[0036] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, which implements the protective gear identification method when executed by a processor.
[0037] In the embodiment of the present invention, the image to be detected, the hardware parameters of the terminal and the original training data are obtained, and a training network is built according to the hardware parameters; the data format of the original training data is changed to the target format to obtain the target training data, and the training network is initially trained according to the initial data set to obtain the initial recognition model; the initial recognition model is trained according to the target training data to obtain the protective gear recognition model; the image to be detected is input into the protective gear recognition model to obtain the detection result of the image to be detected. That is, in the embodiment of the present invention, by building different training networks for different hardware parameters, the data transmission speed is taken into account while not affecting the accuracy of the training network, the speed of protective gear recognition is improved, and recognition errors when the data volume is large are avoided; data information is accurately obtained by changing the data format, and the model convergence speed and the accuracy of model recognition are improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Figure 1 is a flow chart of a protective gear identification method provided by an embodiment of the present invention;
[0039] Figure 2 is another schematic flow chart of the protective gear identification method provided by an embodiment of the present invention;
[0040] Figure 3 Schematic diagram of the principle of the protective gear identification method provided by an embodiment of the present invention;
[0041] Figure 4 is a structural schematic diagram of a protective gear identification device provided by an embodiment of the present invention;
[0042] Figure 5 It is a structural schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0043] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only parts related to the present invention, rather than all structures, are shown in the accompanying drawings.
[0044] Figure 1 The present invention provides a flowchart of a protective gear identification method. The method can be performed by a protective gear identification device provided by an embodiment of the present invention. The device can be implemented in software and / or hardware. In a specific embodiment, the device can be integrated into an electronic device, such as a server. The following embodiments will be described by taking the device integrated into an electronic device as an example. Figure 1 , the method may specifically include the following steps:
[0045] S110, obtaining an image to be detected, hardware parameters of the terminal and original training data, and building a training network according to the hardware parameters;
[0046] For example, the image to be detected can come from an image acquisition device, which can be a device with image acquisition function such as a camera or a video recorder installed in different places, which is used to collect the use of protective gear on specific objects in different places. When the security level of the place is relatively high, and the detection target is an emergency treatment target, it is necessary to use the latest images in different places in real time according to the image acquisition device as the image to be detected, and use the image to be detected to detect whether the specific objects in different places wear the corresponding protective gear as required, that is, the detection target. If the specific object in the image to be detected wears protective gear, it means that the specific object is in a safe state; if the characteristic object in the image to be detected does not wear protective gear, emergency warning processing is required. The terminal can be an electronic device that collects the image to be detected, and can run the program corresponding to the protective gear recognition method at the same time, or an electronic device that performs image processing, and can perform protective gear recognition from the image to be detected obtained by the image acquisition device. The hardware parameters of the terminal can be parameters corresponding to the CPU, graphics card, and wires, which are used to reflect the hardware performance and transmission speed of the terminal. The original training data can be the training data corresponding to the protective gear on the detection object corresponding to different places, which is used to train the recognition model corresponding to the protective gear on the detection object. The training network can be a neural network built according to needs for training recognition models. The training network includes a backbone network and a residual network.
[0047] In a specific implementation, after the image to be detected is acquired from different places according to the image acquisition device, the hardware parameters of the terminal can be obtained according to the terminal that acquires the image to be detected and the original training data corresponding to the image to be detected. The depth and width of the backbone network with the best performance corresponding to the image to be detected are determined according to the performance and transmission speed parameters in the hardware parameters of the terminal, and the backbone network in the training network is built according to the depth and width of the backbone network with the best performance, so as to train the recognition model according to the backbone network with the best performance for the detection of specific objects or detection targets on the image to be detected on the terminal.
[0048] S120, changing the data format of the original training data to the target format to obtain target training data, and performing initial training on the training network according to the initial data set to obtain an initial recognition model;
[0049] For example, the data format of the original training data can be an unprocessed data format obtained from the original database. The target format can be to determine the detection target according to the location where the image to be detected is obtained. Different detection targets have different categories, and corresponding data formats are set for different detection targets. For example, the COCO data format is generally used for single object recognition, and the PACAL VOC data format is selected for overlapping and important categories, wherein each data format corresponds to different label information. The target training data can be standardized training data obtained from the original database by changing the data format of the original training data.
[0050] In the specific implementation, the training network built includes a backbone network and a residual network, wherein the backbone network is used to extract the features of the detection target in the image to be detected, and the residual network is used to perform feature recognition and position information prediction on the features of the detection target in the image to be detected. After the training network is built, the training network is trained by the initial data set until the model converges to obtain the initial recognition model, wherein the initial data set is generally a standard data set containing multiple types of detection targets, such as: COCO data set and ImageNet image data set. The training network is trained by the initial data set to obtain the initial recognition model, and the initial recognition model can identify the basic model of more than 80 or more detection targets in the standard type. For the basic training model, when the image to be detected changes, that is, when the detection target changes, it is not necessary to repeatedly train the initial recognition model, and only the target training data is needed to train the initial recognition model, and the final recognition model can be quickly obtained. Among them, by changing the data format of the original training data to the target format, different data formats are changed for different detection targets, and accurate data label information can be obtained for the features of different detection targets, and the feature attributes can be quickly found in the process of model training to converge to obtain the recognition model.
[0051] S130, training the initial recognition model according to the target training data to obtain a protective gear recognition model;
[0052] In a specific implementation, the images in the target training sample data are input into the initial recognition model for target recognition, and the output of the initial recognition model can be the probability of having a detected target in each image and the predicted position of the detected target in the image. Among them, the probability of having a detected target in each image can be the confidence of the predicted position of the detected target in the image, or it can be the average probability value of multiple detected targets identified in each image. A learning correction function can also be set in the initial recognition model to determine the degree of model training using the confidence corresponding to the predicted position information.
[0053] S140, inputting the image to be detected into the protective gear recognition model to obtain a detection result of the image to be detected.
[0054] In a specific implementation, the detection result of the image to be detected can be the output result of the protective gear recognition model obtained by inputting each image to be detected into the protective gear recognition model, and the output result includes the detection position information and confidence of the detection target in the image to be detected. According to actual needs and experimental data, the confidence threshold can be pre-set to judge whether the specific object in the image to be detected is wearing protective gear in the output result of the protective gear recognition model. If the specific object in the image to be detected is wearing protective gear, it means that the specific object is in a safe state; if the characteristic object in the image to be detected is not wearing protective gear, emergency warning processing is required.
[0055] In the embodiment of the present invention, the image to be detected, the hardware parameters of the terminal and the original training data are obtained, and a training network is built according to the hardware parameters; the data format of the original training data is changed to the target format to obtain the target training data, and the training network is initially trained according to the initial data set to obtain the initial recognition model; the initial recognition model is trained according to the target training data to obtain the protective gear recognition model; the image to be detected is input into the protective gear recognition model to obtain the detection result of the image to be detected. That is, in the embodiment of the present invention, by building different training networks for different hardware parameters, the data transmission speed is taken into account while not affecting the accuracy of the training network, the speed of protective gear recognition is improved, and recognition errors when the data volume is large are avoided; data information is accurately obtained by changing the data format, and the model convergence speed and the accuracy of model recognition are improved.
[0056] The protective gear identification method provided by the embodiment of the present invention is further described below. Figure 2 As shown, the method may specifically include the following steps:
[0057] S210, obtaining an image to be detected, hardware parameters of the terminal and original training data, and determining a target depth and a target width of a backbone network of the training network according to the hardware parameters;
[0058] In a specific implementation, the target depth can be the amount of data corresponding to the convolution kernel of the backbone network for building the training network, which is also understood as the number of network layers in the backbone network, and is used to determine the extraction effect of the network in extracting features from the image. Since the effect of the neural network is closely related to the number of layers of the neural network, the deeper the network, the greater the difficulty, the greater the training cost, and the greater the requirements for the running device. The target width can be the number of convolution kernel channels set for the convolution operation in the backbone network for building the training network, which is used to determine the size of the network output feature layer. According to the performance and transmission speed parameters in the hardware parameters of the running model terminal, under the condition that the network effect of the training network remains unchanged within the preset range, that is, the recognition accuracy of the training network is greater than that within the preset range, a training network that better matches the terminal hardware parameters is determined, and the running speed of the training network can be improved based on the hardware parameters of the terminal, and the training speed of the model and the recognition speed of the recognition model can be improved.
[0059] Furthermore, the target depth and target width of the backbone network of the training network are determined according to the hardware parameters, including:
[0060] Set multiple groups of parameters, each of which includes depth parameters and width parameters. Perform simulation tests on the hardware parameters based on the training network corresponding to each group of parameters to obtain the accuracy and transmission rate corresponding to each group of parameters.
[0061] The parameter combination corresponding to the fastest transmission rate with an accuracy greater than a preset threshold is selected as the target depth and target width of the backbone network.
[0062] For example, according to the hardware parameters of the terminal, multiple groups of parameters can be pre-set according to actual needs and experimental data, and each group of parameters in the multiple groups of parameters includes a depth parameter and a width parameter, wherein the depth parameter in each group of parameters can be the depth value of the network, and the width parameter in each group of parameters can be the width value of the network. Among them, each group of parameters in the multiple groups of parameters includes a depth parameter and a width parameter, for example: multiple groups of parameters can be [1,1], [0.67, 0.75], [0.33, 0.25], [0.33, 0.375] and [0.33, 0.5], etc. The accuracy rate corresponding to each group of parameters can be the probability that the training network built by the depth parameters and width parameters corresponding to the group of parameters is accurate when testing the test image. The transmission rate corresponding to each group of parameters can be the rate of data transmission and processing when the training network built by the depth parameters and width parameters corresponding to the group of parameters tests the test image.
[0063] In a specific implementation, the hardware parameters of the training network are simulated and tested according to each set of parameters. It can be that the preset multiple sets of parameters are tested one by one on the terminal to obtain the accuracy and transmission rate corresponding to each set of parameters. The accuracy threshold corresponding to the training network is pre-set according to actual needs and experimental data, and the accuracy and transmission rate corresponding to each set of parameters are compared according to the preset threshold to determine the parameter group with an accuracy greater than the preset threshold among the multiple sets of parameters, and then the depth parameter and width parameter of the parameter group with the largest transmission rate among the parameter groups with an accuracy greater than the preset threshold among the multiple sets of parameters are selected as the target depth and target width of the backbone network of the training network, so as to build the backbone network according to the target depth and target width.
[0064] S220, building a backbone network for extracting image features in the image to be detected according to the target depth and the target width;
[0065] In a specific implementation, the image features in the image to be detected can be the image feature information in the image to be detected extracted by the backbone network in the training network. The target depth and target width of the backbone network of the training network are determined according to the hardware parameters of the terminal. The backbone network of the training network is built according to the target depth and target width. The depth and width of the backbone network can be adjusted on the basis of the architecture of the initial backbone network to obtain a backbone network that meets the target depth and target width. Alternatively, the backbone network can be built by directly passing through the convolution layer and the setting of the convolution kernel using the target depth and target width, so as to extract the image features in the image to be detected according to the backbone network in the training network, and use the remaining networks in the training network to identify and predict the image to be detected.
[0066] Furthermore, a backbone network is built according to the target depth and target width, including:
[0067] Add convolutional layers to the backbone network and use the convolutional layers to scale the channel data of the backbone network so that the depth and width of the backbone network reach the target depth and target width;
[0068] Batch normalization and activation functions are added after the convolutional layers to form a bottleneck layer, resulting in the backbone network.
[0069] For example, the convolution layer can be a network layer in the training network composed of convolution units for performing convolution operations, which is used to extract image features in the image to be detected, wherein the channel parameters in the convolution layer and the number of convolution kernels in the convolution layer can be set to control the backbone network in the training network to reach the target depth and target width. Batch normalization can be a way to normalize the data to be processed, which is used to speed up the convergence speed during model training and stabilize the training network. The activation function can be a function running on the neuron corresponding to the training network, which is used to map the input of the neuron to the output. Among them, batch normalization and activation functions are used to form a bottleneck layer, which is used to reduce the amount of parameters calculated by the training network, and has the effect of reducing and increasing feature dimensions, thereby reducing the amount of parameter calculation.
[0070] In a specific implementation, the backbone network of the training network is built according to the target depth and target width. The depth and width of the backbone network can be adjusted based on the architecture of the initial backbone network to obtain a backbone network that meets the target depth and target width. The backbone network is built by setting the parameters of the convolution layer of the backbone network in the training network and the number of convolution kernels in the convolution layer, so that the backbone network in the training network reaches the target depth and target width. Batch normalization and activation functions for forming bottleneck layers are added after the convolution layer. By controlling the number of bottleneck layers, the number of parameters calculated by the training network is reduced, and the feature dimension is reduced and increased, thereby reducing the amount of parameter calculation, so that the training network can accelerate the speed of model convergence and the speed of model recognition when training according to the target data.
[0071] S230. Add a feature pyramid structure for detecting a feature map of the image to be detected in the remaining network of the training network, and add an anchor-free method and a decoupling head for predicting a detection result of the image to be detected in the remaining network, wherein the feature map of the image to be detected is constructed according to image features in the image to be detected.
[0072] For example, the feature map of the image to be detected can be a feature pyramid structure from top to bottom, and the image feature information in the image to be detected is transferred and fused in this way to obtain a feature map for prediction, wherein the feature pyramid structure is used to predict the image features in the image to be detected from top to bottom, and then the feature map for prediction is transferred and fused in this way. The anchor-free method can be to combine the features of different network layers in the training network through a decoupling head to form a prediction matrix, so that the training network predicts different categories of information at one time through the prediction matrix, reduces the number of prediction groups, reduces the number of parameters, and does not need to set the size of the sliding window. The decoupling head can be different detection branches and detection heads after dimensionality reduction, which are used to detect the target category, positioning and confidence in the image. While improving the detection effect, it can also improve the target detection speed and avoid the increase in calculation amount.
[0073] In the specific implementation, a feature pyramid structure is added to the residual network in the training network, so that the residual network can transfer and fuse the image features in the high-level image to be detected from top to bottom through upsampling to obtain the feature map for prediction. According to the combination of anchor-free method and decoupling head, the features of different network layers in the training network are combined through the decoupling head to form a prediction matrix, so that the training network can predict different categories of information at one time through the prediction matrix, reduce the number of prediction groups, reduce the number of parameters, and avoid setting a sliding window to reduce the accuracy of the prediction.
[0074] S240, changing the data format of the original training data to the target format to obtain the target training data, and performing initial training on the training network according to the initial data set to obtain an initial recognition model;
[0075] Furthermore, the data format of the original training data is changed to the target format to obtain the target training data, including:
[0076] Determine the detection target corresponding to the image to be detected, and determine the target format corresponding to the original training data according to the category corresponding to the detection target;
[0077] The format of the training data is changed according to the target format corresponding to the training data to obtain the target training data.
[0078] In the specific implementation, by changing the data format of the original training data to the target format, different data formats can be changed for different detection targets, and accurate data label information can be obtained for the features of different detection targets, so that the feature attributes can be quickly found and converged to obtain the recognition model during the model training process. First, the detection target corresponding to the image to be detected is determined according to the acquisition location corresponding to the image to be detected. The detection targets set in different locations are not the same. For example, in a factory with a lot of flying dust, in order to prevent workers from getting pneumoconiosis, it is necessary to detect the wearing of masks by workers in the image to be detected. The feature object is the worker, the protective gear is the mask, and the detection target is the mask on the worker. Determine the target format corresponding to the training data according to the category corresponding to the detection target. Because the detection target is not an overlapping image, no special processing of the category is required. In my protective gear recognition, it is the recognition of protective gear on a specific object. The target format needs to be changed. The target format needs to have detailed category information. For example, the PACAL VOC data format is more accurate for the detection target, and the recognition speed is faster, which speeds up the convergence of the model during the training process.
[0079] Furthermore, the training network is initially trained according to the initial data set to obtain an initial recognition model, including:
[0080] The backbone network in the training network is trained according to the target detection data in the initial data set to obtain the initial parameters corresponding to the backbone network;
[0081] Update the initial parameters to the backbone network to obtain the initial recognition model.
[0082] In the specific implementation, after the training network is built, the training network is trained with the initial data set until the model converges to obtain the initial recognition model, wherein the initial data set is generally a standard data set containing multiple types of detection targets, such as the COCO data set and the ImageNet image data set. The training network is trained with the initial data set to obtain the initial recognition model, which can identify the basic model of more than 80 or more detection targets in the standard type. For the basic training model, when the image to be detected changes, that is, when the detection target changes, there is no need to repeatedly train the initial recognition model. It only needs to be trained with the target training data, and the final recognition model can be quickly obtained.
[0083] S250, training the initial recognition model according to the target training data to obtain a protective gear recognition model;
[0084] S260: Input the image to be detected into the protective gear recognition model to obtain a detection result of the image to be detected.
[0085] Furthermore, after the image to be detected is input into the protective gear recognition model and the detection result of the image to be detected is obtained, the following steps are included:
[0086] Generate warning information based on the detection results of the image to be detected and display the warning information.
[0087] In a specific implementation, the warning information may be a warning information generated based on the detection result of the image to be detected, including the detection position information and confidence of the detection target in the image to be detected. It may be a warning mark on the detection position information of the detection target in the image to be detected. It may also be a warning information generated based on the detection position information of the detection target in the image to be detected, indicating the detection position information, time and whether to wear protective gear of the detection target in the image to be detected. It may also be a warning information generated based on the detection position information of the detection target in the image to be detected, and the detection position information of the detection target in the image to be detected is determined by trajectory mapping to generate warning marks and prompt information of the moving position of the current detection target, and the warning information is displayed through a display device so that the user can perform relevant processing according to the displayed warning information.
[0088] Figure 3 A schematic diagram of the principle of the protective gear identification method provided by an embodiment of the present invention is shown in FIG. Figure 3As shown, the image to be detected and the original training data are obtained, and the data format of the original training data is changed to obtain the target training data. The training network is trained according to the initial data to obtain the initial recognition model. The target training data is divided into a training data set and a verification data set, and the initial recognition model is trained according to the training data set, and the model trained according to the verification data set is verified to obtain the protective gear recognition model. Among them, the training network can be built according to the hardware parameters of the terminal.
[0089] In the embodiment of the present invention, the image to be detected, the hardware parameters of the terminal and the original training data are obtained, and a training network is built according to the hardware parameters; the data format of the original training data is changed to the target format to obtain the target training data, and the training network is initially trained according to the initial data set to obtain the initial recognition model; the initial recognition model is trained according to the target training data to obtain the protective gear recognition model; the image to be detected is input into the protective gear recognition model to obtain the detection result of the image to be detected. That is, in the embodiment of the present invention, by building different training networks for different hardware parameters, the data transmission speed is taken into account while not affecting the accuracy of the training network, the speed of protective gear recognition is improved, and recognition errors when the data volume is large are avoided; data information is accurately obtained by changing the data format, and the model convergence speed and the accuracy of model recognition are improved.
[0090] Figure 4 is a schematic diagram of the structure of the protective gear identification device provided by an embodiment of the present invention. Figure 4 As shown, the protective gear identification device comprises:
[0091] The network building module 410 is used to obtain the image to be detected, the hardware parameters of the terminal and the original training data, and to build a training network according to the hardware parameters;
[0092] An initial training module 420 is used to change the data format of the original training data to a target format to obtain target training data, and to perform initial training on the training network according to the initial data set to obtain an initial recognition model;
[0093] A model training module 430 is used to train the initial recognition model according to the target training data to obtain a protective gear recognition model;
[0094] The image detection module 440 is used to input the image to be detected into the protective gear recognition model to obtain a detection result of the image to be detected.
[0095] In one embodiment, the network building module 410 builds a training network according to the hardware parameters, including:
[0096] Determine the target depth and target width of the backbone network of the training network according to the hardware parameters;
[0097] Building the backbone network for extracting image features in the image to be detected according to the target depth and the target width;
[0098] A feature pyramid structure for detecting a feature map of the image to be detected is added to the residual network of the training network, and an anchor-free method and a decoupling head for predicting a detection result of the image to be detected are added to the residual network, wherein the feature map of the image to be detected is constructed according to image features in the image to be detected.
[0099] In one embodiment, the network building module 410 determines the target depth and target width of the backbone network of the training network according to the hardware parameters, including:
[0100] Setting multiple groups of parameters, each group of parameters in the multiple groups of parameters includes a depth parameter and a width parameter, and performing simulation tests on the hardware parameters according to the training network corresponding to each group of parameters to obtain the accuracy and transmission rate corresponding to each group of parameters;
[0101] A parameter combination corresponding to the fastest transmission rate with an accuracy greater than a preset threshold is selected as the target depth and target width of the backbone network.
[0102] In one embodiment, the network building module 410 builds the backbone network according to the target depth and the target width, including:
[0103] Adding a convolutional layer to the backbone network, and using the convolutional layer to scale the channel data of the backbone network so that the depth and width of the backbone network reach the target depth and the target width;
[0104] Batch normalization and an activation function for forming a bottleneck layer are added after the convolution layer to obtain the backbone network.
[0105] In one embodiment, the initial training module 420 changes the data format of the original training data to a target format to obtain target training data, including:
[0106] Determine a detection target corresponding to the image to be detected, and determine a target format corresponding to the original training data according to the category corresponding to the detection target;
[0107] The format of the original training data is changed according to the target format corresponding to the original training data to obtain the target training data.
[0108] In one embodiment, the initial training module 420 performs initial training on the training network according to the initial data set to obtain an initial recognition model, including:
[0109] Training the backbone network in the training network according to the target detection data in the initial data set to obtain initial parameters corresponding to the backbone network;
[0110] The initial parameters are updated to the backbone network to obtain the initial recognition model.
[0111] In one embodiment, after the image detection module 440 inputs the image to be detected into the protective gear recognition model and obtains the detection result of the image to be detected, the following steps are performed:
[0112] Generate warning information according to the detection result of the image to be detected, and display the warning information.
[0113] In the embodiment of the present invention, the image to be detected, the hardware parameters of the terminal and the original training data are obtained, and a training network is built according to the hardware parameters; the data format of the original training data is changed to the target format to obtain the target training data, and the training network is initially trained according to the initial data set to obtain the initial recognition model; the initial recognition model is trained according to the target training data to obtain the protective gear recognition model; the image to be detected is input into the protective gear recognition model to obtain the detection result of the image to be detected. That is, in the embodiment of the present invention, by building different training networks for different hardware parameters, the data transmission speed is taken into account while not affecting the accuracy of the training network, the speed of protective gear recognition is improved, and recognition errors when the data volume is large are avoided; data information is accurately obtained by changing the data format, and the model convergence speed and the accuracy of model recognition are improved.
[0114] Figure 5 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. Figure 5 A block diagram of an exemplary electronic device 12 suitable for use in implementing embodiments of the present invention is shown. Figure 5 The electronic device 12 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0115] like Figure 5 As shown, the electronic device 12 is in the form of a general purpose computing device. The components of the electronic device 12 may include, but are not limited to: one or more processors or processing units 16, a system memory 28, and a bus 18 that connects various system components (including the system memory 28 and the processing unit 16).
[0116] Bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor or a local bus using any of a variety of bus architectures. By way of example, these architectures include, but are not limited to, an Industry Standard Architecture (ISA) bus, a Micro Channel Architecture (MAC) bus, an Enhanced ISA bus, a Video Electronics Standards Association (VESA) local bus, and a Peripheral Component Interconnect (PCI) bus.
[0117] The electronic device 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the electronic device 12, including volatile and non-volatile media, removable and non-removable media.
[0118] The system memory 28 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 30 and / or cache memory 32. The electronic device 12 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the storage system 34 may be used to read and write non-removable, non-volatile magnetic media ( Figure 5 not shown, usually called a "hard drive"). Although Figure 5 Not shown in the figure, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk"), and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, a DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to the bus 18 via one or more data medium interfaces. The memory 28 may include at least one program product having a set (e.g., at least one) of program modules that are configured to perform the functions of the various embodiments of the present invention.
[0119] A program / utility 40 having a set (at least one) of program modules 42 may be stored, for example, in the memory 28, such program modules 42 including but not limited to an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment. The program modules 42 generally perform the functions and / or methods of the embodiments described herein.
[0120] The electronic device 12 may also communicate with one or more external devices 14 (e.g., keyboards, pointing devices, displays 24, etc.), may communicate with one or more devices that enable a user to interact with the electronic device 12, and / or may communicate with any device that enables the electronic device 12 to communicate with one or more other computing devices (e.g., network cards, modems, etc.). This communication may be performed via an input / output (I / O) interface 22. In addition, the electronic device 12 may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via a network adapter 20. As shown, the network adapter 20 communicates with other modules of the electronic device 12 via a bus 18. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, etc.
[0121] The processing unit 16 executes various functional applications and data processing by running the program stored in the system memory 28, for example, implementing the protective gear identification method provided in the embodiment of the present invention, which includes:
[0122] Obtaining the image to be detected, the hardware parameters of the terminal and the original training data, and building a training network according to the hardware parameters;
[0123] The data format of the original training data is changed to a target format to obtain target training data, and the training network is initially trained according to the initial data set to obtain an initial recognition model;
[0124] Training the initial recognition model according to the target training data to obtain a protective gear recognition model;
[0125] The image to be detected is input into the protective gear recognition model to obtain a detection result of the image to be detected.
[0126] The embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon. When the program is executed by a processor, the protective gear identification method as described above is implemented. The method includes:
[0127] Obtaining the image to be detected, the hardware parameters of the terminal and the original training data, and building a training network according to the hardware parameters;
[0128] The data format of the original training data is changed to a target format to obtain target training data, and the training network is initially trained according to the initial data set to obtain an initial recognition model;
[0129] Training the initial recognition model according to the target training data to obtain a protective gear recognition model;
[0130] The image to be detected is input into the protective gear recognition model to obtain a detection result of the image to be detected.
[0131] The computer storage medium of the embodiment of the present invention can adopt any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, a computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, device or device or used in combination with it.
[0132] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, which carry computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0133] The program code embodied on the computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
[0134] Computer program code for performing the operation of the present invention may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0135] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.
Claims
1. A protective gear identification method, characterized in that: include: Obtaining an image to be detected, hardware parameters of the terminal and original training data, and building a training network according to the hardware parameters, wherein the hardware parameters of the terminal are parameters used to reflect the hardware performance and transmission speed of the terminal; The data format of the original training data is changed to a target format to obtain target training data, and the training network is initially trained according to the initial data set to obtain an initial recognition model; Training the initial recognition model according to the target training data to obtain a protective gear recognition model; Inputting the image to be detected into the protective gear recognition model to obtain a detection result of the image to be detected; The step of building a training network according to the hardware parameters includes: Determine the target depth and target width of the backbone network of the training network according to the hardware parameters; Building the backbone network for extracting image features in the image to be detected according to the target depth and the target width; A feature pyramid structure for detecting the feature map of the image to be detected is added to the residual network of the training network, and an anchor-free method and a decoupling head for predicting the detection result of the image to be detected are added to the residual network, wherein the feature map of the image to be detected is constructed according to the image features in the image to be detected; wherein the feature pyramid structure is used to enable the residual network to transfer and fuse the image features in the high-level image to be detected in a top-down order by upsampling to obtain a feature map for prediction.
2. The method according to claim 1, characterized in that Determining a target depth and a target width of a backbone network of the training network according to the hardware parameters includes: Setting multiple groups of parameters, each group of parameters in the multiple groups of parameters includes a depth parameter and a width parameter, and performing simulation tests on the hardware parameters according to the training network corresponding to each group of parameters to obtain the accuracy and transmission rate corresponding to each group of parameters; A parameter combination corresponding to the fastest transmission rate with an accuracy greater than a preset threshold is selected as the target depth and target width of the backbone network.
3. The method according to claim 1, characterized in that Building the backbone network according to the target depth and the target width includes: Adding a convolutional layer to the backbone network, and using the convolutional layer to scale the channel data of the backbone network so that the depth and width of the backbone network reach the target depth and the target width; Batch normalization and an activation function for forming a bottleneck layer are added after the convolution layer to obtain the backbone network.
4. The method according to claim 1, characterized in that: Changing the data format of the original training data to a target format to obtain target training data includes: Determine a detection target corresponding to the image to be detected, and determine a target format corresponding to the original training data according to the category corresponding to the detection target; The format of the original training data is changed according to the target format corresponding to the original training data to obtain the target training data.
5. The method according to claim 1, characterized in that: The training network is initially trained according to the initial data set to obtain an initial recognition model, including: Training the backbone network in the training network according to the target detection data in the initial data set to obtain initial parameters corresponding to the backbone network; The initial parameters are updated to the backbone network to obtain the initial recognition model.
6. The method according to claim 1, characterized in that After inputting the image to be detected into the protective gear recognition model and obtaining the detection result of the image to be detected, the method includes: Generate warning information according to the detection result of the image to be detected, and display the warning information.
7. A protective gear identification device, characterized in that: include: A network building module, used to obtain the image to be detected, the hardware parameters of the terminal and the original training data, and to build a training network according to the hardware parameters, wherein the hardware parameters of the terminal are parameters used to reflect the hardware performance and transmission speed of the terminal; An initial training module, used to change the data format of the original training data to a target format to obtain target training data, and to perform initial training on the training network according to the initial data set to obtain an initial recognition model; A model training module, used to train the initial recognition model according to the target training data to obtain a protective gear recognition model; An image detection module, used for inputting the image to be detected into the protective gear recognition model to obtain a detection result of the image to be detected; The network building module builds a training network according to the hardware parameters, including: Determine the target depth and target width of the backbone network of the training network according to the hardware parameters; Building the backbone network for extracting image features in the image to be detected according to the target depth and the target width; A feature pyramid structure for detecting the feature map of the image to be detected is added to the residual network of the training network, and an anchor-free method and a decoupling head for predicting the detection result of the image to be detected are added to the residual network, wherein the feature map of the image to be detected is constructed according to the image features in the image to be detected; wherein the feature pyramid structure is used to enable the residual network to transfer and fuse the image features in the high-level image to be detected in a top-down order by upsampling to obtain a feature map for prediction.
8. An electronic device, characterized in that: The electronic device comprises: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the protective gear identification method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the protective gear identification method according to any one of claims 1 to 6 is implemented.
