Worker helmet two-dimensional code small target detection method and system in factory environment

By using Fast-RCNN and GAN technologies in a factory environment, the problem of difficulty in identifying QR code images for workers' helmets is solved, efficient QR code detection and high-definition is achieved, reducing the dependence of labeled data, and improving detection accuracy and system reliability.

CN119204059APending Publication Date: 2024-12-27SHANGHAI NUCLEAR ENGINEERING RESEARCH & DESIGN INSTITUTE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411264048.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-10
Publication Date
2024-12-27

AI Technical Summary

Technical Problem

In factory environment, the QR code images of workers wearing helmets are difficult to identify due to their small size and unclear size. The existing small object detection methods rely on a large amount of labeled data and are costly, and the extracted image has a low resolution, making it difficult to meet management. need.

Method used

Using a Fast-RCNN-based object detection model, the self-supervised learning pre-trained ResNet18 backbone network is used to locate and extract the low-resolution QR code area, and the low-definition QR code image input generates an adversarial network (GAN) for high-definition and Geometric correction solves the problems of high cost of labeling data and difficulty in extracting small-target feature.

Benefits of technology

It significantly reduces the need for labeling data, improves the accuracy of target detection, solves the problem of QR code distortion caused by shooting angles, and improves the practicality and reliability of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119204059A_ABST
    Figure CN119204059A_ABST
Patent Text Reader

Abstract

The invention discloses a worker helmet two-dimensional code small target detection method and system in a factory environment, and relates to the technical field of artificial intelligence and image digital processing, and the method comprises the steps: obtaining a scene image of a worker wearing a helmet with a two-dimensional code in the factory environment in real time; the scene image after standardization processing is input into a target detection model based on a Fast-RCNN network, the Fast-RCNN network comprises a backbone network based on pre-training ResNet18, a region proposal network RPN and a prediction network, depth features of the input scene image are extracted through the backbone network, the depth features are extracted through the region proposal network RPN, a two-dimensional code candidate region is extracted through the prediction network RPN, and the two-dimensional code candidate region is extracted through the prediction network RPN; after the two-dimensional code candidate region is classified and regressed through a prediction network, identifying and outputting a low-resolution two-dimensional code image in the scene image; and inputting the low-resolution two-dimensional code image into a GAN generator, and outputting a high-resolution two-dimensional code image with a corrected geometrical shape.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of artificial intelligence and image digital processing, and in particular to a method and system for detecting a small target of a QR code on a worker's helmet in a factory environment. Background Art

[0002] To ensure the safety of workers, workers are required to wear safety helmets (i.e., hard hats) when working in a factory environment. With the advancement of intelligent management, a QR code is currently set on the outside of the safety helmet. The QR code integrates the fragmented information of the workers, such as the name, phone number, team, type of work, entry time and other basic information of the workers. It can also display the workers' employment contract, pre-job education and training, the coverage of work-related injury insurance, or the job training and professional skills assessment after entering the site. Through one person, one helmet and one code, information correspondence is achieved, avoiding the previous problems of scattered data, difficulty in finding, and lack of information concentration, and optimizing personnel management. However, in the actual construction process, obtaining the scene image of workers wearing helmets in a factory environment and identifying the QR code in the image often cannot be identified because the QR code image is too small and unclear. For this reason, it is currently necessary to detect and extract the small QR code target in the scene image to facilitate subsequent management work.

[0003] To improve the detection performance of small objects, current AI-based detection methods can be mainly divided into the following two categories: (1) Feature pyramid-based methods. This method captures objects of different sizes by constructing multi-scale feature maps. The feature pyramid is usually implemented through continuous image scaling or different levels in a convolutional neural network (CNN). For example, the feature pyramid network (FPN) in Faster RCNN fuses low-level high-resolution information and high-level strong semantic information through top-down paths and lateral connections, thereby enhancing the detection capability of small objects. (2) Receptive field-based methods. The receptive field refers to the range of visual inputs that a neuron in the network can receive. By increasing the convolution kernel or the network depth, the receptive field can be increased, thereby improving the detection capability of small objects. For example, the YOLOv3 network uses a deeper network structure and a larger convolution kernel to improve the detection performance of small objects.

