A mixed Gaussian background separation method, device, equipment and medium with time domain threshold

The mixed Gaussian background separation method with time domain threshold solves the problem of insufficient background separation accuracy and adaptability in complex and dynamic scenes, and achieves efficient front and rear background separation and dynamic background model adjustment, which is suitable for complex monitoring scenes.

CN118397033BActive Publication Date: 2024-10-15XIAMEN FANQIFENG TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410852987.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-28
Publication Date
2024-10-15
Estimated Expiration
2044-06-28

AI Technical Summary

Technical Problem

Existing background separation technology lacks accuracy and adaptability in complex and dynamic scenes, and is affected by factors such as illumination changes, dynamic backgrounds, occlusion and overlap, camera shake, and multi-target tracking, resulting in increased difficulty in separation.

Method used

The mixed Gaussian background separation method using time domain threshold is used to convert the video frame from RGB color space to HSV, and a Gaussian mixture model is constructed segmentally. The sparse noise reduction feature extraction model and the mixed Gaussian distribution model are used to dynamically adjust the background model to adapt to the scene. changes, and rebuilds the model when the camera angle changes.

Benefits of technology

It improves the accuracy and adaptability of background separation, has anti-interference ability, can effectively extract background information, adapts to illumination changes and moving targets, and is suitable for real-time processing needs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118397033B_ABST
    Figure CN118397033B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention provides a mixed Gaussian background separation method, device, equipment and medium with a time domain threshold, which relates to the field of video processing technology. Among them, this mixed Gaussian background separation method with a time domain threshold includes steps S1 to S5. S1, obtain the video to be separated. S2, convert the color space of the video to be separated from RGB to HSV, and obtain the HSV video. S3, segment the HSV video according to the preset duration to obtain multiple time periods. Among them, there is an overlap between two adjacent time periods. The time period includes a modeling time domain and a separation time domain. The duration of the modeling time domain is less than the separation time domain. The length of the modeling time domain is the length of the overlap. S4, construct a background model through a Gaussian mixture model based on the image sequence of the modeling time domain. S5, identify the image sequence of the separation time domain in the same time period based on the background model, and obtain a foreground image sequence. This method has higher accuracy and adaptability under complex backgrounds and dynamic scenes.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of video processing technology, and in particular to a mixed Gaussian background separation method, device, equipment and medium with a time domain threshold. Background Art

[0002] With the widespread application of intelligent video surveillance systems, background separation technology plays a vital role in the fields of moving target detection, abnormal behavior recognition, traffic monitoring, etc. The goal of background separation is to distinguish the static background from the dynamic foreground (such as pedestrians, vehicles, etc.) in the video.

[0003] In order to achieve background separation, technicians in this field have proposed a variety of background separation methods, mainly including the following: Frame difference method: Detect motion areas by comparing pixel differences between consecutive frames. Background subtraction method: Establish a background model and identify the foreground by the difference with the current frame. Segmentation-based methods, etc.

[0004] However, surveillance scenes in the real world are often very complex, and there are at least the following challenges, which lead to reduced accuracy and poor adaptability of existing separation technologies. Lighting changes: Changes in the intensity of natural and artificial light sources can significantly affect image quality, resulting in reduced performance of background separation algorithms. Dynamic background: Natural phenomena such as swaying leaves and rippling water make the background itself dynamic, increasing the difficulty of separation. Occlusion and overlap: Mutual occlusion between foreground targets and overlap with the background make it difficult to accurately identify target boundaries. Camera shake: The instability of the camera can cause noise in the image sequence, affecting the stability of the background model. Multi-target tracking: In multi-target scenes, accurately distinguishing and tracking each target is a technical challenge.

[0005] In view of this, the applicant filed this application after studying the existing technology. Summary of the invention

[0006] The present invention provides a mixed Gaussian background separation method, device, equipment and medium with time domain threshold to improve at least one of the above technical problems.

[0007] In a first aspect, an embodiment of the present invention provides a mixed Gaussian background separation method with a time domain threshold, which comprises steps S1 to S5.

[0008] S1. Obtain the video to be separated.

[0009] S2. Convert the color space of the video to be separated from RGB to HSV to obtain an HSV video.

[0010] S3, segmenting the HSV video according to a preset duration to obtain multiple time periods. There is overlap between two adjacent time periods. The time period includes a modeling time domain and a separation time domain. The duration of the modeling time domain is shorter than the separation time domain. The length of the modeling time domain is the length of the overlap.

[0011] S4. Constructing a background model through a Gaussian mixture model according to the image sequence in the modeling time domain.

[0012] S5. Identify a sequence of images in separated time domains in the same time period according to the background model to obtain a sequence of foreground images.

[0013] In an optional embodiment, step S4 specifically includes step S41 to step S42.

