WO2023103294A1 - 视频处理方法及装置、电子设备、存储介质和计算机程序产品 - Google Patents
视频处理方法及装置、电子设备、存储介质和计算机程序产品 Download PDFInfo
- Publication number
- WO2023103294A1 WO2023103294A1 PCT/CN2022/094896 CN2022094896W WO2023103294A1 WO 2023103294 A1 WO2023103294 A1 WO 2023103294A1 CN 2022094896 W CN2022094896 W CN 2022094896W WO 2023103294 A1 WO2023103294 A1 WO 2023103294A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- video frame
- motion vector
- sample
- target object
- position information
- Prior art date
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/20—Analysis of motion
- G06T7/246—Analysis of motion using feature-based methods, e.g. the tracking of corners or segments
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/13—Edge detection
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/10—Image acquisition modality
- G06T2207/10016—Video; Image sequence
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/20—Special algorithmic details
- G06T2207/20081—Training; Learning
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/20—Special algorithmic details
- G06T2207/20084—Artificial neural networks [ANN]
Definitions
- the embodiment of the present disclosure is based on the Chinese patent application with the application number 202111483515.8, the application date is December 07, 2021, and the application name is "Video Processing Method and Device, Electronic Equipment and Storage Medium", and the priority of the Chinese patent application is required Right, the entire content of this Chinese patent application is hereby incorporated into this disclosure as a reference.
- the present disclosure relates to but not limited to the technical field of computers, and in particular relates to a video processing method and device, electronic equipment, storage media and computer program products.
- Embodiments of the present disclosure provide a video processing method and device, electronic equipment, a storage medium, and a computer program product.
- An embodiment of the present disclosure provides a video processing method, including: acquiring a first video frame in a video stream to be processed, and a first motion vector between the first video frame and a second video frame, wherein the The second video frame is any video frame after the first video frame; the target object in the first video frame is detected and processed, and the contour key points of the target object in the first video frame are acquired First position information, and a first mask image of the first video frame, wherein the first mask image is used to represent an image of the position and contour of the target object in the first video frame, the contour The key point is located on the contour; according to the first motion vector, the first position information and the first mask image, a second motion vector is obtained, wherein the second motion vector is a corrected motion vector; according to the second motion vector and the first position information, obtain the second position information of the outline key point of the target object in the second video frame.
- the accurate outline of the target object can be obtained by performing the recognition processing of the target object on the first video frame itself; video frame) for target detection, that is, without the need to perform frame-by-frame target detection on video frames other than the first video frame, but use the sparse motion vector information between video frames to obtain the detection of target objects in other video frames
- the time redundancy of the video frame is utilized to improve the target detection speed and detection efficiency
- the first motion vector between video frames is the accumulation of motion vectors between any two adjacent video frames, therefore, by correcting the first motion vector and obtaining the second motion vector, using the corrected second motion vector Detecting the target object in the second video frame can reduce the accumulated error of the motion vector, thereby improving the accuracy and robustness of the target detection of the second video frame.
- the obtaining a second motion vector according to the first motion vector, the first position information, and the first mask image includes: obtaining component features according to the first motion vector , the component feature map is determined by the components of the first motion vector; the component feature map, the first position information and the first mask image are input into the correction neural network to obtain the motion vector correction amount ; Obtain the second motion vector according to the motion vector correction amount and the first motion vector.
- the obtaining the component feature map according to the first motion vector includes: decomposing the first motion vector to obtain a first dimension component and a second dimension component; according to the first dimension component and the second dimension component to obtain component feature maps respectively.
- the corrected second motion vector can be obtained, and the correction process can reduce the cumulative error, correct the position of the key points of the contour, and maintain the shape of the contour.
- Using the second motion vector to perform position transformation on the outline key points in the first video frame can improve the accuracy of the position information.
- the method further includes: performing detection processing on the first sample video frame of the sample video stream, acquiring the first sample position information of the outline key point of the target object; acquiring the first sample video frame A first sample mask image of a frame, a sample motion vector between the first sample video frame and a second sample video frame, wherein the first sample mask image is used to represent the first sample video An image of the position and contour of the target object in the frame, the contour key point is located on the contour, and the second sample video frame is any video frame after the first sample video frame; according to the sample motion vector , the first sample mask image, the first sample position information and the corrected neural network to obtain a corrected motion vector; according to the first sample video frame and the second sample video frame, obtain a reference motion vector; obtaining a network loss of the modified neural network according to the modified motion vector and the reference motion vector; and training the modified neural network according to the network loss.
- the obtaining the modified motion vector according to the sample motion vector, the first sample mask image, the first sample position information and the modified neural network includes: according to the The sample motion vector and the preset noise signal are used to obtain a sample component feature map; the sample component feature map, the first sample mask image and the first sample position information are input into the modified neural network to obtain A sample correction amount: obtain a corrected motion vector according to the sample correction amount and the sample motion vector.
- the ability to correct errors of the corrected neural network can be improved by adding random noise during the training process, and the accuracy and robustness of the corrected neural network can be improved.
- the method further includes: obtaining a second mask image of the second video frame according to the second position information of the outline key point of the target object in the second video frame, the first The second mask image is used to represent the image of the position and outline of the target object in the second video frame.
- the obtaining the second mask image of the second video frame according to the second position information of the outline key point of the target object in the second video frame includes: according to the first The relative relationship between the contour key points in the video frame, the contour key points in the second video frame are connected to obtain the contour of the target object in the second video frame; according to the target object in contours in the second video frame to obtain the second mask image.
- An embodiment of the present disclosure also provides a video processing device, including: an acquisition part configured to acquire a first video frame in a video stream to be processed, and a first video frame between the first video frame and the second video frame A motion vector, wherein the second video frame is any video frame after the first video frame; the detection part is configured to perform detection processing on the target object in the first video frame, and obtain the target object The first position information of the outline key point in the first video frame, and the first mask image of the first video frame, wherein the first mask image is used to represent the target in the first video frame An image of the position and contour of the object, the key point of the contour is located on the contour; the correction part is configured to obtain the first mask image according to the first motion vector, the first position information and the first mask image Two motion vectors, wherein the second motion vector is a modified motion vector; the position obtaining part is configured to obtain the target object in the second video according to the second motion vector and the first position information The second position information of the outline keypoint in the frame.
- the correction part is further configured to: obtain a component feature map according to the first motion vector, and the component feature map is determined by the components of the first motion vector; use the component feature map, The first position information and the first mask image are input into a correction neural network to obtain a motion vector correction amount; and the second motion vector is obtained according to the motion vector correction amount and the first motion vector.
- the correction part is further configured to: decompose the first motion vector to obtain a first dimensional component and a second dimensional component; according to the first dimensional component and the second dimensional component , to obtain component feature maps respectively.
- the device further includes: a training part configured to perform detection processing on the first sample video frame of the sample video stream, and acquire the first sample position information of the outline key point of the target object; acquire the A first sample mask image of the first sample video frame, a sample motion vector between the first sample video frame and a second sample video frame, wherein the first sample mask image is used for Representing the image of the position and outline of the target object in the first sample video frame, the key point of the outline is located on the outline, and the second sample video frame is any video frame after the first sample video frame; Obtain a corrected motion vector according to the sample motion vector, the first sample mask image, the first sample position information and the corrected neural network; according to the first sample video frame and the first sample video frame Obtaining a reference motion vector for a two-sample video frame; obtaining a network loss of the modified neural network according to the modified motion vector and the reference motion vector; and training the modified neural network according to the network loss.
- a training part configured to perform detection processing on the first sample video frame of the sample video
- the training part is further configured to: obtain a sample component feature map according to the sample motion vector and a preset noise signal; according to the sample component feature map, the first sample The mask image and the first sample position information are input into the correction neural network to obtain a sample correction amount; according to the sample correction amount and the sample motion vector, a correction motion vector is obtained.
- the apparatus further includes: a mask obtaining part configured to obtain the second position information of the outline key point of the target object in the second video frame according to the second position information of the target object in the second video frame. Two mask images, the second mask image is used to represent the position and outline of the target object in the second video frame.
- the mask obtaining part is further configured to: connect the contour key points in the second video frame according to the relative relationship between the contour key points in the first video frame , obtaining the contour of the target object in the second video frame; obtaining the second mask image according to the contour of the target object in the second video frame.
- An embodiment of the present disclosure provides an electronic device, including: a processor; a memory for storing instructions executable by the processor; wherein the processor is configured to invoke the instructions stored in the memory to execute the above method.
- An embodiment of the present disclosure provides a computer-readable storage medium on which computer program instructions are stored, and when the computer program instructions are executed by a processor, the foregoing method is implemented.
- An embodiment of the present disclosure also provides a computer program product, where the computer program product includes a computer program or an instruction, and when the computer program or instruction is run on an electronic device, the electronic device is made to execute the above method.
- FIG. 1 is a schematic flowchart of a video processing method provided by an embodiment of the present disclosure
- FIG. 2 is an application schematic diagram of a video processing method provided by an embodiment of the present disclosure
- FIG. 3 is a schematic diagram of the composition and structure of a video processing device provided by an embodiment of the present disclosure
- FIG. 4 is a block diagram of an electronic device provided by an embodiment of the present disclosure.
- Fig. 5 is a block diagram of an electronic device provided by an embodiment of the present disclosure.
- the other is feature domain transformation acceleration.
- This method detects the target in the feature information of the video frame based on the motion vector information in the compressed video stream (Compressed Bitstream), thereby utilizing the time redundancy of the video frame to achieve accelerated detection and detection. /or the purpose of the segmentation task, but the feature transformation in this method belongs to the feature domain transformation (Feature Wrapping), that is, to detect the target by transforming the feature information after convolution, downsampling, etc., so it is difficult to accurately Estimate object contour (Contour).
- Feature Wrapping feature domain transformation
- the present disclosure proposes a video processing method, which can be performed by an electronic device, wherein the electronic device can be a notebook computer, a tablet computer, a desktop computer, a set-top box, a mobile device (such as a mobile phone, a portable music player) , personal digital assistants, dedicated message devices, portable game devices) and other types of terminals can also be implemented as servers.
- the server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or it can provide cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, intermediate Cloud servers for basic cloud computing services such as mail service, domain name service, security service, content delivery network (Content Delivery Network, CDN), and big data and artificial intelligence platforms.
- FIG. 1 is a schematic flow chart of a video processing method according to an embodiment of the present disclosure. As shown in FIG. 1 , the method includes the following steps:
- Step S11 obtaining a first video frame in the video stream to be processed, and a first motion vector between the first video frame and a second video frame, wherein the second video frame is the first video frame any subsequent video frame;
- Step S12 performing recognition processing on the target object in the first video frame, obtaining the first position information of the outline key point of the target object in the first video frame, and the first mask of the first video frame a film image, wherein the first mask image is used to represent an image of the position and contour of the target object in the first video frame, the contour keypoints being located on the contour;
- Step S13 obtaining a second motion vector according to the first motion vector, the first position information and the first mask image, wherein the second motion vector is a corrected motion vector;
- Step S14 according to the second motion vector and the first position information, obtain the second position information of the outline key point of the target object in the second video frame.
- the accurate outline of the target object can be obtained by performing the recognition processing of the target object on the first video frame itself; video frame) for target detection, that is, without the need to perform frame-by-frame target detection on video frames other than the first video frame, but use the sparse motion vector information between video frames to obtain the detection of target objects in other video frames
- the time redundancy of the video frame is utilized to improve the target detection speed and detection efficiency
- the first motion vector between video frames is the accumulation of motion vectors between any two adjacent video frames, therefore, the first motion vector will contain the cumulative error of motion vectors between multiple adjacent video frames
- target detection is widely used in video processing, for example, the position and/or characteristics of the detected target can be stored without storing each video frame, thereby reducing storage pressure; The detected position and/or feature of the target can be transmitted without transmitting every video frame, thereby reducing transmission pressure.
- target detection can be performed on each video frame, or a part of video frames can be sampled for target detection, but this detection method usually requires methods such as deep learning, so when the number of video frames is large, the efficiency of target detection is not high.
- Motion vectors and other methods can also be used for detection.
- video code streams obtained according to video coding standards such as H263, H264, H265, H266, VP8, VP9, AV1, and AVS
- there are motion vectors between video frames so , the position of the target object in each video frame can be determined by using the motion vector between the video frames.
- the motion vector between video frames is sparse, which is mainly used to represent the motion features of pixels, and contains less image content.
- the present disclosure performs target detection on the key frame (for example, a specified video frame, or a video frame containing a complete target object) in the video stream to be processed to obtain an accurate outline of the target object , and the location information of key points on the contour. Then, the accurate outline and the key points on the outline are transformed by the motion vector. Therefore, the accurate outline of the target object can be obtained when the efficiency of target detection is improved by using the temporal redundancy of the video frame.
- the motion vector can also be corrected to reduce the error of the motion vector and improve the accuracy and robustness of target detection.
- each video frame in the video stream to be processed and the motion vector between each video frame can be obtained.
- motion vectors between video frames exist in video code streams encoded according to video coding standards such as H263, H264, H265, H266, VP8, VP9, AV1, and AVS.
- the video stream to be processed may belong to any one of the above multiple code streams.
- decoding the video stream to be processed for example, ffmpeg decoder can be used for decoding
- each video frame in the video stream to be processed and the motion vector between each video frame can be obtained.
- the first motion vector between the first video frame and the second video frame is obtained by decoding the video to be processed.
- the second video frame is any video frame after the first video frame.
- the first motion vector can be obtained directly through decoding.
- the second video frame is not an adjacent video frame of the first video frame, and there is an interval of n (n is a positive integer) video frames between the two (the second video frame is after the first video frame).
- the motion vector between any two adjacent video frames can be obtained, then the motion vectors between all the video frames spaced between the first video frame and the second video frame can be vector added, that is, A motion vector between the first video frame and the second video frame is obtained.
- the first video frame is T0
- the second video frame is Tn+1
- the motion vector between the first video frame T0 and video frame T1 is Mv0
- the video The motion vector between frame T1 and video frame T2 is Mv1...the motion vector between video frame Tn and the second video frame Tn+1 is Mvn
- the first motion vector is Mv0+Mv1+...+Mvn.
- the present disclosure does not limit the number of video frames between the first video frame and the second video frame.
- step S12 object detection may be performed on the first video frame in the video stream to be processed, so as to determine an accurate contour line of the target object in the first video frame.
- the detection process may be performed on the target object in the first video frame in the video stream to be processed, and the first position information of the outline key point of the target object in the first video frame is obtained.
- the first video frame may be a designated key frame, or any video frame containing the complete target object.
- the first video frame can be detected by a deep learning method to obtain the detection result of the target object, and then obtain the contour line of the target object and the contour key points on the contour line, wherein the contour key
- the points may include points capable of representing main features of the contour line, for example, points representing the widest position of the contour line, points at the highest position of the contour line, and the like.
- each pixel point on the contour line can be used as a contour key point. The disclosure does not limit the selection of key points.
- the accurate contour line of the target object can be determined, reducing the need to only use the feature domain transformation in the video frame to obtain the target object in the second video frame. It is difficult to accurately estimate the contour line of the target object caused by the contour key points.
- the first mask image of the first video frame may also be obtained.
- the first mask image can represent the position and outline of the target object in the first video frame, for example, the pixel values of all pixels in and on the outline can be set to 1, and the pixel values outside the outline can be set to 0, obtain the first mask image.
- the first mask image can also be used to constrain and correct the shape of the contour of the target object in subsequent processing (for example, in the position transformation of contour key points through motion vectors), for example, if If a certain contour key point leaves the contour line during the position transformation process, it can be corrected by using the first mask image, so that the shape of the contour line is maintained, and the contour key point that leaves the contour line during the position transformation process can also be corrected. The point is corrected so that its position remains on the contour line.
- This disclosure does not limit the use of the first mask image.
- the position of the outline key point in the first video frame can be transformed by the first motion vector to obtain the position of the contour key point in the second video frame
- the position of the contour key point due to the sparsity of the motion vector, it contains less information and is easily disturbed by noise during the transformation process, resulting in position error.
- the first motion vector may be obtained by adding motion vectors between multiple adjacent video frames. If there is an error in the motion vector between adjacent video frames, the motion vector between adjacent video frames The accumulated error of the first motion vector obtained after the accumulation may be relatively large, which will affect the position accuracy of the outline key points in the second video frame. Therefore, in order to improve the position accuracy of the contour key points in the second video frame and the robustness of position transformation, the first motion vector may be corrected.
- the first motion vector can be corrected by using the first position information (that is, the position information of the contour key points of the target object in the first video frame) and the first mask image to obtain Second motion vector.
- the first mask image can constrain and modify the shape of the contour line of the target object, and at the same time, the first position information can also play a role in maintaining the shape of the contour line of the target object and correcting the positions of key points of the contour, for example,
- the relative positional relationship between the contour key points can be determined through the first position information, and the relative positional relationship can be maintained during the position transformation process, thereby maintaining the shape of the contour line.
- the relative positional relationship of the outline key points in the second video frame can be corrected based on the relative positional relationship determined by the first positional information, so that the relative positional relationship between each outline key point remains stable.
- the first motion vector may also be corrected based on the first position information, so as to reduce the error of the first motion vector, and further reduce the error of the relative positional relationship between the contour and key points of the contour. The present disclosure does not limit the role of the first location information.
- the first motion vector may be corrected by modifying the neural network to obtain the second motion vector.
- Step S13 may include: obtaining a component feature map according to the first motion vector, and the component feature map is determined by the components of the first motion vector; combining the component feature map, the first position information and the first The mask image is input into the correction neural network to obtain a motion vector correction amount; and the second motion vector is obtained according to the motion vector correction amount and the first motion vector.
- the modified neural network may be a deep learning neural network, such as a convolutional neural network.
- the present disclosure does not limit the type of the modified neural network.
- the input quantity of the modified neural network can be in the form of an image or a feature map.
- the component feature map can be obtained based on the components of the first motion vector, that is, the components of the motion vector can be expressed in the form of a feature map to serve as the input of the modified neural network. input volume.
- obtaining a component feature map according to the first motion vector includes: decomposing the first motion vector to obtain a first dimension component and a second dimension component; according to the first dimension component and For the second dimension components, corresponding component feature maps are respectively obtained.
- the first motion vector may represent the motion vector of each pixel in the first video frame, for example, a certain pixel in the first video frame (which may be a contour key point or any other pixel point) is (x, y), from the first motion vector, the motion vector corresponding to the pixel is ( ⁇ x, ⁇ y), then the position of the pixel in the second video frame is (x+ ⁇ x, y+ ⁇ y). It can be seen that the motion vector of each pixel in the first motion vector also includes two dimensions, therefore, the first motion vector can be decomposed into two dimensions, namely, the first dimension component and the second dimension component.
- the first dimension component may represent the component of the motion vector of each pixel point in the first dimension direction, for example, the component of the motion vector in the x direction, that is, the ⁇ x in the motion vector corresponding to each pixel point
- the second dimension component can represent the component of the motion vector of each pixel in the second dimension direction, for example, the component of the motion vector in the y direction, that is, in the motion vector corresponding to each pixel The value of ⁇ y.
- a component feature map of the first dimension may be obtained according to the first dimension component of the motion vector corresponding to each pixel.
- the value of the component of the first dimension of the motion vector corresponding to each pixel in the first video frame is the pixel value of the corresponding pixel of the component feature map of the first dimension, for example, the motion corresponding to each pixel
- the value of ⁇ x in the vector is the pixel value of the corresponding pixel in the component feature map of the first dimension.
- the value of the component of the second dimension of the motion vector corresponding to each pixel in the first video frame is the pixel value of the corresponding pixel of the component feature map of the second dimension, for example, each pixel corresponds to
- the value of ⁇ y in the motion vector is the pixel value of the corresponding pixel in the component feature map of the second dimension.
- the component feature map of the first dimension and the component feature map of the second dimension are component feature maps of two channels, for example, the component feature map of the first dimension and the component feature map of the second dimension are the two inputs of the input correction neural network The feature map of the channel.
- the component feature maps of the above two channels, as well as the first position information and the first mask image are input into the correction neural network, and the motion vector correction amount can be obtained through the correction neural network, that is, used to correct the first Correction parameters for motion vectors.
- the first motion vector may be corrected by using a correction parameter to obtain the second motion vector.
- the correction parameter may be in the form of a vector, for example, the correction amount of a certain pixel is (xt, yt), and the motion vector ( ⁇ x, ⁇ y) of the corresponding pixel in the first motion vector is performed During correction, vector addition can be performed to obtain the corrected motion vector ( ⁇ x+xt, ⁇ y+yt) of the pixel. After the motion vector of each pixel is corrected, the second motion vector can be obtained.
- the motion vector correction amount can also be in the form of a matrix. When performing correction, the motion vector correction amount can be multiplied by the motion vector of the corresponding pixel of the first motion vector to obtain the second motion vector.
- the present disclosure does not limit the specific form and correction method of the motion vector correction amount.
- the corrected second motion vector can be obtained.
- the accumulative error of the motion vector can be reduced through the correction process, the position of the key point of the contour can be corrected, and the shape of the contour line can be maintained.
- Using the second motion vector to transform the position of the contour key points of the target object in the first video frame can improve the accuracy of the obtained position information of the contour key points of the target object in the second video frame.
- the correction neural network can be trained before using the above-mentioned correction neural network for correction. For example, a plurality of video segments can be selected in the video sample as the sample video stream, and key frames, motion Vector and other information, through which the modified neural network can be trained.
- the video processing method further includes: performing detection processing on the first sample video frame of the sample video stream, and obtaining the first sample position information of the outline key point of the target object, wherein the first The sample video frame is any video frame in the sample video stream; obtain the first sample mask image of the first sample video frame, the interval between the first sample video frame and the second sample video frame The sample motion vector of , wherein, the first sample mask image is used to represent the image of the position and contour of the target object in the first sample video frame, the contour key point is located on the contour, and the second The sample video frame is any video frame after the first sample video frame; according to the sample motion vector, the first sample mask image, the first sample position information and the modified neural network, obtaining a modified motion vector; obtaining a reference motion vector according to the first sample video frame and the second sample video frame; obtaining a network loss of the modified neural network according to the modified motion vector and the reference motion vector ; According to the network loss, train the modified neural network.
- the sample video stream may be decoded to obtain video frames in the sample video stream, wherein the first sample video frame is any video frame that contains a complete target object in the sample video stream, for example, the first The sample video frame is a key frame in the sample video stream.
- the first sample video frame may be detected by a deep learning method to obtain the outline of the target object and determine the position information of the first sample of the key points of the outline.
- the pixel values of all pixel points inside and on the contour line can also be set to 1, and the pixel values of pixel points outside the contour line can be set to 0, thereby obtaining the first sample mask image .
- the sample motion vector between the first sample video frame and the second sample video frame (any video frame different from the first sample video frame in the sample video stream) can also be obtained .
- random noise may be added to the sample motion vector, and then the motion vector is corrected by the correction neural network, so that the correction ability of the correction neural network is improved.
- uniformly distributed noise may be added, for example, uniformly distributed noise within [-16, 16]. This disclosure does not limit the type and range of random noise.
- noise may be directly added to the sample motion vector, or may be added to a sample component feature map of the sample motion vector.
- the obtaining the modified motion vector according to the sample motion vector, the first sample mask image, the first sample position information and the modified neural network includes: according to the A sample motion vector and a preset noise signal to obtain a sample component feature map; according to inputting the sample component feature map, the first sample mask image and the first sample position information into the modified neural network, Obtain a sample correction amount; obtain a corrected motion vector according to the sample correction amount and the sample motion vector.
- a random noise signal may be added to the sample motion vector.
- the sample motion vector includes two-dimensional components of multiple pixels, and random noise may be randomly added to the motion vectors of some or all pixels.
- random noise may be added to the sample motion vector, random values may be added to the two-dimensional components of the sample motion vector.
- the sample component feature map with random noise is obtained by using the sample motion vector after the random noise is added, and the obtaining method is consistent with that of the component feature map.
- the sample component feature map of the sample motion vector can also be obtained first, and then random noise signals can be added to the sample component feature map, for example, some or all pixels in the sample component feature map of the first dimension can be Random noise is added to the motion vector component of the second dimension sample component feature map, and random noise is added to the motion vector component of some or all pixels in the second dimension sample component feature map to obtain a sample component feature map with random noise.
- random noise is added to the motion vector component of the second dimension sample component feature map
- random noise is added to the motion vector component of some or all pixels in the second dimension sample component feature map to obtain a sample component feature map with random noise.
- the present disclosure does not limit the order in which the noise is added.
- the sample component feature map with random noise, the mask image of the first sample, and the position information of the first sample can be input into the modified neural network, and the modified neural network can perform the shape preservation of the contour line and the contour preservation.
- the relative positional relationship of the key points, the position of the corrected outline key points, and the correction of the sample motion vector are processed to obtain the sample correction amount, and the sample motion vector is corrected based on the sample correction amount to obtain the corrected motion vector.
- the correction method is the same as the above-mentioned method of correcting the first motion vector by the motion vector correction amount.
- the error can be determined by correcting the motion vector to the true motion vector between the first sample video frame and the second sample video frame.
- the reference motion vector may be determined based on the first sample video frame and the second sample video frame, that is, the motion vector of the pixel moving from the position in the first sample video frame to the position in the second sample video frame,
- the reference motion vector is an error-free motion vector and can be used as a reference for determining the error of the corrected motion vector.
- the network loss of the modified neural network can be determined based on the error between the modified motion vector and the reference motion vector, for example, the output of the modified neural network can be determined based on the error between the vectors, that is, The error of the sample correction amount, and then determine the network loss of the corrected neural network based on the error of the sample correction amount.
- the modified neural network can be trained based on the network loss, that is, the network parameters of the modified neural network are adjusted in a direction to reduce the network loss.
- the above training process for the modified neural network can be iteratively performed multiple times until the training reaches a predetermined number of times, or the network loss converges to a preset interval, or is less than a preset threshold, and the training can be completed to obtain a trained modified neural network.
- the ability to correct errors of the corrected neural network can be improved by adding random noise during the training process, and the accuracy and robustness of the corrected neural network can be improved.
- the above-trained correction neural network can perform correction on the first motion vector to obtain a second motion vector with higher precision.
- the first position information of the contour key points in the first video frame may be transformed based on the second motion vector to obtain the second position information of the contour key points of the target object in the second video frame.
- the transformation in step S14 may be implemented based on a related method, for example, the second position information of the outline key point of the target object in the second video frame is obtained through a vector operation method.
- a second mask image of the second video frame may also be obtained based on the second location information.
- the method further includes: obtaining a second mask image of the second video frame according to the second position information of the outline key point of the target object in the second video frame, and the second mask image is used for An image representing the position and outline of the target object in the second video frame.
- the shape of the contour line of the target object can be maintained during the process of position transformation by the second motion vector, so that in the second video frame, the shape and position of the contour line of the target object can still be obtained by represented by the above outline.
- the pixel values of the pixel points inside and on the contour line can be set to 1, and the pixel values of the pixel points outside the contour line can be set to 0, so that the second mask image can be obtained.
- the key points of the contour in the first video frame may have a certain relative relationship, for example, a sequence relationship.
- the key points are connected according to the order of each key point, and the outline in the first video frame can be obtained.
- the contour in the second video frame can still be obtained based on the relative relationship of the contour key points, so as to obtain the second mask image.
- the obtaining the second mask image of the second video frame according to the second position information of the contour key point of the target object in the second video frame includes: according to the contour key point in the first video frame The relative relationship between the points, the contour key points in the second video frame are connected to obtain the contour of the target object in the second video frame; according to the target object in the second video frame In the contour, obtain the second mask image.
- the outline key points in the first video frame for example, an order relationship
- this relative relationship can be maintained, for example, maintaining the relationship between the outline key points , and connect the outline key points according to the order relationship, then the outline of the target object in the second video frame can be obtained while maintaining the shape of the outline of the target object.
- the relative relationship includes not only sequence relationship, but also relative position relationship, connection relationship and so on.
- connection can be maintained in the second video frame relationship, and connect according to the connection relationship, so as to obtain the contour of the target object in the second video frame while maintaining the shape of the contour line of the target object.
- different processing may be performed on the pixels inside and outside the outline, for example, the pixel values of the pixels inside the outline are set to 1, Set pixel values of pixels outside the contour line to 0 to obtain the second mask image.
- the accurate outline of the target object can be obtained by performing the recognition processing of the target object on the first video frame itself; video frame) for target detection, that is, without the need to perform frame-by-frame target detection on video frames other than the first video frame, but use the sparse motion vector information between video frames to obtain the detection of target objects in other video frames
- the time redundancy of the video frame is used to improve the target detection speed and detection efficiency; in addition, when there is at least one other video frame between the first video frame and the second video frame, the first video frame and the second video frame
- the first motion vector between video frames is the accumulation of motion vectors between any two adjacent video frames.
- the accumulation of motion vectors can be reduced Error, correct the position of the contour key points, and maintain the shape of the contour line.
- random noise can be added to improve the ability of the corrected neural network to correct errors, and improve the accuracy and robustness of the corrected neural network.
- Fig. 2 is a schematic diagram of the application of the video processing method provided by the embodiment of the present disclosure.
- the sample video stream is decoded to obtain a sample motion vector 23 between the key frame 21 and the non-key frame 22, wherein the non-key frame 22 is any non-key frame after the key frame 21; for the sample video stream
- the key frame 21 in the key frame performs target detection, and obtains the first sample position information 25 of the outline key point of the target object in the key frame 21; it is also possible to obtain the first sample of the key frame 21 based on the outline of the target object in the key frame Mask image 24.
- the sample motion vector 23 is decomposed to obtain a sample component feature map 26 in the x direction and a sample component feature map 27 in the y direction.
- a uniformly distributed noise signal in the range [-16, 16] can be added to the two sample component feature maps to obtain sample component feature maps with noise, namely: a new sample component feature map in the x direction and a new sample component feature map in the y direction.
- the sample component feature map of 30 is the sample motion vector 23 .
- the new sample component feature map 29 in the x direction, the new sample component feature map 30 in the y direction, the first sample position information 25 and the first sample mask image 24 can be input into the modified neural network 31 for further processing. training to obtain the sample correction amount 32; then, use the sample correction amount 32 to correct the sample motion vector 23 to obtain the corrected motion vector 33; then, based on the corrected motion vector 33 and the real The error between the motion vectors determines the network loss of the modified neural network 31; finally, the modified neural network 31 is trained in a direction to reduce the network loss of the modified neural network 31.
- a trained modified neural network can be used to determine the outline of a target object in any video frame in the video stream.
- the video stream is decoded to obtain the motion vector between the key frame and any video frame other than the key frame, and the position information of the outline key point of the target object in the key frame in the video stream can be obtained, and can also be obtained.
- the motion vector can be decomposed into two component feature maps of x and y channels, and the component feature map, the position information of the contour key points and the mask map are input into the correction neural network to obtain the motion vector correction amount, The motion vector is corrected to obtain the corrected motion vector, and based on the corrected motion vector, the position information of the contour key point of the target object in the key frame is transformed to obtain the contour key of the target object in any video frame point location information.
- the video to be processed is decoded to obtain key frame M and non-key frame N.
- target object detection is performed on the keyframe M.
- the baseline method baseline method
- performing target detection on the non-key frame N may include the following steps: extracting the first motion vector, Correct the first motion vector and generate a mask image of the non-key frame N.
- the application embodiment of the present disclosure uses the FFmpeg decoder to extract the motion vector in the video code stream.
- the first motion vector can be obtained directly through decoding; when the non-key frame N is not the adjacent video frame of the key frame M, there is n (n is a positive integer) during the interval of video frames, through the above-mentioned decoding process, the motion vector between any two adjacent video frames can be obtained, then all the videos of the interval between the non-key frame N and the key frame M can be obtained
- the motion vector between frames can be added by vector to obtain the motion vector between non-key frame N and key frame M.
- key frame M is T0
- non-key frame N is Tn+1
- the interval between them is T1
- the motion vector between key frame T0 and video frame T1 is Mv0
- the motion vector between video frame T1 and video frame T2 is Mv1...between video frame Tn and non-key frame Tn+1
- the motion vector between is Mvn
- the first motion vector is Mv0+Mv1+...+Mvn.
- the application embodiment of the present disclosure uses a correction neural network to obtain a motion vector correction amount of the first motion vector, and uses the motion vector correction amount to correct the first motion vector to obtain a second motion vector.
- First decompose the first motion vector to obtain the components of the motion vector in the x direction and the components of the motion vector in the y direction.
- the components of the motion vector in the x direction and the components of the motion vector in the y direction obtain the x direction and y direction respectively The component feature map of the direction; then, input the component feature map of the x direction and the component feature map of the y direction, the first position information and the first mask image into the correction neural network to obtain the motion vector correction amount; finally, use the motion
- the vector correction amount corrects the first motion vector to obtain the second motion vector.
- the first position information of the outline key point in the key frame M is transformed to obtain the second position information of the target object in the non-key frame N position information; then, obtain a second mask image of the non-key frame N based on the second position information, and the second mask image is used to represent an image of the position and outline of the target object in the non-key frame N.
- the video processing method can be used to quickly detect the target in the video, the method only needs to detect the key frame or the outline of the target object in the video frame containing the complete target object, and can pass the corrected
- the motion vector is used to quickly obtain the position information of the target object in any video frame, improving the accuracy and efficiency of target detection.
- the video processing method can be used for target detection in fields such as monitoring and live broadcasting, and can also be used for detecting and tracking targets in videos in other arbitrary application fields. The present disclosure does not limit the application field of the video processing method.
- FIG. 3 is a schematic structural diagram of a video processing device provided by an embodiment of the present disclosure.
- the device includes: an acquisition part 11 configured to acquire a first video frame in a video stream to be processed, and A first motion vector between a first video frame and a second video frame, wherein the second video frame is any video frame after the first video frame;
- the detection part 12 is configured to detect the first video frame The target object in the target object is detected, and the first position information of the outline key point of the target object in the first video frame and the first mask image of the first video frame are obtained, wherein the first mask The film image is used to represent the image of the position and contour of the target object in the first video frame, and the key point of the contour is located on the contour;
- the correction part 13 is configured to, according to the first motion vector, the second A position information and the first mask image, obtaining a second motion vector, wherein the second motion vector is a corrected motion vector;
- the position obtaining part 14 is configured to obtain a second motion vector according to the second motion
- the correction part is further configured to: obtain a component feature map according to the first motion vector, and the component feature map is determined by the components of the first motion vector;
- the first position information and the first mask image are input into a correction neural network to obtain a motion vector correction amount; and the second motion vector is obtained according to the motion vector correction amount and the first motion vector.
- the correction part is further configured to: decompose the first motion vector to obtain a first dimensional component and a second dimensional component; according to the first dimensional component and the second dimensional component , to obtain component feature maps respectively.
- the device further includes: a training part configured to perform detection processing on the first sample video frame of the sample video stream, and acquire the first sample position information of the outline key point of the target object; acquire the A first sample mask image of the first sample video frame, a sample motion vector between the first sample video frame and a second sample video frame, wherein the first sample mask image is used for Representing the image of the position and outline of the target object in the first sample video frame, the key point of the outline is located on the outline, and the second sample video frame is any video frame after the first sample video frame; Obtain a corrected motion vector according to the sample motion vector, the first sample mask image, the first sample position information and the corrected neural network; according to the first sample video frame and the first sample video frame Obtaining a reference motion vector for a two-sample video frame; obtaining a network loss of the modified neural network according to the modified motion vector and the reference motion vector; and training the modified neural network according to the network loss.
- a training part configured to perform detection processing on the first sample video frame of the sample video
- the training part is further configured to: obtain a sample component feature map according to the sample motion vector and a preset noise signal; use the sample component feature map, the first sample mask The image and the position information of the first sample are input into the correction neural network to obtain a sample correction amount; according to the sample correction amount and the sample motion vector, a correction motion vector is obtained.
- the apparatus further includes: a mask obtaining part configured to obtain the second position information of the outline key point of the target object in the second video frame according to the second position information of the target object in the second video frame. Two mask images, the second mask image is used to represent the position and outline of the target object in the second video frame.
- the mask obtaining part is further configured to: connect the contour key points in the second video frame according to the relative relationship between the contour key points in the first video frame, Obtain the contour of the target object in the second video frame; obtain the second mask image according to the contour of the target object in the second video frame.
- a "part" may be a part of a circuit, a part of a processor, a part of a program or software, etc., of course it may also be a unit, a module or a non-modular one.
- the present disclosure also provides video processing devices, electronic equipment, storage media, and computer program products, all of which can be used to implement any video processing method provided in the present disclosure, corresponding technical solutions and descriptions, and corresponding records in the method section.
- Embodiments of the present disclosure also provide a computer-readable storage medium, on which computer program instructions are stored, and the above-mentioned method is implemented when the computer program instructions are executed by a processor.
- the computer readable storage medium may be a non-transitory computer readable storage medium.
- An embodiment of the present disclosure also proposes an electronic device, including: a processor; a memory for storing instructions executable by the processor; wherein the processor is configured to invoke the instructions stored in the memory to execute the above method.
- An embodiment of the present disclosure also provides a computer program product, including computer readable codes.
- the processor in the device executes the video processing method provided in any of the above embodiments. instruction.
- the embodiments of the present disclosure also provide another computer program product, which is used for storing computer-readable instructions, and when the instructions are executed, the computer executes the operations of the video processing method provided by any of the above-mentioned embodiments.
- Electronic devices may be provided as terminals, servers, or other forms of devices.
- FIG. 4 is a block diagram of an electronic device 800 provided by an embodiment of the present disclosure.
- the electronic device 800 may be a terminal such as a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, and the like.
- the electronic device 800 may include one or more of the following components: a processing component 802, a memory 804, a power supply component 806, a multimedia component 808, an audio component 810, an input/output (I/O) interface 812, a sensor component 814, and communication component 816.
- the processing component 802 generally controls the overall operations of the electronic device 800, such as those associated with display, telephone calls, data communications, camera operations, and recording operations.
- the processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the above method. Additionally, processing component 802 may include one or more modules that facilitate interaction between processing component 802 and other components. For example, processing component 802 may include a multimedia module to facilitate interaction between multimedia component 808 and processing component 802 .
- the memory 804 is configured to store various types of data to support operations at the electronic device 800 . Examples of such data include instructions for any application or method operating on the electronic device 800, such as contact data, phonebook data, messages, pictures, and videos, among others.
- the memory 804 can be realized by any type of volatile or non-volatile memory device or their combination, for example, the memory 804 can be realized by static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM) , Erasable Programmable Read-Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read-Only Memory (ROM), Magnetic Storage, Flash Memory, Magnetic Disk and Optical Disk.
- SRAM static random access memory
- EEPROM electrically erasable programmable read-only memory
- EPROM Erasable Programmable Read-Only Memory
- PROM Programmable Read-Only Memory
- ROM Read-Only Memory
- Magnetic Storage Flash Memory
- Flash Memory Magnetic Disk and Optical Disk.
- the power supply component 806 provides power to various components of the electronic device 800 .
- Power components 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for electronic device 800 .
- the multimedia component 808 includes a screen providing an output interface between the electronic device 800 and the user.
- the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive an input signal from a user.
- the touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensor may not only sense a touch or slide action, but also detect duration and pressure associated with the touch or slide operation.
- the multimedia component 808 also includes a front camera and/or a rear camera. When the electronic device 800 is in an operation mode, such as a shooting mode or a video mode, the front camera and/or the rear camera can receive external multimedia data. Each front camera and rear camera can be a fixed optical lens system or have focal length and optical zoom capability.
- the audio component 810 is configured to output and/or input audio signals.
- the audio component 810 includes a microphone (MIC), which is configured to receive external audio signals when the electronic device 800 is in operation modes, such as call mode, recording mode and voice recognition mode. Received audio signals may be stored in memory 804 or sent via communication component 816 to other electronic devices.
- the audio component 810 also includes a speaker for outputting audio signals.
- the I/O interface 812 provides an interface between the processing component 802 and a peripheral interface module.
- the peripheral interface module may be a keyboard, a click wheel, a button, and the like. These buttons may include, but are not limited to: a home button, volume buttons, start button, and lock button.
- Sensor assembly 814 includes one or more sensors for providing status assessments of various aspects of electronic device 800 .
- the sensor component 814 can detect the open/close state of the electronic device 800, the relative positioning of components, such as the display and the keypad of the electronic device 800, the sensor component 814 can also detect the electronic device 800 or the electronic device 800 The position of a component changes, the presence or absence of user contact with the electronic device 800 , the orientation or acceleration/deceleration of the electronic device 800 and the temperature of the electronic device 800 change.
- Sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects in the absence of any physical contact.
- Sensor assembly 814 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications.
- the sensor component 814 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor or a temperature sensor.
- the communication component 816 is configured to facilitate wired or wireless communication between the electronic device 800 and other devices.
- the electronic device 800 can access a wireless network based on communication standards, such as WiFi, 2G or 3G, or a combination thereof.
- the communication component 816 receives broadcast signals or broadcast related information from an external broadcast management system via a broadcast channel.
- the communication component 816 also includes a near field communication (NFC) module to facilitate short-range communication.
- NFC near field communication
- the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, Infrared Data Association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
- RFID Radio Frequency Identification
- IrDA Infrared Data Association
- UWB Ultra Wideband
- Bluetooth Bluetooth
- the electronic device 800 may be programmed by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable A gate array (FPGA), controller, microcontroller, microprocessor or other electronic component implementation for performing the methods described above.
- ASICs application specific integrated circuits
- DSPs digital signal processors
- DSPDs digital signal processing devices
- PLDs programmable logic devices
- FPGA field programmable A gate array
- controller microcontroller, microprocessor or other electronic component implementation for performing the methods described above.
- non-volatile computer-readable storage medium such as the memory 804 including computer program instructions, which can be executed by the processor 820 of the electronic device 800 to complete the above method.
- FIG. 5 is a block diagram of an electronic device 1900 provided by an embodiment of the present disclosure.
- electronic device 1900 may be provided as a server.
- electronic device 1900 includes processing component 1922 , which further includes one or more processors, and a memory resource represented by memory 1932 for storing instructions executable by processing component 1922 , such as application programs.
- the application programs stored in memory 1932 may include one or more modules each corresponding to a set of instructions.
- the processing component 1922 is configured to execute instructions to perform the above method.
- Electronic device 1900 may also include a power supply component 1926 configured to perform power management of electronic device 1900, a wired or wireless network interface 1950 configured to connect electronic device 1900 to a network, and an input-output (I/O) interface 1958 .
- the electronic device 1900 can operate based on an operating system stored in the memory 1932, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM or the like.
- non-volatile computer-readable storage medium such as the memory 1932 including computer program instructions, which can be executed by the processing component 1922 of the electronic device 1900 to complete the above method.
- the present disclosure can be a system, method and/or computer program product.
- a computer program product may include a computer readable storage medium having computer readable program instructions thereon for causing a processor to implement various aspects of the present disclosure.
- a computer readable storage medium may be a tangible device that can retain and store instructions for use by an instruction execution device.
- a computer readable storage medium may be, for example, but is not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing.
- Computer-readable storage media include: portable computer diskettes, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), or flash memory), static random access memory (SRAM), compact disc read only memory (CD-ROM), digital versatile disc (DVD), memory stick, floppy disk, mechanically encoded device, such as a printer with instructions stored thereon A hole card or a raised structure in a groove, and any suitable combination of the above.
- RAM random access memory
- ROM read-only memory
- EPROM erasable programmable read-only memory
- flash memory static random access memory
- SRAM static random access memory
- CD-ROM compact disc read only memory
- DVD digital versatile disc
- memory stick floppy disk
- mechanically encoded device such as a printer with instructions stored thereon
- a hole card or a raised structure in a groove and any suitable combination of the above.
- computer-readable storage media are not to be construed as transient signals per se, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through waveguides or other transmission media (e.g., pulses of light through fiber optic cables), or transmitted electrical signals.
- the computer-readable program instructions described herein may be downloaded from a computer-readable storage medium to a respective computing/processing device, or downloaded to an external computer or external storage device over a network, such as the Internet, a local area network, a wide area network, and/or a wireless network.
- the network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and/or edge servers.
- a network adapter card or a network interface in each computing/processing device receives computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in a computer-readable storage medium in each computing/processing device .
- Computer program instructions for performing the operations of the present disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, or Source or object code written in any combination, including object-oriented programming languages (such as Smalltalk, C++, etc.), and conventional procedural programming languages—such as "C” or similar programming languages.
- Computer readable program instructions may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer, or entirely on the remote computer or server implement.
- the remote computer can be connected to the user computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (such as via the Internet using an Internet service provider). connect).
- LAN local area network
- WAN wide area network
- an electronic circuit such as a programmable logic circuit, field programmable gate array (FPGA), or programmable logic array (PLA)
- FPGA field programmable gate array
- PDA programmable logic array
- These computer-readable program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine such that when executed by the processor of the computer or other programmable data processing apparatus , producing an apparatus for realizing the functions/actions specified in one or more blocks in the flowchart and/or block diagram.
- These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause computers, programmable data processing devices and/or other devices to work in a specific way, so that the computer-readable medium storing instructions includes An article of manufacture comprising instructions for implementing various aspects of the functions/acts specified in one or more blocks in flowcharts and/or block diagrams.
- each block in a flowchart or block diagram may represent a module, a portion of a program segment, or an instruction that includes one or more Executable instructions.
- the functions noted in the block may occur out of the order noted in the figures. For example, two blocks in succession may, in fact, be executed substantially concurrently, or they may sometimes be executed in the reverse order, depending upon the functionality involved.
- each block of the block diagrams and/or flowchart illustrations, and combinations of blocks in the block diagrams and/or flowchart illustrations can be implemented by a dedicated hardware-based system that performs the specified function or action , or may be implemented by a combination of dedicated hardware and computer instructions.
- the computer program product can be specifically realized by means of hardware, software or a combination thereof.
- the computer program product is embodied as a computer storage medium, and in another optional embodiment, the computer program product is embodied as a software product, such as a software development kit (Software Development Kit, SDK) etc. wait.
- a software development kit Software Development Kit, SDK
- Embodiments of the present disclosure provide a video processing method and device, an electronic device, a storage medium, and a computer program product, wherein the video processing method includes: acquiring a first video frame, and obtaining a video frame between the first video frame and the second video frame The first motion vector; obtain the first position information of the contour key point of the target object in the first video frame, and the first mask image of the first video frame; according to the first motion vector, the first position information and the first mask A film image, obtaining a second motion vector; obtaining second position information of a contour key point of the target object in a second video frame according to the second motion vector and the first position information.
- the accurate outline of the target object can be obtained by performing target object recognition processing on the first video frame itself; secondly, by utilizing the time redundancy of the video frame, the target detection speed and detection efficiency can be improved; again , using the corrected second motion vector to detect the target object in the second video frame can reduce the accumulated error of the above motion vector, thereby improving the accuracy and robustness of object detection in the second video frame.
Landscapes
- Engineering & Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Multimedia (AREA)
- Compression Or Coding Systems Of Tv Signals (AREA)
- Image Analysis (AREA)
Abstract
本公开涉及一种视频处理方法及装置、电子设备、存储介质和计算机程序产品,所述方法包括:获取第一视频帧,以及第一视频帧和第二视频帧之间的第一运动向量;获取目标对象在第一视频帧中的轮廓关键点的第一位置信息,以及第一视频帧的第一掩膜图像;根据第一运动向量、第一位置信息和第一掩膜图像,获得第二运动向量;根据第二运动向量和第一位置信息,获得目标对象在第二视频帧中的轮廓关键点的第二位置信息。
Description
相关申请的交叉引用
本公开实施例基于申请号为202111483515.8、申请日为2021年12月07日、申请名称为“视频处理方法及装置、电子设备和存储介质”的中国专利申请提出,并要求该中国专利申请的优先权,该中国专利申请的全部内容在此引入本公开作为参考。
本公开涉及但不限于计算机技术领域,尤其涉及一种视频处理方法及装置、电子设备、存储介质和计算机程序产品。
在视频文件中进行快速目标检测对视频处理与传输均有着重要意义。在相关技术中,对视频文件的快速目标检测存在检测速度较慢、准确率较低的问题。
发明内容
本公开实施例提供一种视频处理方法及装置、电子设备、存储介质和计算机程序产品。
本公开实施例提供了一种视频处理方法,包括:获取待处理视频流中的第一视频帧,以及所述第一视频帧和第二视频帧之间的第一运动向量,其中,所述第二视频帧为所述第一视频帧之后的任意视频帧;对所述第一视频帧中的目标对象进行检测处理,获取所述目标对象在所述第一视频帧中的轮廓关键点的第一位置信息,以及所述第一视频帧的第一掩膜图像,其中,所述第一掩膜图像用于表示所述第一视频帧中目标对象的位置和轮廓的图像,所述轮廓关键点位于所述轮廓上;根据所述第一运动向量、所述第一位置信息和所述第一掩膜图像,获得第二运动向量,其中,所述第二运动向量为修正后的运动向量;根据所述第二运动向量和所述第一位置信息,获得所述目标对象在所述第二视频帧中的轮廓关键点的第二位置信息。
根据本公开的实施例的视频处理方法,通过对第一视频帧本身进行目标对象的识别处理,可获得目标对象的准确的轮廓;利用运动向量对第一视频帧的后续视频帧(例如第二视频帧)进行目标检测,即,无需对第一视频帧之外的视频帧进行逐帧的目标检测,而是利用视频帧之间稀疏的运动向量信息来获取其他视频帧中的目标对象的检测结果,因此,利用了视频帧的时间冗余性提升目标检测速度和检测效率;另外,在第一视频帧与第二视频帧之间存在至少一个其他视频帧时,第一视频帧与第二视频帧之间的第一运动向量是任意两个相邻视频帧之间的运动向量的累计,因此,通过对第一运动向量进行修正并得到第二运动向量,利用修正后的第二运动向量来检测第二视频帧中的目标对象,可以减小上述运动向量的累计误差,进而提升对第二视频帧的目标检测的准确性和鲁棒性。
在一些实现方式中,所述根据所述第一运动向量、所述第一位置信息和所述第一掩膜图像,获得第二运动向量,包括:根据所述第一运动向量,获得分量特征图,所述分量特征图由所述第一运动向量的分量确定的;将所述分量特征图、所述第一位置信息和所述第一掩膜图像输入修正神经网络,获得运动向量修正量;根据所述运动向量修正量和所述第一运动向量,获得所述第二运动向量。
在一些实现方式中,所述根据所述第一运动向量,获得分量特征图,包括:将所述第一运动向量进行分解,获得第一维度分量和第二维度分量;根据所述第一维度分量和所述第二维度分量,分别获得分量特征图。
通过这种方式,可获得修正后的第二运动向量,修正处理可减小累计误差,修正轮廓关键点的位置,保持轮廓的形状。通过第二运动向量对第一视频帧中的轮廓关键点进行位置变换,可提升位置信息的准确性。
在一些实现方式中,所述方法还包括:对样本视频流的第一样本视频帧进行检测处理,获取目标对象的轮廓关键点的第一样本位置信息;获取所述第一样本视频帧的第一样本掩膜图像、所述第一样本视频帧和第二样本视频帧之间的样本运动向量,其中,所述第一样本掩膜图像用于表示第一样本视频帧中目标对象的位置和轮廓的图像,所述轮廓关键点位于所述轮廓上,所述第二样本视频帧为所述第一样本视频帧之后的任意视频帧;根据所述样本运动向量、所述第一样本掩膜图像、所述第一样本位置信息和所述修正神经网络,获得修正运动向量;根据所述第一样本视频帧和所述第二样本视频帧,获得参考运动向量;根据所述修正运动向量和所述参考运动向量,获得所述修正神经网络的网络损失;根据所述网络损失,训练所述修正神经网络。
在一些实现方式中,所述根据所述样本运动向量、所述第一样本掩膜图像、所述第一样本位置信息和所述修正神经网络,获得修正运动向量,包括:根据所述样本运动向量和预设的噪声信号,获得样本分量特征图;将所述样本分量特征图、所述第一样本掩膜图像和所述第一样本位置信息输入所述修正神经网络,获得样本修正量;根据所述样本修正量和所述样本运动向量,获得修正运动向量。
通过这种方式,可通过在训练过程中加入随机噪声来提升修正神经网络校正误差的能力,提升修正神经网络的精确度和鲁棒性。
在一些实现方式中,所述方法还包括:根据所述目标对象在第二视频帧中的轮廓关键点的第二位置信息,获得所述第二视频帧的第二掩膜图像,所述第二掩膜图像用于表示所述第二视频帧中目标对象的位置和轮廓的图像。
在一些实现方式中,所述根据所述目标对象在第二视频帧中的轮廓关键点的第二位置信息,获得所述第二视频帧的第二掩膜图像,包括:根据所述第一视频帧中的轮廓关键点之间的相对关系,对所述第二视频帧中的轮廓关键点进行连接,获得所述目标对象在所述第二视频帧中的轮廓;根据所述目标对象在所述第二视频帧中的轮廓,获得所述第二掩膜图像。
本公开实施例还提供了一种视频处理装置,包括:获取部分,被配置为获取待处理视频流中的第一视频帧,以及所述第一视频帧和第二视频帧之间的第一运动向量,其中,所述第二视频帧为所述第一视频帧之后的任意视频帧;检测部分,被配置为对所述第一视频帧中的目标对象进行检测处理,获取所述目标对象在第一视频帧中的轮廓关键点的第一位置信息,以及所述第一视频帧的第一掩膜图像,其中,所述第一掩膜图像用于表示所述第一视频帧中目标对象的位置和轮廓的图像,所述轮廓关键点位于所述轮廓上;修正部分,被配置为根据所述第一运动向量、所述第一位置信息和所述第一掩膜图像,获得第二运动向量,其中,所述第 二运动向量为修正后的运动向量;位置获得部分,被配置为根据所述第二运动向量和所述第一位置信息,获得所述目标对象在第二视频帧中的轮廓关键点的第二位置信息。
在一些实现方式中,所述修正部分,还被配置为:根据所述第一运动向量,获得分量特征图,所述分量特征图由第一运动向量的分量确定;将所述分量特征图、所述第一位置信息和所述第一掩膜图像输入修正神经网络,获得运动向量修正量;根据所述运动向量修正量和所述第一运动向量,获得所述第二运动向量。
在一些实现方式中,所述修正部分还被配置为:将所述第一运动向量进行分解,获得第一维度分量和第二维度分量;根据所述第一维度分量和所述第二维度分量,分别获得分量特征图。
在一些实现方式中,所述装置还包括:训练部分,被配置为对样本视频流的第一样本视频帧进行检测处理,获取目标对象的轮廓关键点的第一样本位置信息;获取所述第一样本视频帧的第一样本掩膜图像、所述第一样本视频帧和第二样本视频帧之间的样本运动向量,其中,所述第一样本掩膜图像用于表示第一样本视频帧中目标对象的位置和轮廓的图像,所述轮廓关键点位于所述轮廓上,所述第二样本视频帧为所述第一样本视频帧之后的任意视频帧;根据所述样本运动向量、所述第一样本掩膜图像、所述第一样本位置信息和所述修正神经网络,获得修正运动向量;根据所述第一样本视频帧和所述第二样本视频帧,获得参考运动向量;根据所述修正运动向量和所述参考运动向量,获得所述修正神经网络的网络损失;根据所述网络损失,训练所述修正神经网络。
在一些实现方式中,所述训练部分,还被配置为:根据所述样本运动向量和预设的噪声信号,获得样本分量特征图;根据将所述样本分量特征图、所述第一样本掩膜图像和所述第一样本位置信息输入所述修正神经网络,获得样本修正量;根据所述样本修正量和所述样本运动向量,获得修正运动向量。
在一些实现方式中,所述装置还包括:掩膜获得部分,被配置为根据所述目标对象在第二视频帧中的轮廓关键点的第二位置信息,获得所述第二视频帧的第二掩膜图像,所述第二掩膜图像用于表示所述第二视频帧中目标对象的位置和轮廓的图像。
在一些实现方式中,所述掩膜获得部分,还被配置为:根据所述第一视频帧中的轮廓关键点之间的相对关系,对所述第二视频帧中的轮廓关键点进行连接,获得所述目标对象在所述第二视频帧中的轮廓;根据所述目标对象在所述第二视频帧中的轮廓,获得所述第二掩膜图像。
本公开实施例提供了一种电子设备,包括:处理器;用于存储处理器可执行指令的存储器;其中,所述处理器被配置为调用所述存储器存储的指令,以执行上述方法。
本公开实施例提供了一种计算机可读存储介质,其上存储有计算机程序指令,所述计算机程序指令被处理器执行时实现上述方法。
本公开实施例还提供了一种计算机程序产品,该计算机程序产品包括计算机程序或指令,在所述计算机程序或指令在电子设备上运行的情况下,使得所述电子设备执行上述方法。
应当理解的是,以上的一般描述和后文的细节描述仅是示例性和解释性的,而非限制本公开。根据下面参考附图对示例性实施例的详细说明,本公开的其它特征及方面将变得清楚。
此处的附图被并入说明书中并构成本说明书的一部分,这些附图示出了符合本公开的实施例,并与说明书一起用于说明本公开的技术方案。
图1为本公开实施例提供的视频处理方法的流程示意图;
图2为本公开实施例提供的视频处理方法的应用示意图;
图3为本公开实施例提供的视频处理装置的组成结构示意图;
图4为本公开实施例提供的一种电子设备的框图;
图5为本公开实施例提供的一种电子设备的框图。
以下将参考附图详细说明本公开的各种示例性实施例、特征和方面。附图中相同的附图标记表示功能相同或相似的元件。尽管在附图中示出了实施例的各种方面,但是除非特别指出,不必按比例绘制附图。
在这里专用的词“示例性”意为“用作例子、实施例或说明性”。这里作为“示例性”所说明的任何实施例不必解释为优于或好于其它实施例。
本文中术语“和/或”,是一种描述关联对象的关联关系,表示关联对象之间可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,本文中术语“至少一种”表示多种中的任意一种或多种中的至少两种的任意组合,例如,包括A、B、C中的至少一种,可以表示包括从A、B和C构成的集合中选择的任意一个或多个元素。
另外,为了更好地说明本公开,在下文的具体实施方式中给出了众多的具体细节。本领域技术人员应当理解,没有某些具体细节,本公开同样可以实施。在一些实例中,对于本领域技术人员熟知的方法、手段、元件和电路未作详细描述,以便于凸显本公开的主旨。
相关技术中,快速视频目标检测方法有两大类:
一类为单帧加速,此方法需逐帧进行视频特征提取(Feature Extraction),因此,并未利用视频帧的时间冗余(Temporal Redundancy)性,仍有较大的加速空间。
另一类为特征域变换加速,此方法基于压缩视频码流(Compressed Bitstream)中的运动向量信息,检测视频帧的特征信息中的目标,由此利用视频帧的时间冗余,达到加速检测和/或分割任务的目的,但该方法中的特征变换属于特征域变换(Feature Wrapping),即,对经过卷积、下采样等处理后的特征信息进行变换等处理来检测目标,因此,难以准确估计物体轮廓线(Contour)。
基于此,本公开提出了一种视频处理方法,该方法可以由电子设备执行,其中,电子设备可以为笔记本电脑,平板电脑,台式计算机,机顶盒,移动设备(例如,移动电话,便携式音乐播放器,个人数字助理,专用消息设备,便携式游戏设备)等各种类型的终端,也可以实施为服务器。服务器可以是独立的物理服务器,也可以是多个物理服务器构成的服务器集群或者分布式***,还可以是提供云服务、云数据库、云计算、云函数、云存储、网络服务、云通信、中间件服务、域名服务、安全服务、内容分发网络(Content Delivery Network,CDN)、以及大数据和人工智能平台等基础云计算服务的云服务器。
下面,将结合本公开实施例中的附图,对本公开实施例中的技术方案进行清楚、完整地描述。
图1为本公开实施例的视频处理方法的流程示意图,如图1所示,所述方法包括以下步骤:
步骤S11,获取待处理视频流中的第一视频帧,以及所述第一视频帧和第二视频帧之间的第一运动向量,其中,所述第二视频帧为所述第一视频帧之后的任意视频帧;
步骤S12,对所述第一视频帧中的目标对象进行识别处理,获取所述目标对象在第一视频帧中的轮廓关键点的第一位置信息,以及所述第一视频帧的第一掩膜图像,其中,所述第一掩膜图像用于表示所述第一视频帧中的目标对象的位置和轮廓的图像,所述轮廓关键点位于所述轮廓上;
步骤S13,根据所述第一运动向量、所述第一位置信息和所述第一掩膜图像,获得第二运动向量,其中,所述第二运动向量为修正后的运动向量;
步骤S14,根据所述第二运动向量和所述第一位置信息,获得所述目标对象在所述第二视频帧中的轮廓关键点的第二位置信息。
根据本公开的实施例的视频处理方法,通过对第一视频帧本身进行目标对象的识别处理,可获得目标对象的准确的轮廓;利用运动向量对第一视频帧的后续视频帧(例如第二视频帧)进行目标检测,即,无需对第一视频帧之外的视频帧进行逐帧的目标检测,而是利用视频帧之间稀疏的运动向量信息来获取其他视频帧中的目标对象的检测结果,因此,利用了视频帧的时间冗余性提升目标检测速度和检测效率;另外,在第一视频帧与第二视频帧之间存在至少一个其他视频帧时,第一视频帧与第二视频帧之间的第一运动向量是任意两个相邻视频帧之间的运动向量的累计,因此,第一运动向量会包含多个相邻视频帧之间的运动向量的累计误差,本公开通过修正第一运动向量得到第二运动向量,并利用第二运动向量来检测第二视频帧中的目标对象,可以减小上述运动向量的累计误差,进而提升对第二视频帧中的目标检测的准确性和鲁棒性。
在一些实现方式中,目标检测被广泛应用在视频处理过程中,例如,可将检测到的目标的位置和/或特征进行存储,而不必存储每一帧视频帧,从而减小存储压力;也可将检测到的目标的位置和/或特征进行传输,而不必传输每一帧视频帧,从而减小传输压力。
通常,可对每帧视频帧进行目标检测,或采样一部分视频帧进行目标检测,但该检测方法通常需要采用深度学习等方法,因此,当视频帧的数量较多时,目标检测的效率不高。还可利用运动向量等方式进行检测,例如,在按照H263,H264,H265,H266,VP8,VP9,AV1,AVS等视频编码标准获得的视频码流中,存在视频帧之间的运动向量,因此,可利用视频帧之间的运动向量来确定各视频帧帧中目标对象的位置。但是,视频帧之间的运动向量具有稀疏性,其主要用于表示像素点的运动特征,而包含的图像内容较少,因此,仅利用视频帧之间的运动向量进行特征域的变换,难以确定待检测视频帧中的目标对象的轮廓,也难以获得待检测视频帧中目标对象的轮廓上的轮廓关键点的准确的位置信息。
在一些实现方式中,针对上述技术问题,本公开对待处理视频流中的关键帧(例如,指定的视频帧,或包含完整目标对象的视频帧)本身进行目标检测,获得目标对象的准确的轮廓,以及轮廓上的关键点的位置信息。然后,通过运动向量对准确的轮廓及轮廓上的关键点进行变换,因此,在利用视频帧的时间冗余性提升目标检测的效率的情况下,可以获得目标对象准确的轮廓。另外,还可以对运动向量进行修正,减少运动向量的误差,提升目标检测的准确性和鲁棒性。
在一些实现方式中,在步骤S11中,可获得待处理视频流中的各视频帧,以 及各视频帧之间的运动向量。在一些实现方式中,按照H263,H264,H265,H266,VP8,VP9,AV1,AVS等视频编码标准编码的视频码流中,均存在视频帧之间的运动向量。所述待处理视频流可属于以上多种码流中的任意一种。通过对待处理视频流进行解码处理(例如,可使用ffmpeg解码器进行解码),可以获得待处理视频流中的各视频帧以及各视频帧之间的运动向量。
在一些实现方式中,通过对待处理视频进行解码处理获得第一视频帧和第二视频帧之间的第一运动向量。第二视频帧为第一视频帧之后的任意视频帧。例如,第二视频帧为与第一视频帧相邻的下一视频帧,则可直接通过解码获取第一运动向量。又例如,第二视频帧不是第一视频帧的相邻视频帧,二者之间存在n(n为正整数)个视频帧的间隔(第二视频帧在第一视频帧之后)。通过上述解码处理,可获得任意两个相邻视频帧之间的运动向量,则可将第一视频帧和第二视频帧之间间隔的所有视频帧之间的运动向量进行向量加法,即可获得第一视频帧和第二视频帧之间的运动向量。例如,第一视频帧为T0,第二视频帧为Tn+1,二者之间间隔了T1,T2…Tn视频帧,第一视频帧T0和视频帧T1之间的运动向量为Mv0,视频帧T1和视频帧T2之间的运动向量为Mv1……视频帧Tn和第二视频帧Tn+1之间的运动向量为Mvn,则第一运动向量为Mv0+Mv1+…+Mvn。本公开对第一视频帧和第二视频帧之间间隔的视频帧的数量不做限制。
在一些实现方式中,在步骤S12中,可对待处理视频流中的第一视频帧进行目标检测,以确定第一视频帧中的目标对象的准确的轮廓线。可对待处理视频流中的第一视频帧中的目标对象进行检测处理,获取所述目标对象在第一视频帧中的轮廓关键点的第一位置信息。在一些实现方式中,第一视频帧可以是指定的关键帧,或者包含完整目标对象的任意视频帧。在一些实现方式中,可通过深度学习的方法对第一视频帧进行检测,获得对目标对象的检测结果,进而获得目标对象的轮廓线以及轮廓线上的轮廓关键点,其中,所述轮廓关键点可包括能够表现轮廓线主要特征的点,例如,可表现轮廓线最宽位置的点、轮廓线最高位置的点等。在一些实现方式中,轮廓线上的每个像素点均可作为轮廓关键点。本公开对关键点的选取不做限制。
这样,通过对包含完整目标对象的第一视频帧进行目标检测,即可确定目标对象的准确的轮廓线,减少了仅利用视频帧中的特征域变换来获得第二视频帧中的目标对象的轮廓关键点而带来的难以准确估计目标对象的轮廓线的问题。
在一些实现方式中,获得目标对象的轮廓线后,还可获取第一视频帧的第一掩膜图像。第一掩膜图像可表示第一视频帧中的目标对象的位置和轮廓,例如,可将轮廓线内和轮廓线上的所有像素点的像素值设置为1,轮廓线外的像素值设置为0,获得所述第一掩膜图像。在一些实现方式中,第一掩膜图像还可用于在后续处理中(例如,通过运动向量进行轮廓关键点的位置变换中),对目标对象的轮廓的形状进行约束和校正等,例如,如果某个轮廓关键点在位置变换过程中离开轮廓线,则可利用第一掩膜图像对其进行校正,使得轮廓线的形状得到保持的同时,还可对位置变换过程中脱离轮廓线的轮廓关键点进行修正,使其位置保持在轮廓线上。本公开对第一掩膜图像的用途不做限制。
在一些实现方式中,获得所述第一运动向量和所述第一位置信息后,可通过第一运动向量对第一视频帧中的轮廓关键点的位置进行变换,获得第二视频帧中的轮廓关键点的位置,然而,由于运动向量的稀疏性,其所包含的信息较少,在变换过程中易受到噪声干扰,产生位置误差。此外,第一运动向量可能是由多个相邻视频帧之间的运动向量相加获得的,如果相邻视频帧之间的运动向量中存在 误差,则对相邻视频帧之间的运动向量进行累加之后获得的第一运动向量存在累计误差可能较大,进而对第二视频帧中轮廓关键点的位置精度产生影响。因此,为提升第二视频帧中的轮廓关键点的位置精度以及提升位置变换的鲁棒性,可对第一运动向量进行修正。
在一些实现方式中,在步骤S13中,可通过第一位置信息(即,目标对象在第一视频帧中的轮廓关键点的位置信息)和第一掩膜图像来修正第一运动向量,获得第二运动向量。其中,第一掩膜图像可对目标对象的轮廓线的形状进行约束和修正,同时,第一位置信息也可起到保持目标对象的轮廓线形状及修正轮廓关键点的位置的作用,例如,通过第一位置信息可确定轮廓关键点之间的相对位置关系,在位置变换过程中,可保持该相对位置关系,从而保持轮廓线的形状。如果由于运动向量存在误差,而导致依据该运动向量获得的第二视频帧中的某个或某些轮廓关键点的位置产生误差,进而导致第二视频帧中的轮廓关键点的相对位置关系发生变化,则可基于第一位置信息确定的相对位置关系来修正第二视频帧中轮廓关键点的相对位置关系,使得各轮廓关键点之间的相对位置关系保持稳定。在一些实现方式中,还可基于第一位置信息来修正第一运动向量,减小第一运动向量的误差,进而减小轮廓和轮廓关键点相对位置关系的误差。本公开对第一位置信息的作用不做限制。
在一些实现方式中,可通过修正神经网络来修正第一运动向量,获得第二运动向量。步骤S13可包括:根据所述第一运动向量,获得分量特征图,所述分量特征图由第一运动向量的分量确定;将所述分量特征图、所述第一位置信息和所述第一掩膜图像输入修正神经网络,获得运动向量修正量;根据所述运动向量修正量和所述第一运动向量,获得所述第二运动向量。
在一些实现方式中,所述修正神经网络可以是深度学习神经网络,例如,卷积神经网络。本公开对修正神经网络的类型不做限制。修正神经网络的输入量可以是图像或特征图的形式,例如,可基于第一运动向量的分量获得分量特征图,即,将运动向量的分量以特征图的形式表示,以作为修正神经网络的输入量。
在一些实现方式中,根据所述第一运动向量,获得分量特征图,包括:将所述第一运动向量进行分解,获得第一维度分量和第二维度分量;根据所述第一维度分量和所述第二维度分量,分别获得对应的分量特征图。
在一些实现方式中,所述第一运动向量可表示第一视频帧中各像素点的运动向量,例如,第一视频帧中某个像素点(可以是轮廓关键点,也可以是其他任何像素点)的坐标为(x,y),通过第一运动向量可知,该像素点对应的运动向量为(△x,△y),则该像素点在第二视频帧中的位置为(x+△x,y+△y)。可见,第一运动向量中每个像素点的运动向量也包括两个维度,因此,第一运动向量可分解为两个维度,即,第一维度分量和第二维度分量。例如,第一维度分量可表示每个像素点在第一维度方向上的运动向量的分量,例如,x方向上的运动向量的分量,即,与每个像素点对应的运动向量中的△x的值,类似地,第二维度分量可表示每个像素点在第二维度方向上的运动向量的分量,例如,y方向的运动向量的分量,即,与每个像素点对应的运动向量中的△y的值。
在一些实现方式中,根据每个像素点对应的运动向量的第一维度分量可获得第一维度的分量特征图。例如,第一视频帧中每个像素点对应的运动向量的第一维度的分量的值,即为第一维度的分量特征图的对应像素点的像素值,例如,每个像素点对应的运动向量中的△x的值,即为第一维度的分量特征图中的对应像素点的像素值。类似地,第一视频帧中每个像素点对应的运动向量的第二维度的 分量的值,即为第二维度的分量特征图的对应像素点的像素值,例如,每个像素点对应的运动向量中的△y的值,即为第二维度的分量特征图中的对应像素点的像素值。第一维度的分量特征图和第二维度的分量特征图为两个通道的分量特征图,例如,第一维度的分量特征图和第二维度的分量特征图为输入修正神经网络的两个输入通道的特征图。
在一些实现方式中,将上述两个通道的分量特征图,以及第一位置信息和第一掩膜图像输入修正神经网络,可通过修正神经网络获得运动向量修正量,即,用于修正第一运动向量的修正参数。
在一些实现方式中,可通过修正参数对第一运动向量进行修正,获得第二运动向量。在一些实现方式中,修正参数可以是向量的形式,例如,某个像素点的修正量为(xt,yt),对第一运动向量中对应像素点的运动向量(△x,△y)进行修正时,可进行向量加法,获得该像素点的修正后的运动向量(△x+xt,△y+yt)。对每个像素点的运动向量均进行修正后,可获得第二运动向量。运动向量修正量也可以是矩阵形式,在进行修正时,可使运动向量修正量与第一运动向量的对应像素点的运动向量进行相乘,获得第二运动向量。本公开对运动向量修正量的具体形式和修正方式不做限制。
通过上述方式,可获得修正后的第二运动向量。通过修正处理可减小运动向量的累计误差,修正轮廓关键点的位置,保持轮廓线的形状。通过第二运动向量对目标对象在第一视频帧中的轮廓关键点进行位置变换,可提升所获得的目标对象在第二视频帧中的轮廓关键点的位置信息的准确性。
在一些实现方式中,在使用上述修正神经网络进行修正前,可对修正神经网络进行训练,例如,可在视频样本中选择多段视频作为样本视频流,在样本视频流中可获取关键帧、运动向量等信息,通过这些信息可对修正神经网络进行训练。
在一些实现方式中,所述视频处理方法还包括:对样本视频流的第一样本视频帧进行检测处理,获取目标对象的轮廓关键点的第一样本位置信息,其中,所述第一样本视频帧为所述样本视频流中的任意视频帧;获取所述第一样本视频帧的第一样本掩膜图像、所述第一样本视频帧和第二样本视频帧之间的样本运动向量,其中,所述第一样本掩膜图像用于表示第一样本视频帧中目标对象的位置和轮廓的图像,所述轮廓关键点位于所述轮廓上,所述第二样本视频帧为所述第一样本视频帧之后的任意视频帧;根据所述样本运动向量、所述第一样本掩膜图像、所述第一样本位置信息和所述修正神经网络,获得修正运动向量;根据所述第一样本视频帧和所述第二样本视频帧,获得参考运动向量;根据所述修正运动向量和所述参考运动向量,获得所述修正神经网络的网络损失;根据所述网络损失,训练所述修正神经网络。
在一些实现方式中,可对样本视频流进行解码处理,获得样本视频流中的视频帧,其中,第一样本视频帧为样本视频流中包含完整目标对象的任意视频帧,例如,第一样本视频帧为样本视频流中的关键帧。可通过深度学习的方法对第一样本视频帧进行检测,获得目标对象的轮廓,并确定轮廓关键点的第一样本位置信息。在一些实现方式中,还可将轮廓线内和轮廓线上的所有像素点的像素值设置为1,将轮廓线外的像素点的像素值设置为0,从而获得第一样本掩膜图像。在一些实现方式中,上述解码过程中,还可获得第一样本视频帧和第二样本视频帧(样本视频流中不同于第一样本视频帧的任意视频帧)之间的样本运动向量。
在一些实现方式中,为提升修正神经网络修正运动向量的误差的能力,可以向样本运动向量中加入随机噪声,然后通过修正神经网络对运动向量进行修正, 从而使修正神经网络提升修正能力。在添加随机噪声时,可添加均匀分布的噪声,例如,[-16,16]内均匀分布的噪声,本公开对随机噪声的类型和范围不做限制。在一些实现方式中,可在样本运动向量中直接添加噪声,也可在样本运动向量的样本分量特征图中添加噪声。
在一些实现方式中,所述根据所述样本运动向量、所述第一样本掩膜图像、所述第一样本位置信息和所述修正神经网络,获得修正运动向量,包括:根据所述样本运动向量和预设的噪声信号,获得样本分量特征图;根据将所述样本分量特征图、所述第一样本掩膜图像和所述第一样本位置信息输入所述修正神经网络,获得样本修正量;根据所述样本修正量和所述样本运动向量,获得修正运动向量。
在一些实现方式中,可在样本运动向量中加入随机噪声信号,例如,样本运动向量包括多个像素点的两个维度的分量,可随机在部分或全部像素点的运动向量中添加随机噪声。在样本运动向量中添加随机噪声时,可以对样本运动向量的两个维度的分量添加随机的数值。随后,利用添加随机噪声后的样本运动向量,获得具有随机噪声的样本分量特征图,获得方式与分量特征图的获得方式一致。
在一些实现方式中,也可先获得样本运动向量的样本分量特征图,再向样本分量特征图中添加随机噪声信号,例如,可在第一维度的样本分量特征图中的部分或全部像素点的运动向量分量中添加随机噪声,并在第二维度的样本分量特征图中的部分或全部像素点的运动向量分量中随机加噪声,获得具有随机噪声的样本分量特征图。本公开对噪声的添加顺序不做限制。
在一些实现方式中,可将具有随机噪声的样本分量特征图、第一样本掩膜图像和第一样本位置信息输入修正神经网络,由修正神经网络来执行保持轮廓线的形状、保持轮廓关键点的相对位置关系、校正轮廓关键点的位置以及修正样本运动向量等处理,获得样本修正量,并基于样本修正量对样本运动向量进行修正,获得修正运动向量。修正方式与上述通过运动向量修正量修正第一运动向量的方式相同。
在一些实现方式中,利用修正神经网络获得样本修正量时,由于修正神经网络存在网络损失(例如,误差),因此,样本修正量也存在误差,造成修正运动向量同样存在误差。因此,可通过修正运动向量与第一样本视频帧和第二样本视频帧之间真正的运动向量来确定该误差。例如,可以基于第一样本视频帧和第二样本视频帧来确定参考运动向量,即,像素点从第一样本视频帧中的位置运动到第二样本视频帧中的位置的运动向量,该参考运动向量为无误差的运动向量,可作为确定修正运动向量的误差的参考。
在一些实现方式中,可基于修正运动向量和参考运动向量之间的误差,来确定修正神经网络的网络损失,例如,可基于向量之间的误差,来确定修正神经网络的输出量,即,样本修正量的误差,进而基于样本修正量的误差来确定修正神经网络的网络损失。
在一些实现方式中,可基于网络损失来训练修正神经网络,即,按照使网络损失减小的方向来调整修正神经网络的网络参数。
以上对修正神经网络的训练过程可迭代执行多次,直到训练达到预定次数,或者,网络损失收敛于预设区间,或小于预设阈值,可完成训练,获得训练后的修正神经网络。
通过这种方式,可通过在训练过程中加入随机噪声来提升修正神经网络校正误差的能力,提升修正神经网络的精确度和鲁棒性。
在一些实现方式中,通过以上训练后的修正神经网络可执行对第一运动向量 的修正,获得精度较高的第二运动向量。然后,在步骤S14中,可基于第二运动向量来对第一视频帧中轮廓关键点的第一位置信息进行变换,获得目标对象的轮廓关键点在第二视频帧中的第二位置信息。在一些实现方式中,可基于相关方法实现步骤S14中的变换,例如,通过向量运算方法,获得目标对象的轮廓关键点在第二视频帧中的第二位置信息。
在一些实现方式中,还可基于第二位置信息获得第二视频帧的第二掩膜图像。所述方法还包括:根据所述目标对象在第二视频帧中的轮廓关键点的第二位置信息,获得所述第二视频帧的第二掩膜图像,所述第二掩膜图像用于表示所述第二视频帧中目标对象的位置和轮廓的图像。
在一些实现方式中,在通过第二运动向量进行位置变换的过程中,可保持目标对象的轮廓线的形状,因此,在第二视频帧中,目标对象的轮廓线的形状和位置仍可通过上述轮廓来表示。在示例中,可将轮廓线内和轮廓线上的像素点的像素值设置为1,将轮廓线外的像素点的像素值设置为0,可获得所述第二掩膜图像。
在一些实现方式中,为保持轮廓线的形状,可使第一视频帧中的轮廓关键点之间具有一定的相对关系,例如,顺序关系。按照各关键点的顺序对关键点进行连接,可获得第一视频帧中的轮廓。同理,在获得第二视频帧中轮廓关键点的第二位置信息后,仍可基于轮廓关键点的相对关系来获得第二视频帧中的轮廓,从而获得第二掩膜图像。所述根据所述目标对象在第二视频帧中的轮廓关键点的第二位置信息,获得所述第二视频帧的第二掩膜图像,包括:根据所述第一视频帧中的轮廓关键点之间的相对关系,对所述第二视频帧中的轮廓关键点进行连接,获得所述目标对象在所述第二视频帧中的轮廓;根据所述目标对象在所述第二视频帧中的轮廓,获得所述第二掩膜图像。
在一些实现方式中,第一视频帧中的轮廓关键点之间具有一定的相对关系,例如,顺序关系,在第二视频帧中,则可保持该相对关系,例如,保持轮廓关键点之间的顺序关系,并按照该顺序关系对轮廓关键点进行连接,则可在保持目标对象轮廓线的形状的情况下,获得目标对象在第二视频帧中的轮廓。所述相对关系不仅包括顺序关系,还可以包括相对位置关系、连接关系等。以保持轮廓关键点之间的连接关系为例,在第一视频帧中,轮廓关键点A与轮廓关键点B连接,与轮廓关键点C不连接,则可以在第二视频帧中保持该连接关系,并按照该连接关系进行连接,从而在保持目标对象轮廓线的形状的情况下,获得目标对象在第二视频帧中的轮廓。
在一些实现方式中,获得目标对象在第二视频帧中的轮廓后,可对轮廓线内侧和外侧的像素点进行不同的处理,例如,将轮廓线内的像素点的像素值设置为1,将轮廓线外的像素点的像素值设置为0,获得所述第二掩膜图像。
根据本公开的实施例的视频处理方法,通过对第一视频帧本身进行目标对象的识别处理,可以获得目标对象的准确的轮廓;利用运动向量对第一视频帧的后续视频帧(例如第二视频帧)进行目标检测,即,无需对第一视频帧之外的视频帧进行逐帧的目标检测,而是利用视频帧之间稀疏的运动向量信息来获取其他视频帧中的目标对象的检测结果,因此,利用视频帧的时间冗余,提升了目标检测速度和检测效率;另外,在第一视频帧与第二视频帧之间存在至少一个其他视频帧时,第一视频帧与第二视频帧之间的第一运动向量是任意两个相邻视频帧之间的运动向量的累计,因此,通过修正神经网络来修正第一运动向量得到第二运动向量,可以减小运动向量的累计误差,修正轮廓关键点的位置,保持轮廓线的形 状。在训练修正神经网络的过程中,可加入随机噪声来提升修正神经网络校正误差的能力,提升修正神经网络的精确度和鲁棒性。
图2为本公开实施例提供的视频处理方法的应用示意图。如图2所示,对样本视频流进行解码获得关键帧21和非关键帧22之间的样本运动向量23,其中,非关键帧22是关键帧21之后的任意非关键帧;对样本视频流中的关键帧21进行目标检测,获得目标对象在关键帧21中的轮廓关键点的第一样本位置信息25;还可以基于关键帧中目标对象的轮廓,获得关键帧21的第一样本掩膜图像24。
在一些实现方式中,将样本运动向量23进行分解,获得x方向的样本分量特征图26和y方向的样本分量特征图27。并可对两个样本分量特征图添加[-16,16]范围内的均匀分布的噪声信号,分别获得具有噪声的样本分量特征图,即:x方向新的样本分量特征图29和y方向新的样本分量特征图30。
在一些实现方式中,可将x方向新的样本分量特征图29、y方向新的样本分量特征图30、第一样本位置信息25和第一样本掩膜图像24输入修正神经网络31进行训练,获得样本修正量32;然后,利用样本修正量32对样本运动向量23进行修正,获得修正运动向量33;随后,基于修正运动向量33,以及关键帧21和非关键帧22之间真实的运动向量之间的误差,确定修正神经网络31的网络损失;最后,按照使修正神经网络31的网络损失减小的方向来训练所述修正神经网络31。
在一些实现方式中,可使用训练后的修正神经网络来确定视频流中任一视频帧中目标对象的轮廓。首先对视频流进行解码,获得关键帧和所述关键帧之外的任一视频帧之间的运动向量,并可获得视频流中关键帧中的目标对象的轮廓关键点的位置信息,还可获得关键帧的掩码图。在一些实现方式中,可将运动向量分解为x和y两个通道的分量特征图,并将分量特征图、轮廓关键点的位置信息和掩码图输入修正神经网络,获得运动向量修正量,以对运动向量进行修正,获得修正后的运动向量,基于修正后的运动向量,对关键帧中的目标对象的轮廓关键点的位置信息进行位置变换,获得任一视频帧中目标对象的轮廓关键点的位置信息。
下面以第一视频帧为关键帧M,第二视频帧为关键帧M之后的非关键帧N为例,对本公开的视频处理方法的一个应用实施例进行详细说明。
首先,对待处理视频进行解码,获得关键帧M和非关键帧N。
然后,对关键帧M进行目标对象检测。针对关键帧M,使用基线方法(baseline method)对其进行目标对象检测,提取目标对象在关键帧M中的轮廓关键点的第一位置信息,以及第一视频帧的第一掩膜图像,该第一掩膜图像用于表示关键帧M中的目标对象的位置和轮廓。
随后,使用关键帧M与非关键帧N之间的第一运动向量、第一位置信息以及第一掩膜图像,对非关键帧N进行目标检测,可以包括以下步骤:抽取第一运动向量、修正第一运动向量、生成非关键帧N的掩膜图像。
在抽取第一运动向量的步骤中,本公开应用实施例使用FFmpeg解码器对视频码流中的运动向量进行抽取。当非关键帧N是与关键帧M相邻的下一视频帧时,可以直接通过解码获取第一运动向量;当非关键帧N不是关键帧M的相邻视频帧,二者之间存在n(n为正整数)个视频帧的间隔时,通过上述解码处理,可获得任意两个相邻视频帧之间的运动向量,则可将非关键帧N与关键帧M之间间隔的所有视频帧之间的运动向量进行向量加法,即可获得非关键帧N与关键帧M之间的运动向量,例如,关键帧M为T0,非关键帧N为Tn+1,二者之 间间隔了T1,T2…Tn视频帧,关键帧T0和视频帧T1之间的运动向量为Mv0,视频帧T1和视频帧T2之间的运动向量为Mv1……视频帧Tn和非关键帧Tn+1之间的运动向量为Mvn,则第一运动向量为Mv0+Mv1+…+Mvn。
在修正第一运动向量的步骤中,本公开应用实施例使用修正神经网络获得第一运动向量的运动向量修正量,并使用该运动向量修正量对第一运动向量进行修正获得第二运动向量。首先,对第一运动向量进行分解,获得x方向的运动向量的分量和y方向的运动向量的分量,根据x方向的运动向量的分量和y方向的运动向量的分量,分别获得x方向和y方向的分量特征图;随后,将x方向的分量特征图和y方向的分量特征图、第一位置信息和所述第一掩膜图像输入修正神经网络,获得运动向量修正量;最后,使用运动向量修正量对第一运动向量进行修正,获得所述第二运动向量。
在生成非关键帧N的掩膜图像的步骤中,首先,基于第二运动向量来对关键帧M中轮廓关键点的第一位置信息进行变换,获得目标对象在非关键帧N中的第二位置信息;然后,基于第二位置信息获得非关键帧N的第二掩膜图像,该第二掩膜图像用于表示非关键帧N中目标对象的位置和轮廓的图像。
在一些实现方式中,所述视频处理方法可用于对视频中的目标进行快速检测,该方法仅需检测关键帧或包含完整目标对象的视频帧中的目标对象的轮廓,即可通过修正后的运动向量来快速获得任一视频帧中的目标对象的位置信息,提升目标检测的准确率和效率。所述视频处理方法可用于监控、直播等领域中的目标检测,也可用于对其他任意应用领域的视频中的目标进行检测和追踪。本公开对所述视频处理方法的应用领域不做限制。
图3为本公开实施例提供的视频处理装置的组成结构示意图,如图3所示,所述装置包括:获取部分11,被配置为获取待处理视频流中的第一视频帧,以及所述第一视频帧和第二视频帧之间的第一运动向量,其中,所述第二视频帧为第一视频帧之后的任意视频帧;检测部分12,被配置为对所述第一视频帧中的目标对象进行检测处理,获取所述目标对象在第一视频帧中的轮廓关键点的第一位置信息,以及所述第一视频帧的第一掩膜图像,其中,所述第一掩膜图像用于表示所述第一视频帧中目标对象的位置和轮廓的图像,所述轮廓关键点位于所述轮廓上;修正部分13,被配置为根据所述第一运动向量、所述第一位置信息和所述第一掩膜图像,获得第二运动向量,其中,所述第二运动向量为修正后的运动向量;位置获得部分14,被配置为根据所述第二运动向量和所述第一位置信息,获得所述目标对象在第二视频帧中的轮廓关键点的第二位置信息。
在一些实现方式中,所述修正部分还被配置为:根据所述第一运动向量,获得分量特征图,所述分量特征图由第一运动向量的分量确定;将所述分量特征图、所述第一位置信息和所述第一掩膜图像输入修正神经网络,获得运动向量修正量;根据所述运动向量修正量和所述第一运动向量,获得所述第二运动向量。
在一些实现方式中,所述修正部分还被配置为:将所述第一运动向量进行分解,获得第一维度分量和第二维度分量;根据所述第一维度分量和所述第二维度分量,分别获得分量特征图。
在一些实现方式中,所述装置还包括:训练部分,被配置为对样本视频流的第一样本视频帧进行检测处理,获取目标对象的轮廓关键点的第一样本位置信息;获取所述第一样本视频帧的第一样本掩膜图像、所述第一样本视频帧和第二样本视频帧之间的样本运动向量,其中,所述第一样本掩膜图像用于表示第一样本视频帧中目标对象的位置和轮廓的图像,所述轮廓关键点位于所述轮廓上,所述第 二样本视频帧为所述第一样本视频帧之后的任意视频帧;根据所述样本运动向量、所述第一样本掩膜图像、所述第一样本位置信息和所述修正神经网络,获得修正运动向量;根据所述第一样本视频帧和所述第二样本视频帧,获得参考运动向量;根据所述修正运动向量和所述参考运动向量,获得所述修正神经网络的网络损失;根据所述网络损失,训练所述修正神经网络。
在一些实现方式中,所述训练部分还被配置为:根据所述样本运动向量和预设的噪声信号,获得样本分量特征图;将所述样本分量特征图、所述第一样本掩膜图像和所述第一样本位置信息输入所述修正神经网络,获得样本修正量;根据所述样本修正量和所述样本运动向量,获得修正运动向量。
在一些实现方式中,所述装置还包括:掩膜获得部分,被配置为根据所述目标对象在第二视频帧中的轮廓关键点的第二位置信息,获得所述第二视频帧的第二掩膜图像,所述第二掩膜图像用于表示所述第二视频帧中目标对象的位置和轮廓的图像。
在一些实现方式中,所述掩膜获得部分还被配置为:根据所述第一视频帧中的轮廓关键点之间的相对关系,对所述第二视频帧中的轮廓关键点进行连接,获得所述目标对象在所述第二视频帧中的轮廓;根据所述目标对象在所述第二视频帧中的轮廓,获得所述第二掩膜图像。
在本公开实施例以及其他的实施例中,“部分”可以是部分电路、部分处理器、部分程序或软件等等,当然也可以是单元,还可以是模块也可以是非模块化的。
可以理解,本公开提及的上述各个方法实施例,在不违背原理逻辑的情况下,均可以彼此相互结合形成结合后的实施例。本领域技术人员可以理解,在具体实施方式的上述方法中,各步骤的具体执行顺序应当以其功能和可能的内在逻辑确定。
此外,本公开还提供了视频处理装置、电子设备、存储介质、计算机程序产品,上述均可用来实现本公开提供的任一种视频处理方法,相应技术方案和描述和参见方法部分的相应记载。
本公开实施例还提出一种计算机可读存储介质,其上存储有计算机程序指令,所述计算机程序指令被处理器执行时实现上述方法。计算机可读存储介质可以是非易失性计算机可读存储介质。
本公开实施例还提出一种电子设备,包括:处理器;用于存储处理器可执行指令的存储器;其中,所述处理器被配置为调用所述存储器存储的指令,以执行上述方法。
本公开实施例还提供了一种计算机程序产品,包括计算机可读代码,当计算机可读代码在设备上运行时,设备中的处理器执行用于实现如上任一实施例提供的视频处理方法的指令。
本公开实施例还提供了另一种计算机程序产品,用于存储计算机可读指令,指令被执行时使得计算机执行上述任一实施例提供的视频处理方法的操作。
电子设备可以被提供为终端、服务器或其它形态的设备。
图4为本公开实施例提供的一种电子设备800的框图。在一些实现方式中,电子设备800可以是移动电话,计算机,数字广播终端,消息收发设备,游戏控制台,平板设备,医疗设备,健身设备,个人数字助理等终端。
如图4所示,电子设备800可以包括以下一个或多个组件:处理组件802,存储器804,电源组件806,多媒体组件808,音频组件810,输入/输出(I/O) 的接口812,传感器组件814,以及通信组件816。
处理组件802通常控制电子设备800的整体操作,诸如与显示,电话呼叫,数据通信,相机操作和记录操作相关联的操作。处理组件802可以包括一个或多个处理器820来执行指令,以完成上述的方法的全部或部分步骤。此外,处理组件802可以包括一个或多个模块,便于处理组件802和其他组件之间的交互。例如,处理组件802可以包括多媒体模块,以方便多媒体组件808和处理组件802之间的交互。
存储器804被配置为存储各种类型的数据以支持在电子设备800的操作。这些数据的示例包括用于在电子设备800上操作的任何应用程序或方法的指令,例如,联系人数据、电话簿数据、消息、图片以及视频等。存储器804可以由任何类型的易失性或非易失性存储设备或者它们的组合实现,例如,存储器804可以由静态随机存取存储器(SRAM)、电可擦除可编程只读存储器(EEPROM)、可擦除可编程只读存储器(EPROM)、可编程只读存储器(PROM)、只读存储器(ROM)、磁存储器、快闪存储器、磁盘以及光盘中的一种或多种的组合实现。
电源组件806为电子设备800的各种组件提供电力。电源组件806可以包括电源管理***、一个或多个电源以及其他与为电子设备800生成、管理和分配电力相关联的组件。
多媒体组件808包括在所述电子设备800和用户之间的提供一个输出接口的屏幕。在一些实施例中,屏幕可以包括液晶显示器(LCD)和触摸面板(TP)。如果屏幕包括触摸面板,则屏幕可以被实现为触摸屏,以接收来自用户的输入信号。触摸面板包括一个或多个触摸传感器以感测触摸、滑动和触摸面板上的手势。所述触摸传感器可以不仅感测触摸或滑动动作,而且还可以检测与所述触摸或滑动操作相关的持续时间和压力。在一些实施例中,多媒体组件808还包括一个前置摄像头和/或后置摄像头。当电子设备800处于操作模式,如拍摄模式或视频模式时,前置摄像头和/或后置摄像头可以接收外部的多媒体数据。每个前置摄像头和后置摄像头可以是一个固定的光学透镜***或具有焦距和光学变焦能力。
音频组件810被配置为输出和/或输入音频信号。例如,音频组件810包括一个麦克风(MIC),当电子设备800处于操作模式,如呼叫模式、记录模式和语音识别模式时,麦克风被配置为接收外部音频信号。所接收的音频信号可以被存储在存储器804中,或者经由通信组件816发送到其他电子设备。在一些实施例中,音频组件810还包括一个扬声器,用于输出音频信号。
I/O接口812为处理组件802与***接口模块之间提供接口,上述***接口模块可以是键盘,点击轮,按钮等。这些按钮可包括但不限于:主页按钮、音量按钮、启动按钮和锁定按钮。
传感器组件814包括一个或多个传感器,用于为电子设备800提供各个方面的状态评估。例如,传感器组件814可以检测到电子设备800的打开/关闭状态,组件的相对定位,例如所述组件为电子设备800的显示器和小键盘,传感器组件814还可以检测电子设备800或电子设备800的一个组件的位置改变,用户与电子设备800接触的存在或不存在,电子设备800方位或加速/减速和电子设备800的温度变化。传感器组件814可以包括接近传感器,被配置用来在没有任何的物理接触时检测附近物体的存在。传感器组件814还可以包括光传感器,如CMOS或CCD图像传感器,用于在成像应用中使用。在一些实施例中,该传感器组件814还可以包括加速度传感器,陀螺仪传感器,磁传感器,压力传感器或温度传感器。
通信组件816被配置为便于电子设备800和其他设备之间有线或无线方式的通信。电子设备800可以接入基于通信标准的无线网络,例如WiFi,2G或3G,或它们的组合。在一个示例性实施例中,通信组件816经由广播信道接收来自外部广播管理***的广播信号或广播相关信息。在一个示例性实施例中,所述通信组件816还包括近场通信(NFC)模块,以促进短程通信。例如,在NFC模块可基于射频识别(RFID)技术,红外数据协会(IrDA)技术,超宽带(UWB)技术,蓝牙(BT)技术和其他技术来实现。
在一些实施例中,电子设备800可以被一个或多个应用专用集成电路(ASIC)、数字信号处理器(DSP)、数字信号处理设备(DSPD)、可编程逻辑器件(PLD)、现场可编程门阵列(FPGA)、控制器、微控制器、微处理器或其他电子元件实现,用于执行上述方法。
在一些实施例中,还提供了一种非易失性计算机可读存储介质,例如包括计算机程序指令的存储器804,上述计算机程序指令可由电子设备800的处理器820执行以完成上述方法。
图5为本公开实施例提供的一种电子设备1900的框图。例如,电子设备1900可以被提供为一服务器。参照图5,电子设备1900包括处理组件1922,其进一步包括一个或多个处理器,以及由存储器1932所代表的存储器资源,用于存储可由处理组件1922执行的指令,例如应用程序。存储器1932中存储的应用程序可以包括一个或一个以上的每一个对应于一组指令的模块。此外,处理组件1922被配置为执行指令,以执行上述方法。
电子设备1900还可以包括一个电源组件1926被配置为执行电子设备1900的电源管理,一个有线或无线网络接口1950被配置为将电子设备1900连接到网络,和一个输入输出(I/O)接口1958。电子设备1900可以操作基于存储在存储器1932的操作***,例如Windows ServerTM,Mac OS XTM,UnixTM,LinuxTM,FreeBSDTM或类似。
在一些实施例中,还提供了一种非易失性计算机可读存储介质,例如包括计算机程序指令的存储器1932,上述计算机程序指令可由电子设备1900的处理组件1922执行以完成上述方法。
本公开可以是***、方法和/或计算机程序产品。计算机程序产品可以包括计算机可读存储介质,其上载有用于使处理器实现本公开的各个方面的计算机可读程序指令。
计算机可读存储介质可以是可以保持和存储由指令执行设备使用的指令的有形设备。计算机可读存储介质例如可以是但不限于电存储设备、磁存储设备、光存储设备、电磁存储设备、半导体存储设备或者上述的任意合适的组合。计算机可读存储介质的更具体的例子(非穷举的列表)包括:便携式计算机盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、静态随机存取存储器(SRAM)、便携式压缩盘只读存储器(CD-ROM)、数字多功能盘(DVD)、记忆棒、软盘、机械编码设备、例如其上存储有指令的打孔卡或凹槽内凸起结构、以及上述的任意合适的组合。这里所使用的计算机可读存储介质不被解释为瞬时信号本身,诸如无线电波或者其他自由传播的电磁波、通过波导或其他传输媒介传播的电磁波(例如,通过光纤电缆的光脉冲)、或者通过电线传输的电信号。
这里所描述的计算机可读程序指令可以从计算机可读存储介质下载到各个计算/处理设备,或者通过网络、例如因特网、局域网、广域网和/或无线网下载 到外部计算机或外部存储设备。网络可以包括铜传输电缆、光纤传输、无线传输、路由器、防火墙、交换机、网关计算机和/或边缘服务器。每个计算/处理设备中的网络适配卡或者网络接口从网络接收计算机可读程序指令,并转发该计算机可读程序指令,以供存储在各个计算/处理设备中的计算机可读存储介质中。
用于执行本公开操作的计算机程序指令可以是汇编指令、指令集架构(ISA)指令、机器指令、机器相关指令、微代码、固件指令、状态设置数据、或者以一种或多种编程语言的任意组合编写的源代码或目标代码,所述编程语言包括面向对象的编程语言(例如Smalltalk、C++等),以及常规的过程式编程语言—诸如“C”语言或类似的编程语言。计算机可读程序指令可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络—包括局域网(LAN)或广域网(WAN)—连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。在一些实施例中,通过利用计算机可读程序指令的状态信息来个性化定制电子电路,例如可编程逻辑电路、现场可编程门阵列(FPGA)或可编程逻辑阵列(PLA),该电子电路可以执行计算机可读程序指令,从而实现本公开的各个方面。
这里参照根据本公开实施例的方法、装置(***)和计算机程序产品的流程图和/或框图描述了本公开的各个方面。应当理解,流程图和/或框图的每个方框以及流程图和/或框图中各方框的组合,都可以由计算机可读程序指令实现。
这些计算机可读程序指令可以提供给通用计算机、专用计算机或其它可编程数据处理装置的处理器,从而生产出一种机器,使得这些指令在通过计算机或其它可编程数据处理装置的处理器执行时,产生了实现流程图和/或框图中的一个或多个方框中规定的功能/动作的装置。也可以把这些计算机可读程序指令存储在计算机可读存储介质中,这些指令使得计算机、可编程数据处理装置和/或其他设备以特定方式工作,从而,存储有指令的计算机可读介质则包括一个制造品,其包括实现流程图和/或框图中的一个或多个方框中规定的功能/动作的各个方面的指令。
也可以把计算机可读程序指令加载到计算机、其它可编程数据处理装置、或其它设备上,使得在计算机、其它可编程数据处理装置或其它设备上执行一系列操作步骤,以产生计算机实现的过程,从而使得在计算机、其它可编程数据处理装置、或其它设备上执行的指令实现流程图和/或框图中的一个或多个方框中规定的功能/动作。
附图中的流程图和框图显示了根据本公开的多个实施例的***、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段或指令的一部分,所述模块、程序段或指令的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个连续的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或动作的专用的基于硬件的***来实现,或者可以用专用硬件与计算机指令的组合来实现。
该计算机程序产品可以具体通过硬件、软件或其结合的方式实现。在一个可选实施例中,所述计算机程序产品具体体现为计算机存储介质,在另一个可选实 施例中,计算机程序产品具体体现为软件产品,例如软件开发包(Software Development Kit,SDK)等等。
以上已经描述了本公开的各实施例,上述说明是示例性的,并非穷尽性的,并且也不限于所披露的各实施例。在不偏离所说明的各实施例的范围和精神的情况下,对于本技术领域的普通技术人员来说许多修改和变更都是显而易见的。本文中所用术语的选择,旨在最好地解释各实施例的原理、实际应用或对市场中的技术的改进,或者使本技术领域的其它普通技术人员能理解本文披露的各实施例。
本公开实施例提供了一种视频处理方法及装置、电子设备、存储介质和计算机程序产品,其中,视频处理方法包括:获取第一视频帧,以及第一视频帧和第二视频帧之间的第一运动向量;获取目标对象在第一视频帧中的轮廓关键点的第一位置信息,以及第一视频帧的第一掩膜图像;根据第一运动向量、第一位置信息和第一掩膜图像,获得第二运动向量;根据第二运动向量和第一位置信息,获得目标对象在第二视频帧中的轮廓关键点的第二位置信息。上述视频处理方法,首先通过对第一视频帧本身进行目标对象的识别处理,可以获得目标对象的准确的轮廓;其次,通过利用视频帧的时间冗余,可以提升目标检测速度和检测效率;再次,利用修正后的第二运动向量来检测第二视频帧中的目标对象,可以减小上述运动向量的累计误差,进而提升对第二视频帧的目标检测的准确性和鲁棒性。
Claims (17)
- 一种视频处理方法,包括:获取待处理视频流中的第一视频帧,以及所述第一视频帧和第二视频帧之间的第一运动向量,其中,所述第二视频帧为所述第一视频帧之后的任意视频帧;对所述第一视频帧中的目标对象进行检测处理,获取所述目标对象在所述第一视频帧中的轮廓关键点的第一位置信息,以及所述第一视频帧的第一掩膜图像,其中,所述第一掩膜图像用于表示所述第一视频帧中目标对象的位置和轮廓的图像,所述轮廓关键点位于所述轮廓上;根据所述第一运动向量、所述第一位置信息和所述第一掩膜图像,获得第二运动向量,其中,所述第二运动向量为修正后的运动向量;根据所述第二运动向量和所述第一位置信息,获得所述目标对象在所述第二视频帧中的轮廓关键点的第二位置信息。
- 根据权利要求1所述的方法,其中,所述根据所述第一运动向量、所述第一位置信息和所述第一掩膜图像,获得第二运动向量,包括:根据所述第一运动向量,获得分量特征图,所述分量特征图由所述第一运动向量的分量确定的;将所述分量特征图、所述第一位置信息和所述第一掩膜图像输入修正神经网络,获得运动向量修正量;根据所述运动向量修正量和所述第一运动向量,获得所述第二运动向量。
- 根据权利要求2所述的方法,其中,所述根据所述第一运动向量,获得分量特征图,包括:将所述第一运动向量进行分解,获得第一维度分量和第二维度分量;根据所述第一维度分量和所述第二维度分量,分别获得分量特征图。
- 根据权利要求2所述的方法,其中,所述方法还包括:对样本视频流的第一样本视频帧进行检测处理,获取目标对象的轮廓关键点的第一样本位置信息;获取所述第一样本视频帧的第一样本掩膜图像、所述第一样本视频帧和第二样本视频帧之间的样本运动向量,其中,所述第一样本掩膜图像用于表示第一样本视频帧中目标对象的位置和轮廓的图像,所述轮廓关键点位于所述轮廓上,所述第二样本视频帧为所述第一样本视频帧之后的任意视频帧;根据所述样本运动向量、所述第一样本掩膜图像、所述第一样本位置信息和所述修正神经网络,获得修正运动向量;根据所述第一样本视频帧和所述第二样本视频帧,获得参考运动向量;根据所述修正运动向量和所述参考运动向量,获得所述修正神经网络的网络损失;根据所述网络损失,训练所述修正神经网络。
- 根据权利要求4所述的方法,其中,所述根据所述样本运动向量、所述第一样本掩膜图像、所述第一样本位置信息和所述修正神经网络,获得修正运动向量,包括:根据所述样本运动向量和预设的噪声信号,获得样本分量特征图;将所述样本分量特征图、所述第一样本掩膜图像和所述第一样本位置信息输入所述修正神经网络,获得样本修正量;根据所述样本修正量和所述样本运动向量,获得所述修正运动向量。
- 根据权利要求1至5任一项所述的方法,其中,所述方法还包括:根据所述目标对象在第二视频帧中的轮廓关键点的第二位置信息,获得所述第二视频帧的第二掩膜图像,所述第二掩膜图像用于表示所述第二视频帧中目标对象的位置和轮廓的图像。
- 根据权利要求6所述的方法,其中,所述根据所述目标对象在第二视频帧中的轮廓关键点的第二位置信息,获得所述第二视频帧的第二掩膜图像,包括:根据所述第一视频帧中的轮廓关键点之间的相对关系,对所述第二视频帧中的轮廓关键点进行连接,获得所述目标对象在所述第二视频帧中的轮廓;根据所述目标对象在所述第二视频帧中的轮廓,获得所述第二掩膜图像。
- 一种视频处理装置,包括:获取部分,被配置为获取待处理视频流中的第一视频帧,以及所述第一视频帧和第二视频帧之间的第一运动向量,其中,所述第二视频帧为所述第一视频帧之后的任意视频帧;检测部分,被配置为对所述第一视频帧中的目标对象进行检测处理,获取所述目标对象在第一视频帧中的轮廓关键点的第一位置信息,以及所述第一视频帧的第一掩膜图像,其中,所述第一掩膜图像用于表示所述第一视频帧中目标对象的位置和轮廓的图像,所述轮廓关键点位于所述轮廓上;修正部分,被配置为根据所述第一运动向量、所述第一位置信息和所述第一掩膜图像,获得第二运动向量,其中,所述第二运动向量为修正后的运动向量;位置获得部分,被配置为根据所述第二运动向量和所述第一位置信息,获得所述目标对象在第二视频帧中的轮廓关键点的第二位置信息。
- 根据权利要求8所述的装置,其中,所述修正部分还被配置为:根据所述第一运动向量,获得分量特征图,所述分量特征图由所述第一运动向量的分量确定的;将所述分量特征图、所述第一位置信息和所述第一掩膜图像输入修正神经网络,获得运动向量修正量;根据所述运动向量修正量和所述第一运动向量,获得所述第二运动向量。
- 根据权利要求9所述的装置,其中,所述修正部分还被配置为:将所述第一运动向量进行分解,获得第一维度分量和第二维度分量;根据所述第一维度分量和所述第二维度分量,分别获得分量特征图。
- 根据权利要求9所述的装置,其中,所述装置还包括训练部分,被配置为:对样本视频流的第一样本视频帧进行检测处理,获取目标对象的轮廓关键点的第一样本位置信息;获取所述第一样本视频帧的第一样本掩膜图像、所述第一样本视频帧和第二样本视频帧之间的样本运动向量,其中,所述第一样本掩膜图像用于表示第一样本视频帧中目标对象的位置和轮廓的图像,所述轮廓关键点位于所述轮廓上,所述第二样本视频帧为所述第一样本视频帧之后的任意视频帧;根据所述样本运动向量、所述第一样本掩膜图像、所述第一样本位置信息和所述修正神经网络,获得修正运动向量;根据所述第一样本视频帧和所述第二样本视频帧,获得参考运动向量;根据所述修正运动向量和所述参考运动向量,获得所述修正神经网络的网络损失;根据所述网络损失,训练所述修正神经网络。
- 根据权利要求11所述的装置,其中,所述训练部分还被配置为:根据所述样本运动向量和预设的噪声信号,获得样本分量特征图;将所述样本分量特征图、所述第一样本掩膜图像和所述第一样本位置信息输入所述修正神经网络,获得样本修正量;根据所述样本修正量和所述样本运动向量,获得所述修正运动向量。
- 根据权利要求8至12任一项所述的装置,其中,所述装置还包括掩膜获得部分,被配置为:根据所述目标对象在第二视频帧中的轮廓关键点的第二位置信息,获得所述第二视频帧的第二掩膜图像,所述第二掩膜图像用于表示所述第二视频帧中目标对象的位置和轮廓的图像。
- 根据权利要求13所述的装置,其中,所述掩膜获得部分还被配置为:根据所述第一视频帧中的轮廓关键点之间的相对关系,对所述第二视频帧中的轮廓关键点进行连接,获得所述目标对象在所述第二视频帧中的轮廓;根据所述目标对象在所述第二视频帧中的轮廓,获得所述第二掩膜图像。
- 一种电子设备,包括:处理器;用于存储处理器可执行指令的存储器;其中,所述处理器被配置为调用所述存储器存储的指令,以执行权利要求1至7中任意一项所述的方法。
- 一种计算机可读存储介质,其上存储有计算机程序指令,其中,所述计算机程序指令被处理器执行时实现权利要求1至7中任意一项所述的方法。
- 一种计算机程序产品,所述计算机程序产品包括计算机程序或指令,在所述计算机程序或指令在电子设备上运行的情况下,使得所述电子设备执行权利要求1至7中任意一项所述的方法。
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111483515.8A CN114202562A (zh) | 2021-12-07 | 2021-12-07 | 视频处理方法及装置、电子设备和存储介质 |
CN202111483515.8 | 2021-12-07 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2023103294A1 true WO2023103294A1 (zh) | 2023-06-15 |
Family
ID=80650936
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2022/094896 WO2023103294A1 (zh) | 2021-12-07 | 2022-05-25 | 视频处理方法及装置、电子设备、存储介质和计算机程序产品 |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN114202562A (zh) |
WO (1) | WO2023103294A1 (zh) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116883915A (zh) * | 2023-09-06 | 2023-10-13 | 常州星宇车灯股份有限公司 | 一种基于前后帧图像关联的目标检测方法及检测*** |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114202562A (zh) * | 2021-12-07 | 2022-03-18 | 北京市商汤科技开发有限公司 | 视频处理方法及装置、电子设备和存储介质 |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108256511A (zh) * | 2018-03-15 | 2018-07-06 | 太原理工大学 | 基于视频编码码流的人体运动检测方法 |
CN110516620A (zh) * | 2019-08-29 | 2019-11-29 | 腾讯科技(深圳)有限公司 | 目标跟踪方法、装置、存储介质及电子设备 |
US20200193609A1 (en) * | 2018-12-18 | 2020-06-18 | Qualcomm Incorporated | Motion-assisted image segmentation and object detection |
CN112184757A (zh) * | 2020-09-28 | 2021-01-05 | 浙江大华技术股份有限公司 | 运动轨迹的确定方法及装置、存储介质、电子装置 |
CN114202562A (zh) * | 2021-12-07 | 2022-03-18 | 北京市商汤科技开发有限公司 | 视频处理方法及装置、电子设备和存储介质 |
-
2021
- 2021-12-07 CN CN202111483515.8A patent/CN114202562A/zh active Pending
-
2022
- 2022-05-25 WO PCT/CN2022/094896 patent/WO2023103294A1/zh unknown
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108256511A (zh) * | 2018-03-15 | 2018-07-06 | 太原理工大学 | 基于视频编码码流的人体运动检测方法 |
US20200193609A1 (en) * | 2018-12-18 | 2020-06-18 | Qualcomm Incorporated | Motion-assisted image segmentation and object detection |
CN110516620A (zh) * | 2019-08-29 | 2019-11-29 | 腾讯科技(深圳)有限公司 | 目标跟踪方法、装置、存储介质及电子设备 |
CN112184757A (zh) * | 2020-09-28 | 2021-01-05 | 浙江大华技术股份有限公司 | 运动轨迹的确定方法及装置、存储介质、电子装置 |
CN114202562A (zh) * | 2021-12-07 | 2022-03-18 | 北京市商汤科技开发有限公司 | 视频处理方法及装置、电子设备和存储介质 |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116883915A (zh) * | 2023-09-06 | 2023-10-13 | 常州星宇车灯股份有限公司 | 一种基于前后帧图像关联的目标检测方法及检测*** |
CN116883915B (zh) * | 2023-09-06 | 2023-11-21 | 常州星宇车灯股份有限公司 | 一种基于前后帧图像关联的目标检测方法及检测*** |
Also Published As
Publication number | Publication date |
---|---|
CN114202562A (zh) | 2022-03-18 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110287874B (zh) | 目标追踪方法及装置、电子设备和存储介质 | |
WO2023103294A1 (zh) | 视频处理方法及装置、电子设备、存储介质和计算机程序产品 | |
CN112001321B (zh) | 网络训练、行人重识别方法及装置、电子设备和存储介质 | |
CN109922372B (zh) | 视频数据处理方法及装置、电子设备和存储介质 | |
CN107944409B (zh) | 能够区分关键动作的视频分析方法及装置 | |
CN108985176B (zh) | 图像生成方法及装置 | |
WO2020181728A1 (zh) | 图像处理方法及装置、电子设备和存储介质 | |
TW202105202A (zh) | 影片處理方法及裝置、電子設備、儲存媒體和電腦程式 | |
CN111445414B (zh) | 图像处理方法及装置、电子设备和存储介质 | |
CN106534951B (zh) | 视频分割方法和装置 | |
CN110543849B (zh) | 检测器的配置方法及装置、电子设备和存储介质 | |
WO2022198828A1 (zh) | 一种公式识别方法及装置 | |
CN108171222B (zh) | 一种基于多流神经网络的实时视频分类方法及装置 | |
CN110796012B (zh) | 图像处理方法、装置、电子设备及可读存储介质 | |
CN113506229B (zh) | 神经网络训练和图像生成方法及装置 | |
CN113538310A (zh) | 图像处理方法及装置、电子设备和存储介质 | |
CN111311588B (zh) | 重定位方法及装置、电子设备和存储介质 | |
CN109068138B (zh) | 视频图像的处理方法及装置、电子设备和存储介质 | |
CN110121115B (zh) | 精彩视频片段的确定方法及装置 | |
KR20210054522A (ko) | 얼굴 인식 방법 및 장치, 전자 기기 및 저장 매체 | |
CN113506324B (zh) | 图像处理方法及装置、电子设备和存储介质 | |
CN113506325B (zh) | 图像处理方法及装置、电子设备和存储介质 | |
CN110858921A (zh) | 节目视频的处理方法及装置 | |
CN112330721A (zh) | 三维坐标的恢复方法及装置、电子设备和存储介质 | |
CN110769129A (zh) | 图像处理方法、装置、电子设备及计算机可读存储介质 |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 22902732 Country of ref document: EP Kind code of ref document: A1 |