An intelligent processing system and method for weighing data based on two-dimensional codes

Through improved density clustering and BP neural network optimization algorithm processing weighing data, efficient QR code is generated, which solves the problems of noise impact and low correlation efficiency in weighing data processing, and realizes intelligent data management.

CN120217022BActive Publication Date: 2025-08-05SHANGHAI LYUZE BIOLOGICAL SCI & TECH
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202510695678.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-05-28
Publication Date
2025-08-05
Estimated Expiration
2045-05-28

AI Technical Summary

Technical Problem

The weighing data processing method in the prior art does not preprocess the data, resulting in noise affecting the accuracy of the result, and the correlation efficiency of the weighing data and the QR code is low, affecting management traceability.

Method used

The improved density clustering algorithm is used to identify abnormal weighing data, train the BP neural network and optimize the weight and threshold, and use the particle swarm optimization algorithm to improve the algorithm's convergence speed, and generate QR codes through data encoding and error correction encoding.

Benefits of technology

It improves the accuracy of weighing data processing and the recognition efficiency of QR codes, reduces the difficulty of identification, and realizes the efficient correlation between weighing data and QR codes, making it easier to trace and manage data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120217022B_ABST
    Figure CN120217022B_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of data processing, and discloses an intelligent processing system and method for weighing data based on two-dimensional codes. First, the present invention 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; secondly, based on an improved particle swarm optimization algorithm, the weights and thresholds in the BP neural network are optimized to obtain a BP neural network prediction model; then, according to the normal weighing data set and the BP neural network prediction model, the abnormal weighing data set is verified, and abnormal data is corrected and missing data is filled to obtain a processed weighing data set; finally, data encoding, error correction encoding and masking processing are performed on the processed weighing data set to generate a final weighing data two-dimensional code. By analyzing and processing the weighing data, the present invention achieves the purpose of intelligent processing of weighing data, and the method is objective and accurate.
Need to check novelty before this filing date? Find Prior Art

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 Technique

