Behavior recognition method, device, equipment and storage medium based on feature fusion
By fusing the color and optical flow information of the frame image, and integrating the temporal and spatial dimension information in the feature extraction network, the attention mechanism is introduced to solve the problems of low behavior recognition accuracy and low model training efficiency in the existing technology, and achieve More efficient feature extraction and recognition effects.
Patent Information
- Application Number
- CN202210055992.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-18
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2042-01-18
AI Technical Summary
Existing behavior recognition technology has problems with complexity and low accuracy in model training and feature extraction. In particular, it is difficult to effectively integrate the temporal and spatial dimension information of the video.
The feature fusion method is used to fuse the color information and optical flow information of the frame image, and the first branch and the second branch in the feature extraction network are used to extract the time dimension and spatial dimension information respectively. The fusion module combines the two to introduce attention. mechanism to improve the accuracy of feature extraction.
It improves the accuracy of behavior recognition and model training efficiency, can more effectively capture semantic information and motion information in videos, focus on areas of interest, and improves the accuracy of recognition results.
Smart Images

Figure CN114399839B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence, and provides a behavior recognition method, device, equipment and storage medium based on feature fusion. Background Art
[0002] Behavior recognition is a topic in the field of computer vision recognition. Video can be decomposed into two parts: spatial dimension information and temporal dimension information. Spatial dimension information is presented in the form of a single image, which carries static information such as the shape and color of the target. Temporal dimension information is presented through multiple frames of continuous images, reflecting the movement information of the target. By processing the spatial dimension information and temporal dimension information of the image separately and then fusing them through two neural networks, the static information and dynamic information of the target can be combined. However, there are also problems such as the difficulty of model training, the complexity of the algorithm, and the inaccurate feature extraction, which lead to low accuracy of behavior recognition and low training efficiency of the model. Summary of the invention
[0003] The following is a summary of the subject matter described in detail herein. This summary is not intended to limit the scope of the claims.
[0004] The embodiments of the present invention provide a behavior recognition method, an apparatus, a device and a storage medium based on feature fusion.
[0005] In a first aspect, an embodiment of the present invention provides a behavior recognition method based on feature fusion, comprising:
[0006] Extract frames from the input video to obtain frame images;
[0007] For each of the frame images, color information and optical flow information of the frame image are obtained, and the color information and the optical flow information of each pixel of the frame image are fused to obtain a fused image;
[0008] Input the fused image to a feature extraction network for feature extraction to obtain a target feature, wherein the feature extraction network includes a first branch, a second branch and a fusion module, the first branch is used to extract a first feature representing the time dimension information of the input video, the second branch is used to extract a second feature representing the space dimension information of the input video, and the fusion module is used to fuse the first feature and the second feature to obtain the target feature, the first branch includes N first feature extraction modules, the second branch includes N second feature extraction modules, the input of the nth first feature extraction module is the output of the n-1th first feature extraction module, the input of the nth second feature extraction module is the fusion result of the output of the n-1th first feature extraction module and the output of the n-1th second feature extraction module, N is an integer greater than or equal to 2, and n is an integer between 2 and N;
[0009] The target features are classified to obtain behavior recognition results.
[0010] In a second aspect, an embodiment of the present invention further provides a behavior recognition device based on feature fusion, comprising:
[0011] A frame extraction module is used to extract frames from the input video to obtain a frame image;
[0012] A fused image acquisition module, used for acquiring color information and optical flow information of each frame image, and fusing the color information and optical flow information of each pixel of the frame image to obtain a fused image;
[0013] A feature extraction module, used for inputting the fused image into a feature extraction network for feature extraction to obtain a target feature, wherein the feature extraction network includes a first branch, a second branch and a fusion module, the first branch is used for extracting a first feature representing the time dimension information of the input video, the second branch is used for extracting a second feature representing the space dimension information of the input video, the fusion module is used for fusing the first feature and the second feature to obtain the target feature, the first branch includes N first feature extraction modules, the second branch includes N second feature extraction modules, the input of the nth first feature extraction module is the output of the n-1th first feature extraction module, the input of the nth second feature extraction module is the fusion result of the output of the n-1th first feature extraction module and the output of the n-1th second feature extraction module, N is an integer greater than or equal to 2, and n is an integer between 2 and N;
[0014] The classification module is used to classify the target features to obtain behavior recognition results.
[0015] In a third aspect, an embodiment of the present invention further provides a behavior recognition device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the behavior recognition method based on feature fusion as described in the first aspect of the present invention is implemented.
[0016] In a fourth aspect, an embodiment of the present invention further provides a storage medium, characterized in that a computer program is stored therein, wherein the computer program is used to execute the behavior recognition method based on feature fusion as described in the first aspect of the present invention.
[0017] The embodiment of the present invention includes: extracting frames from an input video to obtain a frame image; for each frame image, obtaining color information and optical flow information of the frame image, and fusing the color information and optical flow information of each pixel of the frame image to obtain a fused image; inputting the fused image into a feature extraction network to extract features to obtain target features, wherein the feature extraction network includes a first branch, a second branch and a fusion module, the first branch is used to extract a first feature representing the time dimension information of the input video, the second branch is used to extract a second feature representing the space dimension information of the input video, the fusion module is used to fuse the first feature and the second feature to obtain the target feature, the first branch includes N first feature extraction modules, the second branch includes N second feature extraction modules, the input of the nth first feature extraction module is the output of the n-1th first feature extraction module, and the output of the nth second feature extraction module is The input is the fusion result of the output of the n-1th first feature extraction module and the output of the n-1th second feature extraction module, N is an integer greater than or equal to 2, and n is an integer between 2 and N; the target features are classified to obtain the behavior recognition result; for the frame image of the input video, the color information and the optical flow information are fused, and the color information is guided by the optical flow information, which is conducive to the feature extraction of the fused image; the fusion result of the output of the n-1th first feature extraction module and the output of the n-1th second feature extraction module is used as the input of the nth second feature extraction module, the time dimension information and the space dimension information are fused, the semantic information and motion information in the video are captured, and the attention mechanism is introduced in the feature extraction model, so that the model can pay more attention to the information of the area of interest, which is conducive to improving the accuracy of behavior recognition and improving the training efficiency of the model.
[0018] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained by the structures particularly pointed out in the description, claims and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] The accompanying drawings are used to provide a further understanding of the technical solution of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the technical solution of the present invention and do not constitute a limitation on the technical solution of the present invention.
[0020] Figure 1 is a flow chart of a behavior recognition method based on feature fusion according to an embodiment of the present invention;
[0021] Figure 2 It is a flow chart of the steps of fusing the color information and the optical flow information of each pixel of the frame image to obtain a fused image;
[0022] Figure 3is a flow chart of step S300;
[0023] Figure 4 It is a schematic diagram of the principle of feature extraction network;
[0024] Figure 5 is a schematic diagram of the principle of the first feature extraction module;
[0025] Figure 6 This is a schematic diagram of the principle of the first attention mechanism module;
[0026] Figure 7 This is the schematic diagram of the principle of the second special extraction module;
[0027] Figure 8 This is a schematic diagram of the principle of the second attention mechanism module;
[0028] Fig. 9 4 is a structural diagram of a behavior recognition device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0029] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0030] It should be noted that, although the functional modules are divided in the device schematic diagram and the logical order is shown in the flow chart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flow chart. The terms "first", "second", etc. in the specification, claims and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. In the description of the present invention, the meaning of "several" is one or more, the meaning of "many" is more than two, greater than, less than, exceed, etc. are understood to exclude the number itself, and above, below, within, etc. are understood to include the number itself.
[0031] The embodiments of the present invention provide a behavior recognition method, apparatus, device and storage medium based on feature fusion; extract frames of an input video to obtain a frame image; for each frame image, obtain color information and optical flow information of the frame image, fuse the color information and optical flow information of each pixel of the frame image to obtain a fused image; input the fused image into a feature extraction network to extract features to obtain target features, wherein the feature extraction network includes a first branch, a second branch and a fusion module, the first branch is used to extract a first feature representing the time dimension information of the input video, the second branch is used to extract a second feature representing the spatial dimension information of the input video, the fusion module is used to fuse the first feature and the second feature to obtain the target feature, the first branch includes N first feature extraction modules, the second branch includes N second feature extraction modules, the input of the nth first feature extraction module is the output of the n-1th first feature extraction module The input of the n-th second feature extraction module is the fusion result of the output of the n-1-th first feature extraction module and the output of the n-1-th second feature extraction module, N is an integer greater than or equal to 2, and n is an integer between 2 and N; the target features are classified to obtain the behavior recognition result; for the frame image of the input video, the color information and the optical flow information are fused, and the color information is guided by the optical flow information, which is conducive to the feature extraction of the fused image; the fusion result of the output of the n-1-th first feature extraction module and the output of the n-1-th second feature extraction module is used as the input of the n-th second feature extraction module, the time dimension information and the space dimension information are fused, the semantic information and motion information in the video are captured, and the attention mechanism is introduced in the feature extraction model, so that the model can pay more attention to the information of the area of interest, which is conducive to improving the accuracy of behavior recognition and improving the training efficiency of the model.
[0032] The semantic information includes static information such as the character's shape, color, expression, brightness, etc., and the motion information includes dynamic information such as clapping, waving, shaking, walking or jumping.
[0033] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Among them, artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence.
[0034] Artificial intelligence is the study of the design principles and implementation methods of various intelligent machines, so that the machines have the functions of perception, reasoning and decision-making. The basic technologies of artificial intelligence generally include sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics and other technologies. Artificial intelligence software technology mainly includes computer vision technology, robotics technology, biometrics technology, speech processing technology, natural language processing technology, and machine learning / deep learning. With the research and progress of artificial intelligence technology, artificial intelligence has been studied and applied in many fields, such as common smart homes, smart customer service, virtual assistants, smart speakers, smart marketing, unmanned driving, automatic driving, robots, smart medical care, etc. It is believed that with the development of technology, artificial intelligence will be applied in more fields and play an increasingly important role.
[0035] The embodiments of the present invention are further described below in conjunction with the accompanying drawings.
[0036] Reference Figure 1 , Figure 1 It is a flow chart of the behavior recognition method based on feature fusion.
[0037] like Figure 1 As shown, the behavior recognition method includes but is not limited to the following steps:
[0038] Step S100, extracting frames from the input video to obtain frame images;
[0039] Step S200: for each frame image, obtain color information and optical flow information of the frame image, and fuse the color information and optical flow information of each pixel of the frame image to obtain a fused image;
[0040] Step S300, inputting the fused image into a feature extraction network for feature extraction to obtain a target feature, wherein the feature extraction network includes a first branch, a second branch and a fusion module, the first branch is used to extract a first feature representing the time dimension information of the input video, the second branch is used to extract a second feature representing the spatial dimension information of the input video, the fusion module is used to fuse the first feature and the second feature to obtain the target feature, the first branch includes N first feature extraction modules based on the attention mechanism, the second branch includes N second feature extraction modules based on the attention mechanism, the input of the nth first feature extraction module is the output of the n-1th first feature extraction module, the input of the nth second feature extraction module is the fusion result of the output of the n-1th first feature extraction module and the output of the n-1th second feature extraction module, N is an integer greater than or equal to 2, and n is an integer between 2 and N;
[0041] Step S400: classify the target features to obtain behavior recognition results.
[0042] In this embodiment, color information and optical flow information are fused for the frame image of the input video, and the color information is guided by the optical flow information, which is beneficial to the feature extraction of the fused image; the fusion result of the output of the n-1th first feature extraction module and the output of the n-1th second feature extraction module is used as the input of the nth second feature extraction module, and the time dimension information and the space dimension information are fused to capture the semantic information and motion information in the video, and an attention mechanism is introduced into the feature extraction model so that the model can pay more attention to the information of the area of interest, which is beneficial to improving the accuracy of behavior recognition and improving the training efficiency of the model.
[0043] For step S100, the video is a series of captured frame images displayed at a given frequency, and extracting frames from the video means obtaining a single frame image by stopping at a specific frame in a sequence.
[0044] The input video is decompressed and decoded, and the decoded data is frame-sampled to extract multiple frame images corresponding to the input video.
[0045] In addition, image distortion should be avoided during decompression, decoding and frame extraction, which is conducive to improving the accuracy of behavior recognition.
[0046] Specifically, the format of the input video may include MP4, RMVB, MKV, AVI and other video formats.
[0047] For step S200, multiple frame images are obtained from the input video, and all frame images need to be processed. For each frame image, the color information of all pixels of the frame image is obtained, and the color information is specifically RGB information. RGB color is the so-called optical primary colors, R represents Red, G represents Green, and B represents Blue. Any color that can be seen by the naked eye in nature can be mixed and superimposed by these three colors. The mode of describing the color of the image through RGB information is an additive color mode. Any color can be described by the radiation of R, G, and B. When the computer defines the color, the value range of the three components of R, G, and B is 0-255, 0 means no stimulation, and 255 means the stimulation reaches the maximum value.
[0048] When an object is moving, the brightness pattern of the corresponding points on the image is also moving. The apparent movement of the brightness pattern of the image is optical flow. Optical flow information expresses the changes in the image and contains information about the target's motion, which can be used to determine the target's motion.
[0049] Reference Figure 2 , the color information and optical flow information of each pixel of the frame image are fused to obtain a fused image, specifically including:
[0050] Step S210: for each pixel of the frame image, obtain the first element value of each color channel according to the color information;
[0051] Step S220: for each pixel of the frame image, in each color channel, multiply and fuse the optical flow information of the pixel with the first element value of the pixel to obtain the second element value of the pixel, and perform standardization on the second element value to obtain the target element value;
[0052] Step S230: Combine the target element values of all color channels of the pixel to obtain a fused image.
[0053] For step S210, since the color information is RBG color, the color information includes three color channels: R channel, B channel and G channel. For the pixel (i, j) of the frame image, the first element value input of each color channel is obtained from the color information. i,j .
[0054] For step S220, for the pixel (i, j) of the frame image, the optical flow information is represented as optical i,j The optical flow information of the pixel is used as the weight of the first element value of the pixel, and the two are fused to obtain the second element value of the pixel. It can be expressed as: Input i,j =input i,j *optical i,j , where Input i,j is the second element value. The color information is guided by the optical flow information, which is conducive to the feature representation of the fusion image.
[0055] The second element value is normalized to obtain the target element value, including: calculating the mean of the second element value; calculating the variance of the second element value; dividing the difference between the second element value and the mean by the variance to obtain the target element value. The element values of the image are normalized and standardized.
[0056] For step S230, for a frame image, the target element values of all color channels of a pixel are combined to obtain the element value of the pixel; and a fused image is obtained according to the element values of all pixels.
[0057] Reference Figure 4 , Figure 4 It is a schematic diagram of the principle of the feature extraction network. The feature extraction network includes a first branch, a second branch and a fusion module.
[0058] Reference Figure 3 For step S300, the fused image is input into a feature extraction network to extract features to obtain target features, including:
[0059] Step S310, downsampling the fused image to obtain a second fused image, and inputting the second fused image into the first branch to obtain a first feature;
[0060] Step S320, inputting the fused image into the second branch to obtain a second feature;
[0061] Step S330: The first feature and the second feature are combined through a fusion module to obtain a target feature.
[0062] For step S310, the size of the fused image is B*C*T*H*W, where B is batch_size, i.e., the number of samples selected for one training; C is the number of channels; T is the time series; H and W are the length and width of the fused image, respectively. The fused image is downsampled to obtain a second fused image, and the size of the second fused image is B*C / 4*T*H*W. By reducing the sampling rate, the first branch can capture the change information extracted in the time dimension of the input video.
[0063] For the first branch, the first branch includes N first feature extraction modules connected in sequence. In this embodiment, N is 2; of course, in other embodiments, N can be other integers greater than or equal to 2, such as 3.
[0064] The second fused image is sequentially passed through two first feature extraction modules for feature extraction to obtain the first feature. Specifically, the second fused image is input into the first first feature extraction module, and the first first feature extraction module outputs a first output feature; the first output feature output by the first first feature extraction module is input into the second first feature extraction module, and the second first feature extraction module outputs another first output feature, and the first output feature output by the second first feature extraction module is used as the first feature.
[0065] In addition, refer to Figure 5 , Figure 5 It is a schematic diagram of the principle of the first feature extraction module. The structure of each first feature extraction module is as follows:
[0066] The first convolutional layer includes: a 1x1x1 convolutional layer and a batch normalization layer;
[0067] The first convolutional layer of the second layer includes: a 3x3x3 convolutional layer and a batch normalization layer;
[0068] The first convolutional layer of the third layer includes: a 1x1x1 convolutional layer and a batch normalization layer;
[0069] The first attention mechanism module;
[0070] A fusion operation is used to fuse the first attention feature and the first input feature to obtain a first output feature.
[0071] The process of feature extraction through the first feature extraction module is as follows: the first input feature is subjected to convolution operation through three first convolution layers in sequence to obtain a first convolution result; the first convolution result is subjected to feature extraction through the first attention mechanism module to obtain a first attention feature; the first attention feature and the first input feature are concatenated to obtain a first output feature.
[0072] Among them, refer to Figure 6 , Figure 6 This is a schematic diagram of the principle of the first attention mechanism module. The structure of the first attention mechanism module is as follows: the first full pooling layer, two first fully connected layers, the first activation function layer and the fusion operation, which is used to concatenate the first sub-attention feature and the first convolution result to obtain the first attention feature.
[0073] Specifically, the first activation function layer is a sigmoid activation function layer.
[0074] The process of subjecting the first convolution result to feature extraction by the first attention mechanism module to obtain the first attention feature is as follows: subjecting the first convolution result to the first full pooling layer, at least one first fully connected layer and a first activation function layer to obtain a first sub-attention feature, and fusing the first sub-attention feature and the first convolution result to obtain the first attention feature.
[0075] For step S320, the fused image is input into the second branch to obtain the second feature, wherein the size of the fused image is B*C*T*H*W, which remains unchanged, so that the second branch can capture the change information extracted in the spatial dimension of the input video.
[0076] For the second branch, the second branch includes N second feature extraction modules connected in sequence. In this embodiment, N is 2; of course, in other embodiments, N can be other integers greater than or equal to 2, such as 3. It should be noted that the number of the second feature extraction modules is the same as the number of the first feature extraction modules.
[0077] The fused image is sequentially passed through two second feature extraction modules for feature extraction to obtain a second feature. Specifically, the fused image is input into the first second feature extraction module, and the first second feature extraction module outputs a second output feature; the second output feature output by the first second feature extraction module and the first output feature output by the first first feature extraction module are fused, and then input into the second first feature extraction module, and the second second feature extraction module outputs another first output feature, and the second output feature output by the second second feature extraction module is used as the second feature.
[0078] It should be noted that the fusion method of the second output feature output by the second feature extraction module and the first output feature output by the first feature extraction module adopts horizontal connection.
[0079] In addition, refer to Figure 7 , Figure 7 It is a schematic diagram of the principle of the second feature extraction module. The structure of each second feature extraction module is as follows:
[0080] The first second convolutional layer includes: a 1x1x1 convolutional layer and a batch normalization layer;
[0081] The second convolutional layer includes: a 3x3x3 convolutional layer and a batch normalization layer;
[0082] The third second convolutional layer includes: a 1x1x1 convolutional layer and a batch normalization layer;
[0083] Second attention mechanism module;
[0084] A fusion operation is used to fuse the second attention feature and the second input feature to obtain a second output feature.
[0085] The process of feature extraction through the second feature extraction module is as follows: the second input feature is convolved through three second convolutional layers to obtain a second convolution result, and the second input feature is the feature input to the second feature extraction module; the second convolution result is subjected to feature extraction through the second attention mechanism module to obtain a second attention feature; the second attention feature and the second input feature are fused to obtain a second output feature, and the second output feature is the feature output by the second feature extraction module.
[0086] Among them, refer to Figure 8 , Figure 8 This is a schematic diagram of the principle of the first attention mechanism module. The structure of the second attention mechanism module is as follows: a second fully pooled layer, two second fully connected layers, a second activation function layer, and a fusion operation, which is used to concatenate the first sub-attention feature and the first convolution result to obtain the first attention feature.
[0087] Specifically, the second activation function layer is a sigmoid activation function layer.
[0088] The process of subjecting the second convolution result to feature extraction through the second attention mechanism module to obtain the second attention feature is as follows: subjecting the second convolution result to the second full pooling layer, two second fully connected layers and the second activation function layer to obtain the second sub-attention feature, and fusing the second sub-attention feature and the second convolution result to obtain the second attention feature.
[0089] For step S330, the first feature and the second feature are spliced together through a fusion module to obtain a target feature, which fuses the time dimension information of the first feature and the space dimension information of the second feature, and includes the semantic information and motion information of the input video.
[0090] In step S400, the target features are classified by a classifier to obtain a behavior recognition result. Specifically, in this embodiment, a sofamax function is used as a classifier. Of course, in other embodiments, other classifiers, such as a SVM vector machine, may also be used.
[0091] Reference Fig. 9 , Fig. 9 An embodiment of the present invention further provides a behavior recognition device, which applies the above behavior recognition method.
[0092] like Fig. 9 As shown, the behavior recognition device includes a frame extraction module 10, a fusion image acquisition module 20, a feature extraction module 30 and a classification module 40.
[0093] The frame extraction module 10 is used to extract frames from the input video to obtain frame images.
[0094] The fused image 20 acquisition module is used to acquire the color information and optical flow information of each frame image, and fuse the color information and optical flow information of each pixel of the frame image to obtain a fused image.
[0095] The feature extraction module 30 is used to input the fused image into the feature extraction network for feature extraction to obtain the target feature. The feature extraction network is as above, that is, the feature extraction network includes a first branch, a second branch and a fusion module, the first branch is used to extract the first feature representing the time dimension information of the input video, the second branch is used to extract the second feature representing the spatial dimension information of the input video, and the fusion module is used to fuse the first feature and the second feature to obtain the target feature. The first branch includes N first feature extraction modules, the second branch includes N second feature extraction modules, the input of the nth first feature extraction module is the output of the n-1th first feature extraction module, the input of the nth second feature extraction module is the fusion result of the output of the n-1th first feature extraction module and the output of the n-1th second feature extraction module, N is an integer greater than or equal to 2, and n is an integer between 2 and N.
[0096] The classification module 40 is used to classify target features to obtain behavior recognition results.
[0097] It should be noted that each module of the behavior recognition device corresponds one-to-one to each step of the above-mentioned behavior recognition method. The behavior recognition device and the behavior recognition method have the same technical solution, solve the same technical problems, and have the same beneficial effects.
[0098] For the behavior recognition device, it fuses the color information and optical flow information of the frame image of the input video, and guides the color information through the optical flow information, which is beneficial to the feature extraction of the fused image; the fusion result of the output of the n-1th first feature extraction module and the output of the n-1th second feature extraction module is used as the input of the nth second feature extraction module, and the time dimension information and the space dimension information are fused to capture the semantic information and motion information in the video, and the attention mechanism is introduced into the feature extraction model, so that the model can pay more attention to the information of the area of interest, which is beneficial to improve the accuracy of behavior recognition and improve the training efficiency of the model.
[0099] An embodiment of the present invention further provides a behavior recognition device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the above behavior recognition method is implemented.
[0100] The processor and the memory may be connected via a bus or other means.
[0101] The memory, as a computer-readable storage medium, can be used to store software programs and computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a memory, such as at least one disk storage device, a flash memory device, or other solid-state storage device. In some embodiments, the memory may optionally include a memory remotely arranged relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0102] The software programs and instructions required to implement the communication method of the above-mentioned embodiment are stored in the memory. When executed by the processor, the behavior recognition method in the above-mentioned embodiment is executed, for example, steps S100 to S400, steps S210 to S230 and steps S310 to S330 described above are executed.
[0103] The node embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0104] In addition, an embodiment of the present invention further provides a storage medium storing a computer program, which is executed by a processor or a controller, for example, by a processor, so that the above-mentioned processor can execute the behavior recognition method in the above-mentioned embodiment, for example, execute the above-described steps S100 to S400, steps S210 to S230 and steps S310 to S330.
[0105] It will be appreciated by those skilled in the art that all or some of the steps and systems in the disclosed method above may be implemented as software, firmware, hardware and appropriate combinations thereof. Some physical components or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor or a microprocessor, or may be implemented as hardware, or may be implemented as an integrated circuit, such as an application specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or a non-transitory medium) and a communication medium (or a temporary medium). As known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, disk storage or other magnetic storage devices, or any other medium that may be used to store desired information and may be accessed by a computer. Furthermore, it is well known to those skilled in the art that communication media typically embodies computer readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.
[0106] The above is a specific description of the preferred implementation of the present invention, but the present invention is not limited to the above-mentioned implementation mode. Technical personnel familiar with the field can also make various equivalent deformations or substitutions without violating the spirit of the present invention. These equivalent deformations or substitutions are all included in the scope defined by the claims of the present invention.
Claims
1. The behavior recognition method based on feature fusion is characterized by: include: Extract frames from the input video to obtain frame images; For each of the frame images, color information and optical flow information of the frame image are obtained, and the color information and the optical flow information of each pixel of the frame image are fused to obtain a fused image; Input the fused image to a feature extraction network for feature extraction to obtain a target feature, wherein the feature extraction network includes a first branch, a second branch and a fusion module, the first branch is used to extract a first feature representing the time dimension information of the input video, the second branch is used to extract a second feature representing the spatial dimension information of the input video, and the fusion module is used to fuse the first feature and the second feature to obtain the target feature, the first branch includes N first feature extraction modules based on an attention mechanism, the second branch includes N second feature extraction modules based on an attention mechanism, the input of the nth first feature extraction module is the output of the n-1th first feature extraction module, the input of the nth second feature extraction module is the fusion result of the output of the n-1th first feature extraction module and the output of the n-1th second feature extraction module, N is an integer greater than or equal to 2, and n is an integer between 2 and N; Classifying the target features to obtain behavior recognition results; The step of inputting the fused image into a feature extraction network to extract features and obtain target features includes: Downsampling the fused image to obtain a second fused image, and inputting the second fused image into the first branch to obtain the first feature; Inputting the fused image into the second branch to obtain the second feature; The first feature and the second feature are spliced together through the fusion module to obtain the target feature.
2. The behavior recognition method according to claim 1, characterized in that: The fusing the color information and the optical flow information of each pixel of the frame image to obtain a fused image includes: For each pixel of the frame image, obtaining a first element value of each color channel according to the color information; For each pixel of the frame image, in each color channel, the optical flow information of the pixel is multiplied and fused with the first element value of the pixel to obtain a second element value of the pixel, and the second element value is normalized to obtain a target element value; The target element values of all the color channels of the pixel are combined to obtain the fused image.
3. The behavior recognition method according to claim 2, characterized in that: The step of performing standardization on the second element value to obtain a target element value includes: Calculate the mean of the second element values; Calculate the variance of the second element value; The difference between the second element value and the mean is divided by the variance to obtain the target element value.
4. The behavior recognition method according to claim 1, characterized in that: The step of inputting the second fused image into the first branch to obtain the first feature includes: Allow the second fused image to pass through N first feature extraction modules in sequence to extract features to obtain the first features; The feature extraction is performed by the first feature extraction module, including: Performing a convolution operation on a first input feature through at least one first convolution layer to obtain a first convolution result, wherein the first input feature is a feature input to the first feature extraction module; The first convolution result is subjected to feature extraction by a first attention mechanism module to obtain a first attention feature; The first attention feature and the first input feature are fused to obtain a first output feature, where the first output feature is a feature output by the first feature extraction module.
5. The behavior recognition method according to claim 4, characterized in that: Inputting the fused image into the second branch to obtain the second feature includes: The fused image is sequentially passed through N second feature extraction modules to extract features to obtain the second features; The feature extraction is performed by the second feature extraction module, including: Performing a convolution operation on a second input feature through at least one second convolution layer to obtain a second convolution result, wherein the second input feature is a feature input to the second feature extraction module; The second convolution result is subjected to feature extraction by a second attention mechanism module to obtain a second attention feature; The second attention feature and the second input feature are fused to obtain a second output feature, where the second output feature is the feature output by the second feature extraction module.
6. The behavior recognition method according to claim 5, characterized in that: The step of subjecting the first convolution result to feature extraction by a first attention mechanism module to obtain a first attention feature includes: Passing the first convolution result through a first full pooling layer, at least one first fully connected layer, and a first activation function layer to obtain a first sub-attention feature, and fusing the first sub-attention feature with the first convolution result to obtain the first attention feature; The step of subjecting the second convolution result to feature extraction by a second attention mechanism module to obtain a second attention feature includes: The second convolution result is passed through a second full pooling layer, at least one second fully connected layer, and a second activation function layer to obtain a second sub-attention feature, and the second sub-attention feature and the second convolution result are fused to obtain the second attention feature.
7. A behavior recognition device, characterized in that: include: A frame extraction module is used to extract frames from the input video to obtain a frame image; A fused image acquisition module, used to acquire color information and optical flow information of each frame image, and fuse the color information and optical flow information of each pixel of the frame image to obtain a fused image; A feature extraction module, used for inputting the fused image into a feature extraction network for feature extraction to obtain a target feature, wherein the feature extraction network includes a first branch, a second branch and a fusion module, the first branch is used for extracting a first feature representing the time dimension information of the input video, the second branch is used for extracting a second feature representing the space dimension information of the input video, the fusion module is used for fusing the first feature and the second feature to obtain the target feature, the first branch includes N first feature extraction modules, the second branch includes N second feature extraction modules, the input of the nth first feature extraction module is the output of the n-1th first feature extraction module, the input of the nth second feature extraction module is the fusion result of the output of the n-1th first feature extraction module and the output of the n-1th second feature extraction module, N is an integer greater than or equal to 2, and n is an integer between 2 and N; A classification module, used to classify the target features to obtain behavior recognition results; The step of inputting the fused image into a feature extraction network to extract features and obtain target features includes: Downsampling the fused image to obtain a second fused image, and inputting the second fused image into the first branch to obtain the first feature; Inputting the fused image into the second branch to obtain the second feature; The first feature and the second feature are spliced together through the fusion module to obtain the target feature.
8. Behavior recognition equipment, including: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the feature fusion-based behavior recognition method as described in any one of claims 1 to 6 when executing the computer program.
9. A storage medium, characterized in that A computer program is stored, and the computer program is used to execute the behavior recognition method based on feature fusion as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Video significance detecting method based on area segmentation
CN105913456A
Video saliency detection method based on deep fusion
CN110909594A
Behavior recognition device and method based on multi-attention mechanism fusion and storage medium
CN112990116A
Behavior recognition method and device based on image fusion, electronic equipment and medium
CN113792680A
Video feature extraction method
CN113850158A