[0014] S41, input each frame of the image sequence in the modeling time domain into the mixed Gaussian model to obtain the mixed Gaussian distribution model of each frame of the image. The mixed Gaussian model is In the formula, For the The frame image The probability of a pixel, is the serial number of the Gaussian model, For the The weights of the Gaussian model, is the symbol for normal distribution, For the input The frame image Pixel data. For the The mean of the normal distribution of the Gaussian model, For the The variance of the normal distribution of the Gaussian model.

[0015] Preferably, the number of Gaussian models is 5.

[0016] S42. According to the mixed Gaussian distribution model of each frame image, respectively compare the probabilities of the pixel values ​​at corresponding positions of each image frame to obtain the background model.

[0017] In an optional embodiment, step S41 specifically includes: inputting the data of the tone channel of each frame of the image in the image sequence in the modeling time domain into the mixed Gaussian model for Gaussian fitting, and obtaining the mixed Gaussian distribution model of each frame of the image.

[0018] On the basis of the above embodiment, in an optional embodiment of the present invention, step S41 specifically includes steps S411 to S412.

[0019] S411, extracting the data of the hue channel of each frame of the image sequence in the modeling time domain through a pre-built sparse noise reduction feature extraction model to obtain a hue feature.

[0020] S412: Input the hue feature into the mixed Gaussian model for Gaussian fitting to obtain a mixed Gaussian distribution model of each frame image.

[0021] Preferably, the sparse denoising feature extraction model comprises an encoder and a decoder connected in sequence.

[0022] The encoder consists of an input layer, a first convolutional layer, a second convolutional layer, a third convolutional layer, a fourth convolutional layer, and a feature vector layer. The input layer is used to input the hue channel data of the image. The first convolutional layer uses 32 3x3 convolution kernels with a stride of 2 and an activation function of ReLU to keep the dimension unchanged. The second convolutional layer uses 64 3x3 convolution kernels with a stride of 2 and an activation function of ReLU. The third convolutional layer uses 128 3x3 convolution kernels with a stride of 2 and an activation function of ReLU. The fourth convolutional layer uses 256 3x3 convolution kernels with a stride of 2 and an activation function of ReLU. The feature vector layer uses a fully connected layer to flatten the feature map output by the convolutional layer into a one-dimensional vector.

[0023] The decoder consists of the first fully connected layer, the first deconvolution layer, the second deconvolution layer, the third deconvolution layer, the fourth deconvolution layer, and the output layer. The first fully connected layer uses a fully connected layer to convert the feature vector obtained by the encoder back into a tensor with a shape suitable for the decoding process. The first deconvolution layer uses 256 3x3 deconvolution kernels with a stride of 2 and an activation function of ReLU. The second deconvolution layer uses 128 3x3 deconvolution kernels with a stride of 2 and an activation function of ReLU. The third deconvolution layer uses 64 3x3 deconvolution kernels with a stride of 2 and an activation function of ReLU. The fourth deconvolution layer uses 32 3x3 deconvolution kernels with a stride of 2 and an activation function of ReLU. The output layer uses a 1x1 convolution kernel with no activation function to obtain the final reconstructed image with the same size as the input image.

[0024] Based on the above embodiment, in an optional embodiment of the present invention, the sparse denoising feature extraction model is trained through the following steps.

[0025] A1. Obtain training images.

[0026] A2. Add noise to the training images.

[0027] A3. Input the noisy training image into the sparse denoising feature extraction model to obtain the output image.

[0028] A4. Calculate a loss function based on the output image and the training image, and then adjust the parameters of the sparse denoising feature extraction model based on the loss function. for: In the formula, To rebuild the losses, is the regularization coefficient to control sparsity, is the sparsity loss, is the regularization coefficient for controlling weight regularization, is the L1 or L2 regularization term, To reduce noise loss.

[0029] In an optional embodiment, step S42 specifically includes steps S421 to S424.

[0030] S421. According to the mixed Gaussian distribution model of each frame of image, respectively compare the probabilities of the pixel values ​​at corresponding positions of each image frame to determine whether the pixel point belongs to the background or the foreground.

[0031] S422: If the difference between the maximum and minimum values ​​of the probability of the pixel value at the corresponding position of each image frame is less than 0.1 and the difference between the maximum and minimum values ​​of the probability of adjacent pixels at the corresponding position is less than 0.1, the pixel is determined to be the background. Otherwise, the pixel is determined to be the foreground.

[0032] S423. For the position covered by the foreground, pixels whose probability of pixel value change is greater than 0.1 are eliminated to obtain background features of the position covered by the foreground.

[0033] S424: Extract pixel values ​​of the background to obtain the background model.

[0034] In an optional embodiment, step S5 specifically includes: separating the background of each frame image in the separated time domain image sequence of the same time period by using OpenCV according to the background model to obtain a foreground image sequence.

[0035] In an optional embodiment, the mixed Gaussian background separation method of time domain threshold further includes step S6. S6, judging whether the shooting angle of the camera has changed. When it is judged that the shooting angle of the camera has changed, the mixed Gaussian background separation method is re-executed to construct a background model, and the background is separated by the background model to identify the foreground.

