Video key area analysis method based on frame difference convolutional neural network

Through the frame difference convolutional neural network analysis method, the key areas of the video frame are identified and intelligently cropped, which solves the problem of traditional videos not being suitable for display on mobile phones and achieves a better vertical screen viewing experience.

CN118609015APending Publication Date: 2024-09-06SHI-CHENG LABORATORY FOR INFORMATION DISPLAY & VISUALIZATION +1
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202410644380.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-23
Publication Date
2024-09-06

AI Technical Summary

Technical Problem

When traditional videos are displayed on smart devices such as mobile phones, the aspect ratio does not adapt, resulting in a poor viewing experience. It lacks effective smart cropping technology to adapt to vertical screen display.

Method used

A video key area analysis method based on frame difference convolutional neural network is used to build a scene category recognition model through frame difference processing, SVM classifier, convolutional neural network and LSTM network, generate a heat map and combine it with a weighted matrix to determine the key points of video frames. area, intelligently cropped to fit the 4:3 aspect ratio.

Benefits of technology

It achieves accurate cropping of videos, provides a better vertical screen viewing experience, and is suitable for mobile devices, video editing software and social media platforms.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118609015A
    Figure CN118609015A
Patent Text Reader

Abstract

The invention discloses a video key area analysis method based on a frame difference convolutional neural network, and the method comprises the steps: carrying out the classification of each video frame through an SVM classifier, and determining the type of each video frame; constructing a scene category recognition model based on a convolutional neural network and an LSTM network, wherein the scene category recognition model is used for performing scene category marking on the video frame; designing a thermodynamic diagram extraction scheme according to a scene category, and generating a grey-scale map for input image array data to serve as a popularity weight; according to the category of the video frame, obtaining an area with the maximum weight value as a central point of the interception part by utilizing a result obtained by multiplying the thermodynamic diagram and the weighting matrix; and cutting the video frame according to the calculated central point coordinate of the cut part, and displaying the processed vertical screen picture at the front end. According to the method and the device, the video can be accurately clipped, and finally the key part of the clipped video picture is displayed at the front end, so that better vertical screen watching experience is provided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical fields of computer vision and target detection, and in particular to a video key area analysis method based on a frame difference convolutional neural network. Background Art

[0002] With the rapid development of multimedia technology, more and more users are accustomed to using terminal devices such as smart phones to conveniently obtain, disseminate and use video data. The display screens of smart devices such as mobile phones widely use 3:4 or even smaller aspect ratios, which makes traditional 4:3 and 16:9 aspect ratio videos not display well on mobile phones. Therefore, the study of video frame intelligent cropping technology, which performs adaptive cropping according to video content, has attracted widespread attention from the public. Summary of the invention

[0003] Technical problem solved: The present invention discloses a video key area analysis method based on a frame difference convolutional neural network, which can accurately crop the video and display the key part of the cropped video screen on the front end. The method can be applied to mobile devices, video editing software, social media platforms and other fields to provide a better vertical screen viewing experience.

[0004] Technical solution:

[0005] A video key area analysis method based on a frame difference convolutional neural network, the video key area analysis method comprising the following steps:

[0006] S1: Perform frame difference processing on the input continuous video frames, classify each video frame using the SVM classifier, and determine the category to which the video frame belongs;

[0007] S2: A scene category recognition model is constructed based on a convolutional neural network and an LSTM network to mark the scene categories of video frames. Specifically, video frames of different categories are imported into the scene category recognition model, and the image features of the video frames are extracted using a convolutional neural network. The image feature time series is constructed according to the acquisition time of the video frames. The LSTM network is used to capture the dependency features in the image feature time series, and the scene category of the video frame is obtained according to the dependency features in the image feature time series.

[0008] S3: design a heat map extraction scheme according to the scene category obtained in step S2, and generate a grayscale map as a heat weight for the input image array data;

[0009] S4: According to the category to which the video frame determined in step S1 belongs, the result obtained by multiplying the heat map with the weighted matrix is ​​used to obtain the area with the largest weight as the coordinate value of the intercepted part;

[0010] S5: cropping the video frame according to the calculated center point coordinates, and displaying the processed vertical screen image on the front end. Further, in step S1, the process of classifying each video frame using the SVM classifier includes the following steps:

[0011] S1.1: Convert the video frames read into the program to grayscale and calculate the frame difference between adjacent input frames; compress the frame difference into a 1*w dimensional array, and then process the 1*w dimensional array into a 1*20 dimensional vector with the same dimension, where w is the width of the input video frame;

