[0050] Example two
[0051] figure 2 It is a flowchart of model training in the gait-based identity verification method provided in the second embodiment of the present invention. This embodiment further adds a model training method in the gait-based identity verification method on the basis of the foregoing embodiments. Such as figure 2 Shown. Model training in the gait-based identity verification method can include the following steps:
[0052] S210: Collect current sample gait data of the user to be identified.
[0053] In this embodiment, the sample gait data refers to all the gait data of the user to be identified.
[0054] S220: Calculate the distance between the current sample gait data and each predetermined current reference gait data.
[0055] S230. Determine whether the distance between the current sample gait data and any one of the current reference gait data is less than a preset distance; if so, execute S240; if otherwise, execute S250;
[0056] S240. When the distance between the current sample gait data and any current reference gait data is less than the preset distance, add 1 to the weighted value corresponding to the current reference gait data;
[0057] S250: When the distance between the current sample gait data and any current reference gait data is not less than the preset distance, set the current sample gait data as the new current reference gait data.
[0058] In this embodiment, for each user to be identified, the first type of reference gait data is used as the first type of reference gait data, and the number is counted, and the corresponding number of the first type of reference gait data is 1;
[0059] Calculate the distance between the second sample of gait data and the first type of reference gait data. When the distance between the second sample of gait data and the first type of reference gait data is less than the preset distance, the two data are combined and counted , The corresponding number of the first type of benchmark gait data is 2;
[0060] Calculate the distance between the third sample of gait data and the first type of reference gait data. When the distance between the third sample of gait data and the first type of reference gait data is less than the preset distance, the third sample of gait data Incorporate the benchmark gait data of the first type of data, the corresponding number of the first type of benchmark gait data is 3;
[0061] Calculate the distance between the fourth sample of gait data and the first type of reference gait data. When the fourth sample of gait data is not less than the preset distance from the first type of reference gait data, it will no longer be with the first The gait data of the class data were merged. Instead, use the fourth sample gait data as the second type of benchmark gait data, and the second type of benchmark gait data counts as 1;
[0062] Calculate the distance between the fifth sample gait data and the first type of reference gait data, and calculate the distance between the fifth sample gait data and the second type of reference gait data, if the fifth sample gait data and the second type The distance of the class reference gait data is less than the preset distance, and the distance between the fifth sample gait data and the first type reference gait data is greater than the preset distance, then the fifth sample gait data is merged into the second type data Benchmark gait data, the second type of data benchmark gait data count is 2. If the distance between the fifth sample gait data and the second type of reference gait data is less than the preset distance, and the distance between the fifth sample gait data and the first type of reference gait data is also less than the preset distance, then the first The five sample gait numbers are combined with the benchmark gait data of the smallest distance. Exemplarily, if the distance between the fifth sample of gait data and the first type of reference gait data is less than the distance between the fifth sample of gait data and the second type of reference gait data, then the fifth sample of gait data Combined with the first type of reference gait data, the first type of reference gait data counts as 4; if the distance between the fifth sample of gait data and the second type of reference gait data is less than the fifth sample of gait data and the first If the distance of the standard gait data is similar, the fifth sample gait data is merged with the second-type standard gait data, and the second-type standard gait data counts as 2.
[0063] If a new sample of gait data appears, the analogy is used to calculate the combined count.
[0064] Exemplarily, the gait data of the first sample is [1, 2]; the gait data of the second sample is [2, 1]; the gait data of the third sample is [1, 3]; the fourth The gait data of the first sample is [2, 2]; the gait data of the fifth sample is [2, 5]; the preset distance is 2.
[0065] The first sample gait data is [1, 2] as the first type of reference gait data [1, 2], and the first type of reference gait data counts as 1.
[0066] According to the Euclidean distance formula, the distance between the second sample of gait data [2, 1] and the first type of benchmark gait data [1, 2] is calculated as , Less than the preset distance 2, the second sample of gait data [2, 1] is combined with the first type of reference gait data [1, 2], the count of the first type of reference gait data [1, 2] is recorded as 2.
[0067] According to the Euclidean distance formula, the distance between the third sample of gait data [1, 3] and the first type of benchmark gait data [1, 2] is 1, which is less than the preset distance 2, and the third sample of gait data [1, 3] is merged with the first type of benchmark gait data [1,2], and the count of the first type of benchmark gait data [1,2] is recorded as 3.
[0068] According to the Euclidean distance formula, the distance between the fourth sample gait data [2, 4] and the first type of benchmark gait data [1, 2] is calculated as , Is greater than the preset distance 2, then the fourth sample gait data is [2, 4] as the second type of reference gait data [2, 4], and the second type of reference gait data count is recorded as 1.
[0069] According to the Euclidean distance formula, the distance between the fifth sample gait data [2, 5] and the first type data reference gait data [1, 2] is calculated as Greater than the preset distance 2, calculate the fifth sample gait data as [2, 5] and the second type of reference gait data [2, 4] the distance is 1, less than the preset distance 2, then the fifth sample The gait data is [2,5] and the second type of reference gait data [2,4] are combined, and the second type of data reference gait data count is recorded as 2.
[0070] The first type of reference gait data and the second type of reference gait data and their respective numbers constitute a reference gait data set {[1, 2]: 3; [2, 4]: 2}. If the current sample gait data is collected, when the distance between the sample gait data and any one of the current reference gait data is less than the preset distance, the weighted value corresponding to the current reference gait data is increased by 1; When the distance of a current reference gait data is not less than the preset distance, the current sample gait data is set as the new current reference gait data. By analogy, the sample gait data is calculated and counted, and the benchmark gait data set is constantly updated.
[0071] The model training method provided by the embodiment of the present invention calculates the distance between the current sample gait data and each predetermined current reference gait data by collecting the current sample gait data of the user to be identified. When the current sample gait data is equal to any one When the distance of the current reference gait data is less than the preset distance, add 1 to the weighted value corresponding to the current reference sample gait data, when the distance between the current sample gait data and any current reference gait data is not less than the preset distance , Set the current sample gait data as the new current reference gait data. It solves the problem of calculating the distance between the new data and all the training data in the prior art calculation method, and the calculation amount is relatively large. The problem of repeated calculation and the simple de-duplication of the training data can inevitably lose a large amount of information in the data, which can reduce model training. The amount of calculation avoids the loss of data information.