A sit-up counting method based on long short-term memory (LSTM) algorithm

The LSTM-based sit-up counting method addresses inefficiencies in existing methods by using a wearable accelerometer to filter and classify sit-up movements, ensuring accurate and efficient counting of standard sit-ups with reduced device complexity.

CN114429149BActive Publication Date: 2024-12-20JIANGSU AUTOMATION RESEARCH INSTITUTE
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111514674.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-13
Publication Date
2024-12-20
Estimated Expiration
2041-12-13

AI Technical Summary

Technical Problem

Existing sit-up counting methods are inefficient, require human supervision, are prone to fraud, and lack accuracy in judging the standardization of movements, often involving complex and bulky devices.

Method used

A sit-up counting method using a long short-term memory (LSTM) algorithm that processes accelerometer data to filter, segment, and classify sit-up movements, determining standard and complete sit-ups through a trained LSTM model with a backbone network and fully connected layer, utilizing a wearable device like a wristwatch.

Benefits of technology

Accurately and efficiently counts sit-ups without human supervision, ensuring standardization and completeness, while reducing device complexity and resource requirements.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114429149B_ABST
    Figure CN114429149B_ABST
Patent Text Reader

Abstract

The invention discloses a sit-up counting method based on a long short-term memory (LSTM) algorithm, the method comprising: using an accelerometer to obtain a real-time accelerometer data stream of a test subject's sit-ups; storing the accelerometer data stream for a period of time into a data file, and filtering the saved data file using an FIR filter to obtain smooth data; segmenting the smooth data by a peak value detection method, recording the peak index, and recording the data between every two peaks as a possible sit-up data; judging whether the data obtained as a possible sit-up is a standard complete sit-up by a long short-term memory (LSTM) algorithm, and when a complete standard sit-up is completed, the counter is increased by 1. The invention can realize automatic test counting of sit-ups, and no human intervention is required in the process, thereby improving work efficiency, and the invention also improves the accuracy and rigor of sit-up counting.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the field of computer technology, and in particular to a sit-up counting method based on a long short-term memory (LSTM) algorithm. Background Art

[0002] Sit-ups are a common form of exercise that is effective in training multiple muscle groups and enhancing core strength. Therefore, sit-ups play an important role in domestic student physical fitness tests and military physical fitness evaluations. For a national sport like sit-ups that is widely promoted, an accurate and precise counting method is essential.

[0003] The main sit-up counting methods currently used are:

[0004] (1) Statisticians manually judge and count. Statisticians observe the subjects doing sit-ups and then count them manually. This counting method requires more human resources to cooperate. At the same time, it is impossible to confirm whether the movements are standardized, which is also prone to fraud;

[0005] (2) Sit-up counting device based on infrared. The whole device occupies a large space, requires operator cooperation, is inconvenient to use, and cannot accurately judge the standardization of sit-up movements;

[0006] (3) Sit-up counting device based on motion detection algorithm. The deep learning detection algorithm is used to perform motion recognition detection on sit-up videos. The device also needs to be specially configured with a camera, and the overall device is relatively redundant.

[0007] The above-mentioned sit-up counting method has the same counting accuracy, precision and efficiency, and increases the complexity of the attached device, which is inconvenient to use. Summary of the invention

[0008] The purpose of the present invention is to provide a sit-up counting method based on a long short-term memory (LSTM) algorithm in order to address the problems existing in the above-mentioned prior art.

[0009] The technical solution to achieve the purpose of the present invention is: a sit-up counting method based on a long short-term memory (LSTM) algorithm, the method comprising the following steps:

[0010] Step 1, using an accelerometer to obtain a real-time accelerometer data stream of a test subject performing sit-ups;

[0011] Step 2, filtering and smoothing the accelerometer data stream;

[0012] Step 3, segment the smoothed data using the peak value detection method, record the peak index, and record the data between every two peaks as a suspected sit-up data;

[0013] Step 4, using the long short-term memory (LSTM) algorithm to determine whether the sit-up data obtained in step 3 is a standard complete sit-up, if so, the count is increased by 1;

[0014] Step 5, repeat the above process until the subject stops the sit-up process.