[0012] S1.2: Use the 1*20 dimensional vector as the input of the SVM classifier and use the SVM classifier to determine the category to which the video frame belongs.

[0013] Furthermore, the categories of video frames include: static frames when the background is fixed, which include two types, one is when the characters in the scene have small movements, and the other is when the characters have large movements; dynamic frames when the camera follows the scene; dynamic frames of the video screen switching type.

[0014] Furthermore, in step S3, the process of generating a grayscale image as a heat weight for the input content includes the following steps:

[0015] S3.1: According to the scene category of step S2, different network models are selected to extract network feature maps. For outdoor scenes, LSTM network is selected as the scene classification network to focus on outdoor key areas, and YOLOv5 network model is selected for indoor scenes to focus on indoor specific targets.

[0016] S3.2: Preprocess the input image array data, convert it into a tensor format, upgrade the tensor according to the required dimension of the selected network model, and input the upgraded tensor into the selected network model;

[0017] S3.3: Select the last convolutional layer of the network backbone of the scene classification network or the last layer of the detection layer of the YOLOv5 network model as the target extraction layer; input the preprocessed image array data into the scene classification network or YOLOv5 network model in with torch.no_grad(), and use the hook function to obtain the output tensor of the target extraction layer;

[0018] S3.4: Convert the output tensor of the target extraction layer into a three-dimensional array and reduce its dimension to obtain a three-dimensional array. Process the three-dimensional array so that the values ​​are in the range of 0-255. Convert the processed three-dimensional array into unit8 format and process it through a pseudo-color function to obtain a corresponding heat map. The warm color area indicates that the selected network model pays high attention to this area.

[0019] S3.5: Determine whether the key focus object label is detected, and perform weighted enhancement on the area where the key focus object is located according to the confidence of the key focus object to obtain the final heat weight.

[0020] Furthermore, in step S4, the process of obtaining the area with the largest weight as the center point of the intercepted part by using the result obtained by multiplying the heat map with the weighted matrix includes the following steps:

[0021] For static frames, the weight matrix of the heat map itself and the frame difference is used to calculate the area with the largest weight, and the update frequency is maintained at 0.5 seconds;

[0022] For dynamic frames, a progressive weight matrix is ​​created, and the heat map is multiplied by the progressive weight matrix to obtain the area with the largest weight; among them, the value of the middle column of the progressive weight matrix is ​​2, and gradually decreases to 1 from the middle to both sides.

[0023] Furthermore, in step S5, the process of cropping the video frame according to the calculated center point coordinates and displaying the processed vertical screen image on the front end includes the following steps:

[0024] S5.1: cropping the video frame according to the calculated coordinates of the intercepted part, cropping it into a ratio of 3:4 and pushing it to the nginx video streaming server in the form of rtmp stream;

[0025] S5.2: The front end pulls the rtmp stream from the nginx server and plays it on the front end in the form of a flv file.

[0026] Beneficial effects:

[0027] The present invention discloses a video key area analysis method based on a frame difference convolutional neural network, which uses a support vector machine (SVM) to accurately classify video frames. After the video frame classification is completed, a heat map is calculated, and the heat map is combined with a progressive weight matrix according to different categories to determine the area with the largest value change as the center point of the cropped video, and the video is intercepted with an aspect ratio of 4:3. The present invention can accurately perform intelligent cropping of horizontal screen videos to achieve the purpose of adapting to the vertical screen of mobile phones. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] Figure 1 It is a flow chart of the video key area analysis method based on frame difference convolutional neural network of the present invention;

[0029] Figure 2 Schematic diagram of video frame processing steps of the present invention. DETAILED DESCRIPTION

[0030] The following examples will enable those skilled in the art to more fully understand the present invention, but are not intended to limit the present invention in any way.

[0031] See also Figure 1 The present invention discloses a video key area analysis method based on a frame difference convolutional neural network, and the video key area analysis method comprises the following steps:

[0032] S1: Perform frame difference processing on the input continuous video frames, classify each video frame using the SVM classifier, and determine the category to which the video frame belongs;

