Target detection method, security equipment and readable storage medium
By comparing the target images taken at different times, the total number of displacement changes of the target is determined, the problem of large error in static target detection in security equipment is solved, the detection accuracy is improved, false alarms are reduced, and the reliability of AI detection methods is enhanced .
Patent Information
- Application Number
- CN202110440318.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-04-22
- Publication Date
- 2024-11-22
- Estimated Expiration
- 2041-04-22
AI Technical Summary
The false alarm rate of existing security equipment is high when detecting the static target state, especially through artificial intelligence detection, which leads to a large detection error for the static target.
By acquiring multiple frame images taken at different times in the object detection method, the displacement change amount of the target is compared. If the total number of times the change amount is less than the preset threshold reaches the second preset threshold, the target is determined to be stationary, and vice versa, the target moves. , reduce false alarms.
It improves the accuracy of detection of static target state, reduces the probability of false alarms, and enhances users' recognition of AI detection methods.
Smart Images

Figure CN113516018B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of security technology, and in particular to a target detection method, security equipment and a readable storage medium. Background Art
[0002] Current cameras generally have various detection and alarm functions, such as motion detection. When the camera detects a moving target in the picture, an alarm is triggered. The main methods of motion detection include: 1. Through motion sensors; 2. Artificial Intelligence (AI) detection method, through the camera's built-in AI chip or AI algorithm, real-time analysis of monitoring images and content, and identification of specific targets based on database and model training.
[0003] The sensitivity of motion sensors is poor, and they can only detect target movement when the target's coordinates change significantly. AI detection methods have higher sensitivity and are widely used in security equipment. However, AI detection methods have large errors in detecting the state of stationary targets. For example, although the target is stationary, the position of the target will have a small deviation in each image captured by the image sensor. In this case, the AI algorithm calculates that the target's coordinates have changed, and it will be determined that the target has moved, resulting in a false alarm. Summary of the invention
[0004] In view of this, embodiments of the present application provide a target detection method, a security device, and a readable storage medium to improve the accuracy of state detection of stationary targets and reduce false alarms.
[0005] In a first aspect, the present application provides a target detection method, comprising steps S1 to S62.
[0006] S1: Acquire multiple first frames obtained by photographing a target within a first period of time.
[0007] S2: Acquire multiple second frames obtained by photographing the target within a second period, where the end time of the first period is the start time of the second period.
[0008] S3: Compare each second frame with the first frames one by one to determine whether the displacement change of the target between the second frame and the first frame is less than a first preset threshold.
[0009] S4: If it is determined that the displacement change of the target is less than the first preset threshold, the count is increased once, and a total count is obtained after the comparison of multiple second frames is completed.
[0010] S5: Determine whether the total count reaches a second preset threshold. If yes, execute step S61: Determine whether the target is stationary. If no, execute step S62: Determine whether the target is moving.
[0011] In some examples, the plurality of first frames are stored in the first data link in chronological order.
[0012] In some examples, the coordinates of the target in the second frame are stored at the end of the second data chain in a first-in-first-out order.
[0013] In some instances, after determining that the total count is less than a second preset threshold and before determining that the target is moving, the method includes: determining whether the coordinates of the target in the second frame are coordinates stored in the second data link; and, if so, determining that the target is stationary; if not, determining that the target is moving.
[0014] In some instances, before determining that the target is stationary or determining that the target is moving, the method includes: obtaining the current detection result of the sensor on the target state; determining whether the current detection result is the same as the detection result of the sensor; if so, determining the state of the target with the same detection result; if not, determining the state of the target with one of the detection results according to a preset rule.
[0015] In some examples, the start time of the first time period is the initial time of photographing the target, and the duration of the second time period is shorter than the duration of the first time period.
[0016] The present application provides a security device, including: a shooting unit and a processing unit. The shooting unit is used to obtain multiple first frames obtained by shooting a target in a first time period, and multiple second frames obtained by shooting a target in a second time period, and the end time of the first time period is the start time of the second time period. The processing unit is used to compare each second frame with multiple first frames one by one to determine whether the displacement change of the target in the second frame and the first frame is less than a first preset threshold; and, if it is determined that the displacement change of the target is less than the first preset threshold, the count is increased once, and the total count is obtained after the comparison of multiple second frames is completed; the processing unit is also used to determine whether the total count reaches the second preset threshold; and, if so, it is determined that the target is stationary; if not, it is determined that the target is moving.
[0017] In some examples, after determining that the total count reaches the second preset threshold and before determining that the target moves, the processing unit is further configured to: determine whether the coordinates of the target in the second frame are coordinates stored in the second data link, the second data link being used to store the coordinates of the stationary target in the second frame; and, if so, determine that the target is stationary; if not, determine that the target moves. After determining that the target is stationary, the processing unit is further configured to store the coordinates of the target in the second frame in the second data link.
[0018] In some examples, the security device further includes a sensor unit. The sensor unit is used to detect the state of the target and obtain a current detection result. Before determining that the target is stationary or that the target is moving, the processing unit is further used to: determine whether the current detection result is the same as the detection result of the sensor unit; and, if so, determine the state of the target with the same detection result; if not, determine the state of the target with one of the detection results according to a preset rule.
[0019] The present application provides a readable storage medium storing a program, which is executed by a processor to implement any of the target detection methods described above.
[0020] In the target detection method, security equipment and readable storage medium of the present application, by comparing the target images captured at different time periods, the total number of times the displacement change of the target in different time periods is large (i.e., exceeding the first preset threshold) is judged to determine whether the target is stationary or moving. When the total number is small (i.e., less than the second preset threshold), the target is determined to be stationary, otherwise it is determined to be moving. It can be seen that the present application does not determine that the target is moving when the displacement change of the target is large, and that the target is stationary when the displacement change of the target is small, but uses the total number of such occurrences as the basis for state detection, thereby improving the accuracy of state detection of the target (including stationary targets) and reducing the probability of false alarms. For example, for the AI detection method, the detection error of stationary targets is reduced, and the user's recognition of the AI detection method is increased. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 is a flowchart of a target detection method according to the first embodiment of the present application;
[0022] Figure 2 It is a timing diagram of the first period and the second period of this application;
[0023] Figure 3 is a schematic diagram of comparing the second frame with the first frame in one embodiment of the present application;
[0024] Figure 4 is a flowchart of a target detection method according to a second embodiment of the present application;
[0025] Figure 5 It is a structural schematic diagram of a security device according to an embodiment of the present application. DETAILED DESCRIPTION
[0026] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in combination with the embodiments and drawings. Obviously, the described embodiments are only part of the embodiments, not all. Based on the embodiments in the present application, the following embodiments and their technical features can be combined with each other without conflict.
[0027] Figure 1 is a flowchart of the target detection method of the first embodiment of the present application. Figure 1 As shown, the target detection method includes the following steps S1 to S62.
[0028] S1: Acquire multiple first frames obtained by photographing a target within a first period of time.
[0029] S2: Acquire multiple second frames obtained by photographing the target within a second period, where the end time of the first period is the start time of the second period.
[0030] This embodiment does not limit the execution subject of each step in the method, which can be determined according to the needs of the actual scene. For example, it can be various electronic devices with shooting functions, including but not limited to monitoring equipment such as cameras in the security field; for another example, it can be an electronic device with computing and processing functions, which may not have a shooting function, and the first frame and the second frame can be captured by an external shooting device and obtained from the external shooting device.
[0031] In some examples, the start time of the first period may be the initial time of shooting the target, such as the start time of the electronic device or the start time of shooting the target after focusing. Figure 2 As shown, the duration of the first time period t1 is the time difference from the start time t1s to the end time t1e, the end time t1e of the first time period t1 is the start time t2s of the second time period t2, and the duration of the second time period t2 is the time difference from the start time t2s to the end time t2d.
[0032] The duration of the second time period t2 is shorter than the duration of the first time period t1 , and shortening the duration of the sampled target image can help improve the accuracy of detecting the target state.
[0033] The number of first frames is directly proportional to the duration of the first period. Similarly, the number of second frames is directly proportional to the duration of the second period. It can be understood that the longer the shooting time is, the greater the number of frames obtained. For example, if the camera takes 10 pictures per second and the duration of the first period is 3 seconds, then step S1 obtains 30 first frames.
[0034] It should be understood that in some instances, the present application can set the number of first frames and second frames individually or in combination with the computing performance of the AI algorithm. For example, in a scenario where the AI algorithm can only process 7 pictures per second, even if the camera takes 10 pictures per second, 7 pictures are finally selected to set the first frame and / or the second frame. For example, step S1 obtains 21 first frames. The rules for selecting pictures are not limited by the embodiments of the present application. For example, the 7 clearest pictures can be selected, or the 7 pictures whose shooting time is closest to the second time period can be selected.
[0035] In some scenarios, multiple first frames can be stored in the first data link in chronological order, which is convenient for calling the first frame and comparing in step S3. The first data link is a storage space, such as a system buffer of an electronic device or a storage space of an external memory.
[0036] S31: Compare each second frame with the plurality of first frames one by one.
[0037] S32: Determine whether the displacement change of the target between the second frame and the first frame is less than a first preset threshold.
[0038] S4: If it is determined that the displacement change of the target is less than the first preset threshold, the count is increased once, and a total count is obtained after the comparison of multiple second frames is completed.
[0039] For example, in Figure 3 In the scene shown, the target is a puppy, and 7 second frames (numbered F1...F7 respectively) and 21 first frames (numbered Fa1, Fa2,...Fa21 respectively) are obtained by shooting it. First, the second frame F1 is compared with the 21 first frames one by one to determine whether the displacement change of the target in the second frame F1 and the first frame Fa1 is less than the first preset threshold, and whether the displacement change of the target in the second frame F1 and the first frame Fa2 is less than the first preset threshold, and so on, until it is determined whether the displacement change of the target in the second frame F1 and the first frame Fa21 is less than the first preset threshold; then, the second frame F2 is compared with the 21 first frames one by one; and the remaining second frames are compared with the 21 first frames one by one.
[0040] In some examples, step S32 may identify the displacement change of the target according to the coordinate changes on the x-axis, y-axis, and z-axis in the three-dimensional rectangular coordinate system. If the coordinate changes on the three axes are all less than a first preset threshold, it is determined that the displacement change of the target is less than the first preset threshold.
[0041] For example, the first preset threshold is d0, the coordinates of the target in the second frame F1 are (x1, y1, z1), and the coordinates in the first frame Fa2 are (x2, y2, z2). If │x1-x2│<d0, │y1-y2│<d0, and │z1-z2│<d0, then it is determined that the coordinate change of the target in the second frame F1 and the first frame Fa2 is less than the first preset threshold. If the coordinate change on one axis, or two axes, or three axes is greater than the first preset threshold, then it is determined that the coordinate change of the target in the second frame F1 and the first frame Fa2 is greater than or equal to the first preset threshold. For example, if │x1-x2│≥d0, even if │y1-y2│<d0 and │z1-z2│<d0, it is determined that the coordinate change of the target in the second frame F1 and the first frame Fa2 is greater than the first preset threshold.
[0042] If it is determined that the displacement change of the target is greater than or equal to the first preset threshold, step S33 may be executed: determining it as non-stationary data, and continuing to execute steps S31 and S32.
[0043] After completing the comparison of all the second frames F1…F7, the total count is obtained. The total count can be used to identify the number of targets that have not undergone a large coordinate change between the first frame and the second frame. The larger the number, the more likely it is that the position deviation is caused by the image sensor when shooting, rather than the displacement caused by the target's own movement, that is, the higher the probability that the target is stationary.
[0044] S5: Determine whether the total count reaches a second preset threshold. If yes, execute step S61: Determine whether the target is stationary. If no, execute step S62: Determine whether the target is moving.
[0045] The embodiment of the present application does not determine that the target is moving when the displacement change of the target in the previous and next frames is large, and that the target is stationary when the displacement change of the target is small, but based on multiple frames in the previous and next two time periods, through frame comparison, the total number of times this situation occurs is obtained and used as the basis for state detection, thereby improving the accuracy of state detection of the target (including stationary targets). This method can be applied to the security field, for example, when the target movement is detected, the probability of false alarm can be reduced.
[0046] The steps of the above method can be implemented by running an AI algorithm. Here, for the AI detection method, the detection error caused by stationary targets can be filtered out, the accuracy of the AI detection method can be improved, and the user's recognition of the AI detection method can be increased.
[0047] Figure 4 is a flowchart of the target detection method of the second embodiment of the present application. Figure 4 As shown, the target detection method includes the following steps S1 to S62.
[0048] S1: Acquire multiple first frames obtained by photographing a target within a first period of time.
[0049] S2: Acquire multiple second frames obtained by photographing the target within a second period, where the end time of the first period is the start time of the second period.
[0050] S31: Compare each second frame with the plurality of first frames one by one.
[0051] S32: Determine whether the displacement change of the target between the second frame and the first frame is less than a first preset threshold.
[0052] S4: If it is determined that the displacement change of the target is less than the first preset threshold, the count is increased once, and a total count is obtained after the comparison of multiple second frames is completed.
[0053] S5: Determine whether the total count reaches a second preset threshold.
[0054] And, if yes, then execute step S61: determine whether the target is stationary. If no, then execute step S51: determine whether the coordinates of the target in the second frame are the coordinates stored in the second data link.
[0055] If the coordinates of the target in the second frame are the coordinates stored in the second data link, then step S61 is executed: determining that the target is stationary, and step S63: storing the coordinates at the end of the second data link in a first-in-first-out order.
[0056] If the coordinates of the target in the second frame are not the coordinates stored in the second data link, step S62 is executed: determining the movement of the target.
[0057] exist Figure 1 Based on the description of the described embodiment, but different therefrom, the present embodiment stores the coordinate data of the stationary target in the second data link each time after determining that the target is stationary, which is equivalent to continuously updating the coordinate data of the target in the stationary state (i.e., the stationary data is updated unchanged), so as to improve the accuracy of the target state detection. For example, with the sequence of time, the position deviation generated when the image sensor is shooting may become larger and larger. For example, when the coordinate change of the target in the second frame F1 and the first frame Fa2 is large and greater than the first preset threshold, it is mistakenly regarded as the target moving, but in fact the target has not moved. In this regard, the present embodiment stores the latest stationary data in the second data link, which is equivalent to continuously updating the stationary data, which is conducive to reducing such false detections.
[0058] It should be understood that one or more of the aforementioned first preset threshold, the second preset threshold, the storage size of the first data link, and the storage size of the second data link can be adaptively set according to actual needs. By adjusting these thresholds, the detection sensitivity can be adjusted, so that the detection sensitivity can be adaptively adjusted according to different scenarios, which is further beneficial to filtering out false detections caused by stationary objects.
[0059] The embodiments of the present application may combine any of the aforementioned methods with the detection results of the sensor to comprehensively detect the state of the target. In some instances, before determining that the target is stationary or determining that the target is moving, the method further includes: obtaining the current detection result of the sensor on the state of the target; determining whether the current detection result is the same as the detection result of the sensor. If so, the state of the target is determined with the same detection result. For example, if both detection methods determine that the target is moving, the target is finally determined to be moving. If not, the state of the target is determined according to one of the detection results according to the preset rules. For example, the preset rule is to use the detection result of the AI detection method as the state of the target, or the preset rule is to use the detection result of the mobile sensor as the state of the target.
[0060] In some scenarios, the sensor includes but is not limited to a motion sensor, an infrared sensor, a sensor based on passive infrared (PIR) technology, etc.
[0061] The preset rules can also be set adaptively according to the target's residence scene. For example, in indoor and outdoor scenes, there are actually no real people who can remain completely motionless, only toy dolls or statues can remain completely motionless. If the sensor detects that the target is a real person, even if the AI detects that the target is stationary, the final detection result is determined to be the target moving.
[0062] The present application also provides a security device, such as Figure 5 As shown, the security device 10 at least includes a shooting unit 11 and a processing unit 12 .
[0063] The shooting unit 11 is used to obtain a plurality of first frames obtained by shooting a target in a first time period, and a plurality of second frames obtained by shooting a target in a second time period, and the end time of the first time period is the start time of the second time period.
[0064] The processing unit 12 is used to compare each second frame with multiple first frames one by one to determine whether the displacement change of the target in the second frame and the first frame is less than a first preset threshold; and, if it is determined that the displacement change of the target is less than the first preset threshold, the count is increased once, and the total count is obtained after the comparison of multiple second frames is completed; the processing unit 12 is also used to determine whether the total count reaches the second preset threshold; and, if so, it is determined that the target is stationary; if not, it is determined that the target is moving.
[0065] In some examples, after determining that the total count reaches the second preset threshold and before determining that the target moves, the processing unit 12 is further configured to: determine whether the coordinates of the target in the second frame are coordinates stored in the second data link; and, if so, determine that the target is stationary; if not, determine that the target moves. After determining that the target is stationary, the processing unit 12 is further configured to store the coordinates of the target in the second frame in the second data link.
[0066] In some examples, the security device further includes a sensor unit 13. The sensor unit 13 is used to detect the state of the target and obtain a current detection result. Before determining that the target is stationary or that the target is moving, the processing unit 12 is further used to: determine whether the current detection result is the same as the detection result of the sensor unit 13; and, if so, determine the state of the target with the same detection result; if not, determine the state of the target with one of the detection results according to a preset rule.
[0067] The processing unit 12 is the control center of the security device 10. It uses various interfaces and lines to connect various parts of the entire security device 10, executes various functions of the security device 10 and processes data by running or loading programs stored in the memory, and calling data stored in the memory, thereby implementing the steps in the method of any of the aforementioned embodiments.
[0068] It should be understood that when implemented in actual application scenarios, depending on the device type of the security device 10, the execution entities of the above steps may not be the shooting unit 11, the processing unit 12 and the sensor unit 13, but may be implemented by other modules and units respectively.
[0069] Those skilled in the art will appreciate that all or part of the steps in the various methods of the above embodiments can be completed by instructions, or by controlling related hardware through instructions, and the instructions can be stored in a readable storage medium and loaded and executed by a processor. To this end, an embodiment of the present application provides a readable storage medium, in which a program is stored, and the program can be loaded by a processor to execute one or more steps in any target detection method provided in the embodiment of the present application.
[0070] The readable storage medium may include a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0071] Since the program stored in the readable storage medium can execute one or more steps in any target detection method provided in the embodiments of the present application, the beneficial effects that can be achieved by any target detection method provided in the embodiments of the present application can be achieved. Please refer to the previous embodiments for details and will not be repeated here.
[0072] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of this specification and drawings are also included in the patent protection scope of the present application.
[0073] In the absence of further restrictions, the elements defined by the sentence "including one..." do not exclude the existence of other identical elements in the process, method, article or device including the element. In addition, parts, features, and elements with the same name in different embodiments may have the same meaning or different meanings, and their specific meanings need to be determined by their explanation in the specific embodiment or further combined with the context of the specific embodiment.
[0074] In addition, although the terms "first, second, third" and the like are used herein to describe various information, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from each other. As used herein, the singular forms "one", "an" and "the" are intended to include plural forms as well. The terms "or" and "and / or" are interpreted as inclusive, or mean any one or any combination. Only when the combination of elements, functions, steps or operations is inherently mutually exclusive in some way, an exception to this definition will occur.
Claims
1. A target detection method, characterized in that: include: Acquire multiple first frames obtained by photographing the target within a first period of time; Acquire multiple second frames obtained by photographing the target in a second period, wherein the end time of the first period is the start time of the second period; Comparing each of the second frames with the plurality of first frames one by one to determine whether the displacement change of the target in the second frame and the first frame is less than a first preset threshold, wherein the displacement change of the target is identified according to the coordinate changes on the x-axis, y-axis, and z-axis in the three-dimensional rectangular coordinate system, and if the coordinate changes on the x-axis, y-axis, and z-axis are all less than the first preset threshold, then it is determined that the displacement change of the target is less than the first preset threshold; If it is determined that the displacement change of the target is less than a first preset threshold, the count is increased once, and a total count is obtained after the comparison of the plurality of second frames is completed; Determining whether the total count reaches a second preset threshold; If so, determining that the target is stationary; If not, it is determined that the target moves.
2. The method according to claim 1, characterized in that The multiple first frames are stored in the first data chain in chronological order.
3. The method according to claim 1, characterized in that After determining that the target is stationary, the method includes: storing the coordinates of the target in the second frame at the end of the second data link in a first-in-first-out order.
4. The method according to claim 3, characterized in that After determining that the total count reaches a second preset threshold and before determining that the target moves, the method includes: determining whether the coordinates of the target in the second frame are coordinates stored in the second data link; and, if so, determining that the target is stationary; If not, it is determined that the target moves.
5. The method according to any one of claims 1 to 4, characterized in that: Before determining that the target is stationary or determining that the target is moving, the method includes: Get the current detection result of the sensor on the target state; Determine whether the current detection result is the same as the detection result of the sensor; If yes, determining the state of the target with the same detection result; If not, the state of the target is determined based on one of the detection results according to a preset rule.
6. The method according to claim 1, characterized in that The start time of the first period is the initial time of shooting the target, and the duration of the second period is shorter than the duration of the first period.
7. A security device, characterized in that: The security equipment includes: A shooting unit, used for acquiring a plurality of first frames obtained by shooting a target in a first time period, and a plurality of second frames obtained by shooting a target in a second time period, wherein the end time of the first time period is the start time of the second time period; a processing unit, configured to compare each of the second frames with the plurality of first frames one by one, to determine whether a displacement change of the target in the second frame and the first frame is less than a first preset threshold, wherein the displacement change of the target is identified according to the coordinate changes on the x-axis, the y-axis, and the z-axis in the three-dimensional rectangular coordinate system, and if the coordinate changes on the x-axis, the y-axis, and the z-axis are all less than the first preset threshold, then it is determined that the displacement change of the target is less than the first preset threshold; and, if it is determined that the displacement change of the target is less than the first preset threshold, then a count is increased once, and a total count is obtained after the comparison of the plurality of second frames is completed; The processing unit is further configured to determine whether the total count reaches a second preset threshold; and, if so, determine that the target is stationary; if not, determine that the target is moving.
8. The security device according to claim 7, characterized in that: The processing unit is further used to set a second data link, wherein the second data link is used to store the coordinates of the stationary target in the second frame; After determining that the total count reaches a second preset threshold and before determining that the target moves, the processing unit is further configured to: determine whether the coordinates of the target in the second frame are coordinates stored in the second data link; and, if so, determine that the target is stationary; If not, determining that the target moves; After determining that the target is stationary, the processing unit is further configured to store the coordinates of the target in the second frame in a second data link.
9. The security device according to claim 7, characterized in that: The security device also includes a sensor unit for detecting the target state and obtaining a current detection result; Before determining that the target is stationary or that the target is moving, the processing unit is further used to: determine whether the current detection result is the same as the detection result of the sensor unit; and, if so, determine the state of the target with the same detection result; If not, the state of the target is determined based on one of the detection results according to a preset rule.
10. A readable storage medium storing a program, characterized in that: When the program is executed by a processor, the target detection method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Image acquisition method and electronic device
CN105744142A
Method for recognizing state of person in monitoring video
CN108537829A
Target tracking method and system based on image feature matching
CN112419364A
Image capturing apparatus and image capturing method
US20070025722A1
Method and system for performing image identification
WO2015039575A1
