CN110972112A - Subway running direction determining method, device, terminal and storage medium - Google Patents

Subway running direction determining method, device, terminal and storage medium Download PDF

Info

Publication number
CN110972112A
CN110972112A CN201911259924.2A CN201911259924A CN110972112A CN 110972112 A CN110972112 A CN 110972112A CN 201911259924 A CN201911259924 A CN 201911259924A CN 110972112 A CN110972112 A CN 110972112A
Authority
CN
China
Prior art keywords
acceleration data
subway
data
acceleration
nth
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201911259924.2A
Other languages
Chinese (zh)
Other versions
CN110972112B (en
Inventor
刘文龙
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Jinsheng Communication Technology Co ltd
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Shanghai Jinsheng Communication Technology Co ltd
Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Jinsheng Communication Technology Co ltd, Guangdong Oppo Mobile Telecommunications Corp Ltd filed Critical Shanghai Jinsheng Communication Technology Co ltd
Priority to CN201911259924.2A priority Critical patent/CN110972112B/en
Publication of CN110972112A publication Critical patent/CN110972112A/en
Priority to PCT/CN2020/134578 priority patent/WO2021115268A1/en
Application granted granted Critical
Publication of CN110972112B publication Critical patent/CN110972112B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/30Services specially adapted for particular environments, situations or purposes
    • H04W4/40Services specially adapted for particular environments, situations or purposes for vehicles, e.g. vehicle-to-pedestrians [V2P]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/02Services making use of location information
    • H04W4/025Services making use of location information using location based information parameters
    • H04W4/027Services making use of location information using location based information parameters using movement velocity, acceleration information

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Navigation (AREA)

Abstract

The embodiment of the application discloses a method, a device, a terminal and a storage medium for determining the running direction of a subway, and belongs to the field of artificial intelligence. The method comprises the following steps: in the subway acceleration stage, acquiring first acceleration data acquired by a linear acceleration sensor, wherein the first acceleration data comprises acceleration data in all directions under a terminal coordinate system; converting the first acceleration data into second acceleration data, wherein the second acceleration data comprises acceleration data of all directions under a world coordinate system; and determining the subway running direction according to the second acceleration data in the target time length. The influence of the terminal posture on the obtained acceleration direction is avoided by converting the first acceleration data collected by the terminal into the second acceleration data, and the problem that the subway running direction is inaccurate due to the fact that a single acceleration direction is unstable can be avoided by comprehensively analyzing the second acceleration data within the target time length.

Description

Subway running direction determining method, device, terminal and storage medium
Technical Field
The embodiment of the application relates to the field of artificial intelligence, in particular to a method, a device, a terminal and a storage medium for determining the operation direction of a subway.
Background
The subway is used as a daily vehicle, and can bring convenient and quick rail transit service for people.
Because the subway operation has directionality, when taking the subway, people need according to destination station and the current station, select to take the subway of corresponding traffic direction. However, the running direction of the subway needs to be judged manually at present, and correspondingly, when the running direction of the taken subway is wrong, a passenger needs to autonomously sense and transfer the subway.
Disclosure of Invention
The embodiment of the application provides a method, a device, a terminal and a storage medium for determining the operation direction of a subway. The technical scheme is as follows:
in one aspect, an embodiment of the present application provides a method for determining a subway running direction, where the method is used for a terminal, and the method includes:
in the subway acceleration stage, acquiring first acceleration data acquired by a linear acceleration sensor, wherein the first acceleration data comprises acceleration data in all directions under a terminal coordinate system;
converting the first acceleration data into second acceleration data, wherein the second acceleration data comprise acceleration data of all directions under a world coordinate system;
and determining the subway running direction according to the second acceleration data in the target time length.
In another aspect, an embodiment of the present application provides an apparatus for determining an operation direction of a subway, where the apparatus is used for a terminal, and the apparatus includes:
the system comprises an acquisition module, a display module and a control module, wherein the acquisition module is used for acquiring first acceleration data acquired by a linear acceleration sensor in the subway acceleration stage, and the first acceleration data comprises acceleration data in each direction under a terminal coordinate system;
the data conversion module is used for converting the first acceleration data into second acceleration data, and the second acceleration data comprises acceleration data in all directions under a world coordinate system;
and the first determining module is used for determining the subway running direction according to the second acceleration data in the target time length.
In another aspect, an embodiment of the present application provides a terminal, where the terminal includes a processor and a memory; the memory stores at least one instruction for execution by the processor to implement the method of determining a direction of travel of a subway as described in the above aspect.
In another aspect, a computer-readable storage medium is provided, which stores at least one instruction for execution by a processor to implement the method for determining the subway running direction according to the above aspect.
In another aspect, a computer program product is provided, which stores at least one instruction that is loaded and executed by a processor to implement the method for determining the subway running direction as described in the above aspect.
By adopting the method for determining the subway running direction provided by the embodiment of the application, when the subway is in an acceleration stage, the terminal acquires acceleration data (first acceleration data) in each direction under a terminal coordinate system through the linear acceleration sensor, and converts the first acceleration data to obtain acceleration data (second acceleration data) in each direction under a world coordinate system, so that the subway running direction is determined according to the second acceleration data in the target time length. The first acceleration data collected by the terminal are converted into the second acceleration data, and due to the uniqueness of the world coordinate system, the influence of the terminal posture on the obtained acceleration direction is avoided, so that the accuracy of determining the subway running direction is improved.
Drawings
Fig. 1 is a flowchart illustrating a method for determining a subway running direction according to an exemplary embodiment of the present application;
fig. 2 is a flowchart illustrating a method for determining a subway running direction according to an exemplary embodiment of the present application;
FIG. 3 is a schematic diagram of a terminal coordinate system and a world coordinate system shown in an exemplary embodiment of the present application;
fig. 4 is a flowchart illustrating a method for determining a subway running direction according to another exemplary embodiment of the present application;
FIG. 5 is a schematic diagram illustrating the direction of Earth's gravity and the direction of magnetic force in accordance with an exemplary embodiment of the present application;
FIG. 6 is a block diagram of a run direction prediction model shown in an exemplary embodiment of the present application;
fig. 7 is a flowchart illustrating a method for determining a subway running direction according to another exemplary embodiment of the present application;
fig. 8 shows a flowchart of a process of determining that a subway is in an acceleration phase according to an exemplary embodiment of the present application;
FIG. 9 is a process diagram illustrating audio data pre-processing according to an exemplary embodiment of the present application;
FIG. 10 illustrates a flow chart of a method of determining whether a user is riding a subway correctly in accordance with an exemplary embodiment of the present application;
fig. 11 is a block diagram illustrating a configuration of a device for determining a subway running direction according to an exemplary embodiment of the present application;
fig. 12 is a block diagram illustrating a structure of a terminal according to an exemplary embodiment of the present application.
Detailed Description
To make the objects, technical solutions and advantages of the present application more clear, embodiments of the present application will be described in further detail below with reference to the accompanying drawings.
Reference herein to "a plurality" means two or more. "and/or" describes the association relationship of the associated objects, meaning that there may be three relationships, e.g., a and/or B, which may mean: a exists alone, A and B exist simultaneously, and B exists alone. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship.
In the related art, the subway running direction is usually determined in two ways, one is to determine the subway running direction through the direction of the instantaneous acceleration: when a user takes a subway, an acceleration sensor in the terminal can record instantaneous acceleration, and the running direction of the subway at the moment can be determined according to the direction of the instantaneous acceleration; the other method is to determine the running direction of the subway through the direction of a compass (electronic compass).
Obviously, by adopting a determination mode of the subway running direction in the related technology, on one hand, the acceleration direction recorded by the acceleration sensor in the terminal is influenced by the terminal posture, namely, the instantaneous acceleration direction detected by the terminal is different when the user holds the terminal in different postures; if the user is in a moving state in the subway, the instantaneous acceleration collected by the acceleration sensor in the terminal not only comprises the acceleration of the subway, but also comprises the acceleration generated by the movement of the user to the terminal; in addition, the subway can generate certain oscillation phenomenon in the acceleration process, so that the running direction of the subway can be determined only by utilizing a certain instantaneous acceleration direction, and the accuracy is low. On the other hand, the operation of the subway is determined by using the electronic compass, and the accuracy of the electronic compass is affected by the operation of the subway, so that the accuracy is low when the operation direction of the subway is determined by directly using the electronic compass.
In order to solve the above problem, an embodiment of the present application provides a method for determining a subway running direction, where the method includes a flow chart shown in fig. 1.
Step 101, acquiring a linear acceleration under a terminal coordinate system.
And 102, converting the linear acceleration under the terminal coordinate system into the acceleration under the world coordinate system through a coordinate system conversion module.
And 103, acquiring acceleration data in a world coordinate system within a period of time.
And 104, inputting the acquired acceleration data in the world coordinate system in a period of time into the operation direction prediction model.
And 105, determining the subway running direction according to the prediction probability of each candidate running direction.
According to the method for determining the subway running direction, linear acceleration under a terminal coordinate system acquired by a terminal is converted into acceleration in a world coordinate system, and due to the uniqueness of the world coordinate system, the influence of the terminal posture on the acquired acceleration direction is avoided, so that the accuracy of determining the subway running direction is improved; in addition, acceleration data in a world coordinate system within a period of time are obtained and input into the operation direction prediction model, so that comprehensive analysis is carried out on the acceleration data within the period of time to determine the operation direction of the subway, and the problem that the operation direction of the subway is determined inaccurately due to instability of a single acceleration direction can be avoided.
Referring to fig. 2, a flowchart of a method for determining a subway running direction according to an exemplary embodiment of the present application is shown. In this embodiment, a method for determining a subway running direction is described as an example, where the method includes:
step 201, in the subway acceleration stage, acquiring first acceleration data acquired by a linear acceleration sensor, wherein the first acceleration data comprises acceleration data in each direction under a terminal coordinate system.
The terminal is provided with a linear acceleration sensor, and data acquired by the linear acceleration sensor is acceleration data after the influence of gravity is eliminated and is acceleration data in a terminal coordinate system.
In a possible implementation manner, when the terminal identifies that the subway is in an acceleration stage, the terminal acquires acceleration data of all directions in a terminal coordinate system through a linear acceleration sensor to obtain first acceleration data in the terminal coordinate system. For example, the first acceleration data may be represented as a vector
Figure BDA0002311332540000041
Wherein xαIs the acceleration component in the X-axis direction of the terminal coordinate system, yαIs the acceleration component in the Y-axis direction of the terminal coordinate system, zαIs the acceleration component in the Z-axis direction of the terminal coordinate system.
Schematically, the terminal coordinate system may be as shown in (a) of fig. 3, and the terminal coordinate system changes with the terminal pose.
Step 202, converting the first acceleration data into second acceleration data, wherein the second acceleration data comprises acceleration data of all directions under a world coordinate system.
The terminal posture can be changed along with different holding postures of the user, so that the terminal coordinate system can be changed at any time, the acceleration direction corresponding to the first acceleration data can be changed at any time, the reference value for determining the subway running direction according to the first acceleration direction is not available, the first acceleration data needs to be converted into second acceleration data corresponding to the world coordinate system, and the world coordinate system cannot be influenced by the terminal posture.
Schematically, the world coordinate system may be as shown in fig. 3 (B), in which the Z axis in the world coordinate system faces vertically upward, the Y axis points to the north, and the X axis points to the east.
In one possible implementation, the first acceleration data is converted into second acceleration data in the world coordinate system according to a data conversion relation between the world coordinate system and the terminal coordinate system. For example, if the relationship between the second acceleration data and the first acceleration data is
Figure BDA0002311332540000042
Wherein the content of the first and second substances,
Figure BDA0002311332540000043
representing second acceleration data, R representing a data conversion relationship between the first acceleration data and the second acceleration data,
Figure BDA0002311332540000044
representing first acceleration data; based on the first acceleration data
Figure BDA0002311332540000045
Wherein x isαIs the acceleration component, y, of the first acceleration data in the X-axis direction under the terminal coordinate systemαIs the acceleration component of the first acceleration data in the Y-axis direction, zαIs a terminalAn acceleration component of the first acceleration data in the Z-axis direction under the coordinate system; second acceleration data may be obtained
Figure BDA0002311332540000046
Wherein x isβIs the acceleration component, y, of the second acceleration data in the X-axis direction under the world coordinate systemβIs the acceleration component of the second acceleration data in the Y-axis direction in the world coordinate system, zβThe acceleration component of the second acceleration data in the Z-axis direction in the world coordinate system.
And step 203, determining the subway running direction according to the second acceleration data in the target time length.
Since the acceleration direction of a single point of the subway in the acceleration stage is very unstable, but the overall direction of the acceleration is stable in the whole acceleration time period, the running direction of the subway is comprehensively judged by using all the acceleration directions of the subway acceleration time in the embodiment of the application.
The target time duration is preset by a developer, and the target time duration can be determined by comprehensively analyzing the acceleration time in the actual operation of the subway by the developer. Optionally, the target duration may be an acceleration duration when the subway is started, or may be a period of time in the acceleration duration.
In one possible implementation mode, the terminal continuously collects the first acceleration data within the target time length, converts the first acceleration data into the second acceleration data and stores the second acceleration data in the terminal so as to perform comprehensive analysis on the acceleration data in the target time. For example, the target duration may be 10s, that is, the terminal continuously acquires the first acceleration data within 10s and converts it into the second acceleration data in real time.
In a possible implementation manner, the terminal performs comprehensive analysis according to the cached second acceleration data to obtain an acceleration direction generally corresponding to the second acceleration data within the target time length, and determines the acceleration direction as the subway running direction.
To sum up, in the embodiment of the application, when the subway is in an acceleration stage, the terminal acquires acceleration data (first acceleration data) in each direction in the terminal coordinate system through the linear acceleration sensor, and converts the first acceleration data to obtain acceleration data (second acceleration data) in each direction in the world coordinate system, so that the subway running direction is determined according to the second acceleration data in the target duration. The first acceleration data collected by the terminal are converted into the second acceleration data, and due to the uniqueness of the world coordinate system, the influence of the terminal posture on the obtained acceleration direction is avoided, so that the accuracy of determining the subway running direction is improved.
In a possible implementation manner, in order to improve the accuracy of determining the subway running direction according to the second acceleration data, a running direction prediction model may be preset in the terminal, and the second acceleration data is used as a model input, so that the current subway running direction is determined according to the output prediction probability of each candidate running direction.
Referring to fig. 4, a flowchart of a method for determining a subway running direction according to another exemplary embodiment of the present application is shown. In this embodiment, a method for determining a subway running direction is described as an example, where the method includes:
step 401, in an acceleration stage of a subway, acquiring first acceleration data acquired by a linear acceleration sensor.
Step 201 may be referred to in the implementation manner of this step, and this embodiment is not described herein again.
Step 402, acquiring the gravity acceleration data acquired by the gravity acceleration sensor and the magnetic data acquired by the magnetometer, wherein the gravity acceleration data and the magnetic data are based on a terminal coordinate system.
The terminal is provided with a gravity acceleration sensor and a magnetometer, the gravity acceleration sensor acquires gravity acceleration data under a terminal coordinate system, and the magnetometer acquires magnetic data under the terminal coordinate system.
In one possible implementation manner, the gravity acceleration data in the terminal coordinate system acquired by the gravity sensor can be represented as
Figure BDA0002311332540000051
Wherein G isxAcceleration component of the gravitational acceleration data in the X-axis direction, GyAcceleration component of the gravitational acceleration data in the Y-axis direction, GyThe acceleration component of the gravity acceleration data in the Z-axis direction is shown; the magnetic force data acquired by the magnetometer in the terminal coordinate system can be expressed as
Figure BDA0002311332540000061
Wherein M isxThe magnetic field component of the magnetic force data in the X-axis direction, MyThe magnetic field component of the magnetic force data in the Y-axis direction, MzIs the magnetic field component of the magnetic force data in the Z-axis direction.
Schematically, the gravity and magnetic force of the earth are schematically shown in fig. 5, in which G is directed vertically downward, that is, in the direction opposite to the Z-axis in the world coordinate system shown in fig. 3 (B); since the direction of the magnetic induction lines is directed from the south pole of the earth to the north pole, the direction of the magnetic force is shown as M in fig. 5.
It should be noted that step 401 and step 402 may be executed simultaneously, and there is no precedence order, that is, when it is determined that the subway is in the acceleration stage, the linear acceleration sensor, the gravitational acceleration sensor, and the magnetometer in the terminal start to acquire data at the same time.
And 403, determining a conversion matrix according to the gravity acceleration data and the magnetic force data, wherein the conversion matrix is used for converting the acceleration data in the terminal coordinate system into the acceleration data in the world coordinate system.
In one possible embodiment, the process of determining the transformation matrix from the gravitational acceleration and the magnetic acceleration may comprise the following steps:
firstly, the representation of unit vectors of three axes of a world coordinate system in a terminal coordinate system is obtained.
Is schematically shownSince the gravitational acceleration data acquired by the gravity sensor is opposite to the unit vector of the Z axis in the world coordinate system, the gravity sensor is based on
Figure BDA0002311332540000062
The Z-axis unit vector of the world coordinate system can be obtained and expressed as
Figure BDA0002311332540000063
Alternatively, as can be seen from (B) in fig. 5 and 3,
Figure BDA0002311332540000064
and
Figure BDA0002311332540000065
cross multiplication of (A) can result in a cross product perpendicular to
Figure BDA0002311332540000066
And
Figure BDA0002311332540000067
vector of the plane of formation
Figure BDA0002311332540000068
And the vector
Figure BDA0002311332540000069
The direction of (B) is directed toward the west in the world coordinate system, which is opposite to the unit vector of the X axis shown in fig. 3 (B), and therefore, it can be obtained that the unit vector of the X axis in the world coordinate system is expressed as:
Figure BDA00023113325400000610
wherein Hx、Hy、HzThe X-axis unit vectors of the world coordinate system are respectively corresponding X, Y, Z components in the three-axis direction under the terminal coordinate system.
Alternatively, the unit vector of the X axis in the world coordinate system is known
Figure BDA00023113325400000611
And Z-axis unit vector
Figure BDA00023113325400000612
Since the Y-axis is perpendicular to the plane formed by the X-axis and the Z-axis, it is dependent on the vector
Figure BDA00023113325400000613
Sum vector
Figure BDA00023113325400000614
The unit vector of Y axis can be obtained
Figure BDA00023113325400000615
In one possible implementation, the unit vectors of the three axes of the world coordinate system are acquired and expressed in the terminal coordinate system as:
Figure BDA00023113325400000616
Figure BDA00023113325400000617
Figure BDA0002311332540000071
and secondly, calculating a conversion matrix between the world coordinate system and the terminal coordinate system.
Assume a transformation matrix R and a point in the terminal coordinate system
Figure BDA0002311332540000072
And a point in the world coordinate system
Figure BDA0002311332540000073
Then there are:
Figure BDA0002311332540000074
due to the fact that
Figure BDA0002311332540000075
The unit vectors are respectively the X-axis, the Y-axis and the Z-axis in the world coordinate system, so that the following components are provided:
Figure BDA0002311332540000076
Figure BDA0002311332540000077
Figure BDA0002311332540000078
substituting the vectors into equation (1) respectively can obtain:
Figure BDA0002311332540000079
Figure BDA00023113325400000710
Figure BDA00023113325400000711
conversion to matrix form is:
Figure BDA00023113325400000712
due to the fact that
Figure BDA00023113325400000713
For the identity matrix E, then equation (2) can be expressed as:
R·D=E (3)
wherein the content of the first and second substances,
Figure BDA00023113325400000714
since D is an orthogonal matrix, i.e. D-1=DTDue to the factThis is:
Figure BDA00023113325400000715
wherein, R is a transformation matrix, and as can be seen from formula (4), the transformation matrix R is related to the gravitational acceleration data and the magnetic force data. Therefore, in a possible implementation manner, when the terminal acquires the first acceleration data through the linear acceleration sensor, the gravity acceleration sensor and the magnetometer respectively acquire corresponding gravity acceleration data and magnetic force data, and the conversion matrix R corresponding to the first acceleration data is obtained according to the relationship between the conversion matrix R and the gravity acceleration value and the magnetic force data.
Step 404, converting the first acceleration data into second acceleration data through the conversion matrix.
In a possible implementation manner, after the terminal acquires the conversion matrix corresponding to the first acceleration data, the first acceleration data and the conversion matrix are substituted into formula (1), so that second acceleration data in a world coordinate system corresponding to the first acceleration data can be obtained.
Illustratively, if the first acceleration data is denoted as L _ ACCαIf the conversion matrix corresponding to the first acceleration data is R, the second acceleration data is L _ ACC according to the formula (1)β=R·L_ACCα
Step 405, inputting the second acceleration data within the target duration into the operation direction prediction model to obtain an operation direction prediction result output by the operation direction prediction model, wherein the operation direction prediction result comprises the prediction probability corresponding to each candidate operation direction.
In one possible embodiment, the running direction prediction model adopts a Convolutional Neural Network (CNN) structure, and the training process of the model is as follows:
firstly, training sample data is collected.
The training sample data comprises sample acceleration data and a sample running direction, the sample acceleration data is acceleration data of various directions in a subway acceleration stage and a world coordinate system, and the sample running direction is the actual running direction of the subway.
In a possible implementation manner, the starter acquires acceleration data of the subway acceleration stage of each subway station in advance, and since the acceleration data is acceleration data in a terminal coordinate system, in order to avoid the influence of a terminal posture on an acceleration direction, the acceleration data is converted into acceleration data in a world coordinate system according to the above steps, and then the acceleration data is marked according to the actual running direction of the subway at the station, for example, the actual running direction of the subway is divided into a southeast direction, a southwest direction, a northeast direction, a northwest direction and the like, and each actual running direction is marked as 0, 1, 2, 3 and the like, that is, 0 represents the southeast direction, 1 represents the northwest direction, 2 represents the northeast direction, 3 represents the northwest direction and the like.
Optionally, the actual running direction of the subway at the station can be obtained according to map application.
Optionally, the actual running direction of the subway may also include east, south, west, north, and the like, or may be more finely divided, for example, 30 ° north, and the representation of the running direction of the sample in the embodiment of the present application is not limited.
And secondly, constructing a CNN model.
In a possible embodiment, as shown in fig. 6, the CNN model structure is that a first convolutional layer 601 and a second convolutional layer 602 are used to extract features of input second acceleration data, a first fully-connected layer 603 and a second fully-connected layer 604 integrate information with category distinction in the convolutional layers 601 and 602, and finally a normalized exponential function (Softmax)605 is connected to classify the information integrated by the fully-connected layers to obtain a running direction prediction result.
Optionally, in the embodiment of the present application, the loss function of the CNN model may adopt a cross entropy loss function, or may also adopt other loss functions, such as a Focal loss function (Focal loss), and the loss function adopted by the prediction direction model in the embodiment of the present application is not limited.
And thirdly, leading the training sample into a CNN classification model for training.
In one possible implementation, the CNN classification model may be trained using a tensor flow (tensoroflow) system and employing a cross-entropy loss function and a gradient descent algorithm until the model converges.
Optionally, the operation direction prediction model may also adopt other conventional machine learning classifiers or deep learning classification models, which is not limited in this embodiment.
In a possible implementation manner, the cached second acceleration data is input into a trained direction prediction model, so as to obtain a prediction result of each running direction, that is, a prediction probability corresponding to each candidate running direction, wherein each candidate running direction is an actual running direction of the subway calibrated in advance in the model training process.
Illustratively, the predicted result for each direction of travel may be: p0=0.01,P1=0.005,P2=0.98,P30.005, etc., wherein 0 represents a southeast direction, 1 represents a southwest direction, 2 represents a northeast direction, 3 represents a northwest direction, etc.
And 406, determining the subway running direction according to the prediction probability of each candidate running direction.
In a possible implementation manner, according to the prediction probabilities of the candidate running directions, the running direction with the highest prediction probability is determined as the subway running direction, for example, due to P2>P0>P1=P3Therefore, the subway running direction is the northeast direction.
In this embodiment, when the terminal collects the first acceleration data, the gravity sensor and the magnetometer collect the gravity acceleration data and the magnetic data respectively, so as to obtain a conversion matrix corresponding to the first acceleration data at the moment; in addition, the operation direction prediction model is preset in the terminal, the cached second acceleration data is input into the model, the subway operation direction is determined according to the output result of the operation direction prediction model, and the accuracy of determining the subway operation direction according to the second acceleration data can be improved.
Since the first acceleration data needs to be continuously acquired, and the attitude of the terminal may change during the acquisition process, so that the gravitational acceleration data and the magnetic data may change, and the transformation matrix may also change, the transformation matrix needs to be determined in real time according to the gravitational acceleration data and the magnetic data in order to obtain the accuracy of the second acceleration data.
Illustratively, on the basis of fig. 4, as shown in fig. 7, steps 402 to 404 may be replaced by steps 407 to 410.
Step 407, acquiring the nth gravitational acceleration data acquired by the gravitational acceleration sensor and the nth magnetic data acquired by the magnetometer, wherein n is an integer greater than or equal to 2.
In a possible implementation manner, when the terminal acquires first acceleration data within a target duration, the linear acceleration sensor, the gravitational acceleration sensor and the magnetometer in the terminal perform data acquisition according to a target sampling frequency, so that the acquired first acceleration data, the gravitational acceleration data and the magnetic data are data at the same time, and the acquired second acceleration data has a reference value.
Illustratively, if the target duration is 10s and the sampling frequency is 20HZ, 200 pieces of first acceleration data, gravity acceleration data and magnetic force data are acquired within the target duration, the nth gravity acceleration data is collected for the nth time, and the nth magnetic force data is collected for the nth time.
And 408, if the similarity between the nth gravitational acceleration data and the nth-1 gravitational acceleration data is greater than the similarity threshold value, and the similarity between the nth magnetic force data and the nth-1 magnetic force data is greater than the similarity threshold value, determining the nth-1 conversion matrix as the nth conversion matrix, and determining the nth-1 conversion matrix according to the nth-1 gravitational acceleration data and the nth-1 magnetic force data.
In a possible implementation manner, a similarity threshold is preset in the terminal, and if the terminal determines that the similarity between the nth reacceleration data and the n-1 st gravitational acceleration data is greater than the similarity threshold and the similarity between the nth magnetic data and the n-1 st magnetic data is greater than the similarity threshold, it is determined that the posture of the terminal is not significantly changed at the time of two acquisition, so that the conversion matrix does not need to be repeatedly calculated, and the n-1 th conversion matrix can be directly determined as the nth conversion matrix, so that the calculation amount of the terminal is reduced, and the power consumption is saved.
The calculation formula of the similarity may be:
Figure BDA0002311332540000101
wherein d is the similarity,
Figure BDA0002311332540000102
for the nth gravity acceleration data, the acceleration data,
Figure BDA0002311332540000103
and converting d into percentage for the n-1 gravity acceleration data, namely obtaining the similarity between the n-1 gravity acceleration data and the n-re acceleration data. The similarity of the nth magnetic force data and the nth-1 magnetic force data can be obtained with reference to the above formula.
Illustratively, the similarity threshold may be 98%, that is, when the terminal determines that the similarity between the nth reacceleration data and the nth-1 gravitational acceleration data is 98.5%, the similarity between the nth magnetic data and the nth-1 magnetic data is 99%, and the similarities are both greater than 98%, it is determined that the posture of the terminal is not significantly changed at the time of two acquisitions, and the nth-1 conversion matrix may be continuously used.
And 409, if the similarity between the nth gravitational acceleration data and the nth-1 gravitational acceleration data is smaller than a similarity threshold value, and/or the similarity between the nth magnetic data and the nth-1 magnetic data is smaller than a similarity threshold value, determining an nth conversion matrix according to the nth gravitational acceleration data and the nth magnetic data.
In a possible implementation manner, if the similarity between the nth gravitational acceleration data and the nth-1 gravitational acceleration data is smaller than a similarity threshold, or the similarity between the nth magnetic data and the nth-1 magnetic data is smaller than a similarity threshold, it is determined that the posture of the terminal may be significantly changed at the time of two times of acquisition, that is, the nth-1 conversion matrix does not have a reference value in the nth data acquisition process, and therefore, the nth conversion matrix needs to be calculated again according to the nth gravitational acceleration data and the nth magnetic data.
And step 410, converting the first acceleration data into second acceleration data through the nth conversion matrix.
In one possible embodiment, the nth acquired first acceleration data is converted into the nth second acceleration data by the determined nth conversion matrix.
In the embodiment of the application, by comparing the similarity between the nth gravitational acceleration data and the nth-1 gravitational acceleration data and the similarity between the nth magnetic force data and the nth-1 magnetic force data, when the similarities are greater than the similarity threshold, the nth first acceleration data can be directly converted into the nth second acceleration data according to the nth-1 conversion matrix, otherwise, the nth conversion matrix needs to be calculated again according to the nth gravitational acceleration data and the nth magnetic force data for data conversion, so that the accuracy of the acquired second acceleration data can be ensured while the calculation amount of the terminal is reduced.
In order to improve the accuracy of the time for acquiring the first acceleration data and determine the time for judging the running direction of the subway, in a possible implementation mode, the terminal can determine whether the subway is started by identifying whether the environment sound contains a subway closing alarm bell, so that the accurate control of the time for acquiring the first acceleration data is realized.
Referring to fig. 8, a flowchart illustrating a process of determining that a subway is in an acceleration phase according to an exemplary embodiment of the present application is schematically shown, where the method includes:
in step 801, ambient sounds are collected by a microphone.
In a possible implementation manner, the terminal can acquire the user position information in real time, and when the user enters the subway according to the user position information, the terminal can start a microphone to collect the environmental sound in real time.
Optionally, when the user uses the payment application program to swipe the card to take the subway, the terminal confirms that the user enters the subway, and the microphone can be started to collect the environment sound in real time.
Optionally, in order to reduce power consumption of the terminal, the terminal may use a low power consumption microphone to collect the environmental sound in real time.
Step 802, when the environment sound is identified to include a subway closing alarm ring, determining that the subway is in a subway starting stage.
In a possible implementation manner, the audio data of the subway door closing alarm ring is stored in the terminal in advance, after the terminal collects the environmental sound in real time through the microphone, the environmental sound can be converted into the audio data, and the audio data is subjected to data processing, so that whether the processed audio data contains the audio data corresponding to the subway door closing alarm ring or not is identified. And if the environment sound is identified to contain the audio data corresponding to the door closing alarm bell of the subway, determining the subway is started.
Optionally, the pre-stored subway closing alarm bell in the terminal may be that when the user takes a subway, the microphone is started to collect and store the subway closing alarm bell; or the terminal acquires the subway closing alarm ring corresponding to the subway when acquiring the urban vehicle wiring diagram, converts the subway closing alarm ring into audio data and stores the audio data to the local.
Because the environmental sound may contain various noises, in order to improve the identification accuracy, the audio data corresponding to the environmental sound needs to be preprocessed, and then the processed audio data is input into the sound identification model, so that whether the current environmental sound contains the subway door-closing warning ring or not is judged according to the warning ring identification result output by the sound identification model.
In a possible implementation manner, the method for determining whether the subway is started or not by judging whether the current environment sound contains the subway closing alarm ring or not may include the following steps:
firstly, extracting audio features of the environmental sounds to obtain an audio feature matrix.
Since the voice recognition model cannot directly recognize the audio data, it is necessary to process the audio data in advance to obtain digital features that can be recognized by the voice recognition model. Because the terminal microphone collects the environmental sound in real time, the audio data of the terminal microphone is not stable on the whole, but the local part of the terminal microphone can be regarded as stable data, and the sound identification model can only identify the stable data, so that the corresponding audio data is firstly subjected to framing processing to obtain the audio data corresponding to different audio frames.
In one possible embodiment, the audio data pre-processing process is as shown in fig. 9, the audio data is first pre-emphasized by a pre-emphasis module 901, and the pre-emphasis process uses a high-pass filter, which only allows signal components above a certain frequency to pass through, and suppresses signal components below the certain frequency, so as to remove unnecessary low-frequency interference such as human talk sound, footstep sound, and mechanical noise in the audio data, and flatten the frequency spectrum of the audio signal. The mathematical expression for the high pass filter is:
H(z)=1-az-1
where a is a correction coefficient, generally ranging from 0.95 to 0.97, and z is an audio signal.
The audio data after the noise removal is subjected to framing processing by the framing windowing module 902, so as to obtain audio data corresponding to different audio frames.
Illustratively, in this embodiment, the audio data including 1024 data points is divided into one frame, and when the sampling frequency of the audio data is selected to be 16000Hz, the duration of one frame of audio data is 64 ms. In order to avoid overlarge change between two frames of data and avoid data loss at two ends of the audio frame after windowing, the audio data are directly divided into frames without adopting a back-to-back mode, and after one frame of data is taken, the frame of data is slid for 32ms and then taken down, namely two adjacent frames of data are overlapped for 32 ms.
Because discrete fourier transform is required to be performed on the audio data subjected to frame division processing during subsequent feature extraction, and one frame of audio data has no obvious periodicity, that is, the left end and the right end of the frame are discontinuous, errors are generated between the audio data subjected to fourier transform and original data, and the more frames are divided, the larger the error is, so that in order to make the audio data subjected to frame division continuous, and each frame of audio data shows the features of a periodic function, frame division windowing processing needs to be performed through the frame division windowing module 902.
In one possible implementation, a hamming window is used to window the audio frame. The hamming window function is multiplied by each frame of data, and the resulting audio data has significant periodicity. The Hamming window has the functional form:
Figure BDA0002311332540000121
n is an integer, the value range of n is 0 to M, M is the number of points of fourier transform, and illustratively, 1024 data points are taken as fourier transform points in this embodiment.
In one possible implementation, after the audio data is subjected to framing and windowing, feature extraction is required to obtain a feature matrix that can be identified by the sound identification model, that is, Mel-frequency cepstral Coefficients (MFCCs) of the audio frame are extracted.
Since it is difficult to obtain the signal characteristics of the audio signal by transforming the audio signal in the time domain, the time domain signal usually needs to be transformed into the energy distribution in the frequency domain for processing, so the terminal first inputs the audio frame data into the fourier transform module 903 for fourier transform, and then inputs the fourier transformed audio frame data into the energy spectrum calculation module 904 for calculating the energy spectrum of the audio frame data. In order to convert the energy spectrum into a mel spectrum conforming to the auditory sense of human ears, the energy spectrum needs to be input into a mel filtering processing module 905 for filtering processing; the mathematical expression of the filtering process is:
Figure BDA0002311332540000122
wherein f is a frequency point after Fourier transform.
After obtaining the mel spectrum of the audio frame, the terminal logarithms the mel spectrum through a Discrete Cosine Transform (DCT) module 906, and an obtained DCT coefficient is the MFCC characteristic.
Illustratively, the embodiment of the application selects a 40-dimensional MFCC feature, when a terminal actually extracts a feature, the input window length of audio data is selected to be 1056ms, the time length of one frame of signal is 64ms, and there is an overlapping portion of 32ms between two adjacent frames of data, so that each 1056ms of input window data corresponds to a generated matrix with a feature of 32 × 40.
And secondly, inputting the audio characteristic matrix into the sound identification model to obtain a warning ring identification result output by the sound identification model, wherein the warning ring identification result is used for indicating whether the environment sound contains the subway closing warning ring.
In a possible implementation mode, the terminal inputs an audio feature matrix obtained after the audio frame is subjected to feature extraction into a sound identification model, and the model identifies whether the current audio frame contains a subway closing alarm ring and outputs an identification result.
In a possible implementation manner, when the terminal cannot autonomously acquire the subway door-closing alarm ring of the current city, the user needs to acquire the subway door-closing alarm ring in advance, and after the subway door-closing alarm ring is acquired, the audio data containing the subway door-closing alarm ring is subjected to the framing processing and feature extraction process in the step one, and the audio feature matrix of the subway door-closing alarm ring is stored locally.
And thirdly, if the alarm ring identification result indicates that the environment sound contains a subway door closing alarm ring, determining that the subway is in a subway starting stage.
Because the terminal performs frame processing on the audio data before recognizing the subway door-closing alarm ring, and the time of one frame of audio is short, when a certain audio frame contains the target alarm ring, the situation that errors are generated in the data processing process when other similar sounds or characteristics are extracted cannot be eliminated, and the situation that the subway door-closing alarm ring is contained in the environmental sound cannot be immediately determined. Therefore, the terminal sets a preset time length, and when the output result of the sound identification model indicates that the number of the audio frames containing the subway door-closing alarm ring within the preset time length reaches a number threshold, it is determined that the environment sound contains the subway door-closing alarm ring, namely, the subway is started.
Illustratively, the terminal sets the preset time length to be 5 seconds, the number threshold value to be 2, and when the terminal recognizes that 2 or more than 2 audio frames contain the subway door-closing alarm ring within 5 seconds, it determines that the current environment sound contains the subway door-closing alarm ring, that is, it determines that the subway is started.
In the embodiment of the application, the environment sound is collected through the microphone, the audio matrix is obtained after the environment sound is preprocessed, the audio matrix is input into the sound recognition model, whether the environment sound contains the target alarm bell or not is determined according to the output alarm bell recognition result, whether the subway is started or not is determined, the accuracy of determining the subway starting is improved, and therefore accurate control of the first acceleration data collection opportunity is achieved.
In a possible application scenario, after the terminal determines the subway running direction according to the second acceleration data, the running direction of the subway expected to be taken by the user can be compared with the running direction of the subway expected to be taken by the user, if the directions of the subway expected to be taken by the user are matched with each other, the user is determined to be taken correctly, and if the directions of the subway expected to be taken by the user are not matched with each other, the user is determined to be taken wrongly, so that the user is reminded to transfer the subway in time.
Schematically, as shown in fig. 10, a flowchart of a method for determining whether a user is riding a subway correctly is shown in an exemplary embodiment of the present application, where the method includes:
step 1001, determining a destination site according to a current site and a target site, where the target site is located between the current site and the destination site.
The determination method of the current station and the target station may be that when the user carries the terminal to take a subway, the terminal acquires a prompt tone when the subway is started or arrives, and the prompt tone includes a name of the current station and a name of a station of a next station.
In one possible implementation mode, when a user takes a subway with the terminal, the terminal determines a terminal station which the subway actually arrives at by acquiring the names of a current station and a target station.
Optionally, the terminal may also obtain the user location information in real time through map-like application, and determine the current station and the target station of the user according to the user location information and the subway line map, so as to determine the terminal station, which is not limited in the embodiment of the present application.
Step 1002, searching a target subway running direction from a database according to a current station and a destination station, wherein the target subway running direction is the running direction of a subway running from the current station to the destination station.
The database stores subway information of all big cities across the country, and may include corresponding relations among cities, subway line identifications, station names, actual operation directions, terminal station directions and the like.
Illustratively, the database may be as shown in Table one.
Watch 1
City Line identification Site name Direction of actual travel Terminal station
City 1 12 Station A Northeast Station B
Southwest Site C
City 2 1 Site D Southeast China Site E
Northwest of China Station F
In a possible implementation manner, when the terminal determines that the current station is station a and the terminal station is station B, the terminal searches from a database (table one) according to the current station and the terminal station, and the running direction of the target subway is the northeast direction.
And 1003, if the determined subway running direction is not matched with the target subway running direction, carrying out transfer prompting.
In a possible implementation manner, if the subway running direction determined according to the step 1002 is not matched with the target subway running direction, it is determined that the possibility that the subway riding direction of the user is incorrect exists, that is, a transfer prompt is performed, so that the user can get off the subway in time, and time waste caused by taking the wrong subway is avoided.
The transfer prompt can be in a voice prompt mode, a vibration prompt mode and the like, and the transfer prompt mode is not limited in the embodiment of the application.
Optionally, if the determined subway running direction is matched with the target subway running direction, it is determined that the user takes the subway correctly, and a confirmation prompt may also be performed, so that the user determines that the currently taken subway is correct and does not need to be replaced.
It should be noted that the present embodiment may be executed after step 406 shown in fig. 4 or step 203 shown in fig. 2.
In the embodiment, the database is preset in the terminal, the determined subway running direction can be compared with the actual subway running direction searched in the database, so that the user can be timely reminded of taking the subway wrongly for transfer, and time waste caused by taking the wrong subway is avoided.
Referring to fig. 11, a block diagram of a device for determining a subway running direction according to an exemplary embodiment of the present application is shown. The apparatus may be implemented as all or a portion of the terminal in software, hardware, or a combination of both. The device includes:
the acquiring module 1101 is configured to acquire first acceleration data acquired by a linear acceleration sensor in a subway acceleration stage, where the first acceleration data includes acceleration data in each direction under a terminal coordinate system;
a data conversion module 1102, configured to convert the first acceleration data into second acceleration data, where the second acceleration data includes acceleration data in each direction in a world coordinate system;
a first determining module 1103, configured to determine a subway running direction according to the second acceleration data within the target time duration.
Optionally, a gravity acceleration sensor and a magnetometer are arranged in the terminal;
optionally, the data conversion module 1102 includes:
the acquisition unit is used for acquiring the gravity acceleration data acquired by the gravity acceleration sensor and the magnetic data acquired by the magnetometer, and the gravity acceleration data and the magnetic data are based on the terminal coordinate system;
the first determining unit is used for determining a conversion matrix according to the gravity acceleration data and the magnetic force data, and the conversion matrix is used for converting the acceleration data in the terminal coordinate system into the acceleration data in the world coordinate system;
and the data conversion unit is used for converting the first acceleration data into the second acceleration data through the conversion matrix.
Optionally, the linear acceleration sensor, the gravitational acceleration sensor, and the magnetometer perform data acquisition according to a target sampling frequency;
optionally, the obtaining unit is further configured to:
acquiring nth gravitational acceleration data acquired by the gravitational acceleration sensor and nth magnetic data acquired by the magnetometer, wherein n is an integer greater than or equal to 2;
optionally, the first determining unit is further configured to:
if the similarity between the nth gravitational acceleration data and the nth-1 gravitational acceleration data is greater than a similarity threshold value, and the similarity between the nth magnetic data and the nth-1 magnetic data is greater than the similarity threshold value, determining an nth-1 conversion matrix as an nth conversion matrix, wherein the nth-1 conversion matrix is determined according to the nth-1 gravitational acceleration data and the nth-1 magnetic data;
if the similarity between the nth gravitational acceleration data and the nth-1 gravitational acceleration data is smaller than the similarity threshold value, and/or the similarity between the nth magnetic force data and the nth-1 magnetic force data is smaller than the similarity threshold value, determining the nth conversion matrix according to the nth gravitational acceleration data and the nth magnetic force data;
optionally, the data conversion unit is further configured to:
converting the first acceleration data into the second acceleration data through the nth conversion matrix.
Optionally, the first determining module 1103 includes:
the first output unit is used for inputting the second acceleration data in the target duration into a running direction prediction model to obtain a running direction prediction result output by the running direction prediction model, and the running direction prediction result comprises prediction probabilities corresponding to all candidate running directions;
and the second determining unit is used for determining the subway running direction according to the prediction probability of each candidate running direction.
Optionally, the operation direction prediction model adopts a CNN structure, and is obtained by training according to sample acceleration data and a sample operation direction;
the sample acceleration data is the acceleration data of all directions in the subway acceleration stage and the world coordinate system, and the sample running direction is the actual running direction of the subway.
Optionally, the apparatus further comprises:
the second determining module is used for determining a destination site according to a current site and a target site, wherein the target site is positioned between the current site and the destination site;
the searching module is used for searching a target subway running direction from a database according to the current station and the destination station, wherein the target subway running direction is the running direction of the subway from the current station to the destination station;
and the prompting module is used for carrying out transfer prompting if the determined subway running direction is not matched with the target subway running direction.
Optionally, the subway acceleration stage includes a subway start stage;
optionally, the apparatus further comprises:
the acquisition module is used for acquiring environmental sounds through a microphone;
and the third determining module is used for determining that the subway is in the subway starting stage when the environment sound is identified to comprise the subway closing alarm ring.
Optionally, the third determining module includes:
the characteristic extraction unit is used for extracting audio characteristics of the environmental sounds to obtain an audio characteristic matrix;
the second output unit is used for inputting the audio characteristic matrix into a sound identification model to obtain a warning ring identification result output by the sound identification model, wherein the warning ring identification result is used for indicating whether the environment sound contains the subway closing warning ring or not;
and a third determining unit, configured to determine that the subway is in the subway start stage if the alarm ring identification result indicates that the environment sound includes the subway closing alarm ring.
In the embodiment of the application, when the subway is in an acceleration stage, the terminal acquires acceleration data (first acceleration data) in each direction under a terminal coordinate system through the linear acceleration sensor, converts the first acceleration data to obtain acceleration data (second acceleration data) in each direction under a world coordinate system, and accordingly determines the subway running direction according to the second acceleration data in the target time length. The first acceleration data collected by the terminal are converted into the second acceleration data, and due to the uniqueness of the world coordinate system, the influence of the terminal posture on the obtained acceleration direction is avoided, so that the accuracy of determining the subway running direction is improved.
Referring to fig. 12, a block diagram of a terminal 1200 according to an exemplary embodiment of the present application is shown. The terminal 1200 may be an electronic device installed and running an application, such as a smart phone, a tablet computer, an electronic book, a portable personal computer, or the like. The terminal 1200 in the present application may include one or more of the following components: a processor 1210, a memory 1220, a screen 1230, and sensors 1240.
Processor 1210 may include one or more processing cores. The processor 1210, using various interfaces and lines to connect various parts throughout the terminal 1200, performs various functions of the terminal 1200 and processes data by executing or executing instructions, programs, code sets, or instruction sets stored in the memory 1220, and calling data stored in the memory 1220. Alternatively, the processor 1210 may be implemented in hardware using at least one of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), and Programmable Logic Array (PLA). The processor 1210 may integrate one or more of a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), a modem, and the like. Wherein, the CPU mainly processes an operating system, a user interface, an application program and the like; the GPU is responsible for rendering and drawing the content that the screen 1230 needs to display; the modem is used to handle wireless communications. It is understood that the modem may not be integrated into the processor 1210, but may be implemented by a communication chip.
The Memory 1220 may include a Random Access Memory (RAM) or a Read-Only Memory (ROM). Optionally, the memory 1220 includes a non-transitory computer-readable medium. The memory 1220 may be used to store instructions, programs, code, sets of codes, or sets of instructions. The memory 1220 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playing function, an image playing function, etc.), instructions for implementing the above method embodiments, and the like, and the operating system may be an Android (Android) system (including an Android system depth development-based system), an IOS system developed by apple inc (including an IOS system depth development-based system), or other systems. The storage data area may also store data created by the terminal 1200 in use, such as phone books, audio and video data, chat log data, and the like.
The screen 1230 may be a capacitive touch display screen for receiving touch operations of a user on or near the screen using a finger, a stylus, or any other suitable object, and displaying user interfaces of various applications. The touch display screen is generally provided at a front panel of the terminal 1200. The touch display screen may be designed as a full-face screen, a curved screen, or a profiled screen. The touch display screen can also be designed to be a combination of a full-face screen and a curved-face screen, and a combination of a special-shaped screen and a curved-face screen, which is not limited in the embodiment of the present application.
The sensor 1240 is used for acquiring sensor data, in this embodiment, the sensor 1240 may include a linear acceleration sensor, a gravitational acceleration sensor and a magnetometer, wherein the linear acceleration sensor is used for acquiring the first acceleration data, the gravitational acceleration sensor is used for acquiring the gravitational acceleration data, and the magnetometer is used for acquiring the magnetic force data. Optionally, the terminal 1200 may further include a temperature sensor, a humidity sensor, a pressure sensor, a proximity sensor, and the like, which is not limited in this embodiment.
In addition, those skilled in the art will appreciate that the configuration of terminal 1200 illustrated in the above-described figures is not meant to be limiting with respect to terminal 1200, and that terminals may include more or less components than those illustrated, or some components may be combined, or a different arrangement of components. For example, the terminal 1200 further includes a radio frequency circuit, a shooting component, a sensor other than the above sensor, an audio circuit, a Wireless Fidelity (WiFi) component, a power supply, a bluetooth component, and other components, which are not described herein again.
The embodiment of the present application further provides a computer-readable medium, where at least one instruction is stored, and the at least one instruction is loaded and executed by the processor to implement the method for determining the subway running direction according to the above embodiments.
The embodiment of the present application further provides a computer program product, where at least one instruction is stored, and the at least one instruction is loaded and executed by the processor to implement the method for determining the subway running direction according to the above embodiments.
Those skilled in the art will recognize that, in one or more of the examples described above, the functions described in the embodiments of the present application may be implemented in hardware, software, firmware, or any combination thereof. When implemented in software, the functions may be stored on or transmitted over as one or more instructions or code on a computer-readable medium. Computer-readable media includes both computer storage media and communication media including any medium that facilitates transfer of a computer program from one place to another. A storage media may be any available media that can be accessed by a general purpose or special purpose computer.
The above description is only exemplary of the present application and should not be taken as limiting, as any modification, equivalent replacement, or improvement made within the spirit and principle of the present application should be included in the protection scope of the present application.