[0033] S2: A scene category recognition model is constructed based on a convolutional neural network and an LSTM network to mark the scene categories of video frames. Specifically, video frames of different categories are imported into the scene category recognition model, and the image features of the video frames are extracted using a convolutional neural network. The image feature time series is constructed according to the acquisition time of the video frames. The LSTM network is used to capture the dependency features in the image feature time series, and the scene category of the video frame is obtained according to the dependency features in the image feature time series.

[0034] S3: design a heat map extraction scheme according to the scene category obtained in step S2, and generate a grayscale map as a heat weight for the input image array data;

[0035] S4: According to the category to which the video frame determined in step S1 belongs, the result obtained by multiplying the heat map with the weighted matrix is ​​used to obtain the area with the largest weight as the center point of the intercepted part;

[0036] S5: cropping the video frame according to the calculated center point coordinates, and displaying the processed vertical screen image on the front end.

[0037] See also Figure 2 , the video key area analysis method specifically includes the following steps:

[0038] S1: Read the video frames from the program, use a queue with a capacity of 25 to store the video frames, and pass them to the background to calculate the coordinates every 5 frames. Each time the frame before a new frame is entered, the frame is dequeued to maintain the continuity of the video frame transmission. The obtained coordinates are assigned to the third frame for display, while keeping the window stable within 0.5s. Perform a convolution-like transformation on the video frame to determine the category to which the video frame belongs;

[0039] S2: According to different categories of video frames, they are passed into the CNN-LSTM deep learning model to mark the scene category of the video. This model is a deep learning model that combines convolutional neural network (CNN) and long short-term memory network (LSTM);

[0040] S3: According to the scene category obtained in step S2, a heat map extraction scheme is designed to generate a grayscale map of the input content as a heat weight;

[0041] S4: Use the heat map to multiply the weighted matrix to obtain the area with the largest frame difference;

[0042] S5: Front-end display optimization, the processed vertical screen image is displayed on the front-end to provide a better vertical screen viewing experience.

[0043] The classification of the video frames in step S1 specifically includes the following steps:

[0044] S1.1: First, grayscale each frame and convert it into a grayscale image. Calculate the frame difference between adjacent input frames to obtain a difference image, which represents the pixel difference between the current frame and the adjacent frame. Since video frames of different sizes may have different dimensions, in order to perform unified processing, the frame difference image is compressed into an array of fixed dimensions. The compressed frame difference array is processed and converted into a 1*20-dimensional vector with the same dimension to ensure the consistency of subsequent processing.

[0045] S1.2: Use the 1*20 dimensional vector obtained above as input and use the support vector machine (SVM) classifier to classify the video frames. The video frames are divided into four categories:

[0046] The first category is that the characters in the scene have small movements and the background is fixed.

[0047] The second category is the scene where the camera follows.

[0048] The third type is the video screen switching type.

[0049] The fourth category is that the characters in the scene move significantly and the background is fixed.

[0050] The first and fourth types have fixed backgrounds and are defined as static frames. The second and third types have switching backgrounds and are defined as dynamic frames.

[0051] Support Vector Machine (SVM) is a commonly used classification algorithm. Its basic idea is to map data into a high-dimensional feature space and find an optimal hyperplane in the space so that samples of different categories can be separated as much as possible. SVM determines the optimal hyperplane by finding support vectors (sample points on the hyperplane) and uses these support vectors for classification. It performs well in high-dimensional feature spaces. SVM can still maintain good classification performance when processing a small number of support vectors and has high efficiency for large-scale data sets.

[0052] According to the classification results, different types of video frames are passed to the corresponding processing program for subsequent processing.

[0053] Step S2 uses the CNN-LSTM model to classify video scenes, which specifically includes the following steps:

[0054] The scene category recognition model of the present invention adopts the CNN-LSTM model, which is a deep learning model that combines a convolutional neural network (CNN) and a long short-term memory network (LSTM). Related research results show that convolutional neural networks (CNN) are a special type of artificial neural network, which is different from other neural network models, and its most important feature is the convolution operation. Therefore, CNN is excellent in many field applications, especially in image-related tasks, such as computer vision problems such as image classification, image retrieval, and object detection. Long short-term memory network (LSTM) is a time-recurrent neural network. Fusion of convolutional neural network CNN and LSTM can be well used in this system for behavior detection. In the present invention, first, CNN is used to extract image features of video frames, and each video frame is used as an input of CNN to obtain corresponding feature representations. Then, these feature sequences are processed using the LSTM network to capture long-term dependencies in time series and achieve accurate classification of video scenes.

[0055] The thermal map extraction in step S3 specifically includes the following steps:

[0056] S3.1: According to the scene classification results of step S2, different network models are selected to extract network feature maps. According to experimental analysis, the network model selected for scene classification in outdoor scenes can better focus on outdoor key areas, and the YOLOv5 network model selected for indoor scenes can better focus on specific targets;

[0057] S3.2: Preprocess the input image array data and convert it into tensor format for input into the network model; Upgrade the tensor according to the required dimension of the network input. The scene classification network input requires a 5-dimensional tensor, and the YOLOv5 model input requires a 4-dimensional tensor; Load the data onto the corresponding computing resources according to the machine type;

[0058] S3.3: Select the target extraction layer of the corresponding network model. The scene classification network extracts the features of the last convolutional layer of the network backbone, and the YOLOv5 model extracts the features of the last layer of the detection layer. In with torch.no_grad(), the preprocessed data is input to the network model to prevent the automatic derivation mechanism from continuously tracking tensors to save resources and improve program efficiency. The hook function is used to obtain the output of the network target layer.

[0059] S3.4: Convert the output tensor of the target layer to a three-dimensional array and reduce the dimension. Process the array so that the value is in the range of 0-255, convert it to unit8 format and process it through a pseudo-color function to get the heat map of the target layer of the network model. The warm color area represents that the network model pays high attention to this area. The heat map can intuitively show the difference of data through the change of color depth. It is a statistical chart that displays data by coloring color blocks. When drawing, you need to specify the color mapping rules. For example, larger values ​​are represented by darker colors, smaller values ​​are represented by lighter colors; larger values ​​are represented by warmer colors, smaller values ​​are represented by cooler colors, and so on.

[0060] S3.5: Determine whether a key focus object label is detected, such as focusing on balls and human bodies in sports game application scenarios, and weight the area where the key focus object is located according to the confidence of the object to obtain the final heat weight.

[0061] The calculation of the maximum frame difference area in step S4 specifically includes the following steps:

[0062] S4.1: For the first and fourth types of static frames, directly use the weight of the heat map itself to calculate the maximum area. Use the weight matrix of the heat map itself and the frame difference to calculate the area with the largest value, maintain the update frequency of 0.5 seconds, and reduce the jitter of the captured video window;

[0063] S4.2: For the second type of dynamic frames of the camera following, in general, the main content captured by the camera following video should be concentrated in the middle part. Create a progressive weight matrix: the value of the middle column of the matrix is ​​2, which gradually decreases to 1 from the middle to both sides, and multiply the heat map with this weight matrix.

[0064] Step S5: front-end display optimization specifically includes the following steps:

[0065] S5.1: Crop the video frame according to the calculated coordinates, crop it into a ratio of 3 to 4, and then push it to the nginx video streaming server in the form of rtmp stream.

[0066] S5.2: The front end pulls the rtmp stream from the nginx server and plays it on the front end in the form of a flv file.

[0067] The present invention first uses support vector machines (SVM) technology to classify video frames, and its basic model is a linear classifier with the largest interval defined in feature space. After the video frames are classified, different processing methods are adopted for different frames. All categories of frames are first classified into scene categories using a convolutional neural network (CNN)-long short-term memory network (LSTM) model, and then the category labels obtained by scene classification are used to design a heat map (also known as a correlation coefficient map. The size of the correlation coefficient corresponding to the different block colors in the heat map can determine the size of the correlation between variables) extraction scheme for deep learning, and a grayscale map is generated for the input content as a heat weight, and then the area with the largest weight is selected to intercept. The video is cropped accurately, and finally the key part of the cropped video screen is displayed on the front end. The method can be applied to fields such as mobile devices, video editing software, and social media platforms to provide a better vertical screen viewing experience.

[0068] The above are only preferred embodiments of the present invention, and the protection scope of the present invention is not limited to the above embodiments. All technical solutions under the concept of the present invention belong to the protection scope of the present invention. It should be pointed out that for ordinary technicians in this technical field, some improvements and modifications without departing from the principle of the present invention should be regarded as the protection scope of the present invention.

Claims

