A target tracking method, apparatus, device and medium
By determining the location range of the target pedestrian in a short time and performing local attribute matching, the problem of mismatch and missed detection in the existing pedestrian tracking algorithm in multi-person scenarios is solved, realizing high-precision and high-recall pedestrian tracking, which is suitable for loitering event detection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HISENSE GRP HLDG CO LTD
- Filing Date
- 2023-05-31
- Publication Date
- 2026-07-03
AI Technical Summary
Existing pedestrian tracking algorithms are prone to mismatches and missed detections in multi-person scenarios, and are also labor-intensive, with low detection accuracy and recall, poor robustness, and poor detection performance.
By determining the location range of the target pedestrian in a short time and performing attribute matching within that range, the workload of global matching is reduced, and the accuracy and real-time performance of matching are improved. A method combining Kalman filter and target detection algorithm is used to filter out the possible range of the target pedestrian in the second image and perform local matching.
It achieves accurate tracking in multi-person scenarios, improves detection accuracy and recall, and has robustness, generalizability and real-time performance, meeting the needs for accurate detection of loitering events.
Smart Images

Figure CN116862947B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, and in particular to a target tracking method, apparatus, device, and medium. Background Technology
[0002] In order to protect personal and property safety, it is sometimes necessary to issue timely warnings for lingering incidents in certain specific scenarios, so as to detect potential dangers such as campus safety hazards or illegal activities carried out by unauthorized personnel on the street as early as possible.
[0003] Given the sheer number of image acquisition devices in society today, the industry typically employs vision-based solutions for detecting loitering events. This involves tracking pedestrians in the image to obtain their spatiotemporal trajectories and then determining whether a pedestrian has lingered in a specific area for more than a set time or frame count, thus identifying whether a loitering event has occurred. The quality of pedestrian tracking directly impacts the effectiveness of loitering event detection. Specifically, related technologies generally employ tracking-by-detaction (TBD) algorithms. However, this approach typically performs feature matching globally, which can lead to mismatches, false positives, or false negatives in scenarios with large numbers of people, and is also computationally intensive. Such scenarios include school campuses and busy roads. Furthermore, this approach is inherently challenging, with algorithm accuracy far lower than that of detection and classification tasks. The industry-wide accuracy and recall rates for pedestrian loitering event detection are relatively low, and the algorithm's robustness is poor, severely impacting the user experience in practical applications.
[0004] Therefore, it is crucial to devise a method that can accurately track pedestrians. Summary of the Invention
[0005] This application provides a target tracking method, apparatus, device, and medium to solve the problems of inaccurate pedestrian tracking and large tracking workload in the prior art.
[0006] This application provides a target tracking method, the method comprising:
[0007] Obtain the first image acquired at the current time, determine the first location and corresponding predicted identifier of the target pedestrian contained in the first image, and determine the first attribute of the target pedestrian;
[0008] Determine the first target time corresponding to the second image of the pedestrian whose predicted identifier was last identified;
[0009] If the first time difference between the first target time and the current time is less than a preset first time threshold, then the distance between the first location and the second location corresponding to the predicted pedestrian in the saved second image is determined.
[0010] If the distance is less than a preset distance threshold, a first preset range containing the location of the target pedestrian is determined in the first image, and the first attribute corresponding to the target pedestrian is matched with the second attribute of each pedestrian contained in the second preset range corresponding to the first preset range in the saved second image; if the matching condition is met with any pedestrian in the second image, the identifier of the successfully matched pedestrian in the second image is determined as the target identifier corresponding to the target pedestrian.
[0011] This application provides a target tracking device, the device comprising:
[0012] The determination module is used to obtain a first image acquired at the current time, determine the first location and corresponding predicted identifier of the target pedestrian contained in the first image, and determine the first attribute of the target pedestrian; determine the first target time corresponding to the second image of the pedestrian whose predicted identifier was last identified; if the first time difference between the first target time and the current time is less than a preset first time threshold, then determine the distance between the first location and the second location corresponding to the pedestrian whose predicted identifier is in the saved second image;
[0013] The processing module is configured to, if the distance is less than a preset distance threshold, determine a first preset range containing the location of the target pedestrian in the first image, and match the first attribute corresponding to the target pedestrian with the second attribute of each pedestrian contained in a second preset range corresponding to the first preset range in the saved second image; if a successful match is found with any pedestrian in the second image, the identifier of the successfully matched pedestrian in the second image is determined as the target identifier corresponding to the target pedestrian.
[0014] This application provides an electronic device including a processor, which executes a computer program stored in a memory to implement the steps of any of the target tracking methods described above.
[0015] This application provides a computer-readable storage medium storing a computer program executable by a terminal, which, when run on the terminal, causes the terminal to perform the steps of any of the target tracking methods described above.
[0016] In this application, a first image acquired at the current time is obtained; the first location and corresponding predicted identifier of the target pedestrian contained in the first image are determined, and the first attribute of the target pedestrian is determined; the first target time corresponding to the second image of the pedestrian whose predicted identifier was last identified is determined; if the first time difference between the first target time and the current time is less than a preset first time threshold, the distance between the first location and the second location corresponding to the predicted identifier of the pedestrian in the saved second image is determined; if the distance is less than a preset distance threshold, the first preset range of the location of the target pedestrian in the first image is determined, and the first attribute corresponding to the target pedestrian is matched with the second attribute of each pedestrian contained in the second preset range corresponding to the first preset range in the saved second image; if the matching condition is met with any pedestrian in the second image, the identifier of the successfully matched pedestrian in the second image is determined as the target identifier corresponding to the target pedestrian. In this embodiment, after determining the first attribute of the target pedestrian, the first attribute is not directly matched with the attributes of all pedestrians contained in the second image. Instead, considering that the target pedestrian's movement range is limited in a short time, the range in which the target pedestrian is most likely to appear in the second image is first selected, i.e., the second preset range. Then, the first attribute is matched with the second attributes of all pedestrians contained in the second preset range in the second image. On the one hand, this reduces the workload of matching, and the target tracking method can meet the requirements of real-time operation. On the other hand, it can more accurately determine the target identifier corresponding to the target pedestrian, so as to accurately track the target pedestrian, with high detection accuracy and high recall rate. Furthermore, the technical solution protected by this application has robustness, generalizability, and real-time performance, and meets the characteristics of reliability. 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 A schematic diagram of a target tracking process provided for some embodiments of this application;
[0019] Figure 2 A schematic diagram showing a second image provided for some embodiments of this application;
[0020] Figure 3 A schematic diagram showing a first image provided for some embodiments of this application;
[0021] Figure 4 A schematic diagram illustrating a matching method determination process provided in some embodiments of this application;
[0022] Figure 5 This is a schematic diagram illustrating the matching of a first feature vector corresponding to a target pedestrian with a second feature vector corresponding to each pedestrian, as provided in some embodiments of this application.
[0023] Figure 6 A schematic diagram showing the appearance of burrs provided in some embodiments of this application;
[0024] Figure 7 A schematic diagram illustrating a process for determining a dwelling event, provided for some embodiments of this application;
[0025] Figure 8 A schematic diagram of a loitering event alarm process provided for some embodiments of this application;
[0026] Figure 9 A schematic diagram of the structure of a target tracking device provided in some embodiments of this application;
[0027] Figure 10 This is a schematic diagram of the structure of an electronic device provided in some embodiments of this application. Detailed Implementation
[0028] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art are within the scope of protection of this application.
[0029] To reduce the workload of matching and accurately track target pedestrians, embodiments of this application provide a target tracking method, apparatus, device, and medium.
[0030] In this application, a first image acquired at the current time is obtained, and the first location and corresponding predicted identifier of the target pedestrian contained in the first image are determined, and the first attribute of the target pedestrian is determined; the first target time corresponding to the second image of the pedestrian whose predicted identifier was last identified is determined; if the first time difference between the first target time and the current time is less than a preset first time threshold, the distance between the first location and the second location corresponding to the predicted identifier of the pedestrian in the saved second image is determined; if the distance is less than a preset distance threshold, the first preset range of the location of the target pedestrian contained in the first image is determined, and the first attribute corresponding to the target pedestrian is matched with the second attribute of each pedestrian contained in the second preset range corresponding to the first preset range in the saved second image; if the matching condition is met with any pedestrian in the second image, the identifier of the successfully matched pedestrian in the second image is determined as the target identifier corresponding to the target pedestrian.
[0031] Figure 1 A schematic diagram of a target tracking process provided for some embodiments of this application, the process including the following steps:
[0032] S101: Obtain the first image acquired at the current time, determine the first location and corresponding predicted identifier of the target pedestrian contained in the first image, and determine the first attribute of the target pedestrian.
[0033] The target tracking method provided in this application is applied to an electronic device, which may be a smart terminal, a PC, or a server, etc.
[0034] In this embodiment, the electronic device first acquires a first image, which is captured at the current time, and this first image contains a target pedestrian. To track the target pedestrian, the electronic device first acquires the first location of the target pedestrian contained in the first image, a predicted identifier of the target pedestrian, and determines a first attribute of the target pedestrian. The predicted identifier is the predicted identity information of the target pedestrian. The first attribute can be the position of the human bounding box corresponding to the pedestrian, the feature vector corresponding to the pedestrian, etc.
[0035] To determine the first location and predicted identifier of a target pedestrian in the first image, in this embodiment, a first candidate location of the target pedestrian in the first image can be predicted based on the saved historical location information of the target pedestrian and a tracker. The tracker can be a Kalman filter, etc., and is not specifically limited. This first candidate location is a preliminary prediction and is generally not very precise.
[0036] To more accurately determine the location information of the target pedestrian, in this embodiment of the application, the human bounding boxes corresponding to all pedestrians contained in the first image can be detected based on the first image and the target detection algorithm. For each pedestrian, the second candidate position corresponding to the pedestrian is determined according to the human bounding box corresponding to the pedestrian. Then, the first candidate position is matched with each second candidate position respectively. The predicted identifier of the pedestrian corresponding to the successfully matched second candidate position is determined as the predicted identifier of the pedestrian, and the successfully matched second candidate position is determined as the first position of the target pedestrian.
[0037] Specifically, the distance between the first candidate position and each second candidate position can be determined separately, and then the second candidate position corresponding to the minimum distance can be determined as the second candidate position that successfully matches the first candidate position.
[0038] To determine the first attribute of a target pedestrian, the first attribute of the target pedestrian can be determined based on a feature extraction algorithm and a sub-image of the first image that contains the target pedestrian.
[0039] S102: Determine the first target time corresponding to the second image of the pedestrian whose predicted identifier was last identified.
[0040] In order to further determine whether the predicted identifier corresponding to the predicted target pedestrian is accurate, so as to track the target pedestrian more accurately, after the electronic device determines the predicted identifier corresponding to the target pedestrian, it first determines the second image of the pedestrian who last identified the predicted identifier, and determines the first target time when the second image was acquired.
[0041] S103: If the first time difference between the first target time and the current time is less than a preset first time threshold, then determine the distance between the first location and the second location corresponding to the predicted pedestrian in the saved second image.
[0042] Since the target pedestrian cannot move instantaneously between events, the first time difference between the first target time and the current time will not be too large. To accurately track the target pedestrian, the electronic device first determines the first time difference between the first target time and the current time, and then determines whether this first time difference is less than a preset first time threshold. This preset first time threshold can be 1 second, etc., and can be set according to requirements. If so, the distance between the first position of the target pedestrian in the first image and the second position corresponding to the predicted pedestrian in the second image is determined. This distance can be Euclidean distance, etc., and the smaller the distance, the greater the probability that the predicted pedestrian and the target pedestrian are the same person.
[0043] It should be noted that since the time interval for acquiring one frame of image is often fixed, in addition to determining whether the first time difference between the first target time and the current time is less than a preset first time threshold to determine whether the target pedestrian has moved instantaneously, it is also possible to determine whether the target pedestrian has moved instantaneously by determining whether the number of images acquired within the time length corresponding to the first target time and the current time is less than a preset number threshold.
[0044] S104: If the distance is less than a preset distance threshold, then a first preset range containing the location of the target pedestrian is determined in the first image, and the first attribute corresponding to the target pedestrian is matched with the second attribute of each pedestrian contained in the second preset range corresponding to the first preset range in the saved second image; if the matching condition is met with any pedestrian in the second image, then the identifier of the successfully matched pedestrian in the second image is determined as the target identifier corresponding to the target pedestrian.
[0045] Since the target pedestrian's movement range is limited, meaning the target pedestrian cannot move too far in an instant, the distance the target pedestrian moves in each subsequent movement will not be too far.
[0046] Figure 2 This is a schematic diagram showing a second image provided in some embodiments of this application. Figure 3 This is a schematic diagram showing a first image provided for some embodiments of this application, and is now intended for... Figure 2 and Figure 3 Please provide an explanation.
[0047] If the target pedestrian identified as ID1 appears at position A in the second image, and the target pedestrian identified as ID2 appears at position B in the second image, then the target pedestrian appears at position C in the first image. Since the target pedestrian's range of movement is limited, it is unlikely that the target pedestrian identified as ID2 will move from position B to position C in a short period of time. In other words, it is unlikely that the target pedestrian is identified as ID2. It is more likely that the target pedestrian identified as ID1 will move from position A to position C in a short period of time. In other words, it is more likely that the target pedestrian is identified as ID1.
[0048] To more accurately track target pedestrians, after determining the distance between the first and second positions, it is determined whether this distance is less than a preset distance threshold. If so, a first preset range containing the target pedestrian's location is determined in the first image. This first preset range can be a circular range centered on the target pedestrian's center point with a first preset value as its radius, or a square range centered on the target pedestrian's center point with a second preset value as its side length, etc. Specifically, the shape and size of the first preset range can be set according to requirements. The distance threshold can be determined based on the target pedestrian in the following ways:
[0049]
[0050] Among them, L t w is the distance threshold. x β is the width of the bounding box corresponding to the target pedestrian, representing a minimum distance unit; β is a preset distance coefficient that can be flexibly set according to needs.
[0051] After determining the first preset range in the first image, a second preset range corresponding to the first preset range in the second image is determined based on the first preset range. The first preset range and the second preset range have the same size and shape, and the coordinate position of the first preset range in the first image is the same as the coordinate position of the second preset range in the second image.
[0052] After determining the second preset range, the electronic device matches the first attribute of the target pedestrian with the second attribute of each pedestrian included in the second preset range in the saved second image. If the matching condition is met with any pedestrian in the second image, the identifier of the successfully matched pedestrian in the second image is determined as the target identifier corresponding to the target pedestrian.
[0053] Figure 4 This is a schematic diagram illustrating a matching method determination process provided in some embodiments of this application. Now, regarding... Figure 4 Please provide an explanation.
[0054] Initialize member variable Time last Its Time last Represent the time of the first target corresponding to the second image; initialize the member variable Location. last Its Location last To characterize the second position of the predicted pedestrian in the second image, before feature matching, it is first determined whether the time difference between the current time and the first target time exceeds 1 second, or whether the number of images collected within the time length corresponding to the current time and the first target time is greater than a preset threshold. If so, a global match is performed between the target pedestrian and all pedestrians contained in the second image; otherwise, the first position P(x,y) and the second position P of the target pedestrian in the first image are determined. i (x i ,y i The distance is given by the first and second positions, where the first and second positions can be the positions of the bottom edges of the human body frames corresponding to the pedestrians, and the distance is given by the second position. Determine distance L i Is it less than the preset distance threshold L? t If so, then a local match is performed between the target pedestrian and all pedestrians contained within the second preset range in the second image; otherwise, a global match is performed between the target pedestrian and all pedestrians contained in the second image.
[0055] In this embodiment, after determining the first attribute of the target pedestrian, the first attribute is not directly matched with the attributes of all pedestrians contained in the second image. Instead, considering that the target pedestrian's movement range is limited in a short time, the range in which the target pedestrian is most likely to appear in the second image is first selected, i.e., the second preset range. Then, the first attribute is matched with the second attributes of all pedestrians contained in the second preset range in the second image. On the one hand, this reduces the workload of matching, and the target tracking method can meet the requirements of real-time operation. On the other hand, it can more accurately determine the target identifier corresponding to the target pedestrian, so as to accurately track the target pedestrian, with high detection accuracy and high recall rate. Furthermore, the technical solution protected by this application has robustness, generalizability, and real-time performance, and meets the characteristics of reliability.
[0056] In order to accurately match the first attribute corresponding to the first pedestrian with the second attribute of each pedestrian included in the second preset range so as to track the target pedestrian, based on the above embodiments, in this embodiment of the application, the attributes of the pedestrian include the position of the human body frame corresponding to the pedestrian.
[0057] The step of matching the first attribute corresponding to the target pedestrian with the second attributes of each pedestrian included in the second preset range corresponding to the first preset range in the saved second image includes:
[0058] Based on the position of the first human body frame corresponding to the target pedestrian and the positions of the second human body frames corresponding to each pedestrian included in the second preset range, the intersection-over-interference ratio of the first human body frame corresponding to the target pedestrian and the second human body frames corresponding to each pedestrian is determined.
[0059] In this embodiment, if the pedestrian's attribute is the position of the human bounding box corresponding to the pedestrian, then when matching the first attribute corresponding to the target pedestrian with the second attributes corresponding to each pedestrian included in the second preset range, the intersection-union ratio (IUGR) of the first human bounding box corresponding to the target pedestrian and the second human bounding boxes corresponding to each pedestrian within the second preset range is determined based on the position of the first human bounding box corresponding to the target pedestrian and the positions of the second human bounding boxes corresponding to each pedestrian within the second preset range. A higher IUGR indicates a higher matching degree.
[0060] The process of determining the intersection-union ratio of two human body frames is existing technology and will not be elaborated here.
[0061] To determine whether a pedestrian successfully matches the target pedestrian, based on the above embodiments, in this embodiment, determining that the target pedestrian meets the matching conditions with any pedestrian in the second image includes:
[0062] If the intersection-union ratio (IU) of the first human bounding box corresponding to the target pedestrian and the second human bounding box corresponding to any pedestrian in the second image is greater than a preset IU threshold, then it is determined that the target pedestrian and the pedestrian in the second image meet the matching success condition.
[0063] To determine whether a pedestrian in the second image matches the target pedestrian successfully, in this embodiment, after determining the intersection-union ratio (IUR) of the first human body frame corresponding to the target pedestrian and the second human body frame corresponding to each pedestrian within a second preset range in the second image, it is determined whether the IUR of the second human body frame of any pedestrian and the first human body frame is greater than a preset IUR threshold. If so, it is determined that the target pedestrian and the pedestrian in the second image meet the matching conditions. Otherwise, it is determined that no pedestrian and the target pedestrian meet the matching conditions. In this case, the target pedestrian is the first pedestrian to appear.
[0064] In order to accurately match the first attribute corresponding to the first pedestrian with the second attribute of each pedestrian in order to track the target pedestrian, based on the above embodiments, in this embodiment of the application, the pedestrian's attribute includes the feature vector corresponding to the pedestrian;
[0065] The step of matching the first attribute corresponding to the target pedestrian with the second attributes of each pedestrian included in the second preset range corresponding to the first preset range in the saved second image includes:
[0066] Based on the first feature vector corresponding to the target pedestrian and the second feature vectors corresponding to each pedestrian within the second preset range, the distance between the first feature vector corresponding to the target pedestrian and the second feature vectors corresponding to each pedestrian is determined.
[0067] In this embodiment, if the pedestrian's attribute is a feature vector corresponding to the pedestrian, then when matching the first attribute corresponding to the target pedestrian with the second attributes corresponding to each pedestrian within a second preset range, the distance between the first feature vector corresponding to the target pedestrian and the second feature vectors corresponding to each pedestrian within the second preset range is determined based on the first feature vector corresponding to the target pedestrian and the second feature vectors corresponding to each pedestrian within the second preset range. This distance can be Euclidean distance, and the smaller the distance, the higher the matching degree.
[0068] Figure 5 This is a schematic diagram illustrating the matching of the first feature vector corresponding to a target pedestrian with the second feature vector corresponding to each pedestrian, as provided in some embodiments of this application. Now, regarding... Figure 5 Please provide an explanation.
[0069] The first feature vector is (-2.130812, 2.516617, -0.650786, ...). The second preset range contains 4 pedestrians, whose corresponding identifiers are ID0, ID1, ID2, and ID3. The second feature vector corresponding to the pedestrian identified as ID0 is (-0.340458, -2.399681, 1.742432, ...), and the second feature vector corresponding to the pedestrian identified as ID1 is ... The vector is (-0.990582, 0.475103, 2.169523, ...). The second feature vector corresponding to the pedestrian identified as ID2 is (-0.581453, 0.579555, 3.340139, ...). The second feature vector corresponding to the pedestrian identified as ID3 is (2.724491, -0.380879, 2.154531, ...). Then, first determine (...). The distances between (-2.130812, 2.516617, -0.650786, ...) and (-0.340458, -2.399681, 1.742432, ...) and between (-2.130812, 2.516617, -0.650786, ...) and (-0.990582, 0.475103, 2.169523, ...) are also considered. The distances between (-2.130812, 2.516617, -0.650786, ...) and (-0.581453, 0.579555, 3.340139, ...) and between (-2.130812, 2.516617, -0.650786, ...) and (2.724491, -0.380879, 2.154531, ...) are calculated.
[0070] To determine whether a pedestrian successfully matches the target pedestrian, based on the above embodiments, in this embodiment, determining that the target pedestrian meets the matching conditions with any pedestrian in the second image includes:
[0071] If the distance between the target pedestrian and any pedestrian in the second image is less than the currently saved distance threshold, then it is determined that the target pedestrian and the pedestrian in the second image meet the matching conditions.
[0072] In order to determine whether there is a pedestrian in the second image that matches the target pedestrian, in this embodiment of the application, after determining the distance between the first feature vector corresponding to the target pedestrian and the second feature vector corresponding to each pedestrian, it is determined whether there is any pedestrian whose distance is less than the currently stored distance threshold. If so, it is determined that the target pedestrian and the pedestrian in the second image meet the matching conditions. Otherwise, it is determined that there is no pedestrian that meets the matching conditions with the target pedestrian. At this time, the target pedestrian is the pedestrian who appears for the first time.
[0073] To accurately track target pedestrians, based on the above embodiments, in this embodiment, before determining that the target pedestrian and the pedestrian in the second image meet the matching success condition if the distance between the target pedestrian and any pedestrian in the second image is less than the currently stored distance threshold, the method further includes:
[0074] Determine whether the current time has reached the update time of the distance threshold. If not, execute the subsequent operation that if the distance between the target pedestrian and any pedestrian in the second image is less than the currently saved distance threshold, then determine that the target pedestrian and the pedestrian in the second image meet the matching conditions.
[0075] If so, determine the first average grayscale value corresponding to each third image acquired within a preset time period before the current time; determine the target lighting condition level corresponding to the first average grayscale value based on the correspondence between the average grayscale value and the lighting condition level; determine the target distance threshold corresponding to the target lighting condition level based on the target lighting condition level, wherein the higher the target lighting condition level, the larger the corresponding target distance threshold; update the currently saved distance threshold using the target distance threshold, and perform the subsequent operation that if the distance between the target pedestrian and any pedestrian in the second image is less than the currently saved distance threshold, then determine that the target pedestrian and the pedestrian in the second image meet the matching success condition.
[0076] When extracting features from images acquired under different lighting conditions, the quality of pedestrian features extracted from those images varies. Generally, in well-lit conditions, the target edges and textures of the acquired images are more realistic and richer, resulting in higher quality pedestrian features that better represent the original shape attributes of the pedestrians in the image, and the differences between features corresponding to different pedestrians are also more obvious. However, in scenes with weak lighting conditions such as at night or on cloudy days, the acquired images are affected by factors such as blurred target edges and loss of texture information, resulting in lower quality pedestrian features extracted from these images. These features cannot well represent the original shape attributes of the pedestrians, and the differences between features corresponding to different pedestrians are also smaller, meaning that the features of different pedestrians are easily "mixed up." Therefore, determining whether there is a successful match between a pedestrian and a target pedestrian based on whether the distance between any pedestrian in the second image and the target pedestrian is less than the currently saved distance threshold is problematic. If the lighting conditions are poor, the distance threshold that was originally applicable under better lighting conditions may not be applicable under poor lighting conditions, which may easily lead to false detections of events due to feature matching errors.
[0077] To improve the accuracy of matching, in this application, different distance thresholds can be set for different lighting conditions. The stronger the lighting conditions, the larger the corresponding distance threshold, and the weaker the lighting conditions, the smaller the corresponding distance threshold. The lighting conditions can include good lighting conditions, average lighting conditions, and poor lighting conditions, etc.
[0078] Specifically, the electronic device can store a distance threshold. Before each feature matching operation—that is, before determining that the target pedestrian and any pedestrian in the second image meet the matching criteria if the distance is less than the currently stored distance threshold—the device first checks the current lighting conditions. Then, it checks whether the distance threshold corresponding to the current lighting conditions matches the stored distance threshold, and subsequently determines whether to update the stored distance threshold. Specifically, if they match, no update is needed; otherwise, the distance threshold corresponding to the current lighting conditions needs to be updated to the stored distance threshold.
[0079] Since lighting conditions do not change significantly in a short period of time, determining the current lighting conditions and updating the stored distance threshold based on them before each feature matching operation would be extremely time-consuming. To reduce the workload of the electronic device and improve the efficiency of determining whether to update the distance threshold, the device is pre-set to update the distance threshold. The distance threshold can be updated every preset time interval or after a preset number of frames have been acquired. The specific timing of the distance threshold update can be set according to requirements.
[0080] To determine whether to update the threshold at the current time, before determining that the target pedestrian and the pedestrian in the second image meet the matching conditions if the distance between the target pedestrian and any pedestrian in the second image is less than the currently saved distance threshold, the electronic device first determines whether the current time has reached the time for updating the distance threshold. If not, it determines that there is no need to update the distance threshold. Therefore, it directly executes the subsequent operation that determines that the target pedestrian and the pedestrian in the second image meet the matching conditions if the distance between the target pedestrian and any pedestrian in the second image is less than the currently saved distance threshold.
[0081] If the current time reaches the update time of the distance threshold, it is determined that the distance threshold needs to be updated. To accurately update the distance threshold, the electronic device first determines the lighting condition level corresponding to the current time. Specifically, in this embodiment, the first average gray value corresponding to each third image acquired within a preset time length before the current time can be determined. Specifically, for each third image, a candidate average gray value corresponding to that third image can be determined, and then the mean of the candidate average gray values corresponding to each third image can be determined, and this mean is determined as the first average gray value. In this embodiment, it is preferable to determine the candidate average gray value corresponding to each third image acquired within the specified ns every n seconds, and to calculate the first average gray value every m minutes. The values of n and m can be set according to requirements. If the lighting conditions of the algorithm scene change very frequently, the values of n and m can be appropriately reduced. In this embodiment, it is preferable that n = 60 and m = 10.
[0082] To determine the target lighting condition level corresponding to the current time, the electronic device stores the correspondence between average grayscale values and lighting condition levels. After determining the first average grayscale value, the target lighting condition level corresponding to the first average grayscale value is determined based on this first average grayscale value and the correspondence between average grayscale values and lighting condition levels. Specifically, a grayscale level range can be preset. After determining the first average grayscale value, it is first determined which target grayscale level space the first average grayscale value belongs to. Then, based on the correspondence between the grayscale level range and lighting condition levels, the target lighting condition level corresponding to the target grayscale level range is determined.
[0083] After determining the target lighting condition level, the target distance threshold corresponding to the target lighting condition level is then determined. The higher the target lighting condition level, the larger the corresponding target distance threshold.
[0084] Specifically, the target distance threshold, T, can be determined based on the following methods and the target lighting conditions level. feature =T feature_base +T feature_base·α·l·O;
[0085] Where 'l' represents the target lighting condition level, with a value ranging from {0, 1, 2}. A value of 0 indicates good lighting conditions, a value of 1 indicates moderate lighting conditions, and a value of 2 indicates poor lighting conditions. Where T... feature_base The threshold is the basic threshold for feature matching, α represents the threshold adjustment scale, and its T feature_base The values of α and 0 can be set according to requirements. 0 represents the feature matching adjustment switch, with a value range of {0,1}. When its value is 0, the feature matching adjustment switch is off; when its value is 1, the feature matching adjustment switch is on. When considering the influence of light intensity on the distance threshold, it is set to 1. Specifically, if the target tracking method of this application is used indoors with good nighttime lighting, the value of "feature matching adjustment switch 0" can be set to 0, i.e., no threshold adjustment is performed, to reduce computational load.
[0086] After determining the target distance threshold, in this embodiment of the application, the target distance threshold is used to update the currently saved distance threshold, and then the operation of determining that the target pedestrian and the pedestrian in the second image meet the matching conditions is performed if the distance between the target pedestrian and any pedestrian in the second image is less than the currently saved distance threshold.
[0087] In existing technologies, the distance threshold is set to a fixed value when performing feature matching, without taking into account the rationality of the threshold under different lighting conditions, resulting in a low accuracy rate of feature matching. However, in the embodiments of this application, different distance thresholds are set for different lighting conditions, which is more reasonable and results in a higher accuracy rate of feature matching.
[0088] To accurately determine the first average grayscale value and reduce the workload of electronic devices, based on the above embodiments, in this embodiment, determining the first average grayscale value corresponding to each third image acquired within a preset time period before the current time includes:
[0089] For each third image, a downsampling operation is performed on the third image, and the second average gray value corresponding to the downsampled image is obtained;
[0090] The mean of the second average grayscale value corresponding to each downsampled image is determined as the first average grayscale value.
[0091] To reduce the workload of electronic devices, in this embodiment of the application, for each third image, a downsampling operation can be performed on the third image. Specifically, the image can be downsampled until the number of pixels in either the length or width of the image is less than a preset value, such as 100. Then, the second average gray value corresponding to the downsampled image is obtained. Finally, the mean of the second average gray value corresponding to each downsampled image is determined as the first average gray value.
[0092] To accurately track target pedestrians, based on the above embodiments, in this embodiment of the application, before determining the identifier of the successfully matched pedestrian in the second image as the target identifier corresponding to the target pedestrian, the method further includes:
[0093] Determine the second time difference between the current time and the second target time corresponding to the last time the matched pedestrian was identified, and the saved third time difference, wherein the third time difference is the difference between the second target time and the third target time corresponding to the last time the matched pedestrian was identified before the second target time;
[0094] If both the second time difference and the third time difference are less than a preset second time threshold, then the subsequent operation of determining the identifier of the successfully matched pedestrian in the second image as the target identifier corresponding to the target pedestrian is performed.
[0095] Normally, target pedestrians appear continuously and cannot appear and disappear instantly. Since this application is mainly used for real-time detection and has a relatively high frame rate, the target pedestrian should appear in the picture for multiple consecutive frames, rather than appearing in a jagged manner.
[0096] Figure 6 This is a schematic diagram showing the appearance of burrs provided in some embodiments of this application, and is now specifically for... Figure 6 Please provide an explanation.
[0097] If a pedestrian appears continuously or nearly continuously in frames 1-6 and in frames m-m+3, it is likely a correct tracking result; while if the pedestrian appears sporadically in frame t, it is likely a mismatch, i.e. an incorrect tracking result.
[0098] If the results of mismatches in frame t are not filtered, and the pedestrian meets the dwell time / frame number threshold in frame t, then an incorrect alarm message will be issued. Therefore, in order to improve the accuracy of tracking and the accuracy of dwell event judgment, in this embodiment, a filtering mechanism for erroneous tracking results can be added. Only if a pedestrian appears continuously or nearly continuously at least twice is it considered a correct match; otherwise, it is considered an incorrect match and no alarm message is issued.
[0099] To determine whether a target pedestrian appears continuously or nearly continuously at least twice, this embodiment determines a second time difference between the current time and the second target time corresponding to the last successfully matched pedestrian, and a saved third time difference. The third time difference is the difference between the second target time and the third target time corresponding to the last successfully matched pedestrian identified before the second target time. Then, it is determined whether both the second time difference and the third time difference are less than a preset second time threshold. If so, it is determined that the target pedestrian appears continuously or nearly continuously at least twice, and the subsequent operation of identifying the identifier of the successfully matched pedestrian in the second image as the target identifier corresponding to the target pedestrian is performed. The dwell time of the target pedestrian is also determined, and an alarm message is issued. Otherwise, it is determined that the target pedestrian does not appear continuously or nearly continuously at least twice, and no alarm message is issued.
[0100] Figure 7 This application provides a schematic diagram of a process for determining a dwelling event, which is now being discussed in some embodiments. Figure 7 Please provide an explanation.
[0101] Initialize variable Time last , where Time last Characterize the time corresponding to the second target image; initialize the variable differenceTime. last , differenceTime before_last differTime last The differenceTime is the second time difference between the current time and the second target time. before_last The difference between the second target time and the third target time corresponding to the first successfully matched pedestrian identification before the second target time.
[0102] When differTime last , differenceTime before_last When none of them are empty, the condition `differTime` is used for judgment. last , differenceTime before_last If all values are less than the preset second time threshold, then the matching result is determined to be correct. If the alarm conditions are met, then alarm information can be output.
[0103] Figure 8 This application provides a schematic diagram of a loitering event alarm process in some embodiments. The following is a description of the process. Figure 8 Please provide an explanation.
[0104] To achieve the alarm for loitering events, this application embodiment uses the deepsort algorithm to determine whether a target pedestrian has loitered. Specifically, it mainly includes five modules: detection and feature extraction module, tracker prediction module, matching module, matching result processing module, and loitering event determination module.
[0105] The detection and feature module first detects the human body bounding box of the target pedestrian in the first image, and determines the first candidate position of the target pedestrian based on the human body bounding box. Then, it extracts features from the sub-image corresponding to the human body bounding box to determine the first feature vector corresponding to the target pedestrian.
[0106] The tracker prediction module predicts the identifier of each pedestrian and, based on the historical location information of each pedestrian and the tracker, predicts the predicted position of each pedestrian in the first image, i.e., the second candidate position.
[0107] The matching module performs position matching based on the first candidate position corresponding to the target pedestrian and the second candidate position of each pedestrian. The second candidate position of a successfully matched pedestrian is determined as the first position of the target pedestrian, and the identifier of the successfully matched pedestrian is determined as the predicted identifier of the target pedestrian. Then, illumination-based adaptive setting of matching parameters is performed. Specifically, position matching is performed based on the first and second positions, or feature matching is performed based on the first and second feature vectors, to determine whether any pedestrian in the second image successfully matches the target pedestrian.
[0108] The matching result processing module is used to identify the appearance of a new pedestrian when a match fails. The new target is then initialized so that the new pedestrian can be tracked subsequently. If the match is successful, the identifier corresponding to the successfully matched pedestrian is determined as the identifier of the target pedestrian, and the predicted position of the target pedestrian is determined as the position of the tracked target pedestrian in the first image.
[0109] The loitering event judgment module is used to determine whether the alarm interval has been exceeded after determining that the target pedestrian's target loitering time exceeds the time threshold. If the alarm interval has been exceeded, an alarm message is output.
[0110] The technical solution protected in this application is robust, generalizable, and real-time, and meets the requirements of reliability.
[0111] Figure 9 This application provides a schematic diagram of the structure of a target tracking device according to some embodiments. The device includes:
[0112] The determination module 901 is used to obtain a first image acquired at the current time, determine the first position and corresponding predicted identifier of the target pedestrian contained in the first image, and determine the first attribute of the target pedestrian; determine the first target time corresponding to the second image of the pedestrian whose predicted identifier was last identified; if the first time difference between the first target time and the current time is less than a preset first time threshold, then determine the distance between the first position and the second position corresponding to the pedestrian with the predicted identifier in the saved second image;
[0113] The processing module 902 is configured to, if the distance is less than a preset distance threshold, determine a first preset range containing the location of the target pedestrian in the first image, and match the first attribute corresponding to the target pedestrian with the second attributes of each pedestrian contained in a second preset range corresponding to the first preset range in the saved second image; if a successful match is found with any pedestrian in the second image, the identifier of the successfully matched pedestrian in the second image is determined as the target identifier corresponding to the target pedestrian.
[0114] Furthermore, the pedestrian's attributes include the position of the corresponding human bounding box;
[0115] The processing module 902 is specifically used to determine the intersection-over-interference ratio of the first human body frame corresponding to the target pedestrian and the second human body frames corresponding to each pedestrian within the second preset range, based on the position of the first human body frame corresponding to the target pedestrian and the position of the second human body frames corresponding to each pedestrian.
[0116] Furthermore, the processing module 902 is also configured to determine that the target pedestrian and the pedestrian in the second image meet the matching success condition if the intersection-union ratio of the first human body frame corresponding to the target pedestrian and the second human body frame corresponding to any pedestrian in the second image is greater than a preset intersection-union ratio threshold.
[0117] Furthermore, the pedestrian's attributes include the feature vector corresponding to the pedestrian;
[0118] The processing module 902 is specifically used to determine the distance between the first feature vector corresponding to the target pedestrian and the second feature vectors corresponding to each pedestrian within the second preset range, based on the first feature vector corresponding to the target pedestrian and the second feature vectors corresponding to each pedestrian.
[0119] Furthermore, the processing module 902 is also configured to determine that the target pedestrian and the pedestrian in the second image meet the matching success condition if the distance between the target pedestrian and any pedestrian in the second image is less than the currently saved distance threshold.
[0120] Furthermore, the processing module 902 is also used to determine whether the current time has reached the update time of the distance threshold. If not, it performs the subsequent operation that if the distance between the target pedestrian and any pedestrian in the second image is less than the currently saved distance threshold, it determines that the target pedestrian and the pedestrian in the second image meet the matching success condition.
[0121] Furthermore, the processing module 902 is also configured to: if the current time reaches the update time of the distance threshold, determine the first average gray value corresponding to each third image acquired within a preset time length before the current time; determine the target lighting condition level corresponding to the first average gray value according to the correspondence between the average gray value and the lighting condition level; determine the target distance threshold corresponding to the target lighting condition level according to the target lighting condition level, wherein the higher the target lighting condition level, the larger the corresponding target distance threshold; update the currently saved distance threshold using the target distance threshold, and perform the subsequent operation that if the distance between the target pedestrian and any pedestrian in the second image is less than the currently saved distance threshold, then determine that the target pedestrian and the pedestrian in the second image meet the matching success condition.
[0122] Further, the processing module 902 is specifically used to perform a downsampling operation on each third image and obtain a second average gray value corresponding to the downsampled image; and to determine the mean of the second average gray value corresponding to each downsampled image as the first average gray value.
[0123] Furthermore, the processing module 902 is also used to determine a second time difference between the current time and the second target time corresponding to the last time the matched pedestrian was identified, and a saved third time difference, wherein the third time difference is the difference between the second target time and the third target time corresponding to the last time the matched pedestrian was identified; if both the second time difference and the third time difference are less than a preset second time threshold, then the subsequent operation of determining the identifier of the matched pedestrian in the second image as the target identifier corresponding to the target pedestrian is performed.
[0124] Based on the above embodiments, some embodiments of this application also provide an electronic device, such as... Figure 10 As shown, it includes: processor 1001, communication interface 1002, memory 1003 and communication bus 1004, wherein processor 1001, communication interface 1002 and memory 1003 communicate with each other through communication bus 1004.
[0125] The memory 1003 stores a computer program, which, when executed by the processor 1001, causes the processor 1001 to perform the following steps:
[0126] Obtain the first image acquired at the current time, determine the first location and corresponding predicted identifier of the target pedestrian contained in the first image, and determine the first attribute of the target pedestrian;
[0127] Determine the first target time corresponding to the second image of the pedestrian whose predicted identifier was last identified;
[0128] If the first time difference between the first target time and the current time is less than a preset first time threshold, then the distance between the first location and the second location corresponding to the predicted pedestrian in the saved second image is determined.
[0129] If the distance is less than a preset distance threshold, a first preset range containing the location of the target pedestrian is determined in the first image, and the first attribute corresponding to the target pedestrian is matched with the second attribute of each pedestrian contained in the second preset range corresponding to the first preset range in the saved second image; if the matching condition is met with any pedestrian in the second image, the identifier of the successfully matched pedestrian in the second image is determined as the target identifier corresponding to the target pedestrian.
[0130] Furthermore, the pedestrian's attributes include the position of the corresponding human bounding box;
[0131] The processor 1001 is specifically used to determine the intersection-over-interference ratio of the first human body frame corresponding to the target pedestrian and the second human body frames corresponding to each pedestrian within the second preset range, based on the position of the first human body frame corresponding to the target pedestrian and the position of the second human body frames corresponding to each pedestrian.
[0132] Furthermore, the processor 1001 is also configured to determine that the target pedestrian and the pedestrian in the second image meet the matching success condition if the intersection-union ratio of the first human body frame corresponding to the target pedestrian and the second human body frame corresponding to any pedestrian in the second image is greater than a preset intersection-union ratio threshold.
[0133] Furthermore, the pedestrian's attributes include the feature vector corresponding to the pedestrian;
[0134] The processor 1001 is specifically used to determine the distance between the first feature vector corresponding to the target pedestrian and the second feature vectors corresponding to each pedestrian within the second preset range, based on the first feature vector corresponding to the target pedestrian and the second feature vectors corresponding to each pedestrian within the second preset range.
[0135] Furthermore, the processor 1001 is also configured to determine that the target pedestrian and the pedestrian in the second image meet the matching success condition if the distance between the target pedestrian and any pedestrian in the second image is less than the currently saved distance threshold.
[0136] Furthermore, the processor 1001 is also used to determine whether the current time has reached the update time of the distance threshold. If not, it performs the subsequent operation that if the distance between the target pedestrian and any pedestrian in the second image is less than the currently saved distance threshold, it determines that the target pedestrian and the pedestrian in the second image meet the matching success condition.
[0137] Furthermore, the processor 1001 is also configured to: if the current time reaches the update time of the distance threshold, determine the first average gray value corresponding to each third image acquired within a preset time length before the current time; determine the target lighting condition level corresponding to the first average gray value according to the correspondence between the average gray value and the lighting condition level; determine the target distance threshold corresponding to the target lighting condition level according to the target lighting condition level, wherein the higher the target lighting condition level, the larger the corresponding target distance threshold; update the currently saved distance threshold using the target distance threshold, and perform the subsequent operation that if the distance between the target pedestrian and any pedestrian in the second image is less than the currently saved distance threshold, then determine that the target pedestrian and the pedestrian in the second image meet the matching success condition.
[0138] Further, the processor 1001 is specifically configured to perform a downsampling operation on each third image and obtain a second average gray value corresponding to the downsampled image; and to determine the mean of the second average gray value corresponding to each downsampled image as the first average gray value.
[0139] Furthermore, the processor 1001 is also configured to determine a second time difference between the current time and the second target time corresponding to the last successfully matched pedestrian, and a stored third time difference, wherein the third time difference is the difference between the second target time and the third target time corresponding to the last successfully matched pedestrian identified before the second target time; if both the second time difference and the third time difference are less than a preset second time threshold, then the subsequent operation of determining the identifier of the successfully matched pedestrian in the second image as the target identifier corresponding to the target pedestrian is executed.
[0140] The communication bus mentioned in the above server 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.
[0141] The communication interface 1002 is used for communication between the above-mentioned electronic device and other devices.
[0142] The memory may include random access memory (RAM) or non-volatile memory (NVM), 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.
[0143] The processors mentioned above can be general-purpose processors, including central processing units, network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits, field-programmable gate arrays or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
[0144] Based on the above embodiments, this invention also provides a computer-readable storage medium storing a computer program executable by an electronic device. When the program is run on the electronic device, the electronic device performs the following steps:
[0145] The memory stores a computer program that, when executed by the processor, causes the processor to perform the following steps:
[0146] Obtain the first image acquired at the current time, determine the first location and corresponding predicted identifier of the target pedestrian contained in the first image, and determine the first attribute of the target pedestrian;
[0147] Determine the first target time corresponding to the second image of the pedestrian whose predicted identifier was last identified;
[0148] If the first time difference between the first target time and the current time is less than a preset first time threshold, then the distance between the first location and the second location corresponding to the predicted pedestrian in the saved second image is determined.
[0149] If the distance is less than a preset distance threshold, a first preset range containing the location of the target pedestrian is determined in the first image, and the first attribute corresponding to the target pedestrian is matched with the second attribute of each pedestrian contained in the second preset range corresponding to the first preset range in the saved second image; if the matching condition is met with any pedestrian in the second image, the identifier of the successfully matched pedestrian in the second image is determined as the target identifier corresponding to the target pedestrian.
[0150] Furthermore, the pedestrian's attributes include the position of the corresponding human bounding box;
[0151] The step of matching the first attribute corresponding to the target pedestrian with the second attributes of each pedestrian included in the second preset range corresponding to the first preset range in the saved second image includes:
[0152] Based on the position of the first human body frame corresponding to the target pedestrian and the positions of the second human body frames corresponding to each pedestrian included in the second preset range, the intersection-over-interference ratio of the first human body frame corresponding to the target pedestrian and the second human body frames corresponding to each pedestrian is determined.
[0153] Further, determining that the target pedestrian and any pedestrian in the second image meet the matching conditions includes:
[0154] If the intersection-union ratio (IU) of the first human bounding box corresponding to the target pedestrian and the second human bounding box corresponding to any pedestrian in the second image is greater than a preset IU threshold, then it is determined that the target pedestrian and the pedestrian in the second image meet the matching success condition.
[0155] Furthermore, the pedestrian's attributes include the feature vector corresponding to the pedestrian;
[0156] The step of matching the first attribute corresponding to the target pedestrian with the second attributes of each pedestrian included in the second preset range corresponding to the first preset range in the saved second image includes:
[0157] Based on the first feature vector corresponding to the target pedestrian and the second feature vectors corresponding to each pedestrian within the second preset range, the distance between the first feature vector corresponding to the target pedestrian and the second feature vectors corresponding to each pedestrian is determined.
[0158] Further, determining that the target pedestrian and any pedestrian in the second image meet the matching conditions includes:
[0159] If the distance between the target pedestrian and any pedestrian in the second image is less than the currently saved distance threshold, then it is determined that the target pedestrian and the pedestrian in the second image meet the matching conditions.
[0160] Furthermore, before determining that the target pedestrian and any pedestrian in the second image meet the matching success condition if the distance between them is less than the currently stored distance threshold, the method further includes:
[0161] Determine whether the current time has reached the distance threshold update time. If not, execute the subsequent operation that if the distance between the target pedestrian and any pedestrian in the second image is less than the currently saved distance threshold, then determine that the target pedestrian and the pedestrian in the second image meet the matching success condition.
[0162] Furthermore, the method also includes:
[0163] If the current time reaches the update time of the distance threshold, then determine the first average gray value corresponding to each third image acquired within a preset time length before the current time; determine the target lighting condition level corresponding to the first average gray value based on the correspondence between the average gray value and the lighting condition level; determine the target distance threshold corresponding to the target lighting condition level based on the target lighting condition level, wherein the higher the target lighting condition level, the larger the corresponding target distance threshold; update the currently saved distance threshold using the target distance threshold, and then perform the subsequent operation that if the distance between the target pedestrian and any pedestrian in the second image is less than the currently saved distance threshold, then determine that the target pedestrian and that pedestrian in the second image meet the matching success condition.
[0164] Further, the first average grayscale value corresponding to each third image acquired within a preset time period prior to the current time includes:
[0165] For each third image, a downsampling operation is performed on the third image, and the second average gray value corresponding to the downsampled image is obtained;
[0166] The mean of the second average grayscale value corresponding to each downsampled image is determined as the first average grayscale value.
[0167] Furthermore, before determining the identifier of the successfully matched pedestrian in the second image as the target identifier corresponding to the target pedestrian, the method further includes:
[0168] Determine the second time difference between the current time and the second target time corresponding to the last time the matched pedestrian was identified, and the saved third time difference, wherein the third time difference is the difference between the second target time and the third target time corresponding to the last time the matched pedestrian was identified before the second target time;
[0169] If both the second time difference and the third time difference are less than a preset second time threshold, then the subsequent operation of determining the identifier of the successfully matched pedestrian in the second image as the target identifier corresponding to the target pedestrian is performed.
[0170] In this embodiment, after determining the first attribute of the target pedestrian, the first attribute is not directly matched with the attributes of all pedestrians contained in the second image. Instead, considering that the target pedestrian's range of movement is limited in a short time, the range in which the target pedestrian is most likely to appear in the second image is first selected, namely the second preset range. Then, the first attribute is matched with the second attributes of all pedestrians contained in the second preset range in the second image. On the one hand, this reduces the workload of matching, and the target tracking method can meet the requirements of real-time operation. On the other hand, it can more accurately determine the target identifier corresponding to the target pedestrian so as to accurately track the target pedestrian. Furthermore, the technical solution protected by this application has robustness, generalizability, and real-time performance.
[0171] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0172] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0173] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0174] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0175] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.
Claims
1. A target tracking method, characterized in that, The method includes: Obtain the first image acquired at the current time, determine the first location and corresponding predicted identifier of the target pedestrian contained in the first image, and determine the first attribute of the target pedestrian; Determine the first target time corresponding to the second image of the pedestrian whose predicted identifier was last identified; If the first time difference between the first target time and the current time is less than a preset first time threshold, then the distance between the first location and the second location corresponding to the predicted pedestrian in the saved second image is determined. If the distance is less than a preset distance threshold, then a first preset range containing the location of the target pedestrian is determined in the first image, and the first attribute corresponding to the target pedestrian is matched with the second attribute of each pedestrian contained in the second preset range corresponding to the first preset range in the saved second image; if the matching condition is met with any pedestrian in the second image, then the identifier of the successfully matched pedestrian in the second image is determined as the target identifier corresponding to the target pedestrian. The determination that the target pedestrian and any pedestrian in the second image meet the matching conditions includes: If the distance between the target pedestrian and any pedestrian in the second image is less than the currently saved distance threshold, then it is determined that the target pedestrian and the pedestrian in the second image meet the matching success condition. Before a successful match is achieved with any pedestrian in the second image, the method further includes: If the current time reaches the update time of the distance threshold, then determine the first average gray value corresponding to each third image acquired within a preset time length before the current time; determine the target lighting condition level corresponding to the first average gray value based on the correspondence between the average gray value and the lighting condition level; determine the target distance threshold corresponding to the target lighting condition level based on the target lighting condition level, wherein the higher the target lighting condition level, the larger the corresponding target distance threshold; update the currently saved distance threshold using the target distance threshold, and then perform the subsequent operation that if the distance between the target pedestrian and any pedestrian in the second image is less than the currently saved distance threshold, then determine that the target pedestrian and that pedestrian in the second image meet the matching success condition; Determining the target distance threshold corresponding to the target lighting condition level based on the target lighting condition level includes: The target distance threshold is determined based on the following formula: Where l represents the target lighting condition level, and its value ranges from {0, 1, 2}. When its value is 0, it indicates that the current lighting condition is good; when its value is 1, it indicates that the current lighting condition is average; and when its value is 2, it indicates that the current lighting condition is poor. The basic threshold for feature matching; The threshold adjustment scale is represented by O; the feature matching adjustment switch is represented by O, and its value range is {0,1}.
2. The method according to claim 1, characterized in that, The attributes of a pedestrian include the position of the human bounding box corresponding to the pedestrian; The step of matching the first attribute corresponding to the target pedestrian with the second attributes of each pedestrian included in the second preset range corresponding to the first preset range in the saved second image includes: Based on the position of the first human body frame corresponding to the target pedestrian and the positions of the second human body frames corresponding to each pedestrian included in the second preset range, the intersection-over-interference ratio of the first human body frame corresponding to the target pedestrian and the second human body frames corresponding to each pedestrian is determined.
3. The method according to claim 2, characterized in that, Determining that the target pedestrian and any pedestrian in the second image meet the matching conditions includes: If the intersection-union ratio (IU) of the first human bounding box corresponding to the target pedestrian and the second human bounding box corresponding to any pedestrian in the second image is greater than a preset IU threshold, then it is determined that the target pedestrian and the pedestrian in the second image meet the matching success condition.
4. The method according to claim 1 or 2, characterized in that, The attributes of a pedestrian include the feature vector corresponding to the pedestrian; The step of matching the first attribute corresponding to the target pedestrian with the second attributes of each pedestrian included in the second preset range corresponding to the first preset range in the saved second image includes: Based on the first feature vector corresponding to the target pedestrian and the second feature vectors corresponding to each pedestrian within the second preset range, the distance between the first feature vector corresponding to the target pedestrian and the second feature vectors corresponding to each pedestrian is determined.
5. The method according to claim 1, characterized in that, Before determining that the target pedestrian and any pedestrian in the second image meet the matching success condition if the distance between them is less than the currently stored distance threshold, the method further includes: Determine whether the current time has reached the distance threshold update time. If not, execute the subsequent operation that if the distance between the target pedestrian and any pedestrian in the second image is less than the currently saved distance threshold, then determine that the target pedestrian and the pedestrian in the second image meet the matching success condition.
6. The method according to claim 1, characterized in that, The first average grayscale value corresponding to each third image acquired within a preset time period before determining the current time includes: For each third image, a downsampling operation is performed on the third image, and the second average gray value corresponding to the downsampled image is obtained; The mean of the second average grayscale value corresponding to each downsampled image is determined as the first average grayscale value.
7. The method according to claim 1, characterized in that, Before determining the identifier of the successfully matched pedestrian in the second image as the target identifier corresponding to the target pedestrian, the method further includes: Determine the second time difference between the current time and the second target time corresponding to the last time the matched pedestrian was identified, and the saved third time difference, wherein the third time difference is the difference between the second target time and the third target time corresponding to the last time the matched pedestrian was identified before the second target time; If both the second time difference and the third time difference are less than a preset second time threshold, then the subsequent operation of determining the identifier of the successfully matched pedestrian in the second image as the target identifier corresponding to the target pedestrian is performed.
8. An electronic device, characterized in that, The electronic device includes a processor and a memory, the memory being used to store program instructions, and the processor being used to execute the computer program stored in the memory to implement the steps of the target tracking method according to any one of claims 1-7.