[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 the weighing data into two-dimensional codes, there is no efficient association between the weighing data and the two-dimensional codes, 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 existing related technologies.

[0005] To solve the above technical problems, the present invention is realized through the following technical solutions:

[0006] The present invention provides an intelligent processing method for weighing data based on two-dimensional codes, including the following steps:

[0007] 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;

[0008] S2. Train the BP neural network, improve the particle swarm optimization algorithm by introducing a speed pause parameter, 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;

[0009] 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;

[0010] 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.

[0011] The invention identifies abnormal weighing data in the initial weighing data set by using an improved density clustering algorithm after obtaining 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, train the BP neural network, and use the particle swarm optimization algorithm to optimize the weights and thresholds in the BP neural network. By introducing a speed pause parameter, the particle swarm optimization algorithm is improved. The improved algorithm improves the problems of slow convergence speed and easy to fall into local optimal solutions in traditional algorithms. Using the speed pause parameter to replace the traditional speed 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 missing data to obtain a processed weighing data set; finally, perform data encoding, error correction coding and masking processing on the processed weighing data set, realizing the efficient association between weighing data and QR codes. Error correction coding is convenient for the identification of incomplete QR codes, and masking processing reduces the recognition difficulty, improves the applicability of QR codes, and is convenient for data traceability and management.

[0012] Preferably, the S1 includes the following steps:

[0013] 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., obtain the 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:

[0014] S111. Randomly select initial weighing data from the initial weighing data set, denote it as the core data point. Taking the core data point as the center, find the k initial weighing data with the closest distance to the core data point to form the core distance set , where represents the distance between the core data point and the k-th initial weighing data with the closest distance; set the radius parameter and set the radius parameter to . Taking the core data point as the center and the radius parameter as the radius to form an initial circular cluster. Sequentially select other initial weighing data in the initial weighing data set as the core data point to obtain several initial circular clusters; select any cluster from the several clusters, denote it as the marked cluster, find the initial weighing data that is not within the range of the several clusters within the range of the marked cluster, denote it as the unmarked weighing data, and perform neighborhood expansion until there is no unmarked weighing data within the range of the marked cluster to obtain the expanded cluster

[0015] S112. Set the b-th initial weighing data in the expanded cluster as , and denote the k initial weighing data with the closest distance to the initial weighing data as . Calculate the average distance of the initial weighing data in the expanded cluster. The calculation formula is as follows

[0016] ;

[0017] where 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

[0018] Calculate the average distance of other initial weighing data in the expanded cluster, and denote the initial weighing data with an average distance much smaller than the radius parameter as the outlier, and the outlier is the abnormal weighing data

[0019] S12. Count all the abnormal weighing data in the initial weighing data set, form the abnormal weighing data set with the abnormal weighing data, and form the normal weighing data set with other initial weighing data in the initial weighing data set

[0020] The invention identifies abnormal weighing data in the initial weighing data set by using an improved density clustering algorithm, adaptively finds the 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

[0021] Preferably, the S2 includes the following steps:

[0022] S21. Obtain the set of weighing data from previous years, select the normal weighing data from 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 a BP (backpropagation) 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:

[0023] ;

[0024] Where, 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, ;

[0025] S22. Use the error calculation formula as the fitness function, and obtain an improved particle swarm optimization algorithm by improving the particle swarm optimization algorithm. Use the improved particle swarm optimization algorithm to optimize the weights and thresholds in the BP neural network to obtain optimized weights and thresholds. The specific steps are as follows:

[0026] 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 to the error calculation formula. As the particles in the particle swarm update their speeds and positions, simultaneously iterate the weights and thresholds in the BP neural network; set the initial speed 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 complete the initialization;

[0027] Set the speed pause parameter to be , 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 speed of the d th particle in the particle swarm at the e th iteration is denoted as For thed The velocity of the e th particle in the

[0028] th iteration is updated, and the update strategy is as follows: When the random number d is greater than the velocity pause parameter, the velocity of the e th particle in the particle swarm at the

[0029] +1th iteration is ; d When the random number e is less than or equal to the velocity pause parameter, the velocity of the th particle in the particle swarm at the +1th iteration is

[0030] , where e represents the current best position, and represents the current best particle; e d e

[0031] S222. Dynamically change the velocity pause parameter, and set the velocity pause parameter at the th iteration to . Replace the inertia weight with the velocity pause parameter at the

[0032] th iteration. The velocity calculation formula for the th particle in the particle swarm at the

[0033] d +1th iteration is as follows: e d e

[0034]

[0035] d e

[0036] ;

[0035] where represents the position of the d th particle in the e [[ID=8e3]]

[0036] d particle swarm at the e d +1th iteration; <000014e]]

[0036] d e d e At this time, compare the position of the d th particle in the e particle swarm at the d e th iteration with the position of the d e d eThe optimal fitness function value at the +1st iteration position is obtained to get the current optimal fitness function value, and the current optimal fitness function value corresponds to the current optimal weight and threshold;

[0037] 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 within [0, 1]. In the first particle swarm, the particle velocity is updated using the velocity pause parameter. In the second particle swarm, the update relies on the current best particle. The update formula for the second particle swarm is as follows:

[0038] ;

[0039] Compare the fitness function values of the particles in the first particle swarm and the second particle swarm. Denote the position corresponding to the current optimal fitness function value as the global optimal position. Set the maximum number of iterations. When the current iteration number 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 respectively correspond to the optimized weight and threshold;

[0040] S23. Use the optimized weight and threshold 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. When the training iteration number reaches the maximum number of iterations, stop the iteration to obtain the BP neural network prediction model.

[0041] This invention trains a BP neural network and uses the particle swarm optimization algorithm to optimize the weights and thresholds in the BP neural network. By introducing the 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.

[0042] Preferably, the S3 includes the following steps:

[0043] 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 the weighing prediction value;

[0044] S32. Set the correction threshold to , select the next abnormal weighing data corresponding to the weighing prediction value in the set of abnormal weighing data, 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 set of abnormal weighing data, use the weighing prediction value to fill in the missing weighing data. Until all the abnormal weighing data in the set of abnormal weighing data are corrected and all the missing data in the set of abnormal weighing data are filled in, a processed set of weighing data is obtained. Then, combined with the set of normal weighing data, a well-processed set of weighing data is obtained.

[0045] Preferably, S4 includes the following steps:

