A scanning adaptive system based on self-service barcode scanner
By automatically adjusting the angle and position of the code scanner and combining the deep learning technology of the virtual reconstruction module, the fixed position and environmental reflection problems of the QR code scanning equipment in the existing system are solved, achieving a more efficient and accurate code scanning effect.
Patent Information
- Application Number
- CN202411056429.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-02
- Publication Date
- 2025-04-18
- Estimated Expiration
- 2044-08-02
AI Technical Summary
The existing QR code self-service scanning system cannot flexibly adjust the angle and position of the scanning equipment, and the reflection problems of ambient light and QR code surfaces affect the accuracy and efficiency of scanning codes.
By judging the position and reflective parameters of the QR code, the angle and position of the code scanner are automatically adjusted, and the virtual reconstruction module is used to reconstruct the virtual QR code through deep learning when it is impossible to directly read the QR code.
It improves the accuracy and efficiency of scanning codes, reduces the complexity and time cost of users adjusting the location of QR codes, and enhances the robustness and adaptability of the system.
Smart Images

Figure CN118917336B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of code scanning technology, and in particular to a code scanning adaptive system based on a self-service code scanner. Background Art
[0002] With the development of information technology and the popularization of smart devices, QR codes have become a widely used tool for storing and transmitting various types of information. QR codes can achieve fast and accurate information acquisition in various scenarios, especially in self-service terminals, where QR code scanning technology has been widely used. However, in practical applications, there are still some technical challenges in the scanning process of QR codes. For example, in automatic ticket machines, the spatial position of the QR code is not fixed, and reflective interference affects the accuracy and efficiency of scanning.
[0003] Existing self-service QR code scanning systems usually rely on fixed-position scanning devices, and cannot flexibly adjust their angles and positions to adapt to the operating habits of different users and the actual placement of the QR code. In addition, the reflection of ambient light and the surface of the QR code will also have a significant impact on the scanning effect. These problems cause users to need to adjust the position and angle of the QR code multiple times when using self-service scanning devices, but they still cannot adapt to the requirements of self-service scanning devices, increasing the complexity of operation and time cost. Summary of the invention
[0004] To solve the above problems, the present invention provides a scanning adaptive system based on a self-service barcode scanner, which automatically adjusts the barcode scanner to scan the code by judging the posture and reflective parameters of the QR code and realizes scanning adaptation by reconstructing a virtual QR code.
[0005] To achieve the above object, the technical solution adopted by the present invention is:
[0006] A barcode scanning adaptive system based on a self-service barcode scanner comprises: a barcode scanner module, a state data acquisition module, a posture analysis module, an adaptive adjustment module and a virtual reconstruction module, wherein the state data acquisition module, the posture analysis module, the adaptive adjustment module and the virtual reconstruction module are connected in sequence, and the barcode scanner module is connected to the adaptive adjustment module;
[0007] The barcode scanner module is used to read the QR code and generate scanned data containing the QR code information;
[0008] The state data acquisition module is used to acquire the image data and laser ranging data in front of the current self-service barcode scanner;
[0009] The adaptive adjustment module is used to control and adjust the horizontal angle and the vertical angle of the barcode scanner module according to the adjustment instructions generated by the posture analysis module;
[0010] The posture analysis module is used to determine the spatial posture of the two-dimensional code according to the image data and the laser ranging data, determine the reflective parameters of the two-dimensional code through the image data, perform reinforcement learning through adjustment instructions, the spatial posture and reflective parameters of the two-dimensional code, and output the adjustment instructions in real time; the laser ranging data includes a laser ranging matrix;
[0011] The virtual reconstruction module is used to reconstruct the virtual QR code and read the scanned code data of the virtual QR code through deep learning based on the image data and the spatial posture of the QR code when the adjustment instruction is completed and the QR code reading cannot be achieved.
[0012] Furthermore, the barcode scanner module is used to perform the following steps:
[0013] Get the code scanning command to execute the code scanning and trigger the code scanning timing;
[0014] If the code scanning data is successfully obtained, the code scanning timer is terminated and initialized;
[0015] If the scanning time is longer than the preset scanning time, the status data acquisition module is triggered to run.
[0016] Furthermore, the determining the spatial position of the QR code according to the image data and the laser ranging data comprises the following steps:
[0017] The laser ranging matrix is screened based on the image data to obtain a valid ranging matrix;
[0018] Based on the convolutional neural network, the effective distance measurement matrix is used as input and the QR code center distance and spatial pose vector are used as output for training;
[0019] Adjust the matrix weights through loss function and back propagation;
[0020] The trained convolutional neural network outputs the current spatial pose vector of the QR code in real time.
[0021] Furthermore, determining the reflective parameters of the QR code through the image data comprises the following steps:
[0022] Grayscale and denoise the image data area corresponding to the effective ranging matrix;
[0023] Calculate the light reflection intensity distribution in the QR code area and obtain the reflection feature vector.
[0024] Furthermore, the reinforcement learning by adjusting the instructions, the spatial posture and the reflective parameters of the QR code includes:
[0025] The spatial position of the QR code and the corresponding reflective parameters are used as states to initialize the reinforcement learning model, and the adjustment instructions are used as actions to establish a state transfer model;
[0026] A reward mechanism is set based on the reflection parameters and whether the scanned data is successfully obtained. Successful operations of obtaining scanned data are rewarded, while unsuccessful operations of obtaining scanned data are punished.
[0027] Update the Q value of the reinforcement learning model through the Q-learning algorithm;
[0028] After each scanning attempt, the reinforcement learning model is adjusted in real time based on the acquired scanning data and reflective parameters.
[0029] Furthermore, the formula of the reinforcement learning model is as follows:
[0030]
[0031] Where s is the state, including the spatial position of the QR code and the corresponding reflective parameters; a is the action, including the adjustment instruction parameters; Q(s, a) represents the expected return value of executing action a in state s; R(s, a) is the immediate reward obtained by executing action a in state s; γ is the discount factor; s′ is the next state; a′ is the next action; P(s′|s, a) is the state transition probability; max a′ Q(s′, a′) represents the maximum expected reward of taking the next action a′ in the next state s′.
[0032] Furthermore, the formula of the reward mechanism is as follows:
[0033]
[0034] Where R(s, a) is the instant reward for executing action a in state s; G indicates whether the scanned code data is successfully acquired. If it is successfully acquired, G is 1, and if it is not successfully acquired, G is 0; P is the reflective parameter of the current QR code; P opt To preset the best reflective parameters; max and P min are the maximum and minimum values of the reflection parameters respectively; λ1 and λ2 are weight coefficients.
[0035] Furthermore, the reconstructing the virtual QR code by deep learning based on the image data and the spatial posture of the QR code comprises the following steps:
[0036] Get the image data in front of the current self-service barcode scanner and the spatial position of the QR code;
[0037] Input the image data and the spatial pose of the QR code into a generator of a generative adversarial network, wherein the generator includes a plurality of convolutional layers and deconvolutional layers, and generates a virtual QR code image by taking the image data and the spatial pose of the QR code as input;
[0038] The generated virtual QR code image is input into the discriminator of the adversarial network, wherein the discriminator includes a plurality of convolutional layers and a fully connected layer, and evaluates the authenticity of the virtual QR code image and outputs the evaluation result;
[0039] Adversarial training through generator and discriminator;
[0040] After the training is completed, a virtual QR code is generated by the generator and verified by the discriminator.
[0041] Furthermore, the loss function of the generator is as follows:
[0042]
[0043] Where gen is the generator; dis is the discriminator; x is the real QR code image data; z is the random noise vector, which is the input of the generator; gen(z) is the generated virtual QR code image; dis(x) is the output probability of the discriminator for the real image; dis(gen(z)) is the output probability of the discriminator for the generated image; p z (z) is the distribution of noise data; p data (x) is the distribution of real data.
[0044] The beneficial effect of the present invention is that the present invention obtains the image data in front of the current self-service barcode scanner in real time through the status data acquisition module, ensuring that the system can capture the latest position and status of the QR code at any time. The posture analysis module determines the spatial posture and reflection parameters of the QR code by analyzing the image data and the laser ranging data, and provides accurate position information and environmental characteristics. The adaptive adjustment module dynamically adjusts the horizontal angle and the up and down angle of the barcode scanner according to the adjustment instructions generated by the posture analysis module to adapt to the operation of different users and the actual placement position of the QR code, solves the limitations of the fixed position scanning equipment in the existing system and minimizes the impact of reflection on the scanning of the code on the reading of the code. Through the virtual reconstruction module, when the adjustment instruction is completed and the QR code reading cannot be realized, based on the image data and the spatial posture of the QR code, the virtual QR code is reconstructed through deep learning and its scanning data is read, further improving the robustness and adaptability of the system. The deep learning technology of the virtual reconstruction module can generate a virtual QR code image, and optimize it through a generative adversarial network (GAN) to ensure the accuracy and readability of the virtual QR code. Based on this, the user only needs to hold the QR code position without adjustment to realize adaptive scanning and read the scanning information. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] Figure 1 It is a structural schematic diagram of a scanning adaptive system based on a self-service barcode scanner of the present invention.
[0046] Figure 2It is a flow chart of the steps of determining the spatial posture of a two-dimensional code based on image data and laser ranging data in the present invention.
[0047] Figure 3 It is a flowchart of the steps of performing reinforcement learning by adjusting the instructions, the spatial posture and reflective parameters of the QR code in the present invention. DETAILED DESCRIPTION
[0048] See also Figure 1-2 As shown, the present invention is about
[0049] A barcode scanning adaptive system based on a self-service barcode scanner comprises: a barcode scanner module, a state data acquisition module, a posture analysis module, an adaptive adjustment module and a virtual reconstruction module, wherein the state data acquisition module, the posture analysis module, the adaptive adjustment module and the virtual reconstruction module are connected in sequence, and the barcode scanner module is connected to the adaptive adjustment module;
[0050] The barcode scanner module is used to read the QR code and generate scanned data containing the QR code information;
[0051] The state data acquisition module is used to acquire the image data and laser ranging data in front of the current self-service barcode scanner;
[0052] The adaptive adjustment module is used to control and adjust the horizontal angle and the vertical angle of the barcode scanner module according to the adjustment instructions generated by the posture analysis module;
[0053] The posture analysis module is used to determine the spatial posture of the two-dimensional code according to the image data and the laser ranging data, determine the reflective parameters of the two-dimensional code through the image data, perform reinforcement learning through adjustment instructions, the spatial posture and reflective parameters of the two-dimensional code, and output the adjustment instructions in real time; the laser ranging data includes a laser ranging matrix;
[0054] The virtual reconstruction module is used to reconstruct the virtual QR code and read the scanned code data of the virtual QR code through deep learning based on the image data and the spatial posture of the QR code when the adjustment instruction is completed and the QR code reading cannot be achieved.
[0055] In some embodiments, first, the barcode scanner module is used to read the QR code and generate scan data containing the QR code information. When the user places the QR code in front of the barcode scanner, the state data acquisition module starts to work and acquires the image data and laser ranging data in front of the current self-service barcode scanner in real time. The image data provides the system with visual information of the QR code, while the laser ranging data provides the system with the distance and position relationship between the QR code and the barcode scanner through the laser ranging matrix. The state data acquisition module transmits the acquired data to the posture analysis module. The posture analysis module determines the spatial posture of the QR code, that is, the position and angle of the QR code in three-dimensional space, by comprehensive analysis of the image data and the laser ranging data. At the same time, the posture analysis module uses the image data to determine the reflective parameters of the QR code, such as the light reflection intensity and angle of the QR code surface. The posture analysis module generates an adjustment instruction based on the above analysis results and transmits it to the adaptive adjustment module. After receiving the adjustment instruction, the adaptive adjustment module controls and adjusts the horizontal angle and the up and down angle of the barcode scanner module in real time to ensure that the barcode scanner is aligned with the optimal position and angle of the QR code. In this way, even if the position and angle of the QR code change, the system can quickly align the QR code through the adjustment of the adaptive adjustment module, thereby improving the scanning success rate. In addition, the posture analysis module performs reinforcement learning through adjustment instructions, the spatial posture of the QR code and the reflective parameters. The system optimizes the adjustment algorithm and model through continuous scanning operations and data feedback, making the adjustment instructions more accurate and efficient. During each scanning process, the system will adjust and optimize the reinforcement learning model in real time according to the acquired scanning data and reflective parameters to improve the intelligence level and adaptability of the system. In unexpected situations, even if the adaptive adjustment module has completed the adjustment according to the adjustment instructions, but the QR code cannot be read, the virtual reconstruction module will be started. The virtual reconstruction module reconstructs the virtual QR code based on the image data and the spatial posture of the QR code through a deep learning algorithm. Specifically, the virtual reconstruction module generates a virtual QR code image that is highly similar to the actual QR code through a generative adversarial network (GAN), and recognizes and reads the virtual QR code through a deep learning model. The generated virtual QR code image is optimized to ensure its accuracy and readability, thereby achieving successful reading of the QR code information. The status data acquisition module consists of an image sensor and a laser rangefinder. The image sensor can be a high-definition camera to obtain the image data in front of the current self-service barcode scanner in real time. The laser rangefinder generates accurate laser distance measurement matrix data by emitting and receiving lasers. These data can reflect the relative position and distance between the QR code and the barcode scanner. The adaptive adjustment module consists of an electric servo motor and a control unit. The electric servo motor controls the horizontal and vertical movement of the barcode scanner to achieve precise adjustment of the barcode scanner angle. The control unit adjusts the operation of the servo motor in real time according to the adjustment instructions generated by the posture analysis module to ensure that the barcode scanner module can quickly align with the position and angle of the QR code.
[0056] Furthermore, the barcode scanner module is used to perform the following steps:
[0057] Get the code scanning command to execute the code scanning and trigger the code scanning timing;
[0058] If the code scanning data is successfully obtained, the code scanning timer is terminated and initialized;
[0059] If the scanning time is longer than the preset scanning time, the status data acquisition module is triggered to run.
[0060] In some embodiments, first, after the system receives a code scanning instruction from the user, the code scanner module is immediately started and prepared for QR code scanning. The code scanner starts to capture QR code image data. The built-in processing unit is responsible for synchronously processing these data, and starts the code scanning timer to record the duration of the code scanning operation. During the code scanning process, if the code scanner successfully obtains the QR code data, the system will immediately stop timing and initialize the code scanner module to prepare for the next scanning operation. Specifically, the built-in processing unit will parse the acquired QR code data and transmit it to the main control system for further processing, while resetting the camera and laser sensor, clearing the previous measurement data and image cache, and ensuring that the next code scanning operation is not interfered with. However, if the QR code data is not successfully obtained within the preset code scanning time, the system will trigger the operation of the status data acquisition module. The preset code scanning time is a reasonable time limit set according to the actual use environment and equipment performance to ensure the smoothness of the user experience and the reliability of the system under various operating conditions. After receiving the instruction, the status data acquisition module immediately starts the high-performance image sensor and laser rangefinder to re-acquire the image data and laser rangefinder data in front of the current self-service code scanner. At this time, the latest image data captured by the image sensor and the distance and angle data measured by the laser rangefinder will be transmitted to the posture analysis module. After receiving the new data, the posture analysis module will conduct a comprehensive analysis through the internal image processing unit and data analysis unit to re-determine the spatial posture and reflective parameters of the QR code. Then, a new adjustment instruction is generated and transmitted to the adaptive adjustment module. Based on the new adjustment instruction, the adaptive adjustment module adjusts the horizontal angle and the vertical angle of the scanner through the electric servo motor, so that the scanner is aligned with the optimal position and angle of the QR code again, thereby improving the scanning success rate.
[0061] Furthermore, the determining the spatial position of the QR code according to the image data and the laser ranging data comprises the following steps:
[0062] The laser ranging matrix is screened based on the image data to obtain a valid ranging matrix;
[0063] Based on the convolutional neural network, the effective distance measurement matrix is used as input and the QR code center distance and spatial pose vector are used as output for training;
[0064] Adjust the matrix weights through loss function and back propagation;
[0065] The trained convolutional neural network outputs the current spatial pose vector of the QR code in real time.
[0066] In some embodiments, first, by capturing the image data in front of the current self-service barcode scanner, and obtaining the distance and angle data between the QR code and the barcode scanner through the laser ranging module, a preliminary laser ranging matrix is formed. The laser ranging matrix contains a large number of data points, reflecting the distance information between the QR code surface and the laser sensor. However, due to the influence of factors such as ambient light and reflection on the QR code surface, the original ranging matrix may contain some invalid or noisy data points. To this end, the system needs to screen the laser ranging matrix based on the image data. Specifically, the system first analyzes the image data through an image processing algorithm to locate the edge and center position of the QR code. Then, the image data is compared with the laser ranging matrix, and valid ranging data points matching the QR code position are screened to form an effective ranging matrix. The effective ranging matrix retains the key distance information related to the actual position of the QR code and removes invalid or noisy data. Next, the system uses a convolutional neural network (CNN) to perform deep learning training on the effective ranging matrix. During the training process, the effective ranging matrix is used as input, and the QR code center distance and spatial pose vector are output to construct a training model. The QR code center distance represents the distance between the center point of the QR code and the scanner, while the spatial pose vector includes the position and angle information of the QR code in three-dimensional space. Through the input of a large amount of training data, the convolutional neural network can gradually learn and optimize, so as to accurately extract the spatial pose features of the QR code. During the training process, the system uses a loss function to evaluate the error between the model's prediction results and the true value. Commonly used loss functions such as mean square error (MSE) are used to quantify the difference between the model output and the target value. Through the back-propagation algorithm, the system adjusts the weight parameters in the network according to the feedback of the loss function, and continuously optimizes the prediction ability of the model. The back-propagation algorithm calculates the partial derivative of the loss function with respect to each weight, propagates the error back to each layer of the network, adjusts the weight layer by layer, and reduces the prediction error.
[0067] Furthermore, determining the reflective parameters of the QR code through the image data comprises the following steps:
[0068] Grayscale and denoise the image data area corresponding to the effective ranging matrix;
[0069] Calculate the light reflection intensity distribution in the QR code area and obtain the reflection feature vector.
[0070] It should be noted that the system performs grayscale processing on the image data area corresponding to the effective ranging matrix. Grayscale processing is the process of converting a color image into a grayscale image. Its purpose is to simplify the image data and retain important light intensity information. Through grayscale processing, each pixel in the color image will be converted into a grayscale value, which represents the light intensity of the pixel. The grayscale image not only has a smaller data volume, but also is more convenient for subsequent image analysis and processing. After the grayscale processing is completed, the system needs to perform denoising on the image data. Denoising is to eliminate random noise in the image and enhance the quality and stability of the image. Common denoising methods include Gaussian filtering, median filtering, etc. Through denoising, the system can remove noise points in the image and retain the effective information of the QR code area, thereby improving the accuracy of subsequent reflective parameter calculations. After completing the grayscale and denoising processing, the system begins to calculate the light reflection intensity distribution in the QR code area. The light reflection intensity distribution refers to the light intensity distribution of each pixel in the QR code area. The system calculates the grayscale value of each pixel one by one to generate a light intensity distribution map. The distribution diagram reflects the light reflection characteristics at different positions on the QR code surface. In order to further extract the reflection parameters, the system converts the light reflection intensity distribution into a reflection feature vector. The reflection feature vector is a vector containing multiple dimensions, each dimension representing the light intensity characteristics at different positions in the QR code area. Through feature extraction algorithms, such as principal component analysis (PCA) or linear discriminant analysis (LDA), the system can reduce the dimension of high-dimensional light intensity data to obtain a representative reflection feature vector. The reflection feature vector contains the light reflection characteristic information in the QR code area, and the system can use the feature vector for further analysis and judgment. For example, the system can evaluate the reflection of the QR code surface based on the reflection feature vector, and adjust it in combination with other parameters to improve the scanner's ability to recognize the QR code.
[0071] Furthermore, the reinforcement learning by adjusting the instructions, the spatial posture and the reflective parameters of the QR code includes:
[0072] The spatial position of the QR code and the corresponding reflective parameters are used as states to initialize the reinforcement learning model, and the adjustment instructions are used as actions to establish a state transfer model;
[0073] A reward mechanism is set based on the reflection parameters and whether the scanned data is successfully obtained. Successful operations of obtaining scanned data are rewarded, while unsuccessful operations of obtaining scanned data are punished.
[0074] Update the Q value of the reinforcement learning model through the Q-learning algorithm;
[0075] After each scanning attempt, the reinforcement learning model is adjusted in real time based on the acquired scanning data and reflective parameters.
[0076] In some embodiments, first, the system initializes the reinforcement learning model. At this stage, the spatial pose of the QR code and the corresponding reflective parameters are defined as the state of the system, and the adjustment instructions are defined as actions. The spatial pose includes the position and angle information of the QR code in three-dimensional space, while the reflective parameters reflect the light reflection characteristics of the QR code surface. Based on these states and actions, the system establishes a state transition model, which describes the process of transitioning from one state to another and its probability distribution. After establishing the state transition model, the system sets up a reward mechanism based on the reflective parameters and the results of scanning code data acquisition. The reward mechanism is designed to encourage the system to successfully acquire QR code data and punish unsuccessful operations. Specifically, when the system successfully acquires the scanned code data, a positive reward will be given; conversely, if the scan fails, a negative reward will be given. This reward mechanism guides the system to optimize its adjustment instructions through a continuous trial and error process to improve the success rate of scanning. In the reinforcement learning process, the system uses the Q-learning algorithm to update the Q value of the reinforcement learning model. Q-learning is a model-free reinforcement learning algorithm that can find the optimal strategy through continuous trial and error and learning without an environmental model. After each adjustment instruction is executed, the system updates the Q value based on the current state, the action performed, the reward obtained, and the new state transferred to. The Q value represents the expected value of the cumulative reward that can be obtained by performing a certain action in a given state.
[0077] Furthermore, the formula of the reinforcement learning model is as follows:
[0078]
[0079] Where s is the state, including the spatial position of the QR code and the corresponding reflective parameters; a is the action, including the adjustment instruction parameters; Q(s, a) represents the expected return value of executing action a in state s; R(s, a) is the immediate reward obtained by executing action a in state s; γ is the discount factor; s′ is the next state; a′ is the next action; P(s′|s, a) is the state transition probability; max a′ Q(s′, a′) represents the maximum expected reward of taking the next action a′ in the next state s′.
[0080] Specifically, first, the system initializes the reinforcement learning model. At this stage, the spatial pose of the QR code and the corresponding reflective parameters are defined as the state s of the system, and the adjustment instruction is defined as the action a. The spatial pose includes the position and angle information of the QR code in three-dimensional space, while the reflective parameters reflect the light reflection characteristics of the QR code surface. Based on these states and actions, the system establishes a state transition model, which describes the process of transitioning from one state to another and its probability distribution. After establishing the state transition model, the system sets up a reward mechanism based on the reflective parameters and the results of scanning code data acquisition. The reward mechanism is designed to encourage the system to successfully acquire QR code data and punish unsuccessful operations. Specifically, when the system successfully acquires the scanned code data, a positive reward will be given; conversely, if the scan fails, a negative reward will be given. This reward mechanism guides the system to optimize its adjustment instructions through a continuous trial and error process to improve the scanning success rate. During the reinforcement learning process, the system updates the Q value of the reinforcement learning model according to the Q-learning algorithm. Q-learning is a model-free reinforcement learning algorithm that can find the optimal strategy through continuous trial and error and learning without an environmental model. After each execution of an adjustment instruction, the system updates the Q value based on the current state s, the action performed a, the reward R obtained, and the new state s′ transferred to.
[0081] Furthermore, the formula of the reward mechanism is as follows:
[0082]
[0083] Where R(s, a) is the instant reward for executing action a in state s; G indicates whether the scanned code data is successfully acquired. If it is successfully acquired, G is 1, and if it is not successfully acquired, G is 0; P is the reflective parameter of the current QR code; P opt To preset the best reflective parameters; max and P min are the maximum and minimum values of the reflection parameters respectively; λ1 and λ2 are weight coefficients.
[0084] Specifically, after the system executes the adjustment instruction, it first evaluates whether the code is scanned successfully. If the QR code data is successfully read, G = 1, and the system will give a positive reward; if the reading fails, G = 0, and the system will give a negative reward. In this way, the system can guide itself to give priority to the adjustment instructions that can successfully read the QR code in future operations through the reward mechanism. Next, the system calculates the current reflective parameter P of the QR code and the preset optimal reflective parameter P opt The difference between the optimal value of the reflective parameter P optIt is an ideal parameter preset through experiments and actual usage experience. The system calculates the difference between the current reflective parameters and the optimal reflective parameters, and standardizes the difference so that it ranges from 0 to 1. By subtracting this standardized difference, the system can evaluate the degree to which the current adjustment instruction optimizes the reflective conditions. The system calculates the instant reward value R(s, a) by comprehensively evaluating the two factors of code scanning success and reflective parameter optimization. The weight coefficients λ1 and λ2 are used to balance the influence of these two parts, ensuring that the system can give priority to code scanning success and gradually optimize the reflective parameters to improve the overall code scanning performance.
[0085] Furthermore, the reconstructing the virtual QR code by deep learning based on the image data and the spatial posture of the QR code comprises the following steps:
[0086] Get the image data in front of the current self-service barcode scanner and the spatial position of the QR code;
[0087] Input the image data and the spatial pose of the QR code into a generator of a generative adversarial network, wherein the generator includes a plurality of convolutional layers and deconvolutional layers, and generates a virtual QR code image by taking the image data and the spatial pose of the QR code as input;
[0088] The generated virtual QR code image is input into the discriminator of the adversarial network, wherein the discriminator includes a plurality of convolutional layers and a fully connected layer, and evaluates the authenticity of the virtual QR code image and outputs the evaluation result;
[0089] Adversarial training through generator and discriminator;
[0090] After the training is completed, a virtual QR code is generated by the generator and verified by the discriminator.
[0091] Specifically, the system inputs the image data and the spatial pose of the QR code into the generator of the generative adversarial network (GAN). The generator consists of several convolutional layers and deconvolutional layers. The convolutional layers are used to extract the features of the input data, and the deconvolutional layers are used to generate high-resolution virtual QR code images. The generator generates a virtual QR code image that is highly similar to the actual QR code by processing the image data and the spatial pose. The generated virtual QR code image is then input into the discriminator of the GAN. The discriminator consists of several convolutional layers and fully connected layers. The convolutional layers are used to extract the features of the virtual QR code image, and the fully connected layers are used to evaluate the authenticity of the virtual QR code image. The discriminator gradually improves its ability to identify the authenticity of the virtual QR code image through adversarial training with the generator, and outputs the evaluation results. The generator and discriminator are continuously optimized through adversarial training. The basic process of adversarial training is as follows:
[0092] The generator generates a virtual QR code image and inputs it into the discriminator;
[0093] The discriminator evaluates the authenticity of the virtual QR code image and outputs the evaluation result;
[0094] According to the feedback from the discriminator, adjust the network parameters of the generator and discriminator;
[0095] The goal of the generator is to generate a virtual QR code image that is closer to reality so that it can deceive the discriminator;
[0096] The goal of the discriminator is to accurately distinguish between real QR code images and virtual QR code images.
[0097] After training, the system uses the optimized generator to generate virtual QR code images and verifies them through the discriminator to ensure the accuracy and readability of the virtual QR code. The generated virtual QR code images are highly similar to the actual QR code images and can provide reliable scan data when the actual QR code cannot be directly read.
[0098] Furthermore, the loss function of the generator is as follows:
[0099]
[0100] Where gen is the generator; dis is the discriminator; x is the real QR code image data; z is the random noise vector, which is the input of the generator; gen(z) is the generated virtual QR code image; dis(x) is the output probability of the discriminator for the real image; dis(gen(z)) is the output probability of the discriminator for the generated image; p z (z) is the distribution of noise data; p data (x) is the distribution of real data.
[0101] Specifically, the goal of the generator is to minimize its loss function to generate a virtual QR code image that can deceive the discriminator. During the training process, the generator continuously adjusts its internal parameters based on the feedback from the discriminator through the back-propagation algorithm to generate more realistic virtual QR code images. Use the real QR code image data x and the generated virtual QR code image gen(z) to train the discriminator to maximize the loss function. Repeat the above steps until the virtual QR code image generated by the generator can deceive the discriminator with a high probability. Through the above training process, the generator continuously optimizes its parameters and improves the quality of the generated virtual QR code image, making it highly similar to the real QR code image. At the same time, the discriminator is also continuously optimized to improve its ability to distinguish between real images and virtual images.
[0102] The above implementation modes are merely descriptions of the preferred implementation modes of the present invention, and are not intended to limit the scope of the present invention. Without departing from the design spirit of the present invention, various modifications and improvements made to the technical solutions of the present invention by ordinary engineering and technical personnel in the field shall fall within the protection scope determined by the claims of the present invention.
Claims
1. A scanning adaptive system based on a self-service barcode scanner, characterized in that: include: A barcode scanner module, a state data acquisition module, a posture analysis module, an adaptive adjustment module and a virtual reconstruction module, wherein the state data acquisition module, the posture analysis module, the adaptive adjustment module and the virtual reconstruction module are connected in sequence, and the barcode scanner module is connected to the adaptive adjustment module; The barcode scanner module is used to read the QR code and generate scanned data containing the QR code information; The state data acquisition module is used to acquire the image data and laser ranging data in front of the current self-service barcode scanner; The adaptive adjustment module is used to control and adjust the horizontal angle and the vertical angle of the barcode scanner module according to the adjustment instructions generated by the posture analysis module; The posture analysis module is used to determine the spatial posture of the two-dimensional code according to the image data and the laser ranging data, determine the reflective parameters of the two-dimensional code through the image data, perform reinforcement learning through adjustment instructions, the spatial posture and reflective parameters of the two-dimensional code, and output the adjustment instructions in real time; the laser ranging data includes a laser ranging matrix; The virtual reconstruction module is used to reconstruct the virtual QR code through deep learning based on the image data and the spatial posture of the QR code and read the scanned code data of the virtual QR code when the adjustment instruction is completed and the QR code reading cannot be realized; The reinforcement learning by adjusting the instructions, the spatial position and reflection parameters of the QR code includes: The spatial position of the QR code and the corresponding reflective parameters are used as states to initialize the reinforcement learning model, and the adjustment instructions are used as actions to establish a state transfer model; A reward mechanism is set based on the reflection parameters and whether the scanned data is successfully obtained. Successful operations of obtaining scanned data are rewarded, while unsuccessful operations of obtaining scanned data are punished. Update the Q value of the reinforcement learning model through the Q-learning algorithm; After each scan attempt, the reinforcement learning model is adjusted in real time based on the scan data and reflective parameters obtained; The method of reconstructing a virtual QR code by deep learning based on the image data and the spatial posture of the QR code comprises the following steps: Get the image data in front of the current self-service barcode scanner and the spatial position of the QR code; Input the image data and the spatial pose of the QR code into a generator of a generative adversarial network, wherein the generator includes a plurality of convolutional layers and deconvolutional layers, and generates a virtual QR code image by taking the image data and the spatial pose of the QR code as input; The generated virtual QR code image is input into the discriminator of the adversarial network, wherein the discriminator includes a plurality of convolutional layers and a fully connected layer, and evaluates the authenticity of the virtual QR code image and outputs the evaluation result; Adversarial training through generator and discriminator; After the training is completed, a virtual QR code is generated by the generator and verified by the discriminator.
2. The self-adaptive barcode scanning system based on the self-service barcode scanner according to claim 1, characterized in that: The barcode scanner module is used to perform the following steps: Get the code scanning command to execute the code scanning and trigger the code scanning timing; If the code scanning data is successfully obtained, the code scanning timer is terminated and initialized; If the scanning time is longer than the preset scanning time, the status data acquisition module is triggered to run.
3. The self-adaptive barcode scanning system based on the self-service barcode scanner according to claim 1, characterized in that: Determining the spatial position of the QR code based on the image data and the laser ranging data comprises the following steps: The laser ranging matrix is screened based on the image data to obtain a valid ranging matrix; Based on the convolutional neural network, the effective distance measurement matrix is used as input and the QR code center distance and spatial pose vector are used as output for training; Adjust the matrix weights through loss function and back propagation; The trained convolutional neural network outputs the current spatial pose vector of the QR code in real time.
4. The self-adaptive barcode scanning system based on the self-service barcode scanner according to claim 2, characterized in that: Determining the reflective parameters of the QR code by using the image data comprises the following steps: Grayscale and denoise the image data area corresponding to the effective ranging matrix; Calculate the light reflection intensity distribution in the QR code area and obtain the reflection feature vector.
5. The self-adaptive barcode scanning system based on a self-service barcode scanner according to claim 1, characterized in that: The formula of the reinforcement learning model is as follows: ; Among them, s is the state, including the spatial position of the QR code and the corresponding reflective parameters; For actions, including adjusting instruction parameters; represents the expected return value of executing action a in state s; To perform an action in state s The immediate rewards received; is the discount factor; For the next state; For the next step; is the state transition probability; To indicate the next state Next step maximum expected return.
6. The adaptive barcode scanning system based on a self-service barcode scanner according to claim 5, characterized in that: The formula for the reward mechanism is as follows: ; in, To perform an action in state s The immediate rewards received; Indicates whether the scanned data is successfully obtained. 1, when the acquisition is unsuccessful is 0; is the reflection parameter of the current QR code; To preset the best reflection parameters; and are the maximum and minimum values of the reflection parameters respectively; and is the weight coefficient.
7. The self-adaptive barcode scanning system based on a self-service barcode scanner according to claim 1, characterized in that: The loss function of the generator is as follows: ; in, For the generator; is the discriminator; is the real QR code image data; is a random noise vector, which is used as the input of the generator; is the generated virtual QR code image; is the output probability of the discriminator for the real image; is the output probability of the discriminator for the generated image; is the distribution of noise data; is the distribution of the real data.
Citation Information
Patent Citations
Human face posture virtual view generation method based on VAE-ACGAN
CN110348330A
System and method for synthesizing front face from side face in end-to-end manner based on conditional generative adversarial network
CN110889370A