Weighing data intelligent processing system and method based on two-dimensional code
Through the improved density clustering algorithm and the preprocessing method of BP neural network, combined with data coding and error correction coding, the problem of low correlation efficiency between noise and QR codes in traditional intelligent weighing data processing is solved, and efficient intelligent processing of weighing data is achieved.
Patent Information
- Application Number
- CN202510695678.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-28
- Publication Date
- 2025-06-27
- Estimated Expiration
- 2045-05-28
AI Technical Summary
The traditional intelligent weighing data processing method has problems such as noise data leading to errors, low correlation efficiency between weighing data and QR codes, resulting in slow QR code generation and identification, and it is difficult to manage traceability.
The improved density clustering algorithm is used to identify abnormal weighing data, train the BP neural network and optimize weights and thresholds using the improved particle swarm optimization algorithm to perform data preprocessing and correction. Then, through data encoding, error correction encoding and mask processing, an efficiently associated weighing data QR code is generated.
It improves the preprocessing accuracy of weighing data and the efficiency of generating and identifying QR codes, and enhances the traceability and management of data.
Smart Images

Figure CN120217022A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data processing, and specifically to an intelligent processing system and method for weighing data based on two-dimensional codes. Background Art
[0002] Chinese Patent CN112948652A discloses a method and system for displaying petrochemical device data based on two-dimensional codes. The method specifically includes using two-dimensional code scanning in non-explosion-proof areas and explosion-proof areas. The real-time database of the petrochemical device displays the requested data of the real-time database nodes. There is a client on the mobile phone in the non-explosion-proof area, and there is also a client on the explosion-proof mobile terminal in the explosion-proof area. The client is used to monitor the user identity account to log in to the real-time database of the petrochemical device and call the mobile phone or explosion-proof mobile terminal to scan the two-dimensional code; the two-dimensional code feedback string is used to locate the corresponding data on the Web server, and further call the real-time data in the real-time database of the petrochemical device according to the parameters in the corresponding data on the Web server; the client displays the data corresponding to the two-dimensional code in the real-time database node interface, and the user queries the data in the real-time database of the petrochemical device. This invention does not clean the data stored in the database, and the two-dimensional code recognition speed needs to be improved.
[0003] In traditional intelligent processing methods for weighing data, after the collected weighing data is stored, no preprocessing is performed on the weighing data. The weighing data may contain noise, resulting in errors in the data processing results; at the same time, during the process of converting weighing data into two-dimensional codes, the efficient association between weighing data and two-dimensional codes is not achieved, resulting in slow two-dimensional code generation speed and recognition speed, which brings difficulties to management and traceability. Summary of the Invention
[0004] In view of the problems in the related art, the present invention provides an intelligent processing system and method for weighing data based on two-dimensional codes to overcome the above-mentioned technical problems existing in the prior related art.
[0005] To solve the above technical problems, the present invention is implemented through the following technical solutions: The present invention provides an intelligent processing method for weighing data based on two-dimensional codes, including the following steps: S1. Obtain relevant item weighing data to form an initial weighing data set, and use an improved density clustering algorithm to identify abnormal weighing data in the initial weighing data set, obtaining an abnormal weighing data set and a normal weighing data set; S2. Train a BP neural network. By introducing a speed pause parameter, improve the particle swarm optimization algorithm to obtain an improved particle swarm optimization algorithm, and use the improved particle swarm optimization algorithm to optimize the weights and thresholds in the BP neural network to obtain a BP neural network prediction model; S3. According to the normal weighing data set, use the BP neural network prediction model to verify the abnormal weighing data set, correct the abnormal data and fill in the missing data to obtain a processed weighing data set; S4. After encoding the processed weighing data set, obtain a new binary code. Then perform error correction coding and masking on the new binary code to obtain the final weighing data QR code, and realize identification and reading to complete the intelligent processing of weighing data.
[0006] The invention obtains an initial weighing data set, uses an improved density clustering algorithm to identify abnormal weighing data in the initial weighing data set, and divides the initial weighing data set into an abnormal weighing data set and a normal weighing data set; this method adaptively searches for the radius parameter, marks abnormal points according to the density, ensures the stability of the algorithm, and overcomes the problem of poor clustering effect caused by different radius parameters in traditional algorithms; secondly, trains a BP neural network, and uses a particle swarm optimization algorithm to optimize the weights and thresholds in the BP neural network. By introducing a velocity pause parameter, the particle swarm optimization algorithm is improved. The improved algorithm improves the problems of slow convergence speed and easy entrapment in local optimal solutions of traditional algorithms. Using the velocity pause parameter to replace the traditional velocity update mechanism greatly increases the optimization performance; the BP neural network prediction model uses the normal weighing data set to output a prediction value, verifies the abnormal weighing data set through the prediction value, uses the prediction value to correct abnormal data and fill in missing data to obtain a processed weighing data set; finally, uses the processed weighing data set for data encoding, error correction coding and masking processing, realizes the efficient association of weighing data and QR codes, error correction coding is convenient for the identification of incomplete QR codes, masking processing reduces the recognition difficulty, improves the applicability of QR codes, and is convenient for data traceability and management.
[0007] Preferably, the S1 includes the following steps: S11. Use a weighing device to obtain the weighing data of relevant items, where the relevant items include logistics and warehousing items, industrial production items, agricultural product processing items, etc., to obtain initial weighing data, form an initial weighing data set, and use an improved density clustering algorithm to perform data division on the initial weighing data set to identify abnormal weighing data. The specific steps are as follows: S111. Randomly select an initial weighing data in the initial weighing data set, denoted as the core data point. Taking the core data point as the center, find the k initial weighing data closest to the core data point to form a core distance set , where represents the distance between the core data point and the k-th initial weighing data closest in distance; set the radius parameter and set the radius parameter to , a circular cluster is formed with the core data point as the center and the radius parameter as the radius. Other initial weighing data in the initial weighing data set are sequentially selected as core data points to obtain a number of initial circular clusters. Any cluster is selected from the several clusters and denoted as the marked cluster. Initial weighing data that is not within the range of the several clusters is searched for within the range of the marked cluster and denoted as unmarked weighing data, and neighborhood expansion is performed until there is no unmarked weighing data within the range of the marked cluster, obtaining an expanded cluster; S112. Set the b-th initial weighing data in the expanded cluster as , and the k initial weighing data closest to the initial weighing data are denoted as . Calculate the average distance of the initial weighing data in the expanded cluster. The calculation formula is as follows: ; Wherein, B represents the average distance of the initial weighing data in the expanded cluster, represents the distance between the initial weighing data and the initial weighing data , represents the expanded cluster; Calculate the average distance of other initial weighing data in the expanded cluster, and mark the initial weighing data whose average distance is much smaller than the radius parameter as an outlier, and the outlier is the abnormal weighing data; S12. Count all the abnormal weighing data in the initial weighing data set, form an abnormal weighing data set with the abnormal weighing data, and form a normal weighing data set with other initial weighing data in the initial weighing data set.
[0008] The present invention identifies abnormal weighing data in the initial weighing data set by using an improved density clustering algorithm, adaptively searches for a radius parameter, marks outliers according to the density, ensures the stability of the algorithm, overcomes the problem of poor clustering effect caused by different radius parameters in the traditional algorithm, and divides the initial weighing data set for subsequent processing.
[0009] Preferably, the S2 includes the following steps: S21. Obtain the weighing data set of previous years, select the normal weighing data in the weighing data set of previous years to obtain a weighing data sample set. After normalizing the weighing data sample set, divide the weighing data sample set into a sample training set and a sample test set, and input the sample training set into a BP (backpropagation) neural network; it is set that the BP neural network includes an input layer, a hidden layer, and an output layer. After the sample training set is input from the input layer, the weights and thresholds in the BP neural network are adjusted by calculating the result error. The error calculation formula is as follows: ; Among them, represents the error of the BP neural network, c represents the number of sample training sets, represents the i th actual input value, represents the i th predicted output value, ; S22. Take the error calculation formula as the fitness function, improve the particle swarm optimization algorithm to obtain an improved particle swarm optimization algorithm, and use the improved particle swarm optimization algorithm to optimize the weights and thresholds in the BP neural network to obtain the optimized weights and thresholds. The specific steps are as follows: S221. Assume that there is a particle swarm in the search space, the size of the particle swarm is N, and each particle in the particle swarm is used as a solution to the error calculation formula. As the particles in the particle swarm update their velocities and positions, the weights and thresholds in the BP neural network are iterated simultaneously. Assume that the initial velocity of the d th particle in the particle swarm is , and the initial position of the d th particle in the particle swarm is , and the initialization is completed; Assume that the velocity pause parameter is , represents the cognitive acceleration coefficient, represents the social acceleration coefficient, and represent random variables distributed in the range [0, 1], represents a random number and , the inertia weight is , and the velocity of the d th particle in the particle swarm at the e th iteration is denoted as . Update the velocity of the d th particle in the particle swarm at the e th iteration. The update strategy is as follows: When the random number is greater than the velocity pause parameter, the velocity d of the e +1th iteration of the th particle in the particle swarm; When the random number is less than or equal to the velocity pause parameter, the velocity d of the e +1th iteration of the th particle in the particle swarm, where represents the current best position, represents the current best particle; S222. Dynamically change the speed pause parameter, and set the speed pause parameter for the e th iteration to be . Use the speed pause parameter of the e th iteration to replace the inertia weight. The speed calculation formula for the d th particle in the particle swarm at the e +1th iteration is as follows: ; Among them, , and represent random variables distributed in the range [0, 1]; Set the position of the d th particle in the particle swarm at the e th iteration to be . According to the speed of the d th particle in the particle swarm at the e +1th iteration, update . The update formula is as follows: ; Among them, represents the position of the d th particle in the particle swarm at the e +1th iteration; At this time, compare the best fitness function values of the position of the d th particle in the particle swarm at the e th iteration and the position of the d th particle in the particle swarm at the e +1th iteration to obtain the current best fitness function value. The current best fitness function value corresponds to the current best weight and threshold; S223. Divide the particle swarm into a first particle swarm and a second particle swarm. Set to represent a random number and , and represent random variables distributed in the range [0, 1]. In the first particle swarm, use the speed pause parameter to update the particle speed. In the second particle swarm, rely on the current best particle for update. The update formula for the second particle swarm is as follows: ; Compare the fitness function values of the particles in the first particle swarm and the second particle swarm. Record the position corresponding to the current best fitness function value as the global optimal position. Set the maximum number of iterations. When the current number of iterations reaches the maximum number of iterations, stop the iteration to obtain the final position of the d th particle in the particle swarm. The final position coordinates correspond to the optimized weight and threshold respectively; S23. Use the optimized weights and thresholds in the BP neural network, and continuously iterate until the BP neural network converges to obtain a trained BP neural network. Then, input the sample test set into the trained BP neural network, set the maximum number of iterations, and stop the iteration when the training iteration number reaches the maximum number of iterations to obtain a BP neural network prediction model.
[0010] The invention trains a BP neural network and uses a particle swarm optimization algorithm to optimize the weights and thresholds in the BP neural network. By introducing a velocity pause parameter, the particle swarm optimization algorithm is improved. The improved algorithm solves the problems of slow convergence speed and easy entrapment in local optimal solutions of the traditional algorithm. Using the velocity pause parameter to replace the traditional velocity update mechanism greatly improves the optimization performance.
[0011] Preferably, the S3 includes the following steps: S31. Label the normal weighing data in the normal weighing data set, intercept every normal weighing data to obtain a number of normal weighing data segments, and convert the normal weighing data set into a normal weighing data segment set. Input the normal weighing data segments in the normal weighing data segment set into the BP neural network prediction model in sequence to output weighing prediction values. S32. Set the correction threshold as , select the next abnormal weighing data corresponding to the weighing prediction value in the abnormal weighing data set, denoted as the weighing data to be corrected. When the absolute value of the difference between the weighing data to be corrected and the weighing prediction value is greater than the correction threshold, correct the weighing data to be corrected to the weighing prediction value; otherwise, retain the weighing data to be corrected. For the missing weighing data in the abnormal weighing data set, use the weighing prediction value to fill in the missing weighing data. Until all the abnormal weighing data in the abnormal weighing data set are corrected and all the missing data in the abnormal weighing data set are filled, a processed weighing data set is obtained, and then combined with the normal weighing data set to obtain a processed weighing data set.
[0012] Preferably, the S4 includes the following steps: S41. Select any processed weighing data in the processed weighing data set to form a weighing data string , where represents the jth weighing data. Divide the weighing data in the weighing data string into groups of 3 digits each. If there are less than 3 digits, form a separate group, and convert the weighing data string into a weighing data group string , convert the weighing data groups in the weighing data group string into binary to obtain the first binary code, and convert the number of weighing data in the weighing data string into binary, denoted as the second binary code; set the digital coding indicator as 0001, and add the digital coding indicator and the second binary code to the front of the first binary code in sequence to form a new binary code; S42. Add the end symbol 0000 to the end of the new binary code. When the new binary code is not a multiple of 8, continue to add 0 until the new binary code is a multiple of 8, and group it by 8 bits to obtain the padded binary code. Perform error correction coding and masking processing on the padded binary code to obtain the final weighing data QR code. The specific steps are as follows: S421. Set each group of the padded binary code to belong to a finite field. Generate an error correction polynomial according to the group distance and the binary code. Divide the padded binary code by the error correction polynomial to obtain the remainder. The remainder is the error correction codeword. Denote the highest-degree coefficient of the remainder as the first error correction codeword, and the lowest-degree coefficient of the remainder as the last error correction codeword. Add the complements of the error correction codewords to the error positions of the padded binary code in sequence to obtain the final code; S422. Set a blank QR code. Fill the final code into the blank QR code starting from the lower right corner upwards in sequence. After reaching the upper left corner of the blank QR code, start filling downwards from the blank area to the right of the upper left corner of the blank QR code, and avoid the non-filling areas of the blank QR code until the final code is arranged completely to obtain the initial weighing data QR code; perform exclusive OR processing on the initial weighing data QR code to generate several mask images. Set weights for the recognition error features of the several mask images, and then score them. Use the mask image with the lowest score as the final mask result. Use the final mask result as the mask of the initial weighing data QR code to obtain the final weighing data QR code, realizing the intelligent processing of weighing data; S43. Set the three-color channel components and weighting coefficients of the final weighing data QR code. Grayscale the final weighing data QR code to obtain a grayscale weighing data QR code image; draw the grayscale curve graph of the grayscale weighing data QR code image. The minimum value of the intersection points of the grayscale curves in the grayscale curve graph is the grayscale threshold. When the grayscale value of the pixel point in the grayscale weighing data QR code image is less than the grayscale threshold, set the corresponding pixel point grayscale value to 0, otherwise set the corresponding pixel point grayscale value to 255 to obtain a binarized weighing data QR code image; set an affine matrix, use the affine matrix to correct the binarized weighing data QR code image, and then remove the mask on the binarized weighing data QR code image to output the final code, realizing the recognition and reading of the final weighing data QR code.
[0013] The invention performs data encoding, error correction encoding, and masking processing by using the processed weighing data set. Among them, the error correction encoding facilitates the identification of incomplete two-dimensional codes, and the masking processing reduces the identification difficulty, realizing the efficient association between the weighing data and the two-dimensional code, improving the applicability of the two-dimensional code, and facilitating data traceability and management.
[0014] This embodiment also discloses a system for an intelligent processing method of weighing data based on two-dimensional codes, specifically including: a weighing data anomaly identification module, a neural network parameter optimization module, a data correction and filling module, and a weighing data two-dimensional code conversion module; The weighing data anomaly identification module is used to identify abnormal weighing data in the initial weighing data set by using an improved density clustering algorithm; The neural network parameter optimization module is used to optimize the weights and thresholds in the BP neural network by using an improved particle swarm optimization algorithm; The data correction and filling module is used to correct abnormal data and fill missing data by using the neural network prediction value; The weighing data two-dimensional code conversion module is used to perform data encoding based on the weighing data, obtain a two-dimensional code, and realize identification and reading.
[0015] The present invention has the following beneficial effects: 1. The invention identifies abnormal weighing data in the initial weighing data set by using an improved density clustering algorithm. By adaptively searching for the radius parameter and marking abnormal points according to the density, the stability of the algorithm is ensured, overcoming the problem of poor clustering effect caused by different radius parameters in the traditional algorithm, and segmenting the initial weighing data set is convenient for subsequent processing.
[0016] 2. The invention trains the BP neural network and uses the particle swarm optimization algorithm to optimize the weights and thresholds in the BP neural network. By introducing a velocity pause parameter to improve the particle swarm optimization algorithm, the improved algorithm solves the problems of slow convergence speed and easy entrapment in local optimal solutions in the traditional algorithm, and uses the velocity pause parameter to replace the traditional velocity update mechanism, greatly increasing the optimization performance.
[0017] 3. The invention performs data encoding, error correction encoding, and masking processing by using the processed weighing data set. Among them, the error correction encoding facilitates the identification of incomplete two-dimensional codes, and the masking processing reduces the identification difficulty, realizing the efficient association between the weighing data and the two-dimensional code, improving the applicability of the two-dimensional code, and facilitating data traceability and management.
[0018] Of course, it is not necessary for any product implementing the present invention to simultaneously achieve all the above-mentioned advantages. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] To more clearly illustrate the technical solutions of the embodiments of the invention, the following will briefly introduce the accompanying drawings required for the description of the embodiments. Obviously, the accompanying drawings in the following description are only some embodiments of the invention. For those of ordinary skill in the art, without creative efforts, additional drawings can be obtained based on these drawings.
[0020] Figure 1 This is a schematic flowchart of the intelligent processing of weighing data by an intelligent weighing data processing system based on two-dimensional codes provided by the present invention. Specific embodiments
[0021] The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, rather than all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of protection of the present invention.
[0022] In the description of the present invention, it should be understood that terms such as "aperture", "upper", "lower", "top", "middle", "inner", etc. indicating orientation or positional relationships are only for the convenience of describing the invention and simplifying the description, rather than indicating or implying that the components or elements referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be construed as limiting the invention.
[0023] Embodiment 1 Please refer to Figure 1 , this embodiment discloses an intelligent processing method for weighing data based on two-dimensional codes, specifically including the following content: S1. Obtain relevant item weighing data, form an initial weighing data set, and use an improved density clustering algorithm to identify abnormal weighing data in the initial weighing data set, obtaining an abnormal weighing data set and a normal weighing data set; The S1 includes the following steps: S11. Use a weighing device to obtain relevant item weighing data. The relevant items include logistics and warehousing items, industrial production items, agricultural product processing items, etc., to obtain initial weighing data, form an initial weighing data set, and use an improved density clustering algorithm to perform data partitioning on the initial weighing data set to identify abnormal weighing data. The specific steps are as follows: S111. Randomly select initial weighing data in the initial weighing data set, denoted as the core data point. Taking the core data point as the center, find the k initial weighing data closest to the core data point to form a core distance set , where Represents the distance between the core data point and the k-th initial weighing data closest in distance; set a radius parameter and set the radius parameter to , form an initial circular cluster with the core data point as the center and the radius parameter as the radius. Sequentially select other initial weighing data in the initial weighing data set as core data points to obtain several initial circular clusters; select any cluster from the several clusters, denote it as the marked cluster, search for initial weighing data that is not within the range of the several clusters within the range of the marked cluster, denote it as unmarked weighing data, and perform neighborhood expansion until there is no unmarked weighing data within the range of the marked cluster to obtain an expanded cluster; S112. Set the b-th initial weighing data in the expanded cluster as , the k initial weighing data closest in distance to the initial weighing data are denoted as , calculate the average distance of the initial weighing data in the expanded cluster. The calculation formula is as follows: ; Among them, B represents the average distance of the initial weighing data in the expanded cluster, represents the distance between the initial weighing data and the initial weighing data , represents the expanded cluster; Calculate the average distance of other initial weighing data in the expanded cluster, and denote the initial weighing data whose average distance is much smaller than the radius parameter as an outlier, and the outlier is the abnormal weighing data; S12. Statistically count all abnormal weighing data in the initial weighing data set, form an abnormal weighing data set with the abnormal weighing data, and form a normal weighing data set with other initial weighing data in the initial weighing data set; S2. Train a BP neural network. By introducing a speed pause parameter, improve the particle swarm optimization algorithm to obtain an improved particle swarm optimization algorithm. Use the improved particle swarm optimization algorithm to optimize the weights and thresholds in the BP neural network to obtain a BP neural network prediction model; The S2 includes the following steps: S21. Obtain a set of weighing data from previous years, select the normal weighing data in the set of weighing data from previous years to obtain a set of weighing data samples. After normalizing the set of weighing data samples, divide the set of weighing data samples into a sample training set and a sample test set, and input the sample training set into the BP neural network; set that the BP neural network includes an input layer, a hidden layer, and an output layer. After the sample training set is input from the input layer, adjust the weights and thresholds in the BP neural network by calculating the result error. The error calculation formula is as follows: ; Among them, represents the error of the BP neural network, c represents the number of sample training sets, represents the i th actual input value, represents the i th predicted output value, ; S22. Take the error calculation formula as the fitness function, improve the particle swarm optimization algorithm, obtain the improved particle swarm optimization algorithm, and use the improved particle swarm optimization algorithm to optimize the weights and thresholds in the BP neural network to obtain the optimized weights and thresholds. The specific steps are as follows: S221. Assume that there is a particle swarm in the search space, the size of the particle swarm is N, and each particle in the particle swarm is used as a solution to the error calculation formula. As the particle update speed and position in the particle swarm, the weights and thresholds in the BP neural network are iterated simultaneously; assume that the initial speed of the d rd particle in the particle swarm is , and the initial position of the d th particle in the particle swarm is , and the initialization is completed; Set the speed pause parameter as , represents the cognitive acceleration coefficient, represents the social acceleration coefficient, and represent random variables distributed in the range [0, 1], represents a random number and , the inertia weight is , and the d th particle in the particle swarm at the e th iteration speed is denoted as . Update the d th particle in the particle swarm at the e th iteration speed, and the update strategy is as follows: When the random number is greater than the speed pause parameter, the d th particle in the particle swarm at the e +1th iteration speed ; When the random number is less than or equal to the speed pause parameter, the d th particle in the particle swarm at the e +1th iteration speed , where represents the current best position, represents the current best particle; S222. Dynamically change the velocity pause parameter, and set the velocity pause parameter for the e th iteration to be . Use the velocity pause parameter of the e th iteration to replace the inertia weight. The velocity calculation formula for the d th particle in the particle swarm at the e +1th iteration is as follows: ; Among them, , and represent random variables distributed in the range [0, 1]; Set the position of the d th particle in the particle swarm at the e th iteration to be . According to the velocity of the d th particle in the particle swarm at the e +1th iteration, update . The update formula is as follows: ; Among them, represents the position of the d th particle in the particle swarm at the e +1th iteration; At this time, compare the best fitness function values of the position of the d th particle in the particle swarm at the e th iteration and the position of the d th particle in the particle swarm at the e +1th iteration to obtain the current best fitness function value. The current best fitness function value corresponds to the current best weight and threshold; S223. Divide the particle swarm into a first particle swarm and a second particle swarm. Set to represent a random number and , and represent random variables distributed in the range [0, 1]. In the first particle swarm, use the velocity pause parameter to update the particle velocity. In the second particle swarm, rely on the current best particle for update. The update formula for the second particle swarm is as follows: ; Compare the fitness function values of the particles in the first particle swarm and the second particle swarm. Record the position corresponding to the current best fitness function value as the global optimal position. Set the maximum number of iterations. When the current number of iterations reaches the maximum number of iterations, stop the iteration to obtain the final position of the d th particle in the particle swarm. The final position coordinates correspond to the optimized weight and threshold respectively; S23. Use the optimized weights and thresholds in the BP neural network, and continuously iterate until the BP neural network converges to obtain a trained BP neural network. Then, input the sample test set into the trained BP neural network, set the maximum number of iterations, and stop the iteration when the training iteration number reaches the maximum number of iterations to obtain a BP neural network prediction model. S3. According to the normal weighing data set, use the prediction value of the BP neural network prediction model to verify the abnormal weighing data set, perform abnormal data correction and missing data filling to obtain a processed weighing data set. The S3 includes the following steps: S31. Label the normal weighing data in the normal weighing data set, intercept every normal weighing data to obtain several normal weighing data segments, and convert the normal weighing data set into a normal weighing data segment set. Input the normal weighing data segments in the normal weighing data segment set into the BP neural network prediction model in sequence to output weighing prediction values. S32. Set the correction threshold to , select the next abnormal weighing data corresponding to the weighing prediction value in the abnormal weighing data set, denoted as the weighing data to be corrected. When the absolute value of the difference between the weighing data to be corrected and the weighing prediction value is greater than the correction threshold, correct the weighing data to be corrected to the weighing prediction value; otherwise, retain the weighing data to be corrected. For the missing weighing data in the abnormal weighing data set, use the weighing prediction value to fill the missing weighing data. Until all the abnormal weighing data in the abnormal weighing data set are corrected and all the missing data in the abnormal weighing data set are filled, a processed weighing data set is obtained, and then combined with the normal weighing data set to obtain a processed weighing data set. S4. After encoding the processed weighing data set, a new binary code is obtained. Perform error correction coding and masking processing on the new binary code to obtain a final weighing data QR code and realize identification and reading to complete the intelligent processing of weighing data. The S4 includes the following steps: S41. Select any processed weighing data in the processed weighing data set to form a weighing data string , where represents the j-th weighing data. Divide the weighing data in the weighing data string into groups of 3 bits each. If there are less than 3 bits, form a separate group, and convert the weighing data string into a weighing data group string , convert the weighing data groups in the weighing data group string to binary to obtain the first binary code, and convert the number of weighing data in the weighing data string to binary, denoted as the second binary code; set the digital coding indicator to 0001, and add the digital coding indicator and the second binary code to the front of the first binary code in sequence to form a new binary code; S42. Add the end symbol 0000 to the end of the new binary code. When the new binary code is not a multiple of 8, continue to add 0 until the new binary code is a multiple of 8, and group it by 8 bits to obtain the padded binary code. Perform error correction coding and masking processing on the padded binary code to obtain the final weighing data QR code. The specific steps are as follows: S421. Set each group of the padded binary code to belong to a finite field. Generate an error correction polynomial according to the group distance and the binary code. Divide the padded binary code by the error correction polynomial to obtain the remainder. The remainder is the error correction codeword. Denote the highest-degree coefficient of the remainder as the first error correction codeword, and the lowest-degree coefficient of the remainder as the last error correction codeword. Add the complement of the error correction codeword to the error position of the padded binary code in sequence to obtain the final code; S422. Set a blank QR code. Fill the final code into the blank QR code starting from the lower right corner upwards in sequence. After reaching the upper left corner of the blank QR code, start filling downwards from the blank area on the right side of the upper left corner of the blank QR code, and avoid the non-filling area of the blank QR code until the final code is arranged completely to obtain the initial weighing data QR code; perform exclusive OR processing on the initial weighing data QR code to generate several masking images. Set weights for the recognition error features of the several masking images, and then score them. Use the masking image with the lowest score as the final masking result. Use the final masking result as the mask of the initial weighing data QR code to obtain the final weighing data QR code, realizing the intelligent processing of weighing data; S43. Set the three-color channel components and weighting coefficients of the final weighing data QR code. Grayscale the final weighing data QR code to obtain a grayscale weighing data QR code image; draw the grayscale curve graph of the grayscale weighing data QR code image. The minimum value of the intersection points of the grayscale curves in the grayscale curve graph is the grayscale threshold. When the grayscale value of the pixel point in the grayscale weighing data QR code image is less than the grayscale threshold, set the grayscale value of the corresponding pixel point to 0, otherwise set the grayscale value of the corresponding pixel point to 255 to obtain a binarized weighing data QR code image; set an affine matrix, use the affine matrix to correct the binarized weighing data QR code image, and then remove the mask on the binarized weighing data QR code image to output the final code, realizing the recognition and reading of the final weighing data QR code.
[0024] Example 2 This embodiment also discloses a system for an intelligent processing method of weighing data based on two-dimensional codes, specifically including: a weighing data anomaly recognition module, a neural network parameter optimization module, a data correction and filling module, and a weighing data two-dimensional code generation module; The weighing data anomaly recognition module is used to identify abnormal weighing data in the initial weighing data set by using an improved density clustering algorithm; The neural network parameter optimization module is used to optimize the weights and thresholds in the BP neural network by using an improved particle swarm optimization algorithm; The data correction and filling module is used to correct abnormal data and fill in missing data by using the neural network prediction value; The weighing data two-dimensional code generation module is used to perform data encoding based on the weighing data, obtain a two-dimensional code and realize identification and reading.
[0025] In the description of this specification, the descriptions referring to terms such as "one embodiment", "example", "specific example", etc. mean that the specific features, structures, materials or characteristics described in connection with the embodiment or example are included in at least one embodiment or example of the invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in a suitable manner in any one or more embodiments or examples.
[0026] The preferred embodiments of the invention disclosed above are only used to help explain the invention. The preferred embodiments do not elaborate on all details and do not limit the invention to the specific embodiments described. Obviously, many modifications and variations can be made according to the content of this specification. These embodiments are selected and specifically described in this specification to better explain the principle and practical application of the invention, so that those skilled in the art in the relevant technical field can well understand and utilize the invention.
Claims
1. An intelligent processing method for weighing data based on two-dimensional codes, characterized in that, It includes the following steps: S1. Obtain the weighing data of relevant items to form an initial weighing data set, and use an improved density clustering algorithm to identify abnormal weighing data in the initial weighing data set, obtaining an abnormal weighing data set and a normal weighing data set; The S1 includes the following steps: S11. Use a weighing device to obtain the weighing data of relevant items. The relevant items include logistics and warehousing items, industrial production items, agricultural product processing items, etc., to obtain initial weighing data, form an initial weighing data set, and use an improved density clustering algorithm to perform data partitioning on the initial weighing data set to identify abnormal weighing data. The specific steps are as follows: S111. Randomly select initial weighing data from the initial weighing data set, denoted as the core data point. Centered on the core data point, find the k initial weighing data closest to the core data point to form a core distance set. , where represents the distance between the core data point and the k-th initial weighing data closest in distance; set a radius parameter and set the radius parameter to . With the core data point as the center and the radius parameter as the radius, form an initial circular cluster. Sequentially select other initial weighing data in the initial weighing data set as core data points to obtain several initial circular clusters; select any cluster from the several clusters, denoted as the marked cluster. Search for initial weighing data not within the several clusters within the range of the marked cluster, denoted as unmarked weighing data, and perform neighborhood expansion until there is no unmarked weighing data within the range of the marked cluster to obtain an expanded cluster. S112. Set the b-th initial weighing data in the extended cluster as , and the k initial weighing data closest to the initial weighing data are denoted as . Calculate the average distance of the initial weighing data in the extended cluster. The calculation formula is as follows: ; Among them, B represents the average distance of the initial weighing data in the expansion cluster ; represents the initial weighing data and the initial weighing data distance; represents the expansion cluster; Calculate the average distance of other initial weighing data in the expanded cluster, and record the initial weighing data with an average distance much smaller than the radius parameter as an outlier, and the outlier is the abnormal weighing data; S12. Count all the abnormal weighing data in the initial weighing data set, form an abnormal weighing data set with the abnormal weighing data, and form a normal weighing data set with the other initial weighing data in the initial weighing data set; S2. Train a BP neural network, and use an optimization algorithm to optimize the weights and thresholds in the BP neural network to obtain a BP neural network prediction model; S3. According to the normal weighing data set, use the BP neural network prediction model to verify the abnormal weighing data set, and perform abnormal data correction and missing data filling to obtain a processed weighing data set; S4. After encoding the processed weighing data set, obtain a new binary code, perform error correction coding and masking processing on the new binary code to obtain a final weighing data QR code, and realize identification and reading to complete the intelligent processing of weighing data.
2. The intelligent processing method for weighing data based on a two-dimensional code according to claim 1, wherein The S1 includes the following steps: S11. Use a weighing device to obtain the weighing data of relevant items to obtain initial weighing data, form an initial weighing data set, and use an improved density clustering algorithm to perform data partitioning on the initial weighing data set to identify abnormal weighing data; S12. According to the abnormal weighing data, divide the initial weighing data set into an abnormal weighing data set and a normal weighing data set.
3. The intelligent processing method for weighing data based on two-dimensional code according to claim 2, wherein, The S11 includes the following steps: S111. Select a core data point in the initial weighing data set. With the core data point as the center, use the nearest distance between the core data point and the initial weighing data as the radius parameter to form an initial circular cluster, and perform neighborhood expansion to obtain an expanded cluster; S112. Calculate the average distance of the initial weighing data in the expanded cluster, and record the initial weighing data with an average distance much smaller than the radius parameter as an outlier, and the outlier is the abnormal weighing data.
4. The intelligent processing method for weighing data based on two-dimensional code according to claim 3, characterized in that The S2 includes the following steps: S21. Obtain the set of weighing data for previous years, select the normal weighing data from the set of weighing data for previous years to obtain a set of weighing data samples. After normalizing the set of weighing data samples, divide the set of weighing data samples into a sample training set and a sample test set, and input the sample training set into the BP neural network. Adjust the weights and thresholds in the BP neural network by calculating the result error. The error calculation formula is as follows: ; Among them, represents the error of the BP neural network, c represents the number of sample training sets, represents the i th actual input value, represents the i th predicted output value, ; S22. Use the error calculation formula as the fitness function, improve the particle swarm optimization algorithm to obtain an improved particle swarm optimization algorithm, and use the improved particle swarm optimization algorithm to optimize the weights and thresholds in the BP neural network to obtain the optimized weights and thresholds; S23. Use the optimized weights and thresholds in the BP neural network and iterate continuously until the BP neural network converges to obtain a trained BP neural network; then input the sample test set into the trained BP neural network, set the maximum number of iterations, and stop iterating when the training iteration number reaches the maximum number of iterations to obtain a BP neural network prediction model.
5. The intelligent processing method for weighing data based on two-dimensional code according to claim 4, characterized in that The optimization of the weights and thresholds in the BP neural network using the improved particle swarm optimization algorithm includes the following steps: S221. Set that there is a particle swarm in the search space, the size of the particle swarm is N, and each particle in the particle swarm is used as a solution of the error calculation formula. As the particles in the particle swarm update their velocities and positions, the weights and thresholds in the BP neural network are iterated simultaneously. Set the initial velocity of the d -th particle in the particle swarm to be , and the initial position of the d -th particle in the particle swarm to be , and the initialization is completed. Set the speed pause parameter to , represents the cognitive acceleration coefficient, represents the social acceleration coefficient, and represents a random variable distributed in the range [0, 1], represents a random number and , the inertia weight is , the speed of the d -th particle in the particle swarm at the e -th iteration is denoted as , update the speed of the d -th particle in the particle swarm at the e -th iteration, and the update strategy is as follows: When the random number is greater than the velocity pause parameter, the d -th particle in the particle swarm at the e +1-th iteration velocity ; When the random number is less than or equal to the velocity pause parameter, the d -th particle in the particle swarm at the e +1-th iteration velocity , where represents the current best position, and represents the current best particle; S222. Dynamically change the speed pause parameter, and set the speed pause parameter for the e th iteration to be . Use the speed pause parameter of the e th iteration to replace the inertia weight. The speed calculation formula for the d th particle in the particle swarm at the e +1th iteration is as follows: ; Among them, , and represent random variables distributed within the range [0, 1]; Set the position of the d -th particle in the particle swarm at the e -th iteration as . According to the velocity of the d -th particle in the particle swarm at the e +1-th iteration, update as follows: The update formula is as follows: ; Among them, represents the position of the d -th particle in the particle swarm at the e +1-th iteration; At this time, compare the position of the d -th particle in the particle swarm at the e -th iteration with the position of the d -th particle in the particle swarm at the e -th + 1 iteration to obtain the current best fitness function value. The current best fitness function value corresponds to the current best weight and threshold; S223. Divide the particle swarm into a first particle swarm and a second particle swarm, and set represents a random number and , and represent random variables distributed in the range [0, 1]. In the first particle swarm, update the particle velocity using the velocity pause parameter. In the second particle swarm, update it relying on the current best particle. The update formula for the second particle swarm is as follows: ; Compare the fitness function values of the particles in the first particle swarm and the second particle swarm, record the position corresponding to the current best fitness function value as the global optimal position, set the maximum number of iterations, and when the current number of iterations reaches the maximum number of iterations, stop the iteration to obtain the final position of the d th particle in the particle swarm. The final position coordinates correspond to the optimized weights and thresholds respectively.
6. The intelligent processing method for weighing data based on two-dimensional code according to claim 5, characterized in that The S3 includes the following steps: S31. Label the normal weighing data in the set of normal weighing data, intercept to obtain several normal weighing data segments, and convert the set of normal weighing data into a set of normal weighing data segments; input the set of normal weighing data segments into the BP neural network prediction model in sequence to output weighing prediction values; S32. Set a correction threshold, use the weighing prediction values to verify the set of abnormal weighing data, compare with the correction threshold, and perform abnormal data correction and missing data filling to obtain a processed set of weighing data.
7. A method for intelligent processing of weighing data based on two-dimensional code according to claim 6, characterized in that, The S4 includes the following steps: S41. Encode the processed set of weighing data to form a new binary code; S42. Add an end symbol and a padding code to the new binary code to obtain a padded binary code. Perform error correction coding and masking processing on the padded binary code to obtain a final weighing data QR code; S43. Perform grayscale and binarization processing on the final weighing data QR code, and then remove the mask on the binarized weighing data QR code image to output the final code, realizing the recognition and reading of the final weighing data QR code.
8. A method for intelligent processing of weighing data based on two-dimensional code according to claim 7, characterized in that, The S42 includes the following steps: S421. Generate an error correction polynomial according to the padded binary code, and use the error correction polynomial for coding error correction to obtain the final code; S422. Set a blank QR code, fill the final code on the blank QR code in sequence to obtain an initial weighing data QR code; perform exclusive OR processing on the initial weighing data QR code to generate several mask images, set weights for the recognition error features of the several mask images, then score, and use the mask image with the lowest score as the final mask result. Use the final mask result as the mask of the initial weighing data QR code to obtain the final weighing data QR code.
9. A system for implementing the intelligent processing method of weighing data based on two-dimensional code as described in any one of claims 1-8, characterized in that Specifically include: Weighing data anomaly identification module, neural network parameter optimization module, data correction and filling module, and weighing data QR code generation module; The weighing data anomaly identification module is used to identify abnormal weighing data in the initial weighing data set using an improved density clustering algorithm; The neural network parameter optimization module is used to optimize the weights and thresholds in the BP neural network using an improved particle swarm optimization algorithm; The data correction and filling module is used to correct abnormal data and fill in missing data using the neural network prediction values; The weighing data QR code generation module is used to perform data encoding based on the weighing data, obtain a QR code, and realize identification and reading.
Citation Information
Patent Citations
Petrochemical device data display method and system based on two-dimensional code
CN112948652A
Electric energy metering abnormal data identification and compensation method based on parameter optimization
CN114528949A
Milling force prediction method based on improved whale algorithm optimized BP neural network
CN117669084A
Binocular camera calibration method, system and device and medium
CN117671029A
Bridge monitoring data inspection method and system based on PSO-BP neural network
CN117708553A