1. A video key area analysis method based on frame difference convolutional neural network, characterized in that: The video key area analysis method comprises the following steps: S1: Perform frame difference processing on the input continuous video frames, classify each video frame using the SVM classifier, and determine the category to which the video frame belongs; S2: A scene category recognition model is constructed based on a convolutional neural network and an LSTM network to mark the scene categories of video frames. Specifically, video frames of different categories are imported into the scene category recognition model, and the image features of the video frames are extracted using a convolutional neural network. The image feature time series is constructed according to the acquisition time of the video frames. The LSTM network is used to capture the dependency features in the image feature time series, and the scene category of the video frame is obtained according to the dependency features in the image feature time series. S3: design a heat map extraction scheme according to the scene category obtained in step S2, and generate a grayscale map as a heat weight for the input image array data; S4: According to the category to which the video frame determined in step S1 belongs, a result obtained by multiplying the heat map with the weighted matrix is ​​used to perform vertical projection and obtain the point with the maximum value as the coordinate value of the intercepted part; S5: cropping the video frame according to the calculated center point coordinates, and displaying the processed vertical screen image on the front end.

2. The video key area analysis method based on frame difference convolutional neural network according to claim 1 is characterized in that: In step S1, the process of classifying each video frame using the SVM classifier includes the following steps: S1.1: Convert the video frames read into the program to grayscale and calculate the frame difference between adjacent input frames; compress the frame difference into a 1*w dimensional array, and then process the 1*w dimensional array into a 1*20 dimensional vector with the same dimension, where w is the width of the input video frame; S1.2: Use the 1*20 dimensional vector as the input of the SVM classifier and use the SVM classifier to determine the category to which the video frame belongs.

3. The video key area analysis method based on frame difference convolutional neural network according to claim 1 is characterized in that: The categories of video frames include: static frames when the background is fixed. There are two types of static frames, one is small movements of people in the scene, and the other is large movements of people; dynamic frames when the camera follows the scene; dynamic frames of the video screen switching type.

4. The video key area analysis method based on frame difference convolutional neural network according to claim 1 is characterized in that: In step S3, the process of generating a grayscale image as a heat weight for the input content includes the following steps: S3.1: According to the scene category of step S2, different network models are selected to extract network feature maps. For outdoor scenes, LSTM network is selected as the scene classification network to focus on outdoor key areas, and YOLOv5 network model is selected for indoor scenes to focus on indoor specific targets. S3.2: Preprocess the input image array data, convert it into a tensor format, upgrade the tensor according to the required dimension of the selected network model, and input the upgraded tensor into the selected network model; S3.3: Select the last convolutional layer of the network backbone of the scene classification network or the last layer of the detection layer of the YOLOv5 network model as the target extraction layer; input the preprocessed image array data into the scene classification network or YOLOv5 network model in with torch.no_grad(), and use the hook function to obtain the output tensor of the target extraction layer; S3.4: Convert the output tensor of the target extraction layer into a three-dimensional array and reduce its dimension to obtain a three-dimensional array. Process the three-dimensional array so that the values ​​are in the range of 0-255. Convert the processed three-dimensional array into unit8 format and process it through a pseudo-color function to obtain a corresponding heat map. The warm color area indicates that the selected network model pays high attention to this area. S3.5: Determine whether the key focus object label is detected, and perform weighted enhancement on the area where the key focus object is located according to the confidence of the key focus object to obtain the final heat weight.

5. The video key area analysis method based on frame difference convolutional neural network according to claim 1 is characterized in that: In step S4, the process of obtaining the area with the largest weight as the intercepted part by using the result obtained by multiplying the heat map with the weighted matrix includes the following steps: For static frames, the weight matrix of the heat map itself and the frame difference is used to calculate the area with the largest weight, and the update frequency is maintained at 0.5 seconds; For dynamic frames, a progressive weight matrix is ​​created, and the heat map is multiplied by the progressive weight matrix to obtain the area with the largest weight; among them, the value of the middle column of the progressive weight matrix is ​​2, and gradually decreases to 1 from the middle to both sides.

6. The video key area analysis method based on frame difference convolutional neural network according to claim 1 is characterized in that: In step S5, the process of cropping the video frame according to the calculated center point coordinates and displaying the processed vertical screen image on the front end includes the following steps: S5.1: cropping the video frame according to the calculated coordinates of the intercepted part, cropping it into a ratio of 3:4 and pushing it to the nginx video streaming server in the form of rtmp stream; S5.2: The front end pulls the rtmp stream from the nginx server and plays it on the front end in the form of a flv file.

Citation Information

Cited By

  • Three-dimensional light field display optimization method and system, electronic equipment and storage medium

    CN119383325A

  • Scene multi-target video coding method

    CN120812411A