[0046] S41. Select any well-processed weighing data in the well-processed set of weighing data 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. 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;

[0047] 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:

[0048] 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 a remainder. The remainder is the error correction codeword. Denote the highest-order coefficient of the remainder as the first error correction codeword, and the lowest-order 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;

[0049] S422. Set a blank QR code, and fill the final code sequentially from the lower right corner of the blank QR code upwards. After reaching the upper left corner of the blank QR code, start filling sequentially 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, obtaining 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 them, 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 a final weighing data QR code, realizing the intelligent processing of weighing data;

[0050] 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 a grayscale curve graph of the grayscale weighing data QR code image. The minimum value of the intersection of the grayscale curves in the grayscale curve graph is the grayscale threshold. When the grayscale value of a 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, obtaining a binary weighing data QR code image; set an affine matrix, use the affine matrix to correct the binary weighing data QR code image, and then remove the mask on the binary weighing data QR code image to output the final code, realizing the recognition and reading of the final weighing data QR code.

[0051] Through the use of the processed weighing data set for data encoding, error correction encoding, and mask processing, the error correction encoding in this invention facilitates the recognition of incomplete QR codes, and the mask processing reduces the recognition difficulty, realizing the efficient association of weighing data and QR codes, improving the applicability of QR codes, and facilitating data traceability and management.

[0052] This embodiment also discloses a system for an intelligent processing method of weighing data based on QR 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 QR code conversion module;

[0053] 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;

[0054] 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;

[0055] The data correction and filling module is used to correct abnormal data and fill missing data by using the neural network prediction value;

[0056] The weighing data QR code generation module is used to perform data encoding based on the weighing data, generate a QR code, and enable recognition and reading.

[0057] The present invention has the following beneficial effects:

[0058] 1. The invention uses an improved density clustering algorithm to identify abnormal weighing data in the initial weighing data set. 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 traditional algorithms, and dividing the initial weighing data set is convenient for subsequent processing.

[0059] 2. 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 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 traditional algorithms. Using the velocity pause parameter to replace the traditional velocity update mechanism greatly improves the optimization performance.

[0060] 3. The invention performs data encoding, error correction encoding, and masking processing on the processed weighing data set. The error correction encoding facilitates the recognition of incomplete QR codes, and the masking processing reduces the recognition difficulty, realizing the efficient association between the weighing data and the QR code, improving the applicability of the QR code, and facilitating data traceability and management.

[0061] Of course, not necessarily all the advantages described above need to be achieved simultaneously when implementing any product of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0062] In order to more clearly illustrate the technical solutions of the embodiments of the invention, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the drawings in the following description are only some embodiments of the invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.

[0063] Figure 1 It is a schematic flowchart of the intelligent processing of weighing data for an intelligent weighing data processing system based on QR codes provided by the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0064] The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the 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.

[0065] In the description of the present invention, it should be understood that the terms "opening", "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 thus should not be construed as a limitation of the invention.

[0066] Embodiment 1

[0067] Please refer to Figure 1 , this embodiment discloses an intelligent processing method for weighing data based on two-dimensional codes, which specifically includes the following content:

[0068] S1. Obtain the weighing data of relevant items, form an initial weighing data set, and use an improved density clustering algorithm to identify abnormal weighing data from the initial weighing data set, obtaining an abnormal weighing data set and a normal weighing data set;

[0069] The S1 includes the following steps:

[0070] 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., obtain the 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:

[0071] 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 a radius parameter, and set the radius parameter to , taking the core data point as the center and the radius parameter as the radius to 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, find the initial weighing data not within the range of the several clusters within the marked cluster range, denoted as the unmarked weighing data, and perform neighborhood expansion until there is no unmarked weighing data within the marked cluster range to obtain an expanded cluster;

[0072] S112. Set the b-th initial weighing data in the expanded cluster as , 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:

[0073] ;

[0074] Among them, B represents the average distance of the initial weighing data in the extended cluster ; represents the initial weighing data and the initial weighing data distance; represents the extended cluster;

[0075] Calculate the average distance of other initial weighing data in the extended cluster, and record the initial weighing data whose average distance is much smaller than the radius parameter as outliers, and the outliers are abnormal weighing data;

