Moving object detection method and device based on multi-directional gradient suppression

By constructing a multi-directional gradient suppression model, the gradient features of moving targets are accurately extracted, achieving effective suppression of the background and efficient detection of moving objects. This improves the accuracy and robustness of moving object detection, especially significantly enhancing the detection performance of small and weak targets in complex scenes.

CN121527680APending Publication Date: 2026-02-13ZHEJIANG MIAXIS TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511683147.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-17
Publication Date
2026-02-13

AI Technical Summary

Technical Problem

Existing moving object detection methods do not make sufficient use of multi-directional gradient features and have unreasonable gradient response adjustment, which leads to missed detection of small or weakly moving targets and a decrease in detection accuracy.

Method used

By constructing a multi-directional gradient suppression model, the gradients of each pixel in the video frame sequence are calculated. Background suppression is performed using a preset background suppression formula. The gradient features in the four directions are then fused to generate a four-channel feature map, which is then input into a neural network for training to detect moving objects.

Benefits of technology

It improves detection accuracy and robustness in complex scenarios, significantly reduces false alarm rate, increases the detection rate of small and weakly moving targets, enhances adaptability to dynamic background and lighting changes, and balances accuracy and real-time performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121527680A_ABST
    Figure CN121527680A_ABST
Patent Text Reader

Abstract

The invention discloses a moving object detection method and device based on multidirectional gradient suppression, relates to the technical field of moving object detection, and solves the problems of insufficient utilization of multidirectional gradient features and unreasonable gradient response adjustment in existing moving object detection. The method comprises the following steps: calculating gradients of each pixel point in the up, down, left and right directions in a video frame sequence, carrying out background suppression by utilizing a background suppression formula, and fusing gradient features in the four directions to form a gradient energy diagram after the background suppression is completed, and then splicing the three channels of the fused gradient energy diagram and the image into a four-channel feature map for training a neural network model so as to obtain a moving object detection model capable of detecting a moving object in the video, and performing real-time detection on the moving object in the video by using the moving object detection model. By extracting the gradient features of the moving object, effective suppression of the background and efficient detection of the moving object are realized, and the detection precision and robustness in a complex scene are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of moving object detection technology, and in particular to a moving object detection method and apparatus based on multi-directional gradient suppression. Background Technology

[0002] Moving object detection is a core task in computer vision, widely used in video surveillance, autonomous driving, industrial inspection, and other scenarios. Existing methods mainly include background modeling (such as Gaussian Mixture Model, GMM), frame difference methods, optical flow methods, and deep learning methods (such as CNN-based object detection). These methods achieve object detection by extracting the differences between the moving region and the background (such as pixel changes and gradient changes). Among them, gradient features are widely used for the localization and segmentation of moving targets because they can reflect the motion state of object edges.

[0003] The existing methods have the following main drawbacks:

[0004] 1. Insufficient utilization of motion gradient features: Existing methods mostly rely on gradients in a single direction or global gradient statistics, ignoring the gradient differences of moving objects in multiple directions (such as up, down, left, and right), leading to missed detection of small targets or weakly moving targets.

[0005] 2. Inappropriate gradient response adjustment: Traditional gradient thresholding methods cannot dynamically balance background suppression and target preservation. Either the background is suppressed too much, resulting in the loss of target edges, or too much background interference is retained, resulting in a decrease in detection accuracy. Summary of the Invention

[0006] The purpose of this application is to overcome the problems of insufficient utilization of multi-directional gradient features and unreasonable gradient response adjustment in existing moving object detection, and to provide a moving object detection method and device based on multi-directional gradient suppression.

[0007] Firstly, a moving object detection method based on multi-directional gradient suppression is provided, including:

[0008] Acquire the video frame sequence to be detected and perform preprocessing;

[0009] Calculate the gradient of each pixel in the four directions (up, down, left, and right) of each image in the video frame sequence;