Claims (11)

1. A method for determining the running direction of a subway is characterized in that the method is used for a terminal, and the method comprises the following steps:
in the subway acceleration stage, acquiring first acceleration data acquired by a linear acceleration sensor, wherein the first acceleration data comprises acceleration data in all directions under a terminal coordinate system;
converting the first acceleration data into second acceleration data, wherein the second acceleration data comprise acceleration data of all directions under a world coordinate system;
and determining the subway running direction according to the second acceleration data in the target time length.
2. The method according to claim 1, characterized in that a gravitational acceleration sensor and a magnetometer are provided in the terminal;
the converting the first acceleration data into second acceleration data includes:
acquiring gravitational acceleration data acquired by the gravitational acceleration sensor and magnetic data acquired by the magnetometer, wherein the gravitational acceleration data and the magnetic data are based on the terminal coordinate system;
determining a conversion matrix according to the gravity acceleration data and the magnetic force data, wherein the conversion matrix is used for converting the acceleration data in the terminal coordinate system into the acceleration data in the world coordinate system;
converting the first acceleration data into the second acceleration data through the conversion matrix.
3. The method of claim 2, wherein the linear acceleration sensor, the gravitational acceleration sensor, and the magnetometer perform data acquisition at a target sampling frequency;
the acquiring of the gravity acceleration data collected by the gravity acceleration sensor and the magnetic data collected by the magnetometer includes:
acquiring nth gravitational acceleration data acquired by the gravitational acceleration sensor and nth magnetic data acquired by the magnetometer, wherein n is an integer greater than or equal to 2;
the determining a transformation matrix according to the gravitational acceleration data and the magnetic force data includes:
if the similarity between the nth gravitational acceleration data and the nth-1 gravitational acceleration data is greater than a similarity threshold value, and the similarity between the nth magnetic data and the nth-1 magnetic data is greater than the similarity threshold value, determining an nth-1 conversion matrix as an nth conversion matrix, wherein the nth-1 conversion matrix is determined according to the nth-1 gravitational acceleration data and the nth-1 magnetic data;
if the similarity between the nth gravitational acceleration data and the nth-1 gravitational acceleration data is smaller than the similarity threshold value, and/or the similarity between the nth magnetic force data and the nth-1 magnetic force data is smaller than the similarity threshold value, determining the nth conversion matrix according to the nth gravitational acceleration data and the nth magnetic force data;
the converting, by the conversion matrix, the first acceleration data into the second acceleration data includes:
converting the first acceleration data into the second acceleration data through the nth conversion matrix.
4. The method according to any one of claims 1 to 3, wherein the determining the subway operation direction according to the second acceleration data within the target time duration comprises:
inputting the second acceleration data in the target duration into a running direction prediction model to obtain a running direction prediction result output by the running direction prediction model, wherein the running direction prediction result comprises prediction probabilities corresponding to all candidate running directions;
and determining the subway running direction according to the prediction probability of each candidate running direction.
5. The method according to claim 4, wherein the operation direction prediction model adopts a Convolutional Neural Network (CNN) structure, and is obtained by training according to sample acceleration data and a sample operation direction;
the sample acceleration data is the acceleration data of all directions in the subway acceleration stage and the world coordinate system, and the sample running direction is the actual running direction of the subway.
6. The method according to any one of claims 1 to 3, wherein after determining the subway operation direction according to the second acceleration data within the target time length, the method further comprises:
determining a destination site according to a current site and a target site, wherein the target site is positioned between the current site and the destination site;
searching a target subway running direction from a database according to the current station and the destination station, wherein the target subway running direction is the running direction of the subway running from the current station to the destination station;
and if the determined subway running direction is not matched with the target subway running direction, carrying out transfer prompt.
7. A method according to any one of claims 1 to 3, characterized in that said subway acceleration phase comprises a subway start-up phase;
before the acquiring of the first acceleration data acquired by the linear acceleration sensor in the subway acceleration stage, the method further includes:
collecting environmental sounds through a microphone;
and when the environment sound is identified to comprise a subway closing alarm ring, determining that the subway is in the subway starting stage.
8. The method of claim 7, wherein the determining that the subway is in the start-up phase when the environment sound is identified to include a subway close alarm ring tone comprises:
performing audio characteristic extraction on the environmental sound to obtain an audio characteristic matrix;
inputting the audio characteristic matrix into a sound identification model to obtain a warning ring identification result output by the sound identification model, wherein the warning ring identification result is used for indicating whether the environment sound contains the subway closing warning ring or not;
and if the alarm ring identification result indicates that the environment sound contains the subway door closing alarm ring, determining that the subway is in the subway starting stage.
9. An apparatus for determining a direction of operation of a subway, the apparatus being used for a terminal, the apparatus comprising:
the system comprises an acquisition module, a display module and a control module, wherein the acquisition module is used for acquiring first acceleration data acquired by a linear acceleration sensor in the subway acceleration stage, and the first acceleration data comprises acceleration data in each direction under a terminal coordinate system;
the data conversion module is used for converting the first acceleration data into second acceleration data, and the second acceleration data comprises acceleration data in all directions under a world coordinate system;
and the first determining module is used for determining the subway running direction according to the second acceleration data in the target time length.
10. A terminal, characterized in that the terminal comprises a processor and a memory; the memory stores at least one instruction for execution by the processor to implement the method of determining a subway train direction as claimed in any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that the storage medium stores at least one instruction for execution by a processor to implement the method for determining a subway running direction according to any one of claims 1 to 8.
CN201911259924.2A 2019-12-10 2019-12-10 Subway running direction determining method, device, terminal and storage medium Active CN110972112B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201911259924.2A CN110972112B (en) 2019-12-10 2019-12-10 Subway running direction determining method, device, terminal and storage medium
PCT/CN2020/134578 WO2021115268A1 (en) 2019-12-10 2020-12-08 Method and apparatus for determining running direction of metro train, and terminal and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911259924.2A CN110972112B (en) 2019-12-10 2019-12-10 Subway running direction determining method, device, terminal and storage medium