[0076] S12. Statistically analyze 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;

[0077] S2. Train the BP neural network, improve the particle swarm optimization algorithm by introducing a speed pause parameter, 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;

[0078] The S2 includes the following steps:

[0079] 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, normalize the weighing data sample set, and then divide the weighing data sample set into a sample training set and a sample test set, and input the sample training set into the BP neural network; Set the BP neural network to include 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:

[0080] ;

[0081] 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, ;

[0082] 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:

[0083] 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 of the error calculation formula. As the particles in the particle swarm update their speeds and positions, the weights and thresholds in the BP neural network are iterated simultaneously. Assume that the initial speed of the d -th particle in the particle swarm is , and the initial position of the d -th particle in the particle swarm is . Complete the initialization;

[0084] Assume that the speed 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 . 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. The update strategy is as follows:

[0085] When the random number is greater than the speed pause parameter, the speed d of the e +1-th iteration of the -th particle in the particle swarm;

[0086] When the random number is less than or equal to the speed pause parameter, the speed d of the e +1-th iteration of the -th particle in the particle swarm, where represents the current best position, and represents the current best particle;

[0087] S222. Dynamically change the speed pause parameter. Assume that the speed pause parameter at the e -th iteration is . Replace the inertia weight with the speed pause parameter at the e -th iteration. The d -th particle in the particle swarme The calculation formula for the velocity of the +1th iteration is as follows:

[0088] ;

[0089] Among them, , and represent random variables distributed within the range [0, 1];

[0090] 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 +1th iteration, update . The update formula is as follows:

[0091] ;

[0092] Among them, represents the position of the d th particle in the particle swarm at the e +1th iteration;

[0093] At this time, compare the optimal 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 optimal fitness function value. The current optimal fitness function value corresponds to the current optimal weight and threshold;

[0094] S223. Divide the particle swarm into the first particle swarm and the second particle swarm. Set to represent a random number and , and represent random variables distributed within 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:

[0095] ;

[0096] 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 optimal 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 respectively correspond to the optimized weight and threshold;

[0097] 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.

[0098] 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.

[0099] The S3 includes the following steps:

[0100] 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.

[0101] 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 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 to obtain a processed weighing data set, and then combine it with the normal weighing data set to obtain a processed weighing data set.

[0102] 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 implement identification and reading to complete the intelligent processing of weighing data.

[0103] The S4 includes the following steps:

[0104] 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, and form a separate group for those with less than 3 bits to 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;

[0105] S42. Add an 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:

[0106] 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 a 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;

[0107] 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 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;

[0108] 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 a grayscale curve graph of the grayscale weighing data QR code image. The minimum value of the intersection 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 binary weighing data QR code image; set an affine matrix, use the affine matrix to correct the binary weighing data QR code image, and then remove the mask on the binary weighing data QR code image to output the final code, realizing the recognition and reading of the final weighing data QR code.

[0109] Example 2

[0110] 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;

[0111] The weighing data anomaly recognition module is used to identify abnormal weighing data from the initial weighing data set using an improved density clustering algorithm;

[0112] 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;

[0113] The data correction and filling module is used to correct abnormal data and fill missing data using the predicted values of the neural network;

[0114] The weighing data two-dimensional code generation module is used to perform data encoding based on the weighing data, obtain two-dimensional codes, and enable identification and reading.

[0115] 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.

