Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is obvious that the described embodiments are some, but not all embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In the prior art, a ranging model in an indoor positioning algorithm based on RSSI ranging is as follows:
RSSI(d)=-10n log10d+A;
wherein RSSI (d) is the distance from the target device to the transmitting enddOf (2) a signalThe strength of (a) is high,Aandnis an environmental parameter. As shown in table 1, is a distribution table of environmental parameter values;
as can be seen from Table 1, different environments correspond to different environmental parameters A and n, and the environmental parameters of the different environments are required to be set through manual experience, so that the accuracy of the ranging model is greatly influenced by manual work, the robustness is low, the accurate ranging model is difficult to establish, the ranging accuracy is influenced, and the reliability and the stability of a positioning result are difficult to guarantee.
In the embodiment, the distance between the target device and each target transmitting terminal is obtained by using the neural network model according to the signal received by the target device, and then the positioning position of the target device is automatically and accurately obtained according to the distance between the target device and each target transmitting terminal, so that not only are environmental parameters of artificial experience equipment effectively avoided, less artificial interference is caused, and accurate positioning of the device can be realized, but also the distance between the target device and each target transmitting terminal can be automatically and accurately output as long as the signal received by the target device is input into the neural network model, so that different environments are effectively avoided being considered, and the problems of low ranging efficiency and poor stability caused by selecting different ranging models according to different environments are solved.
The device location method of the present invention is described below in conjunction with fig. 1, including:
step 101, inputting a signal received by target equipment into a neural network model to obtain the distance between the target equipment output by the neural network model and each target transmitting terminal; wherein the signal is transmitted by each target transmitting terminal; the neural network model is trained and obtained by taking a sample signal received by sample equipment as a sample and taking the actual distance between the sample equipment and each sample transmitting end as a sample label; the sample signals are transmitted by each sample transmitting terminal.
The target device is a device that needs to be located, and may be a mobile phone, a wearable smart device, a tablet computer, and other smart devices, which is not specifically limited in this implementation.
It should be noted that the sample device and the target device are the same type of device.
The target transmitting end may transmit a wireless signal to the target device by wireless transmission, such as bluetooth or WLAN, which is not specifically limited in this embodiment. The number of the target transmitting terminals is multiple, and the target transmitting terminals can be set according to actual requirements.
The structure of the neural network model can be set according to actual requirements, for example, the number of layers of hidden layers in the neural network model, the number of neuron nodes of each hidden layer, the activation function of each hidden layer, and the like can be set according to actual requirements.
The neural network model may be a Back Propagation (BP) neural network model or other neural network models such as a recurrent neural network, which is not specifically limited in this embodiment.
The device positioning method in this embodiment is described below by taking a BP neural network as an example.
As shown in fig. 2, the BP neural network model is a multi-layer feedforward neural network, which mainly includes an input layer, an implicit layer and an output layer, and the feedforward network is trained by error back propagation without knowing the mapping relation equation in advance. The BP neural network model is mainly divided into two stages, wherein the first stage is the forward propagation of signals, and the signals pass through a hidden layer from an input layer and finally reach an output layer; the second stage is the back propagation of error, from the output layer to the hidden layer and finally to the input layer, and the parameters from the hidden layer to the output layer are adjusted in sequence.
In the forward propagation stage, for each hidden layer, multiplying each input information by the corresponding weight, then adding the multiplied value to the corresponding bias value, and finally calculating through an excitation function to obtain the corresponding output value. The input information of the first hidden layer is input information input through the input layer, namely, a signal received by the target device, and the input information of the other hidden layers is an output value of an upper hidden layer adjacent to the first hidden layer.
Wherein, the formula for calculating the output of each hidden layer is as follows:
wherein, IjIs a neuronjNet input value of, WijIs a neuronjTo the neuroniThe weight of (2); x is the number ofiIs a neuroniAn input value of (a); b isjIs a neuronjOffset value of (1), OjIs a neuronjThe output value of (d);nis the total number of input values.
In the back propagation stage, carrying out error analysis on the output value and the true value, and calculating the deviation between the output value and the true value of the BP neural network, wherein the calculation formula of the deviation is as follows:
in the formula: ejNeurons being the output layerjThe deviation value of (a); t isjAre true values.
After the deviation value of the output layer is obtained, the error of the output layer is used for calculating the upper layer error in each hidden layer until the input layer is calculated, and the weight of the neural network model is updated by using a gradient descent method until the distance output by the neural network model is close to the actual distance. The calculation formula is as follows:
in the formula, Wij 'The updating amount of the weight value; b isj 'For the amount of update of the offset value,lis the learning rate. The weight is the relationship between two adjacent layers of neurons, and the threshold is the relationship within each neuron. And optimizing the weight and the offset value through a training network until the optimal weight and the optimal offset value are obtained.
Optionally, the step of inputting the signal received by the target device into the neural network model and outputting the distance between the target device and each target transmitting terminal comprises,
first, the neural network model needs to be trained before inputting the signal received by the target device into the neural network model. When training the neural network model, the sample signal received by the sample device and the actual distance between the sample device and each sample transmitting end may be directly input to the neural network model, or after performing calculation processing on the signal, the calculation processing result and the actual distance are input to the neural network model, for example, the strength of the signal is calculated, and the strength of the signal is input to the neural network model, which is not specifically limited in this embodiment.
The sample signal or the calculation processing result received by the sample device may also be input to the neural network model after being subjected to one or more kinds of preprocessing, which is not specifically limited in this embodiment.
Then, a deviation value between the distance output by the neural network model and the actual distance is calculated. And adjusting parameters of the neural network model according to the deviation value, thereby realizing the optimization of the parameters in the neural network model.
Then, the mobile terminal is used for collecting signals received by the target equipment in real time and recording the signals in real time; the acquisition mode can be that the acquisition is stopped when the duration of the received signal reaches the preset time; the number of signals received by the target device is one or more, which is not specifically limited in this embodiment.
And finally, inputting the signals received by the target equipment into the neural network model, and outputting the distance between the target equipment and each target transmitting terminal.
According to the method, parameters of the neural network model are automatically optimized according to the samples and the sample labels, the optimized model can be suitable for equipment positioning under various environments, and the robustness is good; once the optimal neural network model is obtained, the neural network model can be repeatedly used to obtain the distance between the target equipment and each target transmitting terminal, and the usability is strong; and the signal received by the target equipment is directly input into the neural network model, so that the distance between the target equipment and each target transmitting terminal can be accurately obtained, the manual setting of model parameters is avoided, the accuracy of distance calculation is effectively improved, and the reliability and the stability of a positioning result are further improved.
And 102, calculating the positioning position of the target equipment according to the distance between the target equipment and each target transmitting terminal.
Optionally, after the distances between the target device and each target transmitting end are obtained, the distances between the target device and all the target transmitting ends may be directly combined to calculate the positioning position of the target device, or the distances between the target device and each target transmitting end may be first screened, the distances satisfying the conditions are selected, and then the positioning position of the target device is calculated by combining the distances satisfying the conditions. This embodiment is not particularly limited thereto.
Optionally, the calculation method may be a back-intersection method, or a positioning calculation method such as a centroid positioning method, which is not specifically limited in this embodiment.
According to the embodiment, the distance between the target equipment and each target transmitting terminal is accurately acquired by using a neural network model according to the signal received by the target equipment acquired in real time, and then the target equipment is automatically positioned according to the accurate distance between the target equipment and each target transmitting terminal, so that on one hand, the accuracy of distance estimation is improved, and the reliability and stability of a positioning result are effectively ensured; on the other hand, the neural network model can be applied to distance calculation under various environments, and has good robustness.
On the basis of the foregoing embodiments, in this embodiment, the calculating the location position of the target device according to the distance between the target device and each target transmitting end includes: sorting the distances in the order from small to large, and forming a target distance set by a plurality of distances at the front of a sorting result; wherein the number of distances in the target distance set is greater than or equal to 3; for each distance in the target set, fitting a circular area corresponding to each distance according to each distance and the position coordinate of the target transmitting end corresponding to each distance; under the condition that the circular areas corresponding to all the distances in the target set are intersected, calculating intersection point coordinates in the intersection areas of the circular areas corresponding to all the distances in the target set; and calculating the positioning position of the target equipment according to the intersection point coordinates.
Optionally, after the distances between the target device and each target transmitting end are obtained, all the distances may be sorted in the order from small to large, then a plurality of distances with the top sorting result are selected from all the distances, and the selected plurality of distances form a target distance set. The number of distances included in the target distance set may be set according to actual requirements, such as 3, 4, or 5, which is not specifically limited in this embodiment.
For example, the distances from the target devices output by the neural network model to all target transmitting terminals are sorted from small to large, the sorting result is { d1, d2, …, dM }, and the three distances with the top sorting result are selected to form a target distance set, namely the target distance set is { d1, d2, d3 }.
And then, fitting a circular area corresponding to each distance by taking each distance in the target distance set as a radius and the position coordinate of the target transmitting end corresponding to each distance as a circle center.
Then, whether the circular areas corresponding to all the distances in the target set are intersected pairwise or not is judged, and if yes, intersection point coordinates in the intersection area after the circular areas corresponding to all the distances in the target distance set are intersected are calculated.
For example, the target distance set includes three distances, and as shown in fig. 3, intersection coordinates in an intersection region of circular regions corresponding to the three distances in the target distance set are A, B and C, respectively.
If the two circular regions are not intersected in pairs, the signals received by the target equipment are collected again, the signals are input into the neural network model again, whether the circular regions corresponding to all the distances in the target distance set are intersected or not is judged again until the circular regions corresponding to all the distances in the target set are intersected in pairs.
And finally, calculating the positioning position of the target equipment according to the intersection point coordinates.
Alternatively, according to the intersection coordinates, the positioning position of the target device may be calculated by obtaining a minimum circumscribed circle or a minimum outer polygon containing all the intersection coordinates according to the intersection coordinates, or by directly connecting the intersection coordinates to form a polygon, and then calculating a centroid of the minimum circumscribed circle, the minimum outer polygon, or the polygon as the positioning position of the target device. The present embodiment does not specifically limit the manner of calculating the location position of the target device.
Since the farther the signal travels, the less the impact on the target device, the greater the likelihood of interference. Therefore, in order to accurately position the position of the target device, in this embodiment, all distances are sorted in the order from small to large, and the positioning position of the target device is calculated according to a plurality of distances in front of the sorting result, that is, the distance is relatively small, and the target transmitting end corresponding to the relatively small distance, so that the influence of the interference information on the positioning result of the target device can be effectively alleviated, and the positioning result is more accurate and more stable.
On the basis of the foregoing embodiment, in this embodiment, the calculating the location position of the target device according to the intersection coordinates includes: calculating the centroid coordinates of a polygon formed by the intersection point coordinates based on a weighted centroid algorithm; and taking the centroid coordinate as the positioning position of the target device.
Optionally, based on the intersection coordinates, the step of calculating the location position of the target device comprises,
firstly, connecting all intersection point coordinates in sequence to form a polygon;
then, respectively calculating the abscissa and the ordinate of the centroid coordinate of the polygon based on a weighted centroid algorithm;
and finally, taking the centroid coordinate as the positioning position of the target device.
The following describes the device positioning method by taking an example that the target distance set includes three distances, and the number of intersection coordinates of circular regions corresponding to all the distances in the target set is three.
As shown in fig. 3, two circular areas intersect each other, the intersecting area is a triangle, and the centroid of the triangle is the positioning position of the target device.
Based on the weighted centroid algorithm, the calculation formulas for respectively calculating the abscissa and the ordinate of the centroid coordinate of the polygon are as follows:
in the formula (x)
0,y
0) Is the location of the target device, (X)
A,Y
A)、(X
B,Y
B) And (X)
C,Y
C) Respectively, the coordinates of the three points of intersection A, B, C, d
1、d
2And d
3Respectively representing distances in the target distance set;
、
and
representing the weight of A, B, C points. The larger the radius of the circular area, i.e. the longer the signal propagation distance, the smaller the influence on the point to be measured, and the smaller the weight value. The smaller the radius of the circular area, i.e. the shorter the signal propagation distance, the greater the influence on the point to be measured, and the greater the weight thereof.
In the embodiment, a weighted centroid algorithm is adopted to calculate the centroid coordinate of the polygon formed by the intersection point coordinates, so that the calculation result of the positioning position of the target device is more accurate.
On the basis of the foregoing embodiments, before inputting a signal received by a target device into a neural network model to obtain distances between the target device and each target transmitting end output by the neural network model, the present embodiment further includes: acquiring initial parameters of the neural network model based on a fish swarm algorithm; inputting the sample signals received by the sample equipment into the neural network model to obtain the distance between the sample equipment output by the neural network model and each sample transmitting end; obtaining a loss function of the neural network model according to the distance between the sample equipment and each sample transmitting end and the actual distance between the sample equipment and each sample transmitting end output by the neural network model; and optimizing initial parameters of the neural network model according to the loss function.
The initial parameters of the neural network model comprise weight values and bias values.
The Fish Swarm Algorithm may be a Fish Swarm Algorithm such as ADAFSA (Adaptive Swarm Algorithm Based on Adaptive Dynamic Neighborhood Structure), which is not specifically limited in this embodiment.
In the ADAFSA, the neighborhood structure of the artificial fish is in dynamic adjustment and changes along with the increase of the iteration times, and the visual field and the step length change along with the change of the domain structure; in the early stage of the algorithm, the visual field and the step length are large, and the global optimization capability is met; in the later stage of the algorithm, the visual field and the step length are small, and the local optimization capability is enhanced.
In the first placetAt the time of second iteration, the artificial fishpThe set of neighbor fish within the current neighborhood may be represented as:
wherein N is
p(t) is
tAt the time of second iteration, the artificial fish
pAll neighbor fish sets of (1); d
p(t) is an artificial fish
pA set of distances to other artificial fish at the t-th iteration; f (t) is
tCurrent artificial fish in sub-iteration
pThe number of neighbor fishes;
is a pair D
p(t) performing a sorting operation; arg (·) is a location identification operation; x
p(t) is
tAt the time of second iteration, the artificial fish
pThe state of (1); n is a radical of
fishThe initial scale of the artificial fish; t is the maximum iteration number; ceil (·) is an operation that takes an integer toward positive infinity.
In the ADAFSA, the visual field is the average value of the distances between all neighbor fishes in the neighborhood of the artificial fish in the current state and the visual field and the step length change along with the change of the field structure in the iteration process. Wherein the visual field LvisualAnd step length LstepThe specific calculation formula of (A) is as follows:
wherein,
is the view step coefficient.
At the t-th iteration, the field of view L is acquiredvisualAnd step length LstepAnd then, according to the state, the visual field and the step length of the artificial fish, the optimal behavior of the herding behavior, the foraging behavior and the rear-end collision behavior can be executed.
For clustering behavior, in the neighborhood of artificial fish, the artificial fish is searchedpOf the neighborhood inner central positionCThe specific calculation formula is as follows:
wherein, XmpIs an artificial fishpOf the neighborhood ofm;
Then, for the current artificial fishpThe state of (2) is updated, and the calculation formula is as follows:
wherein, Xmext(p) is the renewed artificial fishpRand is a random function.
For rear-end collisions, intAt the time of second iteration, the artificial fishpIs XpFood concentration of YpFinding the current artificial fish XpArtificial fish X with highest food concentration in neighborhood structuremax,XmaxCorresponding to a food concentration of Ymax(ii) a If Y ismax>YpIf so, the rear-end collision is executed, otherwise, the foraging behavior is continued. The calculation formula for executing the rear-end collision behavior is as follows:
for foraging behavior, whentDuring the second iteration, randomly finding an artificial fish in the visual field range, and setting the state as XKFood concentration of YKIf Y isK>YpThen artificial fish XpMove to XK(ii) a If no more than Y is found after the set repeated exploration timespThe food concentration of (2) is randomly moved by one step.
Optionally, the step of training the neural network model comprises,
determining the structure of a neural network model, including the number of hidden layers of the neural network model and the number of neurons in each layer; determining parameter settings for fish school algorithms, including manual workInitial size N of fish school
fishCoefficient of visual step
Maximum iteration number T, repeated exploration number N;
step (2), taking the initial parameters of the neural network model as the state of the artificial fish, and taking the derivative of the training error of the neural network model as the food concentration of the artificial fish;
step (3), the state of the artificial fish is iteratively optimized by using a fish swarm algorithm, and the state of the artificial fish iterated for the last time is used as the optimal state of the artificial fish;
step (4), taking the optimal state of the artificial fish as an initial parameter of a neural network model;
inputting the sample signals received by the sample equipment and the actual distances from the sample equipment to each sample transmitting end into a neural network model, and calculating the mean square error between the distances output by the neural network model and the actual distances;
and (6) continuously adjusting parameters in the neural network model by using a gradient descent method until the error between the output value trained by the neural network model and the true value is less than a preset value or the training times are reached.
In the prior art, during the training process of the neural network model, random parameters are usually adopted to initialize the parameters of the neural network model, if the initial parameter selection is inaccurate, the neural network model is easy to fall into local optimization, and not only is the convergence speed of the neural network model slow, but also the performance of the neural network model is poor and the generalization capability is low.
In the embodiment, the optimal initial parameter of the neural network model is obtained by utilizing the global optimization capability of the fish swarm algorithm, so that the initial parameter of the neural network model is not a random number generated randomly any more but an optimal value, the network oscillation problem of the neural network model is effectively solved, the local optimization is avoided, and the neural network model is rapidly converged.
On the basis of the foregoing embodiments, in this embodiment, the inputting a signal received by a target device into a neural network model to obtain distances between the target device and each target transmitting end output by the neural network model includes: preprocessing a signal received by the target device; wherein the preprocessing comprises normalization processing and/or filtering processing; and inputting the preprocessed signals into the neural network model to obtain the distance between the target equipment output by the neural network model and each target transmitting terminal.
The number of the signals sent by each target transmitting terminal is multiple, and the specific number can be set according to actual requirements, namely the input information of the neural network model is multiple.
Optionally, in order to prevent the smaller value of the input information from being overwhelmed by the larger value, the input information is normalized to a smaller interval, such as the range of [ -1,1 ]. The normalization method includes maximum and minimum normalization and standard normalization, which is not specifically limited in this embodiment.
In addition, the distance calculation result is inaccurate due to a certain number of noise points in the acquired original signal. In order to further eliminate the noise points in the original signal, the noise in the original signal may be filtered.
Optionally, the signal received by the target device may be preprocessed in one or more of the above processing manners before being input into the neural network model, which is not specifically limited in this embodiment.
It should be noted that the signal received by the target device needs to be preprocessed in a manner suitable for the signal received by the sample device.
And after the preprocessed signals are obtained, inputting the preprocessed signals into a neural network model, and obtaining the distance between the target equipment and each target transmitting terminal.
The embodiment preprocesses the signal received by the target device, so that the influence of noise points on the distance estimation result can be eliminated, and the influence of signals with different dimensions on the distance estimation result can be eliminated, thereby ensuring the reliability and stability of distance estimation and further improving the reliability and stability of the positioning result.
On the basis of the above embodiment, the preprocessing in this embodiment is filtering processing; accordingly, the preprocessing the signal received by the target device includes: determining whether each signal transmitted by each target transmitting terminal received by the target equipment is an abnormal value or not based on a Grubbs test method; and performing Gaussian filtering on signals except the abnormal value in the signals transmitted by each target transmitting end received by the target equipment, and then performing mean filtering.
The device localization method in the present embodiment will be described below by taking the intensity of a signal received by a target device as input information of a neural network model as an example.
Optionally, in order to avoid the influence of the abnormal signal on the positioning result, preprocessing the signal received by the target device by using hybrid filtering of a grubbs test method is adopted to remove the abnormal signal in the signal received by the target device, so that the reliability and stability of the positioning result are ensured.
The grubbs test method has the advantage that the two most important parameters in the normal distribution, i.e. the mean value and the standard deviation, can be introduced in the process of judging the acceptance of the suspicious values. Therefore, the detection accuracy of the Grubbs detection method is higher. The data of the signal strength collected at the same position generally follows normal distribution, that is, the strength of a plurality of signals transmitted by the same target transmitting terminal received by the target device follows normal distribution.
Therefore, the method can effectively eliminate the abnormal value existing in the strength of the signal transmitted by any target transmitting terminal and received by the target equipment, and comprises the following specific steps,
firstly, the RSSI values collected at the same position are sequenced from small to large, and the mean value of the intensities of all the signals transmitted by all the target transmitting terminals received by the target equipment is calculated
And a variance S, wherein the specific calculation formula is as follows:
wherein the RSSIhThe signal strength of the H-th signal transmitted by any target transmitting terminal received by the target equipment is H, and the H is the number of the signal strengths of all the signals transmitted by any target transmitting terminal received by the target equipment.
Then, according to the predetermined confidence coefficient and the data number, searching the corresponding threshold value in the Lubrus critical value table
Wherein
generally taking 0.05; and calculate statistics
;
Judging whether the statistic G is larger than the threshold value
If yes, determining RSSI
hAs an abnormal value, the RSSI
hRemoving all signals transmitted by each target transmitting terminal from the target equipment, and setting the intensity of all signals except abnormal values in the intensity of the signals transmitted by each target transmitting terminal received by the target equipment as RSSI _ G = { RSSI _ G =
1,RSSI_G
2,⋯,RSSI_G
u}。
And then, performing Gaussian filtering on the RSSI _ G and then performing mean filtering, wherein the calculation formula of the Gaussian filtering is as follows:
wherein,
and
respectively the mean and the variance of RSSI G,
uis the number of strengths of the signals in RSSI _ G.
Then will be within RSSI _ G, and
in the interval
The signal intensity of the inner is recorded as
(ii) a Then, all are calculated
As a final filtering result, the specific calculation formula is:
and taking the final filtering result as the input of the neural network model.
In the prior art, in a complex scene, the strength of a signal received by a target device has gross errors, which causes a large jump phenomenon of the strength of the acquired signal, thereby affecting the distance calculation accuracy and being difficult to ensure the reliability and stability of a positioning result.
In the embodiment, through the grubbs test method, the gaussian filtering and the mean filtering, abnormal values in the strength of the signal received by the target device can be effectively eliminated, so that the reliability and the stability of the positioning result are ensured.
As shown in fig. 4, which is a complete flow chart of the device location method, the specific steps include,
acquiring the intensity of a sample signal at different positions, recording the actual distance between sample equipment and a sample transmitting end of the sample signal, and taking the intensity and the actual distance of the sample signal as training sample data;
and (2) determining the structure of the neural network model, wherein the structure comprises information such as the number of neurons in each layer, the number of hidden layers and the like. Initializing an initialization size N comprising an artificial fish shoal
fishCoefficient of visual step
Maximum iteration number T, repeated exploration number N;
step (3), operating an ADAFSA algorithm to obtain the optimal state of the artificial fish;
step (4), the optimal state of the artificial fish is used as an initial weight value and an initial bias value of the neural network model;
step (5), inputting the sample data into a neural network model optimized by an ADAFSA algorithm, and calculating a mean square error;
step (6), adjusting the initial weight and the initial bias value in the neural network model by using a gradient descent method until the error between the output value and the actual value of the trained neural network model is less than a preset value or the training times are reached;
step (7), storing the trained neural network model;
step (8) measuring a wireless signal received by target equipment by using a mobile terminal, recording, and stopping measurement when the receiving time reaches a preset time threshold;
in the step (9), because a certain number of noise points exist in the acquired original signal strength, the noise in the wireless signal needs to be filtered;
and (10) inputting the received signal strength into the trained neural network model, estimating the distance between the target equipment and each target transmitting terminal, and acquiring a distance set. Then, sorting the distances from small to large, and selecting a plurality of circular areas corresponding to the distances with small distances according to a sorting result to intersect;
and (11) calculating the intersection point coordinates in the intersection region, calculating the centroid coordinates of a triangle formed by the intersection point coordinates by using a weighted centroid algorithm, and taking the centroid coordinates as the positioning position of the target equipment.
The device positioning system provided by the present invention is described below, and the device positioning system described below and the device positioning method described above may be referred to correspondingly.
As shown in fig. 5, the device positioning system provided in this embodiment includes an output module 501 and a positioning module 502, where:
the output module 501 is configured to input a signal received by a target device into a neural network model, so as to obtain distances from the target device to each target transmitting end, where the distances are output by the neural network model; wherein the signal is transmitted by each target transmitting terminal; the neural network model is trained and obtained by taking a sample signal received by sample equipment as a sample and taking the actual distance between the sample equipment and each sample transmitting end as a sample label; the sample signals are transmitted by each sample transmitting terminal.
The target device is a device that needs to be located, and may be a mobile phone, a wearable smart device, a tablet computer, and other smart devices, which is not specifically limited in this implementation.
It should be noted that the sample device and the target device are the same type of device.
The target transmitting end may transmit a wireless signal to the target device by wireless transmission, such as bluetooth or WLAN, which is not specifically limited in this embodiment. The number of the target transmitting terminals is multiple, and the target transmitting terminals can be set according to actual requirements.
The structure of the neural network model can be set according to actual requirements, for example, the number of layers of hidden layers in the neural network model, the number of neuron nodes of each hidden layer, the activation function of each hidden layer, and the like can be set according to actual requirements.
The neural network model may be a BP neural network model or other neural network models such as a recurrent neural network, which is not specifically limited in this embodiment.
The device positioning method in this embodiment is described below by taking a BP neural network as an example.
As shown in fig. 2, the BP neural network model is a multi-layer feedforward neural network, which mainly includes an input layer, an implicit layer and an output layer, and the feedforward network is trained by error back propagation without knowing the mapping relation equation in advance. The BP neural network model is mainly divided into two stages, wherein the first stage is the forward propagation of signals, and the signals pass through a hidden layer from an input layer and finally reach an output layer; the second stage is the back propagation of error, from the output layer to the hidden layer and finally to the input layer, and the parameters from the hidden layer to the output layer are adjusted in sequence.
In the forward propagation stage, for each hidden layer, multiplying each input information by the corresponding weight, then adding the multiplied value to the corresponding bias value, and finally calculating through an excitation function to obtain the corresponding output value. The input information of the first hidden layer is input information input through the input layer, namely, a signal received by the target device, and the input information of the other hidden layers is an output value of an upper hidden layer adjacent to the first hidden layer.
Wherein, the formula for calculating the output of each hidden layer is as follows:
wherein, IjIs a neuronjNet input value of, WijIs a neuronjTo the neuroniThe weight of (2); x is the number ofiIs a neuroniAn input value of (a); b isjIs a neuronjOffset value of (1), OjIs a neuronjThe output value of (d);nis the total number of input values.
In the back propagation stage, carrying out error analysis on the output value and the true value, and calculating the deviation between the output value and the true value of the BP neural network, wherein the calculation formula of the deviation is as follows:
in the formula: ejNeurons being the output layerjThe deviation value of (a); t isjAre true values.
After the deviation value of the output layer is obtained, the error of the output layer is used for calculating the upper layer error in each hidden layer until the input layer is calculated, and the weight of the neural network model is updated by using a gradient descent method until the distance output by the neural network model is close to the actual distance. The calculation formula is as follows:
in the formula, Wij 'The updating amount of the weight value; b isj 'For the amount of update of the offset value,lis the learning rate. The weight is the relationship between two adjacent layers of neurons, and the threshold is the relationship within each neuron. And optimizing the weight and the offset value through a training network until the optimal weight and the optimal offset value are obtained.
Optionally, the step of inputting the signal received by the target device into the neural network model and outputting the distance between the target device and each target transmitting terminal comprises,
first, the neural network model needs to be trained before inputting the signal received by the target device into the neural network model. When training the neural network model, the sample signal received by the sample device and the actual distance between the sample device and each sample transmitting end may be directly input to the neural network model, or after performing calculation processing on the signal, the calculation processing result and the actual distance are input to the neural network model, for example, the strength of the signal is calculated, and the strength of the signal is input to the neural network model, which is not specifically limited in this embodiment.
The sample signal or the calculation processing result received by the sample device may also be input to the neural network model after being subjected to one or more kinds of preprocessing, which is not specifically limited in this embodiment.
Then, a deviation value between the distance output by the neural network model and the actual distance is calculated. And adjusting parameters of the neural network model according to the deviation value, thereby realizing the optimization of the parameters in the neural network model.
Then, the mobile terminal is used for collecting signals received by the target equipment in real time and recording the signals in real time; the acquisition mode can be that the acquisition is stopped when the duration of the received signal reaches the preset time; the number of signals received by the target device is one or more, which is not specifically limited in this embodiment.
And finally, inputting the signals received by the target equipment into the neural network model, and outputting the distance between the target equipment and each target transmitting terminal.
According to the method, parameters of the neural network model are automatically optimized according to the samples and the sample labels, the optimized model can be suitable for equipment positioning under various environments, and the robustness is good; once the optimal neural network model is obtained, the neural network model can be repeatedly used to obtain the distance between the target equipment and each target transmitting terminal, and the usability is strong; and the signal received by the target equipment is directly input into the neural network model, so that the distance between the target equipment and each target transmitting terminal can be accurately obtained, the manual setting of model parameters is avoided, the accuracy of distance calculation is effectively improved, and the reliability and the stability of a positioning result are further improved.
The positioning module 502 is configured to calculate a positioning position of the target device according to a distance between the target device and each target transmitting end.
Optionally, after the distances between the target device and each target transmitting end are obtained, the distances between the target device and all the target transmitting ends may be directly combined to calculate the positioning position of the target device, or the distances between the target device and each target transmitting end may be first screened, the distances satisfying the conditions are selected, and then the positioning position of the target device is calculated by combining the distances satisfying the conditions. This embodiment is not particularly limited thereto.
Optionally, the calculation method may be a back-intersection method, or a positioning calculation method such as a centroid positioning method, which is not specifically limited in this embodiment.
According to the embodiment, the distance between the target equipment and each target transmitting terminal is accurately acquired by using a neural network model according to the signal received by the target equipment acquired in real time, and then the target equipment is automatically positioned according to the accurate distance between the target equipment and each target transmitting terminal, so that on one hand, the accuracy of distance estimation is improved, and the reliability and stability of a positioning result are effectively ensured; on the other hand, the neural network model can be applied to distance calculation under various environments, and has good robustness.
On the basis of the above embodiment, the positioning module in this embodiment is specifically configured to: sorting the distances in the order from small to large, and forming a target distance set by a plurality of distances at the front of a sorting result; wherein the number of distances in the target distance set is greater than or equal to 3; for each distance in the target set, fitting a circular area corresponding to each distance according to each distance and the position coordinate of the target transmitting end corresponding to each distance; under the condition that the circular areas corresponding to all the distances in the target set are intersected, calculating intersection point coordinates in the intersection areas of the circular areas corresponding to all the distances in the target set; and calculating the positioning position of the target equipment according to the intersection point coordinates.
On the basis of the above embodiment, the positioning module in this embodiment is further configured to: calculating the centroid coordinates of a polygon formed by the intersection point coordinates based on a weighted centroid algorithm; and taking the centroid coordinate as the positioning position of the target device.
On the basis of the above embodiments, the present embodiment further includes a training module, specifically configured to: acquiring initial parameters of the neural network model based on a fish swarm algorithm; inputting the sample signals received by the sample equipment into the neural network model to obtain the distance between the sample equipment output by the neural network model and each sample transmitting end; obtaining a loss function of the neural network model according to the distance between the sample equipment and each sample transmitting end and the actual distance between the sample equipment and each sample transmitting end output by the neural network model; and optimizing initial parameters of the neural network model according to the loss function.
On the basis of the foregoing embodiments, in this embodiment, the output module is further configured to: preprocessing a signal received by the target device; wherein the preprocessing comprises normalization processing and/or filtering processing; and inputting the preprocessed signals into the neural network model to obtain the distance between the target equipment output by the neural network model and each target transmitting terminal.
On the basis of the above embodiment, the preprocessing in this embodiment is filtering processing; correspondingly, the system further comprises a preprocessing module, which is specifically used for: determining whether each signal transmitted by each target transmitting terminal received by the target equipment is an abnormal value or not based on a Grubbs test method; and performing Gaussian filtering on signals except the abnormal value in the signals transmitted by each target transmitting end received by the target equipment, and then performing mean filtering.
Fig. 6 illustrates a physical structure diagram of an electronic device, which may include, as shown in fig. 6: a processor (processor)601, a communication Interface (Communications Interface)602, a memory (memory)603 and a communication bus 604, wherein the processor 601, the communication Interface 602 and the memory 603 complete communication with each other through the communication bus 604. The processor 601 may invoke logic instructions in the memory 603 to perform a device location method comprising: inputting signals received by target equipment into a neural network model to obtain the distance between the target equipment and each target transmitting end output by the neural network model; wherein the signal is transmitted by each target transmitting terminal; calculating the positioning position of the target equipment according to the distance between the target equipment and each target transmitting terminal; the neural network model is trained and obtained by taking a sample signal received by sample equipment as a sample and taking the actual distance between the sample equipment and each sample transmitting end as a sample label; the sample signals are transmitted by each sample transmitting terminal.
In addition, the logic instructions in the memory 603 may be implemented in the form of software functional units and stored in a computer readable storage medium when the logic instructions are sold or used as independent products. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
In another aspect, the present invention also provides a computer program product, the computer program product comprising a computer program, the computer program being storable on a non-transitory computer-readable storage medium, wherein when the computer program is executed by a processor, a computer is capable of executing the method for positioning a device provided by the above methods, the method comprising: inputting signals received by target equipment into a neural network model to obtain the distance between the target equipment and each target transmitting end output by the neural network model; wherein the signal is transmitted by each target transmitting terminal; calculating the positioning position of the target equipment according to the distance between the target equipment and each target transmitting terminal; the neural network model is trained and obtained by taking a sample signal received by sample equipment as a sample and taking the actual distance between the sample equipment and each sample transmitting end as a sample label; the sample signals are transmitted by each sample transmitting terminal.
In yet another aspect, the present invention also provides a non-transitory computer-readable storage medium having stored thereon a computer program, which when executed by a processor, implements a method for positioning a device provided by the above methods, the method comprising: inputting signals received by target equipment into a neural network model to obtain the distance between the target equipment and each target transmitting end output by the neural network model; wherein the signal is transmitted by each target transmitting terminal; calculating the positioning position of the target equipment according to the distance between the target equipment and each target transmitting terminal; the neural network model is trained and obtained by taking a sample signal received by sample equipment as a sample and taking the actual distance between the sample equipment and each sample transmitting end as a sample label; the sample signals are transmitted by each sample transmitting terminal.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. With this understanding in mind, the above-described technical solutions may be embodied in the form of a software product, which can be stored in a computer-readable storage medium such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in the embodiments or some parts of the embodiments.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.