A video background removal method, system, device and storage medium
Through multi-class support vector machine models and automatic background learning update rules, combined with YUV and HSI color spaces, it solves the problems of large calculation amount and slow processing speed of video background elimination in the existing technology, and achieves fast video background elimination with good effect. A robust solution.
Patent Information
- Application Number
- CN202410055542.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-12
- Publication Date
- 2024-10-11
- Estimated Expiration
- 2044-01-12
AI Technical Summary
Existing video background elimination technology suffers from the problems of large amount of calculation and slow processing speed. Especially when faced with lighting changes, human shadows, background object redistribution, camouflage, non-static backgrounds and rapidly changing backgrounds, it is difficult to effectively distinguish the foreground and background.
A multi-class support vector machine model is used, combined with YUV and HSI color spaces, to classify pixels through distance measurement and threshold judgment, build automatic background learning update rules, and use pre-trained images and morphological techniques to enhance the segmentation effect.
The video background elimination is fast, effective and robust, significantly better than traditional algorithms, and can effectively handle video background elimination tasks in complex environments.
Smart Images

Figure CN118038310B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of background elimination, and more specifically, to a video background elimination method, system, device and storage medium. Background Art
[0002] Video-based computer vision applications first need to detect moving objects and then use background subtraction techniques to separate the background and foreground, such as Figure 1 As shown in the figure, background removal technology is a commonly used video target detection preprocessing method. It uses a static camera to generate one or more foreground masks containing pixel information of objects in the video, and performs subtraction calculation on the current frame and the foreground mask to extract the moving objects in the video. The changes in indoor and outdoor environments bring the following difficulties to the background removal technology:
[0003] (1) Changes in lighting. As light changes over time, pixel values in the RGB color space may change dramatically; changes in lighting may be confused with moving objects.
[0004] (2) Human shadows. When a walking person appears in the picture, it is usually accompanied by shadows, including self-shadows and projected shadows, which lead to changes in local illumination.
[0005] (3) Background object reallocation,When background objects are located in real scenes, e.g., a trash can that is considered as part of the reference image in background modeling is removed from the image or reallocated elsewhere, the region where the trash can was originally located may be mistaken for a moving object.
[0006] (4) Camouflage: The similarity between the colors of moving objects and background increases the difficulty of distinguishing them from each other. For example, when a walking person wearing black clothes appears in a dark outdoor environment, it is difficult to obtain satisfactory results due to the similarity of pixel values.
[0007] (5) Non-static backgrounds: Dynamic backgrounds such as trees in the wind, computer display monitors, and running fans are difficult to model using simple statistics.
[0008] (6) Rapid background changes. When the background changes at a high frequency, the background model cannot adapt quickly, resulting in misclassification.
[0009] The existing background removal technology algorithm classification method can be summarized as follows:
[0010] (1) Based on mathematical concepts, it can be divided into statistical models, fuzzy models and Dempster-schafer models.
[0011] (2) Based on the concept of machine learning, it can be divided into reconstruction, discriminant and hybrid subspace learning models, matrix decomposition or tensor decomposition subspace learning, support vector machine, neural network and deep learning.
[0012] (3) According to the signal processing model classification, it can be divided into Wiener filter, Kalman filter, entropy filter and Chebychev filter.
[0013] (4) Clustering algorithm for classification model.
[0014] Statistics, fuzzy and Dempster-Schafer models allow dealing with challenges brought by imprecise, uncertain and incomplete data, machine learning concepts allow learning background pixel representations in a supervised or unsupervised manner, signal processing models allow estimating background values, and classification models attempt to classify pixels as background or foreground. However, existing background removal techniques all suffer from large computational complexity and slow processing speed. Summary of the invention
[0015] The technical problem to be solved by the present invention is to address the above-mentioned deficiencies in the prior art. The first object of the present invention is to provide a video background removal method with fast processing speed, good effect and strong robustness.
[0016] The second purpose of the present invention is to provide a video background removal system with fast processing speed, good effect and strong robustness.
[0017] A third object of the present invention is to provide a computer device.
[0018] A fourth objective of the present invention is to provide a computer storage medium.
[0019] In order to achieve the above-mentioned purpose 1, the present invention provides a video background removal method, comprising the following steps:
[0020] Step 1. Build a multi-class support vector machine model;
[0021] Step 2. constructing a color model for training the multi-class support vector machine model;
[0022] By combining the YUV color space and the HSI color space, which can separate color information from brightness, and using four parameters, Y, U, V, and H, to represent a pixel, the color model is as follows:
[0023]
[0024]
[0025] Y = 0.299R + 0.587G + 0.114B;
[0026] U = -0.147R - 0.289G + 0.436B;
[0027] V = 0.615R-0.515G-0.1B;
[0028] In the t-th frame image, the change of chromaticity U and V between the ith pixel and the n-th class of background B is measured by the distance D(n):
[0029]
[0030] Among them, B(U, n) and B(V, n) represent the values of U and V in the nth class of background B respectively;
[0031] If the value of D(n) is within the threshold TH D If the threshold is the global threshold for all images, it is defined as the matching class; D(n) can be adjusted to control the probability of false detection. Once a matching class is found, H and Y will be used as two subsequent conditions for the final decision: First, according to the characteristics of H, when a new object appears at the corresponding position, the change in H value is greater than a threshold TH H ; Secondly, according to the characteristics of Y, when the change of Y is less than the threshold TH Y , the pixel is a reliable background. Therefore, to classify a new pixel as background, the following criteria need to be met:
[0032] D(n)≤TH D ;
[0033] H≤TH H ;
[0034] Y≤TH Y ;
[0035] where TH D , TH H and TH Y They are all experience points;
[0036] Step 3. Determine the criteria for class attribution judgment of the multi-class support vector machine model;
[0037] Separate (U, V) into U and V, and treat U and V as two independent features; u and v are the values of U and V respectively. When processing the data of u, (u+TH D ) and (u-TH D ) are regarded as the characteristics of a class, and their boundaries (u+TH D +c) and (u-TH D -c) are considered as features within the background range; values outside this range are considered as foreground features;
[0038] When processing v's data, (v+THD ) and (v-TH D ) are regarded as the characteristics of a class, and their boundaries (v+TH D +c) and (v-TH D -c) features that are considered to be within the background;
[0039] When the pixel values u and v belong to the same class, the pixel is considered as background, otherwise it is considered as foreground;
[0040] Step 4. Construct automatic background learning update rules;
[0041] Automatic background learning updates are achieved through two steps: retraining data and updating the weights of each class;
[0042] The retraining data is as follows: new , v new ) is the center of the new class, (u c , v c ) is the center of the class closest to the center of the new class, D(new) is the radius of the new class, and D(C) is the radius of the class closest to the center of the new class; u new and v new The value of is calculated independently, u new The value of is determined according to the following rules:
[0043] If u new to u c The distance is greater than 2TH D , then u new The value of TH D ;
[0044] If u new to u c The distance is greater than D(C) but less than 2TH D , then u new The value of |u new -u c |-D(C)-2c;
[0045] If u new to u c If the distance is less than D(C), then u new The value of is set to D(C);
[0046] v new The value of is determined according to the following rules:
[0047] If v new to v c The distance is greater than 2TH D , then v new The value of TH D ;
[0048] If v new to v c The distance is greater than D(C) but less than 2TH D , then v new The value of |v new -v c |-D(C)-2c;
[0049] If v new to v c If the distance is less than D(C), then v new The value of is set to D(C);
[0050] Update the weight of each class as follows: In the t-th frame image, the weight ω of the n-th class of the i-th pixel background n,i,t The update function can be expressed as:
[0051]
[0052] Among them, N i is the number of classes in the background of the i-th pixel, α is the update rate, and when the class matches, M n,i,t is 1, and the rest are 0. c (x) is the decision function,
[0053]
[0054] ω n,i,t By c (x) determines that the value range is less than 1;
[0055] Step 5. Obtain a pre-training image, and use the pre-training image to input the multi-class support vector machine model to learn the training background image;
[0056] Step 6. Obtain the image to be segmented, use the trained multi-class support vector machine model to perform foreground segmentation on the image to be segmented, and output the segmented image.
[0057] As a further improvement, in step 3, c is set to 0.01.
[0058] Furthermore, step 5 includes:
[0059] Step 51. Obtain the color information (u, v, y, h) of each pixel in the pre-trained image and store it;
[0060] Step 52: Input the stored data into the multi-class support vector machine model for training, and obtain the weight ω of each pixel of the image n,i,t ;
[0061] Step 53. After the training of the pre-trained image is completed, the prediction classification of the image data is started. When a new video image is obtained, the data of each pixel point is sequentially put into the trained multi-class support vector machine model to determine the class attribution, and determine whether the pixel point belongs to the background or the foreground;
[0062] If it belongs to the background, skip it and do not process it;
[0063] If it belongs to the foreground, the data needs to be stored in the current pixel point, and all the data of the current pixel point needs to be retrained. The data of the model is updated, and the pixel information of the newly added background obtains new weight initialization information ω n+1,i,t .
[0064] Furthermore, the step 6 includes:
[0065] Step 61. After acquiring a new frame of video image, the data of each pixel point is sequentially put into the multi-class support vector machine model to perform class attribution judgment to determine whether the pixel point belongs to the background or the foreground;
[0066] If it belongs to the background, perform automatic background learning update according to step 4 and set the weight ω of the background pixel n,i,t Make updates and save;
[0067] If it belongs to the foreground, mark it as foreground;
[0068] Step 62: After the background of the entire image is eliminated, the segmentation result is enhanced by using morphological techniques;
[0069] Step 63. The newly acquired images are continuously processed and output in a loop according to steps 61 to 62.
[0070] Furthermore, the pre-training image is a part of the image to be segmented.
[0071] In order to achieve the above-mentioned second objective, the present invention provides a video background removal system, comprising:
[0072] Model building module, used to build multi-class support vector machine models;
[0073] A color module, used for constructing a color model for training the multi-class support vector machine model;
[0074] A class-attribution judgment module, used to determine the class-attribution judgment criteria of the multi-class support vector machine model;
[0075] Learning module, used to build automatic background learning update rules;
[0076] A pre-training module, used to obtain a pre-training image, and use the pre-training image to input the multi-class support vector machine model to learn a training background image;
[0077] The segmentation module is used to obtain the image to be segmented, use the trained multi-class support vector machine model to perform foreground segmentation on the image to be segmented, and output the segmented image.
[0078] In order to achieve the third objective above, the present invention provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the above-mentioned video background removal method when executing the computer program.
[0079] In order to achieve the fourth objective above, the present invention provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the above-mentioned video background removal method is implemented.
[0080] Beneficial Effects
[0081] Compared with the prior art, the present invention has the following advantages:
[0082] The background elimination algorithm of the present invention is based on a multi-class support vector machine and can realize the function of extracting a binary image of a moving background. The speed and effect performance are both better than those of traditional algorithms and show strong robustness. BRIEF DESCRIPTION OF THE DRAWINGS
[0083] Figure 1 This is a schematic diagram of background elimination;
[0084] Figure 2 is a flow chart of the learning and training process of the background image in the present invention;
[0085] Figure 3 is a flow chart of the segmentation process of the background image in the present invention;
[0086] Figure 4 This is the effect diagram of the image segmentation of the present invention. DETAILED DESCRIPTION
[0087] The present invention will be further described below with reference to the specific embodiments in the accompanying drawings.
[0088] Support Vector Machine (SVM) is a commonly used data classification method in machine learning. They were originally designed for two different kinds of data classification. In order to classify data belonging to multiple classes, support vector machines are extended to multi-class support vector machines, which use a decision function that represents the probability of the test data in that class to determine a single class. The decision function f(x) is expressed as:
[0089]
[0090]
[0091] Where X i represents the training set data, α i represents the Lagrange multiplier, y i ∈{1, -1}, b represents the deviation value, K(X i , x) represents the kernel function.
[0092] There are three basic methods for multi-class support vector machines: one-to-one, one-to-many, and DAGSVM. In the one-to-one multi-class support vector machine method, each class is trained together with another class in a cycle, and k(k-1) / 2 classifiers are constructed. For the training data of the i-th and j-th classes, in order to maximize the classification interval, it is necessary to optimize the objective function so that Minimize, the objective function is expressed as:
[0093]
[0094] where ξ ≥ 0 is the slack variable, C ≥ 0 is the penalty parameter, ω is the normal vector, and b is the bias variable.
[0095] One-to-one multi-class support vector machines are more practical in solving practical problems, so the technical solution of the present invention is a method based on one-to-one multi-class support vector machines.
[0096] For details, see Figure 2 to Figure 4 The present invention provides a video background elimination method, comprising the following steps 1 to 6:
[0097] Step 1. Build a multi-class support vector machine model, that is, build a multi-class support vector machine model based on one-to-one.
[0098] Step 2. Build a color model for training a multi-class support vector machine model.
[0099] The color model plays a vital role in the background removal algorithm. A well-performing color model should be insensitive to noise and be able to distinguish the difference between the current pixel and the background. On the one hand, the RGB color model is too sensitive to noise and changes in lighting conditions. On the other hand, due to its sensitivity, it can easily distinguish the difference between the current pixel and the background. The present invention selects to combine the YUV color space and the HSI color space that can separate color information from brightness, and uses four parameters Y, U, V, and H to represent a pixel. Y, U, and V represent brightness and color difference in the YUV color space, and H represents the hue of the HSI color space. The color model is as follows:
[0100]
[0101]
[0102] Y = 0.299R + 0.587G + 0.114B;
[0103] U = -0.147R - 0.289G + 0.436B;
[0104] V = 0.615R-0.515G-0.1B.
[0105] In multi-class SVM, both U and V have color information for training and prediction. In the t-th frame image, the change of chromaticity U and V at the i-th pixel and the n-th class of background B is measured by the distance D(n):
[0106]
[0107] Among them, B(U, n) and B(V, n) represent the values of U and V in the nth class of the background B respectively.
[0108] If the value of D(n) is within the threshold TH D If the threshold is the global threshold for all images, it is defined as the matching class. D(n) can be adjusted to control the probability of false detection. Once a matching class is found, H and Y are used as two subsequent conditions for the final decision: First, for the characteristics of H, when a new object appears at the corresponding position, the change in H value is greater than a threshold TH. H ; Secondly, according to the characteristics of Y, when the change of Y is less than the threshold TH Y , the pixel is a reliable background. Therefore, to classify a new pixel as background, the following criteria need to be met:
[0109] D(n)≤TH D ;
[0110] H≤TH H ;
[0111] Y≤TH Y ;
[0112] where TH D , TH H and TH Y They are all experience points.
[0113] Step 3. Determine the criteria for class attribution judgment of the multi-class support vector machine model.
[0114] In order to reduce the computational complexity, the present invention separates (U, V) into U and V, and regards U and V as two independent features; for example, u and v are the values of U and V respectively. When processing the data of u, (u+THD ) and (u-TH D ) are regarded as the characteristics of a class, and their boundaries (u+TH D +c) and (u-TH D -c) are considered as background features, where c is set to 0.01; values outside this range are considered as foreground features.
[0115] Similarly, when processing the data of v, (v+TH D ) and (v-TH D ) are regarded as the characteristics of a class, and their boundaries (v+TH D +c) and (v-TH D -c) are considered as features within the background range, where c is set to 0.01.
[0116] After training the data, when a new pixel value (u, v, y, h) is observed, the multi-class support vector machine model will output two predictions about u and v. Only when the observed pixel values u and v belong to the same class, the pixel is considered as background, otherwise it is considered as foreground.
[0117] Step 4. Construct automatic background learning update rules.
[0118] Automatic background learning and updating enables the algorithm to intelligently adapt to changes in ambient light and the problem of foreground object reallocation. In the present invention, automatic background learning and updating is achieved through the two steps of retraining data and updating the weight of each class.
[0119] In order to avoid the intersection of two classes leading to wrong decisions on the class in the class prediction step, a simple mechanism can be adopted. The retraining data is specifically defined as follows: new , v new ) is the center of the new class, (u c , v c ) is the center of the class closest to the center of the new class, D(new) is the radius of the new class, and D(C) is the radius of the class closest to the center of the new class. new and v new The value of is calculated independently, u new The value of is determined according to the following rules:
[0120] If u new to u c The distance is greater than 2TH D , then u new The value of TH D ;
[0121] If u new to u c The distance is greater than D(C) but less than 2THD , then u new The value of |u new -u c |-D(C)-2c;
[0122] If u new to u c If the distance is less than D(C), then u new The value of is set to D(C).
[0123] Similarly, v new The value of is determined according to the following rules:
[0124] If v new to v c The distance is greater than 2TH D , then v new The value of TH D ;
[0125] If v new to v c The distance is greater than D(C) but less than 2TH D , then v new The value of |v new -v c |-D(C)-2c;
[0126] If v new to v c If the distance is less than D(C), then v new The value of is set to D(C).
[0127] Another key step in automatic background learning is to update the weight of each class, which describes the supporting evidence of the class belonging to the background. The weight of each class is updated as follows: In the t-th frame image, the weight ω of the n-th class of the i-th pixel background n,i,t The update function can be expressed as:
[0128]
[0129] Among them, N i is the number of classes in the background of the i-th pixel, α is the update rate, and when the class matches, M n,i,t is 1, and the rest are 0. c (x) is the decision function,
[0130]
[0131] ω n,i,t By c (x) determines the value range, which is less than 1. The weight update function allows the class to learn at an appropriate speed and slowly eliminates the class whose pixels are stored in the background image.
[0132] Step 5. Obtain pre-training images and use the pre-training images to input a multi-class support vector machine model to learn the training background image.
[0133] Step 6. Obtain the image to be segmented, use the trained multi-class support vector machine model to perform foreground segmentation on the image to be segmented, and output the segmented image.
[0134] The purpose of step 5 is to learn the background and initialize the parameters, such as Figure 2 As shown, step 5 includes:
[0135] Step 51. After acquiring the video image, determine whether it is a pre-trained image. If it is a pre-trained image, obtain the color information (u, v, y, h) of each pixel in the pre-trained image and store it;
[0136] Step 52: Input the stored data into the multi-class support vector machine model for training, and obtain the weight ω of each pixel in the image n,i,t ;
[0137] Step 53. After completing the training of the pre-trained image, the prediction classification of the image data begins. When a new video image is acquired, the data of each pixel point is sequentially put into the trained multi-class support vector machine model for class attribution judgment to determine whether the pixel point belongs to the background or the foreground. The judgment condition is based on the attribution judgment standard in step 3.
[0138] If it belongs to the background, skip it and do not process it;
[0139] If it belongs to the foreground, the data needs to be stored in the current pixel point, and all the data of the current pixel point needs to be retrained. The data of the model is updated, and the pixel information of the newly added background obtains new weight initialization information ω n+1,i,t .
[0140] Foreground segmentation is divided into two stages, such as Figure 3 As shown, it mainly involves the classification of background and foreground and the implementation of automatic background learning update. Step 6 includes:
[0141] Step 61. After acquiring a new frame of video image, the data of each pixel point is sequentially put into the multi-class support vector machine model to perform class attribution judgment to determine whether the pixel point belongs to the background or the foreground; the judgment condition is based on the attribution judgment standard in step 3;
[0142] If it belongs to the background, perform automatic background learning update according to step 4 and set the weight ω of the background pixel n,i,t Make updates and save;
[0143] If it belongs to the foreground, mark it as foreground;
[0144] Step 62: After the background of the entire image is eliminated, the segmentation result is enhanced by using morphological techniques;
[0145] Step 63. The newly acquired image is continuously processed and output according to steps 61 to 62. The final effect is as shown in the figure below. Figure 4 shown.
[0146] The pre-training image may be a part of the image to be segmented, for example, the pre-training image may be a segment of the image at the beginning of the image to be segmented.
[0147] A video background removal system, comprising:
[0148] Model building module, used to build multi-class support vector machine models;
[0149] Color module, used to build color models for training multi-class support vector machine models;
[0150] The attribution judgment module is used to determine the criteria for class attribution judgment of the multi-class support vector machine model;
[0151] Learning module, used to build automatic background learning update rules;
[0152] A pre-training module, used to obtain pre-training images and use the pre-training images to input a multi-class support vector machine model to learn a training background image;
[0153] The segmentation module is used to obtain the image to be segmented, use the trained multi-class support vector machine model to perform foreground segmentation on the image to be segmented, and output the segmented image.
[0154] A computer device comprises a memory and a processor. The memory stores a computer program. When the processor executes the computer program, the above-mentioned video background elimination method is implemented.
[0155] A computer-readable storage medium stores a computer program, which implements the above-mentioned video background removal method when executed by a processor.
[0156] The above are only preferred embodiments of the present invention. It should be pointed out that for those skilled in the art, several modifications and improvements can be made without departing from the structure of the present invention, which will not affect the effect of the implementation of the present invention and the practicality of the patent.
Claims
1. A video background removal method, characterized in that: The following steps are involved: Step 1. Build a multi-class support vector machine model; Step 2. constructing a color model for training the multi-class support vector machine model; By combining the YUV color space and the HSI color space, which can separate color information from brightness, and using four parameters, Y, U, V, and H, to represent a pixel, the color model is as follows: Y = 0.299R + 0.587G + 0.114B; U = -0.147R - 0.289G + 0.436B; V = 0.615R-0.515G-0.1B; In the t-th frame image, the change of chromaticity U and V between the ith pixel and the n-th class of background B is measured by the distance D(n): Among them, B(U,n) and B(V,n) represent the values of U and V in the nth class of background B respectively; If the value of D(n) is within the threshold TH D If the threshold is the global threshold for all images, it is defined as the matching class; D(n) can be adjusted to control the probability of false detection. Once a matching class is found, H and Y will be used as two subsequent conditions for the final decision: First, according to the characteristics of H, when a new object appears at the corresponding position, the change in H value is greater than a threshold TH H ; Secondly, according to the characteristics of Y, when the change of Y is less than the threshold TH Y , the pixel is a reliable background; therefore, the following criteria need to be met to classify a new pixel as background: D(n)≤TH D ; H≤TH H ; Y≤TH Y ; where TH D , TH H and TH Y They are all experience points; Step 3. Determine the criteria for class attribution judgment of the multi-class support vector machine model; Separate (U, V) into U and V, and treat U and V as two independent features; u and v are the values of U and V respectively. When processing the data of u, (u+TH D ) and (u-TH D ) are regarded as the characteristics of a class, and their boundaries (u+TH D +c) and (u-TH D -c) are considered as features within the background range; values outside this range are considered as foreground features; When processing the data of v, (v+TH D ) and (v-TH D ) are regarded as the characteristics of a class, and their boundaries (v+TH D +c) and (v-TH D -c) features that are considered to be within the background; When the pixel values u and v belong to the same class, the pixel is considered as background, otherwise it is considered as foreground; Step 4. Construct automatic background learning update rules; Automatic background learning updates are achieved through two steps: retraining data and updating the weights of each class; The retraining data is as follows: new , v new ) is the center of the new class, (u c , v c ) is the center of the class closest to the center of the new class, D(new) is the radius of the new class, and D(C) is the radius of the class closest to the center of the new class; u new and v new The value of is calculated independently, u new The value of is determined according to the following rules: If u new to u c The distance is greater than 2TH D , then u new The value of TH D ; If u new to u c The distance is greater than D(C) but less than 2TH D , then u new The value of |u new -u c |-D(C)-2c; If u new to u c If the distance is less than D(C), then u new The value of is set to D(C); v new The value of is determined according to the following rules: If v new to v c The distance is greater than 2TH D , then v new The value of TH D ; If v new to v c The distance is greater than D(C) but less than 2TH D , then v new The value of |v new -v c |-D(C)-2c; If v new to v c If the distance is less than D(C), then v new The value of is set to D(C); Update the weight of each class as follows: In the t-th frame image, the weight ω of the n-th class of the i-th pixel background n,i,t The update function can be expressed as: Among them, N i is the number of classes in the background of the i-th pixel, α is the update rate, and when the class matches, M n,i,t is 1, and the rest are 0. c (x) is the decision function, ω n,i,t By c (x) determines that the value range is less than 1; Step 5. Obtain a pre-training image, and use the pre-training image to input the multi-class support vector machine model to learn the training background image; Step 6. Obtain the image to be segmented, use the trained multi-class support vector machine model to perform foreground segmentation on the image to be segmented, and output the segmented image.
2. A video background removal method according to claim 1, characterized in that: In step 3, set c to 0.
01.
3. A video background removal method according to claim 1, characterized in that: In step 5 include: Step 51. Obtain the color information (u, v, y, h) of each pixel in the pre-trained image and store it; Step 52: Input the stored data into the multi-class support vector machine model for training, and obtain the weight ω of each pixel of the image n,i,t ; Step 53. After the training of the pre-trained image is completed, the prediction classification of the image data is started. When a new video image is obtained, the data of each pixel point is sequentially put into the trained multi-class support vector machine model to determine the class attribution, and determine whether the pixel point belongs to the background or the foreground; If it belongs to the background, skip it and do not process it; If it belongs to the foreground, the data needs to be stored in the current pixel point, and all the data of the current pixel point needs to be retrained. The data of the model is updated, and the pixel information of the newly added background obtains new weight initialization information ω n+1,i,t .
4. A video background removal method according to claim 1, characterized in that: The step 6 includes: Step 61. After acquiring a new frame of video image, the data of each pixel point is sequentially put into the multi-class support vector machine model to perform class attribution judgment to determine whether the pixel point belongs to the background or the foreground; If it belongs to the background, perform automatic background learning update according to step 4 and set the weight ω of the background pixel n,i,t Make updates and save; If it belongs to the foreground, mark it as foreground; Step 62: After the background of the entire image is eliminated, the segmentation result is enhanced by using morphological techniques; Step 63. The newly acquired images are continuously processed and output in a loop according to steps 61 to 62.
5. The method for removing background from a video according to claim 1, characterized in that: The pre-training image is a part of the image to be segmented.
6. A video background removal system, characterized in that: include: Model building module, used to build multi-class support vector machine models; The color module is used to construct a color model for training the multi-class support vector machine model; the YUV color space and the HSI color space that can separate color information from brightness are combined, and a pixel is represented by four parameters, Y, U, V, and H. The color model is as follows: Y = 0.299R + 0.587G + 0.114B; U = -0.147R - 0.289G + 0.436B; V = 0.615R-0.515G-0.1B; In the t-th frame image, the change of chromaticity U and V between the ith pixel and the n-th class of background B is measured by the distance D(n): Among them, B(U, n) and B(V, n) represent the values of U and V in the nth class of background B respectively; If the value of D(n) is within the threshold TH D If the threshold is the global threshold for all images, it is defined as the matching class; D(n) can be adjusted to control the probability of false detection. Once a matching class is found, H and Y will be used as two subsequent conditions for the final decision: First, according to the characteristics of H, when a new object appears at the corresponding position, the change in H value is greater than a threshold TH H ; Secondly, according to the characteristics of Y, when the change of Y is less than the threshold TH Y , the pixel is a reliable background; therefore, the following criteria need to be met to classify a new pixel as background: D(n)≤TH D ; H≤TH H ; Y≤TH Y ; where TH D , TH H and TH Y They are all experience points; The attribution judgment module is used to determine the criterion for class attribution judgment of the multi-class support vector machine model; separate (U, V) into U and V, and regard U and V as two independent features; u and v are the values of U and V respectively, when processing the data of u, (u+TH D ) and (u-TH D ) are regarded as the characteristics of a class, and their boundaries (u+TH D +c) and (u-TH D -c) are considered as features within the background range; values outside this range are considered as foreground features; When processing the data of v, (v+TH D ) and (v-TH D ) are regarded as the characteristics of a class, and their boundaries (v+TH D +c) and (v-TH D -C) features considered as background; When the pixel values u and v belong to the same class, the pixel is considered as background, otherwise it is considered as foreground; The learning module is used to construct automatic background learning update rules; automatic background learning update is achieved by retraining data and updating the weight of each class; The specific retraining data is: definition (u new , v new ) is the center of the new class, (u c , v c ) is the center of the class closest to the center of the new class, D(new) is the radius of the new class, and D(C) is the radius of the class closest to the center of the new class; u new and v new The value of is calculated independently, u new The value of is determined according to the following rules: If u new to u c The distance is greater than 2TH D , then u new The value of TH D ; If u new to u c The distance is greater than D(C) but less than 2TH D , then u new The value of |u new -u c |-D(C)-2c; If u new to u c If the distance is less than D(C), then u new The value of is set to D(C); v new The value of is determined according to the following rules: If v new to v c The distance is greater than 2TH D , then v new The value of TH D ; If v new to v c The distance is greater than D(C) but less than 2TH D , then v new The value of |v new -v c |-D(C)-2c; If v new to v c If the distance is less than D(C), then v new The value of is set to D(C); Update the weight of each class as follows: In the t-th frame image, the weight ω of the n-th class of the i-th pixel background n,i,t The update function can be expressed as: Among them, N i is the number of classes in the background of the i-th pixel, α is the update rate, and when the class matches, M n,i,t is 1, and the rest are 0. c (x) is the decision function, ω n,i,t By c (x) determines that the value range is less than 1; A pre-training module, used to obtain a pre-training image, and use the pre-training image to input the multi-class support vector machine model to learn a training background image; The segmentation module is used to obtain the image to be segmented, use the trained multi-class support vector machine model to perform foreground segmentation on the image to be segmented, and output the segmented image.
7. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the method for removing background from a video according to any one of claims 1 to 5 is implemented.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, a video background removal method according to any one of claims 1 to 5 is implemented.