[0036] In a second aspect, an embodiment of the present invention provides a mixed Gaussian background separation device with a time domain threshold, which includes a video acquisition module, a color conversion module, a time domain module, a background construction module and a separation module.

[0037] The video acquisition module is used to acquire the video to be separated.

[0038] The color conversion module is used to convert the color space of the video to be separated from RGB to HSV to obtain an HSV video.

[0039] The time domain module is used to segment the HSV video according to a preset duration to obtain multiple time periods. There is overlap between two adjacent time periods. The time period includes a modeling time domain and a separation time domain. The duration of the modeling time domain is shorter than the separation time domain. The length of the modeling time domain is the length of the overlap.

[0040] The background construction module is used to construct a background model through a Gaussian mixture model according to the image sequence in the modeling time domain.

[0041] The separation module is used to identify the image sequence of the separated time domain in the same time period according to the background model to obtain the foreground image sequence.

[0042] In a third aspect, an embodiment of the present invention provides a mixed Gaussian background separation device with a time domain threshold, comprising a processor, a memory, and a computer program stored in the memory. The computer program can be executed by the processor to implement the mixed Gaussian background separation method with a time domain threshold as described in any paragraph of the first aspect.

[0043] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium. The computer-readable storage medium includes a stored computer program, wherein when the computer program is executed, the device where the computer-readable storage medium is located is controlled to perform the mixed Gaussian background separation method with time domain threshold as described in any paragraph of the first aspect.

[0044] By adopting the above technical solution, the present invention can achieve the following technical effects:

[0045] The mixed Gaussian background separation method of the time domain threshold of the present invention has higher accuracy and adaptability in complex backgrounds and dynamic scenes. It has the following advantages: 1. It has strong anti-interference ability and can effectively extract background information to achieve foreground and background separation; 2. It has certain adaptability to lighting changes and moving targets; 3. It can dynamically adjust the background model to adapt to changing scenes; 4. The algorithm is highly efficient and suitable for real-time processing needs. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.

[0047] Figure 1 It is a flowchart of the mixed Gaussian background separation method with time domain threshold.

[0048] Figure 2 It is a schematic diagram of the time period of step S3.

[0049] Figure 3 It is a flowchart of step S4 and step S5.

[0050] Figure 4 It is the network structure diagram of the sparse denoising feature extraction model. DETAILED DESCRIPTION

[0051] The technical scheme in the embodiment of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiment of the present invention. Obviously, the described embodiment is only a part of the embodiment of the present invention, not all of the embodiments. Based on the embodiment of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0052] Example 1, please refer to Figures 1 to 4 The first embodiment of the present invention provides a mixed Gaussian background separation method with a time domain threshold, which aims to solve the problem of insufficient separation accuracy and adaptability of existing background separation algorithms when dealing with scenes with complex scenes and dynamic scenes coexisting.

[0053] The mixed Gaussian background separation method with time domain threshold can be performed by a mixed Gaussian background separation device with time domain threshold (hereinafter referred to as background separation device). In particular, it is performed by one or more processors in the background separation device to implement steps S1 to S5.

[0054] S1. Obtain the video to be separated.

[0055] S2. Convert the color space of the video to be separated from RGB to HSV to obtain an HSV video. Specifically, in the HSV color space, each color is represented by hue (H), saturation (S), and value (V). The color parameters in this model are: hue (H), saturation (S), and value (V).

[0056] S3, segmenting the HSV video according to a preset duration to obtain multiple time periods. There is overlap between two adjacent time periods. The time period includes a modeling time domain and a separation time domain. The duration of the modeling time domain is shorter than the separation time domain. The length of the modeling time domain is the length of the overlap.

[0057] Specifically, the background model is rebuilt for each time period of the modeling time domain, and then the background separation of the time period is performed. Therefore, the model has strong adaptability and can adapt to complex and changing application scenarios. In this embodiment, there is no overlap between different modeling time domains. The background model built in the modeling time domain is applied to the background of all images from the time domain to the next background model. Figure 2 As shown in the figure, the step size of the time domain extraction should not be too long, generally not exceeding twice the selected time domain, so as to ensure the effectiveness of the background model; in scenes with small changes, the step size can be appropriately extended to reduce the computational overhead.

[0058] S4, constructing a background model through a Gaussian mixture model according to the image sequence in the modeling time domain. Preferably, step S4 specifically includes steps S41 to S42.

[0059] S41, input each frame of the image sequence in the modeling time domain into the mixed Gaussian model to obtain the mixed Gaussian distribution model of each frame of the image. The mixed Gaussian model is In the formula, For the The frame image The probability of a pixel, is the serial number of the Gaussian model, For the The weights of the Gaussian model, is the symbol for normal distribution, For the input The frame image Pixel data. For the The mean of the normal distribution of the Gaussian model, For the The variance of the normal distribution of the Gaussian model.