[0004] The above-mentioned small target detection methods mostly use traditional supervised learning methods to train the detection model. The supervised learning method often relies on a large amount of labeled data. In small target detection, obtaining sufficient labeled data is costly and time-consuming. The resolution of small targets in the image is low, which makes feature extraction difficult and the accuracy of small target detection is low. In addition, the extracted small target image has low resolution and is unclear, which is difficult to meet subsequent usage requirements. Summary of the invention

[0005] In order to address the deficiencies of the above-mentioned prior art, the present invention provides a method and system for detecting small targets of QR codes on workers' helmets in a factory environment. The scene images of workers wearing helmets captured in real time in the factory environment are input into a target detection model based on Fast-RCNN. The target detection model uses the pre-trained ResNet18 based on self-supervised learning as the backbone network to locate and extract low-resolution QR code areas in the image, effectively avoiding the high cost and long time of annotating data, solving the problem of difficulty in extracting small target features, and improving the accuracy of target detection. The low-definition QR code image is then input into a generative adversarial network (GAN), and the generator converts the input low-resolution QR code image into a high-definition and geometrically corrected high-quality QR code image, solving the problem of QR code distortion caused by shooting angle, and having high practicality and reliability.

[0006] In a first aspect, the present invention provides a method for detecting a small target of a QR code on a worker's helmet in a factory environment.

[0007] A method for detecting a small target of a QR code on a worker's helmet in a factory environment, comprising:

[0008] Real-time acquisition of scene images of workers wearing helmets with QR codes in a factory environment;

[0009] Performing standardization processing on the acquired scene image;

[0010] The standardized scene image is input into the target detection model based on the Fast-RCNN network. The Fast-RCNN network includes a backbone network based on the pre-trained ResNet18, a region proposal network RPN and a prediction network. The input scene image first passes through the backbone network to extract deep features, and the deep features are then passed through the region proposal network RPN to extract the QR code candidate area. After the QR code candidate area is classified and regressed through the prediction network, the low-resolution QR code image in the scene image is identified and output;

[0011] The low-resolution QR code image is input into the GAN generator, and a high-resolution and geometrically corrected QR code image is output.

[0012] According to a further technical solution, the training process of the target detection model includes:

[0013] Obtain multiple scene images of workers wearing helmets with QR codes in a factory environment, and standardize the acquired scene images to form an image dataset;

[0014] The target detection model is trained by using the image dataset and the self-supervised learning method. During the training process, a loss function based on the self-supervised loss and the target detection loss is constructed. The training is performed until the loss function meets the set conditions, and the trained target detection model is obtained.

[0015] According to a further technical solution, the standardization process is an image scaling process, that is, scaling the scene image input into the target detection model to a uniform size.

[0016] In a further technical solution, the backbone network includes multiple feature extraction layers, and each feature extraction layer is connected to an upsampling layer and an activation layer;

[0017] During the training process of the target detection model, feature learning is performed between the features extracted and output by two consecutive layers before and after the backbone network to complete the self-supervised learning of the backbone network.

[0018] A further technical solution is to construct a self-supervised loss function based on the outputs of different layers of the backbone network, including:

[0019] For each layer of the backbone network, the extracted features are upsampled and activated by the activation function to obtain the output result of the current layer;

[0020] A self-supervised loss function is constructed based on the loss between the output results of adjacent layers in all levels.

[0021] A further technical solution is to construct a target detection loss function during the training of the target detection model, including:

[0022] The deep features extracted by the backbone network are input into the region proposal network RPN, and the candidate regions of the QR code are extracted and then input into the prediction network, which finally outputs the predicted QR code region, i.e., the coordinates of the QR code bounding box.

[0023] Based on the predicted QR code bounding box coordinates and the actual annotated QR code bounding box coordinates, an object detection loss function is constructed.

[0024] Further technical solutions, the GAN network includes a generator and a discriminator, and the training process of the GAN network includes:

[0025] The two-dimensional code image extracted and output by the target detection model is an uncorrected low-definition two-dimensional code image. The uncorrected low-definition two-dimensional code image is input into the generator to obtain a two-dimensional code generated image.

[0026] The QR code generated image is input into the discriminator. The discriminator evaluates the QR code generated image based on the corrected high-definition QR code image, and constructs a loss function based on the corrected high-definition QR code image and the QR code generated image. The training is carried out until the loss function meets the set conditions to obtain a trained GAN network.

[0027] In a second aspect, the present invention provides a small target detection system for a QR code on a worker's helmet in a factory environment.

[0028] A small target detection system for QR codes on workers' helmets in a factory environment, comprising:

[0029] An image acquisition module is used to acquire real-time images of workers wearing helmets with QR codes in a factory environment;

[0030] An image preprocessing module, used for standardizing the acquired scene images;

[0031] The QR code small target detection module is used to input the standardized scene image into the target detection model based on the Fast-RCNN network. The Fast-RCNN network includes a backbone network based on the pre-trained ResNet18, a region proposal network RPN and a prediction network. The input scene image first passes through the backbone network to extract deep features, and the deep features are then used to extract the QR code candidate area through the region proposal network RPN. After the QR code candidate area is classified and regressed through the prediction network, the low-resolution QR code image in the scene image is identified and output;

[0032] The QR code small target output module is used to input the low-resolution QR code image into the GAN generator and output a high-resolution and geometrically corrected QR code image.

[0033] In a third aspect, the present invention further provides an electronic device comprising a memory and a processor, and computer instructions stored in the memory and executed on the processor, wherein when the computer instructions are executed by the processor, the steps of the method described in the first aspect are completed.

[0034] In a fourth aspect, the present invention further provides a computer-readable storage medium for storing computer instructions, which, when executed by a processor, complete the steps of the method described in the first aspect.

[0035] One or more of the above technical solutions have the following beneficial effects:

[0036] 1. The present invention provides a method and system for detecting small targets of QR codes on workers' helmets in a factory environment. First, by acquiring scene images of workers wearing helmets in a factory environment in real time, the constructed target detection model based on Fast-RCNN is trained. The target detection model uses a pre-trained ResNet18 based on self-supervised learning as the backbone network. Through the self-supervised learning, visual features can be extracted from unlabeled images. This process does not require labeled data. These pre-trained features are then applied to the target detection task to locate and extract the low-resolution QR code area in the image. Through this method, although the target detection stage adopts a supervised learning method and requires certain labeled data, the application of self-supervised learning can significantly reduce the amount of labeled data required, which can effectively accelerate the training process of the model, reduce the dependence on labeled data, effectively avoid the high cost and long time of labeled data, solve the problem of difficulty in extracting small target features, and improve the accuracy of target detection.

[0037] 2. In the present invention, the extracted low-definition QR code image is also input into the generative adversarial network GAN, and the input low-resolution QR code image is converted into a high-definition and geometrically corrected high-quality QR code image through the generator, thereby solving the problem of QR code distortion caused by shooting angle, and having high practicality and reliability. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] The accompanying drawings in the specification, which constitute a part of the present invention, are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute improper limitations on the present invention.

[0039] Figure 1 This is a flow chart of a method for detecting a small target of a QR code on a worker's helmet in a factory environment according to an embodiment of the present invention. DETAILED DESCRIPTION

[0040] It should be noted that the following detailed descriptions are exemplary only, are intended to describe specific embodiments, are intended to provide further explanation of the present invention, and are not intended to limit exemplary embodiments according to the present invention. Unless otherwise specified, all technical and scientific terms used herein have the same meanings as those of ordinary skill in the art to which the present invention belongs. In addition, it should also be understood that when the terms "comprising" and / or "including" are used in this specification, it indicates the presence of features, steps, operations, devices, components and / or combinations thereof.

[0041] Embodiment 1

