User behavior analysis method, device, electronic device and medium based on GPS trajectory
By using target position points to store queues and timestamps in GPS trajectory analysis, the user's stay area is identified, and the problems of high complexity and low accuracy in the prior art are solved, and efficient and accurate stay area recognition is achieved.
Patent Information
- Application Number
- CN202010720940.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-07-23
- Publication Date
- 2025-01-07
- Estimated Expiration
- 2040-07-23
AI Technical Summary
The existing GPS trajectory analysis method has high complexity and does not consider the time dimension when identifying the residence area, resulting in low recognition accuracy and low efficiency.
By obtaining the user's historical GPS trajectory information, the target position point storage queue is used to calculate the distance between the GPS position point and the team head, and the time stamp is used to determine the residence area, and the temporary residence point is eliminated to identify the real residence area.
It improves the accuracy and efficiency of the user's stay area identification, and can identify staying behaviors such as in-situ circles, with small calculations and simple algorithms.
Smart Images

Figure CN111812689B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to big data processing, and in particular to a method, device, electronic device and medium for analyzing user behavior based on GPS tracks. Background Art
[0002] With the popularization of GPS technology on mobile devices, the analysis of GPS trajectories of target objects is increasingly used in all aspects of life. For example, the behavioral characteristics, activity patterns, and interest preferences of target objects (e.g., people, vehicles, animals) are studied through GPS trajectories to provide support for location-based services (e.g., point of interest annotation), urban planning (e.g., route optimization), and environmental protection (e.g., migratory bird habitat monitoring).
[0003] Identifying the stay area in GPS trajectory is an important topic in GPS trajectory analysis. For example, by analyzing the user's stay area (a shopping mall, tourist attraction, etc.), location-based services can be recommended to users. Currently, clustering algorithms and multiple traversal methods are usually used to identify the stay area in GPS trajectory. The clustering algorithm has high complexity and only considers the spatial dimension, not the time dimension, resulting in low recognition accuracy; the multiple traversal method requires multiple traversals of GPS trajectory information (the first traversal calculates the distance and speed of adjacent GPS positioning points, the second traversal deletes high-speed GPS positioning points, and the third traversal divides the GPS trajectory to obtain suspected stay areas), and then finds the target stay area from the suspected stay area and determines the coordinates of the target stay area, and the recognition efficiency is low. Therefore, there is an urgent need for a user behavior analysis method based on GPS trajectory to improve the recognition accuracy and efficiency of the user's stay area. Summary of the invention
[0004] In view of the above, it is necessary to provide a user behavior analysis method based on GPS trajectory, aiming to improve the recognition accuracy and efficiency of the user's stay area.
[0005] The user behavior analysis method based on GPS trajectory provided by the present invention includes:
[0006] In response to a behavior analysis request for a specified user issued by a client, historical GPS track information of the specified user within a preset time period is obtained, and GPS positioning points in the historical GPS track information are sorted according to timestamps to obtain a GPS positioning point sequence;
[0007] Creating a target location point storage queue, and storing the first GPS location point of the GPS location point sequence at the head of the target location point storage queue;
[0008] Reading corresponding GPS positioning points from the GPS positioning point sequence in sequence, and calculating a first distance between the read GPS positioning point and the GPS positioning point at the head of the target position point storage queue;
[0009] The staying area of the designated user is determined based on the first distance, and the coordinates of the staying area and the staying time of the designated user in the staying area are calculated.
[0010] Optionally, determining the stay area of the designated user based on the first distance includes:
[0011] When the first distance is less than a first threshold, the read GPS positioning point is stored in the target position point storage queue, and when the first distance is greater than the first threshold, it is determined whether the number of GPS positioning points in the target position point storage queue is greater than a second threshold;
[0012] When the number of GPS positioning points in the target location point storage queue is greater than a second threshold, the geographical area corresponding to the GPS positioning points in the target location point storage queue is regarded as the stay area of the designated user.
[0013] Optionally, after determining whether the number of GPS positioning points in the target location point storage queue is greater than a second threshold, the method further includes:
[0014] If the number of GPS positioning points in the target location point storage queue is less than the second threshold, the GPS positioning point at the head of the target location point storage queue is deleted, and the remaining GPS positioning points in the target location point storage queue are moved one position toward the head position to obtain a new head GPS positioning point, and then return to read the next GPS positioning point in the GPS positioning point sequence.
[0015] Optionally, calculating the coordinates of the stay area and the stay time of the designated user in the stay area includes:
[0016] Obtain the position coordinates and timestamps of each GPS positioning point in the target position point storage queue corresponding to the stay area, take the average of the position coordinates of each GPS positioning point as the coordinates of the stay area, and take the difference between the timestamps of the GPS positioning point at the end of the target position point storage queue and the GPS positioning point at the head of the queue as the stay time of the designated user in the stay area.
[0017] Optionally, after calculating the coordinates of the stay area and the stay time of the designated user in the stay area, the method further includes:
[0018] Determine whether there are any unread GPS positioning points in the GPS positioning point sequence;
[0019] If yes, the target location point storage queue is cleared, and the GPS location point in the GPS location point sequence whose first distance to the GPS location point at the head of the target location point storage queue is greater than the first threshold is stored at the head of the cleared target location point storage queue;
[0020] The second distances between the unread GPS positioning points in the GPS positioning point sequence and the GPS positioning point at the head of the cleared target location point storage queue are calculated in sequence, and another stay area of the designated user is determined based on the second distance. All GPS positioning points in the GPS positioning point sequence are traversed to obtain multiple stay areas of the designated user.
[0021] Optionally, after obtaining the multiple stay areas of the designated user, the method further includes:
[0022] The absolute value of the difference between the coordinates of each of the multiple stay areas and each standard stay coordinate in the standard stay coordinate set corresponding to the designated user is calculated respectively. If the absolute value of the difference is greater than a third threshold, the corresponding stay area is regarded as an abnormal stay area and an early warning message is issued.
[0023] Optionally, after obtaining the multiple stay areas of the designated user, the method further includes:
[0024] If the number of the designated user's stay areas is greater than a fourth threshold, a warning message is sent to the client.
[0025] In order to solve the above problems, the present invention further provides a user behavior analysis device, the device comprising:
[0026] An acquisition module is used to respond to a behavior analysis request for a specified user issued by a client, obtain the historical GPS track information of the specified user within a preset time period, and sort the GPS positioning points in the historical GPS track information according to timestamps to obtain a GPS positioning point sequence;
[0027] A creation module, used for creating a target location point storage queue, and storing the first GPS positioning point of the GPS positioning point sequence at the head of the target location point storage queue;
[0028] A reading module, used for sequentially reading corresponding GPS positioning points from the GPS positioning point sequence, and calculating a first distance between the read GPS positioning point and the GPS positioning point at the head of the target position point storage queue;
[0029] A calculation module is used to determine the stay area of the designated user based on the first distance, and calculate the coordinates of the stay area and the stay time of the designated user in the stay area.
[0030] In order to solve the above problem, the present invention further provides an electronic device, the electronic device comprising:
[0031] at least one processor; and,
[0032] a memory communicatively connected to the at least one processor; wherein,
[0033] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the above-mentioned user behavior analysis method based on GPS trajectory.
[0034] In order to solve the above problems, the present invention also provides a computer-readable storage medium, on which a user behavior analysis program is stored. The user behavior analysis program can be executed by one or more processors to implement the above-mentioned user behavior analysis method based on GPS trajectory.
[0035] Compared with the prior art, the present invention first stores the first GPS positioning point of the GPS positioning point sequence of the designated user to the head of the target position point storage queue, calculates the first distance between the GPS positioning point of the GPS positioning point sequence and the GPS positioning point at the head of the target position point storage queue in sequence, and when the first distance is less than the first threshold, stores the GPS positioning point to the target position point storage queue. Compared with the prior art, the distance between adjacent GPS positioning points is compared with the first threshold. This step can identify the stop behavior such as circling in place, and the recognition accuracy is higher; then, when the first distance is greater than the first threshold, it is determined whether the number of GPS positioning points in the target position point storage queue is greater than the second threshold. When the number of GPS positioning points in the target position point storage queue is greater than the second threshold, the geographical area corresponding to the GPS positioning points in the target position point storage queue is regarded as the stop area of the designated user. The purpose of this step is to eliminate the temporary stop GPS positioning points in the GPS positioning point sequence and identify the real stop area. The present invention has a small amount of calculation, a simple algorithm, and high recognition accuracy, so the present invention improves the recognition accuracy and recognition efficiency of the user's stop area. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1 A flowchart of a method for analyzing user behavior based on GPS trajectory provided by an embodiment of the present invention;
[0037] Figure 2 A schematic diagram of a module of a user behavior analysis device provided by an embodiment of the present invention;
[0038] Figure 3A schematic diagram of the structure of an electronic device for implementing a user behavior analysis method based on GPS trajectory provided by an embodiment of the present invention;
[0039] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0040] In order to make the purpose, technical scheme and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0041] It should be noted that the descriptions of "first", "second", etc. in the present invention are only used for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in the field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such a combination of technical solutions does not exist and is not within the scope of protection required by the present invention.
[0042] The present invention provides a user behavior analysis method based on GPS trajectory. Figure 1 FIG. 1 is a flow chart of a method for analyzing user behavior based on GPS trajectory according to an embodiment of the present invention. The method can be executed by an electronic device, and the electronic device can be implemented by software and / or hardware.
[0043] In this embodiment, the user behavior analysis method based on GPS trajectory includes:
[0044] S1. Respond to a behavior analysis request for a specified user issued by a client, obtain historical GPS track information of the specified user within a preset time period, and sort the GPS positioning points in the historical GPS track information according to timestamps to obtain a GPS positioning point sequence.
[0045] The GPS track information includes the location coordinates (latitude and longitude) and timestamp of each GPS positioning point.
[0046] In this embodiment, the GPS track information is generated by a GPS dotting device (e.g., a handheld terminal E handheld, vehicle-mounted GPS) at a preset time interval (e.g., 1 second or 10 seconds). It should be emphasized that in order to further ensure the privacy and security of the above historical GPS track information, the above historical GPS track information can also be stored in a node of a blockchain.
[0047] S2. Create a target location point storage queue, and store the first GPS location point of the GPS location point sequence at the head of the target location point storage queue.
[0048] The target location point storage queue meets the first-in-first-out principle, the first element to enter (element is equivalent to the GPS positioning point in this embodiment) is at the head of the queue, the last element to enter is at the tail of the queue, and when deleting an element, only the element at the head of the queue can be deleted, and when adding an element, only the element at the tail of the queue can be added. This embodiment realizes the dynamic contraction and expansion of the target location point storage queue based on the above characteristics of the queue.
[0049] S3, reading corresponding GPS positioning points from the GPS positioning point sequence in sequence, and calculating a first distance between the read GPS positioning point and the GPS positioning point at the head of the target location point storage queue;
[0050] S4. Determine a stay area of the designated user based on the first distance, and calculate coordinates of the stay area and the stay time of the designated user in the stay area.
[0051] In this embodiment, determining the stay area of the designated user based on the first distance includes:
[0052] A1. When the first distance is less than a first threshold, the read GPS positioning point is stored in the target position point storage queue; when the first distance is greater than the first threshold, it is determined whether the number of GPS positioning points in the target position point storage queue is greater than a second threshold;
[0053] A2. When the number of GPS positioning points in the target location point storage queue is greater than a second threshold, the geographical area corresponding to the GPS positioning points in the target location point storage queue is regarded as the stay area of the designated user.
[0054] In this embodiment, the first distance between the GPS positioning point in the GPS positioning point sequence and the GPS positioning point at the head of the target location point storage queue is calculated based on the position coordinates of the GPS positioning point; and the first threshold is set according to the travel mode of the designated user. Taking the example that the user travels on foot and the GPS marking device marks a GPS positioning point per minute, the first threshold is set to 10 meters (under normal circumstances, 80 meters can be walked in one minute).
[0055] For example, the first GPS positioning point in the GPS positioning point sequence of the specified user is stored at the head of the target location point storage queue. If the distance between the second GPS positioning point in the GPS positioning point sequence and the GPS positioning point at the head of the target location point storage queue is less than 10 meters, it can be considered that the specified user is currently in a stay state, and the second GPS positioning point is stored in the target location point storage queue. Then, the distance between the third GPS positioning point in the GPS positioning point sequence and the GPS positioning point at the head of the target location point storage queue is calculated. If the distance is still less than 10 meters, the third GPS positioning point is also stored at the end of the target location point storage queue.
[0056] In this embodiment, the GPS positioning point at the head of the target location point storage queue is used as the standard GPS positioning point, and the first distance between the GPS positioning point in the GPS positioning point sequence and the standard GPS positioning point is calculated, and whether the user stays is determined according to the first distance. When the traditional stay area is identified, the position coordinates of the current GPS positioning point and the previous GPS positioning point are usually compared (that is, whether the user stays is determined according to the distance between two adjacent GPS positioning points). Compared with the traditional stay area identification method, the present invention can identify such stay behaviors as circling in place. For example, when a user is shopping in a mall, he browses each store on each floor of the mall in turn, and circles (browses each store and product) with the first GPS positioning point (for example, the elevator entrance) as the center and 8 meters as the radius. If the distance between the second GPS positioning point and the third GPS positioning point is 12 meters, at this time, when the traditional method is used to identify the stay area, it will be considered that the user has not stayed. Therefore, the scheme described in this embodiment has a higher recognition accuracy when identifying the stay area.
[0057] When a first distance between a certain GPS positioning point in the GPS positioning point sequence and the GPS positioning point at the head of the target position point storage queue is greater than a first threshold, the number of GPS positioning points in the current target position point storage queue needs to be confirmed.
[0058] For example, if the distances between the 2nd to 24th GPS positioning points in the GPS positioning point sequence of the designated user and the GPS positioning point at the head of the target location point storage queue (i.e., the 1st GPS positioning point in the GPS positioning point sequence) are all less than 10 meters, when it is calculated that the distance between the 25th GPS positioning point in the GPS positioning point sequence and the GPS positioning point at the head of the target location point storage queue is greater than 10 meters, it is considered that the designated user did not stay between the 24th GPS positioning point and the 25th GPS positioning point. At this time, there are 24 GPS positioning points in the target location point storage queue, and it is necessary to determine whether the number of GPS positioning points in the target location point storage queue is greater than the second threshold. If the second threshold is 20 (if the number of GPS positioning points in the target location point storage queue is greater than the second threshold, it means that the number of GPS positioning points in the target location point storage queue exceeds 20. Since the point is marked once per minute, it means that the user is considered to have stayed when the stay time is greater than 20 minutes), then the geographical area corresponding to the 24 GPS positioning points in the target location point storage queue is considered to be the stay area of the designated user. This embodiment not only takes into account the spatial position of each GPS positioning point, but also takes into account the influence of the time relationship on the identification of the stay area. The solution described in this embodiment has a higher recognition accuracy when identifying the stay area.
[0059] In this embodiment, calculating the coordinates of the stay area and the stay time of the designated user in the stay area includes:
[0060] Obtain the position coordinates and timestamps of each GPS positioning point in the target position point storage queue corresponding to the stay area, take the average of the position coordinates of each GPS positioning point as the coordinates of the stay area, and take the difference between the timestamps of the GPS positioning point at the end of the target position point storage queue and the GPS positioning point at the head of the queue as the stay time of the designated user in the stay area.
[0061] In another embodiment of the present invention, after determining whether the number of GPS positioning points in the target location point storage queue is greater than a second threshold, the user behavior analysis method further includes:
[0062] If the number of GPS positioning points in the target location point storage queue is less than the second threshold, the GPS positioning point at the head of the target location point storage queue is deleted, and the remaining GPS positioning points in the target location point storage queue are moved one position toward the head position to obtain a new head GPS positioning point, and the next GPS positioning point in the GPS positioning point sequence is returned.
[0063] For example, the distances between the 2nd to 5th GPS positioning points in the GPS positioning point sequence of the designated user and the GPS positioning point at the head of the target location point storage queue (the 1st GPS positioning point) are all less than 10 meters, while the distance between the 6th GPS positioning point in the GPS positioning point sequence and the GPS positioning point at the head of the target location point storage queue is greater than 10 meters. At this time, the number of GPS positioning points in the target location point storage queue is 5, which is less than the second threshold value, indicating that the designated user is only temporarily staying (staying time is 5 minutes) and is not a real stay. In this case, the target location point storage queue is removed from the storage queue. The GPS positioning point at the head of the squadron is deleted, that is, the first GPS positioning point in the GPS positioning point sequence is deleted from the head of the target location point storage queue, and the remaining GPS positioning points in the target location point storage queue are moved one position toward the head of the queue, and the second GPS positioning point is moved to the head position to become the new head of the target location point storage queue. Then, the distance between the sixth GPS positioning point and the GPS positioning point at the new head of the target location point storage queue (i.e., the second GPS positioning point) is calculated. If the distance is less than 10 meters, the sixth GPS positioning point is added to the tail of the target location point storage queue.
[0064] In this embodiment, after calculating the coordinates of the stay area and the stay time of the designated user in the stay area, the method further includes:
[0065] B1, determining whether there are any unread GPS positioning points in the GPS positioning point sequence;
[0066] B2. If yes, clear the target location point storage queue, and store the GPS location point in the GPS location point sequence whose first distance to the GPS location point at the head of the target location point storage queue is greater than the first threshold to the head of the cleared target location point storage queue;
[0067] B3. Calculate in sequence the second distance between the unread GPS positioning points in the GPS positioning point sequence and the GPS positioning point at the head of the cleared target location point storage queue, determine another stay area of the designated user based on the second distance, traverse all GPS positioning points in the GPS positioning point sequence, and obtain multiple stay areas of the designated user.
[0068] After determining a stay area, determine whether there are any unread GPS positioning points in the GPS positioning point sequence. If so, clear the current target location point storage queue, and store the GPS positioning point whose distance from the GPS positioning point at the head of the target location point storage queue is greater than the first threshold to the head of the cleared target location point storage queue. In this embodiment, if there are 200 GPS positioning points in the GPS positioning point sequence, and the GPS positioning points corresponding to the output stay area are the 1st to 24th GPS positioning points in the GPS positioning point sequence, then the 25th GPS positioning point in the GPS positioning point sequence is stored to the head of the cleared queue, and the distance between the 26th GPS positioning point and the GPS positioning point at the head of the target location point storage queue is calculated, and steps S3-S5 are repeated until the GPS positioning points in the GPS positioning point sequence are traversed to obtain multiple stay areas for the specified user.
[0069] In this embodiment, after obtaining the multiple stay areas of the designated user, the user behavior analysis method further includes:
[0070] The absolute value of the difference between the coordinates of each of the multiple stay areas and each standard stay coordinate in the standard stay coordinate set corresponding to the designated user is calculated respectively. If the absolute value of the difference is greater than a third threshold, the corresponding stay area is regarded as an abnormal stay area and an early warning message is issued.
[0071] This step can identify the abnormal staying area of the specified user (or vehicle). For example, for a truck in normal operation, this step can timely identify the abnormal operation of the truck (for example, due to a malfunction of the truck, the truck stays in a non-loading area or non-unloading area for too long), and timely intervene and assist in resolving the relevant abnormalities.
[0072] In this embodiment, after obtaining the multiple stay areas of the designated user, the user behavior analysis method further includes:
[0073] If the number of the designated user's stay areas is greater than a fourth threshold, a warning message is sent to the client.
[0074] It can be seen from the above embodiments that the user behavior analysis method based on GPS trajectory proposed by the present invention, first, the first GPS positioning point of the GPS positioning point sequence of the specified user is stored in the head of the target position point storage queue, and the first distance between the GPS positioning point of the GPS positioning point sequence and the GPS positioning point at the head of the target position point storage queue is calculated in sequence. When the first distance is less than the first threshold, the GPS positioning point is stored in the target position point storage queue. Compared with the prior art, the distance between adjacent GPS positioning points is compared with the first threshold. This step can identify the stop behavior such as circling in place, and the recognition accuracy is higher; then, when the first distance is greater than the first threshold, it is determined whether the number of GPS positioning points in the target position point storage queue is greater than the second threshold. When the number of GPS positioning points in the target position point storage queue is greater than the second threshold, the geographical area corresponding to the GPS positioning points in the target position point storage queue is regarded as the stop area of the specified user. The purpose of this step is to eliminate the temporary stop GPS positioning points in the GPS positioning point sequence and identify the real stop area. The present invention has a small amount of calculation, a simple algorithm, and a high recognition accuracy, so the present invention improves the recognition accuracy and recognition efficiency of the user's stop area.
[0075] like Figure 2 FIG. 1 is a schematic diagram of a module of a user behavior analysis device provided by an embodiment of the present invention.
[0076] The user behavior analysis device 100 of the present invention can be installed in an electronic device. According to the functions to be implemented, the user behavior analysis device 100 may include an acquisition module 110, a creation module 120, a reading module 130 and a calculation module 140. The module of the present invention may also be referred to as a unit, which refers to a series of computer program segments that can be executed by an electronic device processor and can complete fixed functions, which are stored in the memory of the electronic device.
[0077] In this embodiment, the functions of each module / unit are as follows:
[0078] The acquisition module 110 is used to respond to a behavior analysis request for a specified user issued by the client, obtain the historical GPS trajectory information of the specified user within a preset time period, and sort the GPS positioning points in the historical GPS trajectory information according to timestamps to obtain a GPS positioning point sequence.
[0079] The GPS track information includes the location coordinates (latitude and longitude) and timestamp of each GPS positioning point.
[0080] In this embodiment, the GPS track information is generated by a GPS dotting device (e.g., a handheld terminal E handheld, vehicle-mounted GPS) at a preset time interval (e.g., 1 second or 10 seconds). It should be emphasized that in order to further ensure the privacy and security of the above historical GPS track information, the above historical GPS track information can also be stored in a node of a blockchain.
[0081] The creation module 120 is used to create a target location point storage queue and store the first GPS positioning point of the GPS positioning point sequence at the head of the target location point storage queue.
[0082] The target location point storage queue meets the first-in-first-out principle, the first element to enter (element is equivalent to the GPS positioning point in this embodiment) is at the head of the queue, the last element to enter is at the tail of the queue, and when deleting an element, only the element at the head of the queue can be deleted, and when adding an element, only the element at the tail of the queue can be added. This embodiment realizes the dynamic contraction and expansion of the target location point storage queue based on the above characteristics of the queue.
[0083] The reading module 130 is used to sequentially read corresponding GPS positioning points from the GPS positioning point sequence, and calculate a first distance between the read GPS positioning point and the GPS positioning point at the head of the target position point storage queue;
[0084] The calculation module 140 is used to determine the staying area of the designated user based on the first distance, and calculate the coordinates of the staying area and the staying time of the designated user in the staying area.
[0085] In this embodiment, determining the stay area of the designated user based on the first distance includes:
[0086] C1. When the first distance is less than a first threshold, the read GPS positioning point is stored in the target position point storage queue; when the first distance is greater than the first threshold, it is determined whether the number of GPS positioning points in the target position point storage queue is greater than a second threshold;
[0087] C2. When the number of GPS positioning points in the target location point storage queue is greater than a second threshold, the geographical area corresponding to the GPS positioning points in the target location point storage queue is regarded as the stay area of the designated user.
[0088] In this embodiment, the first distance between the GPS positioning point in the GPS positioning point sequence and the GPS positioning point at the head of the target location point storage queue is calculated based on the position coordinates of the GPS positioning point; and the first threshold is set according to the travel mode of the designated user. Taking the example that the user travels on foot and the GPS marking device marks a GPS positioning point per minute, the first threshold is set to 10 meters (under normal circumstances, 80 meters can be walked in one minute).
[0089] For example, the first GPS positioning point in the GPS positioning point sequence of the specified user is stored at the head of the target location point storage queue. If the distance between the second GPS positioning point in the GPS positioning point sequence and the GPS positioning point at the head of the target location point storage queue is less than 10 meters, it can be considered that the specified user is currently in a stay state, and the second GPS positioning point is stored in the target location point storage queue. Then, the distance between the third GPS positioning point in the GPS positioning point sequence and the GPS positioning point at the head of the target location point storage queue is calculated. If the distance is still less than 10 meters, the third GPS positioning point is also stored at the end of the target location point storage queue.
[0090] In this embodiment, the GPS positioning point at the head of the target location point storage queue is used as the standard GPS positioning point, and the first distance between the GPS positioning point in the GPS positioning point sequence and the standard GPS positioning point is calculated, and whether the user stays is determined according to the first distance. When the traditional stay area is identified, the position coordinates of the current GPS positioning point and the previous GPS positioning point are usually compared (that is, whether the user stays is determined according to the distance between two adjacent GPS positioning points). Compared with the traditional stay area identification method, the present invention can identify such stay behaviors as circling in place. For example, when a user is shopping in a mall, he browses each store on each floor of the mall in turn, and circles (browses each store and product) with the first GPS positioning point (for example, the elevator entrance) as the center and 8 meters as the radius. If the distance between the second GPS positioning point and the third GPS positioning point is 12 meters, at this time, when the traditional method is used to identify the stay area, it will be considered that the user has not stayed. Therefore, the scheme described in this embodiment has a higher recognition accuracy when identifying the stay area.
[0091] When a first distance between a certain GPS positioning point in the GPS positioning point sequence and the GPS positioning point at the head of the target position point storage queue is greater than a first threshold, the number of GPS positioning points in the current target position point storage queue needs to be confirmed.
[0092] For example, if the distances between the 2nd to 24th GPS positioning points in the GPS positioning point sequence of the designated user and the GPS positioning point at the head of the target location point storage queue (i.e., the 1st GPS positioning point in the GPS positioning point sequence) are all less than 10 meters, when it is calculated that the distance between the 25th GPS positioning point in the GPS positioning point sequence and the GPS positioning point at the head of the target location point storage queue is greater than 10 meters, it is considered that the designated user did not stay between the 24th GPS positioning point and the 25th GPS positioning point. At this time, there are 24 GPS positioning points in the target location point storage queue, and it is necessary to determine whether the number of GPS positioning points in the target location point storage queue is greater than the second threshold. If the second threshold is 20 (if the number of GPS positioning points in the target location point storage queue is greater than the second threshold, it means that the number of GPS positioning points in the target location point storage queue exceeds 20. Since the point is marked once per minute, it means that the user is considered to have stayed when the stay time is greater than 20 minutes), then the geographical area corresponding to the 24 GPS positioning points in the target location point storage queue is considered to be the stay area of the designated user. This embodiment not only takes into account the spatial position of each GPS positioning point, but also takes into account the influence of the time relationship on the identification of the stay area. The solution described in this embodiment has a higher recognition accuracy when identifying the stay area.
[0093] In this embodiment, calculating the coordinates of the stay area and the stay time of the designated user in the stay area includes:
[0094] Obtain the position coordinates and timestamps of each GPS positioning point in the target position point storage queue corresponding to the stay area, take the average of the position coordinates of each GPS positioning point as the coordinates of the stay area, and take the difference between the timestamps of the GPS positioning point at the end of the target position point storage queue and the GPS positioning point at the head of the queue as the stay time of the designated user in the stay area.
[0095] In another embodiment of the present invention, after determining whether the number of GPS positioning points in the target location point storage queue is greater than the second threshold, the calculation module 140 is further used to:
[0096] If the number of GPS positioning points in the target location point storage queue is less than the second threshold, the GPS positioning point at the head of the target location point storage queue is deleted, and the remaining GPS positioning points in the target location point storage queue are moved one position toward the head position to obtain a new head GPS positioning point, and then return to read the next GPS positioning point in the GPS positioning point sequence.
[0097] For example, the distances between the 2nd to 5th GPS positioning points in the GPS positioning point sequence of the designated user and the GPS positioning point at the head of the target location point storage queue (the 1st GPS positioning point) are all less than 10 meters, while the distance between the 6th GPS positioning point in the GPS positioning point sequence and the GPS positioning point at the head of the target location point storage queue is greater than 10 meters. At this time, the number of GPS positioning points in the target location point storage queue is 5, which is less than the second threshold value, indicating that the designated user is only temporarily staying (staying time is 5 minutes) and is not a real stay. In this case, the target location point storage queue is removed from the storage queue. The GPS positioning point at the head of the squadron is deleted, that is, the first GPS positioning point in the GPS positioning point sequence is deleted from the head of the target location point storage queue, and the remaining GPS positioning points in the target location point storage queue are moved one position toward the head of the queue, and the second GPS positioning point is moved to the head position to become the new head of the target location point storage queue. Then, the distance between the sixth GPS positioning point and the GPS positioning point at the new head of the target location point storage queue (i.e., the second GPS positioning point) is calculated. If the distance is less than 10 meters, the sixth GPS positioning point is added to the tail of the target location point storage queue.
[0098] In this embodiment, after calculating the coordinates of the stay area and the stay time of the designated user in the stay area, the calculation module 140 is further used to:
[0099] D1. Determine whether there are any unread GPS positioning points in the GPS positioning point sequence;
[0100] D2. If yes, clear the target location point storage queue, and store the GPS location point in the GPS location point sequence whose first distance to the GPS location point at the head of the target location point storage queue is greater than the first threshold to the head of the cleared target location point storage queue;
[0101] D3. Calculate in sequence the second distance between the unread GPS positioning points in the GPS positioning point sequence and the GPS positioning point at the head of the cleared target location point storage queue, determine another stay area of the designated user based on the second distance, traverse all GPS positioning points in the GPS positioning point sequence, and obtain multiple stay areas of the designated user.
[0102] After determining a stay area, determine whether there are any unread GPS positioning points in the GPS positioning point sequence. If so, clear the current target location point storage queue, and store the GPS positioning point whose first distance from the GPS positioning point at the head of the target location point storage queue is greater than the first threshold to the head of the cleared target location point storage queue. In this embodiment, if there are 200 GPS positioning points in the GPS positioning point sequence, and the GPS positioning points corresponding to the output stay area are the 1st to 24th GPS positioning points in the GPS positioning point sequence, then the 25th GPS positioning point in the GPS positioning point sequence is stored to the head of the cleared queue, and the distance between the 26th GPS positioning point and the GPS positioning point at the head of the target location point storage queue is calculated, and steps S3-S5 are repeated until the GPS positioning points in the GPS positioning point sequence are traversed to obtain multiple stay areas for the specified user.
[0103] In this embodiment, after obtaining the multiple stay areas of the designated user, the calculation module 140 is further used to:
[0104] The absolute value of the difference between the coordinates of each of the multiple stay areas and each standard stay coordinate in the standard stay coordinate set corresponding to the designated user is calculated respectively. If the absolute value of the difference is greater than a third threshold, the corresponding stay area is regarded as an abnormal stay area and an early warning message is issued.
[0105] This step can identify the abnormal staying area of the specified user (or vehicle). For example, for a truck in normal operation, this step can timely identify the abnormal operation of the truck (for example, due to a malfunction of the truck, the truck stays in a non-loading area or non-unloading area for too long), and timely intervene and assist in resolving the relevant abnormalities.
[0106] In this embodiment, after obtaining the multiple stay areas of the designated user, the calculation module 140 is further used to:
[0107] If the number of the designated user's stay areas is greater than a fourth threshold, a warning message is sent to the client.
[0108] like Figure 3 , which is a schematic diagram of the structure of an electronic device of a user behavior analysis method based on GPS trajectory provided by an embodiment of the present invention.
[0109] The electronic device 1 is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions. The electronic device 1 can be a computer, a single network server, a server group consisting of multiple network servers, or a cloud based on cloud computing consisting of a large number of hosts or network servers, wherein cloud computing is a type of distributed computing, a super virtual computer composed of a group of loosely coupled computer sets.
[0110] In this embodiment, the electronic device 1 includes, but is not limited to, a memory 11, a processor 12, and a network interface 13, which can be interconnected for communication via a system bus. The memory 11 stores a user behavior analysis program 10, and the user behavior analysis program 10 can be executed by the processor 12. Figure 1 Only the electronic device 1 having components 11-13 and the user behavior analysis program 10 is shown. It can be understood by those skilled in the art that Figure 1 The structure shown does not constitute a limitation on the electronic device 1 , and may include fewer or more components than shown in the figure, or combine certain components, or arrange the components differently.
[0111] Among them, the memory 11 includes a memory and at least one type of readable storage medium. The memory provides a cache for the operation of the electronic device 1; the readable storage medium may be a non-volatile storage medium such as a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory, etc.), a random access memory (RAM), a static random access memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a disk, an optical disk, etc. In some embodiments, the readable storage medium may be an internal storage unit of the electronic device 1, such as a hard disk of the electronic device 1; in other embodiments, the non-volatile storage medium may also be an external storage device of the electronic device 1, such as a plug-in hard disk equipped on the electronic device 1, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. In this embodiment, the readable storage medium of the memory 11 is generally used to store an operating system and various application software installed on the electronic device 1, such as storing the code of the user behavior analysis program 10 in an embodiment of the present invention, etc. In addition, the memory 11 may also be used to temporarily store various types of data that have been output or are to be output.
[0112] In some embodiments, the processor 12 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chips. The processor 12 is generally used to control the overall operation of the electronic device 1, such as performing control and processing related to data interaction or communication with other devices. In this embodiment, the processor 12 is used to run the program code stored in the memory 11 or process data, such as running the user behavior analysis program 10.
[0113] The network interface 13 may include a wireless network interface or a wired network interface, and the network interface 13 is used to establish a communication connection between the electronic device 1 and a client (not shown in the figure).
[0114] Optionally, the electronic device 1 may further include a user interface, which may include a display (Display), an input unit such as a keyboard (Keyboard), and the optional user interface may also include a standard wired interface and a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, and an OLED (Organic Light-Emitting Diode) touch device, etc. Among them, the display may also be appropriately referred to as a display screen or a display unit, which is used to display information processed in the electronic device 1 and to display a visual user interface.
[0115] It should be understood that the embodiment is for illustration only and the scope of the patent application is not limited to this structure.
[0116] The user behavior analysis program 10 stored in the memory 11 of the electronic device 1 is a combination of multiple instructions. When running in the processor 12, it can achieve:
[0117] In response to a behavior analysis request for a specified user issued by a client, historical GPS track information of the specified user within a preset time period is obtained, and GPS positioning points in the historical GPS track information are sorted according to timestamps to obtain a GPS positioning point sequence;
[0118] Creating a target location point storage queue, and storing the first GPS location point of the GPS location point sequence at the head of the target location point storage queue;
[0119] Reading corresponding GPS positioning points from the GPS positioning point sequence in sequence, and calculating a first distance between the read GPS positioning point and the GPS positioning point at the head of the target position point storage queue;
[0120] The staying area of the designated user is determined based on the first distance, and the coordinates of the staying area and the staying time of the designated user in the staying area are calculated.
[0121] Specifically, the specific implementation method of the processor 12 for the above instructions can refer to Figure 1 The description of the relevant steps in the corresponding embodiment is not repeated here. It should be emphasized that in order to further ensure the privacy and security of the above historical GPS trajectory information, the above historical GPS trajectory information can also be stored in a node of a blockchain.
[0122] Furthermore, if the module / unit integrated in the electronic device 1 is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. The computer-readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a mobile hard disk, a magnetic disk, an optical disk, a computer memory, and a read-only memory (ROM).
[0123] In the several embodiments provided by the present invention, it should be understood that the disclosed devices, apparatuses and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation.
[0124] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0125] In addition, each functional module in each embodiment of the present invention may be integrated into one processing unit, each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional modules.
[0126] It is obvious to those skilled in the art that the present invention is not limited to the details of the above exemplary embodiments, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention.
[0127] Therefore, no matter from which point of view, the embodiments should be regarded as illustrative and non-restrictive, and the scope of the present invention is limited by the appended claims rather than the above description, so it is intended that all changes falling within the meaning and scope of the equivalent elements of the claims are included in the present invention. Any attached figure mark in the claims should not be regarded as limiting the claims involved.
[0128] The blockchain referred to in this invention is a new application mode of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, platform product service layer, and application service layer.
[0129] In addition, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices stated in the system claim can also be implemented by one unit or device through software or hardware. The second and other words are used to indicate names, but not to indicate any particular order.
[0130] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present invention.
Claims
1. A user behavior analysis method based on GPS trajectory, characterized in that: The method comprises: In response to a behavior analysis request for a specified user issued by a client, historical GPS track information of the specified user within a preset time period is obtained, and GPS positioning points in the historical GPS track information are sorted according to timestamps to obtain a GPS positioning point sequence; Creating a target location point storage queue, and storing the first GPS location point of the GPS location point sequence at the head of the target location point storage queue; Reading corresponding GPS positioning points from the GPS positioning point sequence in sequence, and calculating a first distance between the read GPS positioning point and the GPS positioning point at the head of the target position point storage queue; When the first distance is less than a preset first threshold, the GPS positioning point is stored in the target location point storage queue; when the first distance is greater than the first threshold and the number of GPS positioning points in the target location point storage queue is greater than a preset second threshold, the geographical area corresponding to the GPS positioning point in the target location point storage queue is used as the stay area of the designated user, and the coordinates of the stay area and the stay time of the designated user in the stay area are calculated.
2. The user behavior analysis method according to claim 1, characterized in that: After determining whether the number of GPS positioning points in the target location point storage queue is greater than a second threshold, the method further includes: If the number of GPS positioning points in the target location point storage queue is less than the second threshold, the GPS positioning point at the head of the target location point storage queue is deleted, and the remaining GPS positioning points in the target location point storage queue are moved one position toward the head position to obtain a new head GPS positioning point, and then return to read the next GPS positioning point in the GPS positioning point sequence.
3. The user behavior analysis method according to claim 1, characterized in that: The calculating of the coordinates of the stay area and the stay time of the designated user in the stay area comprises: Obtain the position coordinates and timestamps of each GPS positioning point in the target position point storage queue corresponding to the stay area, take the average of the position coordinates of each GPS positioning point as the coordinates of the stay area, and take the difference between the timestamps of the GPS positioning point at the end of the target position point storage queue and the GPS positioning point at the head of the queue as the stay time of the designated user in the stay area.
4. The user behavior analysis method according to claim 1, characterized in that: After calculating the coordinates of the stay area and the stay time of the designated user in the stay area, the method further includes: Determine whether there are any unread GPS positioning points in the GPS positioning point sequence; If yes, the target location point storage queue is cleared, and the GPS location point in the GPS location point sequence whose first distance to the GPS location point at the head of the target location point storage queue is greater than the first threshold is stored at the head of the cleared target location point storage queue; The second distances between the unread GPS positioning points in the GPS positioning point sequence and the GPS positioning point at the head of the cleared target location point storage queue are calculated in sequence, another stay area of the designated user is determined based on the second distance, and all GPS positioning points in the GPS positioning point sequence are traversed to obtain multiple stay areas of the designated user.
5. The user behavior analysis method according to claim 4, characterized in that: After obtaining the multiple stay areas of the designated user, the method further includes: The absolute value of the difference between the coordinates of each of the multiple stay areas and each standard stay coordinate in the standard stay coordinate set corresponding to the designated user is calculated respectively. If the absolute value of the difference is greater than a third threshold, the corresponding stay area is regarded as an abnormal stay area and an early warning message is issued.
6. The user behavior analysis method according to claim 4, characterized in that: After obtaining the multiple stay areas of the designated user, the method further includes: If the number of the designated user's stay areas is greater than a fourth threshold, a warning message is sent to the client.
7. A user behavior analysis device, characterized in that: The device comprises: An acquisition module is used to respond to a behavior analysis request for a specified user issued by a client, obtain the historical GPS track information of the specified user within a preset time period, and sort the GPS positioning points in the historical GPS track information according to timestamps to obtain a GPS positioning point sequence; A creation module, used for creating a target location point storage queue, and storing the first GPS positioning point of the GPS positioning point sequence at the head of the target location point storage queue; A reading module, used for sequentially reading corresponding GPS positioning points from the GPS positioning point sequence, and calculating a first distance between the read GPS positioning point and the GPS positioning point at the head of the target position point storage queue; A calculation module is used to store the GPS positioning point in the target location point storage queue when the first distance is less than a preset first threshold value, and when the first distance is greater than the first threshold value and the number of GPS positioning points in the target location point storage queue is greater than a preset second threshold value, use the geographical area corresponding to the GPS positioning point in the target location point storage queue as the stay area of the designated user, and calculate the coordinates of the stay area and the stay time of the designated user in the stay area.
8. An electronic device, characterized in that: The electronic device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the user behavior analysis method based on GPS trajectory as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a user behavior analysis program, which can be executed by one or more processors to implement the user behavior analysis method based on GPS trajectory as described in any one of claims 1 to 6.
Citation Information
Patent Citations
System for monitoring people flow action track based on mobile phone positioning technology
CN108737951A
Device, program and method for estimating place of stay of user carrying around mobile terminal
JP2015170144A