[0060] Preferably, the number of Gaussian models is 5. Step S41 specifically includes: inputting the data of the hue channel of each frame of the image sequence in the modeling time domain into the mixed Gaussian model for Gaussian fitting, and obtaining the mixed Gaussian distribution model of each frame of the image.

[0061] S42, according to the mixed Gaussian distribution model of each frame image, respectively compare the probability of the pixel value at the corresponding position of each image frame to obtain the background model. Preferably, step S42 specifically includes steps S421 to S424.

[0062] S421. According to the mixed Gaussian distribution model of each frame of image, respectively compare the probabilities of the pixel values ​​at corresponding positions of each image frame to determine whether the pixel point belongs to the background or the foreground.

[0063] S422: If the difference between the maximum and minimum values ​​of the probability of the pixel value at the corresponding position of each image frame is less than 0.1 and the difference between the maximum and minimum values ​​of the probability of adjacent pixels at the corresponding position is less than 0.1, the pixel is determined to be the background. Otherwise, the pixel is determined to be the foreground.

[0064] S423. For the position covered by the foreground, pixels whose probability of pixel value change is greater than 0.1 are eliminated to obtain background features of the position covered by the foreground.

[0065] S424: Extract pixel values ​​of the background to obtain the background model.

[0066] S5, identifying the image sequence of the separated time domain in the same time period according to the background model, and obtaining the foreground image sequence. Preferably, step S5 specifically includes: separating the background of each frame image in the image sequence of the separated time domain in the same time period through opencv according to the background model, and obtaining the foreground image sequence.

[0067] In summary, the mixed Gaussian background separation method of the time domain threshold of the embodiment of the present invention generally includes the following five steps. 1. Video frame color space conversion: Convert the input RGB video frames into the HSV color space one by one, and use the sensitivity of the HSV color space to illumination changes and color changes to extract the color information of the image. 2. Time domain threshold setting: In the HSV color space, combined with the continuity of the video frame, a time difference is set as the threshold, and the pixel values ​​of the image frames within the time domain threshold are compared. 3. Mixed Gaussian model: Introduce a mixed Gaussian model to model the background. Gaussian fitting is performed on the color distribution of each pixel point of the video frame. 4. Background separation: Combine the time domain threshold and the Gaussian mixture model to compare the color differences of the pixel points at the corresponding position of each frame image in the time domain, so as to determine whether the pixel point belongs to the foreground target, thereby constructing the background model of the time domain, thereby achieving background separation. 5. Dynamic adaptability: Within another time domain threshold, according to the pixel differences of each frame of the mixed Gaussian model, the background model adapted to the time domain is dynamically adjusted to improve the adaptability and robustness of the algorithm.

[0068] like Figure 2 and Figure 3 As shown, the working principle of the mixed Gaussian background separation method with time domain threshold in an embodiment of the present invention is further explained below.

[0069] First, set a time domain (i.e., modeling time domain). That is, set how long image data needs to be extracted from the video data. For example, if 1 second is set as the time domain, all image frames within 1 second are extracted to construct the image set of the time domain.

[0070] The selection of the time domain depends on the specific application scenario. If the background is relatively simple and changes little, such as in the application scenario where the object changes little in the image acquired over a long period of time (more than 10 seconds can be considered a long time), a longer time domain can be selected to build the background model, because a longer time domain can provide more data to capture the stability and consistency of the background. When the video frame rate is low, 1-2 seconds can be selected as a time domain, and 1 second can be selected as a time domain when the frame rate is high. By constructing a time domain in this way, the computational burden when building the background model can be effectively reduced, while ensuring a sufficient time span to capture potential background changes. If it is in a changing scene, images within 1 second or less can be extracted to construct this time domain to ensure that the model can quickly and effectively perform background segmentation.

[0071] Afterwards, each image in the image set is converted from the color space to the HSV color space, and the HSV color space can mark the colors of different objects in the image.

[0072] After that, the images converted to HSV are input into the mixed Gaussian model in turn, and the distribution probability of each pixel in an image is calculated by the mixed Gaussian model. The Gaussian model is also called the normal distribution. The model probability of the normal distribution is conducive to modeling certain events and affects the decision-making of things. The mixed Gaussian model consists of multiple Gaussian models.

[0073] Specifically, the HSV image structure is a three-channel, i.e., a three-dimensional structure. Assuming that the plane image size is 56x56 pixels, the HSV can be split into three 56x56 two-dimensional plane images, similar to the three channels of a color image. The first dimension is hue H, the second dimension is saturation S, and the third dimension is brightness V. In this embodiment, the mixed Gaussian model The data on the hue (H) channel is taken. The hue (H) channel contains the main information of the color and is the most significant feature of the color. For example, red, green, blue, etc. have obvious differences in the hue channel. Using the hue channel can more effectively separate different color areas.

[0074] According to the above method, a mixed Gaussian normal distribution model of each pixel in each image of the image set is constructed. Assuming that there are 20 images in the selected time domain, 20 mixed Gaussian distribution models can be obtained.