[0042] In order to avoid the problem that traditional supervised learning methods require a large amount of labeled data to train target detection models, which is costly and time-consuming, this embodiment uses a self-supervised learning method to train the model. Self-supervised learning is a learning method that does not require manually labeled data. It trains the model by generating pseudo labels from the data itself. In the context of small target detection, self-supervised learning can learn better feature representations to improve detection performance. Among them, the self-supervised learning method mainly includes two methods: constructing pre-tasks and contrastive learning. The method of constructing pre-tasks uses some pre-tasks as training signals. These pre-tasks do not need to be manually labeled, but are directly obtained from the data. In this embodiment, scene images of workers wearing helmets captured in real time in a factory environment are input into a Fast-RCNN-based target detection model for training, and a pre-trained ResNet18 is used as the backbone network of Fast-RCNN for target detection to locate the low-resolution QR code area in the image. During the training process, a self-supervised learning method of constructing a pre-task is adopted, and the activation results of the intermediate output of the model are used as labels, so that the model can learn deeper expressions from the activation results, thereby improving the effect of small target detection and recognition, and solving the problem of requiring a large amount of labeled data.

[0043] In addition, considering the problem that the extracted small target image has low resolution and is unclear, and is difficult to meet subsequent usage requirements, this embodiment inputs the detected and extracted low-definition QR code image into GAN. The generator in GAN is composed of multiple layers of convolutional layers, batch normalization layers, activation functions, and upsampling layers. The multiple layers work together to convert the input low-resolution QR code image into a high-quality image. The generator outputs a QR code image that has been processed and geometrically corrected, which not only improves the accuracy of target detection, but also solves the problem of QR code distortion caused by shooting angles, effectively improving practicality and reliability.

[0044] Specifically, this embodiment provides a method for detecting a small target of a QR code on a worker's helmet in a factory environment. Figure 1 As shown, the specific steps include:

[0045] Step S1, acquiring in real time a scene image of a worker wearing a helmet with a QR code in a factory environment;

[0046] Step S2, performing standardization processing on the acquired scene image;

[0047] Step S3, input the standardized scene image into the target detection model based on the Fast-RCNN network, wherein the Fast-RCNN network includes a backbone network based on the pre-trained ResNet18, a region proposal network RPN and a prediction network, wherein the input scene image first passes through the backbone network to extract deep features, and the deep features then pass through the region proposal network RPN to extract the QR code candidate region, and the QR code candidate region is classified and regressed through the prediction network, and then the low-resolution QR code image in the scene image is identified and output;

[0048] Step S4: input the low-resolution QR code image into the generator of GAN, and output a high-resolution and geometrically corrected QR code image.

[0049] The following content introduces in more detail the small target detection method of the QR code on the worker's helmet in the factory environment proposed in this embodiment.

[0050] In steps S1 and S2, a scene image of a worker wearing a helmet with a QR code in a factory environment is obtained in real time, and the obtained scene image is standardized. The standardization process is image scaling, that is, scaling the scene image input into the target detection model to a uniform size to match the input size of the subsequent network.

[0051] In step S3, the standardized scene image is input into a target detection model based on the Fast-RCNN network, and a low-resolution two-dimensional code image in the scene image is extracted and output.

[0052] The above-mentioned Fast-RCNN network includes a backbone network, a region proposal network RPN and a prediction network, wherein a pre-trained ResNet18 with training weights is used as the backbone network of Fast-RCNN to perform feature extraction and target detection, and finally locate the low-resolution QR code area in the scene image; the above-mentioned region proposal network RPN is responsible for generating proposals of potential target areas in the image; the prediction network, i.e. the prediction head, is responsible for further classification and bounding box regression of the proposals generated by RPN, so as to accurately locate and identify the QR code area in the image.

[0053] In this embodiment, the input scene image first passes through the backbone network to extract deep features, and the deep features are then used to extract the QR code candidate area through the region proposal network RPN. After the QR code candidate area is classified and regressed through the prediction network, the low-resolution QR code image in the scene image is identified and output. The above process specifically includes:

[0054] (1) The input image is processed by ResNet18 to extract deep features. The extracted feature shape is (N, C, H, W), where N represents the batch size, C represents the number of feature channels, and H and W represent the height and width of the feature map, respectively.

