Behavior monitoring method and apparatus, electronic device, and storage medium
By identifying and tracking target pedestrians in gas station surveillance videos and generating behavioral identifiers, the shortcomings of manual monitoring at gas stations are addressed, enabling automatic and accurate monitoring of refueling activities and improving safety and control effectiveness.
Patent Information
- Application Number
- CN202410079492.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-19
- Publication Date
- 2026-11-27
- Estimated Expiration
- 2044-01-19
AI Technical Summary
Gas stations rely on manual monitoring to control the refueling situation of customers, which makes it difficult to accurately monitor whether loose fuel is being added to vehicles during peak hours, posing safety hazards and risks of confusion.
By acquiring surveillance video frames, identifying and tracking target pedestrians, generating behavioral identifiers, and using pedestrian re-identification containers to record re-identification and tracking identifiers, cross-camera behavior detection and monitoring can be achieved, automatically identifying fuel purchase and refueling behaviors.
It enables automatic and accurate monitoring of refueling activities by customers, reducing manual intervention and improving the safety and management effectiveness of gas stations.
Smart Images

Figure CN118015697B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of intelligent recognition technology, and in particular to a behavior monitoring method, device, electronic device, and storage medium. Background Technology
[0002] With the increasing demand for fuel in many vehicles, gas stations can sell bulk fuel to qualified buyers, who can then purchase it to refuel motorcycles or other vehicles. Currently, the process for selling bulk fuel at gas stations is as follows: First, the buyer parks their motorcycle in the designated parking area of the gas station, retrieves an empty container provided by the gas station, and then completes the bulk fuel purchase registration and payment at the gas station.
[0003] Afterwards, the gas station staff confirmed the purchase registration, issued a voucher to the purchaser, and finally, the staff responsible for refueling confirmed that the purchaser had completed the registration and payment process based on the voucher, then filled the container with fuel. After refueling, the purchaser left with the container.
[0004] In response to relevant departments' control requirements on the sale of bulk fuel at gas stations, gas station staff need to monitor the whereabouts of the bulk fuel after customers leave with their containers, ensuring that customers have filled their vehicles with the purchased fuel. However, these monitoring methods rely on manual operation. During peak fuel sales periods, it is difficult for gas station staff to accurately monitor whether each customer has filled their vehicle with the purchased fuel. This can even lead to confusion between different customers and different fuel containers, creating greater safety hazards and seriously affecting the gas station's control over customers' refueling activities. Summary of the Invention
[0005] In view of this, the present invention aims to provide a behavior monitoring method, device, electronic device and storage medium to solve the problem that manual monitoring of pedestrians' refueling behavior affects the gas station's control over the refueling situation of customers, and to achieve automatic and accurate identification and monitoring of the behavior of target personnel.
[0006] According to a first aspect of the present invention, a behavior monitoring method is provided, the method comprising:
[0007] Obtain the current video frame of the surveillance video and determine the target pedestrian in the current video frame;
[0008] The target pedestrian is stored in a pedestrian re-identification container and the target pedestrian is tracked. The pedestrian re-identification container includes the re-identification identifier and the tracking identifier of the target pedestrian.
[0009] Based on the tracking identifier of the target pedestrian, behavior detection is performed on the target pedestrian in the surveillance video to generate the behavior identifier of the target pedestrian;
[0010] Based on the tracking identifier and behavior identifier of the target pedestrian, the behavior monitoring result of the target pedestrian is determined.
[0011] Optionally, obtaining the current video frame of the surveillance video and determining the target pedestrian in the current video frame includes:
[0012] Obtain the current video frame of the surveillance video and perform human detection on the current video frame;
[0013] Preset tags are used to identify detected people and determine the pedestrians to be tracked;
[0014] A preset image dominant color algorithm is used to determine the consistency between the pedestrian to be tracked and the target pedestrian, and the pedestrian to be tracked is filtered to determine the target pedestrian in the current video frame.
[0015] Optionally, the step of storing the target pedestrian in a pedestrian re-identification container and tracking the target pedestrian, wherein the pedestrian re-identification container includes a re-identification identifier and a tracking identifier for the target pedestrian, including:
[0016] In response to the target pedestrian being stored in the pedestrian re-identification container, a re-identification identifier for the target pedestrian is generated;
[0017] The target pedestrian is tracked, and it is detected whether the target pedestrian appears at the target camera.
[0018] If the target pedestrian appears at the target camera, update the re-identification identifier of the target pedestrian and generate the tracking identifier of the target pedestrian.
[0019] Optionally, the step of updating the re-identification identifier of the target pedestrian and generating the tracking identifier of the target pedestrian when the target pedestrian appears at the target camera includes:
[0020] Once the target pedestrian is detected appearing at the target camera, the target pedestrian is matched with the historical pedestrians in the pedestrian re-identification container;
[0021] Determine whether the target pedestrian matches the historical pedestrian in the pedestrian re-identification container;
[0022] If the target pedestrian matches the historical pedestrians in the pedestrian re-identification container, determine whether the target camera where the target pedestrian is located matches the target camera where the historical pedestrians are located;
[0023] If the target camera where the target pedestrian is located is different from the target camera where the historical pedestrian is located, a tracking identifier for the target pedestrian is generated.
[0024] If the target camera where the target pedestrian is located is the same as the target camera where the historical pedestrian is located, the tracking identifier of the target pedestrian is corrected to the tracking identifier of the historical pedestrian, and the re-identification identifier of the target pedestrian is updated.
[0025] Optionally, determining whether the target pedestrian matches the historical pedestrians in the pedestrian re-identification container includes:
[0026] Obtain the feature values of the target pedestrian and the historical pedestrians in the pedestrian re-identification container, and generate the Euclidean distance between the feature values of the target pedestrian and the historical pedestrians;
[0027] Based on the Euclidean distance, the target pedestrian is compared with the historical pedestrians in the pedestrian re-identification container;
[0028] If the Euclidean distance is less than a preset threshold, then the target pedestrian is determined to be the same as the historical pedestrian.
[0029] Optionally, the step of performing behavior detection on the target pedestrian in the surveillance video based on the tracking identifier of the target pedestrian and generating a behavior identifier for the target pedestrian includes:
[0030] Obtain the target area where the target pedestrian corresponding to the tracking identifier appears, wherein the target area includes a first behavior area and a second behavior area;
[0031] The behavior of the target pedestrian is detected in the first behavior area and the second behavior area respectively, and the behavior detection result of the target pedestrian is generated.
[0032] In response to the behavior detection result of the target pedestrian, a behavior identifier of the target pedestrian is generated in the pedestrian re-identification container.
[0033] Optionally, the behavior identifier includes a first behavior identifier and a second behavior identifier, and determining the behavior monitoring result of the target pedestrian based on the tracking identifier and behavior identifier includes:
[0034] Based on the tracking identifier of the target pedestrian, the first behavior identifier and the second behavior identifier of the target pedestrian are determined;
[0035] If the first behavior identifier and the second behavior identifier of the target pedestrian are inconsistent, the behavior monitoring result of the target pedestrian is determined, and an alarm is issued to the target pedestrian.
[0036] According to a second aspect of the present invention, a behavior monitoring device is provided, the device comprising:
[0037] The target determination module is used to acquire the current video frame of the surveillance video and determine the target pedestrian in the current video frame;
[0038] The target tracking module is used to store the target pedestrian in a pedestrian re-identification container and track the target pedestrian, wherein the pedestrian re-identification container includes the re-identification identifier and the tracking identifier of the target pedestrian;
[0039] The behavior detection module is used to perform behavior detection on the target pedestrian in the surveillance video based on the tracking identifier of the target pedestrian, and generate the behavior identifier of the target pedestrian;
[0040] The result determination module is used to determine the behavior monitoring result of the target pedestrian based on the tracking identifier and behavior identifier of the target pedestrian.
[0041] According to another aspect of the present invention, an electronic device is also provided, comprising:
[0042] processor;
[0043] Memory used to store the processor's executable instructions;
[0044] The processor is configured to execute the instructions to implement the behavior monitoring method described above.
[0045] According to another aspect of the present invention, a readable storage medium is also provided, on which a computer program is stored, which, when executed by a processor, implements the steps of the behavior monitoring method described above.
[0046] The behavior monitoring method provided in this invention acquires the current video frame of a surveillance video, identifies the target pedestrian in the current video frame, stores the target pedestrian in a pedestrian re-identification container, and tracks the target pedestrian. The pedestrian re-identification container includes a re-identification identifier and a tracking identifier for the target pedestrian. Based on the tracking identifier, behavior detection is performed on the target pedestrian in the surveillance video to generate a behavior identifier for the target pedestrian. The behavior monitoring result is determined based on the tracking identifier and behavior identifier. This invention uses a pedestrian re-identification container to record the re-identification identifier, tracking identifier, and behavior identifier of the target pedestrian. Based on pedestrian re-identification, it performs cross-camera target tracking and associates the identification and behavior of the target pedestrian, achieving behavior monitoring of the target pedestrian. With the assistance of a pedestrian re-identification algorithm, it achieves the goal of unifying the behavior detection and actual behavior of the same target pedestrian across different cameras, without human intervention, realizing automatic and accurate target pedestrian behavior monitoring, and further improving the control effect of gas stations on the refueling situation of customers.
[0047] The above description is merely an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of the present invention more apparent and understandable, specific embodiments of the present invention are described below. Attached Figure Description
[0048] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the invention. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings:
[0049] Figure 1 This is a flowchart of the steps of a behavior monitoring method provided in an embodiment of the present invention;
[0050] Figure 2 yes Figure 1 A flowchart of step 101 in the behavior monitoring method provided in this embodiment of the invention;
[0051] Figure 3 yes Figure 1 A flowchart of step 102 in the behavior monitoring method provided in this embodiment of the invention;
[0052] Figure 4 yes Figure 1 A flowchart of step 103 in the behavior monitoring method provided in this embodiment of the invention;
[0053] Figure 5 yes Figure 1 A flowchart of step 104 in the behavior monitoring method provided in this embodiment of the invention;
[0054] Figure 6 This is a schematic diagram illustrating an application scenario of the behavior monitoring method provided in this embodiment of the invention;
[0055] Figure 7 This is a schematic diagram of the structure of a behavior monitoring device provided in an embodiment of the present invention;
[0056] Figure 8 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0057] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the various embodiments of the present invention will be described in detail below with reference to the accompanying drawings. However, those skilled in the art will understand that many technical details are presented in the various embodiments of the present invention to facilitate a better understanding of this application. However, the technical solutions claimed in this application can be implemented even without these technical details and various changes and modifications based on the following embodiments. The division of the various embodiments below is for ease of description and should not constitute any limitation on the specific implementation of the present invention. The various embodiments can be combined with and referenced by each other without contradiction.
[0058] Reference Figure 1 The flowchart illustrates the steps of a behavior monitoring method provided in an embodiment of the present invention, the method including:
[0059] Step 101: Obtain the current video frame of the surveillance video and identify the target pedestrian in the current video frame.
[0060] In this embodiment of the invention, in order to automatically re-identify and track pedestrians who purchase bulk oil, and to achieve consistent monitoring of the pedestrian's refueling and oil purchase behaviors, ensuring that the gas station can control the refueling situation of oil purchasers and avoid the behavior of purchasing bulk oil but not refueling, this embodiment uses a behavior monitoring system to identify and analyze the monitoring video, and realize the behavior monitoring and early warning of the target pedestrian.
[0061] Specifically, due to the presence of many interfering factors in the surveillance video, such as non-bulk fuel buyers, gas station staff, and items appearing at the gas station, this embodiment needs to filter the elements appearing in the surveillance video to improve the accuracy of behavior monitoring and identify the target pedestrians to be monitored. Therefore, by acquiring the current video frame of the surveillance video and detecting the current video frame, the target pedestrian in the current video frame is identified. The target pedestrian is the pedestrian who appears for the first time in the bulk fuel refueling area waiting to refuel.
[0062] In this embodiment, object interference can be eliminated first. By detecting people in the current video frame and using preset tags to identify the detected people, the pedestrian to be tracked can be determined. Then, gas station staff and other people can be filtered out from the pedestrians to be tracked. Specifically, the pedestrians to be tracked can be filtered according to preset personnel information, thereby determining the target pedestrian in the current video frame. The preset tags include object category tags and person category tags, which are used to distinguish between pedestrians and objects.
[0063] It should be noted that gas stations generally include multiple refueling areas, and the refueling area for bulk oil is a designated one of these areas. The surveillance video in this embodiment is obtained from the gas station's monitoring system. This video can be captured by the main camera and secondary cameras located at various locations within the gas station. In this embodiment, based on the multi-camera environment of the gas station and the angle of each camera, three cameras are selected to ensure that their fields of view fully cover the entire process of bulk oil purchase and refueling. Specific details are not elaborated here. The gas station's surveillance video can include: surveillance video at the gas station entrance, surveillance video at the gas station exit, and surveillance video of each refueling area.
[0064] Step 102: Store the target pedestrian in the pedestrian re-identification container and track the target pedestrian. The pedestrian re-identification container includes the re-identification identifier and the tracking identifier of the target pedestrian.
[0065] In this embodiment of the invention, after the target pedestrian is identified, the target pedestrian is stored in the pedestrian re-identification container. After the target pedestrian is stored in the pedestrian re-identification container, a re-identification identifier is generated to mark that the target pedestrian has been identified and does not need to be identified again during the tracking process, thus saving data processing resources. After storing the target pedestrian, the pedestrian re-identification container generates a tracking identifier for the target pedestrian, thereby tracking the target pedestrian corresponding to the tracking identifier.
[0066] It should be noted that the pedestrian re-identification container is a pre-created container. In the initial state, the container used to store pedestrian re-identification results is empty. After the target pedestrian is identified, the first target pedestrian appearing in the main camera of the behavior monitoring system is stored in the pedestrian re-identification result container, and the re-identification flag of the pedestrian is set to true, indicating that the pedestrian will not be re-identified in the subsequent continuous tracking process, so as to save processor resources. The pedestrian re-identification container also includes the tracking flag of the target pedestrian, which is used to lock the target pedestrian with the same tracking flag for tracking.
[0067] Specifically, when a target pedestrian appears across a camera's viewpoint, the target may be lost. To avoid this problem, this embodiment tracks the target pedestrian, detecting whether the pedestrian has appeared at the target camera. If the pedestrian appears at the target camera, the re-identification flag is updated, and a tracking flag is generated. The target camera can be the main field-of-view camera, used to confirm that the pedestrian has appeared in the refueling area. It should be noted that this embodiment continuously tracks the target pedestrian appearing within the main camera's view, calculating the aspect ratio of the pedestrian's bounding rectangle. When most of the pedestrian's body appears in the main field of view, it indicates that the pedestrian has not been lost after crossing the camera's viewpoint. The re-identification flag for the pedestrian is then updated to true, and subsequent tracking will not perform re-identification operations on the pedestrian. The tracking flag for the pedestrian is then generated and recorded.
[0068] Step 103: Based on the tracking identifier of the target pedestrian, perform behavior detection on the target pedestrian in the surveillance video and generate the behavior identifier of the target pedestrian.
[0069] In this embodiment of the invention, in order to combine the behavior of the target pedestrian with tracking and identification, the target pedestrian in the surveillance video is continuously monitored based on the tracking identifier of the target pedestrian to perform behavior detection. The behavior detection includes oil purchase behavior and refueling behavior, and corresponding behavior identifiers are generated according to the behavior of the target pedestrian.
[0070] Specifically, behavior detection can be achieved by acquiring the target area where the target pedestrian appears, corresponding to the tracking identifier. The target area includes a first behavior area and a second behavior area. The first behavior area can be a fuel purchase area, and the second behavior area can be a refueling area. The behavior areas are set according to actual monitoring needs. This embodiment takes fuel purchase and refueling as an example. After acquiring the target area where the target pedestrian appears, the behavior of the target pedestrian in the first behavior area and the second behavior area are detected respectively, generating the behavior detection results of the target pedestrian. The behavior identifier of the target pedestrian is generated in the pedestrian re-identification container. The behavior detection results are the fuel purchase behavior and the refueling behavior. Correspondingly, the behavior identifier includes the first behavior identifier and the second behavior identifier. Using the refueling behavior detection results, the fuel purchase and refueling flags of the target pedestrian in the container are set and updated.
[0071] Step 104: Determine the behavioral monitoring results of the target pedestrian based on the tracking and behavioral identifiers of the target pedestrian.
[0072] In this embodiment, the tracking identifier and behavior identifier of the target pedestrian are the factors for determining whether the pedestrian's refueling behavior is compliant. Therefore, the behavior monitoring result of the target pedestrian is determined based on the tracking identifier and behavior identifier of the target pedestrian. Specifically, based on the pedestrian's tracking ID number, as well as the refueling identifier and the oil purchase identifier, pedestrians with the same tracking identifier are judged. The only non-compliant behavior is: completing the purchase of oil but not refueling, that is, the pedestrian takes away the oil after purchasing it, which will cause potential safety risks. After determining the behavior monitoring result of the target pedestrian, an alarm is issued so that staff can stop the non-compliant behavior of the target pedestrian in time.
[0073] To facilitate a thorough understanding of the above behavior monitoring method by those skilled in the art, refer to Figure 6 , Figure 6 This is a schematic diagram illustrating an application scenario of a behavior monitoring method provided in this embodiment of the invention. Specifically, the pedestrian re-identification result container is connected to the re-identification and tracking functions in the behavior monitoring. During initialization, the container includes a purchase tag and a refueling tag. After the target pedestrian is identified using the re-identification function, the target pedestrian is stored in the pedestrian re-identification result container, and a tracking tag is generated for the target pedestrian. The tracking function continuously tracks the target pedestrian, detecting purchase and refueling behaviors in the area where the target pedestrian is located. When a purchase occurs, the purchase tag for that pedestrian in the container is set to true using a signal slot mechanism, indicating that the pedestrian has purchased gasoline. Simultaneously, the tracking tag number for that pedestrian is recorded. Based on the results of refueling behavior detection, the refueling tag for that pedestrian is set. If refueling behavior is detected, the refueling tag is set to true using a signal slot mechanism, and the tracking tag number for that pedestrian is recorded. Therefore, based on the pedestrian's tracking tag, refueling tag, and purchase tag, the behavior of the target pedestrian is judged, and alarms are pushed to notify staff to handle non-compliant behaviors promptly.
[0074] The behavior monitoring method provided in this invention acquires the current video frame of a surveillance video, identifies the target pedestrian in the current video frame, stores the target pedestrian in a pedestrian re-identification container, and tracks the target pedestrian. The pedestrian re-identification container includes a re-identification identifier and a tracking identifier for the target pedestrian. Based on the tracking identifier, behavior detection is performed on the target pedestrian in the surveillance video to generate a behavior identifier for the target pedestrian. The behavior monitoring result is determined based on the tracking identifier and behavior identifier. This invention uses a pedestrian re-identification container to record the re-identification identifier, tracking identifier, and behavior identifier of the target pedestrian. Based on pedestrian re-identification, it performs cross-camera target tracking and associates the identification and behavior of the target pedestrian to achieve behavior monitoring. With the assistance of the pedestrian re-identification algorithm, it achieves the goal of unifying the behavior detection and actual behavior of the same target pedestrian across different cameras, eliminating the need for manual intervention and realizing automatic and accurate target pedestrian behavior monitoring, further improving the control effect of gas stations on the refueling situation of customers.
[0075] Furthermore, refer to Figure 2 , showed Figure 1 A flowchart of step 101 in a behavior monitoring method is provided. This method is basically the same as the behavior monitoring method provided in the first embodiment of the present invention. Step 101 may include:
[0076] Step 201: Obtain the current video frame of the surveillance video and perform human detection on the current video frame.
[0077] In this embodiment, the current video frame of the surveillance video is obtained, and an image detection algorithm is used to detect people in the current video frame, detecting pedestrians and other objects appearing in the video frame. In this embodiment, the image detection algorithm is not specifically limited, and it can be any detection algorithm that can detect people in the image, which will not be described in detail here.
[0078] Step 202: Use preset tags to identify the detected people and determine the pedestrians to be tracked.
[0079] It should be noted that, in order to eliminate interference from other factors in the current video frame, object interference can be eliminated first by detecting people in the current video frame. Preset labels are used to identify the detected people and determine the pedestrians to be tracked. The preset labels include object category labels and person category labels, which are used to distinguish between pedestrians and objects.
[0080] Step 203: Use a preset image dominant color algorithm to determine the consistency between the pedestrian to be tracked and the target pedestrian, and filter the pedestrian to be tracked to determine the target pedestrian in the current video frame.
[0081] In this embodiment of the invention, after the identified target pedestrian enters the tracking, in order to ensure that the identified object and the tracked object are the same target, this embodiment can use a preset image dominant color algorithm to make a consistency judgment on the pedestrian to be tracked and the target pedestrian in the video frame, and filter out the gas station staff, so as to reduce interference for subsequent pedestrian re-identification logic and determine the target pedestrian in the current video frame.
[0082] Specifically, the preset image dominant color algorithm in this embodiment mainly extracts the dominant color of the target pedestrian in the current video frame and compares it with the dominant colors of other non-target pedestrians to perform consistency judgment and filter interference factors. In the scenario of people tracking, the target images are all pedestrian images, so the images are all vertical images with a height greater than their width. Specifically, the image is pre-divided into multiple sub-images, the H component is extracted from the multiple sub-images, all pixels within the H component are traversed and the pixel values are determined, and the pixels are assigned to the corresponding pixel ranges according to the pixel values. The multiple pixel ranges are sorted in descending order according to the number of pixels within them, and the first pixel range is taken. The average value of the pixel distribution within the pixel range is calculated, and this average value is the dominant color value of the current sub-image. The dominant color values of the multiple sub-images are merged into the dominant color value of the current video frame image. For example, the dividing points for dividing the image into multiple sub-images can be 1 / 8 and 7 / 8 of the image height, respectively, resulting in 3 sub-images with the same width as the original image, thus obtaining 3 sub-images.
[0083] It should be noted that, in this embodiment, since the HSV color space uses polar coordinates to represent colors, the red, blue, green and other information of pixels are all stored in the H component. Therefore, the H component is extracted from multiple sub-images so that subsequent logical operations on colors can be performed. Specifically, the color space of the image can be converted from RGB to HSV color space in advance, and then the hue / tone H component can be extracted. This will not be elaborated on here.
[0084] Specifically, in this embodiment, consistency judgment is performed between the tracked pedestrian and the target pedestrian. This involves comparing the image of the pedestrian to be tracked at time t and the image of the target pedestrian observed at time t+1. The dominant color values of the two images are extracted using a preset image dominant color algorithm, and the Euclidean distance between the dominant colors is calculated. If the Euclidean distance is less than a preset threshold, the pedestrian to be tracked and the target pedestrian are the same person, and their consistency is confirmed. Otherwise, the pedestrian to be tracked needs to be filtered. The dominant color value of the gas station employee's uniform is extracted using the preset image dominant color algorithm as a preset value, and the dominant color value of the target pedestrian is extracted in real time. The Euclidean distance between the target pedestrian's dominant color and the preset dominant color is calculated. If the Euclidean distance is less than the preset threshold, the target pedestrian is considered to be a staff member and is removed from the tracking list. Otherwise, the pedestrian is considered to be a non-staff member, and tracking continues.
[0085] Specifically, to filter out gas station staff and other personnel from the pedestrians to be tracked, a preset image dominant color algorithm can be used. Based on preset personnel information, the pedestrians to be tracked are filtered to determine the target pedestrians in the current video frame. The preset personnel information is the preset dominant color value of the gas station staff that the system has pre-identified and extracted, so as to eliminate the interference of gas station staff in the monitoring of target pedestrians during the detection process and improve monitoring efficiency.
[0086] This invention acquires the current video frame of a surveillance video, performs person detection on the current video frame, identifies the detected persons using preset tags, determines the pedestrians to be tracked, filters the pedestrians to be tracked based on preset personnel information, and determines the target pedestrians in the current video frame. By detecting the target in the surveillance video frame, interference is reduced for subsequent pedestrian re-identification logic, further improving the accuracy of behavior monitoring.
[0087] Furthermore, refer to Figure 3 , showed Figure 1 A flowchart of step 102 in a behavior monitoring method is provided. This method is basically the same as the behavior monitoring method provided in the first embodiment of the present invention. Step 102 may include:
[0088] Step 301: In response to the target pedestrian being stored in the pedestrian re-identification container, generate the target pedestrian's re-identification identifier.
[0089] Specifically, the pedestrian re-identification result container is initially empty. When it is confirmed that the pedestrian appears in the behavior monitoring for the first time, the target pedestrian is stored in the pedestrian re-identification container.
[0090] Step 302: Track the target pedestrian and detect whether the target pedestrian appears at the target camera.
[0091] In this embodiment, the first pedestrian appearing in the main camera is continuously tracked, and the aspect ratio of the pedestrian's bounding rectangle is calculated. The system detects whether the target pedestrian has appeared in the target camera. It confirms that most of the pedestrian's body is in the field of view by judging the aspect ratio of the pedestrian's bounding rectangle. When the aspect ratio is greater than a preset threshold, it is determined that the target pedestrian has appeared in the target camera. The preset threshold is determined according to the actual field of view size and is not specifically limited here.
[0092] Step 303: If the target pedestrian appears at the target camera, update the re-identification tag of the target pedestrian and generate the tracking tag of the target pedestrian.
[0093] Specifically, step 303, if the target pedestrian appears at the target camera, updates the re-identification identifier of the target pedestrian and generates the tracking identifier of the target pedestrian, may include the following steps:
[0094] 01. Once a target pedestrian is detected appearing at the target camera, the target pedestrian is matched with the historical pedestrians in the pedestrian re-identification container;
[0095] 02. Determine whether the target pedestrian matches the historical pedestrians in the pedestrian re-identification container;
[0096] 03. If the target pedestrian matches the historical pedestrian in the pedestrian re-identification container, determine whether the target camera where the target pedestrian is located matches the target camera where the historical pedestrian is located.
[0097] 04. If the target camera where the target pedestrian is located is different from the target camera where the historical pedestrian is located, a tracking tag for the target pedestrian will be generated.
[0098] 05. If the target camera where the target pedestrian is located is the same as the target camera where the historical pedestrian is located, correct the tracking identifier of the target pedestrian to the tracking identifier of the historical pedestrian, and update the re-identification identifier of the target pedestrian.
[0099] It should be noted that in the above steps, the target pedestrian is matched with the historical pedestrians in the pedestrian re-identification container to determine whether the target pedestrian is consistent with the historical pedestrians in the pedestrian re-identification container. If they are consistent, the camera where the newly appearing pedestrian is located is compared with the camera of the historical pedestrian in the pedestrian re-identification result container. If it is the same camera as the historical pedestrian in the container, the tracking identifier of the newly appearing pedestrian is kept unchanged, that is, the tracking identifier of the target pedestrian is corrected to the tracking identifier of the historical pedestrian, and the re-identification identifier of the target pedestrian is updated. If it is a different camera from the historical pedestrian in the container, the tracking identifier of the target pedestrian is regenerated. Optionally, if after traversing the pedestrian re-identification container, no re-identification pedestrian is found that is closest to the current pedestrian, it means that the pedestrian is appearing in the system for the first time. Different logical operations need to be performed depending on the camera where the pedestrian is located. Specifically: if the camera where the pedestrian is located is the main camera, then add the pedestrian to the pedestrian re-identification container and update the pedestrian's re-identification flag to true. No further pedestrian re-identification is needed in the subsequent continuous tracking process. If the camera where the pedestrian is located is not the main camera, then ignore the pedestrian.
[0100] Specifically, the steps to determine whether the target pedestrian is consistent with the historical pedestrians in the pedestrian re-identification container can be implemented as follows: obtain the feature values of the target pedestrian and the historical pedestrians in the pedestrian re-identification container, generate the Euclidean distance between the feature values of the target pedestrian and the historical pedestrians, and judge the target pedestrian and the historical pedestrians in the pedestrian re-identification container based on the Euclidean distance. If the Euclidean distance is less than a preset threshold, it is determined that the target pedestrian and the historical pedestrians are consistent.
[0101] It should be noted that the target pedestrian is compared with all historical pedestrians in the pedestrian re-identification result container. The Euclidean distance between the feature values of the target pedestrian and the historical pedestrians in the container is calculated one by one. When the distance is less than a preset threshold, the sequence number of the pedestrian in the container is recorded. Finally, the sequence number of the pedestrian in the container with the smallest distance and its associated tracking identification information are saved. The pedestrian sequence number refers to the sequence number of the pedestrian in the container, and the tracking identification is the number assigned to the pedestrian in the tracking algorithm.
[0102] Optionally, a dominant color extraction algorithm can be added during the target pedestrian tracking process to compare the dominant color of the currently tracked object and the currently observed object, calculate the difference between the tracked object and the observed object, and determine whether to update the tracked object using the observed object based on the magnitude of the difference. This will not be elaborated on here.
[0103] In this embodiment, the tracking identifiers of the target pedestrians across the camera are compared and matched with the historical pedestrian tracking identifiers stored in the container to determine the consistency between the current tracking object and the current observation object, thus solving the problem of tracking ID jumps or swaps. The above judgment determines whether to update the tracking object using the observation object, which can effectively improve the situation of tracking ID disappearance and tracking ID swapping caused by target overlap in traditional Kalman filtering, and improve the accuracy of behavior monitoring.
[0104] Furthermore, refer to Figure 4 , showed Figure 1 A flowchart of step 103 in a behavior monitoring method is provided. This method is basically the same as the behavior monitoring method provided in the first embodiment of the present invention. Step 103 may include:
[0105] Step 401: Obtain the target area where the target pedestrian corresponding to the tracking identifier appears.
[0106] The target area includes the first row area and the second row area;
[0107] Step 402: Detect the behavior of the target pedestrian in the first behavior area and the second behavior area respectively, and generate the behavior detection results of the target pedestrian.
[0108] Step 403: In response to the behavior detection result of the target pedestrian, generate the behavior identifier of the target pedestrian in the pedestrian re-identification container.
[0109] Specifically, in the above steps, the first behavior area can be the oil purchase area, and the second behavior area can be the refueling area. After obtaining the target area where the target pedestrian appears, the behavior of the target pedestrian in the first behavior area and the second behavior area are detected respectively, and the behavior detection results of the target pedestrian are generated. The behavior identifier of the target pedestrian is generated in the pedestrian re-identification container. The behavior detection results are the oil purchase behavior and the refueling behavior. Correspondingly, the behavior identifier includes the first behavior identifier and the second behavior identifier. Using the refueling behavior detection results, the flags for the oil purchase and refueling of the target pedestrian in the re-identification container are set.
[0110] This invention utilizes the results of refueling behavior detection to update the markings for re-identifying pedestrians purchasing and refueling oil inside the container. It employs a behavior detection algorithm to detect the same pedestrian's purchasing and refueling behavior, and finally determines whether there is a risk based on the refueling and purchasing markings, thus achieving unified detection of refueling and purchasing behavior when the same pedestrian is crossing cameras.
[0111] Furthermore, refer to Figure 5 , showed Figure 1 A flowchart of step 104 in a behavior monitoring method is provided. This method is basically the same as the behavior monitoring method provided in the first embodiment of the present invention. Step 104 may include:
[0112] Step 501: Based on the tracking identifier of the target pedestrian, determine the first behavior identifier and the second behavior identifier of the target pedestrian.
[0113] Step 502: If the first behavior identifier and the second behavior identifier of the target pedestrian are inconsistent, determine the behavior monitoring result of the target pedestrian and issue an alarm to the target pedestrian.
[0114] It should be noted that in the above steps, the first behavior identifier and the second behavior identifier of the target pedestrian are judged based on the tracking identifier of the target pedestrian. The first behavior identifier corresponds to the pedestrian's oil purchase behavior, and the second behavior identifier corresponds to the pedestrian's refueling behavior. The first behavior identifier and the second behavior identifier are initially in the initial state. When oil purchase behavior is detected, the first behavior identifier is true, and when refueling behavior is detected, the second behavior identifier is true. If the first behavior identifier and the second behavior identifier of the target pedestrian are inconsistent, the behavior monitoring result of the target pedestrian is determined, and an alarm is issued to the target pedestrian. The alarm in this invention can be made by information push or any other alarm method that can remind gas station staff. No specific limitation is made here.
[0115] By adding refueling and purchasing flags, and with the assistance of pedestrian re-identification algorithms, this invention enables the unified detection of refueling and purchasing behaviors for the same pedestrian when they are across different cameras. The system is more concise and efficient, and the logic is clearer. Since the pedestrian re-identification part is decoupled from the purchasing and refueling behavior detection through a signal slot mechanism, the pedestrian re-identification in this invention can be easily and simply applied to other scenarios, further improving the practicality of this invention.
[0116] Reference Figure 7 The diagram shows a structural schematic of a behavior monitoring device provided in an embodiment of the present invention. The device includes:
[0117] The target determination module 601 is used to acquire the current video frame of the surveillance video and determine the target pedestrian in the current video frame;
[0118] The target tracking module 602 is used to store the target pedestrian in a pedestrian re-identification container and track the target pedestrian, wherein the pedestrian re-identification container includes a re-identification identifier and a tracking identifier of the target pedestrian;
[0119] The behavior detection module 603 is used to perform behavior detection on the target pedestrian in the surveillance video based on the tracking identifier of the target pedestrian, and generate the behavior identifier of the target pedestrian.
[0120] The result determination module 604 is used to determine the behavior monitoring result of the target pedestrian based on the tracking identifier and behavior identifier of the target pedestrian.
[0121] Furthermore, the target determination module 601 includes:
[0122] The detection submodule is used to acquire the current video frame of the surveillance video and perform human detection on the current video frame;
[0123] The identification submodule is used to identify detected people using preset tags and determine the pedestrians to be tracked;
[0124] The target determination submodule is used to use a preset image dominant color algorithm to determine the consistency between the pedestrian to be tracked and the target pedestrian, and to filter the pedestrian to be tracked to determine the target pedestrian in the current video frame.
[0125] Furthermore, the target tracking module 602 includes:
[0126] The first generation submodule is used to generate a re-identification identifier for the target pedestrian in response to the target pedestrian being stored in the pedestrian re-identification container.
[0127] The tracking submodule is used to track the target pedestrian and detect whether the target pedestrian appears in front of the target camera;
[0128] The second generation submodule is used to update the re-identification identifier of the target pedestrian and generate the tracking identifier of the target pedestrian if the target pedestrian appears at the target camera.
[0129] Furthermore, the second generation submodule includes:
[0130] A matching unit is used to detect the appearance of the target pedestrian at the target camera and match the target pedestrian with the historical pedestrians in the pedestrian re-identification container;
[0131] The first judgment unit is used to determine whether the target pedestrian is consistent with the historical pedestrian of the pedestrian re-identification container;
[0132] The second judgment unit is used to determine whether the target camera where the target pedestrian is located is consistent with the target camera where the historical pedestrian is located when the target pedestrian matches the historical pedestrian match of the pedestrian re-identification container.
[0133] The generation unit is configured to generate a tracking identifier for the target pedestrian if the target camera where the target pedestrian is located is different from the target camera where the historical pedestrian is located.
[0134] The update unit is configured to, if the target camera where the target pedestrian is located is the same as the target camera where the historical pedestrian is located, correct the tracking identifier of the target pedestrian to the tracking identifier of the historical pedestrian, and update the re-identification identifier of the target pedestrian.
[0135] Furthermore, the first determination unit includes:
[0136] A distance subunit is generated to obtain the feature values of the target pedestrian and the historical pedestrians in the pedestrian re-identification container, and to generate the Euclidean distance between the feature values of the target pedestrian and the historical pedestrians.
[0137] The judgment subunit is used to judge the target pedestrian and the historical pedestrians of the pedestrian re-identification container based on the Euclidean distance;
[0138] A sub-unit is defined to determine that the target pedestrian is consistent with the historical pedestrian if the Euclidean distance is less than a preset threshold.
[0139] Furthermore, the behavior detection module 603 includes:
[0140] The acquisition submodule is used to acquire the target area where the target pedestrian corresponding to the tracking identifier appears, wherein the target area includes a first behavior area and a second behavior area;
[0141] The behavior detection submodule is used to detect the behavior of the target pedestrian in the first behavior area and the second behavior area respectively, and generate the behavior detection result of the target pedestrian.
[0142] The third generation submodule is used to generate the behavior identifier of the target pedestrian in the pedestrian re-identification container in response to the behavior detection result of the target pedestrian.
[0143] Furthermore, the result determination module 604 includes:
[0144] The identifier determination submodule is used to determine the first behavior identifier and the second behavior identifier of the target pedestrian based on the tracking identifier of the target pedestrian;
[0145] The result determination submodule is used to determine the behavior monitoring result of the target pedestrian if the first behavior identifier and the second behavior identifier of the target pedestrian are inconsistent, and to issue an alarm prompt to the target pedestrian.
[0146] The behavior monitoring device provided in this invention acquires the current video frame of a surveillance video, identifies the target pedestrian in the current video frame, stores the target pedestrian in a pedestrian re-identification container, and tracks the target pedestrian. The pedestrian re-identification container includes a re-identification identifier and a tracking identifier for the target pedestrian. Based on the tracking identifier, behavior detection is performed on the target pedestrian in the surveillance video, generating a behavior identifier for the target pedestrian. The behavior monitoring result is determined based on the tracking identifier and behavior identifier. This invention uses a pedestrian re-identification container to record the re-identification identifier, tracking identifier, and behavior identifier of the target pedestrian. Based on pedestrian re-identification, it performs cross-camera target tracking and associates the identification and behavior of the target pedestrian, achieving behavior monitoring of the target pedestrian. With the assistance of the pedestrian re-identification algorithm, it achieves the goal of unifying the behavior detection and actual behavior of the same target pedestrian across different cameras, eliminating the need for manual intervention and realizing automatic and accurate target pedestrian behavior monitoring, further improving the control effect of gas stations on the refueling situation of customers.
[0147] Reference Figure 8 The present invention also provides an electronic device, such as... Figure 8 As shown, it includes a processor 701, a communication interface 702, a memory 703, and a communication bus 704, wherein the processor 701, the communication interface 702, and the memory 703 communicate with each other through the communication bus 704.
[0148] Memory 703 is used to store computer programs;
[0149] When processor 701 executes a program stored in memory 703, it performs the following steps:
[0150] Obtain the current video frame of the surveillance video and determine the target pedestrian in the current video frame;
[0151] The target pedestrian is stored in a pedestrian re-identification container and the target pedestrian is tracked. The pedestrian re-identification container includes the re-identification identifier and the tracking identifier of the target pedestrian.
[0152] Based on the tracking identifier of the target pedestrian, behavior detection is performed on the target pedestrian in the surveillance video to generate the behavior identifier of the target pedestrian;
[0153] Based on the tracking identifier and behavior identifier of the target pedestrian, the behavior monitoring result of the target pedestrian is determined.
[0154] The communication bus mentioned above can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used to represent it in the diagram, but this does not mean that there is only one bus or one type of bus.
[0155] The communication interface is used for communication between the aforementioned terminal and other devices.
[0156] The memory may include random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.
[0157] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0158] In another embodiment of the present invention, a computer-readable storage medium is also provided, which stores instructions that, when executed on a computer, cause the computer to perform any of the behavior monitoring methods described in the above embodiments.
[0159] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present invention are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid state disk (SSD)).
[0160] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, 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 said element.
[0161] The various embodiments in this specification are described in a related manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the system embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0162] The above description is merely a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention are included within the scope of protection of the present invention.
Claims
1. A behavior monitoring method, characterized in that, The method includes: The current video frame of the surveillance video is obtained, and the target pedestrian in the current video frame is identified; the target pedestrian is the pedestrian who appears for the first time in the oil refueling area waiting to refuel. The target pedestrian is stored in a pedestrian re-identification container and the target pedestrian is tracked. The pedestrian re-identification container includes the re-identification identifier and the tracking identifier of the target pedestrian. Based on the tracking identifier of the target pedestrian, behavior detection is performed on the target pedestrian in the surveillance video to generate the behavior identifier of the target pedestrian; Based on the tracking identifier and behavior identifier of the target pedestrian, determine the behavior monitoring result of the target pedestrian; The step of storing the target pedestrian in a pedestrian re-identification container and tracking the target pedestrian, wherein the pedestrian re-identification container includes a re-identification identifier and a tracking identifier for the target pedestrian, including: In response to the target pedestrian being stored in the pedestrian re-identification container, a re-identification identifier for the target pedestrian is generated; The target pedestrian is tracked, and it is detected whether the target pedestrian appears at the target camera. Once the target pedestrian is detected appearing at the target camera, the target pedestrian is matched with the historical pedestrians in the pedestrian re-identification container; Determine whether the target pedestrian matches the historical pedestrian in the pedestrian re-identification container; If the target pedestrian matches the historical pedestrians in the pedestrian re-identification container, determine whether the target camera where the target pedestrian is located matches the target camera where the historical pedestrians are located; If the target camera where the target pedestrian is located is different from the target camera where the historical pedestrian is located, a tracking identifier for the target pedestrian is generated. If the target camera where the target pedestrian is located is the same as the target camera where the historical pedestrian is located, the tracking identifier of the target pedestrian is corrected to the tracking identifier of the historical pedestrian, and the re-identification identifier of the target pedestrian is updated.
2. The method according to claim 1, characterized in that, The step of acquiring the current video frame of the surveillance video and determining the target pedestrian in the current video frame includes: Obtain the current video frame of the surveillance video and perform human detection on the current video frame; Preset tags are used to identify detected people and determine the pedestrians to be tracked; A preset image dominant color algorithm is used to determine the consistency between the pedestrian to be tracked and the target pedestrian, and the pedestrian to be tracked is filtered to determine the target pedestrian in the current video frame.
3. The method according to claim 1, characterized in that, The step of determining whether the target pedestrian matches the historical pedestrians in the pedestrian re-identification container includes: Obtain the feature values of the target pedestrian and the historical pedestrians in the pedestrian re-identification container, and generate the Euclidean distance between the feature values of the target pedestrian and the historical pedestrians; Based on the Euclidean distance, the target pedestrian is compared with the historical pedestrians in the pedestrian re-identification container; If the Euclidean distance is less than a preset threshold, then the target pedestrian is determined to be the same as the historical pedestrian.
4. The method according to claim 1, characterized in that, The step of detecting the behavior of the target pedestrian in the surveillance video based on the tracking identifier of the target pedestrian and generating the behavior identifier of the target pedestrian includes: Obtain the target area where the target pedestrian corresponding to the tracking identifier appears, wherein the target area includes a first behavior area and a second behavior area; The behavior of the target pedestrian is detected in the first behavior area and the second behavior area respectively, and the behavior detection result of the target pedestrian is generated. In response to the behavior detection result of the target pedestrian, a behavior identifier of the target pedestrian is generated in the pedestrian re-identification container.
5. The method according to claim 1, characterized in that, The behavior identifier includes a first behavior identifier and a second behavior identifier. Determining the behavior monitoring result of the target pedestrian based on the target pedestrian's tracking identifier and behavior identifier includes: Based on the tracking identifier of the target pedestrian, the first behavior identifier and the second behavior identifier of the target pedestrian are determined; If the first behavior identifier and the second behavior identifier of the target pedestrian are inconsistent, the behavior monitoring result of the target pedestrian is determined, and an alarm is issued to the target pedestrian.
6. A behavior monitoring device, characterized in that, The device includes: The target identification module is used to acquire the current video frame of the surveillance video and identify the target pedestrian in the current video frame; the target pedestrian is the pedestrian who is appearing for the first time in the oil refueling area waiting to refuel. The target tracking module is used to store the target pedestrian in a pedestrian re-identification container and track the target pedestrian, wherein the pedestrian re-identification container includes the re-identification identifier and the tracking identifier of the target pedestrian; The behavior detection module is used to perform behavior detection on the target pedestrian in the surveillance video based on the tracking identifier of the target pedestrian, and generate the behavior identifier of the target pedestrian; The result determination module is used to determine the behavior monitoring result of the target pedestrian based on the tracking identifier and behavior identifier of the target pedestrian; The target tracking module includes: The first generation submodule is used to generate a re-identification identifier for the target pedestrian in response to the target pedestrian being stored in the pedestrian re-identification container. The tracking submodule is used to track the target pedestrian and detect whether the target pedestrian appears in front of the target camera; A matching unit is used to detect the appearance of the target pedestrian at the target camera and match the target pedestrian with the historical pedestrians in the pedestrian re-identification container; The first judgment unit is used to determine whether the target pedestrian is consistent with the historical pedestrian of the pedestrian re-identification container; The second judgment unit is used to determine whether the target camera where the target pedestrian is located is consistent with the target camera where the historical pedestrian is located when the target pedestrian matches the historical pedestrian match of the pedestrian re-identification container. The generation unit is configured to generate a tracking identifier for the target pedestrian if the target camera where the target pedestrian is located is different from the target camera where the historical pedestrian is located. The update unit is configured to, if the target camera where the target pedestrian is located is the same as the target camera where the historical pedestrian is located, correct the tracking identifier of the target pedestrian to the tracking identifier of the historical pedestrian, and update the re-identification identifier of the target pedestrian.
7. An electronic device, characterized in that, include: processor; Memory used to store processor-executable instructions; The processor is configured to execute the instructions to implement the behavior monitoring method as described in any one of claims 1 to 5.
8. A readable storage medium, characterized in that, A computer program is stored on the readable storage medium, which, when executed by a processor, implements the behavior monitoring method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Cross-camera pedestrian detection tracking method based on depth learning
CN108875588A
Refueling behavior monitoring method and device, electronic equipment and storage medium
CN116343336A