[0075] After obtaining these 20 mixed Gaussian distributions, the probability of the pixel value at each corresponding position in the 20 images is compared through these 20 Gaussian distributions. If the 20 distribution probabilities of the pixel at this position do not change or change slightly, the threshold is generally set to 0.1. If the difference between the maximum and minimum values ​​of the 20 distribution probabilities is less than 0.1, and the change of adjacent distribution probabilities is also less than 0.1 (that is, in the 20 probability distributions, the difference between 1 and 2, 2 and 3... is less than 0.1), then the pixel point is divided into the background model, and the change difference is greater than the above threshold and is determined as a foreground target.

[0076] Since the foreground object is in motion, the background features covered by the foreground object in the previous frames can be constructed through time changes. In this way, a good background model is constructed. Specifically, the pixels at the foreground position on the frames with large changes are removed, and only the background pixels are left, thus constructing the background model.

[0077] Finally, the background separation goal can be achieved for subsequent images through the foreground and background separation module in opencv.

[0078] The mixed Gaussian background separation method of the time domain threshold of the present invention has higher accuracy and adaptability in complex backgrounds and dynamic scenes. It has the following advantages: 1. It has strong anti-interference ability and can effectively extract background information to achieve foreground and background separation; 2. It has certain adaptability to lighting changes and moving targets; 3. It can dynamically adjust the background model to adapt to changing scenes; 4. The algorithm is highly efficient and suitable for real-time processing needs.

[0079] On the basis of the above embodiment, in an optional embodiment of the present invention, step S41 specifically includes steps S411 to S412.

[0080] S411, extracting the data of the hue channel of each frame of the image sequence in the modeling time domain through a pre-built sparse noise reduction feature extraction model to obtain a hue feature.

[0081] S412: Input the hue feature into the mixed Gaussian model for Gaussian fitting to obtain a mixed Gaussian distribution model of each frame image.

[0082] Preferably, the sparse denoising feature extraction model comprises an encoder and a decoder connected in sequence. Among them, the encoder can compress high-dimensional image data into a low-dimensional feature vector. Specifically, the key to the sparse denoising feature extraction model lies in the encoder part, which compresses the image into a low-dimensional feature vector. This feature vector can be used for various tasks, such as image classification, clustering or as input for other machine learning models. The decoder part is used to reconstruct the image, which helps to ensure that the encoder learns useful feature representations. The embodiment of the present invention uses a sparse denoising feature extraction model to learn a low-dimensional representation of the background, and uses this as a supplement to the mixed Gaussian model to help capture the complex changes of the background.

[0083] The encoder consists of the following parts.

[0084] Input layer: The size of the input image is 1920x1080. Since it is a single channel, the shape of the input tensor is (1920,1080,1).

[0085] The first convolutional layer uses 32 3x3 convolution kernels with a stride of 2, an activation function of ReLU, and padding='same' to keep the dimension unchanged.

[0086] Second convolutional layer: Use 64 3x3 convolution kernels, stride 2, ReLU activation, padding='same'.

[0087] The third convolutional layer: uses 128 3x3 convolution kernels, a stride of 2, ReLU activation, and padding='same'.

[0088] Fourth convolutional layer: Use 256 3x3 convolution kernels, stride 2, ReLU activation, padding='same'.

[0089] Feature vector layer: Use a fully connected layer to flatten the feature map output by the convolutional layer into a one-dimensional vector. The length of this vector will be the dimension of the feature vector. For example, if the output of the fully connected layer is 1024, then the length of the feature vector is 1024.

[0090] The decoder consists of the following parts.

[0091] The first fully connected layer: The feature vector obtained by the encoder is converted back into a tensor with a shape suitable for the decoding process through a fully connected layer.

[0092] First deconvolution layer: Use 256 3x3 deconvolution kernels, stride 2, ReLU activation, padding='same'.

[0093] Second deconvolution layer: Use 128 3x3 deconvolution kernels, stride 2, ReLU activation, padding='same'.

[0094] The third deconvolution layer: uses 64 3x3 deconvolution kernels, a step size of 2, ReLU activation, and padding='same'.

[0095] Fourth deconvolution layer: Use 32 3x3 deconvolution kernels, stride 2, ReLU activation, padding='same'.

[0096] Output layer: Use a 1x1 convolution kernel with no activation function to get the final reconstructed image with the same size as the input image.

[0097] Based on the above embodiment, in an optional embodiment of the present invention, the sparse denoising feature extraction model is trained through the following steps.

[0098] A1. Obtain training images.

[0099] A2. Add noise to the training images.

[0100] A3. Input the noisy training image into the sparse denoising feature extraction model to obtain the output image.

[0101] A4. Calculate a loss function based on the output image and the training image, and then adjust the parameters of the sparse denoising feature extraction model based on the loss function. for: In the formula, To rebuild the losses, is the regularization coefficient to control sparsity, is the sparsity loss, is the regularization coefficient for controlling weight regularization, is the L1 or L2 regularization term, To reduce noise loss.