[0015] Furthermore, the filtering and smoothing processing of the accelerometer data stream described in step 2 is specifically: using a FIR filter to filter and smooth the accelerometer data stream.

[0016] Furthermore, the step 3 described in which the smoothed data is segmented by a peak value detection method is specifically: the smoothed data is segmented into data information blocks between "peaks-peaks" and stored.

[0017] Furthermore, the long short-term memory (LSTM) algorithm described in step 4 is used to determine whether the sit-up data obtained in step 3 is a standard complete sit-up, specifically including:

[0018] Step 4-1, construct a long short-term memory LSTM algorithm model;

[0019] Step 4-2, training the model to obtain a model for determining whether a sit-up is standard and complete;

[0020] Step 4-3, using the model for judging whether a sit-up is standard and complete to judge the sit-up data, to judge whether it is a standard and complete sit-up.

[0021] Furthermore, the long short-term memory LSTM algorithm model described in step 4-1 includes two parts: a backbone network and a fully connected layer. The backbone network part is composed of an LSTM module network, with a total of 6 layers of LSTM module networks. The input information is a sit-up data segment. After the first layer of operation, 32-dimensional data is obtained in the dimension, 32-dimensional data is obtained in the dimension after the second layer of operation, 64-dimensional data is obtained in the dimension after the third layer of operation, 64-dimensional data is obtained in the dimension after the fourth layer of operation, 128-dimensional data is obtained in the dimension after the fifth layer of operation, and 128-dimensional data is obtained in the dimension after the sixth layer of operation; the feature matrix obtained after the sixth layer of operation is input into the fully connected layer, and then the result is output through the activation function, and whether it is a standard and complete sit-up is determined based on the result.

[0022] Furthermore, the activation function outputs a 1×2 matrix, in which the two values ​​of dimension 2 respectively represent "yes" or "not" a standard sit-up. If the result is "0", it represents a standard sit-up, and the counter increases by 1. If the result is "1", it represents a non-standard sit-up, and the counter value remains unchanged.

[0023] Further, the model is trained in step 4-2 to obtain a model for determining whether the sit-up is standard and complete, specifically including:

[0024] Step 4-2-1, construct a sample data set, including a positive sample set and a negative sample set; for the positive sample set, select a standard sit-up action accelerometer data stream, filter and smooth the data stream, then obtain a "peak-peak" sit-up data slice, supplement or crop the data slice length according to the basic data length of completing a sit-up, and normalize the data. After processing, the data is used as a positive sample, and multiple positive samples constitute a positive sample set; for the negative sample set, a negative sample is constituted by a randomly generated floating-point number within 1, and multiple negative samples constitute a negative sample set;

[0025] Step 4-2-2, dividing the sample data set into a training set and a validation set;

[0026] Step 4-2-3, use the training set to train the long short-term memory LSTM algorithm model, use the cross entropy loss function to optimize, and obtain a trained model for determining whether the sit-ups are standard and complete.

[0027] Compared with the prior art, the present invention has the following significant advantages:

[0028] (1) The present invention is easy to use and can accurately and stably record the number of sit-ups without the need for extra personnel supervision and cooperation, thus saving human resources.

[0029] (2) The device to which the present invention is attached is simple and only requires the subject to wear a wearable device (such as a wristwatch) containing an accelerometer, which occupies a small space.

[0030] (3) The algorithm proposed in the present invention can more accurately judge the standardization and completeness of the sit-up movements of the subjects, and can standardize the movement postures of the subjects, achieving a more adequate exercise effect.

[0031] The present invention is further described in detail below in conjunction with the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] Figure 1 The present invention is a flowchart of a sit-up counting method based on a long short-term memory (LSTM) algorithm.

[0033] Figure 2 It is a schematic diagram of the long short-term memory (LSTM) algorithm model of the present invention. DETAILED DESCRIPTION

[0034] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0035] Combination Figure 1 and Figure 2 The present invention proposes a sit-up counting method based on a long short-term memory (LSTM) algorithm, comprising the following steps:

[0036] Step 1, construct a long short-term memory LSTM (Long short-term memory) algorithm model, including a backbone network and a fully connected layer: the backbone network is composed of an LSTM module network, and the backbone network has a total of 6 layers of LSTM module networks. The input information is a 200×1 sit-up data segment. After the first layer of operation, 32-dimensional data is obtained, and after the second layer of operation, 32-dimensional data is obtained. After the third layer of operation, 64-dimensional data is obtained. After the fourth layer of operation, 64-dimensional data is obtained. After the fifth layer of operation, 128-dimensional data is obtained. After the sixth layer of operation, 128-dimensional data is obtained. The feature matrix obtained after the sixth layer of operation is input into the fully connected layer, and a 2-dimensional result is obtained after the activation function. The result is used to determine whether it is a standard and complete sit-up. After the fully connected network and activation function, the final result is a 1×2 matrix, where the two values ​​of dimension 2 represent "yes" or "no" standard sit-ups. If the result is "0", it means it is a standard sit-up, and the counter increases by 1. If the result is "1", it means it is a non-standard sit-up, and the counter value remains unchanged.

[0037] Regarding the activation function, the present invention uses Softmax as the activation function because the Softmax activation function has the following characteristics: the Softmax activation function uses an exponent, which can make large values ​​larger and small values ​​smaller, increase the distinction contrast, and make the model learning more efficient. The second reason is that the Softmax activation function is continuously differentiable and eliminates the inflection point. This feature is very necessary in places such as the gradient descent method of deep learning.

[0038] Step 2: Preparation and preprocessing of the training set for the LSTM (Long short-term memory) algorithm model:

[0039] (1) Using an accelerometer in a wristwatch (or other wearable device including an accelerometer) to obtain a real-time accelerometer data stream of the subject's sit-ups, parsing the data stream to obtain the subject's sit-up information.

[0040] (2) The analyzed accelerometer data stream is filtered to obtain a smooth curve. Otherwise, it cannot be well analyzed. The filtering method used is a digital filter FIR (Finite Impulse Response) filter. After passing through the filter, the smooth sit-up data of the test subject is obtained.

[0041] (3) For the smooth sit-up data of the test subject, the data contains peaks and troughs. By analyzing the periodic effect of the sit-up movement on the accelerometer, it can be determined that the data between two peaks may be the data of a sit-up. The smoothed data is processed to obtain all the peak information, and the overall information is divided into data between "peak-peak" and stored in blocks. The "peak-peak" data is defined as a possible sit-up.

[0042] (4) Obtaining a training set: a positive sample set, selecting a standard sit-up action accelerometer data stream, smoothing the data stream using a digital filter, obtaining a "peak-peak" sit-up data slice after obtaining the smoothed data, supplementing or cutting the data slice length according to the basic data length of completing a sit-up, fixing the sit-up data length of one sit-up to 200, normalizing the data, and using the data as a positive sample after processing, and multiple positive samples constitute the entire positive sample set for the entire training; a negative sample set, the data length of one sit-up is also selected as 200, using a randomly generated floating point number within 1 to constitute a negative sample, and multiple negative samples constitute the entire negative sample set for the entire training. In the present invention, the positive sample set contains a total of 409 positive samples, and the negative sample set contains 400 negative samples.

[0043] Step 3: Training process of the LSTM (Long short-term memory) algorithm model:

[0044] (1) The preprocessed training set is sent to a model based on the long short-term memory (LSTM) algorithm for training, and the cross entropy loss function is used as the loss function for optimization.

[0045] (2) In addition, the training process also needs to set some hyperparameters, including the batch-size setting of the number of data input into the neural network for training each time, the number of iterations, the initial learning rate, the decay method of the learning rate, and the ratio of the training set to the validation set. In the present invention, the number of iterations is set to 50, the batch-size is set to 512, the initial learning rate is set to 0.001, and the ratio of the training set to the validation set is 9:1. The decay method of the learning rate adopts the observation of the accuracy of the validation set to decay. When the accuracy of the validation set remains unchanged after 10 iterations, the learning rate decays to 50% of the previous learning rate.

[0046] (3) After 50 iterations of training, a trained model based on the LSTM (Long short-term memory) algorithm is obtained to determine whether sit-ups are standardized, standard, and complete. The model is solidified into a file for later use.