[0010] Background suppression is performed on the gradient in the four directions (up, down, left, and right) of each pixel using a preset background suppression formula;

[0011] The suppressed gradient features of the four directions are fused to obtain a fused gradient energy map;

[0012] The fused gradient energy map is stitched together with the three channels of the image to obtain a four-channel feature map;

[0013] The four-channel feature maps are input into a neural network model for training to obtain a moving object detection model.

[0014] The moving object detection model described above is used to detect moving objects in a video frame sequence.

[0015] In some possible implementations, the preprocessing includes:

[0016] Gaussian filtering is used to remove noise from the images in the video frame sequence;

[0017] Identify whether an image in a video frame sequence is in color; if the image is in color, convert it to grayscale.

[0018] In some possible implementations, the gradient calculation formula for each pixel (i, j) in each image of the video frame sequence is as follows:

[0019]

[0020]

[0021]

[0022]

[0023] in, The gradient is in the north direction. The gradient is in the south direction. The gradient is in the east direction. Let be the gradient in the west direction, med() be the median function, and s be the step size of the gradient calculation window.

[0024] In some possible implementations, the preset background suppression formula is:

[0025]

[0026] in, The gradient after background suppression. The input gradient is given by EXP(), the natural exponential function is given by K, the exponential adjustment parameter is given by T, which controls the suppression strength in the low gradient region, and the quadratic adjustment parameter is given by T, which limits the influence of abnormal high gradient noise.

[0027] In some possible implementations, the formula for calculating the fusion of the suppressed four-directional gradient features is as follows:

[0028]

[0029] Where D(I) is the fusion result, and ▏▏ is the absolute value operation. The northward gradient after background suppression. The hard-direction gradient after background suppression. The gradient in the eastward direction after background suppression. The gradient in the west direction after background suppression.

[0030] In some possible implementations, the formula for calculating the fusion of gradient energy map and three-channel image stitching is as follows:

[0031]

[0032] Among them, I 4ch For a four-channel feature map, I R For the R channel feature map, I G For the G channel feature map, I B Let B be the feature map and D(I) be the fused gradient energy map.

[0033] In some possible implementations, the four-channel feature map is input into a neural network model for training to obtain a moving object detection model, including:

[0034] Construct a training dataset and label the specific locations of moving objects in the four-channel feature map;

[0035] Construct a neural network model based on Retinaface;

[0036] The training dataset is input into the neural network model, and the neural network model is trained using classification loss and location loss functions;

[0037] If the loss function converges, training ends and a moving object detection model is obtained.

[0038] Secondly, a moving object detection device based on multi-directional gradient suppression is provided, comprising:

[0039] The acquisition module is used to acquire the video frame sequence to be detected and perform preprocessing.

[0040] The gradient calculation module is used to calculate the gradient of each pixel in the video frame sequence in the four directions of up, down, left, and right.

[0041] The background suppression module is used to suppress the background gradient of each pixel in the four directions of up, down, left, and right using a preset background suppression formula.

[0042] The feature fusion module is used to fuse the suppressed gradient features in four directions to obtain a fused gradient energy map.

[0043] The stitching module is used to stitch the fused gradient energy map with the three channels of the image to obtain a four-channel feature map;

[0044] The model training module is used to input the four-channel feature map into the neural network model for training to obtain a moving object detection model.

[0045] The detection module is used to detect moving objects in a video frame sequence using the moving object detection model.

[0046] Thirdly, a computer-readable storage medium is provided for program code executable by a device, the program code including steps for performing a method as described in any of the implementations of the first aspect above.

[0047] Fourthly, an electronic device is provided, the electronic device including a processor, a memory, and a program or instructions stored in the memory and executable on the processor, wherein the program or instructions, when executed by the processor, implement the method as described in any of the implementations of the first aspect above.

[0048] This application has the following beneficial effects:

[0049] 1. This application constructs a background suppression formula and a multi-directional gradient fusion model to accurately extract the gradient features of moving targets, thereby achieving effective background suppression and efficient detection of moving objects, and improving the detection accuracy and robustness in complex scenes.

[0050] 2. More precise background suppression: Through a new background suppression formula, the gradient response is dynamically adjusted—it has a strong suppression effect on low gradient background areas (such as static backgrounds) and a weak suppression effect on high gradient motion areas (such as object edges), significantly reducing the false alarm rate.

[0051] 3. Full utilization of multi-directional features: integrating North ,South ,East ,West Gradient information in four directions captures the edge features of moving objects in different directions, improving the detection rate of small targets and weakly moving targets;

[0052] 4. Strong detection robustness: By using the gradient fusion formula, the gradient energy after multi-directional suppression is integrated to enhance the adaptability to dynamic background and illumination changes;

[0053] 5. High computational efficiency: The formula is an analytical expression that can be embedded in existing detection processes (such as the preprocessing stage), eliminating the need for complex iterative calculations and balancing accuracy and real-time performance. Attached Figure Description

[0054] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments of this application and their descriptions are used to explain this application and do not constitute an undue limitation of this application.

[0055] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0056] Figure 1 This is a flowchart of the moving object detection method based on multi-directional gradient suppression according to Embodiment 1 of this application;

[0057] Figure 2 This is a structural block diagram of the moving object detection device based on multi-directional gradient suppression according to Embodiment 2 of this application;

[0058] Figure 3 This is a schematic diagram of the internal structure of the electronic device according to Embodiment 4 of this application.

[0059] Figure label:

[0060] 100. Acquisition Module; 200. Gradient Calculation Module; 300. Background Suppression Module; 400. Feature Fusion Module; 500. Stitching Module; 600. Model Training Module; 700. Detection Module. Detailed Implementation

[0061] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0062] Example 1

[0063] like Figure 1 As shown, the moving object detection method based on multi-directional gradient suppression involved in Embodiment 1 of this application includes:

[0064] S100: Obtain the video frame sequence to be detected and perform preprocessing.

[0065] Specifically, image preprocessing involves obtaining the video frame sequence to be detected. This video frame sequence is a series of static images arranged chronologically (called "frames"). The current frame image I (with dimensions M×N pixels) is selected, and preprocessing is performed on the image.

[0066] S101. Use Gaussian filtering to remove image noise. The filter kernel size is 3×3 and the standard deviation σ=1.0.

[0067] S102. If the image is in color, convert it to grayscale and unify the processing dimensions.

[0068] S200. Calculate the gradient of each pixel in the video frame sequence in the four directions of up, down, left, and right.

[0069] Specifically, the gradients in the four directions of up, down, left, and right are calculated (i.e., the gradients in the four directions of north (N), south (S), west (W), and east (E) in the image). For each pixel (i,j) in image I, the gradients in the four directions of north (N), south (S), west (W), and east (E) are calculated respectively. For the gradient of pixel (i,j), the gradients in the four directions of up, down, left, and right of that pixel are calculated respectively. The gradient in each direction is the pixel gray value minus the median gray value in the corresponding direction. The gradient calculation formula is:

[0070]

[0071]

[0072]

[0073]

[0074] in, The gradient is in the north direction. The gradient is in the south direction. The gradient is in the east direction. Let be the gradient in the west direction, med() be the median function, and s be the step size of the gradient calculation window.

[0075] S300: Use a preset background suppression formula to suppress the gradient in the four directions (up, down, left, and right) of each pixel.

[0076] Specifically, the background suppression formula is applied to the four directional gradients calculated in step S200 to suppress low-gradient background interference and enhance the features of high-gradient moving targets. By adjusting the parameters K and T in the background suppression formula, the background suppression is optimized to achieve the desired effect. When the size is small, it significantly suppresses background interference. When the target gradient is large, the background suppression formula is:

[0077]