[0102] Specifically, the reconstruction loss is the mean square error, which is used to measure the difference between the reconstructed image and the original image. The sparsity loss allows the sparse denoising feature extraction model to learn sparse feature representations to reduce the amount of calculation and improve the recognition speed. The denoising loss allows the model to reduce noise during the reconstruction process to improve the recognition accuracy, which has great practical significance.

[0103] Based on the above embodiment, in an optional embodiment of the present invention, the mixed Gaussian background separation method of time domain threshold further includes step S6. S6, judging whether the shooting angle of the camera has changed. When it is judged that the shooting angle of the camera has changed, the mixed Gaussian background separation method is re-executed to construct a background model, and the background is separated by the background model to identify the foreground.

[0104] Specifically, the mixed Gaussian background separation method with time domain threshold in the embodiment of the present invention is designed for fixed camera positions, and has strong adaptability and high background separation ability for fixed camera positions. However, the application of the algorithm is not limited to fixed camera positions, but is also applicable to mobile camera positions (non-fixed camera positions). When applied to mobile camera positions, the setting of the time domain needs to be much smaller than the time it takes for the camera position to move from one point to another (or the camera angle offset), and the background model needs to be rebuilt according to the algorithm after moving to another point.

[0105] As for when the mobile camera builds the background model, a software trigger can be set to combine with the algorithm and the camera's motion control program. When the camera is not moving, the update of the background model is determined by the set time domain; if the camera moves, the camera's motion control program sends an instruction to the software trigger after issuing an instruction to move the camera. After the software trigger receives the signal instruction sent by the mobile program, it will build an instruction and send it to the program that builds the background model, allowing the program to update the background model.

[0106] Embodiment 2: The embodiment of the present invention provides a mixed Gaussian background separation device with a time domain threshold, which includes a video acquisition module, a color conversion module, a time domain module, a background construction module and a separation module.

[0107] The video acquisition module is used to acquire the video to be separated.

[0108] The color conversion module is used to convert the color space of the video to be separated from RGB to HSV to obtain an HSV video.

[0109] The time domain module is used to segment the HSV video according to a preset duration to obtain multiple time periods. There is overlap between two adjacent time periods. The time period includes a modeling time domain and a separation time domain. The duration of the modeling time domain is shorter than the separation time domain. The length of the modeling time domain is the length of the overlap.

[0110] The background construction module is used to construct a background model through a Gaussian mixture model according to the image sequence in the modeling time domain.

[0111] The separation module is used to identify the image sequence of the separated time domain in the same time period according to the background model to obtain the foreground image sequence.

[0112] Embodiment 3: The embodiment of the present invention provides a mixed Gaussian background separation device with time domain threshold, which includes a processor, a memory, and a computer program stored in the memory. The computer program can be executed by the processor to implement the mixed Gaussian background separation method with time domain threshold as described in any paragraph of Embodiment 1.

[0113] Embodiment 4: The embodiment of the present invention provides a computer-readable storage medium. The computer-readable storage medium includes a stored computer program, wherein when the computer program is executed, the device where the computer-readable storage medium is located is controlled to perform the mixed Gaussian background separation method with time domain threshold as described in any paragraph of Embodiment 1.

[0114] It is understandable that the background separation device may be an electronic device with computing capabilities, such as a portable notebook computer, a desktop computer, a server, a smart phone, or a tablet computer.

[0115] In several embodiments provided in the embodiments of the present invention, it should be understood that the disclosed apparatus and method can also be implemented in other ways. The apparatus and method embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the apparatus, method and computer program product according to multiple embodiments of the present invention. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, program segment or a part of the code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.

[0116] In addition, the functional modules in the various embodiments of the present invention may be integrated together to form an independent part, or each module may exist independently, or two or more modules may be integrated to form an independent part.