[0055] (2) The feature map extracted above is input into the Region Proposal Network (RPN) for further processing. After being input into the RPN, the RPN receives the feature map input from ResNet18, generates region proposals, and extracts a fixed-size feature map for each candidate region.

[0056] (3) Each candidate region generated by RPN is used as input to the prediction network (i.e., prediction head). The prediction head performs classification and regression to obtain prediction results (Predictions). The prediction head (Predict head) outputs regression and classification results. The shape of the regression result is (N, num_anchors*4), which is used for bounding box regression correction; the shape of the classification result is (N, num_anchors*num_classes), which represents the target classification confidence score.

[0057] Based on the bounding box regression results generated by the above RPN, the low-resolution QR code positions in the image are identified, and the QR code images corresponding to these areas are captured and extracted. The extracted images are low-resolution images.

[0058] In step S4, the low-resolution QR code image is input into the generator of GAN, and a high-resolution and geometrically corrected QR code image is output.

[0059] In this embodiment, a generative adversarial network (GAN) is selected to handle the image-to-image conversion task, with the focus on improving the resolution of the image and correcting the image content. Specifically, the extracted low-resolution QR code image is used as the input of the generator in GAN, and the generator is composed of a multi-layer convolution layer, a batch normalization layer, an activation function, and an upsampling layer. The generator receives the low-definition QR code image as a condition, and generates a high-definition and geometrically corrected QR code image through its network architecture. The output image has a higher resolution and a more accurate shape, which is suitable for further recognition and analysis. In addition, since the goal of GAN is to generate high-quality corrected images rather than adversarial training with real images, the discriminator in GAN is not used in the above process, and the discriminator is only used during GAN training.

[0060] In this embodiment, the implementation of the above process depends on the trained target detection model and GAN network. The training process of the target detection model and GAN network is introduced through the following content.

[0061] First, an image dataset is used to train a target detection model for small targets, with the goal of enabling the model to accurately identify the location of the QR code on the helmet and output its coordinates (Bounding boxes). Specifically, the training process of the target detection model is as follows: multiple scene images of workers wearing helmets with QR codes in a factory environment are obtained, and the obtained scene images are standardized to form an image dataset; the image dataset is used to train the target detection model using a self-supervised learning method, wherein, during the training process, a loss function based on self-supervised loss and target detection loss is constructed, and training is performed until the loss function meets the set conditions to obtain a trained target detection model.

[0062] Furthermore, this embodiment selects a backbone network of the target detection model, and uses the outputs of different levels of the backbone network to achieve self-supervised learning. The backbone network includes multiple feature extraction layers, and each feature extraction layer is connected to an upsampling layer and an activation layer. In this case, during the training process of the target detection model, feature learning is performed between the features extracted and output by two consecutive layers of the backbone network. The previous layer of the network learns and the next layer outputs, thereby improving the generalization ability of the network and completing the self-supervised learning of the backbone network.

[0063] Specifically, a self-supervised loss function is constructed based on the outputs of different layers of the backbone network, including:

[0064] (1) For each layer of the backbone network, the extracted features are upsampled and activated by the activation function to obtain the output result of the current layer. Assume that the backbone network is f(·), which consists of multiple layers, each layer corresponds to a feature extraction operation, A l is the output feature of the network layer l, then the output result of each layer of the network is:

[0065]

[0066] Among them, A l represents the output feature of the lth layer of the network, which is actually a feature map containing c channels; B(·) represents the bilinear upsampling operation, which upsamples the input feature map to a higher resolution. Because the output sizes of the two adjacent layers of the model are inconsistent, the output size needs to be unified through upsampling; Softmax(·) is an activation function, which is usually used to convert a real vector into an effective probability distribution. Its output is the ratio of the exponent of each element of the input vector to the sum; G(A l) means to sum all channels of the output features of the lth layer to obtain the sum of the squares of all channels, which is used to represent the activation result of this layer.

[0067] (2) Based on the loss between the output results of adjacent layers in all levels, a self-supervised loss function is constructed as:

[0068]