[0047] The technical content and technical features of the present invention have been disclosed as above, but those skilled in the art may still make various substitutions and modifications based on the teachings and disclosures of the present invention without departing from the spirit of the present invention. Therefore, the protection scope of the present invention should not be limited to the contents disclosed in the embodiments, but should include various substitutions and modifications that do not depart from the present invention, and are covered by the claims of this patent application.

Claims

1. A sit-up counting method based on long short-term memory (LSTM) algorithm, characterized in that: The method comprises the following steps: Step 1, using an accelerometer to obtain a real-time accelerometer data stream of a test subject performing sit-ups; Step 2, filtering and smoothing the accelerometer data stream; Step 3, segment the smoothed data using the peak value detection method, record the peak index, and record the data between every two peaks as a suspected sit-up data; Step 4, using the long short-term memory LSTM algorithm to determine whether the sit-up data obtained in step 3 is a standard complete sit-up, if so, the count is increased by 1; the use of the long short-term memory LSTM algorithm to determine whether the sit-up data obtained in step 3 is a standard complete sit-up specifically includes: Step 4-1, construct a long short-term memory LSTM algorithm model; Step 4-2, training the model to obtain a model for determining whether a sit-up is standard and complete; Step 4-3, using the model for judging whether a sit-up is standard and complete to judge the sit-up data, to judge whether it is a standard and complete sit-up; The long short-term memory LSTM algorithm model described in step 4-1 includes two parts: a backbone network and a fully connected layer. The backbone network part is composed of an LSTM module network, with a total of 6 layers of LSTM module networks. The input information is a sit-up data segment. After the first layer of operation, 32-dimensional data is obtained in the dimension, 32-dimensional data is obtained in the dimension after the second layer of operation, 64-dimensional data is obtained in the dimension after the third layer of operation, 64-dimensional data is obtained in the dimension after the fourth layer of operation, 128-dimensional data is obtained in the dimension after the fifth layer of operation, and 128-dimensional data is obtained in the dimension after the sixth layer of operation. The feature matrix obtained after the sixth layer of operation is input into the fully connected layer, and then the result is output after the activation function, and whether it is a standard and complete sit-up is determined according to the result; The output result of the activation function is a 1×2 matrix, where the two values ​​of dimension 2 represent "yes" or "no" standard sit-ups. If the result is "0", it means it is a standard sit-up, and the counter is incremented by 1. If the result is "1", it means it is a non-standard sit-up, and the counter value remains unchanged. Step 5, repeat the above process until the subject stops the sit-up process.

2. The sit-up counting method based on the long short-term memory (LSTM) algorithm according to claim 1 is characterized in that: The step 2 of filtering and smoothing the accelerometer data stream is specifically: using an FIR filter to filter and smooth the accelerometer data stream.

3. The sit-up counting method based on the long short-term memory (LSTM) algorithm according to claim 1, characterized in that: Step 3 describes dividing the smoothed data by using a peak value detection method, specifically: dividing the smoothed data into "peak-peak" data information blocks for storage.

4. The sit-up counting method based on the long short-term memory (LSTM) algorithm according to claim 1, characterized in that: Step 4-2 trains the model to obtain a model for determining whether a sit-up is standard and complete, specifically including: Step 4-2-1, construct a sample data set, including a positive sample set and a negative sample set; for the positive sample set, select a standard sit-up action accelerometer data stream, filter and smooth the data stream, then obtain a "peak-peak" sit-up data slice, supplement or cut the data slice length according to the basic data length of completing a sit-up, and normalize the data. After processing, the data is used as a positive sample, and multiple positive samples constitute a positive sample set; for the negative sample set, a negative sample is formed by using a randomly generated floating-point number within 1, and multiple negative samples constitute a negative sample set; Step 4-2-2, dividing the sample data set into a training set and a validation set; Step 4-2-3, use the training set to train the long short-term memory LSTM algorithm model, use the cross entropy loss function to optimize, and obtain a trained model for determining whether the sit-ups are standard and complete.

5. The sit-up counting method based on the long short-term memory (LSTM) algorithm according to claim 1, characterized in that: The basic data length of one sit-up is 200.