[0078] in, The gradient after background suppression. For input gradients (including) , , and EXP() is the natural exponential function, K is the exponential adjustment parameter (value range 50≤K≤500, default K=200), used to control the suppression intensity in the low gradient region, and T is the secondary adjustment parameter (value range 100≤T≤1000, default T=500), used to limit the influence of abnormal high gradient noise.

[0079] It should be noted that when When smaller (background area). ≈0, significantly suppressing background interference; when When it is large (edge ​​of the moving target). ≈1, preserving target gradient features, this novel background suppression formula dynamically adjusts the gradient response—strongly suppressing low-gradient background regions (such as static backgrounds) and weakly suppressing high-gradient moving regions (such as object edges), significantly reducing the false alarm rate. The dynamic adjustment of the gradient response is mainly manifested in its ability to target different objects. The values ​​of parameters K and T in the code will be different.

[0080] S400. The suppressed gradient features of the four directions are fused to obtain the fused gradient energy map.

[0081] The suppressed gradient features from the four directions are fused together, and the pixel-level motion energy D(I) is calculated using the following formula:

[0082]

[0083] Where D(I) is the fusion result, which reflects the probability that a pixel belongs to a moving object (the larger the D(I) value, the higher the probability that the pixel belongs to a moving object), and ▏▏ is the absolute value operation. The northward gradient after background suppression. The hard-direction gradient after background suppression. The gradient in the eastward direction after background suppression. The gradient in the west direction after background suppression.

[0084] In this embodiment, the fusion of North ( ),South( ),East( ),West( The gradient information in four directions captures the edge features of moving objects in different directions, which can effectively improve the detection rate of small and weakly moving targets. Secondly, by combining the gradient energy after multi-directional suppression through the above gradient fusion formula, the adaptability to dynamic background and illumination changes is enhanced, and the robustness of moving object detection is significantly improved.

[0085] S500. The fused gradient energy map is stitched together with the three channels of the image to obtain a four-channel feature map.

[0086] Specifically, the gradient energy map D(I) fused in step S400 is embedded as the fourth channel of the image as a "motion prior feature" to construct a 4-dimensional input feature; the importance weights of the four channels are automatically learned through the channel attention mechanism to strengthen the correlation between the D(I) channel and the moving target; finally, the neural network is combined to output a high-precision motion region segmentation result.

[0087] D(I) is used as the 4th channel and concatenated with the original image to form a 4-channel feature map:

[0088]

[0089] Among them, I 4ch For a four-channel feature map, I R For the R channel feature map, I G For the G channel feature map, I B Let B be the feature map and D(I) be the fused gradient energy map.

[0090] S600. Input the four-channel feature map into the neural network model for training to obtain a moving object detection model.

[0091] Specifically, the obtained four-channel feature maps are fed into the Retinaface main neural network for learning, and trained until the loss function converges.

[0092] In this embodiment, the specific training process of the neural network is as follows:

[0093] S601. Prepare training data, namely RGBD four-channel data, and label the specific positions (x1, y1) and (x2, y2) of the moving objects.

[0094] S602. Construct a neural network structure based on Retinaface;

[0095] S603. Neural network training is performed using classification loss and location loss functions;

[0096] S604. Once the loss function converges, the training is considered complete, and the moving object detection model is obtained.

[0097] S700. Detect moving objects in the video frame sequence using the moving object detection model.

[0098] Specifically, after obtaining the video frame sequence to be detected, the video frame sequence is processed according to the steps in S100-S500 to obtain a four-channel feature map. The four-channel feature map is then input into the motion object detection model trained in step S600 to detect the motion objects in the video frame sequence. The detection result can be presented by selecting the motion objects in the original video frame sequence using colored outlines.

[0099] The performance of the moving object detection model trained in this embodiment on a small object detection dataset in extreme scenarios is shown in Table 1 below:

[0100] Table 1:

[0101]

[0102] As can be seen from Table 1 above, the moving object detection model in this embodiment has significantly improved detection accuracy while ensuring real-time detection, and can be used for real-time detection of small targets in extreme scenarios.

[0103] In this embodiment, addressing the issues of insufficient utilization of multi-directional gradient features and unreasonable gradient response adjustment in existing moving object detection, a novel background suppression formula and multi-directional gradient fusion model are constructed to accurately extract the gradient features of moving targets. This achieves effective background suppression and efficient detection of moving objects, improving detection accuracy and robustness in complex scenes. Furthermore, the formula in this embodiment is an analytical expression that can be embedded into existing detection processes (such as the preprocessing stage), eliminating the need for complex iterative calculations. It balances accuracy and real-time performance, effectively improving computational efficiency.

[0104] Example 2

[0105] like Figure 2 As shown, the moving object detection device based on multi-directional gradient suppression according to Embodiment 2 of this application includes:

[0106] The acquisition module 100 is used to acquire the video frame sequence to be detected and perform preprocessing.

[0107] The gradient calculation module 200 is used to calculate the gradient of each pixel in the video frame sequence in the four directions of up, down, left, and right.

[0108] Background suppression module 300 is used to suppress the gradient of each pixel in the four directions of up, down, left, and right using a preset background suppression formula;

[0109] The feature fusion module 400 is used to fuse the suppressed gradient features in four directions to obtain a fused gradient energy map.

[0110] The stitching module 500 is used to stitch the fused gradient energy map with the three channels of the image to obtain a four-channel feature map;

[0111] The model training module 600 is used to input the four-channel feature map into the neural network model for training to obtain a moving object detection model.

[0112] The detection module 700 is used to detect moving objects in a video frame sequence using the moving object detection model.

[0113] It should be noted that other specific implementations of the moving object detection device based on multi-directional gradient suppression in this embodiment can be found in the specific implementations of the moving object detection method based on multi-directional gradient suppression described above. To avoid redundancy, they will not be repeated here.

[0114] Example 3

[0115] This application relates to a computer-readable storage medium in Embodiment 3, which is used for program code executed by a device, the program code including steps for performing a method as described in any implementation of Embodiment 1 of this application;

[0116] The computer-readable storage medium may be a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM); the computer-readable storage medium may store program code, and when the program stored in the computer-readable storage medium is executed by a processor, the processor is used to perform the steps of the method in any of the implementations of Embodiment 1 of this application.