Publications (2)

Publication Number Publication Date
CN110972112A true CN110972112A (en) 2020-04-07
CN110972112B CN110972112B (en) 2022-04-05

Family

ID=70033796

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911259924.2A Active CN110972112B (en) 2019-12-10 2019-12-10 Subway running direction determining method, device, terminal and storage medium

Country Status (2)

Country Link
CN (1) CN110972112B (en)
WO (1) WO2021115268A1 (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111366150A (en) * 2020-04-20 2020-07-03 Oppo广东移动通信有限公司 Running direction detection method and device, electronic equipment and storage medium
CN112188037A (en) * 2020-09-24 2021-01-05 影石创新科技股份有限公司 Method for generating gyroscope rotation direction and computer equipment
WO2021115268A1 (en) * 2019-12-10 2021-06-17 Oppo广东移动通信有限公司 Method and apparatus for determining running direction of metro train, and terminal and storage medium
CN113091769A (en) * 2021-03-30 2021-07-09 Oppo广东移动通信有限公司 Attitude calibration method and device, storage medium and electronic equipment
WO2024002191A1 (en) * 2022-06-29 2024-01-04 维沃移动通信有限公司 Motion state determination method and apparatus, and electronic device and readable storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101514900A (en) * 2009-04-08 2009-08-26 哈尔滨工程大学 Method for initial alignment of a single-axis rotation strap-down inertial navigation system (SINS)
CN107449418A (en) * 2016-12-26 2017-12-08 浙江从泰网络科技有限公司 User's walking direction calculating method based on accelerometer and magnetometer
CN108846663A (en) * 2018-06-21 2018-11-20 维沃移动通信有限公司 A kind of two dimensional code method of adjustment, device and mobile terminal
JP2018190310A (en) * 2017-05-11 2018-11-29 学校法人同志社 Device and method for estimating attention decrease of driver
CN110006438A (en) * 2019-02-15 2019-07-12 腾讯大地通途(北京)科技有限公司 Navigation control method, device and computer equipment
CN110118560A (en) * 2019-05-28 2019-08-13 东北大学 A kind of indoor orientation method based on LSTM and Multi-sensor Fusion

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105142112B (en) * 2015-09-24 2018-09-04 广东欧珀移动通信有限公司 Mobile terminal detects metro environment and automatically reports the bus stop the method and device of prompt automatically
WO2019000417A1 (en) * 2017-06-30 2019-01-03 SZ DJI Technology Co., Ltd. Map generation systems and methods
CN110068322B (en) * 2019-04-18 2024-03-01 中国电子科技集团公司电子科学研究院 Pedestrian positioning method and pedestrian positioning device based on terminal
CN110972112B (en) * 2019-12-10 2022-04-05 Oppo广东移动通信有限公司 Subway running direction determining method, device, terminal and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101514900A (en) * 2009-04-08 2009-08-26 哈尔滨工程大学 Method for initial alignment of a single-axis rotation strap-down inertial navigation system (SINS)
CN107449418A (en) * 2016-12-26 2017-12-08 浙江从泰网络科技有限公司 User's walking direction calculating method based on accelerometer and magnetometer
JP2018190310A (en) * 2017-05-11 2018-11-29 学校法人同志社 Device and method for estimating attention decrease of driver
CN108846663A (en) * 2018-06-21 2018-11-20 维沃移动通信有限公司 A kind of two dimensional code method of adjustment, device and mobile terminal
CN110006438A (en) * 2019-02-15 2019-07-12 腾讯大地通途(北京)科技有限公司 Navigation control method, device and computer equipment
CN110118560A (en) * 2019-05-28 2019-08-13 东北大学 A kind of indoor orientation method based on LSTM and Multi-sensor Fusion

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
赵宏: "手机内置加速度传感器数据的空间坐标转换算法", 《计算机应用》 *

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2021115268A1 (en) * 2019-12-10 2021-06-17 Oppo广东移动通信有限公司 Method and apparatus for determining running direction of metro train, and terminal and storage medium
CN111366150A (en) * 2020-04-20 2020-07-03 Oppo广东移动通信有限公司 Running direction detection method and device, electronic equipment and storage medium
CN111366150B (en) * 2020-04-20 2022-03-18 Oppo广东移动通信有限公司 Running direction detection method and device, electronic equipment and storage medium
CN112188037A (en) * 2020-09-24 2021-01-05 影石创新科技股份有限公司 Method for generating gyroscope rotation direction and computer equipment
CN112188037B (en) * 2020-09-24 2023-03-24 影石创新科技股份有限公司 Method for generating gyroscope rotation direction and computer equipment
CN113091769A (en) * 2021-03-30 2021-07-09 Oppo广东移动通信有限公司 Attitude calibration method and device, storage medium and electronic equipment
WO2024002191A1 (en) * 2022-06-29 2024-01-04 维沃移动通信有限公司 Motion state determination method and apparatus, and electronic device and readable storage medium

Also Published As

Publication number Publication date
CN110972112B (en) 2022-04-05
WO2021115268A1 (en) 2021-06-17

Similar Documents

Publication Publication Date Title
CN110972112B (en) Subway running direction determining method, device, terminal and storage medium
CN110660201B (en) Arrival reminding method, device, terminal and storage medium
CN110838286B (en) Model training method, language identification method, device and equipment
CN110534099B (en) Voice wake-up processing method and device, storage medium and electronic equipment
CN110853618B (en) Language identification method, model training method, device and equipment
CN110310623B (en) Sample generation method, model training method, device, medium, and electronic apparatus
WO2016150001A1 (en) Speech recognition method, device and computer storage medium
CN110853617B (en) Model training method, language identification method, device and equipment
CN111325386B (en) Method, device, terminal and storage medium for predicting running state of vehicle
CN107257996A (en) The method and system of environment sensitive automatic speech recognition
CN110570873B (en) Voiceprint wake-up method and device, computer equipment and storage medium
CN111354371B (en) Method, device, terminal and storage medium for predicting running state of vehicle
CN110880328B (en) Arrival reminding method, device, terminal and storage medium
CN109947971B (en) Image retrieval method, image retrieval device, electronic equipment and storage medium
CN113129867B (en) Training method of voice recognition model, voice recognition method, device and equipment
CN111009261B (en) Arrival reminding method, device, terminal and storage medium
CN111508480A (en) Training method of audio recognition model, audio recognition method, device and equipment
CN106713633A (en) Deaf people prompt system and method, and smart phone
CN113628612A (en) Voice recognition method and device, electronic equipment and computer readable storage medium
US11830501B2 (en) Electronic device and operation method for performing speech recognition
CN113984078B (en) Arrival reminding method, device, terminal and storage medium
CN117636872A (en) Audio processing method, device, electronic equipment and readable storage medium
CN108322770A (en) Video frequency program recognition methods, relevant apparatus, equipment and system
CN111326146A (en) Method and device for acquiring voice awakening template, electronic equipment and computer readable storage medium
CN111128131B (en) Voice recognition method and device, electronic equipment and computer readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant