Traffic incident identification method, computer equipment and storage medium
By extracting features of traffic participants and traffic scenes in multi-frame images, generating temporal features and performing associated recognition, the problem of low traffic event recognition accuracy in the existing technology is solved, and higher recognition accuracy and adaptability are achieved.
Patent Information
- Application Number
- CN202410988200.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-23
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2044-07-23
AI Technical Summary
Existing technologies have low accuracy when identifying traffic events and cannot effectively adapt to complex traffic scenarios.
By acquiring multiple frames of images, the initial features of traffic participants and traffic scenes are extracted, time series features are comprehensively generated, and time series correlation is used for traffic event recognition.
It improves the accuracy of traffic event recognition, has strong adaptability, and can effectively identify traffic events in different application scenarios.
Smart Images

Figure CN118521945B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of intelligent transportation technology, and in particular to a method for identifying a traffic event, a computer device, and a storage medium. Background Art
[0002] With the rapid development of intelligent transportation, the demand for identifying traffic events is also growing.
[0003] At present, it is usually to extract image features and then identify traffic events based on the extracted image features. Since actual traffic scenes are complex and diverse, the above methods cannot effectively identify traffic events, have poor applicability, and have low accuracy in identifying traffic events. Summary of the invention
[0004] The main technical problem solved by the present application is to provide a method for identifying traffic events, a computer device and a storage medium, which can improve the accuracy of traffic event identification.
[0005] In order to solve the above problems, the first aspect of the present application provides a method for identifying traffic events, which includes: acquiring multiple frames of images collected in a target area; processing the multiple frames of images to obtain a first initial feature of traffic participants and a second initial feature of the traffic scene in each frame of the image; respectively integrating the first initial feature and the second initial feature of the multiple frames of the image to obtain a first time series feature of the traffic participants and a second time series feature of the traffic scene; utilizing the time series association between the first time series feature and the second time series feature to identify traffic events and obtain a traffic event identification result for the target area.
[0006] In order to solve the above problem, the second aspect of the present application provides a computer device, which includes a memory and a processor coupled to each other, the memory stores program data, and the processor is used to execute the program data to implement any step of the above traffic event identification method.
[0007] In order to solve the above-mentioned problem, the third aspect of the present application provides a computer-readable storage medium, which stores program data that can be executed by a processor, and the program data is used to implement any step of the above-mentioned traffic event identification method.
[0008] The above scheme obtains multiple frames of images collected in the target area, processes the multiple frames of images, obtains the first initial features of traffic participants and the second initial features of traffic scenes in each frame of images, and respectively integrates the first initial features and the second initial features of the multiple frames of images to obtain the first time series features of traffic participants and the second time series features of traffic scenes. In this way, the time series features of traffic participants and traffic scenes in the multiple frames of images can be obtained. Then, the time series association between the first time series features and the second time series features is comprehensively utilized to perform traffic event recognition, and the traffic event recognition results of the target area are obtained. The characteristics of traffic participants and traffic scenes in the multiple frames of images are comprehensively considered, and traffic events can be recognized in different application scenarios. It has strong adaptability and can improve the accuracy of traffic event recognition.
[0009] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] In order to more clearly illustrate the technical solutions in this application, the following briefly introduces the drawings required in the description of the embodiments. Obviously, the drawings described below are only some embodiments of this application. For ordinary technical workers in this field, other drawings can be obtained based on these drawings without creative work. Among them:
[0011] Figure 1 It is a flow chart of an embodiment of a method for identifying a traffic event of the present application;
[0012] Figure 2 This application Figure 1 A schematic diagram of a flow chart of an embodiment of step S12;
[0013] Figure 3 This application Figure 1 A schematic diagram of a flow chart of an embodiment of step S13;
[0014] Figure 4 This application Figure 1 A schematic diagram of a flow chart of an embodiment of step S14;
[0015] Figure 5 It is a structural schematic diagram of an embodiment of a traffic event recognition model of the present application;
[0016] Figure 6 It is a structural diagram of an embodiment of the self-attention layer of the present application;
[0017] Figure 7 It is a structural schematic diagram of an embodiment of a traffic event identification device of the present application;
[0018] Figure 8It is a structural schematic diagram of an embodiment of a computer device of the present application;
[0019] Fig. 9 It is a structural diagram of an embodiment of a computer-readable storage medium of the present application. DETAILED DESCRIPTION
[0020] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technical workers in the field without making creative work are within the scope of protection of this application.
[0021] The terms "first" and "second" in this application are only used for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features. Thus, the features defined as "first" and "second" can explicitly or implicitly include at least one of the features. In the description of this application, the meaning of "multiple" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally also includes steps or units that are not listed, or optionally also includes other steps or units inherent to these processes, methods, products or devices.
[0022] Reference to "embodiments" in this application means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0023] The term "and / or" in this article is only a description of the association relationship of associated objects, indicating that there may be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the objects associated before and after are in an "or" relationship. In addition, "many" in this article means two or more than two. In addition, the term "at least one" in this article means any combination of at least two of any one or more of a plurality of, for example, including at least one of A, B, and C, can mean including any one or more elements selected from the set consisting of A, B, and C.
[0024] The present application provides the following embodiments, and each embodiment is described in detail below.
[0025] It is understandable that the traffic event recognition method in the present application can be executed by a computer device, and the computer device can be any device with processing capabilities, such as a mobile phone, a computer, a server, etc., and the present application does not limit this. In some possible implementations, the traffic event recognition method can be implemented by a processor calling program data stored in a memory.
[0026] See also Figure 1 , Figure 1 1 is a flow chart of an embodiment of a method for identifying a traffic event of the present application. The method may include the following steps:
[0027] S11: Acquire multiple frames of images collected in the target area.
[0028] The target area may be an area where a traffic event needs to be identified, such as a camera device may be used to capture images of the target area to obtain multiple frames of images captured in the target area, and the multiple frames of images may be continuous images. This application does not limit the target area.
[0029] In some implementations, multiple frames of images captured in the target area may be obtained based on a target video captured in the target area.
[0030] Optionally, a target video captured in the target area can be obtained, and multiple frames of images can be obtained from the target video according to a preset sliding window. The preset sliding window can be used as a sliding window for traffic event recognition, and the multiple frames of images in each preset sliding window can be used to recognize traffic events respectively. For example, the preset sliding window uses T frames as a sliding window, and the spacing of the sliding window is L frames. If the target video has 10 frames, T is 5 frames, and L is 2 frames, then frames 1 to 5 can be used as T frames of the first preset sliding window, and frames 3 to 7 can be used as T frames of the second preset sliding window. And so on, multiple frames of images of multiple preset sliding windows can be obtained.
[0031] Optionally, the target video captured in the target area may be segmented to obtain continuous multi-frame images, and the traffic event may be identified for each segment of the multi-frame images.
[0032] It is understandable that the present application may also use other methods to determine the multiple frames of images of the target area, and the present application does not limit this. The following description is made by taking the multiple frames of images as T frames of images as an example.
[0033] S12: Processing multiple frames of images to obtain first initial features of traffic participants and second initial features of traffic scenes in each frame of image.
[0034] The multiple frames of images are processed separately, such as feature extraction and target detection for each frame of image, so as to obtain the first initial features of the traffic participants and the second initial features of the traffic scene of each frame of image. Among them, traffic participants refer to objects that are in motion or are about to enter motion in a vehicle, as well as transportation personnel and traffic managers. Objects that have a direct or indirect relationship with traffic, such as users of traffic work and dynamic objects, may be included. Exemplarily, traffic participants mainly include dynamic objects, users of various traffic work, and objects that use some public road traffic resources corresponding to their needs. The traffic scene may include the current traffic scene. Exemplarily, the traffic scene may include traffic participants and scenes to which traffic participants belong, etc. This application does not impose any restrictions on this.
[0035] In some embodiments, the first initial feature includes: a location feature, a category feature, and a local feature of a traffic participant. The second initial feature includes a global feature of a traffic scene. For each frame of an image, the location feature, the category feature, and the local feature of a traffic participant, as well as the global feature of a traffic scene, can be detected and extracted.
[0036] In some embodiments, see Figure 2 , step S12 of the above embodiment can be further expanded. Multiple frames of images are processed to obtain the first initial features of the traffic participants and the second initial features of the traffic scene of each frame of image. This embodiment may include the following steps:
[0037] S121: For each frame of the image, target detection is performed on the image to obtain position features and category features of the traffic participants.
[0038] For each frame of the image, a target detection network can be used to perform target detection on the image to obtain the position features and category features of the traffic participants. The position features can represent the position coordinates of the detection frame where the traffic participants are located, such as the size of the detection frame, preset coordinate points, for example, the preset coordinate points can be the center point coordinates, any corner coordinates of the detection frame (such as the upper left corner coordinates), etc., and the present application does not limit this. Exemplarily, the position features can be expressed as (x, y, w, h), where x and y respectively represent the preset coordinate points of the detection frame where the traffic participants are located, and w and h respectively represent the width and height of the detection frame where the traffic participants are located. Category features can represent the category of traffic participants, such as the category of vehicles, dynamic objects, etc. Among them, the target detection network is such as R-CNN (Region-CNN, target detection algorithm), YOLO (You Only Look Once, real-time target detection algorithm), etc., and the present application is not limited to this.
[0039] In addition, shallow features and deep features of each frame image can also be extracted to obtain local features of traffic participants and global features of traffic scenes respectively. Specifically, as follows:
[0040] S122: Based on the intermediate layer features of the target detection, the intermediate layer features of the first downsampling multiple are obtained to obtain the local features of the traffic participant.
[0041] The height and width of each frame image are H and W respectively, the number of channels of shallow features is N1, and the number of channels of deep features is N2.
[0042] The intermediate layer features of the target detection network can be saved as the intermediate layer features of the target detection. The intermediate layer features can be features of the preset layer output of the target detection network. For example, the preset layer is a layer other than the input layer and the output layer in the target detection network. For example, the preset layer is a layer before the last layer in the target detection network, etc. This application does not limit the intermediate layer features.
[0043] In some embodiments, shallow features can be extracted to obtain local features of traffic participants. Shallow features can refer to features extracted by the shallow network of the target detection network, which are closer to the input layer and contain more pixel information and fine-grained information (such as color, texture, edge or angular information). Its shallow feature receptive field is smaller and can capture more details.
[0044] In some implementations, the intermediate layer features of the first downsampling multiple P1 can be obtained based on the intermediate layer features of the target detection, and the shallow layer features of the traffic participants can be obtained. The shallow layer features can be used to extract the local features of the traffic participants, so as to obtain the local features of the traffic participants. The shallow layer features can be recorded as The first downsampling multiple P1 may be determined according to specific application scenarios and requirements, and the present application does not limit the scale of the first downsampling multiple P1.
[0045] For example, the intermediate layer features with the first downsampling factor of 4 can be taken to obtain the shallow features of the traffic participants. , and the obtained shallow features are used as the first initial features of traffic participants.
[0046] S123: Obtain the intermediate layer features of the second downsampling multiple to obtain the second initial features of the traffic scene, wherein the second initial features of the traffic scene are global features of the traffic scene, and the second downsampling multiple is greater than the first downsampling multiple.
[0047] In some embodiments, deep features can be extracted to obtain global features of the traffic scene. Deep features can represent features extracted by the deep network of the target detection network, which are closer to the output layer and can contain some coarse-grained information and more abstract semantic information. The receptive field of deep features is larger, and some information about the overall image can be obtained, which has stronger semantic information.
[0048] In some implementations, the intermediate layer features of the second downsampling multiple P2 can be obtained based on the intermediate layer features of the target detection to obtain the deep layer features of the traffic scene. The deep layer features can be recorded as The second initial feature of the traffic scene is a global feature of the traffic scene, and the second downsampling multiple is greater than the first downsampling multiple.
[0049] For example, the intermediate layer features with the second downsampling factor of 32 can be taken to obtain the deep features of the traffic scene, and the deep features are recorded as , and the acquired deep features can be used as the second initial features of the traffic scene, that is, the global features of the traffic scene. Among them, the second downsampling multiple can be determined according to the specific application scenario and requirements, and the application does not limit the scale of the second multiple P2.
[0050] In some application scenarios, after obtaining the deep features, the deep features can be globally pooled, and its dimension is , the features processed by global pooling are used as the global features of the traffic scene, that is, the second initial features of the traffic scene are obtained.
[0051] Through the above method, the position features, category features, and shallow features and deep features of different scales of each frame image can be obtained.
[0052] Continue reading Figure 1 , after the above step S12, the following steps are also included:
[0053] S13: respectively synthesizing the first initial features and the second initial features of the multiple frames of images to obtain the first time series features of the traffic participants and the second time series features of the traffic scene.
[0054] By integrating the first initial features of multiple frames of images such as T-frame images, the first time sequence features of traffic participants can be obtained. And, by integrating the second initial features of multiple frames of images such as T-frame images, the second time sequence features of traffic scenes can be obtained. The first time sequence features can include the time sequence between the first initial features, and the second time sequence features can include the time sequence between the second initial features.
[0055] In some embodiments, the first initial features of each traffic participant in the T frame image may be spliced to obtain the first time series features of the traffic participant, and the second initial features of the traffic scene in the T frame image may be spliced to obtain the second time series features of the traffic scene.
[0056] In some implementations, each traffic participant may be tracked to obtain a tracking result, and then the first initial features of each traffic participant in multiple frames of images may be integrated according to the tracking result to obtain the first time series features of the traffic participant. This application does not limit the method of obtaining the first time series features and the second time series features.
[0057] In some embodiments, see Figure 3 , step S13 of the above embodiment can be further expanded. The first initial features and the second initial features of the multiple frames of images are respectively integrated to obtain the first time series features of the traffic participants and the second time series features of the traffic scene. This embodiment may include the following steps:
[0058] S131: splicing the second initial features of multiple frames of images to obtain the second temporal features of the traffic scene.
[0059] The global features (i.e., the second initial features) of the traffic scene in multiple frames of images such as T frame images are spliced, and its dimension is , we can get the second time series characteristics of the traffic scene .
[0060] S132: Perform target tracking on multiple frames of images to determine target participants; wherein the target participants include traffic participants that meet preset tracking conditions.
[0061] Target tracking is performed on multiple frames of images to track each traffic participant. Then, the target participant is determined based on the tracking result of the target tracking. The target participant includes traffic participants that meet preset tracking conditions. In some application scenarios, traffic participants that meet the preset tracking conditions include at least one of the following: a second number of traffic participants that appear continuously in a preset number of images, and the number of traffic participants in the continuously appearing images is greater than a quantity threshold. The preset number is less than or equal to T frames. The quantity threshold is greater than or equal to 2. This application does not impose any restrictions on this.
[0062] In some embodiments, the first initial feature can be used to track the target on multiple frames of images. Specifically, the first initial feature includes the position feature of the traffic participant, the category feature of the traffic participant, and the local feature of the traffic participant. The position feature and category feature of the traffic participant can be used to track the target on multiple frames of images to obtain the tracking results of the multiple frames of images. Alternatively, the local features of the traffic participants can be selectively added for target tracking. For example, the position feature and local features of the traffic participants can be used to track the target on multiple frames of images to obtain the tracking results of the multiple frames of images.
[0063] Exemplarily, a target tracking network is used to track targets in multiple frames of images. For example, the target tracking network includes a Mean-Shift algorithm, a KCF (Kernelized Correlation Filters) algorithm, a SORT (Simple Online and Realtime Tracking) algorithm, etc. This application does not impose any restrictions on this.
[0064] In the process of target tracking of multiple frames of images, local features can be selectively used for denoising, auxiliary tracking, etc. to improve the accuracy of tracking results. For example, according to the tracking situation of the position features of the traffic participants in each frame of images, such as the loss of the tracking target, the matching degree or similarity of the tracking target is lower than the preset matching value, the local features of the traffic participants can be used to input the tracking algorithm such as Kalman filtering to track the target, so as to obtain the tracking results of multiple frames of images.
[0065] Then, the target participants may be determined according to the tracking results, and the target participants include a second number M of traffic participants that appear continuously, where M is an integer greater than 1. For example, the second number M of traffic participants that appear continuously in the T frame image are determined as the target participants.
[0066] S133: The first initial features of the target participant in the multiple frame images are integrated to obtain the first time series features of the traffic participant.
[0067] The first initial features of the target participants in the multiple frames of images may be spliced to obtain the first time-series features of each target participant as the first time-series features of the traffic participant.
[0068] In some embodiments, the first initial features include the position features, the category features and the local features of the traffic participants. Correspondingly, the position features, the category features and the local features of the target participants in the multiple frames of images are integrated respectively, and the first time series features obtained accordingly include the position time series features, the category time series features and the local time series features.
[0069] In some embodiments, the position features of the target participants (M traffic participants) in multiple frames of images, such as T frames, are spliced to obtain the position time series features of the target participants, which are recorded as , where 4 represents the coordinates and size (x, y, w, h) of the detection box of the target participant. The category features of the target participants (M traffic participants) in multiple frames of images such as T frames are spliced to obtain the category temporal features of the target participants, which are recorded as , where 1 represents the category of the target participant, such as the category of transportation, dynamic objects, etc.
[0070] In some embodiments, based on the position range of the position timing feature F2 of the target participant, such as the coordinates corresponding to the position timing feature F2, the features of the position range are extracted from the local features of the traffic participant to obtain the local timing features. Exemplarily, based on the coordinates corresponding to the position timing feature F2 in each frame of the image, the features of the position range corresponding to the position timing feature F2 of the target participant can be extracted from the local features of each frame to obtain the extracted features. Since the sizes of the target participants or the corresponding detection frame sizes are different, that is, the extracted features can obtain M*T features of different sizes, after the extracted features are globally pooled, the local timing features can be obtained, which are recorded as .
[0071] It is understandable that the present application does not limit the execution order of the above steps S131 to S133. For example, step S131 may be executed first, and then step S132 to S133. Alternatively, step S132 to S133 may be executed first, and then step S131.
[0072] In the above manner, the first time series feature and the second time series feature of the T frame image can be obtained. That is, the second time series feature of the traffic scene can be obtained. , the time series characteristics of the location of traffic participants , Category time series features , local time series characteristics .
[0073] Continue reading Figure 1 , after the above step S13, the following steps are also included:
[0074] S14: Using the time series association between the first time series feature and the second time series feature, traffic event recognition is performed to obtain a traffic event recognition result for the target area.
[0075] The first time series feature and the second time series feature can be input into the traffic event recognition model, so that the traffic event recognition model uses the time series association between the first time series feature and the second time series feature to perform traffic event recognition and obtain the traffic event recognition result of the target area. The time series association can represent the dynamic change of the first time series feature and the second time series feature in time in multiple frames of images. For example, it can represent the dynamic change of traffic participants and traffic scenes in time.
[0076] In some implementations, since the number of traffic participants appearing in different preset sliding windows T may be different, the first time series feature may be filled. The first time series feature is filled with a value of 0. The preset target number of first time series features is filled with the first time series feature. is the maximum number of targets to be detected and tracked, such as the preset number of targets is the maximum number of traffic participants detected and tracked in the T frame image, or the preset target number is the maximum number of traffic participants detected and tracked in the target video, and this application does not impose any restrictions on this.
[0077] For example, using a preset target number The first time series feature is filled. Specifically, the position time series feature of the traffic participant is filled. , Category time series features , local time series characteristics Fill them separately and get the corresponding , , .
[0078] Then, the second time series features of the traffic scene and the filled position time series features, category time series features and local time series features are input into the traffic event recognition model to perform traffic event recognition to obtain the traffic event recognition results of the target area.
[0079] The above scheme obtains multiple frames of images collected in the target area, processes the multiple frames of images, obtains the first initial features of traffic participants and the second initial features of traffic scenes in each frame of images, and respectively integrates the first initial features and the second initial features of the multiple frames of images to obtain the first time series features of traffic participants and the second time series features of traffic scenes. In this way, the time series features of traffic participants and traffic scenes in the multiple frames of images can be obtained. Then, the time series association between the first time series features and the second time series features is comprehensively utilized to perform traffic event recognition, and the traffic event recognition results of the target area are obtained. The characteristics of traffic participants and traffic scenes in the multiple frames of images are comprehensively considered, and traffic events can be recognized in different application scenarios. It has strong adaptability and can improve the accuracy of traffic event recognition.
[0080] In some embodiments, see Figure 4 , step S14 of the above embodiment can be further expanded. By using the time series association between the first time series feature and the second time series feature to perform traffic event recognition and obtain the traffic event recognition result of the target area, this embodiment may include the following steps:
[0081] S141: Performing a time series transformation on the first time series feature to obtain a first transformed feature of the traffic participant; and performing a time series transformation on the second time series feature to obtain a second transformed feature of the traffic scene.
[0082] The first time series feature may be subjected to time series transformation to obtain a first transformed feature of the traffic participant. For example, the time series transformation includes global coding, and the first time series feature may be globally encoded in a global coding manner, so that the globally encoded feature of the traffic participant may be used as the first transformed feature.
[0083] In some embodiments, the first time series features include position time series features, category time series features, and local time series features. The position time series features, category time series features, and local time series features can be globally encoded to obtain the first transformation features of the traffic participant, so that the position time series features, category time series features, and local time series features of the traffic participant can be unified.
[0084] In some implementations, the position time series features, category time series features, and local time series features may be channel transformed respectively, and then the transformed position time series features, category time series features, and local time series features may be integrated to obtain the first transformed features of the traffic participant.
[0085] By performing a time series transformation on the second time series feature, a second transformed feature of the traffic scene can be obtained, that is, a global time series feature of the traffic scene.
[0086] In some embodiments, see Figure 5The traffic event recognition model includes a global encoding module, a first multi-layer perceptron layer, a connection layer, a self-attention layer, and a classification layer. The global encoding module includes a second multi-layer perceptron layer, a third multi-layer perceptron layer, an embedding layer, and an addition layer.
[0087] The global encoding module may be used to perform a temporal transformation on the first temporal features to obtain the first transformed features of the traffic participants. Specifically, the position temporal features, the category temporal features, and the local temporal features may be channel mapped to the same preset number of channels to obtain the corresponding channel mapping features. Then, the corresponding channel mapping features are added to obtain the first transformed features of the traffic participants.
[0088] In some embodiments, the values of the positional timing features and the local timing features are continuous, and the values of the category timing features are discrete. For the category timing features, channel mapping of the category timing features includes mapping the discrete category timing features to a continuous vector space. Exemplarily, the Embedding layer can be used to perform channel mapping on the category timing features to obtain channel mapping features with a preset number of channels. Among them, the Embedding layer is a network layer in a deep learning model, which is used to map discrete inputs (such as words, categories, etc.) to a continuous vector space.
[0089] In some embodiments, a second multi-layer perceptron layer may be used to detect local temporal features. Perform channel mapping and use the third multi-layer perceptron layer to map the position and timing features Perform channel mapping and use the embedding layer to classify temporal features Channel mapping is performed to map the position timing features, category timing features, and local timing features to the same preset number of channels, and the corresponding channel mapping features are obtained respectively. For example, the preset number of channels can be determined according to the number of channels of the position timing features, category timing features, and local timing features. For example, the preset number of channels is the maximum value, the sum value, etc. of the number of channels in the position timing features, category timing features, and local timing features. For example, the preset number of channels can be predetermined according to the number of channels of the local timing features. It is understandable that the mapping to the same preset number of channels can also be determined in a manner, and the present application does not limit the preset number of channels, the mapping method, etc. Among them, the first multi-layer perceptron layer, the second multi-layer perceptron layer, and the third multi-layer perceptron layer can be MLP (Multilayer Perceptron, multi-layer perceptron) structures. The embedding layer can be the structure of the Embedding layer. The present application does not limit this.
[0090] With the preset number of channels as N, the position time series features, category time series features and local time series features can be mapped to the same preset number of channels, so that the corresponding channel mapping features can be obtained. Then, the corresponding channel mapping features are added using an addition layer (such as an Add layer) to obtain the first transformation feature of the traffic participant. The first transformation feature of the traffic participant can also be used as the global feature of the traffic participant.
[0091] The above method combines the position time series features, category time series features and local time series features of traffic participants for global encoding, thereby obtaining the global coding features of traffic participants, which can effectively unify all features of traffic participants.
[0092] In some implementations, the first multi-layer perceptron layer may be used to perform a time series transformation on the second time series feature of the traffic scene to obtain the second transformed feature of the traffic scene. In some application scenarios, the number of channels of the first transformed feature and the second transformed feature may be the same. Specifically, the second time series feature may be transformed according to the preset number of channels N. Transform the number of channels to obtain the second transformation feature of the traffic scene .
[0093] In order to facilitate the concatenation of the first transformation feature and the second transformation feature for subsequent self-attention processing, after the first transformation feature and the second transformation feature are obtained as described above, the first transformation feature and the second transformation feature may be dimensionally transformed.
[0094] In some embodiments, the first transformed feature of the traffic participant Perform dimension transformation to obtain the first transformed feature after dimension transformation Among them, the first transformed feature after dimension transformation Contains the global encoding features of the target participants in multiple frames of images. And the second transformation features of the traffic scene Perform dimension transformation to obtain the second transformed feature after dimension transformation Among them, the second transformed feature after dimension transformation Contains global encoding features of traffic scenes in multiple frames.
[0095] S142: Concatenate the first transformed feature and the second transformed feature to obtain an event recognition feature.
[0096] A connection layer (such as a Concat layer) is used to concatenate the first transformation feature and the second transformation feature to obtain an event recognition feature.
[0097] In some implementations, a connection layer (such as a Concat layer) is used to concatenate the first transformed features after dimension transformation. and the second transformed feature after dimension transformation , get event recognition features .
[0098] S143: Perform self-attention processing on the event recognition features to obtain attention features.
[0099] The self-attention layer (such as Transformer Encoder) can be used to perform self-attention processing on the event recognition features, which can be used to analyze the global features and The global features of each traffic participant are used for self-attention interaction to obtain the attention features.
[0100] See also Figure 6 , event recognition features It contains the global features of the traffic scene and The global features of traffic participants. Input the self-attention layer TransformerEncoder for processing. For example, Taking 9 traffic participants as an example, position 0 can represent the global characteristics of the traffic scene , positions 1 to 9 are Global characteristics of traffic participants .
[0101] Event recognition features through self-attention layer Transformer Encoder By performing self-attention processing, we can obtain attention features , which can represent the global features of traffic scene encoding after self-attention interaction.
[0102] Then, the attention feature Enter the classification layer.
[0103] S144: Using the attention features to classify traffic events, and obtaining traffic event recognition results for the target area.
[0104] A classification layer (such as an MLP classification head) is used to classify the attention features into traffic events, and a traffic event recognition result of the target area is obtained. The traffic event recognition result can be traffic jam, traffic accident, normal traffic, vehicle speeding, etc., which is not limited in this application.
[0105] The above scheme obtains the first transformed feature of the traffic participant by performing a time series transformation on the first time series feature, and obtains the second transformed feature of the traffic scene by performing a time series transformation on the second time series feature, concatenates the first transformed feature and the second transformed feature to obtain the event recognition feature, and then performs self-attention processing on the event recognition feature to obtain the attention feature. The above-mentioned time series attention mechanism using the traffic scene and traffic participants can obtain the global feature of the traffic scene after self-attention interaction, thereby using the attention feature to classify traffic events and obtain the traffic event recognition result of the target area, which can improve the accuracy of traffic event recognition.
[0106] In addition, by identifying traffic events through global coding and comprehensively utilizing the temporal correlation between the global features of the traffic scene and the local features of the traffic participants, the temporal transformations between the traffic scene and the traffic participants in the corresponding traffic events can be adaptively extracted, thereby effectively improving the recognition accuracy of traffic events.
[0107] In addition, in the process of traffic event recognition, the local features, position features and category features of traffic participants in multiple frame images and the global features of the traffic scene are comprehensively considered. In the process of traffic event recognition by the traffic event recognition model, the model can adaptively learn the rules or logic of different traffic scenes or different traffic events in different scenarios, and has strong adaptability to improve the recognition accuracy of traffic events.
[0108] This application only provides technology. The data required for specific applications shall be based on actual conditions. However, users are reminded that when actually using this technology, the collection and processing of data should comply with laws and regulations related to data and user information protection.
[0109] It is understandable that in the above method of the specific implementation mode, the writing order of each step does not mean a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of each step should be determined by its function and possible internal logic.
[0110] With respect to the above-mentioned embodiment, the present application also provides a traffic event recognition device for implementing the above-mentioned traffic event recognition method.
[0111] See also Figure 7 , Figure 7 1 is a schematic diagram of the structure of an embodiment of a traffic event recognition device of the present application. The traffic event recognition device 20 comprises: an acquisition module 21, a detection module 22, a synthesis module 23 and a recognition module 24.
[0112] The acquisition module 21 is used to acquire multiple frames of images collected in the target area.
[0113] The detection module 22 is used to process multiple frames of images to obtain the first initial features of the traffic participants and the second initial features of the traffic scene in each frame of image.
[0114] The integration module 23 is used to integrate the first initial features and the second initial features of the multiple frames of images respectively to obtain the first time series features of the traffic participants and the second time series features of the traffic scene.
[0115] The recognition module 24 is used to perform traffic event recognition by utilizing the time series association between the first time series feature and the second time series feature to obtain a traffic event recognition result of the target area.
[0116] It should be noted that the traffic event identification device provided in the above embodiment and the traffic event identification method provided in the above embodiment belong to the same concept, wherein the specific manner in which each module and unit performs the operation has been described in detail in the method embodiment and will not be repeated here. In actual application, the traffic event identification device provided in the above embodiment can distribute the above functions to different functional modules as needed, that is, divide the internal structure of the device into different functional modules to complete all or part of the functions described above, and this application does not limit this.
[0117] For the above embodiment, the present application provides a computer device, see Figure 8 , Figure 8 1 is a schematic diagram of the structure of an embodiment of a computer device of the present application. The computer device 30 includes a memory 31 and a processor 32, wherein the memory 31 and the processor 32 are coupled to each other, the memory 31 stores program data, and the processor 32 is used to execute the program data to implement the steps of any embodiment of the above-mentioned traffic event recognition method.
[0118] In this embodiment, the processor 32 may also be referred to as a CPU (Central Processing Unit). The processor 32 may be an integrated circuit chip having the ability to process signals. The processor 32 may also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. A general-purpose processor may be a microprocessor or the processor 32 may also be any conventional processor, etc.
[0119] The method of the above embodiment can be implemented in the form of a computer program, so the present application proposes a computer readable storage medium, see Fig. 9 , Fig. 9 The computer-readable storage medium 40 stores program data 41 that can be run by a processor, and the program data 41 can be executed by the processor to implement the steps of any embodiment of the above-mentioned traffic event recognition method.
[0120] The computer-readable storage medium 40 of this embodiment may be a medium that can store the program data 41, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, or may be a server storing the program data 41. The server may send the stored program data 41 to other devices for execution, or may execute the stored program data 41 by itself.
[0121] In some embodiments, the functions or modules included in the device provided in the above embodiments of the present application can be used to execute the method described in the above method embodiments. The specific implementation can refer to the description of the above method embodiments. For the sake of brevity, the present application will not go into details here.
[0122] The above description of the various embodiments tends to emphasize the differences between the various embodiments. The same or similar aspects can be referenced to each other. For the sake of brevity, this application will not go into details here.
[0123] In the several embodiments provided in the present application, it should be understood that the disclosed methods and devices can be implemented in other ways. For example, the device implementation described above is only schematic. For example, the division of modules or units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.
[0124] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0125] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0126] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium, which is a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a computer, server, or network device, etc.) or a processor to execute all or part of the steps of each implementation method of the present application.
[0127] Obviously, the technical workers in this field should understand that the above modules or steps of the present application can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, and optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a computer-readable storage medium and executed by a computing device, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. In this way, the present application is not limited to any specific combination of hardware and software.
[0128] The above descriptions are merely embodiments of the present application and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A method for identifying traffic events, characterized in that: include: Acquire multiple frames of images collected in the target area; Processing the multiple frames of images to obtain a first initial feature of a traffic participant and a second initial feature of a traffic scene in each frame of image; Respectively synthesizing the first initial features and the second initial features of the multiple frames of images to obtain a first time series feature of the traffic participant and a second time series feature of the traffic scene; Using the time series association between the first time series feature and the second time series feature, traffic event recognition is performed to obtain a traffic event recognition result for the target area; The method of using the time series association between the first time series feature and the second time series feature to identify a traffic event and obtain a traffic event identification result of the target area includes: Performing a time series transformation on the first time series feature to obtain a first transformed feature of the traffic participant; and performing a time series transformation on the second time series feature to obtain a second transformed feature of the traffic scene; Concatenating the first transformed feature and the second transformed feature to obtain an event recognition feature; Performing self-attention processing on the event recognition feature to obtain an attention feature; The attention features are used to classify traffic events to obtain traffic event recognition results in the target area.
2. The method according to claim 1, characterized in that The first time series features include position time series features, category time series features, and local time series features; the first time series features are subjected to time series transformation to obtain the first transformed features of the traffic participant, including: Channel mapping is performed on the position time series features, the category time series features and the local time series features respectively, so as to be mapped to the same preset number of channels, and the corresponding channel mapping features are obtained; wherein channel mapping on the category time series features includes mapping the discrete category time series features to a continuous vector space; Adding the corresponding channel mapping features to obtain a first transformation feature of the traffic participant; And / or, performing a time series transformation on the second time series feature to obtain a second transformed feature of the traffic scene includes: According to the preset number of channels, the second time series feature is transformed in the number of channels to obtain the second transformed feature of the traffic scene.
3. The method according to claim 1, characterized in that Before the first transformation feature and the second transformation feature are concatenated to obtain the event identification feature, the method includes: Performing dimension transformation on the first transformation feature of the traffic participant to obtain a dimensionally transformed first transformation feature, and performing dimension transformation on the second transformation feature of the traffic scene to obtain a dimensionally transformed second transformation feature; Among them, the first transformed feature after dimension transformation includes the global coding feature of the target participant in the multiple frames of images, and the second transformed feature after dimension transformation includes the global coding feature of the traffic scene in the multiple frames of images.
4. The method according to claim 1, characterized in that: The step of respectively synthesizing the first initial features and the second initial features of the multiple frames of images to obtain the first time series features of the traffic participant and the second time series features of the traffic scene includes: Performing target tracking on the multiple frames of images to determine target participants; wherein the target participants include traffic participants that meet preset tracking conditions; Combining the first initial features of the target participant in the multiple frames of images to obtain the first time series features of the traffic participant; and The second initial features of the multiple frames of images are spliced to obtain the second temporal features of the traffic scene.
5. The method according to claim 4, characterized in that The first initial feature includes the position feature of the traffic participant and the local feature of the traffic participant; The performing target tracking on the multiple frames of images to determine the target participant includes: Using the position features and local features of the traffic participants, target tracking is performed on the multiple frames of images to obtain tracking results of the multiple frames of images; Determining the target participants according to the tracking result, wherein the target participants include a second number of traffic participants that appear continuously; And / or, the first time series feature includes a position time series feature, a category time series feature and a local time series feature; the first initial feature of the target participant in the multiple frames of images is integrated to obtain the first time series feature of the traffic participant, including: splicing the position features of the target participant in the multiple frames of images to obtain the position time series features of the target participant, and splicing the category features of the target participant in the multiple frames of images to obtain the category time series features of the target participant; According to the position range of the position time series feature of the target participant, the features of the position range are extracted from the local features of the traffic participant to obtain the local time series feature.
6. The method according to claim 1, characterized in that The processing of the multiple frames of images to obtain the first initial features of the traffic participants and the second initial features of the traffic scene of each frame of image includes: For each frame of the image, target detection is performed on the image to obtain position features and category features of the traffic participants; Based on the intermediate layer features of the target detection, the intermediate layer features of the first downsampling multiple are obtained to obtain the local features of the traffic participant; and Acquire the intermediate layer features of the second downsampling multiple to obtain the second initial features of the traffic scene, wherein the second initial features of the traffic scene are global features of the traffic scene, and the second downsampling multiple is greater than the first downsampling multiple.
7. The method according to claim 1, characterized in that The step of acquiring multiple frames of images collected in the target area includes: Acquire a target video captured in the target area; According to a preset sliding window, the multiple frames of images are acquired from the target video.
8. A computer device, characterized in that: The invention comprises a memory and a processor coupled to each other, wherein the memory stores program data, and the processor is used to execute the program data to implement the steps of the method according to any one of claims 1 to 7.
9. A computer-readable storage medium, characterized in that: Program data that can be executed by a processor are stored, and the program data is used to implement the steps of the method according to any one of claims 1 to 7.
