Training method and positioning method
By constructing and connecting neural network models for positioning and training based on objective functions, the problem of low positioning accuracy based on BLE signal strength in the prior art is solved, and higher positioning accuracy is achieved.
Patent Information
- Application Number
- CN202210316647.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-28
- Publication Date
- 2025-06-20
- Estimated Expiration
- 2042-03-28
AI Technical Summary
The existing positioning algorithm based on BLE signal strength RSSI has the problem of low positioning accuracy.
By constructing the first model and the second model, the first model is used to output positioning coordinates, and the second model is used to output signal strength data. The two are connected to form a training model and trained based on the objective function to improve positioning accuracy.
The device positioning accuracy based on signal strength is improved, and the problem of the model falling into local optimal solution or overfitting prematurely during training is avoided.
Smart Images

Figure CN114943333B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data analysis, and particularly to a training method and a positioning method. Background Art
[0002] The digital key based on BLE (Bluetooth Low Energy) is a technical route of the keyless system. Locating the position of the key is one of the key functions of the keyless system. The existing positioning algorithms based on the RSSI (Received Signal Strength Indicator) of the BLE signal strength include rule-based positioning algorithms, or use physical attenuation models combined with geometric methods to solve the source coordinates so as to achieve the purpose of positioning the Bluetooth key.
[0003] However, the existing algorithms based on the RSSI of the BLE signal generally have the problem of low positioning accuracy. How to improve the positioning accuracy based on RSSI is a technical problem of the BLE Bluetooth key.
[0004] That is, there is a problem of low accuracy in the device positioning algorithm based on signal strength in the prior art. Summary of the Invention
[0005] The purpose of the present invention is to provide a training method and a positioning method to solve the problem of low accuracy in the device positioning algorithm based on signal strength in the prior art.
[0006] To solve the above technical problem, the present invention provides a training method for training a device positioning model based on signal strength. The training method includes the following steps:
[0007] Construct a first model and a second model. Among them, the input parameters of the first model include signal strength data, the output parameters of the first model include positioning coordinates, and the output parameters of the second model are the signal strength data.
[0008] The output end of the first model for outputting the positioning coordinates is connected to the input end of the second model to obtain a training model.
[0009] Train the training model based on an objective function, where the objective function is calculated based on at least the output result of the first model and the output result of the training model.
[0010] The trained first model is configured as the device positioning model.
[0011] Optionally, the output parameters of the first model further include area category parameters.
[0012] Optionally, the positioning coordinates are the x coordinate, y coordinate, and z coordinate of the signal source in the reference coordinate system, and the signal strength data is the signal strength of the signal source received by the anchor point.
[0013] Optionally, the first model includes four input channels, and each input channel corresponds to a column of the following matrix:
[0014]
[0015] where RSSI i represents the signal strength of the signal source received by the i-th anchor point, x i represents the x coordinate of the i-th anchor point in the reference coordinate system, y i represents the y coordinate of the i-th anchor point in the reference coordinate system, z i represents the z coordinate of the i-th anchor point in the reference coordinate system, w represents the total number of anchor points, i represents the serial number of the anchor point, and the value range of i is 1 to w.
[0016] Optionally, the first model includes a first convolutional layer and a fully connected layer. The first convolutional layer includes a 1×1 convolutional kernel with f channels. The first convolutional layer outputs four first intermediate tensors of 1×w×f. After the first tensors are fused, a first fused tensor of 1×w×f is obtained. The fully connected layer performs calculations based on the first fused tensor and outputs the positioning coordinates, where f is a preset parameter.
[0017] Optionally, the input parameter of the second model includes distance data in a preset format. The output end of the first model for outputting the positioning coordinates is connected to the input end of the second model through a coordinate regression module.
[0018] Optionally, the input parameter of the second model includes distance data in a preset format. The output end of the first model for outputting the positioning coordinates is connected to the input end of the second model through a coordinate regression module. The distance data in the preset format is [D1, D2, D3, S1, S2, S3], where D1 = [d1,..., d w , S1 = [s1,..., s w , s i = LeakyRelu(m·d i +k).
[0019] where d i represents the Euclidean distance between the i-th anchor point and the signal source, m and k are both trainable parameters, w represents the total number of anchor points, i represents the serial number of the anchor point, and the value range of i is 1 to w.
[0020] The second model includes six input channels, and each input channel corresponds to one of [D1, D2, D3, S1, S2, S3].
[0021] Optionally, the second model includes a second convolutional layer. The second convolutional layer includes 1×1 convolutional kernels with f channels. The second convolutional layer outputs six second intermediate tensors of 1×w×f. After the second intermediate tensors are accumulated, a second fusion tensor of 1×w×f is obtained. The second fusion tensor performs addition along the third dimension to calculate a third fusion tensor of 1×w×1. The third fusion tensor is configured to output the signal strength data, where f is a preset parameter.
[0022] Optionally, the input parameters of the second model include distance data in a preset format. The output end of the first model for outputting the positioning coordinates is connected to the input end of the second model through a coordinate regression module. The distance data in the preset format is [D1, D2, D3, S1, S2, S3], where D1 = [d1,..., d w , S1 = [s1,..., s w , s i = LeakyRelu(m·d i + k).
[0023] where d i represents the Euclidean distance between the i-th anchor point and the signal source, and both m and k are trainable parameters.
[0024] The second model includes six input channels, and each input channel corresponds to one of [D1, D2, D3, S1, S2, S3].
[0025] The second model includes a second convolutional layer. The second convolutional layer includes 1×1 convolutional kernels with f channels. The second convolutional layer outputs six second intermediate tensors of 1×w×f. After the second intermediate tensors are accumulated, a second fusion tensor of 1×w×f is obtained. The second fusion tensor performs addition along the third dimension to calculate a third fusion tensor of 1×w×1. The third fusion tensor is configured to output the signal strength data.
[0026] The penalty term of the objective function includes the error of the first model, the error of the training model, and a connection loss term. The connection loss term is calculated based on the following formula:
[0027] Diff max = max(Diff mae ).
[0028]
[0029] Among them, Diffmax represents the connection loss term, Diff mae [i] represents the intermediate calculation term corresponding to the i-th anchor point, FusionMat i,j represents the element with the serial number (1, i, j) in the first fusion tensor, ReconMat i,j represents the element with the serial number (1, i, j) in the second fusion tensor, and the value range of j is 1 to f.
[0030] To solve the above technical problems, the present invention also provides a positioning method. The positioning method obtains a positioning result based on a device positioning model, and the device positioning model is trained based on the above training method.
[0031] Compared with the prior art, in a training method and a positioning method provided by the present invention, the training method includes the following steps: constructing a first model and a second model. The first model is connected to the second model to obtain a training model. Training the training model based on an objective function, wherein the objective function is calculated based on at least the output result of the first model and the output result of the training model. The trained first model is configured as the device positioning model. With such a configuration, the training result is evaluated simultaneously through the error of the first model and the error of the training model, improving the model training effect and avoiding the situation that the model prematurely falls into a local optimal solution or overfitting during the training process, so that the positioning accuracy of the trained positioning model is higher, thereby solving the problem of low accuracy of the device positioning algorithm based on signal strength in the prior art. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] Those of ordinary skill in the art will understand that the provided drawings are used to better understand the present invention and do not constitute any limitation to the scope of the present invention. Among them:
[0033] Figure 1 is a flowchart of the training method according to an embodiment of the present invention;
[0034] Figure 2 is a calculation flowchart of the training model according to an embodiment of the present invention.
[0035] In the drawings:
[0036] 1 - First model; 2 - Second model; 3 - Coordinate regression module; 4 - Training model. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0037] To make the objectives, advantages, and features of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be noted that the accompanying drawings are in very simplified forms and are not drawn to scale, and are only used to conveniently and clearly assist in explaining the objectives of the embodiments of the present invention. In addition, the structures shown in the accompanying drawings are often part of the actual structures. In particular, the accompanying drawings need to show different focuses and sometimes use different scales.
[0038] As used in the present invention, the singular forms "a", "an", and "the" include plural objects. The term "or" is generally used in the sense of including "and / or". The term "several" is generally used in the sense of including "at least one". The term "at least two" is generally used in the sense of including "two or more". In addition, the terms "first", "second", "third" are only used for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly specifying the quantity of the indicated technical features. Thus, the features defined with "first", "second", "third" may explicitly or implicitly include one or at least two of such features. "One end" and "the other end", as well as "the proximal end" and "the distal end" generally refer to two corresponding parts, which not only include the endpoints. The terms "mounted", "connected", "coupled" should be understood in a broad sense. For example, it may be a fixed connection, a detachable connection, or integrated; it may be a mechanical connection or an electrical connection; it may be directly connected or indirectly connected through an intermediate medium, and it may be the internal communication of two elements or the interaction relationship between two elements. In addition, as used in the present invention, when an element is disposed on another element, it generally only indicates that there is a connection, coupling, cooperation, or transmission relationship between the two elements, and the two elements may be directly or indirectly connected, coupled, cooperated, or transmitted through an intermediate element, and cannot be understood as indicating or implying the spatial position relationship between the two elements, that is, an element may be inside, outside, above, below, or on one side of another element, etc., in any orientation, unless otherwise explicitly specified in the content. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0039] Unless otherwise specified, the order among the steps in the methods disclosed in this application is not limited to the order presented in the specification, and the independent steps can be arbitrarily swapped. Additionally, those skilled in the art can understand based on their technical common sense that the expression "if <(meet) a certain condition>, then <(perform) a certain action>" does not mean that under any working conditions after meeting <the certain condition>, the described <certain action> will definitely be executed. The execution of <the certain action> may also depend on other prerequisite conditions. For example, the action of "turning on the machine" depends on whether the current system is powered, but for the sake of simplicity, the requirement for the power supply status is generally not recorded in <the certain condition>. In this application, the expression "if <(meet) a certain condition>, then <(perform) a certain action>" can be understood as that after <the certain condition> is met, under the normal working conditions understood by those skilled in the art, the expectation of <the certain action> being executed exceeds 50%, and usually exceeds 90%.
[0040] The core idea of the present invention is to provide a training method and a positioning method to solve the problem of low accuracy of the device positioning algorithm based on signal strength in the prior art.
[0041] The following is a description with reference to the accompanying drawings.
[0042] Please refer to Figures 1 to 2 , where Figure 1 is a flowchart of the training method according to an embodiment of the present invention; Figure 2 is a calculation flowchart of the training model according to an embodiment of the present invention.
[0043] Figure 1 There is shown a training method for training a device positioning model based on signal strength, and the training method includes the following steps:
[0044] S10 Construct a first model 1 and a second model 2, where the input parameters of the first model 1 include signal strength data, the output parameters of the first model 1 include positioning coordinates, and the output parameters of the second model 2 are the signal strength data.
[0045] S20 Connect the output end of the first model 1 for outputting the positioning coordinates to the input end of the second model 2 to obtain a training model 4.
[0046] S30 Train the training model 4 based on an objective function, where the objective function is calculated based at least on the output result of the first model 1 and the output result of the training model 4.
[0047] S40 The trained first model 1 is configured as the device positioning model.
[0048] In this embodiment, the training and iteration of the model are not limited to the output result of the first model 1 itself. Instead, the second model 2 is added, and the two are combined to obtain the more complex training model 4. The objective function is calculated based on the output results of the first model 1 and the training model 4, achieving a better training effect.
[0049] The first model 1 and the second model 2 are preferably neural network models combined with physical models.
[0050] In one embodiment, the output parameters of the first model 1 further include region category parameters. When applied to a vehicle, the region category parameters include: the left side inside the vehicle, the right side inside the vehicle, the left side outside the vehicle, the right side outside the vehicle, the near left side of the vehicle, the far right side of the vehicle, etc.
[0051] Preferably, the signal strength data can be obtained by setting anchor points. For example, a Bluetooth receiver is set at a preset position of a vehicle, and each Bluetooth receiver corresponds to an anchor point. The positioning coordinates are the x coordinate, y coordinate, and z coordinate of the signal source (such as a Bluetooth key) in the reference coordinate system, and the signal strength data is the signal strength of the signal source received by the anchor point. The reference coordinate system is relatively fixed to the anchor point.
[0052] The first model 1 includes four input channels, and each input channel corresponds to a column of the following matrix:
[0053]
[0054] Among them, RSSI i represents the signal strength of the signal source received by the i-th anchor point, x i represents the x coordinate of the i-th anchor point in the reference coordinate system, y i represents the y coordinate of the i-th anchor point in the reference coordinate system, z i represents the z coordinate of the i-th anchor point in the reference coordinate system, w represents the total number of anchor points, i represents the serial number of the anchor point, and the value range of i is 1 to w.
[0055] The first model 1 includes a first convolutional layer and a fully connected layer. The first convolutional layer includes 1×1 convolutional kernels with f channels. The first convolutional layer outputs four first intermediate tensors of 1×w×f. After the first tensors are fused, a first fused tensor of 1×w×f is obtained. The fully connected layer calculates based on the first fused tensor and outputs the positioning coordinates. Among them, f is a preset parameter. f can be set according to actual needs. In one embodiment, the dimension of the first fused tensor is transformed into a tensor of 1×(w·f) as the input of the fully connected layer.
[0056] Please refer to Figure 2 , the input parameters of the second model 2 include distance data in a preset format, and the output end of the first model 1 for outputting the positioning coordinates is connected to the input end of the second model 2 through a coordinate regression module 3. It can be understood that there is a certain conversion relationship between the distance data in the preset format and the positioning coordinates, but the positioning coordinates cannot be directly input into the second model 2. Therefore, the coordinate regression module 3 is required to perform calculations and conversions.
[0057] It can be understood that in some embodiments, the output end of the first model 1 for outputting the positioning coordinates can also be directly connected to the input end of the second model 2. At this time, the format of the input parameters of the second model 2 is consistent with the positioning coordinates.
[0058] In one embodiment, the distance data in the preset format is [D1, D2, D3, S1, S2, S3], where D1 = [d1,..., d w , S1 = [s1,..., s w , s i = LeakyRelu(m·d i + k).
[0059] Among them, d i represents the Euclidean distance between the i-th anchor point and the signal source, both m and k are trainable parameters, w represents the total number of anchor points, i represents the serial number of the anchor point, and the value range of i is 1 to w.
[0060] The second model includes six input channels, and each input channel corresponds to one of [D1, D2, D3, S1, S2, S3].
[0061] The function of the coordinate regression module 3 is to calculate the positioning coordinates and the coordinates of the anchor points to obtain each d i ; and then calculate and output [D1, D2, D3, S1, S2, S3]. The coordinate regression module 3 is a trainable model.
[0062] Regarding the setting of s i , the explanation of s i is as follows, s iThe corresponding non-linear term is used to handle the situation where the signal propagates in two domains, inside and outside the vehicle. The calculation rule of LeakyRelu(x) can be understood according to the common knowledge in the art. Generally, when x≥0, LeakyRelu(x) = x; when x<0, LeakyRelu(x) = αx, where α is a number close to 0, for example, 0.01. The advantage of using LeakyReLU(x) is that during the backpropagation process, for the part where the input of the LeakyReLU activation function is less than zero, the gradient can also be calculated, which can avoid the sawtooth problem in the gradient direction.
[0063] The second model 2 includes a second convolutional layer. The second convolutional layer includes a 1×1 convolutional kernel with f channels. The second convolutional layer outputs 6 second intermediate tensors of 1×w×f. After the second intermediate tensors are accumulated, a second fusion tensor of 1×w×f is obtained. The second fusion tensor is calculated by adding along the third dimension to obtain a third fusion tensor of 1×w×1. The third fusion tensor is configured to output the signal strength data. The third dimension is the dimension where the parameter f is located.
[0064] The penalty term (denoted as Cost) of the objective function includes the error of the first model (denoted as loss regress ), the error of the training model (denoted as loss recon ), and a connection loss term. The connection loss term is calculated based on the following formula:
[0065] Diff max =max(Diff mae )。
[0066]
[0067] Where, Diff max represents the connection loss term, Diff mae [i] represents the intermediate calculation term corresponding to the i-th anchor point, FusionMat i,j represents the element with the serial number (1, i, j) in the first fusion tensor, and ReconMat i,j represents the element with the serial number (1, i, j) in the second fusion tensor. The value range of j is 1 to f. The setting of the connection loss term can improve the training effect of the model.
[0068] Based on the above description, the penalty term Cost can be calculated by the following formula:
[0069] Cost=ρ1loss regress +ρ2Diff max +ρ3loss recon 。
[0070] Among them, the error of the first model can be calculated by the mean squared error (MSE), the mean absolute error (MAE), or the reduce max error. The calculation method of the reduce max error is to first calculate max(x error , y error , z error ), and then calculate the average. x error , y error , z error respectively represent the errors in the x-direction, y-direction, and z-direction in the reference coordinate system. The error of the training model can be calculated using MSE or MAE, and ρ1, ρ2, ρ3 are the corresponding weights.
[0071] This embodiment also provides a positioning method. The positioning method obtains a positioning result based on the device positioning model, and the device positioning model is trained based on the above training method. For the specific details of the positioning method, such as the preprocessing of the input signal and the display method of the output result, those skilled in the art can set them according to actual needs and will not be described in detail here.
[0072] In summary, in the training method and positioning method provided in this embodiment, the training method includes the following steps: S10 constructing a first model and a second model. S20 connecting the first model to the second model to obtain a training model. S30 training the training model based on an objective function, where the objective function is calculated based on at least the output result of the first model and the output result of the training model. S40 the trained first model is configured as the device positioning model. With such a configuration, the training result is evaluated simultaneously through the error of the first model and the error of the training model, improving the model training effect and avoiding the model falling into a local optimum prematurely or overfitting during the training process, making the positioning accuracy of the trained positioning model higher, thereby solving the problem of low accuracy of the device positioning algorithm based on signal strength in the prior art.
[0073] The above description is only a description of the preferred embodiments of the present invention and does not limit the scope of the present invention in any way. Any changes and modifications made by those of ordinary skill in the art of the present invention based on the above disclosure belong to the protection scope of the technical solution of the present invention.
Claims
1. A training method, characterized in that, For training a device positioning model based on signal strength, the training method includes the following steps: Construct a first model and a second model, wherein the input parameters of the first model include signal strength data, the output parameters of the first model include positioning coordinates, and the output parameters of the second model are the signal strength data; The output end of the first model for outputting the positioning coordinates is connected to the input end of the second model to obtain a training model; Train the training model based on an objective function, wherein the objective function is calculated based at least on the output result of the first model and the output result of the training model; The trained first model is configured as the device positioning model; The positioning coordinates are the x coordinate, y coordinate, and z coordinate of the signal source in the reference coordinate system, and the signal strength data is the signal strength of the signal source received by the anchor point; The first model includes four input channels, and each input channel corresponds to a column of the following matrix: Among them, RSSI i represents the signal strength of the signal source received by the i-th anchor point, x i represents the x coordinate of the i-th anchor point in the reference coordinate system, y i represents the y coordinate of the i-th anchor point in the reference coordinate system, z i represents the z coordinate of the i-th anchor point in the reference coordinate system, w represents the total number of anchor points, i represents the serial number of the anchor point, and the value range of i is 1 to w; The input parameters of the second model include distance data in a preset format. The output terminal of the first model for outputting the positioning coordinates is connected to the input terminal of the second model through a coordinate regression module. The distance data in the preset format is [D1, D2, D3, S1, S2, S3], where D1 = [d1, …, d w , s i = LeakyRelu(m·d i +k); where d i represents the Euclidean distance between the i-th said anchor point and the signal source, and both m and k are trainable parameters; The second model includes six input channels, and each input channel corresponds to one of [D1, D2, D3, S1, S2, S3].
2. The training method according to claim 1, characterized in that, The output parameters of the first model further include area category parameters.
3. The training method according to claim 1, characterized in that, The first model includes a first convolutional layer and a fully connected layer. The first convolutional layer includes a 1×1 convolutional kernel with f channels. The first convolutional layer outputs four first intermediate tensors of 1×w×f. After the first intermediate tensors are fused, a first fused tensor of 1×w×f is obtained. The fully connected layer calculates based on the first fused tensor and outputs the positioning coordinates, where f is a preset parameter.
4. The training method according to claim 3, characterized in that, The second model includes a second convolutional layer. The second convolutional layer includes a 1×1 convolutional kernel with f channels. The second convolutional layer outputs six second intermediate tensors of 1×w×f. After the second intermediate tensors are accumulated, a second fused tensor of 1×w×f is obtained. The second fused tensor performs addition along the third dimension for calculation to obtain a third fused tensor of 1×w×1, and the third fused tensor is configured to output the signal strength data, where f is a preset parameter.
5. The training method according to claim 4, characterized in that, The penalty term of the objective function includes the error of the first model, the error of the training model, and a connection loss term. The connection loss term is calculated based on the following formula: Diff max = max(Diff mae ); Among them, Diff max represents the connection loss term, Diff mae [i] represents the intermediate calculation term corresponding to the i-th anchor point, FusionMat i,j represents the element with the serial number (1, i, j) in the first fusion tensor, ReconMat i,j represents the element with the serial number (1, i, j) in the second fusion tensor, and the value range of j is 1 to f.
6. A positioning method, characterized in that, The positioning method obtains a positioning result based on the device positioning model, and the device positioning model is trained based on the training method according to any one of claims 1 to 5.
Citation Information
Patent Citations
WiFi positioning method and server and positioning model establishing method
CN106792769A
Signal-strength-based deep learning regression fusion positioning method
CN109151995A