Screw locking detection method and device, storage medium and equipment
By using CNN and BiLSTM network models to extract the characteristics of torque and angle data in the automatic screw lock machine, the misjudgment and misjudgment problems in screw lock attachment state detection are solved, and a higher detection accuracy is achieved.
Patent Information
- Application Number
- CN202510863748.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-26
- Publication Date
- 2025-07-25
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The automatic screw lock machine has problems of misjudgment and misjudgment in the detection of screw lock attachment status, which is mainly due to the difficulty in extracting features and the dependence on prior knowledge, resulting in low recognition accuracy.
The spatial characteristics of torque and angle data are extracted by using convolutional neural network (CNN) and combined with the bidirectional long and short-term memory network (BiLSTM) to process the timing characteristics, the CNN-BiLSTM network model is constructed to detect the screw locking state.
It improves the accuracy of screw lock attachment detection, overcomes the problems of misjudgment and misjudgment, and improves the judgment accuracy of the automatic screw lock machine.
Smart Images

Figure CN120372171A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of screw locking detection, and particularly to a method, device, storage medium and equipment for detecting the screw locking state. Background Art
[0002] The automatic screw locking machine is an important part of the electric energy meter production line, which can realize the automatic installation of screws for electric energy meters and is an indispensable part of factory automation. The automatic screw locking machine can obtain the torque and rotational speed time series data generated during the screw locking process in real time, detect the screw locking state, timely discover screw locking problems, reduce the defective rate, and improve the product quality.
[0003] The automatic screw locking machine usually divides the electric screwdriver parameters into different ranges according to production experience and corresponds these parameter ranges to screw categories. However, since there are often many overlapping parts in the parameter ranges of similar categories, this easily leads to misjudgment by the automatic screw locking machine, thereby reducing the overall discrimination accuracy. An improved method is to use machine learning algorithms for classification, such as support vector machines, neural networks, etc., which require feature selection and extraction to convert the original data into a feature representation that can be used for classification. However, it is difficult to correctly extract effective features and requires in-depth understanding and professional knowledge of the problem domain. Summary of the Invention
[0004] In view of the deficiencies and defects existing in the prior art, the present invention provides a method, device, storage medium and equipment for detecting the screw locking state, overcomes the difficulties of difficult feature extraction in machine learning and the dependence on prior knowledge, improves the problem of low recognition accuracy, uses a convolutional neural network to extract spatial features, and uses a bidirectional long short-term memory network to extract temporal features to achieve accurate detection of screw locking.
[0005] The object of the present invention can be achieved by the following technical solutions.
[0006] A method for detecting screw locking includes the following steps.
[0007] S1. Export the data of the torque sensor and the angle sensor from the automatic screw locking machine database, and manually label the data to distinguish the sample labels of normal and abnormal screw locking.
[0008] S2. Perform end value filling, equal interval compression, and normalization data preprocessing on the torque and angle data sets; perform one-hot encoding processing on the sample labels.
[0009] Divide the data set into a training data set and a test data set.
[0010] S3. Use a convolutional neural network, a long short-term memory neural network, and a fully connected neural network to jointly construct a CNN-BiLSTM network model and perform parameter initialization.
[0011] S4. Input the training data set into the above model.
[0012] Use the backpropagation algorithm to update the model weights.
[0013] Repeat the above process until all training data sets are trained iteratively, and save the trained model.
[0014] S5. Input the test data set into the trained model, evaluate the prediction results, and determine whether the error value compared to the sample label meets the standard: If not, adjust the model parameters and then re-execute S4 - S5; if it meets the standard, consider the output model prediction results as the screw locking detection results.
[0015] Preferably, the data preprocessing method of filling with the last value in step S2 is as follows: First, traverse the torque data and the angle data to obtain the maximum sequence length L max , and then for all torque data and angle data with lengths less than L max , fill them with the last value of the current data sequence to L max .
[0016] Preferably, the data preprocessing method of equally spaced compression in step S2 is: Perform equal-time interval compression on the data after filling with the last value, and take out one torque data and one angle data every other time interval.
[0017] Preferably, in step S2, the following formula is used to normalize the torque data and the angle data respectively.
[0018] .
[0019] Seq i represents the value of the i-th data; the maximum and minimum values of the sample data are Seq max and Seq min .
[0020] Preferably, the one-hot encoding processing method is: The sample encoding for normal screw locking is [0 1], and the encoding for abnormal is [1 0].
[0021] Preferably, the CNN-BiLSTM model structure is constructed as follows in sequence.
[0022] Conv1D layer: Use a one-dimensional convolutional layer with the number of convolutional kernels being filters, the size of the convolutional kernel being kernel_size, the stride being the parameter strides, and the activation function using the ReLU function.
[0023] MaxPooling1D layer: It is a max pooling layer with a window size of pooling_size.
[0024] BiLSTM layer: It uses a two-layer bidirectional LSTM layer, and each LSTM layer has LSTM_size hidden units.
[0025] Dropout layer: It uses a dropout layer with a probability of p.
[0026] Dense layer: The last two layers are fully connected layers: the first fully connected layer has fn1 hidden units and the activation function is the ReLU function; the second layer has fn2 hidden units and the activation function is the sigmoid function.
[0027] A screw locking detection device includes the following modules.
[0028] Data export module, used to export torque sensor and angle sensor data from the automatic screw locking machine database.
[0029] Data processing and partitioning module, used to perform end value filling, equally spaced compression, and normalization data preprocessing on the torque and angle data sets, and perform one-hot encoding processing on the sample labels; used to partition the data set into a training data set and a test data set.
[0030] Model construction and parameter initialization module, used to jointly construct a CNN-BiLSTM network model using a convolutional neural network, a long short-term memory neural network, and a fully connected neural network and perform parameter initialization.
[0031] Model training module, used to input the training data set into the above model; used to update the model weights using the backpropagation algorithm; used to repeat the process in step S4 above until all training data set training iterations are completed, and save the trained model.
[0032] Prediction result judgment module, used to input the test data set into the trained model, evaluate the prediction result, and judge whether the error value compared with the sample label meets the standard: if not, adjust the model parameters and then re-execute the process in steps S4~S5 above; if it meets the standard, it is considered that the output model prediction result can be used as the screw locking detection result.
[0033] An automatic screw locking machine includes: a processor; a memory storing computer instructions, and the computer instructions are used to make the processor execute the method as described above.
[0034] A storage medium stores computer instructions, and the computer instructions are used to make a computer execute the method as described above.
[0035] Advantageous technical effects of the present invention: In order to overcome the problems of misjudgment and missed judgment of the automatic screw locking machine, aiming at the difficulties in feature extraction in the field of machine learning and the dependence on prior knowledge, spatial features of torque and angle data are extracted through a one-dimensional convolution kernel, and then sequence data is processed by a bidirectional long short-term memory neural network to capture long-term dependence relationships and extract temporal features of the data, realizing accurate detection of screw locking. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1 It is the overall flowchart of the present invention.
[0037] Figure 2 It is the torque and angle curves of the samples labeled OK in the embodiments of the present invention.
[0038] Figure 3 It is the torque and angle curves of the samples labeled NG in the embodiments of the present invention.
[0039] Figure 4 It is the schematic diagram of the CNN-BiLSTM model architecture constructed in the embodiments of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0040] In order to make the objectives, technical solutions and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and do not limit the present invention.
[0041] Embodiment: A method for detecting screw locking includes the following steps.
[0042] S1. Export the data of the torque sensor and the angle sensor from the database of the automatic screw locking machine, and manually label the data: the samples with normal screw locking status are labeled as OK, and the samples with abnormal screw locking status are labeled as NG.
[0043] S2. Perform data preprocessing on the torque and angle data sets.
[0044] Filling with the last value: First, traverse the torque data Tor and the angle data Ang to obtain the maximum sequence length L max = 1023, and then for all torque data and angle data with lengths less than L max = 1023, fill them with the last value of the current data sequence to L max = 1023.
[0045] Equidistant compression: Compress the data after filling with the last value at equal time intervals (interval = 1), and take out one torque data and one angle data every other time interval. Finally, the lengths of the torque and angle data are 513.
[0046] Normalization: The torque data and angle data are normalized respectively using the following formula.
[0047] 。
[0048] Seq i represents the value of the i-th data; the maximum and minimum values of the sample data are Seq max and Seq min 。
[0049] One-hot encoding: The sample with the label OK is encoded as E OK = [0 1]; the sample with the label NG is encoded as E NG = [1 0].
[0050] After obtaining Figure 2 、 Figure 3 the torque and angle curves of the samples with the labels OK and NG respectively as shown, the dataset is divided into a training dataset and a test dataset.
[0051] S3. Use a convolutional neural network, a long short-term memory neural network, and a fully connected neural network to jointly construct a CNN-BiLSTM network model and perform parameter initialization. As Figure 4 shown, the model structure is as follows in sequence.
[0052] 1) Conv1D layer: Use a one-dimensional convolutional layer with the number of convolutional kernels filters = 10, the size of the convolutional kernel kernel_size = 3, the stride parameter strides = 1, and the activation function uses the ReLU function. By applying the one-dimensional convolutional kernel to perform a convolution operation on the input data, this layer can capture the local features in the input data, extract the spatial information in the data, and help the model learn more discriminative features.
[0053] 2) MaxPooling1D layer: It is a max pooling layer with a window size pooling_size = 2. By performing a max pooling operation on the feature map, this layer can reduce the size of the feature map and retain the most significant features. The max pooling operation helps to reduce the complexity of the model and improve the robustness of the model to translational invariance.
[0054] 3) BiLSTM layer: Use two layers of bidirectional LSTM layers, and each LSTM layer has LSTM_size = 64 hidden units. LSTM is a recurrent neural network suitable for time series data. This layer uses LSTM units to learn the time series information in the input data, and through bidirectional processing, it can consider both past and future information at the same time, which enables the model to better capture long-term dependencies.
[0055] 4) Dropout layer: A dropout layer with a probability p = 0.2 is used to randomly discard some neurons with a certain probability during the training process. This can reduce the overfitting of the model and improve the generalization ability of the model.
[0056] 5) Dense layer: The last two layers are fully connected layers. The number of hidden units in the first fully connected layer is fn1 = 32, and the activation function is the ReLU function. The number of hidden units in the second layer is fn2 = 2, and the activation function is the sigmoid function, which can map the features learned by the model to the output categories.
[0057] S4. Input the training data set into the above model.
[0058] Update the model weights using the backpropagation algorithm.
[0059] Repeat the above process until all training data sets are trained iteratively, and save the trained model.
[0060] S5. Use the test data set, input it into the trained model, and evaluate the effect to determine whether it meets the standard: If it does not meet the standard, adjust the model parameters and then re - execute S4~S5; If it meets the standard, the output model prediction result can be regarded as the screw locking detection result.
[0061] In some embodiments, the present disclosure provides a screw locking detection device, which can be applied to the aforementioned automatic screw locking machine. In some embodiments, the screw locking detection device exemplified by the present disclosure includes the following modules.
[0062] Data export module, used to export torque sensor and angle sensor data from the automatic screw locking machine database.
[0063] Data processing and partitioning module, used to perform end - value filling, equal - interval compression, and normalization data pre - processing on the torque and angle data sets, and perform one - hot encoding processing on the sample labels; used to partition the data set into a training data set and a test data set.
[0064] Model construction and parameter initialization module, used to jointly construct a CNN - BiLSTM network model using a convolutional neural network, a long short - term memory neural network, and a fully connected neural network and perform parameter initialization.
[0065] Model training module, used to input the training data set into the above model; used to update the model weights using the backpropagation algorithm; used to repeat the process in step S4 above until all training data sets are trained iteratively, and save the trained model.
[0066] The prediction result judgment module is used to input the test data set into the trained model, evaluate the prediction result, and judge whether the error value compared with the sample label meets the standard: if it does not meet the standard, the model parameters are adjusted and the above processes in steps S4~S5 are executed again; if it meets the standard, the output model prediction result is considered as the screw locking detection result.
[0067] As can be seen from the above, in the embodiments of the present disclosure, the problems of misjudgment and missed judgment of the automatic screw locking machine are overcome, and accurate detection of screw locking is realized.
[0068] In some embodiments, the data processing and partitioning module is used for end value filling data preprocessing: first, traverse the torque data and angle data to obtain the maximum sequence length L max , and then for all torque data and angle data with lengths less than L max , they are respectively filled with the last value of the current data sequence to L max .
[0069] In some embodiments, the data processing and partitioning module is used for equal interval compression data preprocessing: perform equal time interval compression on the data after end value filling, and take out one torque data and one angle data every other time interval.
[0070] In some embodiments, the data processing and partitioning module is used to perform normalization processing on the torque data and angle data respectively using the following formula.
[0071] .
[0072] Seq i represents the value of the i-th data; the maximum and minimum values of the sample data are Seq max and Seq min .
[0073] In some embodiments, the data processing and partitioning module is used for one-hot encoding processing: the sample encoding for normal screw locking is [0 1], and the encoding for abnormal is [1 0].
[0074] In some embodiments, the model construction and parameter initialization module is used to construct the following CNN-BiLSTM model structure.
[0075] 1) Conv1D layer: Use a one-dimensional convolutional layer with the number of convolutional kernels as filters, the size of the convolutional kernel as kernel_size, the stride as the parameter strides, and the activation function uses the ReLU function.
[0076] 2) MaxPooling1D layer: It is a max pooling layer with a window size of pooling_size.
[0077] 3) BiLSTM layer: Use two layers of bidirectional LSTM layers, and each LSTM layer has LSTM_size hidden units.
[0078] 4) Dropout layer: Use a dropout layer with a probability of p.
[0079] 5) Dense layer: The last two layers are fully connected layers: The number of hidden units in the first fully connected layer is fn1, and the activation function is the ReLU function; the number of hidden units in the second layer is fn2, and the activation function is the sigmoid function.
[0080] In some embodiments, the present disclosure provides an automatic screw locking machine, including: a processor; a memory storing computer instructions, and the computer instructions are used to cause the processor to execute the methods of any of the above embodiments.
[0081] In some embodiments, the present disclosure provides a storage medium storing computer instructions, and the computer instructions are used to cause a computer to execute the methods of any of the above embodiments.
[0082] The automatic screw locking machine includes a processor, which can perform various appropriate actions and processes according to the program stored in the memory or the program loaded from the storage part into the memory. In the memory, various programs and data required for the operation of the automatic screw locking machine are also stored. The processor and the memory are connected to each other through a bus. The input / output (I / O) interface is also connected to the bus.
[0083] The following components are connected to the I / O interface: an input part including a keyboard, a mouse, etc.; an output part including a cathode ray tube (CRT), a liquid crystal display (LCD), etc. and a speaker, etc.; a storage part including a hard disk, etc.; and a communication part including a network interface card such as a LAN card, a modem, etc. The communication part performs communication processing via a network such as the Internet. A drive is also connected to the I / O interface as needed. A removable medium, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive as needed, so that the computer program read from it can be installed into the storage part as needed.
[0084] Specifically, according to the embodiments of the present disclosure, the above method process can be implemented as a computer software program. For example, the embodiments of the present disclosure include a computer program product, which includes a computer program tangibly contained on a machine-readable medium, and the computer program includes program codes for executing the above method. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part, and / or installed from the removable medium.
[0085] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagram may represent a module, a segment of a program, or a part of code that contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than that marked in the accompanying drawings. For example, two consecutive blocks shown may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, and combinations of blocks in the block diagram and / or flowchart, can be implemented by a dedicated hardware-based system that performs the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.
[0086] The above embodiments are illustrative of the specific embodiments of the present invention and not limitations thereof. Those skilled in the relevant art can make various transformations and changes without departing from the spirit and scope of the present invention to obtain corresponding equivalent technical solutions. Therefore, all equivalent technical solutions should be included in the patent protection scope of the present invention.
Claims
1. A method for detecting screw attachment, characterized in that, It includes the following steps: S1. Export the data of the torque sensor and the angle sensor from the automatic screw-locking machine database, and manually label the data to distinguish the sample labels of normal and abnormal screw locking; S2. Perform end value filling, equal interval compression, and normalization data preprocessing on the torque and angle data sets; perform one-hot encoding processing on the sample labels; Divide the data set into a training data set and a test data set; S3. Use a convolutional neural network, a long short-term memory neural network, and a fully connected neural network to jointly construct a CNN-BiLSTM network model and perform parameter initialization; S4. Input the training data set into the above model; Use the backpropagation algorithm to update the model weights; Repeat the above process until all training iterations of the training data set are completed, and save the trained model; S5. Input the test data set into the trained model, evaluate the prediction results, and judge whether the error value compared with the sample label meets the standard: if not, adjust the model parameters and then re-execute S4~S5; if it meets the standard, the output model prediction results can be used as the screw locking detection results.
2. The method for detecting screw locking according to claim 1, wherein The preprocessing method for filling the end value in step S2 is as follows: First, traverse the torque data and the angle data to obtain the maximum sequence length L max , and then for all torque data and angle data with lengths less than L max , fill them with the last value of the current data sequence to L max .
3. The method for detecting screw locking according to claim 1, wherein The equal interval compression data preprocessing method in step S2 is: perform equal time interval compression on the data after end value filling, and take out one torque data and one angle data every other time interval.
4. A screw locking detection method according to claim 1, characterized in that, In step S2, the following formula is used to perform normalization processing on the torque data and the angle data respectively: ; Seq i represents the value of the i-th data; the maximum and minimum values of the sample data are Seq max and Seq min .
5. A method for detecting screw locking according to claim 1, characterized in that, The one-hot encoding processing method in step S2 is: the sample encoding of normal screw locking is [0 1], and the sample encoding of abnormal is [1 0].
6. A screw locking detection method according to claim 1, characterized in that The structure of the CNN-BiLSTM model constructed in step S3 is as follows: Conv1D layer: Use a one-dimensional convolutional layer with the number of convolutional kernels as filters, the size of the convolutional kernel as kernel_size, the stride as the parameter strides, and the ReLU function as the activation function; MaxPooling1D layer: It is a max pooling layer with a window size of pooling_size; BiLSTM layer: Use two layers of bidirectional LSTM layers, and each LSTM layer has LSTM_size hidden units; Dropout layer: Use a dropout layer with a probability of p; Dense layer: The last two layers are fully connected layers: the number of hidden units in the first fully connected layer is fn1, and the activation function is the ReLU function; the number of hidden units in the second layer is fn2, and the activation function is the sigmoid function.
7. A screw locking detection device, characterized in that, It includes: A data export module for exporting the data of the torque sensor and the angle sensor from the automatic screw-locking machine database; A data processing and division module for performing end value filling, equal interval compression, and normalization data preprocessing on the torque and angle data sets, and performing one-hot encoding processing on the sample labels; For dividing the data set into a training data set and a test data set; A model construction and parameter initialization module for using a convolutional neural network, a long short-term memory neural network, and a fully connected neural network to jointly construct a CNN-BiLSTM network model and perform parameter initialization; A model training module for inputting the training data set into the above model; for using the backpropagation algorithm to update the model weights; Repeat the process in step S4 described in any one of claims 1 to 6 until the training iteration of all training data sets is completed, and save the trained model; A prediction result judgment module, configured to input a test data set into the trained model, evaluate the prediction result, and judge whether the error value compared with the sample label meets the standard: if it does not meet the standard, adjust the model parameters and then re-execute the process in steps S4 to S5 described in any one of claims 1 to 6; if it meets the standard, it is considered that the output model prediction result can be used as the screw locking detection result.
8. An automatic screw locking machine, characterized in that, Comprising: A processor; A memory storing computer instructions for causing the processor to execute the method described in any one of claims 1 to 6.
9. A storage medium, characterized in that, Storing computer instructions for causing a computer to execute the method described in any one of claims 1 to 6.
Citation Information
Patent Citations
Network traffic intrusion detection method
CN117155701A
Transform and neural network intrusion detection method and system
CN118199969A
Screw locking detection method and device
CN119442042A
ML estimation of tightening classes utilizing normalization
US20240370774A1