[0116] The preferred embodiments of the invention disclosed above are only used to assist in the elaboration of the invention. The preferred embodiments do not describe all the details in detail, nor do they limit the invention to only 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. A method for intelligent processing of weighing data based on QR code, characterized in that: The steps include: S1. Obtaining relevant item weighing data to form an initial weighing data set, and using an improved density clustering algorithm to identify abnormal weighing data on the initial weighing data set to obtain an abnormal weighing data set and a normal weighing data set; Said S1 comprises the following steps: S11. Use a weighing device to obtain weighing data of relevant items, including logistics and warehousing items, industrial production items, and agricultural product processing items. Obtain initial weighing data to form an initial weighing data set. Use an improved density clustering algorithm to perform data segmentation 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, record it as a core data point, take the core data point as the center, find the k initial weighing data closest to the core data point, and form a core distance set A = {a1, a2, a3, ..., a k }, where a k Indicates the distance between the core data point and the nearest kth initial weighing data; set the radius parameter and set the radius parameter to a k , taking the core data point as the center and the radius parameter as the radius to form an initial circular cluster, sequentially selecting other initial weighing data in the initial weighing data set as core data points to obtain several initial circular clusters; selecting any cluster from the several clusters, recording it as a marked cluster, searching for initial weighing data that is not within the range of the several clusters within the range of the marked cluster, recording it as unmarked weighing data, and performing neighborhood expansion until there is no unmarked weighing data within the range of the marked cluster, thereby obtaining an expanded cluster; S112, set the bth initial weighing data in the expansion cluster to r b , distance from initial weighing data r b The most recent k initial weighing data are recorded as r k,b , calculate the initial weighing data r in the expanded cluster b The average distance is calculated as follows: Among them, B represents the initial weighing data r in the expanded cluster b The average distance, d(r b ,r k,b ) represents the initial weighing data r b and initial weighing data r k,b The distance between α and α represents the expansion cluster; Calculate the average distance of other initial weighing data in the expanded cluster, and record the initial weighing data corresponding to the average distance smaller than the radius parameter as outliers, which are abnormal weighing data; S12, counting all abnormal weighing data in the initial weighing data set, forming the abnormal weighing data into an abnormal weighing data set, and forming the other initial weighing data in the initial weighing data set into a normal weighing data set; S2, training the BP neural network, using the optimization algorithm to optimize the weights and thresholds in the BP neural network to obtain a BP neural network prediction model; S3. Based on the normal weighing data set, use the BP neural network prediction model prediction value 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 the processed weighing data set is encoded, a new binary code is obtained, and the new binary code is further error-corrected and masked to obtain a final weighing data QR code, which is then recognized and read to complete intelligent weighing data processing.

2. The method for intelligently processing weighing data based on a QR code according to claim 1, characterized in that: The S1 comprises the following steps: S11. Using a weighing device to obtain weighing data of relevant items to obtain initial weighing data, forming an initial weighing data set, and using an improved density clustering algorithm to perform data segmentation on the initial weighing data set to identify abnormal weighing data; S12. Divide the initial weighing data set into an abnormal weighing data set and a normal weighing data set according to the abnormal weighing data.

3. The method for intelligently processing weighing data based on a QR code according to claim 2, characterized in that: The S11 includes the following steps: S111, selecting a core data point from the initial weighing data set, forming an initial circular cluster with the core data point as the center, using the closest distance between the core data point and the initial weighing data as a radius parameter, and performing 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 corresponding to the average distance being smaller than the radius parameter as an outlier, which is abnormal weighing data.

4. The method for intelligently processing weighing data based on a QR code according to claim 3, characterized in that: The S2 comprises the following steps: S21. Obtain a weighing data set from previous years, select normal weighing data from the weighing data set to obtain a weighing data sample set, normalize the weighing data sample set, divide the weighing data sample set into a sample training set and a sample test set, input the sample training set into a BP neural network, and adjust the weights and thresholds in the BP neural network by calculating the error of the calculated results. The error calculation formula is as follows: Among them, β represents the error of BP neural network, c represents the number of sample training sets, l i represents the actual input value of the i-th, l i ′ represents the i-th predicted output value, i = 1, 2, 3, ..., c; S22, using the error calculation formula as the fitness function, improving the particle swarm optimization algorithm to obtain an improved particle swarm optimization algorithm, and using the improved particle swarm optimization algorithm to optimize the weights and thresholds in the BP neural network to obtain 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 number of training iterations reaches the maximum number of iterations to obtain a BP neural network prediction model.