[0117] If the function is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions to enable a computer device (which can be a personal computer, an electronic device, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program code. It should be noted that in this article, the term "include", "comprise" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also includes other elements that are not explicitly listed, or also includes elements inherent to such a process, method, article or device. Without more constraints, an element defined by the phrase "comprising a..." does not exclude the existence of other identical elements in the process, method, article or apparatus comprising the element.

[0118] The terms used in the embodiments of the present invention are only for the purpose of describing specific embodiments, and are not intended to limit the present invention. The singular forms "a", "said" and "the" used in the embodiments of the present invention and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings.

[0119] It should be understood that the term "and / or" used in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.

[0120] The word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrases "if it is determined" or "if (stated condition or event) is detected" may be interpreted as "when it is determined" or "in response to determining" or "when detecting (stated condition or event)" or "in response to detecting (stated condition or event)", depending on the context.

[0121] The "first\second" mentioned in the embodiments is only to distinguish similar objects, and does not represent a specific order for the objects. It is understandable that the "first\second" can be interchanged with the specific order or sequence where permitted. It should be understood that the objects distinguished by "first\second" can be interchanged where appropriate, so that the embodiments described herein can be implemented in an order other than those illustrated or described herein.

[0122] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A mixed Gaussian background separation method with time domain threshold, characterized in that: Include: Get the video to be separated; Convert the color space of the video to be separated from RGB to HSV to obtain an HSV video; The HSV video is segmented according to a preset duration to obtain a plurality of time periods; wherein there is an overlap between two adjacent time periods; the time period includes a modeling time domain and a separation time domain; the duration of the modeling time domain is shorter than the separation time domain; and the length of the modeling time domain is the length of the overlap; According to the image sequence in the modeling time domain, a background model is constructed by using a Gaussian mixture model; Identify a sequence of images in separated time domains in the same time period according to the background model to obtain a sequence of foreground images; According to the image sequence in the modeling time domain, a background model is constructed by using a Gaussian mixture model, specifically including: Extracting the data of the tone channel of each frame of the image sequence in the modeling time domain through a pre-built sparse denoising feature extraction model to obtain the tone feature; wherein the sparse denoising feature extraction model is used to learn the low-dimensional representation of the background and to supplement the mixed Gaussian model; The hue feature is input into the mixed Gaussian model for Gaussian fitting to obtain a mixed Gaussian distribution model of each frame image; wherein the mixed Gaussian model is: In the formula, For the The frame image The probability of a pixel, is the serial number of the Gaussian model, For the The weights of the Gaussian model, is the symbol for normal distribution, For the input The frame image Pixel data; For the The mean of the normal distribution of the Gaussian model, For the The variance of the normal distribution of the Gaussian model; According to the mixed Gaussian distribution model of each frame of image, respectively compare the probabilities of the pixel values ​​at the corresponding positions of each image frame to obtain the background model; The sparse denoising feature extraction model comprises an encoder and a decoder connected in sequence; The encoder consists of an input layer, a first convolutional layer, a second convolutional layer, a third convolutional layer, a fourth convolutional layer, and a feature vector layer; the input layer is used to input the hue channel data of the image; the first convolutional layer uses 32 3x3 convolution kernels with a step size of 2 and an activation function of ReLU to keep the dimension unchanged; the second convolutional layer uses 64 3x3 convolution kernels with a step size of 2 and an activation function of ReLU; the third convolutional layer uses 128 3x3 convolution kernels with a step size of 2 and an activation function of ReLU; the fourth convolutional layer uses 256 3x3 convolution kernels with a step size of 2 and an activation function of ReLU; the feature vector layer uses a fully connected layer to flatten the feature map output by the convolutional layer into a one-dimensional vector; The decoder contains the first fully connected layer, the first deconvolution layer, the second deconvolution layer, the third deconvolution layer, the fourth deconvolution layer and the output layer; the first fully connected layer uses a fully connected layer to convert the feature vector obtained by the encoder back into a tensor with a shape suitable for the decoding process; the first deconvolution layer uses 256 3x3 deconvolution kernels with a step size of 2 and an activation function of ReLU; the second deconvolution layer uses 128 3x3 deconvolution kernels with a step size of 2 and an activation function of ReLU; the third deconvolution layer uses 64 3x3 deconvolution kernels with a step size of 2 and an activation function of ReLU; the fourth deconvolution layer uses 32 3x3 deconvolution kernels with a step size of 2 and an activation function of ReLU; the output layer uses a 1x1 convolution kernel without an activation function to obtain the final reconstructed image, whose size is the same as the input image; The sparse denoising feature extraction model is trained through the following steps; Get training images; Add noise to training images; Input the noisy training image into the sparse denoising feature extraction model to obtain the output image; A loss function is calculated according to the output image and the training image, and then the parameters of the sparse denoising feature extraction model are adjusted according to the loss function; wherein the loss function for: In the formula, To rebuild the losses, is the regularization coefficient to control sparsity, is the sparsity loss, is the regularization coefficient for controlling weight regularization, is the L1 or L2 regularization term, To reduce noise loss.

2. The mixed Gaussian background separation method of time domain thresholding according to claim 1 is characterized in that: The number of Gaussian models is 5.

3. The mixed Gaussian background separation method of time domain thresholding according to claim 1 is characterized in that: According to the mixed Gaussian distribution model of each frame image, respectively comparing the probabilities of the pixel values ​​at the corresponding positions of each image frame to obtain the background model, specifically including: According to the mixed Gaussian distribution model of each frame of image, respectively compare the probability of the pixel value at the corresponding position of each image frame to determine whether the pixel point belongs to the background or the foreground; If the difference between the maximum and minimum values ​​of the probability of the pixel value at the corresponding position of each image frame is less than 0.1 and the difference between the maximum and minimum values ​​of the probability of adjacent pixels at the corresponding position is less than 0.1, then the pixel is determined to be the background; otherwise, the pixel is determined to be the foreground; For the position covered by the foreground, the pixels whose probability of pixel value change is greater than 0.1 are eliminated to obtain the background features of the position covered by the foreground; The pixel values ​​of the background are extracted to obtain the background model.

4. The mixed Gaussian background separation method of time domain thresholding according to any one of claims 1 to 3, characterized in that: Identifying a sequence of images in separated time domains in the same time period according to the background model to obtain a sequence of foreground images specifically includes: According to the background model, the background of each frame image in the image sequence of the separated time domain in the same time period is separated by OpenCV to obtain a foreground image sequence.

5. The mixed Gaussian background separation method of time domain thresholding according to any one of claims 1 to 3, characterized in that: The video to be separated is a video taken by a surveillance camera; The mixed Gaussian background separation method of time domain threshold also includes: Determine whether the shooting angle of the camera has changed; when it is determined that the shooting angle of the camera has changed, re-execute the mixed Gaussian background separation method, build a background model, and separate the background through the background model to identify the foreground.

6. A mixed Gaussian background separation device with time domain threshold, characterized in that: Include: A video acquisition module is used to acquire the video to be separated; A color conversion module, used to convert the color space of the video to be separated from RGB to HSV, and obtain an HSV video; A time domain module is used to segment the HSV video according to a preset duration to obtain multiple time periods; wherein there is overlap between two adjacent time periods; the time period includes a modeling time domain and a separation time domain; the duration of the modeling time domain is less than the separation time domain; and the length of the modeling time domain is the length of the overlap; A background construction module, used to construct a background model through a Gaussian mixture model according to the image sequence in the modeling time domain; A separation module, used for identifying a sequence of images in a separated time domain in the same time period according to the background model, and obtaining a sequence of foreground images; The background building blocks are specifically used for: Extracting the data of the tone channel of each frame of the image sequence in the modeling time domain through a pre-built sparse denoising feature extraction model to obtain the tone feature; wherein the sparse denoising feature extraction model is used to learn the low-dimensional representation of the background and to supplement the mixed Gaussian model; The hue feature is input into the mixed Gaussian model for Gaussian fitting to obtain a mixed Gaussian distribution model of each frame image; wherein the mixed Gaussian model is: In the formula, For the The frame image The probability of a pixel, is the serial number of the Gaussian model, For the The weights of the Gaussian model, is the symbol for normal distribution, For the input The frame image Pixel data; For the The mean of the normal distribution of the Gaussian model, For the The variance of the normal distribution of the Gaussian model; According to the mixed Gaussian distribution model of each frame of image, respectively compare the probabilities of the pixel values ​​at the corresponding positions of each image frame to obtain the background model; The sparse denoising feature extraction model comprises an encoder and a decoder connected in sequence; The encoder consists of an input layer, a first convolutional layer, a second convolutional layer, a third convolutional layer, a fourth convolutional layer, and a feature vector layer; the input layer is used to input the hue channel data of the image; the first convolutional layer uses 32 3x3 convolution kernels with a step size of 2 and an activation function of ReLU to keep the dimension unchanged; the second convolutional layer uses 64 3x3 convolution kernels with a step size of 2 and an activation function of ReLU; the third convolutional layer uses 128 3x3 convolution kernels with a step size of 2 and an activation function of ReLU; the fourth convolutional layer uses 256 3x3 convolution kernels with a step size of 2 and an activation function of ReLU; the feature vector layer uses a fully connected layer to flatten the feature map output by the convolutional layer into a one-dimensional vector; The decoder contains the first fully connected layer, the first deconvolution layer, the second deconvolution layer, the third deconvolution layer, the fourth deconvolution layer and the output layer; the first fully connected layer uses a fully connected layer to convert the feature vector obtained by the encoder back into a tensor with a shape suitable for the decoding process; the first deconvolution layer uses 256 3x3 deconvolution kernels with a step size of 2 and an activation function of ReLU; the second deconvolution layer uses 128 3x3 deconvolution kernels with a step size of 2 and an activation function of ReLU; the third deconvolution layer uses 64 3x3 deconvolution kernels with a step size of 2 and an activation function of ReLU; the fourth deconvolution layer uses 32 3x3 deconvolution kernels with a step size of 2 and an activation function of ReLU; the output layer uses a 1x1 convolution kernel without an activation function to obtain the final reconstructed image, whose size is the same as the input image; The sparse denoising feature extraction model is trained through the following steps; Get training images; Add noise to training images; Input the noisy training image into the sparse denoising feature extraction model to obtain the output image; A loss function is calculated according to the output image and the training image, and then the parameters of the sparse denoising feature extraction model are adjusted according to the loss function; wherein the loss function for: In the formula, To rebuild the losses, is the regularization coefficient to control sparsity, is the sparsity loss, is the regularization coefficient for controlling weight regularization, is the L1 or L2 regularization term, To reduce noise loss.

7. A mixed Gaussian background separation device with time domain threshold, characterized in that: It comprises a processor, a memory, and a computer program stored in the memory; the computer program can be executed by the processor to implement the mixed Gaussian background separation method with time domain threshold as described in any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored computer program, wherein when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute the mixed Gaussian background separation method with time domain threshold as described in any one of claims 1 to 5.