Method and apparatus for detecting pasting behavior, electronic device, and medium
By combining scene semantic segmentation and pixel-level change detection with dynamic block division and feature matching, the problem of low efficiency, high resource consumption and insufficient accuracy in posting behavior detection in existing technologies is solved, and high-precision, low-resource-consumption posting behavior detection is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-02-02
- Publication Date
- 2026-05-29
AI Technical Summary
Existing technologies for detecting posting behavior are characterized by low efficiency, high resource consumption, insufficient detection accuracy, and poor adaptability. They are unable to adapt to the automatic identification of posting carriers in complex scenarios and feature extraction is limited, leading to false detections and resource waste.
The system automatically determines the posting behavior monitoring area through scene semantic segmentation, uses pixel-level change detection and background modeling and updating, dynamically segments the data, extracts texture and color features, and matches them with a preset feature library. It then combines the feature change magnitude and duration to determine whether there is a target posting behavior.
It improves the intelligence and adaptability of the detection area, enhances the detection accuracy and anti-interference ability of suspicious areas, reduces resource consumption, significantly improves the accuracy of posting behavior detection, and reduces false judgments.
Smart Images

Figure CN122115826A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data analysis and processing technology, specifically to a posting behavior detection method, device, electronic device, and storage medium. Background Technology
[0002] With the continuous evolution of video security technology, traditional video surveillance technology is gradually becoming more intelligent and addressing social issues more deeply, promoting harmonious social development. In scenarios such as urban management, community security, and commercial establishment maintenance, illegal posting of advertisements, posters, and notices not only affects the aesthetics of the environment but may also involve issues such as false advertising and the dissemination of illegal information. Therefore, accurate and efficient detection of such posting activities is of significant practical importance.
[0003] In existing technologies, posting behavior detection mainly adopts two methods: one is through manual inspection, which relies on staff to periodically check designated areas. This method is inefficient, labor-intensive, and difficult to achieve real-time monitoring, and is prone to missed detections and false detections. The other is automated detection based on video surveillance. This method usually first determines whether a tripwire intrusion or area intrusion event has occurred. After successful determination, the posting algorithm is used to analyze the entire video frame data before and after the event to determine whether the target posting behavior exists in the current video screen.
[0004] However, the aforementioned automated detection scheme based on video surveillance has several drawbacks: First, the determination of the detection area relies on manually setting rule boxes, which lacks flexibility and cannot adapt to the automatic identification needs of posting carriers (such as walls, doors, and utility poles) in complex scenarios. It is also difficult to accurately cover irregularly distributed posting areas. Second, the use of fixed-size image blocks for detection does not consider the differences in the degree of pixel change in different areas. For areas with drastic changes, fixing small-sized blocks may lead to insufficient detection accuracy, while fixing large-sized blocks for areas with gentle changes will result in wasted resources. Third, the feature extraction method is singular, relying solely on the comparison of raw video frame data, without fully exploring the key features such as texture and color corresponding to the posting behavior, resulting in low detection accuracy and susceptibility to factors such as changes in lighting and environmental interference. Finally, analyzing the entire video frame data before and after the event requires a huge amount of data processing, leading to high resource consumption of the detection algorithm and making it difficult to deploy in resource-constrained scenarios such as edge devices.
[0005] There are currently no effective solutions to the problems of low efficiency, high resource consumption, insufficient detection accuracy, and poor adaptability in related technologies for detecting posting behavior. Summary of the Invention
[0006] This application provides a posting behavior detection method, electronic device, apparatus, and storage medium to solve the problems of existing posting behavior detection technologies, such as reliance on manually setting detection areas, fixed block division methods, single feature extraction, high resource consumption, and insufficient detection accuracy.
[0007] In a first aspect, embodiments of this application provide a posting behavior detection method, including: Pixel-level change detection is performed on the posting behavior monitoring area in the video frame to identify suspicious areas with continuous pixel changes; wherein, the posting behavior monitoring area is determined by scene semantic segmentation of the video frame, and the pixel-level change detection includes inter-frame difference operation and background modeling update; The suspicious region is dynamically segmented, and the size of the detection sub-blocks is adjusted according to the degree of pixel change within the suspicious region to obtain multiple dynamic detection sub-blocks; Extract the texture and color features of each of the dynamically detected sub-blocks at the start and end of the change; The texture and color features are matched with a preset posting behavior feature library, and the magnitude and duration of feature changes are combined to determine whether the target posting behavior exists within the posting behavior monitoring area.
[0008] Optionally, in some embodiments of this application, the step of performing pixel-level change detection on the posting behavior monitoring area in the video frame to determine suspicious areas with continuous pixel changes includes: Based on the scene semantic segmentation results of the video footage, preset posting carrier areas such as walls and door panels are selected as the posting behavior monitoring areas; Perform inter-frame difference operation on consecutive video frames within the posting behavior monitoring area to obtain a pixel change mask map; Background modeling is performed using a Gaussian mixture model and updated in real time. The pixel change mask image is then filtered to identify regions where the number of consecutive pixel changes exceeds a preset threshold as suspicious regions.
[0009] Optionally, in some embodiments of this application, the dynamic segmentation of the suspicious region, adjusting the size of the detection sub-blocks according to the drastic changes in pixels within the suspicious region to obtain multiple dynamic detection sub-blocks, includes: Calculate the gradient value of each pixel within the suspected region, and calculate the average gradient of each sub-region. If the average gradient of a sub-region is greater than the first preset gradient threshold, then the sub-region is divided into a dynamic detection sub-block of the first size. If the average gradient of a sub-region is between a second preset gradient threshold and a first preset gradient threshold, then the sub-region is divided into a dynamic detection sub-block of the second size; wherein the first size is smaller than the second size. If the average gradient of a sub-region is less than the second preset gradient threshold, then the sub-region is merged with the adjacent sub-region and divided into a dynamic detection sub-block of the third size; the third size is greater than the second size.
[0010] Optionally, in some embodiments of this application, the detection frequency of the pixel-level change detection of the posting behavior monitoring area in the video frame is a portion of the current video frame rate, and each detection includes at least one keyframe data.
[0011] Optionally, in some embodiments of this application, the detection frequency of the pixel-level change detection of the posting behavior monitoring area in the video frame is a portion of the current video frame rate, and each detection includes at least one keyframe data.
[0012] Optionally, in some embodiments of this application, after determining whether a target posting behavior exists within the posting behavior monitoring area, the method further includes: If it is determined that there is a target posting behavior within the posting behavior monitoring area, the features of the dynamic detection sub-block in the video frames within a preset time range after the change stabilizes are continuously monitored. If the feature change amplitude is less than the preset stabilization threshold, it is confirmed that there is no false judgment; if the feature change amplitude is greater than the preset stabilization threshold, it is determined to be a false judgment.
[0013] Secondly, embodiments of this application provide a posting behavior detection device, comprising: The determination module is used to perform pixel-level change detection on the posting behavior monitoring area in the video frame and determine suspicious areas with continuous pixel changes; wherein, the posting behavior monitoring area is determined by scene semantic segmentation of the video frame, and the pixel-level change detection includes inter-frame difference operation and background modeling update; The processing module is used to dynamically divide the suspicious area into blocks and adjust the size of the detection sub-blocks according to the degree of pixel change in the suspicious area to obtain multiple dynamic detection sub-blocks. The extraction module is used to extract the texture and color features of each of the dynamically detected sub-blocks at the start and end of the change. The detection module is used to match texture features and color features with a preset posting behavior feature library, and combine the feature change amplitude and change duration to determine whether there is a target posting behavior in the posting behavior monitoring area.
[0014] Accordingly, this application also provides an electronic device, including a memory, a processor, and a processor program stored in the memory and executable on the processor, wherein the processor executes the program as described in any of the methods above.
[0015] This application also provides a storage medium storing a processor program that, when executed by a processor, implements any of the methods described above.
[0016] This application provides a posting behavior detection method, apparatus, electronic device, and storage medium. It performs pixel-level change detection on a posting behavior monitoring area in a video frame to identify suspicious areas with continuous pixel changes. The posting behavior monitoring area is determined through scene semantic segmentation of the video frame, and the pixel-level change detection includes inter-frame difference operations and background modeling updates. The suspicious areas are dynamically segmented, and the size of the detection sub-blocks is adjusted according to the intensity of pixel changes within the suspicious areas to obtain multiple dynamic detection sub-blocks. Then, the texture and color features of each dynamic detection sub-block are extracted at the start and end of the change. Finally, the texture and color features are matched with a preset posting behavior feature library, combining the feature change amplitude and change duration... The posting behavior detection scheme provided in this application determines whether a target posting behavior exists within the posting behavior monitoring area after a certain period of time. By automatically determining the monitoring area through scene semantic segmentation, the scheme eliminates the need for manual rule box setting, improving the intelligence and adaptability of the detection area determination. Pixel-level change detection is used to accurately locate suspicious areas, and combined with inter-frame difference operations and background modeling updates, the accuracy and anti-interference capability of suspicious area detection are improved. Dynamic block division based on the intensity of pixel changes achieves reasonable allocation of detection resources and reduces resource consumption caused by invalid data processing. Texture and color features are extracted and matched with a preset feature library, while also considering the magnitude and duration of feature changes, significantly improving the accuracy of posting behavior detection and effectively reducing false positives. This application can reduce algorithm resource consumption while ensuring detection accuracy, adapting to the posting behavior detection needs in complex scenarios. Attached Figure Description
[0017] 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.
[0018] Figure 1 This is an application scenario diagram of the posting behavior detection method provided in the embodiments of this application; Figure 2This is a flowchart illustrating the posting behavior detection method provided in an embodiment of this application; Figure 3 This is a schematic diagram of the posting behavior detection device provided in the embodiments of this application; Figure 4 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0019] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0020] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, components, features, and elements with the same names in different embodiments of this application may have the same meaning or different meanings, the specific meaning of which must be determined by its interpretation in that specific embodiment or further in conjunction with the context of that specific embodiment.
[0021] It should be understood that the specific embodiments described herein are merely illustrative of this application and are not intended to limit this application.
[0022] In the following description, the use of suffixes such as "module," "part," or "unit" to denote elements is solely for the purpose of illustrative purposes and has no specific meaning in itself. Therefore, "module," "part," or "unit" may be used interchangeably.
[0023] The following describes in detail the embodiments involved in this application. It should be noted that the order of description of the embodiments in this application is not intended to limit the priority of the embodiments.
[0024] This application provides a posting behavior detection method, apparatus, storage medium, and smart terminal. Specifically, the posting behavior detection method of this application can be executed by a smart terminal or a server, wherein the smart terminal can be a terminal. The terminal can be a smartphone, tablet computer, laptop computer, touch screen, game console, personal computer (PC), personal digital assistant (PDA), or other smart terminal. The terminal may also include a client, which can be a media playback client or a real-time posting behavior detection client, etc.
[0025] This application provides a method for detecting posting behavior, which can be executed by an electronic device or a server. This application example illustrates the method using an electronic device. The electronic device includes a touchscreen display and a processor. The touchscreen display is used to present a graphical user interface (GUI) and receive user commands applied to the GUI. When the user operates the GUI via the touchscreen display, the GUI can control local content on the electronic device or control content on the server side in response to the received commands.
[0026] The posting behavior detection scheme provided in this application automatically determines the posting behavior monitoring area through scene semantic segmentation, eliminating the need for manual rule box setting and improving the intelligence and adaptability of detection area determination. It employs pixel-level change detection to accurately locate suspicious areas, and combines inter-frame difference operations with background modeling updates to improve the accuracy and anti-interference capability of suspicious area detection. Dynamic block segmentation based on the intensity of pixel changes achieves reasonable allocation of detection resources and reduces resource consumption caused by processing invalid data. Extracting texture and color features and matching them with a preset feature library, while also considering the magnitude and duration of feature changes, significantly improves the accuracy of posting behavior detection and effectively reduces false positives. This application can reduce algorithm resource consumption while ensuring detection accuracy and adapt to the posting behavior detection needs in complex scenarios.
[0027] Figure 1 This is an application scenario diagram of the posting behavior detection method provided in the embodiments of this application. For example... Figure 1As shown, both server a and video capture device b can transmit data via a network. Video capture device b is used to capture video data of the currently captured scene and transmit it to server a. After receiving the video data, server a executes the posting behavior detection method provided in this embodiment: determining the posting behavior monitoring area through scene semantic segmentation, performing pixel-level change detection on the area to obtain suspicious areas, dynamically dividing the suspicious areas into blocks and extracting features, and determining whether target posting behavior exists based on feature matching and change parameters. Server a can be implemented by a standalone server or a server cluster composed of multiple servers. Video capture device b can be a camera, mobile phone, tablet computer, or other device with video shooting capabilities, and can be deployed in scenarios requiring posting behavior control, such as streets, residential areas, shopping malls, and office buildings. The following sections provide detailed descriptions of each example. It should be noted that the order in which the embodiments are described is not intended to limit the priority of the embodiments.
[0028] A posting behavior detection method includes: performing pixel-level change detection on a posting behavior monitoring area in a video frame to identify suspicious areas with continuous pixel changes; wherein the posting behavior monitoring area is determined by scene semantic segmentation of the video frame, and the pixel-level change detection includes inter-frame difference operation and background modeling update; dynamically segmenting the suspicious areas, adjusting the size of the detection sub-blocks according to the intensity of pixel changes within the suspicious areas to obtain multiple dynamic detection sub-blocks; extracting texture features and color features of each dynamic detection sub-block at the start and end of the change; matching the texture features and color features with a preset posting behavior feature library, and combining the feature change amplitude and change duration to determine whether a target posting behavior exists within the posting behavior monitoring area.
[0029] Please see Figure 2 , Figure 2 This application provides a flowchart illustrating the posting behavior detection method. The specific process of this posting behavior detection method is as follows: Step S100: Pixel-level change detection is performed on the posting behavior monitoring area in the video frame to identify suspicious areas with continuous pixel changes; wherein, the posting behavior monitoring area is determined by scene semantic segmentation of the video frame, and the pixel-level change detection includes inter-frame difference operation and background modeling update.
[0030] Specifically, in traditional posting behavior detection, the monitoring area needs to be manually delineated using rule boxes, which is inefficient and lacks adaptability, failing to cope with the diverse distribution of posting carriers in complex scenarios. This application uses scene semantic segmentation technology to automatically identify carrier areas in video footage that meet the posting conditions, using these areas as the posting behavior monitoring areas, eliminating the need for manual intervention and significantly improving the intelligence level of the detection.
[0031] Scene semantic segmentation is one of the core technologies in computer vision. Its purpose is to assign a semantic category label (such as wall, door, ground, sky, pedestrian, vehicle, etc.) to each pixel in an image. In this application, existing semantic segmentation models (such as FCN, U-Net, SegNet, DeepLab series models, etc.) can be used to process video frames to obtain pixel-level semantic segmentation results. To ensure a balance between segmentation accuracy and real-time performance, lightweight semantic segmentation models (such as MobileNet+U-Net, EfficientNet+DeepLabV3+, etc.) can be preferentially selected, which are suitable for deployment on edge computing devices.
[0032] After obtaining the semantic segmentation results, the areas corresponding to the preset posting carrier categories are selected as posting behavior monitoring areas. Posting carriers refer to object surfaces that meet the physical conditions for posting, commonly including walls (such as brick walls, cement walls, plaster walls, etc.), door panels (such as apartment building unit doors, office building doors, shop doors, etc.), utility poles, the back of billboards, bus stop walls, etc. Users can customize the list of posting carrier categories according to the actual application scenario. For example, in a residential community scenario, "walls," "door panels," and "blank areas of bulletin boards" can be listed as posting carriers; in a street scenario, "walls," "utility poles," and "bus stop walls" can be listed as posting carriers.
[0033] After determining the posting behavior monitoring area, pixel-level change detection is performed on this area. The purpose is to capture pixel changes occurring within the area, thereby locating suspicious areas where posting behavior may occur. Pixel-level change detection includes two core steps: inter-frame difference calculation and background modeling update. Combining these two steps can effectively improve the accuracy of change detection and reduce the impact of environmental interference such as lighting fluctuations and slight jitter.
[0034] The core idea of inter-frame difference operation is to identify moving or changing regions by comparing pixel differences between consecutive video frames. The specific implementation process is as follows: Select two or more consecutive video frames (e.g., frame t and frame t+1), and perform difference operations on the corresponding pixels within the posting behavior monitoring area. For grayscale images, the difference operation can be represented as: D (x,y) = |I_t (x,y) - I_{t+1}(x,y)| Where I_t(x,y) represents the gray value of frame t at coordinate (x,y), I_{t+1}(x,y) represents the gray value of frame t+1 at coordinate (x,y), and D(x,y) represents the gray difference result between the two frames at that coordinate.
[0035] For color images, they can be converted to grayscale images first and then the difference operation can be performed, or the difference operation can be performed on the three RGB channels separately and the maximum value can be taken as the final difference result.
[0036] After obtaining the difference results, a difference threshold T is set, and D(x,y) is binarized: if D(x,y)≥T, the pixel is determined to be a changed pixel and marked as 1; if D(x,y)<T, the pixel is determined to be an unchanged pixel and marked as 0. The pixel change mask is obtained through binarization, and the area corresponding to "1" in the mask is the initially identified changed area.
[0037] The differential threshold T needs to be dynamically adjusted according to the actual scene. For example, in a stable indoor scene, T can be 20-30; in an outdoor scene with large changes in lighting, T can be 30-50. To adapt to the lighting conditions of different scenes, an adaptive threshold algorithm (such as the Otsu algorithm) can be used to automatically calculate the differential threshold, further improving the robustness of detection.
[0038] Simply performing inter-frame differencing may result in issues such as "holes" and "ghosting," and it's difficult to distinguish between genuine changes in posting behavior and disruptive changes like lighting fluctuations or swaying leaves. Therefore, this application introduces a background modeling and updating technique. By constructing and updating a background model in real time, the pixel change mask image obtained from inter-frame differencing is optimized and filtered.
[0039] This application employs a Gaussian Mixture Model (GMM) to construct the background model. This model can effectively handle complex background scenes, describing the background features of each pixel through a linear combination of multiple Gaussian distributions, and is suitable for dynamically changing background environments. The core idea of the Gaussian Mixture Model is that the grayscale value variation of each pixel follows a mixture distribution of K Gaussian distributions, where K is typically 3-5. For each pixel (x, y), its probability density function is: P (I (x,y)) = Σ_{k=1 to K} ω_k * N (I (x,y); μ_k, σ_k²) Where ω_k is the weight of the k-th Gaussian distribution, μ_k is the mean, σ_k² is the variance, and N(・) is the probability density function of the normal distribution.
[0040] During model initialization, K Gaussian distributions are initialized for each pixel, with initial mean, variance, and weights set. During model update, for each new frame of video data, the grayscale value of each pixel is matched against the corresponding K Gaussian distributions: if the grayscale value falls within the 2σ_k range of a Gaussian distribution, the pixel is considered a match, and the mean, variance, and weights of that Gaussian distribution are updated (weights increase, while the weights of other Gaussian distributions decrease proportionally); if no Gaussian distribution is matched, a new Gaussian distribution is initialized using the pixel's grayscale value, replacing the Gaussian distribution with the smallest weight.
[0041] After the model is updated, it is sorted according to the weights and variances of the Gaussian distributions. Gaussian distributions with larger weights and smaller variances are more likely to correspond to background pixels. The first B (B is usually 2-3) Gaussian distributions that satisfy ω_k / σ_k ≥ T_bg (T_bg is the background determination threshold) are selected as the background model. For the current pixel, if its gray value falls within the range of the Gaussian distribution corresponding to the background model, it is determined to be a background pixel; otherwise, it is determined to be a foreground pixel (i.e., a changing pixel).
[0042] By using Gaussian mixture model background modeling, the pixel change mask image obtained from inter-frame difference can be filtered to remove false change pixels caused by lighting fluctuations, slight jitter, etc., and retain the real change areas. Subsequently, morphological processing (such as dilation and erosion operations) is performed on the filtered mask image to fill the "holes" in the change areas, eliminate isolated noise points, and obtain a more complete change area.
[0043] Finally, regions with a continuous number of pixel changes exceeding a preset threshold are selected as suspicious regions. The preset threshold can be set based on the minimum size of the posting activity. For example, if the smallest posted object (such as a small advertisement) is 5cm × 8cm, the corresponding number of pixels in a video frame is 100 × 160 = 16000, then the preset threshold can be set to 16000. If the number of pixels within a connected region of change is ≥16000, it is determined to be a suspicious region; if the number of pixels is <16000, it is determined to be an invalid region of change (such as dust, stains, etc.) and is excluded.
[0044] Step S200: Dynamically divide the suspicious area into blocks and adjust the size of the detection sub-blocks according to the degree of pixel change in the suspicious area to obtain multiple dynamic detection sub-blocks.
[0045] Specifically, existing technologies typically divide the detection region using fixed-size image blocks. This approach has significant drawbacks: for regions with drastic pixel changes (such as the edges of objects or areas with strong color contrast), fixed-size blocks may not fully cover the changing features, leading to incomplete feature extraction; for regions with gradual pixel changes (such as the interior of objects or areas with uniform color), fixed-size blocks contain excessive redundant information, increasing data processing volume and resource consumption. This application proposes a dynamic block segmentation strategy that adaptively adjusts the size of detection sub-blocks based on the degree of pixel change within the suspicious region, achieving an optimized balance between detection accuracy and resource consumption.
[0046] The specific steps of dynamic block processing are as follows: The first step is to calculate the gradient value of each pixel within the suspected region. The gradient value quantifies the severity of pixel changes; a larger gradient value indicates a more drastic change at that pixel. This application uses the Sobel operator to calculate the pixel gradient. The Sobel operator is a commonly used edge detection operator that calculates the gradient magnitude and direction by measuring the grayscale change rate of a pixel in the horizontal and vertical directions.
[0047] The horizontal convolution kernel Gx and the vertical convolution kernel Gy of the Sobel operator are respectively: Gx = [[-1, 0, 1], [-2, 0, 2], [-1, 0, 1]] Gy = [[-1, -2, -1], [0, 0, 0], [1, 2, 1]] For each pixel (x, y) within the suspicious region, convolve Gx and Gy over its 3×3 neighborhood to obtain the horizontal gradient value Gx(x, y) and the vertical gradient value Gy(x, y). The magnitude of the gradient change for that pixel is then: G (x,y) = √(Gx (x,y)² + Gy (x,y)²) To simplify the calculation, an approximate formula can also be used: G(x,y) = |Gx(x,y)| + |Gy(x,y)|.
[0048] The average gradient of change for each sub-region is calculated. First, the suspicious region is divided into several initial sub-regions. The size of the initial sub-regions can be set according to the resolution of the video frame and the size of the suspicious region, for example, 32×32 pixels. For each initial sub-region, the average gradient of change of all pixels within the region is calculated as the average gradient of change for that sub-region.
[0049] The size of the sub-region is adjusted based on the average gradient change to obtain a dynamic detection sub-block. Two preset gradient thresholds are set: a first preset gradient threshold G1 and a second preset gradient threshold G2, where G1 > G2. Based on the relationship between the average gradient change of the sub-region and the two thresholds, detection sub-blocks of different sizes are used. If the average gradient of the sub-region G_avg > G1, it indicates that the pixel changes within the sub-region are drastic and may contain key features such as the edges of the posted object, text, or patterns. A smaller detection sub-block (first size) is needed for fine detection to fully capture these key features. The first size can be set to 16×16 pixels or 24×24 pixels; for example, it is set to 16×16 pixels in this embodiment.
[0050] If the average gradient of the sub-region G2 ≤ G_avg ≤ G1, it indicates that the pixel change within the sub-region is moderate, and a medium-sized detection sub-block (second size) is sufficient to meet the detection requirements. The second size can be set to 32×32 pixels or 48×48 pixels, for example, it is set to 32×32 pixels in this embodiment.
[0051] If the average gradient of a sub-region G_avg < G2, it indicates that the pixel changes within that sub-region are gradual and the feature information is limited. A larger detection sub-block (third size) can be used for detection to reduce data processing. The third size can be set to 64×64 pixels or 96×96 pixels; for example, it is set to 64×64 pixels in this embodiment. Adjacent sub-regions with extremely small average gradient changes can be merged to form larger detection sub-blocks, further improving detection efficiency.
[0052] The preset gradient thresholds G1 and G2 need to be adjusted according to the actual scene and the characteristics of the object being displayed. For example, in scenes where the object has a complex pattern and clear edges, G1 can be set to 80-100 and G2 to 30-50; in scenes where the object is a solid color and has gentle edges, G1 can be set to 60-80 and G2 to 20-30. Through calibration with a large amount of experimental data, the optimal combination of thresholds can be determined to ensure the rationality of dynamic segmentation.
[0053] Step S300: Extract the texture and color features of each of the dynamically detected sub-blocks at the start and end of the change.
[0054] Specifically, the act of posting essentially involves adding new objects (such as paper or stickers) to the surface of the substrate, a process that causes significant changes in the texture and color features of the substrate surface. Therefore, extracting the texture and color features of the dynamic detection sub-block before and after the change is the core basis for determining whether posting behavior has occurred.
[0055] First, it is necessary to determine the start and stabilize points of the change. The start point of the change refers to the moment when continuous pixel changes first occur within the dynamically detected sub-block; the corresponding video frame is the change initiation frame. The stabilize point of the change refers to the moment when pixel changes within the dynamically detected sub-block cease and the features remain stable; the corresponding video frame is the change stabilize frame. The specific determination method is as follows: Change start time: When the percentage of changed pixels in a certain dynamic detection sub-block exceeds 5% (customizable percentage) in 3 consecutive frames, the first frame of the 3 frames is determined as the change start frame, and the corresponding time is the change start time.
[0056] Stable change moment: When a dynamic detection sub-block undergoes a change, if the percentage of changed pixels is less than 2% (customizable percentage) for 5 consecutive frames after the change occurs, the last frame of those 5 frames is determined to be the stable change frame, and the corresponding moment is the stable change moment.
[0057] After determining the two key moments, the texture and color features of the dynamically detected sub-blocks are extracted in the changing start frame and the changing stable frame, respectively.
[0058] Texture features are the spatial distribution patterns of grayscale or color values in an image, reflecting information such as the roughness and pattern structure of an object's surface. They are important features for distinguishing between the object being posted and the substrate. This application employs two texture feature extraction methods: Local Binary Pattern (LBP) and Gray Level Co-occurrence Matrix (GLCM), combining the advantages of both to enhance feature representation capabilities.
[0059] Local Binary Pattern (LBP) is an efficient texture descriptor with advantages such as rotation invariance and illumination invariance, effectively capturing local texture information of an image. Its core idea is: for each pixel in the image, its gray value is compared with the gray values of its eight neighboring pixels. If the gray value of a neighboring pixel is greater than that of the center pixel, it is marked as 1; otherwise, it is marked as 0, resulting in an 8-bit binary number. This binary number is then converted to decimal, which is the LBP value of the center pixel. By statistically analyzing the distribution of LBP values across all pixels in the image, an LBP histogram is obtained, serving as the texture feature vector.
[0060] To improve the robustness of LBP features, this application employs an extended LBP operator, including rotation-invariant LBP and uniform mode LBP. Rotation-invariant LBP achieves rotation invariance by cyclically shifting a binary number and taking its minimum value; uniform mode LBP only retains patterns where the number of 0-1 transitions in the binary number is ≤2, reducing feature dimensions and improving computational efficiency. In this embodiment, the neighborhood radius of the LBP operator is set to 1, the number of neighboring pixels is 8, and a uniform mode is used, resulting in a final LBP histogram with 59 dimensions (58 uniform modes plus 1 non-uniform mode).
[0061] The Gray-Level Co-occurrence Matrix (GLCM) describes the texture features of an image by statistically analyzing the probability of combinations of gray values between two pixels with fixed distances and orientations. The core idea is to construct a GLCM P(i,j) for a given distance d and orientation θ (e.g., 0°, 45°, 90°, 135°), where P(i,j) represents the number of times two pixels with gray values i and j appear simultaneously at a distance d and orientation θ. Statistical features such as energy, entropy, contrast, and correlation are extracted from the GLCM as texture feature vectors.
[0062] In this embodiment, the gray level is set to 16 levels (the gray values from 0 to 255 are uniformly quantized into 16 levels), the distance d is set to 1, and the direction θ is selected from four directions: 0°, 45°, 90°, and 135°. Four statistical features (energy, entropy, contrast, and correlation) are extracted from each direction, resulting in a total of 16-dimensional GLCM feature vectors.
[0063] The LBP histogram feature vector (59 dimensions) is concatenated with the GLCM statistical feature vector (16 dimensions) to obtain a 75-dimensional texture feature vector, which is used for subsequent matching.
[0064] Color features are among the most intuitive characteristics of an image. There is usually a significant color difference between the object being posted and the posting medium; therefore, color features can effectively assist in determining the posting behavior. Since the RGB color space is sensitive to changes in illumination, this application converts the image to the HSV color space to extract color features. The HSV color space separates hue, saturation, and value. Hue and saturation are more robust to changes in illumination and are more suitable as color features.
[0065] The specific steps for color feature extraction are as follows: The image of the dynamically detected sub-blocks is converted from the RGB color space to the HSV color space. The conversion formula is as follows: For the RGB three-channel values (R, G, B), they are first normalized to the range of [0,1], resulting in r=R / 255, g=G / 255, b=B / 255.
[0066] Calculate the maximum value max(r,g,b) and the minimum value min(r,g,b), then: Brightness V = max (r,g,b) Saturation S = (max(r,g,b) - min(r,g,b)) / max(r,g,b) (when max≠0); S=0 (when max=0) Hue H: If max = r, then H = 60° × ((g - b) / (max - min)) + 0° If max = g, then H = 60° × ((b - r) / (max - min)) + 120° If max = b, then H = 60° × ((r - g) / (max - min)) + 240° If H < 0, then H = H + 360° Statistical features of the three channels—hue (H), saturation (S), and value (V)—are extracted. This application selects three key features: hue mean, saturation variance, and value peak, specifically defined as follows: Hue mean: The average value of all pixel values in the hue channel, reflecting the overall hue tendency of the image.
[0067] Saturation variance: The variance of all pixel values in the saturation channel, reflecting the difference in the vividness of image colors.
[0068] Peak brightness: The brightness value corresponding to the peak value of the grayscale histogram of the brightness channel, reflecting the main brightness level of the image.
[0069] The extracted color features are normalized and mapped to the range [0,1] to eliminate the influence of dimensional differences on subsequent matching. The normalization formula is: F_norm = (F - F_min) / (F_max - F_min) Where F is the original feature value, F_min is the minimum value of the feature in the training samples, F_max is the maximum value of the feature in the training samples, and F_norm is the normalized feature value.
[0070] In the above manner, each dynamic detection sub-block obtains a 75-dimensional texture feature vector and a 3-dimensional color feature vector at the start of the change and at the stable time of the change, respectively. The two are then concatenated to form a 78-dimensional comprehensive feature vector, which is used for subsequent feature matching.
[0071] Step S400: Match the texture features and color features with the preset posting behavior feature library, and combine the feature change amplitude and change duration to determine whether there is a target posting behavior in the posting behavior monitoring area.
[0072] Specifically, the pre-defined posting behavior feature library is a feature set built based on a large amount of posting behavior sample data. It contains feature vectors of different types of posting materials (such as paper advertisements, plastic stickers, and spray-painted posters) on different posting carriers (such as walls, doors, and utility poles). The feature library is constructed as follows: Collect sample data on posting behavior: Collect video data of various posting objects being posted on different carriers under different scenes and lighting conditions, extract comprehensive feature vectors at the start and end of the change, and form a sample feature set. The number of samples must meet the statistical significance requirement, usually no less than 1000 sets.
[0073] Cluster analysis is performed on the sample feature set: The K-means clustering algorithm is used to cluster the sample feature vectors, grouping samples with similar features into one class. The feature vector corresponding to each cluster center is used as the standard feature vector in the preset posting behavior feature library. The number of clusters K is set according to the number of types of posted items. For example, if there are 5 types of posted items, then K=5.
[0074] Calculate the confidence interval for each standard feature vector: For each cluster, calculate the Euclidean distance between the feature vectors of all samples in the cluster and the cluster center, and take the 95th quantile of the distance as the confidence radius. The cluster center and the confidence radius together constitute the confidence interval of the standard feature vector.
[0075] The feature matching process uses Euclidean distance as a similarity metric; the smaller the Euclidean distance, the higher the similarity between the feature vector to be matched and the standard feature vector. The specific matching steps are as follows: Calculate the Euclidean distance between the composite feature vector (F_stable) of the dynamically detected sub-block at the stable moment of change and each standard feature vector (F_std) in the preset posting behavior feature library: Dist = √(Σ_{i=1 to n} (F_stable (i) - F_std (i))²) Where n is the feature vector dimension (n=78 in this embodiment), F_stable(i) is the i-th component of the feature vector to be matched, and F_std(i) is the i-th component of the standard feature vector.
[0076] If there exists a standard feature vector whose Euclidean distance Dist to the feature vector to be matched is less than or equal to the confidence radius of the standard feature vector, then the feature vector to be matched is determined to be a successful match with the standard feature vector; otherwise, the match is determined to be a failure.
[0077] Feature matching alone may lead to misjudgments, such as misidentifying stains or scratches on the carrier surface as affixing. Therefore, this application combines two auxiliary judgment indicators, the magnitude of feature change and the duration of the change, to further improve the accuracy of detection.
[0078] The magnitude of feature change is used to quantify the degree of feature difference between dynamically detected sub-blocks before and after a change. The greater the difference, the higher the probability of posting behavior. The magnitude of feature change is measured by calculating the cosine similarity between the comprehensive feature vector at the start of the change (F_start) and the comprehensive feature vector at the stable point of the change (F_stable). The closer the cosine similarity is to 0, the greater the magnitude of feature change; the closer it is to 1, the smaller the magnitude of feature change. The formula for calculating the cosine similarity is: Sim = (F_start・F_stable) / (||F_start|| × ||F_stable||) Where F_start・F_stable is the dot product of the two feature vectors, ||F_start|| is the L2 norm of F_start, and ||F_stable|| is the L2 norm of F_stable.
[0079] Set a threshold for the magnitude of feature change, Sim_th (e.g., 0.5). If Sim < Sim_th, the magnitude of feature change is determined to meet the requirements for posting behavior; if Sim ≥ Sim_th, the magnitude of feature change is determined not to meet the requirements, and the possibility of posting behavior is excluded.
[0080] The duration of a change refers to the time interval from the start of the change to its stabilization. Posting is a physical process with a certain duration (such as applying glue or pasting paper), typically lasting more than 5 seconds; while spurious changes (such as sudden changes in light or brief obstruction by an object) usually have a shorter duration, generally less than 2 seconds. Therefore, a duration threshold T_th (e.g., 5 seconds) is set. If the duration T ≥ T_th, the duration is considered to meet the requirements for posting; if T < T_th, the duration is considered not to meet the requirements, and the possibility of posting is excluded.
[0081] Based on three indicators—feature matching results, feature change magnitude, and change duration—the following judgment rules are established: If feature matching is successful, feature change magnitude Sim < Sim_th and change duration T ≥ T_th, then it is determined that there is target posting behavior within the posting behavior monitoring area. If any one of the above three conditions is not met, it is determined that there is no target posting behavior.
[0082] The targeted posting behavior includes, but is not limited to, posting paper advertisements, plastic stickers, spray-painted posters, and other behaviors that add foreign objects to the surface of a carrier. Based on the standard feature vector category corresponding to the feature matching results, the specific type of posting behavior (such as commercial advertisements, small advertisements, notices, etc.) can be further determined, providing a basis for subsequent management and disposal.
[0083] In related technologies, the use of fixed block segmentation, full-frame data processing, and single feature extraction results in high detection resource consumption, low accuracy, and poor adaptability. This application automatically determines the monitoring area through scene semantic segmentation, accurately locates suspicious areas through pixel-level change detection, optimizes resource allocation through dynamic block segmentation, enhances representation capabilities through texture and color features, and reduces the false positive rate by combining multiple indicators. It effectively solves the shortcomings of existing technologies and achieves efficient, accurate, and adaptive posting behavior detection.
[0084] In one embodiment, based on the above step S100, pixel-level change detection is performed on the posting behavior monitoring area in the video frame to determine suspicious areas with continuous pixel changes. The posting behavior detection method of this application further includes the following steps: Based on the scene semantic segmentation results of the video footage, preset posting carrier areas such as walls and door panels are selected as the posting behavior monitoring areas; Perform inter-frame difference operation on consecutive video frames within the posting behavior monitoring area to obtain a pixel change mask map; Background modeling is performed using a Gaussian mixture model and updated in real time. The pixel change mask image is then filtered to identify regions where the number of consecutive pixel changes exceeds a preset threshold as suspicious regions.
[0085] Specifically, scene semantic segmentation is the core technology for automatically determining the area to be monitored for posting behavior, and its accuracy directly affects the performance of subsequent detection. To further improve the accuracy of semantic segmentation, this application employs transfer learning to fine-tune the pre-trained semantic segmentation model. For example, using EfficientNet-B3 pre-trained on the ImageNet dataset as the backbone network, combined with the decoder structure of DeepLabV3+, fine-tuning is performed on a custom posting carrier semantic segmentation dataset. The custom dataset contains video frames from different scenes, labeled with posting carrier categories such as walls, doors, and utility poles. Data augmentation (such as random cropping, flipping, and brightness adjustment) is used to expand the dataset size and improve the model's generalization ability.
[0086] In inter-frame difference operations, to reduce the impact of lighting changes, a three-frame difference method can be used instead of a two-frame difference method. The three-frame difference method selects three consecutive video frames (frame t-1, frame t, and frame t+1), calculates the difference between frame t and frame t-1, and between frame t+1 and frame t, respectively, and then performs a logical AND operation on the two difference results to obtain the final pixel change mask. The three-frame difference method can effectively suppress spurious changes caused by slow changes in lighting, improving the accuracy of change detection.
[0087] The background update rate of the Gaussian mixture model can be dynamically adjusted. For example, in scenes with stable lighting, a slower update rate (e.g., α=0.001) can be set to avoid excessive fluctuations in the background model; in scenes with large lighting changes, a faster update rate (e.g., α=0.01) can be set to allow the background model to quickly adapt to environmental changes. The update rate α is used to control the update magnitude of the mean and variance. The formula for updating the mean is μ_k = (1 - α)μ_k + αI(x,y), and the formula for updating the variance is σ_k² = (1 - α)σ_k² + α(I(x,y) - μ_k)².
[0088] When filtering a pixel variation mask, in addition to morphological dilation and erosion operations, median filtering can also be used to remove isolated noise points. The window size for median filtering can be set to 3×3 or 5×5. By replacing the median of the pixels within the window, salt-and-pepper noise can be effectively suppressed while preserving edge information of the variation area.
[0089] When filtering suspicious areas, in addition to considering the number of consecutive pixel changes, the shape characteristics of the changing area can also be considered. Posted objects are usually rectangular or approximately rectangular in shape, so the rectangularity of the changing area can be calculated (rectangularity = area / area of minimum bounding rectangle). If the rectangularity is ≥0.7 (a custom threshold can be defined), the area is further confirmed as a suspicious area; if the rectangularity is <0.7, it is judged as an irregular changing area (such as stains, scratches, etc.) and excluded. Filtering by shape features can further improve the accuracy of locating suspicious areas.
[0090] In one embodiment, based on the above step S200, the suspicious area is dynamically segmented into blocks, and the size of the detection sub-blocks is adjusted according to the degree of pixel change within the suspicious area to obtain multiple dynamic detection sub-blocks. The posting behavior detection method of this application further includes the following steps: Calculate the gradient value of each pixel within the suspected region, and calculate the average gradient of each sub-region. If the average gradient of a sub-region is greater than the first preset gradient threshold, then the sub-region is divided into a dynamic detection sub-block of the first size. If the average gradient of a sub-region is between a second preset gradient threshold and a first preset gradient threshold, then the sub-region is divided into a dynamic detection sub-block of the second size; wherein the first size is smaller than the second size. If the average gradient of a sub-region is less than the second preset gradient threshold, then the sub-region is merged with the adjacent sub-region and divided into a dynamic detection sub-block of the third size; the third size is greater than the second size.
[0091] Specifically, when calculating pixel gradient values, in addition to the Sobel operator, the Canny edge detection operator can also be used. The Canny operator, through steps such as Gaussian filtering to smooth the image, calculating gradient magnitude and direction, non-maximum suppression, and double threshold detection, can obtain more accurate edge gradient information. This application can use the fused gradient values of the Sobel and Canny operators to improve the accuracy of gradient calculation. The fusion formula is: G_fuse = 0.6×G_Sobel + 0.4×G_Canny Where G_Sobel is the gradient value calculated by the Sobel operator, G_Canny is the gradient value calculated by the Canny operator, and G_fuse is the fused gradient value.
[0092] When calculating the average gradient change for each sub-region, a trimmed mean can be used instead of a regular mean to avoid the influence of outliers. The trimmed mean is calculated by removing the top 5% and bottom 5% of pixels within each sub-region from the gradient values, and then calculating the mean of the remaining 90% of pixels. Trimming the mean effectively suppresses the interference of extreme values on the average gradient change, making the gradient statistics more robust.
[0093] The size adjustment of dynamically detected sub-blocks can employ an adaptive step-size strategy. For example, the step size between the first, second, and third sizes can be dynamically adjusted based on the video frame resolution. For video frames with a resolution of 1920×1080, the step size can be set to 32 pixels; for video frames with a resolution of 1280×720, the step size can be set to 24 pixels. This adaptive step size ensures that dynamic segmentation achieves optimal results in videos with different resolutions.
[0094] For the merged third-size sub-region, if its area exceeds the preset maximum value (e.g., 1024×1024 pixels), it is further divided into multiple third-size sub-blocks to avoid incomplete feature extraction due to excessively large individual sub-blocks. The preset maximum value needs to be determined based on the maximum size of the object being posted to ensure that each individual sub-block can cover the local features of the object.
[0095] In one embodiment, the detection frequency for pixel-level change detection of the posting behavior monitoring area in the video frame is 1 / 2 to 1 / 5 of the current video frame rate, and each detection includes at least one keyframe data.
[0096] Specifically, video frame rate refers to the number of frames per second in a video, with common frame rates being 25fps, 30fps, and 60fps. A detection frequency that is too high will lead to excessive data processing and increased resource consumption; a detection frequency that is too low may miss key changes in the posting behavior, resulting in false negatives. This application sets the detection frequency to 1 / 2 to 1 / 5 of the current video frame rate, for example: When the video frame rate is 25fps, the detection frequency is 5fps-12.5fps, that is, once every 0.08 seconds-0.2 seconds; When the video frame rate is 30fps, the detection frequency is 6fps-15fps, that is, once every 0.067 seconds-0.167 seconds; When the video frame rate is 60fps, the detection frequency is 12fps-30fps, that is, once every 0.033 seconds to 0.083 seconds.
[0097] The detection frequency can be dynamically adjusted according to the scenario. In scenarios with high posting activity (such as commercial streets and areas around schools), a higher detection frequency (such as half the frame rate) is used; in scenarios with low posting activity (such as inside residential areas and office building corridors), a lower detection frequency (such as half the frame rate) is used to achieve a balance between detection efficiency and resource consumption.
[0098] Keyframe data refers to frames in a video that can completely represent scene information, such as I-frames in H.264 and H.265 encoding. I-frames use intra-frame coding and can be decoded independently without relying on other frames, containing complete image information. Each detection includes at least one keyframe, ensuring that pixel-level change detection is based on complete and accurate image information, avoiding image distortion caused by relying on predicted frames such as P-frames and B-frames, and improving the accuracy of change detection.
[0099] If no keyframe is included in the current detection period, the system will automatically wait until the next keyframe appears before performing the detection, or select the highest quality frame from the video frames in the current period (determined by image sharpness evaluation indicators such as variance and entropy) as a replacement keyframe to ensure the reliability of the detection data.
[0100] In one embodiment, based on the above step S300, the texture features and color features of each of the dynamically detected sub-blocks are extracted at the start of the change and at the stable time of the change. The posting behavior detection method of this application further includes the following steps: Extract the texture features of the dynamic detection sub-block from the video frames at the start of the change and the video frames at the stable point of the change; Extract the mean hue, saturation variance, and peak brightness of the dynamic detection sub-block in the video frames at two time points.
[0101] Specifically, during texture feature extraction, to further enhance the discriminative power of the features, Histogram of Oriented Gradients (HOG) features can be introduced. HOG features, by statistically analyzing the gradient orientation histograms of local image regions, can effectively capture the contour information of the image, complementing LBP and GLCM features. In this embodiment, the cell size of the HOG feature is set to 8×8 pixels, the block size to 2×2 cells, and the gradient direction is divided into 9 intervals, resulting in a 36-dimensional HOG feature vector. After concatenating the HOG feature vector with the LBP and GLCM feature vectors, the texture feature vector dimension is expanded to 111 dimensions, further enhancing the feature representation capability.
[0102] When extracting color features, in addition to hue mean, saturation variance, and brightness peak value, two other features can be extracted from the color histogram: the number of peaks and the peak positions. The number of peaks reflects the types of dominant colors in the image, while the peak positions reflect the hue range of the dominant colors. By increasing the dimensions of color features, the color information of the image can be described more comprehensively, improving the accuracy of feature matching.
[0103] To address the impact of lighting variations on color characteristics, a color constancy algorithm can be used for image preprocessing. This algorithm eliminates the influence of lighting changes on image color, restoring the inherent color of objects. This application employs the Gray World Algorithm, whose core idea is to assume that the average grayscale value of all pixels in the image is gray (R=G=B=128), and to adjust the gain of the RGB channels to achieve a preset average grayscale value. The implementation formula for the Gray World Algorithm is as follows: R_new = R × (Gray / R_avg) G_new = G × (Gray / G_avg) B_new = B × (Gray / B_avg) Where R_avg, G_avg, and B_avg are the average grayscale values of the three RGB channels, respectively; Gray is the preset average grayscale value (e.g., 128); and R_new, G_new, and B_new are the adjusted RGB values. Color constancy preprocessing can significantly improve the stability of color features under different lighting conditions.
[0104] In one embodiment, after determining in step S400 whether a target posting behavior exists within the posting behavior monitoring area, the posting behavior detection method of this application further includes the following steps: If it is determined that a target posting behavior exists within the posting behavior monitoring area, the end time of the target posting behavior and the coordinates of the posting area corresponding to the dynamic detection sub-block are recorded.
[0105] Specifically, the end time of the targeted posting behavior is the point at which the change stabilizes. Recording the end time facilitates subsequent tracing and statistical analysis of the posting behavior. For example, it allows for the statistical analysis of the number of posting incidents and peak periods in a specific area within a given timeframe, providing data support for urban management and security control.
[0106] The coordinates of the posting area corresponding to the dynamically detected sub-block refer to the range of pixel coordinates of that sub-block in the original video frame, usually represented by the coordinates of the top-left and bottom-right corners of the sub-block (e.g., (x1, y1, x2, y2)). Recording the posting area coordinates allows for precise location of the posting action, providing navigational support for subsequent on-site handling. For example, by sending the coordinate information to the mobile terminal of the management personnel, they can quickly locate the specific position of the posted object and carry out cleaning or disposal.
[0107] In addition to the end time and posting area coordinates, the following information can also be recorded: Posting behavior type: The type of posting object determined based on feature matching results (such as paper advertisements, plastic stickers, etc.); Posting medium type: The type of medium on which the posting takes place (such as walls, door panels, etc.); Feature matching similarity: The maximum similarity value between the feature vector to be matched and the standard feature vector; Video frame screenshots: Video frame screenshots at the start and stabilization points of the change are retained as evidence of the posting behavior.
[0108] Recorded information can be stored in a local database or cloud server, supporting queries and statistics based on criteria such as time, location, and posting type. To ensure data security and integrity, encrypted storage and backup strategies can be employed, encrypting sensitive information (such as video screenshots) and performing regular data backups to prevent data loss or leakage.
[0109] In one embodiment, after determining in step S400 whether a target posting behavior exists within the posting behavior monitoring area, the posting behavior detection method of this application further includes the following steps: If it is determined that there is a target posting behavior within the posting behavior monitoring area, the features of the dynamic detection sub-block in the video frames within a preset time range after the change stabilizes are continuously monitored. If the feature change amplitude is less than the preset stabilization threshold, it is confirmed that there is no false judgment; if the feature change amplitude is greater than the preset stabilization threshold, it is determined to be a false judgment.
[0110] Specifically, in real-world scenarios, some fraudulent posting behaviors may be mistakenly identified as targeted posting behaviors, for example: The items carried by pedestrians briefly obscure the posting medium, causing pixel changes; Paper, leaves, and other materials temporarily adhere to the surface of a carrier when blown by the wind, and are then blown away by the wind. Temporary changes that occur on the surface of a carrier due to rainwater, stains, etc.
[0111] These false postings share a common characteristic: after the initial change stabilizes, the features change significantly again within a short period (e.g., the obstruction is removed, or the paper is blown away). Therefore, by continuously monitoring the features after the point of stabilization, these false alarms can be effectively identified and eliminated.
[0112] The preset time range needs to be adjusted according to the actual scenario, and is usually set to 30-60 seconds. If the feature change amplitude (cosine similarity) of the dynamically detected sub-block is always less than the preset stability threshold (e.g., 0.1) within the preset time range, it means that the posted object has been stably attached to the carrier surface, and it is confirmed that there is no false judgment; if the feature change amplitude is greater than the preset stability threshold, it means that the change is temporary, and it is judged as a false judgment, and the previous posting behavior judgment result is cancelled.
[0113] During continuous monitoring, the detection frequency can be appropriately reduced, for example, set to 1 / 10 of the current video frame rate, to reduce resource consumption. If the feature change exceeds the preset stability threshold during continuous monitoring, a secondary detection can be triggered immediately to re-extract features and perform matching to further confirm whether it is a false positive.
[0114] This application provides a method for detecting posting behavior. It involves performing pixel-level change detection on a posting behavior monitoring area in a video frame to identify suspicious areas with continuous pixel changes. The posting behavior monitoring area is determined through scene semantic segmentation of the video frame. The pixel-level change detection includes inter-frame difference operations and background modeling updates. The suspicious areas are dynamically segmented, and the size of the detection sub-blocks is adjusted according to the severity of pixel changes within the suspicious areas to obtain multiple dynamic detection sub-blocks. Then, texture and color features of each dynamic detection sub-block are extracted at the start and end of the change. Finally, the texture and color features are matched with a preset posting behavior feature library, and the method combines the feature change amplitude and duration to determine the posting behavior behavior. To determine whether a target posting behavior exists within the posting behavior monitoring area, the posting behavior detection scheme provided in this application automatically determines the monitoring area through scene semantic segmentation, eliminating the need for manual rule box setting and improving the intelligence and adaptability of the detection area determination. Pixel-level change detection is used to accurately locate suspicious areas, and combined with inter-frame difference operations and background modeling updates, the accuracy and anti-interference ability of suspicious area detection are improved. Dynamic block division based on the intensity of pixel changes achieves reasonable allocation of detection resources and reduces resource consumption caused by invalid data processing. Texture and color features are extracted and matched with a preset feature library, while also considering the amplitude and duration of feature changes, significantly improving the accuracy of posting behavior detection and effectively reducing false positives. This application can reduce algorithm resource consumption while ensuring detection accuracy and adapt to the posting behavior detection needs in complex scenarios.
[0115] To facilitate better implementation of the posting behavior detection method of this application embodiment, this application embodiment also provides a posting behavior detection device, wherein the meanings of the terms are the same as those in the posting behavior detection system described above, and specific implementation details can be found in the description of the system embodiment.
[0116] Please see Figure 3 , Figure 3 This is a schematic diagram of the structure of a posting behavior detection device provided in an embodiment of this application. The posting behavior detection device may specifically include a determination module 201, a processing module 202, an extraction module 203, and a detection module 204, as follows: The determination module 201 is used to perform pixel-level change detection on the posting behavior monitoring area in the video frame and determine the suspicious area with continuous pixel changes; wherein, the posting behavior monitoring area is determined by scene semantic segmentation of the video frame, and the pixel-level change detection includes inter-frame difference operation and background modeling update; Processing module 202 is used to dynamically divide the suspicious area into blocks, and adjust the size of the detection sub-blocks according to the degree of pixel change in the suspicious area to obtain multiple dynamic detection sub-blocks; Extraction module 203 is used to extract the texture features and color features of each of the dynamically detected sub-blocks at the start of the change and at the stable time of the change; The detection module 204 is used to match texture features and color features with a preset posting behavior feature library, and combine the feature change amplitude and change duration to determine whether there is a target posting behavior in the posting behavior monitoring area.
[0117] Optionally, in some embodiments of this application, the determining module 201 may specifically be used for: Based on the scene semantic segmentation results of the video footage, preset posting carrier areas such as walls and door panels are selected as the posting behavior monitoring areas; Perform inter-frame difference operation on consecutive video frames within the posting behavior monitoring area to obtain a pixel change mask map; Background modeling is performed using a Gaussian mixture model and updated in real time. The pixel change mask image is then filtered to identify regions where the number of consecutive pixel changes exceeds a preset threshold as suspicious regions.
[0118] Optionally, in some embodiments of this application, the processing module 202 may also be used for: Calculate the gradient value of each pixel within the suspected region, and calculate the average gradient of each sub-region. If the average gradient of a sub-region is greater than the first preset gradient threshold, then the sub-region is divided into a dynamic detection sub-block of the first size. If the average gradient of a sub-region is between a second preset gradient threshold and a first preset gradient threshold, then the sub-region is divided into a dynamic detection sub-block of the second size; wherein the first size is smaller than the second size. If the average gradient of a sub-region is less than the second preset gradient threshold, then the sub-region is merged with the adjacent sub-region and divided into a dynamic detection sub-block of the third size; the third size is greater than the second size.
[0119] This application provides a posting behavior detection device. A determining module 201 performs pixel-level change detection on a posting behavior monitoring area in a video frame, identifying suspicious areas with continuous pixel changes. The posting behavior monitoring area is determined through scene semantic segmentation of the video frame, and the pixel-level change detection includes inter-frame difference operations and background modeling updates. A processing module 202 dynamically segments the suspicious areas, adjusting the size of the detection sub-blocks according to the severity of pixel changes within the suspicious areas to obtain multiple dynamic detection sub-blocks. Next, an extraction module 203 extracts the texture and color features of each dynamic detection sub-block at the start and end of the change. Finally, a detection module 204 matches the texture and color features with a preset posting behavior feature library, combining them with specific data. The posting behavior detection scheme provided in this application determines whether a target posting behavior exists within the posting behavior monitoring area by analyzing the magnitude and duration of feature changes. It automatically determines the monitoring area through scene semantic segmentation, eliminating the need for manual rule box setting and improving the intelligence and adaptability of the detection area determination. Pixel-level change detection accurately locates suspicious areas, and the combination of inter-frame difference operations and background modeling updates enhances the accuracy and anti-interference capability of suspicious area detection. Dynamic block segmentation based on the intensity of pixel changes achieves reasonable allocation of detection resources and reduces resource consumption caused by invalid data processing. Extracting texture and color features and matching them with a preset feature library, while also considering the magnitude and duration of feature changes, significantly improves the accuracy of posting behavior detection and effectively reduces false positives. This application can reduce algorithm resource consumption while ensuring detection accuracy and adapt to the posting behavior detection needs in complex scenarios.
[0120] Furthermore, embodiments of this application also provide an electronic device, such as... Figure 4 As shown, it illustrates a structural schematic diagram of the electronic device involved in the embodiments of this application, specifically: The electronic device may include components such as a processor 301 with one or more processing cores, a memory 302 with one or more processor-readable storage media, a power supply 303, and an input unit 304. Those skilled in the art will understand that... Figure 4The electronic device structure shown does not constitute a limitation on the electronic device and may include more or fewer components than shown, or combine certain components, or have different component arrangements. Wherein: Processor 301 is the control center of the electronic device. It connects various parts of the electronic device via various interfaces and lines. By running or executing software programs and / or modules stored in memory 302, and by calling data stored in memory 302, it performs various functions and processes data, thereby providing overall monitoring of the electronic device. Optionally, processor 301 may include one or more processing cores; preferably, processor 301 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless posting behavior detection. It is understood that the modem processor may not be integrated into processor 301.
[0121] The memory 302 can be used to store software programs and modules. The process 301 executes various functional applications and posting behavior detection methods by running the software programs and modules stored in the memory 302. The memory 302 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, application programs required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 302 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 302 may also include a memory controller to provide the process 301 with access to the memory 302.
[0122] The electronic device also includes a power supply 303 that supplies power to various components. Preferably, the power supply 303 can be logically connected to the processor 301 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. The power supply 303 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.
[0123] The electronic device may also include an input unit 304, which can be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.
[0124] Although not shown, the electronic device may also include a display unit, etc., which will not be described in detail here. Specifically, in the embodiments of this application, the processing 301 in the electronic device loads the executable files corresponding to the processes of one or more applications into the memory 302 according to the following instructions, and the processing 301 runs the applications stored in the memory 302 to realize various functions, as follows: Pixel-level change detection is performed on the posting behavior monitoring area in the video frame to identify suspicious areas with continuous pixel changes. The posting behavior monitoring area is determined through scene semantic segmentation of the video frame, and the pixel-level change detection includes inter-frame difference operation and background modeling update. The suspicious areas are dynamically segmented, and the size of the detection sub-blocks is adjusted according to the severity of pixel changes within the suspicious areas to obtain multiple dynamic detection sub-blocks. Texture and color features of each dynamic detection sub-block are extracted at the start and end of the change. The texture and color features are matched with a preset posting behavior feature library, and the presence of a target posting behavior within the monitoring area is determined by combining the feature change amplitude and duration.
[0125] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.
[0126] This application's embodiments automatically determine the posting behavior monitoring area through scene semantic segmentation, eliminating the need for manual rule box setting and improving the intelligence and adaptability of detection area determination. It employs pixel-level change detection to accurately locate suspicious areas, and combines inter-frame difference operations with background modeling updates to enhance the accuracy and anti-interference capability of suspicious area detection. Dynamic block segmentation based on the intensity of pixel changes achieves reasonable allocation of detection resources, reducing resource consumption caused by invalid data processing. Extracting texture and color features and matching them with a preset feature library, while also considering the magnitude and duration of feature changes, significantly improves the accuracy of posting behavior detection and effectively reduces false positives. This application can reduce algorithm resource consumption while ensuring detection accuracy, adapting to the posting behavior detection needs in complex scenarios.
[0127] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by instructions, or by instructions controlling related hardware. These instructions can be stored in a processor-readable storage medium and loaded and executed by a processor.
[0128] Therefore, embodiments of this application provide a storage medium storing a plurality of instructions that can be loaded by a processor to execute steps in any of the posting behavior detection methods provided in embodiments of this application. For example, the instructions can execute the following steps: Pixel-level change detection is performed on the posting behavior monitoring area in the video frame to identify suspicious areas with continuous pixel changes. The posting behavior monitoring area is determined through scene semantic segmentation of the video frame, and the pixel-level change detection includes inter-frame difference operation and background modeling update. The suspicious areas are dynamically segmented, and the size of the detection sub-blocks is adjusted according to the severity of pixel changes within the suspicious areas to obtain multiple dynamic detection sub-blocks. Texture and color features of each dynamic detection sub-block are extracted at the start and end of the change. The texture and color features are matched with a preset posting behavior feature library, and the presence of a target posting behavior within the monitoring area is determined by combining the feature change amplitude and duration.
[0129] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.
[0130] The storage medium may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.
[0131] Since the instructions stored in the storage medium can execute the steps of any of the posting behavior detection methods provided in the embodiments of this application, the beneficial effects that any of the posting behavior detection methods provided in the embodiments of this application can achieve can be realized. For details, please refer to the previous embodiments, which will not be repeated here.
[0132] The foregoing has provided a detailed description of a posting behavior detection method, apparatus, electronic device, and storage medium provided in the embodiments of this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A method for detecting posting behavior, characterized in that, include: Pixel-level change detection is performed on the posting behavior monitoring area in the video frame to identify suspicious areas with continuous pixel changes; wherein, the posting behavior monitoring area is determined by scene semantic segmentation of the video frame, and the pixel-level change detection includes inter-frame difference operation and background modeling update; The suspicious region is dynamically segmented, and the size of the detection sub-blocks is adjusted according to the degree of pixel change within the suspicious region to obtain multiple dynamic detection sub-blocks; Extract the texture and color features of each of the dynamically detected sub-blocks at the start and end of the change; The texture and color features are matched with a preset posting behavior feature library, and the magnitude and duration of feature changes are combined to determine whether the target posting behavior exists within the posting behavior monitoring area.
2. The management and scheduling method according to claim 1, characterized in that, The step of performing pixel-level change detection on the posting behavior monitoring area in the video frame to identify suspicious areas with continuous pixel changes includes: Based on the scene semantic segmentation results of the video footage, preset posting carrier areas such as walls and door panels are selected as the posting behavior monitoring areas; Perform inter-frame difference operation on consecutive video frames within the posting behavior monitoring area to obtain a pixel change mask map; Background modeling is performed using a Gaussian mixture model and updated in real time. The pixel change mask image is then filtered to identify regions where the number of consecutive pixel changes exceeds a preset threshold as suspicious regions.
3. The posting behavior detection method according to claim 1, characterized in that, The process involves dynamically dividing the suspicious region into blocks, adjusting the size of the detection sub-blocks based on the drastic changes in pixels within the suspicious region, resulting in multiple dynamically detected sub-blocks, including: Calculate the gradient value of each pixel within the suspected region, and calculate the average gradient of each sub-region. If the average gradient of a sub-region is greater than the first preset gradient threshold, then the sub-region is divided into a dynamic detection sub-block of the first size. If the average gradient of a sub-region is between a second preset gradient threshold and a first preset gradient threshold, then the sub-region is divided into a dynamic detection sub-block of the second size; wherein the first size is smaller than the second size. If the average gradient of a sub-region is less than the second preset gradient threshold, then the sub-region is merged with the adjacent sub-region and divided into a dynamic detection sub-block of the third size; the third size is greater than the second size.
4. The posting behavior detection method according to claim 1, characterized in that, The detection frequency for pixel-level change detection of the posting behavior monitoring area in the video frame is a portion of the current video frame rate, and each detection includes at least one keyframe data.
5. The posting behavior detection method according to claim 1, characterized in that, The extraction of texture and color features of each of the dynamically detected sub-blocks at the start and end of the change includes: Extract the texture features of the dynamic detection sub-block from the video frames at the start of the change and the video frames at the stable point of the change; Extract the mean hue, saturation variance, and peak brightness of the dynamic detection sub-block in the video frames at two time points.
6. The posting behavior detection method according to any one of claims 1 to 4, characterized in that, After determining whether a target posting behavior exists within the posting behavior monitoring area, the method further includes: If it is determined that a target posting behavior exists within the posting behavior monitoring area, the end time of the target posting behavior and the coordinates of the posting area corresponding to the dynamic detection sub-block are recorded.
7. The posting behavior detection method according to any one of claims 1 to 4, characterized in that, After determining whether a target posting behavior exists within the posting behavior monitoring area, the method further includes: If it is determined that there is a target posting behavior within the posting behavior monitoring area, the features of the dynamic detection sub-block in the video frames within a preset time range after the change stabilizes are continuously monitored. If the feature change amplitude is less than the preset stabilization threshold, it is confirmed that there is no false judgment; if the feature change amplitude is greater than the preset stabilization threshold, it is determined to be a false judgment.
8. A posting behavior detection device, characterized in that, include: The determination module is used to perform pixel-level change detection on the posting behavior monitoring area in the video frame and determine suspicious areas with continuous pixel changes; wherein, the posting behavior monitoring area is determined by scene semantic segmentation of the video frame, and the pixel-level change detection includes inter-frame difference operation and background modeling update; The processing module is used to dynamically divide the suspicious area into blocks and adjust the size of the detection sub-blocks according to the degree of pixel change in the suspicious area to obtain multiple dynamic detection sub-blocks. The extraction module is used to extract the texture and color features of each of the dynamically detected sub-blocks at the start and end of the change. The detection module is used to match texture features and color features with a preset posting behavior feature library, and combine the feature change amplitude and change duration to determine whether there is a target posting behavior in the posting behavior monitoring area.
9. An electronic device, characterized in that, include: A memory, a processor, and a processor program stored in the memory and executable on the processor, wherein the processor executes the program as steps of the posting behavior detection method as described in any one of claims 1 to 7.
10. A storage medium, characterized in that, The computer processing program is stored and can be loaded by a processor to execute the posting behavior detection method as described in any one of claims 1 to 7.