5. The method for intelligently processing weighing data based on a QR code according to claim 4, characterized in that: The method of using the improved particle swarm optimization algorithm to optimize the weights and thresholds in the BP neural network includes the following steps: 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 speed and position, the weights and thresholds in the BP neural network are iterated simultaneously. Set the initial speed of the dth particle in the particle swarm to C. d , the initial position of the dth particle in the particle swarm is D d , complete initialization; Set the speed pause parameter to χ, b1 represents the cognitive acceleration coefficient, b2 represents the social acceleration coefficient, c1 and c2 represent random variables distributed in the range [0, 1], c3 represents a random number and c3∈[0, 1], the inertia weight is δ, and the e-th iteration speed of the d-th particle in the particle swarm is recorded as C d (e) Update the e-th iteration speed of the d-th particle in the particle swarm. The update strategy is as follows: When the random number c3 is greater than the speed pause parameter, the e+1th iteration speed C of the dth particle in the particle swarm d (e+1)=C d (e); When the random number c3 is less than or equal to the speed pause parameter, the e+1th iteration speed C of the dth particle in the particle swarm d (e+1)=δ·C d (e)+b1c1(D′(e)-D d (e))+b2c2(D″(e)-D d (e)), where D′(e) represents the current best position and D″(e) represents the current best particle; S222. Dynamically change the speed pause parameter, set the e-th iteration speed pause parameter to χ(e), use the e-th iteration speed pause parameter to replace the inertia weight, and the calculation formula for the e+1-th iteration speed of the d-th particle in the particle swarm is as follows: Wherein, c4, c5 and c6 represent random variables distributed in the range [0, 1]; Set the position of the dth particle in the particle swarm at the eth iteration to D d (e) According to the e+1th iteration speed of the dth particle in the particle swarm, D d (e) Update, the update formula is as follows: D d (e+1)=D d (e)+C d (e+1); Among them, D d (e+1) represents the e+1th iteration position of the dth particle in the particle swarm; At this time, compare the best fitness function values of the e-th iteration position of the d-th particle in the particle swarm and the e+1-th iteration position of the d-th particle in the particle swarm to obtain the current best fitness function value, which corresponds to the current best weight and threshold; S223. Divide the particle swarm into a first particle swarm and a second particle swarm. Set c7 to represent a random number and c7∈[0,1], c8 and c9 to represent random variables distributed in the range of [0,1]. In the first particle swarm, the speed pause parameter is used to update the particle speed. In the second particle swarm, the current best particle is used 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, and stop the iteration when the current number of iterations reaches the maximum number of iterations. Get the final position of the dth particle in the particle swarm. The final position coordinates correspond to the optimized weights and thresholds respectively.

6. The method for intelligently processing weighing data based on a QR code according to claim 5, characterized in that: The S3 comprises the following steps: S31, labeling the normal weighing data in the normal weighing data set, intercepting a number of normal weighing data segments, converting the normal weighing data set into a normal weighing data segment set; inputting the normal weighing data segment set into a BP neural network prediction model in sequence, and outputting a weighing prediction value; S32. Set a correction threshold, use the weighing prediction value to verify the abnormal weighing data set, and compare it with the correction threshold to correct the abnormal data and fill in the missing data to obtain a processed weighing data set.

7. The method for intelligently processing weighing data based on a QR code according to claim 6, characterized in that: The S4 comprises the following steps: S41, encoding the processed weighing data set to form a new binary code; S42, adding a terminator and a padding code to the new binary code to obtain a padded binary code, performing error correction coding and masking processing on the padded binary code to obtain a final weighing data QR code; S43, grayscale and binarization processing is performed on the final weighing data QR code, and then the mask on the binary weighing data QR code image is removed, and the final code is output to realize recognition and reading of the final weighing data QR code.

8. The method for intelligently processing weighing data based on a QR code according to claim 7, characterized in that: The S42 includes the following steps: S421. Generate an error correction polynomial based on the padded binary code, and use the error correction polynomial to perform coding error correction to obtain a final code; S422. Set a blank QR code, and fill the final code on the blank QR code in sequence to obtain an initial weighing data QR code; perform XOR processing on the initial weighing data QR code to generate several mask images, set weights for the error features of the recognition of several mask images, and then score them, 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 a QR code according to any one of claims 1 to 8, characterized in that: Specifically include: Weighing data anomaly recognition module, neural network parameter optimization module, data correction and filling module, and weighing data QR code module; The weighing data anomaly identification module is used to identify abnormal weighing data on 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 missing data using the neural network prediction value; The weighing data two-dimensional code module is used to encode the weighing data, obtain a two-dimensional 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