[0069] In the above formula, calculate G(A l ) and G(A l+1 ), i.e., the L2 norm, is used as the loss between a single layer pair, and is used in the training process to gradually allow two consecutive layers of the network to learn each other's feature representations.

[0070] Based on the above scheme, the self-supervised loss training in this embodiment means that each layer of the network feature map A l After upsampling and Softmax processing, G(A l ), and then by calculating the adjacent layer (G(A l ) and G(A l+1 ) to train the previous layer to learn the feature representation of the next layer. The self-imitation mechanism helps the network to learn the feature representation of the deep network while keeping the size small, thereby improving the model's performance in detecting small objects under resource constraints. The self-supervised learning is used to extract visual features from unlabeled images, and this process does not require labeled data.

[0071] Secondly, the pre-trained features are applied to the target detection task, and this process uses a supervised learning method. During the training process of the target detection model, a target detection loss function is constructed. Specifically, the deep features extracted by the backbone network are input into the region proposal network RPN, and the candidate regions of the QR code are extracted and then input into the prediction network, and finally the predicted QR code region, i.e., the coordinates of the QR code bounding box, is output; based on the predicted QR code bounding box coordinates and the actual labeled QR code bounding box coordinates, a target detection loss function is constructed.

[0072] In this embodiment, the prediction result of ResNet18 is compared with the true label Label to calculate the loss of the target detection task. For target detection, the classification loss function and the bounding box regression loss function are used to construct the loss function L Task , used to match the predicted results of the true label, the loss function L Task for:

[0073]

[0074] Among them, N pos is the number of positive samples, ti and are the predicted bounding box coordinates and the actual bounding box coordinates, respectively. SmoothL1 is the smooth L1 loss function. N is the number of samples, C is the number of categories, and y i,c is the true label, if sample i belongs to category c, it is 1, otherwise it is 0 (in this embodiment, the sample that does not contain a QR code image is a background class and is marked as 0, while the sample that contains a QR code image is a target class and is marked as 1); p i,c is the predicted probability that sample i belongs to category c.

[0075] Through the above method, although labeled data is required in the target detection stage, the application of self-supervised learning can significantly reduce the amount of labeled data required. The reason is that self-supervised learning can enable the model to learn rich visual features from a large amount of unlabeled data, so that in the supervised learning stage, the model only needs less labeled data for fine-tuning and optimization. Therefore, the above method proposed in this embodiment can not only accelerate the training process of the model, but also reduce the dependence on labeled data, effectively reducing the labeling cost.

[0076] Finally, the obtained Bounding boxes area image (i.e., the QR code image) is passed into GAN for GAN training. The generator in GAN receives the QR code image output by the small target detection model and is responsible for generating a high-resolution and geometrically corrected QR code image. The discriminator in GAN is used to evaluate the image quality generated by the generator and determine whether the image is a real high-definition image or an image generated by the generator, so as to train the generator to produce more realistic images.

[0077] Specifically, the GAN network includes a generator and a discriminator. During the training process of the GAN network, the two-dimensional code image extracted and output by the target detection model is an uncorrected low-definition two-dimensional code image, and the corrected high-definition two-dimensional code image is used as a label. The uncorrected low-definition two-dimensional code image is input into the generator to obtain the generated two-dimensional code image; the generated two-dimensional code image is input into the discriminator, the discriminator evaluates the generated two-dimensional code image based on the corrected high-definition two-dimensional code image, and constructs a loss function based on the corrected high-definition two-dimensional code image and the generated two-dimensional code image. After training until the loss function meets the set conditions, a trained GAN network is obtained. After the training is completed, the generator (Generator) generates an image with the same high definition and geometric shape correction as the label.

[0078] Among them, calculate the GAN generation task loss L gan , specifically including the discriminator loss and the generator loss, which is:

[0079] (1) Discriminator loss L D :

[0080]

[0081] In the above formula, x high Indicates the rectified high-definition QR code image label, x low represents the uncorrected low-definition QR code image input, G(x low ) The generator is based on the low-resolution image x low The generated image, D(x), is the probability output by the discriminator that the input x is a real high-definition image.

[0082] (2) Generator loss L G :

[0083]

[0084] During training, the generator G learns how to transform low-resolution, unrectified input images into high-resolution, geometrically correct output images that are as high-resolution as the label, while the discriminator D learns how to distinguish the difference between the generated images and real high-resolution images.

[0085] GAN generation task loss L gan ,for:

[0086] L gan =L D +L G

[0087] Through the above methods, GAN can improve the resolution of the input image and correct the shape of the QR code, thereby improving the recognition accuracy of the QR code.

[0088] The total loss function of the final training is:

[0089] L totat =L Task +L self +L gan .

[0090] In this embodiment, a real-time scene image of a worker wearing a helmet with a QR code in a factory environment is input into the trained network model. First, target detection is performed to locate the low-resolution QR code in the image. After that, the detected low-definition QR code image is input into the GAN. In this process, the generator converts the image into a high-definition and geometrically corrected QR code image. This method not only improves the accuracy of small target detection, but also solves the problem of QR code distortion caused by shooting angle, thereby improving the practicality and reliability of the entire system.

[0091] Embodiment 2

[0092] This embodiment provides a small target detection system for a QR code on a worker's helmet in a factory environment, including:

[0093] An image acquisition module is used to acquire real-time images of workers wearing helmets with QR codes in a factory environment;

[0094] An image preprocessing module, used for standardizing the acquired scene images;

[0095] The QR code small target detection module is used to input the standardized scene image into the target detection model based on the Fast-RCNN network. The Fast-RCNN network includes a backbone network based on the pre-trained ResNet18, a region proposal network RPN and a prediction network. The input scene image first passes through the backbone network to extract deep features, and the deep features are then used to extract the QR code candidate area through the region proposal network RPN. After the QR code candidate area is classified and regressed through the prediction network, the low-resolution QR code image in the scene image is identified and output;

[0096] The QR code small target output module is used to input the low-resolution QR code image into the GAN generator and output a high-resolution and geometrically corrected QR code image.

[0097] Embodiment 3

[0098] This embodiment provides an electronic device, including a memory and a processor, and computer instructions stored in the memory and executed on the processor. When the computer instructions are executed by the processor, the steps of the method for detecting a small target of a QR code on a worker's helmet in a factory environment as described above are completed.

[0099] Embodiment 4

[0100] This embodiment also provides a computer-readable storage medium for storing computer instructions. When the computer instructions are executed by a processor, the steps in the method for detecting a small target of a QR code on a worker's helmet in a factory environment as described above are completed.

[0101] The steps involved in the above embodiments 2 to 4 correspond to the method embodiment 1, and the specific implementation methods can refer to the relevant description part of embodiment 1. The term "computer-readable storage medium" should be understood as a single medium or multiple media including one or more instruction sets; it should also be understood to include any medium that can store, encode or carry an instruction set for execution by a processor and enable the processor to execute any method in the present invention.

[0102] Those skilled in the art should understand that the modules or steps of the present invention described above can be implemented by a general-purpose computer device, or alternatively, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. The present invention is not limited to any specific combination of hardware and software.

[0103] The above description is only a preferred embodiment of the present invention. Although the specific implementation mode of the present invention is described in conjunction with the accompanying drawings, it is not a limitation of the protection scope of the present invention. Those skilled in the art should understand that on the basis of the technical solution of the present invention, various modifications or variations that can be made by those skilled in the art without creative work are still within the protection scope of the present invention.

Claims

1. A method for detecting a small target of a QR code on a worker's helmet in a factory environment, characterized in that: include: Real-time acquisition of scene images of workers wearing helmets with QR codes in a factory environment; Performing standardization processing on the acquired scene image; The standardized scene image is input into the target detection model based on the Fast-RCNN network. The Fast-RCNN network includes a backbone network based on the pre-trained ResNet18, a region proposal network RPN and a prediction network. The input scene image first passes through the backbone network to extract deep features, and the deep features are then passed through the region proposal network RPN to extract the QR code candidate area. After the QR code candidate area is classified and regressed through the prediction network, the low-resolution QR code image in the scene image is identified and output; The low-resolution QR code image is input into the GAN generator, and a high-resolution and geometrically corrected QR code image is output.

2. A method for detecting a small target of a QR code on a worker's helmet in a factory environment as claimed in claim 1, characterized in that: The training process of the target detection model includes: Obtain multiple scene images of workers wearing helmets with QR codes in a factory environment, and standardize the acquired scene images to form an image dataset; The target detection model is trained by using the image dataset and the self-supervised learning method. During the training process, a loss function based on the self-supervised loss and the target detection loss is constructed. The training is performed until the loss function meets the set conditions, and the trained target detection model is obtained.

3. A method for detecting a small target of a QR code on a worker's helmet in a factory environment as claimed in claim 1, characterized in that: The standardization process is an image scaling process, that is, scaling the scene image input into the target detection model to a uniform size.

4. A method for detecting a small target of a QR code on a worker's helmet in a factory environment as claimed in claim 1, characterized in that: The backbone network includes multiple feature extraction layers, and each feature extraction layer is connected to an upsampling layer and an activation layer; During the training process of the target detection model, feature learning is performed between the features extracted and output by two consecutive layers before and after the backbone network to complete the self-supervised learning of the backbone network.

5. A method for detecting a small target of a QR code on a worker's helmet in a factory environment as claimed in claim 4, characterized in that: A self-supervised loss function is constructed based on the outputs of different layers of the backbone network, including: For each layer of the backbone network, the extracted features are upsampled and activated by the activation function to obtain the output result of the current layer; A self-supervised loss function is constructed based on the loss between the output results of adjacent layers in all levels.

6. A method for detecting a small target of a QR code on a worker's helmet in a factory environment as claimed in claim 1, characterized in that: During the training process of the target detection model, the construction of the target detection loss function includes: The deep features extracted by the backbone network are input into the region proposal network RPN, and the candidate regions of the QR code are extracted and then input into the prediction network, which finally outputs the predicted QR code region, i.e., the coordinates of the QR code bounding box. Based on the predicted QR code bounding box coordinates and the actual annotated QR code bounding box coordinates, an object detection loss function is constructed.

7. A method for detecting a small target of a QR code on a worker's helmet in a factory environment as claimed in claim 1, characterized in that: The GAN network includes a generator and a discriminator. The training process of the GAN network includes: The two-dimensional code image extracted and output by the target detection model is an uncorrected low-definition two-dimensional code image. The uncorrected low-definition two-dimensional code image is input into the generator to obtain a two-dimensional code generated image. The QR code generated image is input into the discriminator. The discriminator evaluates the QR code generated image based on the corrected high-definition QR code image, and constructs a loss function based on the corrected high-definition QR code image and the QR code generated image. The training is carried out until the loss function meets the set conditions to obtain a trained GAN network.

8. A small target detection system for QR codes on workers' helmets in a factory environment, characterized in that: include: An image acquisition module is used to acquire real-time images of workers wearing helmets with QR codes in a factory environment; An image preprocessing module, used for standardizing the acquired scene images; The QR code small target detection module is used to input the standardized scene image into the target detection model based on the Fast-RCNN network. The Fast-RCNN network includes a backbone network based on the pre-trained ResNet18, a region proposal network RPN and a prediction network. The input scene image first passes through the backbone network to extract deep features, and the deep features are then used to extract the QR code candidate area through the region proposal network RPN. After the QR code candidate area is classified and regressed through the prediction network, the low-resolution QR code image in the scene image is identified and output; The QR code small target output module is used to input the low-resolution QR code image into the GAN generator and output a high-resolution and geometrically corrected QR code image.

9. An electronic device, characterized in that: The invention comprises a memory and a processor, and computer instructions stored in the memory and executed on the processor. When the computer instructions are executed by the processor, the steps of a method for detecting a small target of a QR code on a worker's helmet in a factory environment are completed as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: Used to store computer instructions, which, when executed by a processor, complete the steps of a method for detecting a small target of a QR code on a worker's helmet in a factory environment as described in any one of claims 1-7.