[0117] Example 4

[0118] like Figure 3 As shown, an electronic device according to Embodiment 4 of this application includes a processor, a memory, and a program or instructions stored in the memory and executable on the processor. When the program or instructions are executed by the processor, they implement the method in any of the implementations in Embodiment 1 of this application.

[0119] The processor can be a general-purpose central processing unit (CPU), microprocessor, application-specific integrated circuit (ASIC), graphics processing unit (GPU), or one or more integrated circuits, used to execute related programs to implement the method in any of the implementations of Embodiment 1 of this application.

[0120] The processor can also be an integrated circuit electronic device with signal processing capabilities. In implementation, each step of the method in any of the implementations of Embodiment 1 of this application can be completed by the integrated logic circuitry in the processor's hardware or by software instructions.

[0121] The aforementioned processor can also be a general-purpose processor, digital signal processor, application-specific integrated circuit (ASIC), field-programmable gate array (FPGA), or other programmable logic device, discrete gate or transistor logic device, or discrete hardware component. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly embodied in the execution of a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software modules can be located in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. The storage medium is located in memory; the processor reads information from the memory and, in conjunction with its hardware, completes the functions required by the units included in the data processing apparatus of the embodiments of this application, or executes the methods in any implementation of Embodiment 1 of this application.

[0122] The above are merely preferred embodiments of this application; however, the scope of protection of this application is not limited thereto. Any equivalent substitutions or modifications made by those skilled in the art within the scope of the technology disclosed in this application, based on the technical solution and its improved concept, should be covered within the scope of protection of this application.

Claims

