A method and system for automatically pasting a two-dimensional code
By automatically affixing QR codes with a robotic arm and calculating the offset using a deep neural network, the problem of positional deviation caused by manual affixing is solved, enabling efficient and accurate affixing and scanning of QR codes inside buttons.
Patent Information
- Application Number
- CN202211523279.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-30
- Publication Date
- 2026-02-27
- Estimated Expiration
- 2042-11-30
AI Technical Summary
In the existing technology, the process of applying QR codes to the inner lining of buttons relies on manual operation, which results in high labor intensity and is prone to positional deviation, affecting scanning efficiency.
A robotic arm is used to automatically affix QR codes. By acquiring standard and real-time images, a deep neural network is used to calculate the QR code position offset. The position of the robotic arm is adjusted by the control system to ensure accurate affixing. Image enhancement processing is combined with a DCGAN model to improve the calculation accuracy.
It enables automated application of QR codes to the inner lining of buttons, reducing manual labor and improving the accuracy of application location and scanning efficiency.
Smart Images

Figure CN115760832B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of button liner processing technology, specifically to a method and system for automatically affixing QR codes. Background Technology
[0002] The button liner to be processed needs to have a QR code affixed to its side. A QR code reader is used to identify the QR code on the button liner placed on the carrier. In conjunction with the back-end management system, the entire processing of the button liner can be traced to ensure the processing quality of the button liner.
[0003] Currently, QR codes are usually applied to the inner lining of buttons manually. This not only increases the labor intensity, but also makes it easy for the QR codes to be applied incorrectly or not aligned with the axis of the button, making it difficult for scanning devices to scan the QR codes later, thus affecting the scanning efficiency. Summary of the Invention
[0004] To address the problems of existing technologies, this invention provides a method for automatically affixing QR codes, comprising:
[0005] Acquire a standard image of the lining with the QR code correctly affixed and store it in the control system; at the same time, store the spatial standard position data of the robotic arm's motion end in the initial state with the QR code correctly affixed.
[0006] The manual staff places the lining to be affixed with the QR code onto the carrier and then places the carrier with the lining onto the conveyor belt. The conveyor belt transports the carrier to the location where the QR code is to be affixed, and a robotic arm affixes the QR code to one side of the lining.
[0007] After successful application, the image acquisition device captures real-time images of the lining with the QR code and transmits them to the calculation module. The calculation module calculates the positional offset of the QR code in the standard image and the real-time image based on the standard image and the real-time image.
[0008] If the offset is zero, the QR code is correctly affixed; if the offset is not zero and the QR code affixed is deviated, the control system adjusts the robot arm to the standard spatial position in the initial state according to the QR code's position offset.
[0009] A further approach is to calculate the positional offset of the QR code in the standard image and the real-time image based on the standard image and the real-time image, including:
[0010] Calculate the positional offset of the QR code in the standard image and the real-time image according to the key point matching algorithm;
[0011] The keypoint matching algorithm is a deep neural network matching method.
[0012] A further approach is to define the spatial standard position of the robotic arm's actuator as the horizontal displacement and vertical displacement of the actuator relative to the origin.
[0013] A further approach is to perform image enhancement processing on both the acquired standard images and real-time images before calculation. The enhancement processing method includes:
[0014] The images are preprocessed to serve as the training dataset;
[0015] The DCGAN model structure and network function are optimized to obtain the DCGAN network model.
[0016] The training dataset is used to train the improved DCGAN model until the generator G and the discriminator D reach Nash equilibrium.
[0017] The trained model is used to perform image enhancement and generate new images.
[0018] A further approach is to preprocess the unenhanced images, using the following as part of the training dataset:
[0019] The acquired, unenhanced images are screened to remove low-quality image data with blurred features and redundant information.
[0020] The filtered image samples are processed using traditional image augmentation techniques to obtain a preprocessed dataset;
[0021] The preprocessed dataset is mixed with the unenhanced images to form a new training dataset.
[0022] A further approach involves optimizing the DCGAN model structure and network function, including:
[0023] In the generator G of the DCGAN model, a deconvolution layer and multiple residual blocks are added respectively, and batch normalization and activation processing are performed after each convolutional network layer.
[0024] In the discriminator D of the DCGAN model, a convolutional layer and multiple residual blocks are added respectively, and batch normalization and activation processing are performed after each convolutional network layer.
[0025] Replace the ReLU activation function of the generator G in the DCGAN network with SeLU;
[0026] Replace the loss function of the DCGAN network with the Wasserstein distance.
[0027] A further approach is to use the training dataset for training the improved DCGAN model, including:
[0028] Input a set of random noise Z into the generator G, and the generator G generates an image distribution G(Z) of the random noise;
[0029] G(Z) is passed to the discriminator D to identify whether the generated sample is real or fake and is fed back to the generator G.
[0030] With the parameters of the generator G fixed, the discriminator D is continuously trained using the training set and G(Z);
[0031] With the parameters of the discriminator D fixed, the parameters of the generator G are continuously trained and optimized.
[0032] This process is repeated until the generator G and discriminator D reach Nash equilibrium, at which point training ends.
[0033] The generator G and discriminator D reach Nash equilibrium, at which point the output of discriminator D remains at 0.5.
[0034] The present invention also provides a system for automatically affixing QR codes, comprising:
[0035] The image acquisition module is used to acquire standard images of the lining with the QR code correctly affixed and to acquire real-time images of the lining with the QR code affixed, and store them in the control system.
[0036] Data storage module: Used to store the spatial standard position data of the robotic arm's motion end in the initial state after correctly affixing the QR code;
[0037] Control module: Used to control the conveyor belt to transport the carrier to the location where the code is to be affixed and to control the robotic arm to affix the QR code to one side of the lining; and to control the adjustment of the robotic arm's moving end relative to the origin position.
[0038] Calculation module: used to calculate the positional offset of the QR code in the standard image and the real-time image based on the standard image and the real-time image;
[0039] The present invention also provides a computer device, comprising: a processor and a memory for storing a computer program capable of running on the processor, wherein the processor, when running the computer program, implements the above-described method for automatically affixing QR codes.
[0040] The present invention also provides a computer storage medium storing an executable program, which, when executed by a processor, implements the above-described method for automatically affixing QR codes.
[0041] The specific beneficial effects of this invention compared to the prior art are as follows:
[0042] This invention achieves automatic QR code application to linings by placing the lining to be labeled with a QR code onto a carrier and transporting the carrier to the designated location via a conveyor belt. The control system then controls a robotic arm to affix the QR code to one side of the lining, thus enabling automatic QR code application.
[0043] This invention acquires a standard image and a real-time image of an inner lining with a correctly affixed QR code. Based on the standard and real-time images, it calculates whether the position of the QR code in the two images is offset to determine whether the affixed QR code is correctly positioned without deviation. If the QR code is misaligned, the offset is used to automatically adjust the spatial position of the robotic arm's actuator in its initial state, so that the robotic arm will not deviate when affixing QR codes in subsequent instances.
[0044] This invention enhances both the acquired standard images and real-time images before calculation, providing clearer images and improving the accuracy of the calculations. Attached Figure Description
[0045] Figure 1 A flowchart illustrating a method for automatically affixing QR codes, as provided in an embodiment of the present invention;
[0046] Figure 2 This is a flowchart of step S2 in an embodiment of the present invention;
[0047] Figure 3 This is a schematic diagram of the structure of an automatic QR code affixing system provided in an embodiment of the present invention;
[0048] Figure 4 This is a schematic diagram of the hardware structure of a computer device provided in an embodiment of the present invention.
[0049] Attached image captions: 1-Memory; 2-Processor. Detailed Implementation
[0050] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention.
[0051] like Figure 1 As shown, one embodiment of the present invention discloses a method for automatically affixing QR codes, comprising the following steps:
[0052] S1: Collect a standard image of the lining with the QR code correctly affixed and store it in the control system; at the same time, store the spatial standard position data of the robotic arm's motion end in the initial state with the QR code correctly affixed.
[0053] S2: The manual operator places the lining to be affixed with the QR code onto the carrier, and then places the carrier with the lining onto the conveyor belt. The conveyor belt transports the carrier to the area where the QR code is to be affixed, and a robotic arm affixes the QR code to one side of the lining. This process is as follows: Figure 2 As shown.
[0054] S3: After successful application, the image acquisition device captures real-time images of the lining with the QR code and transmits them to the calculation module. The calculation module calculates the position offset of the QR code in the standard image and the real-time image based on the standard image and the real-time image.
[0055] S4: If the offset is zero, the QR code is correctly affixed; if the offset is not zero and the QR code affixed is deviated, the control system adjusts the robot arm to the standard spatial position in the initial state according to the QR code's position offset.
[0056] This invention involves acquiring a standard image of a liner with a correctly affixed QR code and a real-time image of the liner with the QR code affixed. Based on the standard image and the real-time image, it calculates whether there is an offset in the position of the QR code between the two images to determine whether the affixed QR code is correctly positioned without deviation. If there is a deviation in the affixing of the QR code, the spatial position of the robotic arm's moving end is automatically adjusted based on the offset to ensure that the robotic arm does not deviate when affixing QR codes in subsequent instances.
[0057] In this embodiment, calculating the positional offset of the QR code in the standard image and the real-time image based on the standard image and the real-time image includes:
[0058] Calculate the positional offset of the QR code in the standard image and the real-time image according to the key point matching algorithm;
[0059] The keypoint matching algorithm is a deep neural network matching method.
[0060] It should be noted that the keypoint matching algorithm in this embodiment calculates the affine transformation matrix to obtain information such as the offset and rotation angle of the QR code position. The keypoint matching algorithm can use traditional SIFT / SURF, deep neural network matching methods (superglue), etc.
[0061] In this embodiment, the spatial standard position of the manipulator's action end is the horizontal displacement and vertical displacement of the action end relative to the origin.
[0062] In this embodiment, both the acquired standard image and the real-time image undergo image enhancement processing before calculation. The enhancement processing method includes:
[0063] S20: Perform data preprocessing on the images to serve as the training dataset; by filtering both standard and real-time images and then enhancing the filtered image data, the interference from low-quality data can be minimized, and more training samples can be provided for the model, enabling the model to learn more comprehensive dataset features.
[0064] S21: Optimize the DCGAN model structure and network function to obtain the DCGAN network model;
[0065] S22: Use the training dataset to train the improved DCGAN model until the generator G and discriminator D reach Nash equilibrium; this makes it impossible for the discriminator D to determine the source of the image or distinguish between real and fake images. At this point, the distribution of image data generated by the generator G is closest to the distribution of real data.
[0066] S23: Image enhancement is performed using the trained model to generate new images. After the DCGAN model is trained, the generator G can generate very realistic images that the discriminator D cannot distinguish. Therefore, by feeding a set of random noise into the trained generator G, rich high-quality samples can be generated to achieve the purpose of image enhancement.
[0067] In this embodiment, the unenhanced images undergo data preprocessing, and the training dataset includes:
[0068] S200: Screen the acquired unenhanced images and filter out low-quality image data with blurred features and redundant information;
[0069] S201: The filtered image samples are processed using traditional image augmentation techniques to obtain a preprocessed dataset;
[0070] S202: Mix the preprocessed dataset with the unenhanced images to form a new training dataset.
[0071] In this embodiment of the invention, the above-described settings address the issue that when using unenhanced images for model training, low-quality samples with excessive redundant interference or unclear feature information can negatively impact the model's training performance and even lead to performance degradation. By filtering the unenhanced images and then enhancing them, the interference from low-quality data can be minimized, providing the model with more training samples and enabling it to learn more comprehensive dataset features.
[0072] In this embodiment, the optimization of the DCGAN model structure and network function includes:
[0073] In the generator G of the DCGAN model, a deconvolution layer and multiple residual blocks are added respectively, and batch normalization and activation processing are performed after each convolutional network layer.
[0074] In the discriminator D of the DCGAN model, a convolutional layer and multiple residual blocks are added respectively, and batch normalization and activation processing are performed after each convolutional network layer.
[0075] Replace the ReLU activation function of the generator G in the DCGAN network with SeLU;
[0076] Replace the loss function of the DCGAN network with the Wasserstein distance.
[0077] It should be noted that the DCGAN (Deep Convolutional Generative Adversarial Network) in this embodiment is a combination of GAN and CNN (Convolutional Neural Network). Based on the original GAN, DCGAN innovatively integrates CNN, but it is not entirely the same as a traditional CNN. Specific improvements include: removing the pooling layers in the generator G and replacing them with fractional stride convolutions to achieve upsampling and image generation; using stride convolutions instead of pooling operations in the discriminator D to achieve downsampling; adding batch normalization (BN) layers to the output layer of generator G and the input layer of discriminator D to reduce the probability of gradient explosion; replacing fully connected layers with global average pooling, except for the first layer of generator G and the last layer of discriminator D, to improve training convergence speed; using the Tanh activation function in the output layer of generator G and the ReLU function in other layers; and adding the Leaky-ReLU function after all layers in discriminator D.
[0078] This embodiment can effectively enhance both the acquired standard images and real-time images through the above settings.
[0079] In this embodiment, using the training dataset for training the improved DCGAN model includes:
[0080] Input a set of random noise Z to the generator G, and the generator G generates an image distribution G(Z) of the random noise; the random noise Z is generally Gaussian noise that follows a uniform distribution.
[0081] G(Z) is passed to the discriminator D to identify whether the generated sample is real or fake and feeds it back to the generator G. The discriminator D continuously identifies the image samples generated by the generator G. If the image is identified as fake, a penalty is applied to the generator G.
[0082] With the parameters of generator G fixed, discriminator D is continuously trained using the training set and G(Z); the distance between the distribution of samples in the real dataset and the distribution of data generated by generator G is calculated using Wasserstein distance, and the network parameters are continuously optimized and updated.
[0083] With the parameters of the discriminator D fixed, the parameters of the generator G are continuously trained and optimized. Based on the reward and punishment signals fed back by the discriminator D, the generator G minimizes the punishment as much as possible, continuously learns the distribution characteristics of real data, and optimizes and updates its own network parameters.
[0084] This process is repeated until the generator G and discriminator D reach Nash equilibrium, at which point training ends.
[0085] The generator G and discriminator D are trained alternately. Eventually, the discriminator D can no longer distinguish between real and fake images, and the adversarial relationship between the generator G and the discriminator D reaches a Nash equilibrium. At this point, the output probability of the discriminator D is 0.5, and the training of the DCGAN model is complete.
[0086] like Figure 3 As shown, this embodiment of the invention also provides a system for automatically affixing QR codes, including:
[0087] The image acquisition module is used to acquire standard images of the lining with the QR code correctly affixed and to acquire real-time images of the lining with the QR code affixed, and store them in the control system.
[0088] Data storage module: Used to store the spatial standard position data of the robotic arm's motion end in the initial state after correctly affixing the QR code;
[0089] Control module: Used to control the conveyor belt to transport the carrier to the location where the code is to be affixed and to control the robotic arm to affix the QR code to one side of the lining; and to control the adjustment of the robotic arm's moving end relative to the origin position.
[0090] Calculation module: used to calculate the positional offset of the QR code in the standard image and the real-time image based on the standard image and the real-time image;
[0091] It should be noted that the description of the system item for automatically affixing QR codes to linings above is similar to the description of the method item for automatically affixing QR codes to linings above. The beneficial effects of the same method will not be repeated. For technical details not disclosed in the system item embodiments of the present invention for automatically affixing QR codes to linings, please refer to the description of the method item embodiments of the present invention for automatically affixing QR codes to linings.
[0092] like Figure 4As shown, this embodiment of the invention also provides a computer device, including: a processor 1 and a memory 2 for storing a computer program that can run on the processor, wherein when the processor 1 runs the computer program, it implements the above-described method steps for automatically affixing QR codes.
[0093] In some embodiments of the present invention, memory 1 may be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory may be random access memory (RAM), which serves as an external cache. By way of example, but not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), Synchronous DRAM (SDRAM), Double Data Rate Synchronous DRAM (DDRSDRAM), Enhanced Synchronous DRAM (ESDRAM), Synchlink DRAM (SLDRAM), and Direct Rambus RAM (DRRAM). The memory 1 of the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.
[0094] Processor 2 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of processor 2 or by instructions in software form. Processor 2 can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this invention. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this invention can be directly manifested as execution by a hardware decoding processor, or execution by a combination of hardware and software modules in the decoding processor. The software modules can be located in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. This storage medium is located in memory 1, and processor 2 reads the information in memory 2 and, in conjunction with its hardware, completes the steps of the above method.
[0095] In some embodiments, the embodiments described herein can be implemented using hardware, software, firmware, middleware, microcode, or a combination thereof. For hardware implementation, the processing unit can be implemented in one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), general-purpose processors, controllers, microcontrollers, microprocessors, other electronic units for performing the functions described herein, or combinations thereof.
[0096] For software implementation, the techniques described herein can be achieved through modules (e.g., procedures, functions, etc.) that perform the functions described herein. The software code can be stored in memory and executed by a processor. The memory can be implemented within the processor or externally.
[0097] Another embodiment of the present invention provides a computer storage medium storing an executable program. When executed by a processor 1, the executable program can implement the steps of the method for automatically affixing QR codes described above. For example, as... Figure 1 One or more of the methods shown.
[0098] In some embodiments, the computer storage medium may include various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0099] It should be noted that the technical solutions described in the embodiments of the present invention can be combined arbitrarily without conflict.
[0100] Finally, it should be noted that the above description is only for specific embodiments of the present invention. However, the present invention is not limited to the specific embodiments described above. Equivalent modifications and substitutions made to the present invention by those skilled in the art are also within the scope of the present invention. Therefore, all equivalent changes and modifications made without departing from the spirit and scope of the present invention are covered within the scope of the present invention.
Claims
1. A method for automatically pasting a two-dimensional code, characterized by: The method comprises the following steps: Collecting a standard image of the liner with a correctly attached two-dimensional code and storing it in a control system; at the same time, storing the spatial standard position data of the action end of the manipulator with a correctly attached two-dimensional code in the initial state; Placing the liner to be attached with a two-dimensional code on a carrier by hand and placing the carrier with the placed liner on a conveyor belt, which transports the carrier to the position where the code is to be attached, and attaching the two-dimensional code to one side of the liner by the manipulator; After successful attachment, collecting a real-time image of the liner with the attached two-dimensional code by an image collector in real time and transmitting it to a calculation module, and calculating the position offset of the two-dimensional code in the standard image and the real-time image according to the standard image and the real-time image; If the offset is zero, the two-dimensional code attachment position is correct; If the offset is not zero, the two-dimensional code attachment position deviates, and at this time, the spatial position of the manipulator in the initial state is adjusted to the spatial standard position according to the position offset of the two-dimensional code by the control system; The collected standard image and real-time image are subjected to image enhancement processing before calculation, and the enhancement processing method comprises: Data preprocessing of the image as a training data set; Optimizing the DCGAN model structure and network function to obtain a DCGAN network model; Using the improved DCGAN model to train the training data set until the generator G and the discriminator D reach Nash equilibrium; Using the trained model to perform image enhancement to generate a new image; Data preprocessing of the unenhanced image as a training data set, comprising: Filtering low-quality image data with blurred features and redundant information from the collected unenhanced images; Using traditional image expansion technology to operate the filtered image samples to obtain a preprocessed data set; Mixing the preprocessed data set with the unenhanced image to form a new training data set; Optimizing the DCGAN model structure and network function, comprising: Adding a deconvolution layer and multiple residual blocks to the generator G of the DCGAN model, and performing batch normalization and activation processing after each convolutional network; Adding a convolution layer and multiple residual blocks to the discriminator D of the DCGAN model, and performing batch normalization and activation processing after each convolutional network; Replacing the activation function ReLU of the generator G in the DCGAN network with SeLU; Replacing the loss function of the DCGAN network with Wasserstein distance.
2. The method of claim 1, wherein: Calculating the position offset of the two-dimensional code in the standard image and the real-time image according to the standard image and the real-time image comprises: Calculating the position offset of the two-dimensional code in the standard image and the real-time image according to a key point matching algorithm; The key point matching algorithm is a deep neural network matching method.
3. The method of claim 1, wherein: The spatial standard position of the action end of the manipulator is the horizontal displacement and vertical displacement of the action end relative to the origin.
4. The method of claim 1, wherein: The training data set is used for training the improved DCGAN model, which comprises: inputting a set of random noise Z into the generator G, and generating a random noise generated image distribution G(Z) by the generator G; feeding G(Z) to the discriminator D, discriminating the true and false of the generated sample and feeding back to the generator G; fixing the parameters of the generator G, and constantly training the discriminator D by the training set and G(Z); fixing the parameters of the discriminator D, and constantly training and optimizing the parameters of the generator G; constantly circulating the process until the generator G and the discriminator D reach Nash equilibrium, and the training is completed; the generator G and the discriminator D reach Nash equilibrium, and the output of the discriminator D is maintained at 0.
5.
5. A system for automatically affixing a two-dimensional code, characterized by: It comprises: an image acquisition module for acquiring a standard image of an inner liner correctly pasted with a two-dimensional code and acquiring a real-time image of an inner liner pasted with a two-dimensional code and storing them in a control system; a data storage module for storing the spatial standard position data of the action end of the manipulator correctly pasting the two-dimensional code in the initial state; a control module for controlling the conveyor belt to transport the carrier to the code pasting position and controlling the manipulator to paste the two-dimensional code on one side of the inner liner; and adjusting the action end of the manipulator compared with the original point position; a calculation module for calculating the position offset of the two-dimensional code in the standard image and the real-time image according to the standard image and the real-time image.
6. A computer device, comprising: It comprises: a processor and a memory for storing a computer program capable of running on the processor, wherein when the processor is used to run the computer program, the automatic two-dimensional code pasting method of any one of claims 1 to 4 is realized.
7. A computer storage medium, characterized in that The executable program is stored, and when the executable program is executed by the processor, the automatic two-dimensional code pasting method of any one of claims 1 to 4 is realized.
Citation Information
Patent Citations
Automatic two-dimensional code mounting system
CN112722498A
Power transmission line image augmentation method and system based on improved DCGAN
CN113673670A
Automatic labeling positioning and deviation rectifying method based on computer vision
CN114425776A