CN110728390B - Event prediction method and device - Google Patents

Event prediction method and device Download PDF

Info

Publication number
CN110728390B
CN110728390B CN201810778702.0A CN201810778702A CN110728390B CN 110728390 B CN110728390 B CN 110728390B CN 201810778702 A CN201810778702 A CN 201810778702A CN 110728390 B CN110728390 B CN 110728390B
Authority
CN
China
Prior art keywords
space
data matrix
grid
time
matrix
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201810778702.0A
Other languages
Chinese (zh)
Other versions
CN110728390A (en
Inventor
邢金彪
韩迦密
张玉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Hikvision Digital Technology Co Ltd
Original Assignee
Hangzhou Hikvision Digital Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Hikvision Digital Technology Co Ltd filed Critical Hangzhou Hikvision Digital Technology Co Ltd
Priority to CN201810778702.0A priority Critical patent/CN110728390B/en
Publication of CN110728390A publication Critical patent/CN110728390A/en
Application granted granted Critical
Publication of CN110728390B publication Critical patent/CN110728390B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q10/00Administration; Management
    • G06Q10/04Forecasting or optimisation specially adapted for administrative or management purposes, e.g. linear programming or "cutting stock problem"
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q50/00Systems or methods specially adapted for specific business sectors, e.g. utilities or tourism
    • G06Q50/10Services
    • G06Q50/26Government or public services

Landscapes

  • Business, Economics & Management (AREA)
  • Engineering & Computer Science (AREA)
  • Strategic Management (AREA)
  • Economics (AREA)
  • Tourism & Hospitality (AREA)
  • Human Resources & Organizations (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Marketing (AREA)
  • Development Economics (AREA)
  • General Physics & Mathematics (AREA)
  • General Business, Economics & Management (AREA)
  • Quality & Reliability (AREA)
  • Game Theory and Decision Science (AREA)
  • Entrepreneurship & Innovation (AREA)
  • Operations Research (AREA)
  • Educational Administration (AREA)
  • Health & Medical Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • Primary Health Care (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The application relates to a method and a device for predicting an event, belonging to the field of data mining. The method comprises the following steps: establishing a first time-space data matrix according to a first data set, wherein the first data set comprises time-space data of each event occurring in an ith unit time period of a current period, each grid space in the first time-space data matrix corresponds to an area, and the grid space is used for storing the number of the events occurring in the area corresponding to the grid space in the ith unit time period, and i is an integer greater than 0; and acquiring a second space-time data matrix through a prediction model according to the first space-time data matrix, wherein a grid space in the second space-time data matrix is used for storing the number of events occurring in a region corresponding to the grid space in the (i+1) th unit time period, and the prediction model is a model obtained by fusing a convolutional neural network CNN and a residual network. The method and the device can improve the precision of the predicted event.

Description

Event prediction method and device
Technical Field
The present application relates to the field of data mining, and in particular, to a method and apparatus for event prediction.
Background
In the field of urban traffic, the traffic flow and/or the number of traffic accidents occurring per road section of the city are constantly changing. In order to effectively manage traffic flow, people flow and/or traffic accidents in road sections, corresponding police forces can be arranged in different road sections for management and treatment.
In the urban traffic field, if the traffic flow, the traffic flow and/or the number of traffic accidents occurring in one or more days in the future can be predicted for each road section of the city, the police force can be arranged in different road sections in advance according to the predicted traffic flow, the traffic flow and/or the number of traffic accidents occurring, and thus events such as large traffic flow, traffic flow or traffic accidents can be effectively processed.
There is also a method for predicting an event at present, which can be used for predicting an event occurring in one or more days in the future, however, the existing event prediction method is mainly aimed at a specific scene, and the prediction accuracy in the actual scene is low.
Disclosure of Invention
In order to improve the precision of predicting an event, the embodiment of the application provides a method and a device for predicting the event. The technical scheme is as follows:
in a first aspect, the present application provides a method of event prediction, the method comprising:
Establishing a first time-space data matrix according to a first data set, wherein the first data set comprises time-space data of each event occurring in an ith unit time period of a current period, each grid space in the first time-space data matrix corresponds to an area, and the grid space is used for storing the number of the events occurring in the area corresponding to the grid space in the ith unit time period, and i is an integer greater than 0;
And acquiring a second space-time data matrix through a prediction model according to the first space-time data matrix, wherein a grid space in the second space-time data matrix is used for storing the number of events occurring in a region corresponding to the grid space in the (i+1) th unit time period, and the prediction model is a model obtained by fusing a convolutional neural network CNN and a residual network.
Optionally, the prediction model is a model obtained by fusing N convolution units included in the CNN and N-1 residual units included in the residual network, N is an integer greater than 1, in the prediction model, an output end of a jth convolution unit is connected with an input end of a jth residual unit, an output end of the jth residual unit is connected with an input end of a jth+1th convolution unit, and j=1, 2 … … N-1.
Optionally, the establishing a first time space data matrix according to the first data set includes:
establishing a third space-time data matrix according to the first data set, wherein each grid space in the third space-time data matrix corresponds to an area, and the grid space is used for storing the number of events occurring in the area corresponding to the grid space in the ith unit time period, and i is an integer greater than 0;
And fusing a target grid space in the third space-time data matrix with a grid space adjacent to the target network space to obtain a first space-time data matrix, wherein the number of events included in the target grid space is smaller than a preset number threshold.
Optionally, the fusing the target grid space in the third spatio-temporal data matrix with the adjacent grid space to obtain a first spatio-temporal data matrix includes:
Selecting a first plurality of grid spaces with the smallest number of included events from an x-th row in the third space-time data matrix, and fusing the selected grid spaces with adjacent grid spaces, wherein x=1, 2 and 3 … …;
And selecting a second plurality of grid spaces with the smallest number of included events from a y-th column in the third space-time data matrix, and fusing the selected grid spaces with adjacent grid spaces, wherein y=1, 2 and 3 … ….
Optionally, before the fusing the target grid space in the third spatio-temporal data matrix with the adjacent grid space to obtain the first spatio-temporal data matrix, the method further includes:
acquiring the number of target grid spaces included in each row and the number of target grid spaces included in each column in the first time-space data matrix;
Selecting a grid space number from the target grid space numbers included in each row as a first number, and selecting a grid space number from the target grid space numbers included in each column as a second number.
Optionally, after fusing the target grid space in the third spatio-temporal data matrix with the adjacent grid space to obtain the first spatio-temporal data matrix, the method further includes:
When the target grid space and the adjacent grid space are fused into a new grid space, the region corresponding to the new grid space is set to comprise the region corresponding to the target grid space and the region corresponding to the adjacent grid space.
Optionally, the method further comprises:
Establishing a fourth time-space data matrix according to a second data set, wherein the second data set comprises time-space data of each event occurring in the ith unit time period of a target period, the target period is earlier than the current period, a grid space in the fourth time-space data matrix is used for storing the number of events occurring in a region corresponding to the grid space in the ith unit time period of the target period, and the structure of the fourth time-space data matrix is the same as that of the first time-space data matrix;
the obtaining a second space-time data matrix through a prediction model according to the first space-time data matrix comprises the following steps:
and acquiring a second space-time data matrix through the prediction model according to the first space-time data matrix and the fourth space-time data matrix.
Optionally, the establishing a fourth time space data matrix according to the second data set includes:
Establishing a fifth space-time data matrix according to the second data set, wherein a grid space in the fifth space-time data matrix is used for storing the number of events occurring in a region corresponding to the grid space in the ith time period of the target period;
And fusing the target grid space in the fifth space-time data matrix with the grid space adjacent to the target grid space to obtain a fourth space-time data matrix.
Optionally, the obtaining, according to the first space-time data matrix, a second space-time data matrix through a prediction model includes:
Acquiring an external factor matrix of an ith unit time period of a current period, wherein the structure of the external factor matrix is the same as that of the first time space data matrix, and the external factor matrix is used for reflecting the influence of external factors occurring in the ith unit time period of the current period on events occurring in unit time periods after the ith unit time period;
and acquiring a second space-time data matrix through a prediction model according to the first space-time data matrix and the external factor matrix.
In a second aspect, the present application provides an apparatus for event prediction, the apparatus comprising:
The system comprises a building module, a storage module and a processing module, wherein the building module is used for building a first time-space data matrix according to a first data set, the first data set comprises time-space data of each event occurring in an ith unit time period of a current period, each grid space in the first time-space data matrix corresponds to an area, the grid space is used for storing the number of the events occurring in the area corresponding to the grid space in the ith unit time period, and i is an integer larger than 0;
The acquiring module is configured to acquire a second spatio-temporal data matrix according to the first spatio-temporal data matrix through a prediction model, where a grid space in the second spatio-temporal data matrix is used to store the number of events occurring in a region corresponding to the grid space in the (i+1) th unit time period, and the prediction model is a model obtained by fusing a convolutional neural network CNN and a residual network.
Optionally, the prediction model is a model obtained by fusing N convolution units included in the CNN and N-1 residual units included in the residual network, N is an integer greater than 1, in the prediction model, an output end of a jth convolution unit is connected with an input end of a jth residual unit, an output end of the jth residual unit is connected with an input end of a jth+1th convolution unit, and j=1, 2 … … N-1.
Optionally, the establishing module is configured to:
establishing a third space-time data matrix according to the first data set, wherein each grid space in the third space-time data matrix corresponds to an area, and the grid space is used for storing the number of events occurring in the area corresponding to the grid space in the ith unit time period, and i is an integer greater than 0;
And fusing a target grid space in the third space-time data matrix with a grid space adjacent to the target network space to obtain a first space-time data matrix, wherein the number of events included in the target grid space is smaller than a preset number threshold.
Optionally, the establishing module is configured to:
Selecting a first plurality of grid spaces with the smallest number of included events from an x-th row in the third space-time data matrix, and fusing the selected grid spaces with adjacent grid spaces, wherein x=1, 2 and 3 … …;
And selecting a second plurality of grid spaces with the smallest number of included events from a y-th column in the third space-time data matrix, and fusing the selected grid spaces with adjacent grid spaces, wherein y=1, 2 and 3 … ….
Optionally, the apparatus further includes: the selection module is used for selecting the selection module,
The acquisition module is further configured to acquire the number of target grid spaces included in each row and the number of target grid spaces included in each column in the first space-time data matrix;
The selecting module is configured to select a grid space number from the target grid space numbers included in each row as a first number, and select a grid space number from the target grid space numbers included in each column as a second number.
Optionally, the apparatus further includes:
and the setting module is used for setting that the area corresponding to the new grid space comprises the area corresponding to the target grid space and the area corresponding to the adjacent grid space when the target grid space and the adjacent grid space are fused into the new grid space.
Optionally, the establishing module is further configured to establish a fourth space-time data matrix according to a second data set, where the second data set includes space-time data of each event occurring in an i-th unit time period of a target period, the target period is earlier than the current period, a grid space in the fourth space-time data matrix is used to store the number of events occurring in an area corresponding to the grid space in the i-th unit time period of the target period, and a structure of the fourth space-time data matrix is the same as a structure of the first space-time data matrix;
the obtaining module is configured to obtain a second space-time data matrix through the prediction model according to the first space-time data matrix and the fourth space-time data matrix.
Optionally, the establishing module is configured to:
Establishing a fifth space-time data matrix according to the second data set, wherein a grid space in the fifth space-time data matrix is used for storing the number of events occurring in a region corresponding to the grid space in the ith time period of the target period;
And fusing the target grid space in the fifth space-time data matrix with the grid space adjacent to the target grid space to obtain a fourth space-time data matrix.
Optionally, the acquiring module is configured to:
Acquiring an external factor matrix of an ith unit time period of a current period, wherein the structure of the external factor matrix is the same as that of the first time space data matrix, and the external factor matrix is used for reflecting the influence of external factors occurring in the ith unit time period of the current period on events occurring in unit time periods after the ith unit time period;
and acquiring a second space-time data matrix through a prediction model according to the first space-time data matrix and the external factor matrix.
In a third aspect, the application provides a non-transitory computer readable storage medium storing a computer program loaded and executed by a processor to implement instructions of the first aspect or any of the alternative methods of the first aspect.
The technical scheme provided by the embodiment of the application can have the following beneficial effects:
Because the prediction model is obtained by fusing the CNN and the residual error network, the space-time data matrix is predicted in the CNN, and all or part of residual error information in the space-time data matrix is eliminated by the prediction model through the residual error network, so that a second space-time data matrix is obtained, and the prediction precision is improved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the application, as described in detail below.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and together with the description, serve to explain the principles of the application.
FIG. 1 is a flow chart of a method for event prediction provided by an embodiment of the present application;
FIG. 2-1 is a flow chart of a method for event prediction provided by an embodiment of the present application;
2-2 are flowcharts providing a method for predicting a third spatiotemporal data matrix by a predictive model in accordance with embodiments of the application;
FIGS. 2-3 are flowcharts providing another method for predicting a third spatiotemporal data matrix by a predictive model in accordance with embodiments of the application;
FIGS. 2-4 are flowcharts providing another method for predicting a third spatiotemporal data matrix by a predictive model in accordance with embodiments of the application;
FIGS. 2-5 are flowcharts providing another method for predicting a third spatiotemporal data matrix by a predictive model in accordance with embodiments of the application;
FIG. 3 is a schematic diagram of an apparatus for event prediction according to an embodiment of the present application;
fig. 4 is a schematic diagram of a terminal structure according to a fourth embodiment of the present application.
Specific embodiments of the present application have been shown by way of the above drawings and will be described in more detail below. The drawings and the written description are not intended to limit the scope of the inventive concepts in any way, but rather to illustrate the inventive concepts to those skilled in the art by reference to the specific embodiments.
Detailed Description
Reference will now be made in detail to exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numbers in different drawings refer to the same or similar elements, unless otherwise indicated. The implementations described in the following exemplary examples do not represent all implementations consistent with the application. Rather, they are merely examples of apparatus and methods consistent with aspects of the application as detailed in the accompanying claims.
Referring to fig. 1, an embodiment of the present application provides a method of event prediction, the method comprising:
Step 101: and establishing a first time-space data matrix according to a first data set, wherein the first data set comprises time-space data of each event occurring in the ith unit time period of the current period, each grid space in the first time-space data matrix corresponds to an area, the grid space is used for storing the number of the events occurring in the area corresponding to the grid space in the ith unit time period, and i is an integer greater than 0.
Step 102: and acquiring a second space-time data matrix through a prediction model according to the first space-time data matrix, wherein a grid space in the second space-time data matrix is used for storing the number of events occurring in a region corresponding to the grid space in the (i+1) th unit time period, and the prediction model is a model obtained by fusing a CNN and a residual network.
In the embodiment of the application, the CNN is used for predicting the spatio-temporal data matrix in the (i+1) th unit time period according to the first spatio-temporal data matrix, and the spatio-temporal data matrix predicted by the CNN includes residual information, wherein the residual information is error information between a true value and a predicted value. Because the prediction model is obtained by fusing the CNN and the residual error network, after the CNN predicts the space-time data matrix, the prediction model eliminates all or part of residual error information in the space-time data matrix through the residual error network to obtain a second space-time data matrix, thereby improving the prediction precision.
Referring to fig. 2-1, an embodiment of the present application provides a method for event prediction, including:
Step 201: a first data set is acquired, the first data set comprising spatiotemporal data of events occurring within an i-th unit time period of a current cycle.
The spatiotemporal data of the event at least comprises the occurrence time and the occurrence position of the event, and i is an integer greater than 0. Optionally, the spatiotemporal data of the event may further include one or more of identification of the event and information such as category of the event.
Alternatively, one cycle may be equal to one month, one week, one day, a plurality of months, a plurality of weeks, or a plurality of days, etc., and one cycle includes a plurality of unit time periods. For example, assuming that one cycle includes four weeks and one unit time period is one week, one cycle includes four unit time periods.
Alternatively, the i-th unit time period of the current period may be the unit time period in which the current time is located or a complete unit time period closest to the current time in the current period.
Alternatively, the first data set may be obtained by the following operations 2011 to 2013, respectively:
2011: spatiotemporal data of each event occurring in the ith unit time period of the current cycle is acquired from the sequence data.
The sequence data may be event data occurring in a time sequence, each event data having a corresponding time. For example, the sequence data may be video data photographed by each image pickup apparatus of a city, each frame of video data being event data occurring in time series.
The event that occurs is included in the sequence data, for example, the event included in the video data captured by the image capturing apparatus may be that the image capturing apparatus captures a human body and/or that the image capturing apparatus captures a vehicle or the like.
In this step, sequence data within the i-th unit time period of the current period may be acquired, whether an event occurs in each acquired sequence data is detected, and if so, spatiotemporal data of the event is extracted from the sequence data.
For example, for sequence data of an i-th unit time period located in a current period captured by a certain image capturing apparatus, the sequence data is video data, and each frame of video data included in the sequence data is detected. If the vehicle image is detected to be included in a certain frame of video data, judging that an event exists in the frame of video data, wherein the event is called a first event for convenience of explanation, the first event is that a vehicle is shot, the time corresponding to the frame of video data is taken as the occurrence time of the first event, and the position of the image pickup device is taken as the occurrence position of the first event, so that the space-time data of the first event is obtained. Optionally, an identifier may be further allocated to the first event, and it is determined that the event category to which the first event belongs is a vehicle, so that the spatiotemporal data of the first event may further include information such as the identifier of the first event and/or the event category to which the first event belongs.
If detecting that certain frame of video data in the certain frame of video data comprises a human body image, judging that an event occurs in the frame of video data, wherein the event is called a second event for convenience of explanation, the second event is that a human body is shot, the time corresponding to the frame of video data is taken as the occurrence time of the second event, and the place where the image capturing device is located is taken as the occurrence position of the second event, so that the space-time data of the second event are obtained. Optionally, an identifier may be further allocated to the second event, and it is determined that the event category to which the second event belongs is a human body, so that the spatiotemporal data of the second event may further include information such as the identifier of the second event and/or the event category to which the second event belongs.
For example, the spatiotemporal data of each event occurring in the i-th unit time period of the current cycle is acquired as shown in table 1 below.
TABLE 1
2012: The occurrence position in the spatio-temporal data of each event is converted into position information in the form of coordinates.
Alternatively, the occurrence position in the spatio-temporal data of each event may be converted into position information in the form of latitude and longitude coordinates.
The present step is an optional step, and the present step may not be performed, so that step 2013 is directly performed after step 2011 is performed.
2013: From the spatiotemporal data of each event occurring in the ith unit time period of the current period, the spatiotemporal data of the event belonging to the target type is acquired and constitutes a first data set.
For example, assuming that the traffic flow of the entire city in the i+1th unit time period is predicted in the present embodiment, the target type may be a vehicle. For another example, assuming that the traffic of people in the entire city is predicted in the i+1th unit time period in the present embodiment, the target type may be a human body.
In this step, a second data set may also be acquired, the second data set including spatiotemporal data of each event occurring within the i-th unit time period of the target period, the target period being earlier than the current period, so the second data set is contemporaneous data of the first data set.
Alternatively, the second data set may be acquired in the procedure for acquiring the first data set described above, which will not be described in detail herein.
Step 202: and establishing a third space-time data matrix according to the first data set, wherein each grid space in the third space-time data matrix corresponds to one area, and the grid space is used for storing the number of events occurring in the area corresponding to the grid space in the ith unit time period.
In this step, a spatio-temporal data matrix of M rows and N columns is created, where each row or each column in the spatio-temporal data matrix includes a grid space corresponding to an area, and the areas corresponding to each grid space are not overlapped, and optionally, the areas corresponding to each grid space may be the same or different, where M and N are integers greater than 1, and each grid space in the spatio-temporal data matrix is used to store the number of events occurring in its corresponding area, and after the spatio-temporal data matrix is created, the number of events stored in each storage area in the spatio-temporal data matrix is 0.
For each piece of space-time data in the first data set, determining a target area where the occurrence position is located according to the occurrence position included in the space-time data, reading the number of events stored in a grid space corresponding to the target area in the space-time data matrix, increasing the number of the read events, and updating the number of the events stored in the grid space corresponding to the target area to the increased number of the events. And processing each space-time data in the first data set in the mode, wherein the obtained space-time data matrix is a third space-time data matrix.
Alternatively, the region corresponding to each grid space in the spatiotemporal data matrix may be represented by a coordinate range including a longitude coordinate range and a latitude coordinate range.
Optionally, a fifth spatio-temporal data matrix may be further established according to the second data set, where each grid space in the fifth spatio-temporal data matrix corresponds to an area, and the grid space is used to store the number of events occurring in the area corresponding to the grid space in the ith time period in the target period.
The process of establishing the fifth space-time data matrix according to the second data set may be:
establishing a space-time data matrix of M rows and N columns, wherein each row or each column of the space-time data matrix comprises grid spaces corresponding to an area, the areas corresponding to each grid space are not overlapped, each grid space corresponds to one grid space in a third space-time data matrix, for each grid space and another grid space corresponding to the grid space in the third space-time data matrix, the area corresponding to the grid space is the same as the area corresponding to the other grid space, and after the space-time data matrix is established, the number of events stored in each grid space in the space-time data matrix is 0. And for each piece of space-time data in the second data set, determining a target area where the occurrence position is located according to the occurrence position included in the space-time data, reading the number of events stored in the grid space corresponding to the target area in the space-time data matrix, increasing the number of the read events, and updating the number of the events stored in the grid space corresponding to the target area to the increased number of the events. And processing each space-time data in the second data set in the mode, wherein the obtained space-time data matrix is a fifth space-time data matrix. Wherein the structure of the fifth spatiotemporal data matrix is the same as the structure of the third spatiotemporal data matrix.
It should be noted that: the sparsity of the third spatiotemporal data matrix and the sparsity of the fifth spatiotemporal data matrix are both higher, that is, the third spatiotemporal data matrix comprises more grid spaces, the number of events stored in the grid spaces is smaller, the number of events stored in the grid spaces is usually smaller than a number threshold, if the third spatiotemporal data matrix and/or the fifth spatiotemporal data matrix are directly input into the prediction model for event prediction, the prediction model loses a large amount of information in the prediction process due to the larger sparsity of the matrices, and the accuracy of a prediction result is lower.
In order to avoid that the prediction model loses information at the time of prediction, in the present embodiment, the following operations 203 and 204 may also be performed on the third spatiotemporal data matrix and/or the fifth spatiotemporal data matrix.
Step 203: and acquiring the first number of grid spaces to be fused in each row of the third space-time data matrix and the second number of grid spaces to be fused in each column.
The method comprises the following steps: determining a target grid space of each row and a target grid space of each column in the third space-time data matrix, wherein the number of events stored in the target grid space is smaller than a preset number threshold; the number of target grid spaces included in each row is counted, one grid space number is selected from the number of target grid spaces included in each row as a first number, and the number of target grid spaces included in each column is counted, and one grid space number is selected from the number of target grid spaces included in each column as a second number.
Alternatively, for the operation of selecting one grid space number from the target grid space numbers of each row as the first number, it may be:
Selecting a minimum grid space number from the target grid space numbers of each row as a first number; or the number of the target grid spaces of each row is sorted in order from the largest to the smallest, and one grid space number may be selected as the first number from the smallest grid space number to the grid space number arranged in the middle. Alternatively, the number of grid spaces arranged in the middle may be directly selected as the first number.
Alternatively, for the operation of selecting one grid space number from the target grid space numbers of each column as the second number, it may be:
Selecting a minimum grid space number from the target grid space numbers of each column as a second number; or the number of the target grid spaces of each column is ordered in order from large to small, and one grid space number can be selected as the second number from the smallest grid space number to the grid space number arranged in the middle. Alternatively, the number of grid spaces arranged in the middle may be directly selected as the second number.
It should be noted that: the third spatiotemporal data matrix typically includes a target grid space in each row and in each column, i.e., the third spatiotemporal data matrix typically includes a number of target grid spaces in each row and a number of target grid spaces in each column that are greater than 0.
In a special case, if the number of target grid spaces included in a certain row in the third space-time data matrix is 0 or the number of target grid spaces included in a certain column is 0, discarding the number of target grid spaces which are 0, and then acquiring the first number and the second number according to the number of the remaining target grid spaces.
Step 204: and according to the first number and the second number, fusing the target grid space in the third space-time data matrix with the adjacent grid space to obtain a first space-time data matrix.
And K represents the first number, S represents the second number, and the combined first time-space data matrix comprises a grid space of M-K rows and N-S columns.
This step may be performed by the following steps 2041 and 2042, respectively:
2041: selecting a first plurality of grid spaces from the x-th row in the third space-time data matrix, and fusing the selected grid spaces into adjacent grid spaces, wherein the selected grid spaces comprise target grid spaces in the x-th row, and x=1, 2 and 3 … … M.
Alternatively, the present step may be implemented by the following procedure, specifically:
(1-1): a grid space with the smallest number of stored events may be selected from row x, and the selected grid space is fused into its neighboring grid spaces.
(1-2): Judging whether the number of times of selection reaches the first number, if not, executing the step (1-3), and if so, ending the return.
(1-3): Selecting a grid space with the smallest number of stored events from the x-th row, fusing the selected grid space into the adjacent grid space, and returning to the execution (1-2).
2042: And selecting a second plurality of grid spaces from the y-th column in the third space-time data matrix, and fusing the selected grid spaces into adjacent grid spaces, wherein the selected grid spaces comprise target grid spaces in the y-th column, and y=1, 2 and 3 … ….
Alternatively, the present step may be implemented by the following procedure, specifically:
(2-1): a grid space with the smallest number of stored events may be selected from column y, and the selected grid space is fused into its neighboring grid spaces.
(2-2): Judging whether the selection times reach the first number, if not, executing the step (2-3), and if so, ending the return.
(2-3): Selecting a grid space with the smallest number of stored events from the y-th column, fusing the selected grid space into its neighboring grid spaces, and returning to the execution (2-2).
Optionally, the target grid space in the fifth space-time data matrix may be fused into the adjacent grid space to obtain a fourth space-time data matrix.
In the implementation, the target grid space in the fifth space-time data matrix can be fused into the adjacent grid space according to the first number and the second number to obtain a fourth space-time data matrix. The fusion process can be found in the operations of 2041 and 2042 described above, and will not be described in detail herein.
Step 205: according to the first time-space data matrix, a second time-space data matrix is obtained through a prediction model, each grid space in the second time-space data matrix corresponds to one area, the grid space is used for storing the number of events occurring in the area corresponding to the grid space in the (i+1) th time period, and the prediction model is obtained by fusing a CNN and a residual error network.
The method comprises the following steps: predicting a second space-time data matrix through a prediction model according to the first space-time data matrix; and setting the region corresponding to the grid space of the x-th row and the y-th column in the second space-time data matrix as the region corresponding to the grid space of the x-th row and the y-th column in the first space-time data matrix, wherein x and y are integers larger than 0.
Alternatively, referring to fig. 2-2, the prediction model is a model obtained by fusing N convolution units included in the CNN and N-1 residual units included in the residual network, where N is an integer greater than 1, in the prediction model, an output end of a jth convolution unit is connected to an input end of a jth residual unit, and an output end of the jth residual unit is connected to an input end of a jth+1th convolution unit, where j=1, 2 … … N-1.
Referring to fig. 2-2, the cnn includes a first convolution unit, a second convolution unit, …, and an nth convolution unit, and the residual network includes a first residual unit, a second residual unit, … …, and an nth residual unit. The output end of the first convolution unit is connected with the input end of the first residual unit, the output end of the first residual unit is connected with the input end of the second convolution unit, the output end of the second convolution unit is connected with the input end of the second residual unit, the output end of the second residual unit is connected with the input end of the third convolution unit, the output end of the third convolution unit is connected with the input end of the third residual unit, … …, and the output end of the N-1 residual unit is connected with the input end of the N-th convolution unit. Still referring to fig. 2-2, the cnn further includes a full connection layer and an activation function module, and an output terminal of the nth convolution unit is connected to an input terminal of the full connection layer, and an output terminal of the full connection layer is connected to an input terminal of the activation function module. Thus, the CNN and the residual error network are fused into a prediction model.
In this step, the first time space data matrix may be input to a first convolution unit, the first convolution unit performs convolution operation on the first time space data matrix, and a first convolution result of the convolution operation is input to a first residual unit, where the first convolution result includes residual information, and the residual information is substantially an error information; the first residual unit performs residual processing on the first convolution result to obtain a first residual result, and inputs the first residual result to the second convolution unit, wherein the first residual unit eliminates all or part of residual information in the first convolution result when performing residual processing to obtain the first residual result; the second convolution unit carries out convolution operation on the first residual error result, and inputs a second convolution result obtained by the convolution operation to the second residual error unit, wherein the second convolution result comprises residual error information; the second residual unit carries out residual processing on the second convolution result to obtain a second residual result, and the second residual result is input to the third convolution unit; the … … (N-1) th residual unit receives the (N-1) th convolution result input by the (N-1) th convolution unit, carries out residual processing on the (N-1) th convolution result to obtain the (N-1) th residual result, and inputs the (N-1) th residual result to the (N) th convolution unit; the nth convolution unit carries out convolution operation on the (N-1) th residual result to obtain an nth convolution result, wherein the nth convolution result is a first feature matrix X RD, and the first feature matrix X RD obtained by the convolution operation is input to the full connection layer; and the full-connection layer predicts the first feature matrix X RD through the activation function module and outputs a second space-time data matrix.
Alternatively, the fourth spatio-temporal data matrix may be input into the prediction model, i.e. the second spatio-temporal data matrix is obtained by the prediction model from the first spatio-temporal data matrix and the fourth spatio-temporal data matrix.
The convolution result output by each convolution unit is a space-time data matrix in the (i+1) th unit time period, namely, a first convolution result, a second convolution result, … …, an N-1 th convolution result and a first feature matrix X RD are space-time data matrices in the (i+1) th unit time period, so each convolution unit is used for predicting an event occurring in the (i+1) th unit time period, and each residual unit is used for eliminating or partially eliminating residual information in the convolution result input to the residual unit. The first feature matrix X RD is processed by N-1 residual units, and all or part of residual information in the first feature matrix X RD is eliminated.
Referring to fig. 2-3, such that the first and fourth time-space data matrices are input to the first convolution unit, respectively, at the time of prediction; the first space-time data matrix is processed by a first convolution unit, a first residual error unit, a second convolution unit, a second residual error unit, … …, an N-1 convolution unit, an N-1 residual error unit and an N convolution unit respectively to obtain a first feature matrix X RD. The fourth time space data matrix is processed by a first convolution unit, a first residual error unit, a second convolution unit, a second residual error unit, … …, an N-1 convolution unit, an N-1 residual error unit and an N convolution unit respectively to obtain a second feature matrix X CPD; the first feature matrix X RD and the second feature matrix X CPD are combined in a weighted mode to obtain a third feature matrix X CR,XCR=a*XRD+b*XCPD, a is a first preset weight, b is a second preset weight, and multiplication is performed; inputting the combined third feature matrix X CR to the full connection layer; and the full connection layer predicts the third feature matrix X CR through the activation function module and outputs a second space-time data matrix.
Wherein one or more external factors may occur per unit time period, and for external factors occurring within the i-th unit time period, the external factors may affect events occurring within the i+1th unit time period, the i+2th unit time period … … th+m unit time period, where M is an integer greater than or equal to 0. External factors may be weather, holidays, etc. For example, weather such as thunderstorms, snowfalls, or strong winds may occur in the ith unit time period, and if the predicted event occurring in the (i+1) th unit time period is traffic or flow, the weather may have an effect on the flow of traffic and/or flow of traffic.
Therefore, in order to improve the accuracy of prediction, the external factor matrix X OF corresponding to the external factor is obtained during the prediction, that is, the external factor matrix X OF corresponding to the i-th unit time period can be obtained, the structure of the external factor matrix X OF is the same as that of the first time space data matrix, and the external factor matrix X OF is used for reflecting the influence of the external factor occurring in the i-th unit time period of the current period on the events occurring in each unit time period after the i+1th unit time period and the i+1th unit time period; and inputting an external factor matrix X OF corresponding to the ith unit time period into the prediction model.
Referring to fig. 2 to 4, when only the first time-space data matrix is input to the prediction model, a first feature matrix X RD can be obtained through the prediction model according to the first time-space data matrix; and then the first feature matrix X RD and the external factor matrix X OF are weighted and combined to obtain a fourth feature matrix X END,XEND=c*XRD+d*XOF, c is a third preset weight, d is a fourth preset weight, and the fourth feature matrix X END is input to the full connection layer. And the full connection layer predicts the fourth feature matrix X END through an activation function module and outputs a second space-time data matrix. Or alternatively
Referring to fig. 2 to 5, when the first and fourth time-space data matrices are input to the prediction model, a third feature matrix X CR is obtained through the prediction model according to the first and fourth time-space data matrices; and then, weighting and combining the third feature matrix X CR and the external factor matrix X OF to obtain a fourth feature matrix X END,XEND=e*XCR+f*XOF, wherein e is a fifth preset weight, f is a sixth preset weight, and inputting the fourth feature matrix X END into the full connection layer. And the full connection layer predicts the fourth feature matrix X END through an activation function module and outputs a second space-time data matrix.
Optionally, the external factor matrix corresponding to each external event may be preset in advance, and the structure of the external factor matrix is the same as that of the first time space data matrix and the fourth time space data matrix.
In the embodiment of the application, a third space-time data matrix is established by acquiring a first data set, wherein the first data set comprises space-time data of each event occurring in the ith unit time period of the current period, each grid space in the first space-time data matrix corresponds to an area, and the grid space is used for storing the number of the events occurring in the area corresponding to the grid space in the ith unit time period; fusing a target grid space in the third space-time data matrix into a grid space adjacent to the target grid space to obtain a first space-time data matrix, wherein the number of events included in the target grid space is smaller than a preset number threshold; according to the first time-space data matrix, a second time-space data matrix is obtained, each grid space in the second time-space data matrix corresponds to one area, and the grid space is used for storing the number of events occurring in the area corresponding to the grid space in the (i+1) th unit time period, so that the number of events occurring in each area in the (i+1) th unit time period can be predicted, and event prediction is realized. In addition, as the target grid space in the third space-time data matrix is fused into the grid space adjacent to the target grid space to obtain the first space-time data matrix, the number of events included in the target grid space is smaller than a preset number threshold, the sparsity of the space-time data matrix can be reduced, the information loss can be reduced during prediction, and the accuracy of a prediction result is improved. Finally, the prediction model formed by fusing the CNN and the residual error network constructs the model from multiple angles such as time, space, external event factors and the like, influences on the target event prediction are fused in multiple aspects, the time and space correlation among the events are comprehensively considered, the information loss caused by the model in the prediction process is reduced through the residual error network, and thus the accuracy of the event prediction can be further improved. In addition, the established space-time data matrix also takes the advantages of space-time correlation, capability of changing trend of the whole reaction, wider application range, stronger universality, good management support for related management departments and the like into consideration.
The following are examples of the apparatus of the present application that may be used to perform the method embodiments of the present application. For details not disclosed in the embodiments of the apparatus of the present application, please refer to the embodiments of the method of the present application.
Referring to fig. 3, an embodiment of the present application provides an apparatus 300 for event prediction, the apparatus 300 including:
A building module 301, configured to build a first space-time data matrix according to a first data set, where the first data set includes space-time data of each event occurring in an ith unit time period of a current period, each grid space in the first space-time data matrix corresponds to an area, and the grid space is configured to store a number of events occurring in the area corresponding to the grid space in the ith unit time period, where i is an integer greater than 0;
The obtaining module 302 is configured to obtain a second spatio-temporal data matrix according to the first spatio-temporal data matrix through a prediction model, where a grid space in the second spatio-temporal data matrix is used to store the number of events occurring in a region corresponding to the grid space in the (i+1) th unit time period, and the prediction model is a model obtained by fusing a convolutional neural network CNN and a residual network.
Optionally, the prediction model is a model obtained by fusing N convolution units included in the CNN and N-1 residual units included in the residual network, N is an integer greater than 1, in the prediction model, an output end of a jth convolution unit is connected with an input end of a jth residual unit, an output end of the jth residual unit is connected with an input end of a jth+1th convolution unit, and j=1, 2 … … N-1.
Optionally, the establishing module 301 is configured to:
establishing a third space-time data matrix according to the first data set, wherein each grid space in the third space-time data matrix corresponds to an area, and the grid space is used for storing the number of events occurring in the area corresponding to the grid space in the ith unit time period, and i is an integer greater than 0;
And fusing a target grid space in the third space-time data matrix with a grid space adjacent to the target network space to obtain a first space-time data matrix, wherein the number of events included in the target grid space is smaller than a preset number threshold.
Optionally, the establishing module 301 is configured to:
Selecting a first plurality of grid spaces with the smallest number of included events from an x-th row in the third space-time data matrix, and fusing the selected grid spaces with adjacent grid spaces, wherein x=1, 2 and 3 … …;
And selecting a second plurality of grid spaces with the smallest number of included events from a y-th column in the third space-time data matrix, and fusing the selected grid spaces with adjacent grid spaces, wherein y=1, 2 and 3 … ….
Optionally, the apparatus 300 further includes: the selection module is used for selecting the selection module,
The acquisition module is further configured to acquire the number of target grid spaces included in each row and the number of target grid spaces included in each column in the first space-time data matrix;
The selecting module is configured to select a grid space number from the target grid space numbers included in each row as a first number, and select a grid space number from the target grid space numbers included in each column as a second number.
Optionally, the apparatus 300 further includes:
and the setting module is used for setting that the area corresponding to the new grid space comprises the area corresponding to the target grid space and the area corresponding to the adjacent grid space when the target grid space and the adjacent grid space are fused into the new grid space.
Optionally, the establishing module 301 is further configured to establish a fourth time-space data matrix according to a second data set, where the second data set includes time-space data of each event occurring in an i-th unit time period of a target period, the target period is earlier than the current period, a grid space in the fourth time-space data matrix is used to store a number of events occurring in an area corresponding to the grid space in the i-th unit time period of the target period, and a structure of the fourth time-space data matrix is the same as a structure of the first time-space data matrix;
The obtaining module 302 is configured to obtain a second spatiotemporal data matrix according to the first spatiotemporal data matrix and the fourth spatiotemporal data matrix through the prediction model.
Optionally, the establishing module 301 is configured to:
Establishing a fifth space-time data matrix according to the second data set, wherein a grid space in the fifth space-time data matrix is used for storing the number of events occurring in a region corresponding to the grid space in the ith time period of the target period;
And fusing the target grid space in the fifth space-time data matrix with the grid space adjacent to the target grid space to obtain a fourth space-time data matrix.
Optionally, the acquiring module 302 is configured to:
Acquiring an external factor matrix of an ith unit time period of a current period, wherein the structure of the external factor matrix is the same as that of the first time space data matrix, and the external factor matrix is used for reflecting the influence of external factors occurring in the ith unit time period of the current period on events occurring in unit time periods after the ith unit time period;
and acquiring a second space-time data matrix through a prediction model according to the first space-time data matrix and the external factor matrix.
In the embodiment of the application, a third space-time data matrix is established by acquiring a first data set, wherein the first data set comprises space-time data of each event occurring in the ith unit time period of the current period, each grid space in the first space-time data matrix corresponds to an area, and the grid space is used for storing the number of the events occurring in the area corresponding to the grid space in the ith unit time period; fusing a target grid space in the third space-time data matrix into a grid space adjacent to the target grid space to obtain a first space-time data matrix, wherein the number of events included in the target grid space is smaller than a preset number threshold; according to the first time-space data matrix, a second time-space data matrix is obtained, each grid space in the second time-space data matrix corresponds to one area, and the grid space is used for storing the number of events occurring in the area corresponding to the grid space in the (i+1) th unit time period, so that the number of events occurring in each area in the (i+1) th unit time period can be predicted, and event prediction is realized.
The specific manner in which the various modules perform the operations in the apparatus of the above embodiments have been described in detail in connection with the embodiments of the method, and will not be described in detail herein.
Fig. 4 shows a block diagram of a terminal 400 according to an exemplary embodiment of the present invention. The terminal 400 may be a portable mobile terminal such as: a smart phone, a tablet computer, an MP3 player (Moving Picture Experts Group Audio Layer III, motion picture expert compression standard audio plane 3), an MP4 (Moving Picture Experts Group Audio Layer IV, motion picture expert compression standard audio plane 4) player, a notebook computer, or a desktop computer. The terminal 400 may also be referred to by other names as user equipment, portable terminal, laptop terminal, desktop terminal, etc.
In general, the terminal 400 includes: a processor 401 and a memory 402.
Processor 401 may include one or more processing cores such as a 4-core processor, an 8-core processor, etc. The processor 401 may be implemented in at least one hardware form of DSP (DIGITAL SIGNAL Processing), FPGA (Field-Programmable gate array), PLA (Programmable Logic Array ). Processor 401 may also include a main processor, which is a processor for processing data in an awake state, also called a CPU (Central Processing Unit ), and a coprocessor; a coprocessor is a low-power processor for processing data in a standby state. In some embodiments, the processor 401 may integrate a GPU (Graphics Processing Unit, image processor) for rendering and drawing of content required to be displayed by the display screen. In some embodiments, the processor 401 may also include an AI (ARTIFICIAL INTELLIGENCE ) processor for processing computing operations related to machine learning.
Memory 402 may include one or more computer-readable storage media, which may be non-transitory. Memory 402 may also include high-speed random access memory, as well as non-volatile memory, such as one or more magnetic disk storage devices, flash memory storage devices. In some embodiments, a non-transitory computer readable storage medium in memory 402 is used to store at least one instruction for execution by processor 401 to implement the method of event prediction provided by the method embodiments of the present application.
In some embodiments, the terminal 400 may further optionally include: a peripheral interface 403 and at least one peripheral. The processor 401, memory 402, and peripheral interface 403 may be connected by a bus or signal line. The individual peripheral devices may be connected to the peripheral device interface 403 via buses, signal lines or a circuit board. Specifically, the peripheral device includes: at least one of radio frequency circuitry 404, a touch display 405, a camera 406, audio circuitry 407, a positioning component 408, and a power supply 409.
Peripheral interface 403 may be used to connect at least one Input/Output (I/O) related peripheral to processor 401 and memory 402. In some embodiments, processor 401, memory 402, and peripheral interface 403 are integrated on the same chip or circuit board; in some other embodiments, either or both of the processor 401, memory 402, and peripheral interface 403 may be implemented on separate chips or circuit boards, which is not limited in this embodiment.
The Radio Frequency circuit 404 is configured to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The radio frequency circuitry 404 communicates with a communication network and other communication devices via electromagnetic signals. The radio frequency circuit 404 converts an electrical signal into an electromagnetic signal for transmission, or converts a received electromagnetic signal into an electrical signal. Optionally, the radio frequency circuit 404 includes: antenna systems, RF transceivers, one or more amplifiers, tuners, oscillators, digital signal processors, codec chipsets, subscriber identity module cards, and so forth. The radio frequency circuitry 404 may communicate with other terminals via at least one wireless communication protocol. The wireless communication protocol includes, but is not limited to: the world wide web, metropolitan area networks, intranets, generation mobile communication networks (2G, 3G, 4G, and 5G), wireless local area networks, and/or WiFi (WIRELESS FIDELITY ) networks. In some embodiments, the radio frequency circuit 404 may further include NFC (NEAR FIELD Communication) related circuits, which is not limited by the present application.
The display screen 405 is used to display a UI (User Interface). The UI may include graphics, text, icons, video, and any combination thereof. When the display screen 405 is a touch display screen, the display screen 405 also has the ability to collect touch signals at or above the surface of the display screen 405. The touch signal may be input as a control signal to the processor 401 for processing. At this time, the display screen 405 may also be used to provide virtual buttons and/or a virtual keyboard, also referred to as soft buttons and/or a soft keyboard. In some embodiments, the display 405 may be one, providing a front panel of the terminal 400; in other embodiments, the display 405 may be at least two, and disposed on different surfaces of the terminal 400 or in a folded design; in still other embodiments, the display 405 may be a flexible display disposed on a curved surface or a folded surface of the terminal 400. Even more, the display screen 405 may be arranged in an irregular pattern that is not rectangular, i.e. a shaped screen. The display screen 405 may be made of materials such as an LCD (Liquid CRYSTAL DISPLAY) and an OLED (Organic Light-Emitting Diode).
The camera assembly 406 is used to capture images or video. Optionally, camera assembly 406 includes a front camera and a rear camera. Typically, the front camera is disposed on the front panel of the terminal and the rear camera is disposed on the rear surface of the terminal. In some embodiments, the at least two rear cameras are any one of a main camera, a depth camera, a wide-angle camera and a tele camera, so as to realize that the main camera and the depth camera are fused to realize a background blurring function, and the main camera and the wide-angle camera are fused to realize a panoramic shooting and Virtual Reality (VR) shooting function or other fusion shooting functions. In some embodiments, camera assembly 406 may also include a flash. The flash lamp can be a single-color temperature flash lamp or a double-color temperature flash lamp. The dual-color temperature flash lamp refers to a combination of a warm light flash lamp and a cold light flash lamp, and can be used for light compensation under different color temperatures.
The audio circuit 407 may include a microphone and a speaker. The microphone is used for collecting sound waves of users and environments, converting the sound waves into electric signals, and inputting the electric signals to the processor 401 for processing, or inputting the electric signals to the radio frequency circuit 404 for realizing voice communication. For the purpose of stereo acquisition or noise reduction, a plurality of microphones may be respectively disposed at different portions of the terminal 400. The microphone may also be an array microphone or an omni-directional pickup microphone. The speaker is used to convert electrical signals from the processor 401 or the radio frequency circuit 404 into sound waves. The speaker may be a conventional thin film speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, not only the electric signal can be converted into a sound wave audible to humans, but also the electric signal can be converted into a sound wave inaudible to humans for ranging and other purposes. In some embodiments, audio circuit 407 may also include a headphone jack.
The location component 408 is used to locate the current geographic location of the terminal 400 to enable navigation or LBS (Location Based Service, location-based services). The positioning component 408 may be a positioning component based on the United states GPS (Global Positioning System ), the Beidou system of China, or the Galileo system of Russia.
The power supply 409 is used to power the various components in the terminal 400. The power supply 409 may be an alternating current, a direct current, a disposable battery, or a rechargeable battery. When power supply 409 comprises a rechargeable battery, the rechargeable battery may be a wired rechargeable battery or a wireless rechargeable battery. The wired rechargeable battery is a battery charged through a wired line, and the wireless rechargeable battery is a battery charged through a wireless coil. The rechargeable battery may also be used to support fast charge technology.
In some embodiments, the terminal 400 further includes one or more sensors 410. The one or more sensors 410 include, but are not limited to: acceleration sensor 411, gyroscope sensor 412, pressure sensor 413, fingerprint sensor 414, optical sensor 415, and proximity sensor 416.
The acceleration sensor 411 may detect the magnitudes of accelerations on three coordinate axes of the coordinate system established with the terminal 400. For example, the acceleration sensor 411 may be used to detect components of gravitational acceleration on three coordinate axes. The processor 401 may control the touch display screen 405 to display a user interface in a lateral view or a longitudinal view according to the gravitational acceleration signal acquired by the acceleration sensor 411. The acceleration sensor 411 may also be used for the acquisition of motion data of a game or a user.
The gyro sensor 412 may detect a body direction and a rotation angle of the terminal 400, and the gyro sensor 412 may collect a 3D motion of the user to the terminal 400 in cooperation with the acceleration sensor 411. The processor 401 may implement the following functions according to the data collected by the gyro sensor 412: motion sensing (e.g., changing UI according to a tilting operation by a user), image stabilization at shooting, game control, and inertial navigation.
The pressure sensor 413 may be disposed at a side frame of the terminal 400 and/or at a lower layer of the touch display 405. When the pressure sensor 413 is disposed at a side frame of the terminal 400, a grip signal of the terminal 400 by a user may be detected, and the processor 401 performs a left-right hand recognition or a shortcut operation according to the grip signal collected by the pressure sensor 413. When the pressure sensor 413 is disposed at the lower layer of the touch display screen 405, the processor 401 controls the operability control on the UI interface according to the pressure operation of the user on the touch display screen 405. The operability controls include at least one of a button control, a scroll bar control, an icon control, and a menu control.
The fingerprint sensor 414 is used to collect a fingerprint of the user, and the processor 401 identifies the identity of the user based on the fingerprint collected by the fingerprint sensor 414, or the fingerprint sensor 414 identifies the identity of the user based on the collected fingerprint. Upon recognizing that the user's identity is a trusted identity, the user is authorized by the processor 401 to perform relevant sensitive operations including unlocking the screen, viewing encrypted information, downloading software, paying for and changing settings, etc. The fingerprint sensor 414 may be provided on the front, back or side of the terminal 400. When a physical key or vendor Logo is provided on the terminal 400, the fingerprint sensor 414 may be integrated with the physical key or vendor Logo.
The optical sensor 415 is used to collect the ambient light intensity. In one embodiment, the processor 401 may control the display brightness of the touch display screen 405 according to the ambient light intensity collected by the optical sensor 415. Specifically, when the intensity of the ambient light is high, the display brightness of the touch display screen 405 is turned up; when the ambient light intensity is low, the display brightness of the touch display screen 405 is turned down. In another embodiment, the processor 401 may also dynamically adjust the shooting parameters of the camera assembly 406 according to the ambient light intensity collected by the optical sensor 415.
A proximity sensor 416, also referred to as a distance sensor, is typically provided on the front panel of the terminal 400. The proximity sensor 416 is used to collect the distance between the user and the front of the terminal 400. In one embodiment, when the proximity sensor 416 detects a gradual decrease in the distance between the user and the front face of the terminal 400, the processor 401 controls the touch display 405 to switch from the bright screen state to the off screen state; when the proximity sensor 416 detects that the distance between the user and the front surface of the terminal 400 gradually increases, the processor 401 controls the touch display screen 405 to switch from the off-screen state to the on-screen state.
Those skilled in the art will appreciate that the structure shown in fig. 4 is not limiting of the terminal 400 and may include more or fewer components than shown, or may combine certain components, or may employ a different arrangement of components.
Other embodiments of the application will be apparent to those skilled in the art from consideration of the specification and practice of the application disclosed herein. This application is intended to cover any variations, uses, or adaptations of the application following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the application pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the application being indicated by the following claims.
It is to be understood that the application is not limited to the precise arrangements and instrumentalities shown in the drawings, which have been described above, and that various modifications and changes may be effected without departing from the scope thereof. The scope of the application is limited only by the appended claims.

Claims (10)

1. A method of event prediction, wherein the event comprises at least one of: detecting a human body, detecting a vehicle and detecting a traffic accident; the method comprises the following steps:
Establishing a third space-time data matrix according to a first data set, wherein the first data set comprises space-time data of each event occurring in the ith unit time period of the current period, each grid space in the third space-time data matrix corresponds to an area, and the grid space is used for storing the number of the events occurring in the area corresponding to the grid space in the ith unit time period, and i is an integer greater than 0;
Fusing a target grid space in the third space-time data matrix with grid spaces adjacent to the target grid space to obtain a first space-time data matrix, wherein the number of events included in the target grid space is smaller than a preset number threshold value, each grid space in the first space-time data matrix corresponds to an area, and the grid space is used for storing the number of events occurring in the area corresponding to the grid space in the ith unit time period, and i is an integer larger than 0;
According to the first space-time data matrix, a second space-time data matrix is obtained through a prediction model, a grid space in the second space-time data matrix is used for storing the number of events occurring in a region corresponding to the grid space in the (i+1) th unit time period of the current period, and the prediction model is a model obtained by fusing a convolutional neural network CNN and a residual network; the prediction model is a model obtained by fusing N convolution units included in the CNN and N-1 residual units included in the residual network, N is an integer greater than 1, in the prediction model, the output end of a jth convolution unit is connected with the input end of a jth residual unit, the output end of the jth residual unit is connected with the input end of a j+1th convolution unit, and j=1, 2 … … N-1; the output end of the N-th convolution unit is connected with the input end of the full-connection layer, and the output end of the full-connection layer is connected with the input end of the activation function module; each convolution unit is used for predicting an event occurring in the (i+1) th unit time period, and each residual unit is used for eliminating or partially eliminating residual information in a convolution result input to the residual unit;
Establishing a fourth time-space data matrix according to a second data set, wherein the second data set comprises time-space data of each event occurring in the ith unit time period of a target period, the target period is earlier than the current period, a grid space in the fourth time-space data matrix is used for storing the number of events occurring in a region corresponding to the grid space in the ith unit time period of the target period, and the structure of the fourth time-space data matrix is the same as that of the first time-space data matrix;
The obtaining a second space-time data matrix through a prediction model according to the first space-time data matrix comprises the following steps: inputting the first time-space data matrix into a prediction model to obtain a first feature matrix output by an Nth convolution unit; inputting the fourth time-space data matrix into the prediction model to obtain a second feature matrix output by an Nth convolution unit; weighting and combining the first feature matrix and the second feature matrix to obtain a third feature matrix; inputting the third feature matrix to the full connection layer; the full connection layer predicts the third feature matrix through an activation function module and outputs a second space-time data matrix;
the fusing the target grid space in the third space-time data matrix with the adjacent grid space to obtain a first space-time data matrix includes:
Determining a target grid space of each row and a target grid space of each column in the third spatio-temporal data matrix; counting the number of the target grid spaces included in each row, selecting one grid space number from the number of the target grid spaces included in each row as a first number, counting the number of the target grid spaces included in each column, and selecting one grid space number from the number of the target grid spaces included in each column as a second number;
Selecting a first plurality of grid spaces with the smallest number of included events from an x-th row in the third space-time data matrix, and fusing the selected grid spaces with adjacent grid spaces, wherein x=1, 2 and 3 … …;
And selecting a second plurality of grid spaces with the smallest number of included events from a y-th column in the third space-time data matrix, and fusing the selected grid spaces with adjacent grid spaces, wherein y=1, 2 and 3 … ….
2. The method of claim 1, wherein after the fusing the target grid space in the third spatio-temporal data matrix with the adjacent grid space to obtain the first spatio-temporal data matrix, further comprising:
When the target grid space and the adjacent grid space are fused into a new grid space, the region corresponding to the new grid space is set to comprise the region corresponding to the target grid space and the region corresponding to the adjacent grid space.
3. The method of claim 1, wherein the obtaining a second spatiotemporal data matrix from the first spatiotemporal data matrix by a predictive model comprises:
and acquiring a second space-time data matrix through the prediction model according to the first space-time data matrix and the fourth space-time data matrix.
4. The method of claim 3, wherein the establishing a fourth time-space data matrix from the second data set comprises:
Establishing a fifth space-time data matrix according to the second data set, wherein a grid space in the fifth space-time data matrix is used for storing the number of events occurring in a region corresponding to the grid space in the ith time period of the target period;
And fusing the target grid space in the fifth space-time data matrix with the grid space adjacent to the target grid space to obtain a fourth space-time data matrix.
5. The method of claim 1, wherein the obtaining a second spatiotemporal data matrix from the first spatiotemporal data matrix by a predictive model comprises:
Acquiring an external factor matrix of an ith unit time period of a current period, wherein the structure of the external factor matrix is the same as that of the first time space data matrix, and the external factor matrix is used for reflecting the influence of external factors occurring in the ith unit time period of the current period on events occurring in unit time periods after the ith unit time period;
and acquiring a second space-time data matrix through a prediction model according to the first space-time data matrix and the external factor matrix.
6. An apparatus for event prediction, wherein the event comprises at least one of: detecting a human body, detecting a vehicle and detecting a traffic accident; the device comprises:
The system comprises a building module, a storage module and a data processing module, wherein the building module is used for building a third space-time data matrix according to a first data set, the first data set comprises space-time data of each event occurring in an ith unit time period of a current period, each grid space in the third space-time data matrix corresponds to an area, the grid space is used for storing the number of the events occurring in the area corresponding to the grid space in the ith unit time period, and i is an integer larger than 0; fusing a target grid space in the third space-time data matrix with grid spaces adjacent to the target grid space to obtain a first space-time data matrix, wherein the number of events included in the target grid space is smaller than a preset number threshold value, each grid space in the first space-time data matrix corresponds to an area, and the grid space is used for storing the number of events occurring in the area corresponding to the grid space in the ith unit time period, and i is an integer larger than 0;
The acquisition module is used for acquiring a second space-time data matrix through a prediction model according to the first space-time data matrix, wherein a grid space in the second space-time data matrix is used for storing the number of events occurring in a region corresponding to the grid space in the (i+1) th unit time period of the current period, and the prediction model is a model obtained by fusing a convolutional neural network CNN and a residual network; the prediction model is a model obtained by fusing N convolution units included in the CNN and N-1 residual units included in the residual network, N is an integer greater than 1, in the prediction model, the output end of a jth convolution unit is connected with the input end of a jth residual unit, the output end of the jth residual unit is connected with the input end of a j+1th convolution unit, and j=1, 2 … … N-1; the output end of the N-th convolution unit is connected with the input end of the full-connection layer, and the output end of the full-connection layer is connected with the input end of the activation function module; each convolution unit is used for predicting an event occurring in the (i+1) th unit time period, and each residual unit is used for eliminating or partially eliminating residual information in a convolution result input to the residual unit;
The building module is further configured to build a fourth space-time data matrix according to a second data set, where the second data set includes space-time data of each event occurring in an ith unit time period of a target period, the target period is earlier than the current period, a grid space in the fourth space-time data matrix is used to store a number of events occurring in an area corresponding to the grid space in the ith unit time period of the target period, and a structure of the fourth space-time data matrix is the same as a structure of the first space-time data matrix;
The acquisition module is used for inputting the first time-space data matrix into a prediction model to obtain a first feature matrix output by an Nth convolution unit; inputting the fourth time-space data matrix into the prediction model to obtain a second feature matrix output by an Nth convolution unit; weighting and combining the first feature matrix and the second feature matrix to obtain a third feature matrix; inputting the third feature matrix to the full connection layer; the full connection layer predicts the third feature matrix through an activation function module and outputs a second space-time data matrix;
the fusing the target grid space in the third space-time data matrix with the adjacent grid space to obtain a first space-time data matrix includes:
Determining a target grid space of each row and a target grid space of each column in the third spatio-temporal data matrix; counting the number of the target grid spaces included in each row, selecting one grid space number from the number of the target grid spaces included in each row as a first number, counting the number of the target grid spaces included in each column, and selecting one grid space number from the number of the target grid spaces included in each column as a second number;
Selecting a first plurality of grid spaces with the smallest number of included events from an x-th row in the third space-time data matrix, and fusing the selected grid spaces with adjacent grid spaces, wherein x=1, 2 and 3 … …;
And selecting a second plurality of grid spaces with the smallest number of included events from a y-th column in the third space-time data matrix, and fusing the selected grid spaces with adjacent grid spaces, wherein y=1, 2 and 3 … ….
7. The apparatus of claim 6, wherein the apparatus further comprises:
and the setting module is used for setting that the area corresponding to the new grid space comprises the area corresponding to the target grid space and the area corresponding to the adjacent grid space when the target grid space and the adjacent grid space are fused into the new grid space.
8. The apparatus of claim 6, wherein the means for obtaining is configured to obtain a second spatio-temporal data matrix from the prediction model based on the first spatio-temporal data matrix and the fourth spatio-temporal data matrix.
9. The apparatus of claim 8, wherein the means for establishing is to:
Establishing a fifth space-time data matrix according to the second data set, wherein a grid space in the fifth space-time data matrix is used for storing the number of events occurring in a region corresponding to the grid space in the ith time period of the target period;
And fusing the target grid space in the fifth space-time data matrix with the grid space adjacent to the target grid space to obtain a fourth space-time data matrix.
10. The apparatus of claim 6, wherein the acquisition module is to:
Acquiring an external factor matrix of an ith unit time period of a current period, wherein the structure of the external factor matrix is the same as that of the first time space data matrix, and the external factor matrix is used for reflecting the influence of external factors occurring in the ith unit time period of the current period on events occurring in the unit time periods between the ith unit time periods;
and acquiring a second space-time data matrix through a prediction model according to the first space-time data matrix and the external factor matrix.
CN201810778702.0A 2018-07-16 2018-07-16 Event prediction method and device Active CN110728390B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810778702.0A CN110728390B (en) 2018-07-16 2018-07-16 Event prediction method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810778702.0A CN110728390B (en) 2018-07-16 2018-07-16 Event prediction method and device

Publications (2)

Publication Number Publication Date
CN110728390A CN110728390A (en) 2020-01-24
CN110728390B true CN110728390B (en) 2024-04-23

Family

ID=69217313

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810778702.0A Active CN110728390B (en) 2018-07-16 2018-07-16 Event prediction method and device

Country Status (1)

Country Link
CN (1) CN110728390B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111798662A (en) * 2020-07-31 2020-10-20 公安部交通管理科学研究所 Urban traffic accident early warning method based on space-time gridding data
CN113192325B (en) * 2021-04-19 2022-06-24 银江技术股份有限公司 Traffic incident correlation analysis method and system

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2018009887A1 (en) * 2016-07-08 2018-01-11 University Of Hawaii Joint analysis of multiple high-dimensional data using sparse matrix approximations of rank-1
CN108053080A (en) * 2017-12-30 2018-05-18 中国移动通信集团江苏有限公司 Zone user quantity statistics value Forecasting Methodology, device, equipment and medium
CN108108844A (en) * 2017-12-25 2018-06-01 儒安科技有限公司 A kind of urban human method for predicting and system

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10235403B2 (en) * 2014-07-08 2019-03-19 Palo Alto Research Center Incorporated Parallel collective matrix factorization framework for big data

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2018009887A1 (en) * 2016-07-08 2018-01-11 University Of Hawaii Joint analysis of multiple high-dimensional data using sparse matrix approximations of rank-1
CN108108844A (en) * 2017-12-25 2018-06-01 儒安科技有限公司 A kind of urban human method for predicting and system
CN108053080A (en) * 2017-12-30 2018-05-18 中国移动通信集团江苏有限公司 Zone user quantity statistics value Forecasting Methodology, device, equipment and medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
郝雅娴 等.K-近邻矩阵分解推荐系统算法.《小型微型计算机系统》.2018,第39卷(第4期),755-758页. *

Also Published As

Publication number Publication date
CN110728390A (en) 2020-01-24

Similar Documents

Publication Publication Date Title
CN108304265B (en) Memory management method, device and storage medium
CN110380904B (en) Bandwidth allocation method and device, electronic equipment and storage medium
CN108363982B (en) Method and device for determining number of objects
CN112084811B (en) Identity information determining method, device and storage medium
CN110839128B (en) Photographing behavior detection method and device and storage medium
CN111754386B (en) Image area shielding method, device, equipment and storage medium
CN110991445B (en) Vertical text recognition method, device, equipment and medium
CN110728390B (en) Event prediction method and device
CN110471614B (en) Method for storing data, method and device for detecting terminal
CN111860064B (en) Video-based target detection method, device, equipment and storage medium
CN112749590B (en) Object detection method, device, computer equipment and computer readable storage medium
CN111611414B (en) Vehicle searching method, device and storage medium
CN111223311B (en) Traffic flow control method, device, system, control equipment and storage medium
CN112882094B (en) First-arrival wave acquisition method and device, computer equipment and storage medium
CN111179628B (en) Positioning method and device for automatic driving vehicle, electronic equipment and storage medium
CN112241987B (en) System, method, device and storage medium for determining defense area
CN112052153B (en) Product version testing method and device
CN111984755A (en) Method and device for determining target parking point, electronic equipment and storage medium
CN111638564A (en) Rainfall forecasting method, device, equipment and storage medium
CN116681755B (en) Pose prediction method and device
CN113658283B (en) Image processing method, device, electronic equipment and storage medium
CN113052408B (en) Method and device for community aggregation
CN114615520B (en) Subtitle positioning method, subtitle positioning device, computer equipment and medium
CN112347604B (en) Method and device for determining vehicle path set
CN113409235B (en) Vanishing point estimation method and apparatus

Legal Events

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