1. A moving object detection method based on multi-directional gradient suppression, characterized in that, include: Acquire the video frame sequence to be detected and perform preprocessing; Calculate the gradient of each pixel in the four directions (up, down, left, and right) of each image in the video frame sequence; Background suppression is performed on the gradient in the four directions (up, down, left, and right) of each pixel using a preset background suppression formula; The suppressed gradient features of the four directions are fused to obtain a fused gradient energy map; The fused gradient energy map is stitched together with the three channels of the image to obtain a four-channel feature map; The four-channel feature maps are input into a neural network model for training to obtain a moving object detection model. The moving object detection model described above is used to detect moving objects in a video frame sequence.

2. The moving object detection method based on multi-directional gradient suppression according to claim 1, characterized in that, The preprocessing includes: Gaussian filtering is used to remove noise from the images in the video frame sequence; Identify whether an image in a video frame sequence is in color; if the image is in color, convert it to grayscale.

3. The moving object detection method based on multi-directional gradient suppression according to claim 1, characterized in that, The gradient calculation formula for each pixel (i, j) in each image of the video frame sequence is as follows: in, The gradient is in the north direction. The gradient is in the south direction. The gradient is in the east direction. Let be the gradient in the west direction, med() be the median function, and s be the step size of the gradient calculation window.

4. The moving object detection method based on multi-directional gradient suppression according to claim 3, characterized in that, The preset background suppression formula is: in, The gradient after background suppression. The input gradient is given by EXP(), the natural exponential function is given by K, the exponential adjustment parameter is given by T, which controls the suppression strength in the low gradient region, and the quadratic adjustment parameter is given by T, which limits the influence of abnormal high gradient noise.

5. The moving object detection method based on multi-directional gradient suppression according to claim 4, characterized in that, The formula for calculating the fusion of the four-directional gradient features after suppression is as follows: Where D(I) is the fusion result, and ▏▏ is the absolute value operation. The northward gradient after background suppression. The hard-direction gradient after background suppression. The gradient in the eastward direction after background suppression. The gradient in the west direction after background suppression.

6. The moving object detection method based on multi-directional gradient suppression according to claim 5, characterized in that, The formula for calculating the three-channel stitching of the gradient energy map and the image is as follows: Among them, I 4ch For a four-channel feature map, I R For the R channel feature map, I G For the G channel feature map, I B Let B be the feature map and D(I) be the fused gradient energy map.

7. The moving object detection method based on multi-directional gradient suppression according to any one of claims 1-6, characterized in that, The four-channel feature maps are input into a neural network model for training to obtain a moving object detection model, including: Construct a training dataset and label the specific locations of moving objects in the four-channel feature map; Construct a neural network model based on Retinaface; The training dataset is input into the neural network model, and the neural network model is trained using classification loss and location loss functions; If the loss function converges, training ends and a moving object detection model is obtained.

8. A moving object detection device based on multi-directional gradient suppression, characterized in that, include: The acquisition module is used to acquire the video frame sequence to be detected and perform preprocessing. The gradient calculation module is used to calculate the gradient of each pixel in the video frame sequence in the four directions of up, down, left, and right. The background suppression module is used to suppress the background gradient of each pixel in the four directions of up, down, left, and right using a preset background suppression formula. The feature fusion module is used to fuse the suppressed gradient features in four directions to obtain a fused gradient energy map. The stitching module is used to stitch the fused gradient energy map with the three channels of the image to obtain a four-channel feature map; The model training module is used to input the four-channel feature map into the neural network model for training to obtain a moving object detection model. The detection module is used to detect moving objects in a video frame sequence using the moving object detection model.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium is for program code executed by the device, the program code including steps for performing the method as described in any one of claims 1-7.

10. An electronic device, characterized in that, The electronic device includes a processor, a memory, and a program or instructions stored in the memory and executable on the processor, wherein the program or instructions, when executed by the processor, implement the method as described in any one of claims 1-7.