Track early warning method and device based on Bloom filter, medium and equipment
By processing trajectory data based on the Bloom filter, the problem of inefficiency in traditional methods when processing massive data is solved, and fast trajectory abnormality judgment and real-time early warning are achieved.
Patent Information
- Application Number
- CN202510342859.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-21
- Publication Date
- 2025-06-10
AI Technical Summary
Traditional trajectory early warning methods are inefficient when processing massive trajectory data, making it difficult to meet the needs of real-time early warning.
The trajectory warning method based on the Bloom filter is adopted, and the target bit array is determined by obtaining and processing the first and second bit arrays, and the target bit array is determined, and the Bloom filter is used to convert the person identification and trajectory point coordinates into bit arrays for comparison, thereby generating trajectory warning information.
It improves the efficiency of trajectory warning, can quickly judge trajectory abnormalities, and meets the needs of real-time warning.
Smart Images

Figure CN120128877A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data processing, and in particular to a trajectory warning method, device, medium and equipment based on a Bloom filter. Background Art
[0002] The monitoring and warning of personnel trajectories are crucial in the fields of public safety, security management, etc. Traditional trajectory warning methods identify abnormal trajectories through simple coordinate comparison or rule matching methods, and face many challenges in data processing and analysis: on the one hand, as the amount of data continues to increase, the efficiency of processing massive trajectory data becomes a bottleneck. For example, in the face of a large-scale event site or an urban transportation hub, the amount of personnel trajectory data generated per second is huge, and traditional methods take a long time to search and compare trajectory data, making it difficult to meet the requirements of real-time warning.
[0003] Therefore, how to improve the efficiency of personnel trajectory warning has become an urgent problem to be solved. Summary of the Invention
[0004] In view of the above technical problems, the technical solution adopted by the present invention is a trajectory warning method based on a Bloom filter, and the trajectory warning method based on a Bloom filter includes the following steps:
[0005] S1, obtaining a first bit array and a second bit array, where the first bit array corresponds to a first bit width, and the second bit array corresponds to a second bit width.
[0006] S2, determining a first search duration according to the first bit width, and determining a second search duration according to the second bit width.
[0007] S3, obtaining the personnel identifier of the target person and N first trajectory point coordinates of the target person, where N is the number of first trajectory point coordinates.
[0008] S4, determining a target bit array from the first bit array and the second bit array according to the number of first trajectory point coordinates, the first search duration, the second search duration, and a preset coordinate comparison duration.
[0009] S5, when using the first bit array as the target bit array, splicing the personnel identifier with N first trajectory point coordinates respectively to form N first reference strings.
[0010] S6, converting each first reference string into a first reference bit array through a Bloom filter respectively.
[0011] S7, comparing each first reference bit array with the first bit array to obtain a first comparison result, and if the first comparison result meets a first preset condition, generating trajectory warning information of the target person.
[0012] S8. When the second array is used as the target array, the personnel identifier is used as the second reference string, and the second reference string is converted into a second reference array through a Bloom filter.
[0013] S9. Compare the second reference array with the second array to obtain a second comparison result. If the second comparison result meets the second preset condition, execute step S10.
[0014] S10. Compare the N first trajectory point coordinates with the second trajectory point coordinates corresponding to the target personnel obtained, to obtain a third comparison result. If the third comparison result meets the third preset condition, generate a trajectory warning message for the target personnel.
[0015] The present invention also provides a trajectory warning device based on a Bloom filter. The trajectory warning device based on a Bloom filter includes:
[0016] An array acquisition module, configured to acquire a first array and a second array, where the first array corresponds to a first bit width, and the second array corresponds to a second bit width.
[0017] A duration mapping module, configured to determine a first search duration according to the first bit width, and determine a second search duration according to the second bit width.
[0018] A personnel information acquisition module, configured to acquire the personnel identifier of the target personnel and the N first trajectory point coordinates of the target personnel, where N is the number of first trajectory point coordinates.
[0019] An array determination module, configured to determine a target array from the first array and the second array according to the number of first trajectory point coordinates, the first search duration, the second search duration, and a preset coordinate comparison duration.
[0020] A first string determination module, configured to, when the first array is used as the target array, splice the personnel identifier with the N first trajectory point coordinates respectively to form N first reference strings.
[0021] An array conversion module, configured to convert each first reference string into a first reference array through a Bloom filter respectively.
[0022] A first trajectory warning module, configured to compare each first reference array with the first array to obtain a first comparison result. If the first comparison result meets the first preset condition, generate a trajectory warning message for the target personnel.
[0023] A second string determination module, configured to, when the second array is used as the target array, use the personnel identifier as the second reference string, and convert the second reference string into a second reference array through a Bloom filter.
[0024] The digit array comparison module is used to compare the second reference digit array with the second digit array to obtain a second comparison result. If the second comparison result meets the second preset condition, the second trajectory warning module is executed.
[0025] The second trajectory warning module is used to compare the N first trajectory point coordinates with the second trajectory point coordinates corresponding to the target person obtained, to obtain a third comparison result. If the third comparison result meets the third preset condition, a trajectory warning information of the target person is generated.
[0026] The present invention also provides a non-transitory computer-readable storage medium. At least one instruction or at least one segment of program is stored in the non-transitory computer-readable storage medium, and the at least one instruction or at least one segment of program is loaded and executed by a processor to implement the above-mentioned trajectory warning method based on a Bloom filter.
[0027] The present invention also provides an electronic device, including a processor and the above-mentioned non-transitory computer-readable storage medium.
[0028] The present invention has at least the following beneficial effects: obtaining a first digit array and a second digit array formed according to prior information, and then determining a first search duration and a second search duration. According to the person identifier of the target person and several first trajectory point coordinates of the target person, the one with a shorter search time is determined as the target digit array from the first digit array and the second digit array. Thus, the person identifier of the target person and several first trajectory point coordinates of the target person are compared according to the target digit array to determine whether there is an abnormal situation in the first trajectory point coordinates of the target person, and then a trajectory warning information is generated, which can quickly judge trajectory anomalies, thereby improving the efficiency of personnel trajectory warning. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the following drawings are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0030] Figure 1 It is a flowchart of a trajectory warning method based on a Bloom filter provided in Embodiment 1 of the present invention;
[0031] Figure 2 It is a structural schematic diagram of a trajectory warning device based on a Bloom filter provided in Embodiment 2 of the present invention. DETAILED DESCRIPTION OF THE INVENTION
[0032] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative efforts shall fall within the protection scope of the present invention.
[0033] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily need to describe a specific order or sequence. It can be understood that, under appropriate circumstances, the above-mentioned terms for distinguishing similar objects can be interchanged, so that the present invention can also implement other embodiments other than the above-mentioned illustrated embodiments or described embodiments. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or server including a series of steps or units does not necessarily have to be limited to those clearly listed steps or units, but may include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0034] Embodiment 1
[0035] Embodiment 1 of the present invention provides a trajectory warning method based on a Bloom filter. The trajectory warning method based on a Bloom filter includes the following steps, as Figure 1 shown:
[0036] S1. Obtain a first bit array and a second bit array, where the first bit array corresponds to a first bit width, and the second bit array corresponds to a second bit width.
[0037] S2. Determine a first search duration according to the first bit width, and determine a second search duration according to the second bit width.
[0038] S3. Obtain the personnel identifier of the target person and the N first trajectory point coordinates of the target person, where N is the number of first trajectory point coordinates.
[0039] S4. Determine a target bit array from the first bit array and the second bit array according to the number of first trajectory point coordinates, the first search duration, the second search duration, and a preset coordinate comparison duration.
[0040] S5. When using the first bit array as the target bit array, splice the personnel identifier with the N first trajectory point coordinates respectively to form N first reference strings.
[0041] S6. Convert each first reference string into a first reference bit array through a Bloom filter respectively.
[0042] S7. Compare each first reference bit array with the first bit array to obtain a first comparison result. If the first comparison result meets the first preset condition, generate a trajectory warning message for the target person.
[0043] S8. When using the second bit array as the target bit array, use the person identifier as the second reference string, and convert the second reference string into a second reference bit array through a Bloom filter.
[0044] S9. Compare the second reference bit array with the second bit array to obtain a second comparison result. If the second comparison result meets the second preset condition, execute step S10.
[0045] S10. Compare the N first trajectory point coordinates with the corresponding second trajectory point coordinates of the target person obtained to obtain a third comparison result. If the third comparison result meets the third preset condition, generate a trajectory warning message for the target person.
[0046] Among them, the first bit width can be represented by W 1 indicating that the first bit array can include W 1 bits, and the element value of each bit can be 0 or 1. The second bit width can be represented by W 2 indicating that the second bit array can include W 2 bits, and the element value of each bit can be 0 or 1.
[0047] The first search duration can be used to represent the time consumed for a single data search through the first bit array, and the second search duration can be used to represent the time consumed for a single data search through the second bit array.
[0048] The person identifier can be used to identify the information of the target person. For example, the person identifier can be the identity id, unique device id, unique network id, etc. of the target person. The first trajectory point coordinate can represent the actual position information passed by the target person.
[0049] The first reference string can include the person identifier and a single first trajectory point coordinate, that is, each first trajectory point coordinate can be concatenated with the person identifier to form a corresponding first reference string.
[0050] The Bloom filter can represent data in a probabilistic data structure to be used to determine whether a data belongs to a set.
[0051] Specifically, the second trajectory point coordinate can refer to the position information where the target person is allowed to move to. For any first trajectory point coordinate, if it does not exist in the second trajectory point coordinates corresponding to the current first trajectory point coordinate, it is determined that the third comparison result meets the third preset condition, indicating that the first trajectory point coordinate of the target person exceeds the preset position range, and a trajectory warning message for the target person is generated.
[0052] In a specific embodiment, the first digit array corresponds to the number K of the first hash functions 1 , and the second digit array corresponds to the number K of the second hash functions 2 .
[0053] Correspondingly, according to the first bit width, a first search duration is determined, and according to the second bit width, a second search duration is determined, including:
[0054] According to the first bit width and the number of the first hash functions, the first search duration is determined through a preset duration mapping function.
[0055] According to the second bit width and the number of the second hash functions, the second search duration is determined through the duration mapping function.
[0056] Among them, the Bloom filter processes data through a plurality of hash functions, and updates the created digit array according to the processing results. In this embodiment, the first digit array corresponds to K 1 first hash functions during update, and the second digit array corresponds to K 2 second hash functions during update.
[0057] The duration mapping function can be determined by a fitting method. Specifically, according to the historical bit width, the number of historical hash functions, and the historical search time of the historical digit array during the historical process of searching for a single data through the Bloom filter, a historical data group is formed. Through fitting of multiple historical data groups, the least squares method can be used as the fitting method to obtain the duration mapping function.
[0058] In an embodiment, the historical data group may further include the historical length of a single data searched through the Bloom filter during the historical process, so as to further improve the fitting accuracy of the duration mapping function. Correspondingly, according to the first bit width and the number of the first hash functions, the first search duration is determined through a preset duration mapping function, including determining the first search duration according to the length of the first reference string, the first bit width, and the number of the first hash functions, and according to the second bit width and the number of the second hash functions, the second search duration is determined through a preset duration mapping function, including determining the second search duration according to the length of the second reference string, the second bit width, and the number of the second hash functions.
[0059] In a specific embodiment, the obtaining steps of the first digit array include:
[0060] Obtain a plurality of first sample strings, where the first sample strings include the sample identifiers of the sample personnel and the sample trajectory point coordinates corresponding to the sample personnel.
[0061] For any first sample string, pass the first sample string through K 1 first hash functions respectively for mapping processing to obtain K 1 first hash mapping results.
[0062] According to the K 1 first hash mapping results, obtain the first sample bit array.
[0063] Traverse all first sample strings to obtain the first sample bit array corresponding to each first sample string respectively.
[0064] Perform an OR operation on all first sample bit arrays bit by bit to obtain the first bit array.
[0065] Among them, the sample personnel may refer to the personnel who need to be monitored for their trajectories, and the sample trajectory point coordinates can be used to represent the positions where the sample personnel are allowed to move to.
[0066] Specifically, create a first initial bit array with a bit width of the first bit width. All elements corresponding to the bits in the first initial bit array have a value of 0, and the K 1 first hash functions are independent of each other.
[0067] Each first hash function can evenly map the elements to the range of [0, W 1 - 1].
[0068] For any first sample string, pass the first sample string through K 1 first hash functions respectively for mapping processing to obtain K 1 first hash values, and set the positions corresponding to the K 1 first hash values in the first initial bit array to 1 to obtain the first sample bit array.
[0069] In a specific embodiment, the steps for obtaining the second bit array include:
[0070] Obtain a number of second sample strings, where the second sample strings include the sample identifiers of the sample personnel.
[0071] For any second sample string, pass the second sample string through K 2 second hash functions respectively for mapping processing to obtain K 2 second hash mapping results.
[0072] According to the K 2 second hash mapping results, obtain the second sample bit array.
[0073] Traverse all second sample strings to obtain the second sample bit array corresponding to each second sample string respectively.
[0074] Perform a bitwise OR operation on all the second sample bit arrays to obtain a second bit array.
[0075] Among them, the second sample string only includes the sample identifier of the sample personnel.
[0076] Specifically, create a second initial bit array with a bit width of the second bit width. All the elements corresponding to the bits in the second initial bit array have a value of 0, and K 2 second hash functions are independent of each other.
[0077] Each second hash function can uniformly map the elements to the range of [0, W 2 - 1].
[0078] For any second sample string, map the second sample string through K 2 second hash functions respectively to obtain K 2 second hash values. Set the positions corresponding to the K 2 second hash values in the second initial bit array to 1 to obtain a second sample bit array.
[0079] In a specific embodiment, determining a target bit array from the first bit array and the second bit array according to the number of first trajectory point coordinates, the first search duration, the second search duration, and a preset coordinate comparison duration includes:
[0080] Multiply the number of first trajectory point coordinates by the first search duration to obtain a first multiplication result, and use the first multiplication result as a first reference duration.
[0081] Multiply the number of first trajectory point coordinates by the coordinate comparison duration to obtain a second multiplication result.
[0082] Add the second search duration to the second multiplication result to obtain an addition result, and use the addition result as a second reference duration.
[0083] Compare the first reference duration with the second reference duration. If the first reference duration is greater than the second reference duration, determine the second bit array as the target bit array.
[0084] If the first reference duration is less than the second reference duration, determine the first bit array as the target bit array.
[0085] Among them, the trajectory of the target personnel may include N first trajectory point coordinates, that is, the number of first trajectory points is N. When using the first bit array, each first reference bit array needs to be compared with the first bit array. Therefore, the first reference duration T = N × t 1 , where t 1 may refer to the first search duration.
[0086] When the second digit array is adopted, it is only necessary to compare a single second reference digit array with the second digit array. If the comparison is successful, then compare between the respective first trajectory point coordinates and the respective second trajectory point coordinates corresponding to the target person. Therefore, the second reference duration T = t 2 + N × t 3 , where t 2 can refer to the second search duration, and t 3 can refer to the coordinate comparison duration. It should be noted that the coordinate comparison duration can refer to the total time consumed for comparing a single first trajectory point coordinate with all second trajectory point coordinates respectively.
[0087] In a specific embodiment, the first preset condition is:
[0088] For any first reference digit array, if the bit corresponding to the first preset value in the current first reference digit array is not the first preset value in the first digit array, it is determined that the first comparison result meets the first preset condition.
[0089] Among them, if the bit corresponding to the first preset value in the current first reference digit array is not the first preset value in the first digit array, it indicates that the first trajectory point coordinate of the target person exceeds the preset position range, and this position range can be determined according to forms such as an electronic fence. Then it is determined that the first comparison result meets the first preset condition, and a trajectory warning message for the target person is generated.
[0090] In a specific embodiment, the second preset condition is:
[0091] If the bits corresponding to the first preset value in the second reference digit array are all the first preset value in the second digit array, it is determined that the second comparison result meets the second preset condition.
[0092] Among them, if the bits corresponding to the first preset value in the second reference digit array are all the first preset value in the second digit array, it indicates that the target person is a person whose trajectory needs to be monitored. Therefore, it is determined that the second comparison result meets the second preset condition, and subsequent trajectory point comparison is performed.
[0093] In this embodiment, the first digit array and the second digit array formed according to prior information are obtained, and then the first search duration and the second search duration are determined. According to the person identifier of the target person and several first trajectory point coordinates of the target person, the one with a shorter search duration is determined as the target digit array from the first digit array and the second digit array. Thus, the person identifier of the target person and several first trajectory point coordinates of the target person are compared according to the target digit array to determine whether there is an abnormal situation in the first trajectory point coordinates of the target person, and then a trajectory warning message is generated, which can quickly perform trajectory anomaly judgment, thereby improving the efficiency of personnel trajectory warning.
[0094] Embodiment 2
[0095] Embodiment 2 provides a trajectory warning device based on a Bloom filter. The trajectory warning device based on a Bloom filter includes, as Figure 2 shown:
[0096] A bit array acquisition module 201, configured to acquire a first bit array and a second bit array, where the first bit array corresponds to a first bit width, and the second bit array corresponds to a second bit width.
[0097] A duration mapping module 202, configured to determine a first search duration according to the first bit width, and determine a second search duration according to the second bit width.
[0098] A personnel information acquisition module 203, configured to acquire a personnel identifier of a target person and N first trajectory point coordinates of the target person, where N is the number of first trajectory point coordinates.
[0099] A bit array determination module 204, configured to determine a target bit array from the first bit array and the second bit array according to the number of first trajectory point coordinates, the first search duration, the second search duration, and a preset coordinate comparison duration.
[0100] A first string determination module 205, configured to splice the personnel identifier with N first trajectory point coordinates into N first reference strings when using the first bit array as the target bit array.
[0101] A bit array conversion module 206, configured to convert each first reference string into a first reference bit array through a Bloom filter respectively.
[0102] A first trajectory warning module 207, configured to compare each first reference bit array with the first bit array to obtain a first comparison result. If the first comparison result meets a first preset condition, generate trajectory warning information of the target person.
[0103] A second string determination module 208, configured to use the personnel identifier as a second reference string when using the second bit array as the target bit array, and convert the second reference string into a second reference bit array through a Bloom filter.
[0104] A bit array comparison module 209, configured to compare the second reference bit array with the second bit array to obtain a second comparison result. If the second comparison result meets a second preset condition, execute a second trajectory warning module.
[0105] A second trajectory warning module 210, configured to compare N first trajectory point coordinates with second trajectory point coordinates corresponding to the acquired target person respectively to obtain a third comparison result. If the third comparison result meets a third preset condition, generate trajectory warning information of the target person.
[0106] In a specific embodiment, the first digit array corresponds to the number K of the first hash functions 1 , and the second digit array corresponds to the number K of the second hash functions 2 .
[0107] Correspondingly, the duration mapping module 202 includes:
[0108] A first search duration acquisition sub-module, configured to determine a first search duration according to the first bit width and the number of the first hash functions through a preset duration mapping function.
[0109] A second search duration acquisition sub-module, configured to determine a second search duration according to the second bit width and the number of the second hash functions through the duration mapping function.
[0110] In a specific embodiment, the digit array acquisition module 201 includes:
[0111] A first sample string acquisition sub-module, configured to acquire a plurality of first sample strings, where the first sample string includes a sample identifier of a sample person and sample trajectory point coordinates corresponding to the sample person.
[0112] A first sample string mapping sub-module, configured to, for any first sample string, perform mapping processing on the first sample string through K 1 first hash functions respectively to obtain K 1 first hash mapping results.
[0113] A first sample digit array acquisition sub-module, configured to perform an OR operation on the K 1 first hash mapping results bit by bit to obtain a first sample digit array.
[0114] A first sample string traversal sub-module, configured to traverse all the first sample strings to obtain a first sample digit array corresponding to each first sample string respectively.
[0115] A first digit array acquisition sub-module, configured to perform an OR operation on all the first sample digit arrays bit by bit to obtain a first digit array.
[0116] In a specific embodiment, the digit array acquisition module 201 further includes:
[0117] A second sample string acquisition sub-module, configured to acquire a plurality of second sample strings, where the second sample string includes a sample identifier of a sample person.
[0118] A second sample string mapping sub-module, configured to, for any second sample string, perform mapping processing on the second sample string through K 2 second hash functions respectively to obtain K 2A second hash mapping result.
[0119] A second sample bit array obtaining sub-module, configured to perform an OR operation on the K 2 second hash mapping results bit by bit to obtain a second sample bit array.
[0120] A second sample string traversing sub-module, configured to traverse all second sample strings to obtain a second sample bit array corresponding to each second sample string respectively.
[0121] A second bit array obtaining sub-module, configured to perform an OR operation on all second sample bit arrays bit by bit to obtain a second bit array.
[0122] In a specific embodiment, the bit array determining module 204 includes:
[0123] A first reference duration obtaining sub-module, configured to multiply the number of first trajectory point coordinates by the first search duration to obtain a first multiplication result, and use the first multiplication result as the first reference duration.
[0124] A second multiplication result obtaining sub-module, configured to multiply the number of first trajectory point coordinates by the coordinate comparison duration to obtain a second multiplication result.
[0125] A second reference duration obtaining sub-module, configured to add the second search duration and the second multiplication result to obtain an addition result, and use the addition result as the second reference duration.
[0126] A first target bit array determining sub-module, configured to compare the first reference duration with the second reference duration. If the first reference duration is greater than the second reference duration, determine the second bit array as the target bit array.
[0127] A second target bit array determining sub-module, configured to, if the first reference duration is less than the second reference duration, determine the first bit array as the target bit array.
[0128] In a specific embodiment, the first preset condition is:
[0129] For any first reference bit array, if the bit corresponding to the first preset value in the current first reference bit array is not the first preset value in the first bit array, it is determined that the first comparison result satisfies the first preset condition.
[0130] In a specific embodiment, the second preset condition is:
[0131] If the bits corresponding to the first preset value in the second reference bit array are all the first preset value in the second bit array, it is determined that the second comparison result satisfies the second preset condition.
[0132] It should be noted that for the information interaction, execution process, etc. between the above modules, since they are based on the same concept as the method embodiments of the present invention, for their specific functions and the technical effects brought, reference can be specifically made to the method embodiment part, and details will not be elaborated here.
[0133] Embodiment III
[0134] Embodiment III of the present invention provides a non-transitory computer-readable storage medium, in which at least one instruction or at least one program segment is stored, and the at least one instruction or at least one program segment is loaded and executed by a processor to implement the steps:
[0135] S1. Obtain a first digit array and a second digit array, where the first digit array corresponds to a first bit width, and the second digit array corresponds to a second bit width.
[0136] S2. Determine a first search duration according to the first bit width, and determine a second search duration according to the second bit width.
[0137] S3. Obtain the personnel identifier of the target person and the N first trajectory point coordinates of the target person, where N is the number of first trajectory point coordinates.
[0138] S4. Determine a target digit array from the first digit array and the second digit array according to the number of first trajectory point coordinates, the first search duration, the second search duration, and a preset coordinate comparison duration.
[0139] S5. When using the first digit array as the target digit array, splice the personnel identifier with the N first trajectory point coordinates respectively to form N first reference strings.
[0140] S6. Convert each first reference string into a first reference digit array through a Bloom filter respectively.
[0141] S7. Compare each first reference digit array with the first digit array to obtain a first comparison result. If the first comparison result meets the first preset condition, generate a trajectory warning message for the target person.
[0142] S8. When using the second digit array as the target digit array, use the personnel identifier as the second reference string, and convert the second reference string into a second reference digit array through a Bloom filter.
[0143] S9. Compare the second reference digit array with the second digit array to obtain a second comparison result. If the second comparison result meets the second preset condition, execute step S10.
[0144] S10. Compare the N first trajectory point coordinates with the second trajectory point coordinates corresponding to the target person obtained, to obtain a third comparison result. If the third comparison result meets the third preset condition, generate a trajectory warning message for the target person.
[0145] Those of ordinary skill in the art can understand that all or part of the processes of implementing the methods in the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, storage, database, or other medium used in the various embodiments provided in the present application can include non-volatile and / or volatile memories. Non-volatile memories can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memories can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), Synchronization Link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and Rambus dynamic RAM (RDRAM), etc.
[0146] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the above-mentioned division of each functional unit and module is used as an example. In practical applications, the above functions can be allocated to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.
[0147] Embodiment 4
[0148] Embodiment 4 of the present invention provides an electronic device, which includes a processor and the non-transitory computer-readable storage medium in Embodiment 3 of the present invention.
[0149] The above are only the preferred embodiments of the present invention and do not impose any form of limitation on the present invention. Although the present invention has been disclosed above with the preferred embodiments, it is not intended to limit the present invention. Any person skilled in the art can make some changes or modifications to equivalent embodiments of equivalent changes by using the above-disclosed technical content within the scope of the technical solution of the present invention. However, as long as it does not depart from the content of the technical solution of the present invention, any simple modification, equivalent change and modification made to the above embodiments according to the technical essence of the present invention still fall within the scope of the technical solution of the present invention.
Claims
1. A trajectory warning method based on Bloom filter, characterized in that: The trajectory warning method based on Bloom filter comprises the following steps: S1, obtaining a first bit array and a second bit array, wherein the first bit array corresponds to a first bit width, and the second bit array corresponds to a second bit width; S2, determining a first search duration according to the first bit width, and determining a second search duration according to the second bit width; S3, obtaining a person identification of a target person and N first trajectory point coordinates of the target person, where N is the number of first trajectory point coordinates; S4, determining a target bit array from the first bit array and the second bit array according to the number of coordinates of the first trajectory points, the first search duration, the second search duration, and a preset coordinate comparison duration; S5, when the first bit array is used as the target bit array, the personnel identification is respectively concatenated with the N first trajectory point coordinates to form N first reference character strings; S6, converting each first reference character string into a first reference bit array through a Bloom filter; S7, comparing each first reference bit array with the first bit array to obtain a first comparison result, and if the first comparison result meets a first preset condition, generating trajectory warning information of the target person; S8, when the second bit array is used as the target bit array, the personnel identifier is used as a second reference string, and the second reference string is converted into a second reference bit array through the Bloom filter; S9, comparing the second reference bit array with the second bit array to obtain a second comparison result, and if the second comparison result satisfies a second preset condition, executing step S10; S10, respectively comparing the coordinates of the N first trajectory points with the acquired coordinates of the second trajectory points corresponding to the target person to obtain a third comparison result. If the third comparison result meets a third preset condition, then generating trajectory warning information of the target person.
2. The trajectory warning method based on Bloom filter according to claim 1 is characterized in that: The first bit array corresponds to a first hash function quantity K1, and the second bit array corresponds to a second hash function quantity K2; Accordingly, determining a first search duration according to the first bit width, and determining a second search duration according to the second bit width includes: Determining the first search duration according to the first bit width and the first number of Hash functions by using a preset duration mapping function; The second search duration is determined according to the second bit width and the second number of Hash functions through the duration mapping function.
3. The trajectory early warning method based on Bloom filter according to claim 2 is characterized in that: The step of obtaining the first bit group comprises: Acquire a plurality of first sample character strings, wherein the first sample character strings include sample identifiers of sample persons and coordinates of sample trajectory points corresponding to the sample persons; For any first sample character string, the first sample character string is respectively mapped through K1 first hash functions to obtain K1 first hash mapping results; According to K1 first hash mapping results, a first sample bit array is obtained; Traversing all first sample character strings to obtain first sample bit arrays corresponding to each first sample character string; Performing a bitwise OR operation on all first sample bit arrays to obtain the first bit array.
4. The trajectory warning method based on Bloom filter according to claim 3 is characterized in that: The step of obtaining the second bit group comprises: Acquire a plurality of second sample character strings, wherein the second sample character strings include sample identifications of sample personnel; For any second sample character string, the second sample character string is respectively mapped through K2 second hash functions to obtain K2 second hash mapping results; According to the K2 second hash mapping results, a second sample bit array is obtained; Traversing all second sample character strings to obtain second sample bit arrays corresponding to each second sample character string; Performing a bitwise OR operation on all second sample bit arrays to obtain the second bit array.
5. The trajectory early warning method based on Bloom filter according to claim 1 is characterized in that: The step of determining a target bit array from the first bit array and the second bit array according to the first trajectory point coordinate quantity, the first search duration, the second search duration, and a preset coordinate comparison duration includes: Multiplying the first number of trajectory point coordinates by the first search duration to obtain a first multiplication result, and using the first multiplication result as a first reference duration; Multiplying the first trajectory point coordinate quantity and the coordinate comparison duration to obtain a second multiplication result; Adding the second search duration and the second multiplication result to obtain an addition result, and using the addition result as a second reference duration; Compare the first reference duration with the second reference duration, and if the first reference duration is greater than the second reference duration, determine the second bit array as the target bit array; If the first reference duration is shorter than the second reference duration, the first bit array is determined as the target bit array.
6. The trajectory warning method based on Bloom filter according to claim 1 is characterized in that: The first preset condition is: For any first reference bit array, if the bit with the first preset value in the current first reference bit array corresponds to a bit with a first preset value in the first bit array that is not the first preset value, it is determined that the first comparison result satisfies the first preset condition.
7. The trajectory early warning method based on Bloom filter according to claim 1 is characterized in that: The second preset condition is: If the bits with the first preset value in the second reference bit array and the corresponding bits in the second bit array are all the first preset value, it is determined that the second comparison result satisfies the second preset condition.
8. A trajectory warning device based on Bloom filter, characterized in that: The trajectory warning device based on Bloom filter includes: A bit array acquisition module, used to acquire a first bit array and a second bit array, wherein the first bit array corresponds to a first bit width, and the second bit array corresponds to a second bit width; A duration mapping module, used to determine a first search duration according to the first bit width, and determine a second search duration according to the second bit width; A personnel information acquisition module, used to acquire a personnel identification of a target person and N first trajectory point coordinates of the target person, where N is the number of first trajectory point coordinates; A bit array determination module, configured to determine a target bit array from the first bit array and the second bit array according to the number of coordinates of the first trajectory points, the first search duration, the second search duration, and a preset coordinate comparison duration; A first character string determination module, configured to, when the first bit array is used as the target bit array, concatenate the personnel identification with the N first trajectory point coordinates into N first reference character strings; A bit array conversion module, used for converting each first reference character string into a first reference bit array through a Bloom filter; A first trajectory warning module, used for comparing each first reference bit array with the first bit array to obtain a first comparison result, and generating trajectory warning information of the target person if the first comparison result meets a first preset condition; A second character string determination module is used for, when the second bit array is used as the target bit array, using the personnel identification as a second reference character string, and converting the second reference character string into a second reference bit array through the Bloom filter; A bit array comparison module, used for comparing a second reference bit array with the second bit array to obtain a second comparison result, and executing a second trajectory warning module if the second comparison result meets a second preset condition; The second trajectory warning module is used to compare the coordinates of the N first trajectory points with the acquired coordinates of the second trajectory points corresponding to the target person to obtain a third comparison result. If the third comparison result meets a third preset condition, the trajectory warning information of the target person is generated.
9. A non-transitory computer-readable storage medium, wherein at least one instruction or at least one program is stored in the non-transitory computer-readable storage medium, characterized in that: The at least one instruction or the at least one program is loaded and executed by the processor to implement the trajectory warning method based on the Bloom filter as described in any one of claims 1-7.
10. An electronic device, characterized in that: The invention comprises a processor and the non-transitory computer-readable storage medium as claimed in claim 9.