CN-117037404-B - Electronic fence early warning method based on target detection and target tracking
Abstract
The invention relates to an electronic fence early warning method based on target detection and target tracking, which is characterized in that video stream data transmitted back by a field camera is detected in real time frame by using YOLOX target detection network, the existence and state of a target object are detected, an id is allocated to a target behavior track by DeepSORT tracking algorithm, and an alarm is sent out once an id owner is found to be close to a fence. The invention has the beneficial effects that the images in the monitoring area are acquired through the camera or other image acquisition equipment, and the images are processed and analyzed by using the computer vision technology to identify the movement track of the object or the person, so that the safety monitoring and the countermeasure in the monitoring area are realized, and the invention can be applied to a plurality of fields with extremely low cost and extremely high deployment flexibility.
Inventors
- ZHANG KAIYU
- WU FEI
- SUN HAOJUN
- CAI MEIYU
- Wan Haonan
- GONG HAOCHENG
- Huang Zifei
- LI JIALE
Assignees
- 上海工程技术大学
Dates
- Publication Date
- 20260505
- Application Date
- 20230630
Claims (8)
- 1. The electronic fence early warning method based on target detection and target tracking is characterized by comprising the following steps: The method comprises the following steps that 1, a user forms a closed area by drawing a plurality of straight lines based on a video shooting scene corresponding to a video acquisition module, and the straight lines are used as electronic fences; Step 2, video is read, video frames are sequentially sent to an operation module, target detection is carried out through YOLOX target detection networks in the operation module to obtain a detection result Bounding Boxes, and the detection result Bounding Boxes is sent to a cache queue; step 3, judging whether a new target appears in the video frame, if so, returning the video frame as a first video frame of the new target to the step 2 and sending the first video frame to YOLOX target detection network for target detection; Otherwise, sending the detection result of the current video frame and the detection result of the previous video frame into DeepSort target tracking network in the operation module to carry out matching, searching the same target in the adjacent frames and distributing the same id to the same target; step 4, confirming the positioning point coordinates of the targets from the detection results Bounding Boxes of the different targets; Step 5, calculating the axial distance between each target positioning point and each straight line, taking the minimum value as the distance between the target and the fence in the real scene, and the axial distance between the positioning point coordinates of the ith target and the straight line j The formula is as follows; ; x i is a horizontal coordinate point of a target i, y i is a vertical coordinate point of the target i, k j is the slope of a straight line j, and b j is the offset of the straight line j; Step 6, if the minimum axis distance between the coordinates of the target locating point and any straight line is larger than or equal to a threshold value, checking whether the target id is in a buffer area, and if the target id is in the buffer area, removing the target id from the buffer area; step 7, if the minimum axis distance between the coordinates of the target locating point and a certain straight line is smaller than a threshold value, judging whether the target id is in a buffer area, and if the target id is not in the buffer area, triggering an alarm at the time; If the alarm is not triggered before the given time interval and the target id is not in the buffer zone, sending the target id into the buffer zone and giving out the alarm; the buffer area is a memory area for storing the id of the detector by the computer; And 8, judging whether the coordinates of the locating point of the target exist in the video frame, if not, ending the judgment, and if so, returning to the step 5.
- 2. The electronic fence pre-warning method based on target detection and target tracking according to claim 1, wherein the method comprises the following steps: in step 1, determining whether the straight line belongs to a vertical line or a horizontal line according to the slope and the intercept of the straight line, wherein if the slope k of the straight line belongs to a set Then consider a vertical line, if the slope k of the line belongs to the set And is considered as a horizontal line.
- 3. The electronic fence pre-warning method based on target detection and target tracking according to claim 1, wherein the method comprises the following steps: generating a detection frame from detection results Bounding Boxes of different targets, acquiring length and width information and center point coordinates of the detection frame, calculating to obtain bottom midpoint coordinates of each target detection frame, and taking the bottom midpoint as the positioning point coordinates; the detection frame is a rectangular frame, and four sides of the rectangular frame respectively penetrate through limit pixel points in four directions of the upper side, the lower side, the left side and the right side of the target.
- 4. The method for pre-warning an electronic fence based on target detection and target tracking according to claim 3, wherein the threshold in the steps 6 and 7 is one fifth of the width of the target detection frame.
- 5. The method for pre-warning an electronic fence based on target detection and target tracking according to claim 1, wherein in step 6, a line to be measured with the target is taken as a target line, the type of the target line is determined first, if the target line belongs to a vertical line, a horizontal axis distance is calculated, if the target line belongs to a horizontal line, a vertical axis distance is calculated, and if the target line does not belong to a horizontal line, both the horizontal axis distance and the vertical axis distance are calculated, and the minimum axis distance is taken as the distance between the target and the fence line in a real scene.
- 6. The method for pre-warning an electronic fence based on target detection and target tracking according to claim 3, wherein the straight line for forming the electronic fence in the step 1 is divided into an inner straight line and an outer straight line, the inner straight line is an exit warning line for determining that the target exits, and the outer straight line is an entrance warning line for determining that the target enters.
- 7. The method for pre-warning an electronic fence based on target detection and target tracking according to claim 6, wherein the method for pre-warning an electronic fence based on target detection and target tracking is characterized by further comprising an approach warning line, wherein the approach warning line is a virtual line and is provided with an inner approach warning line and an outer approach warning line, the inner approach warning line is located in the departure warning line and is equal to a threshold value in distance from the departure warning line, the outer approach warning line is located outside the entrance warning line and is equal to the threshold value in distance from the entrance warning line, and a buffer area is formed between the inner approach warning line and the outer approach warning line.
- 8. The method for early warning an electronic fence based on target detection and target tracking according to claim 1, wherein the video acquisition module is a camera, the operation module is a computer embedded with YOLOX target detection network and DeepSort target tracking network, and the video acquisition module transmits video to the operation module in a wired or wireless mode.
Description
Electronic fence early warning method based on target detection and target tracking Technical Field The invention relates to the field of electronic fences, in particular to an electronic fence early warning method based on target detection and target tracking. Background The history of electronic fencing technology dates back to the beginning of the 50 s of the 20 th century, when a military company in the united states established the first "virtual fence" using radar technology to protect the united states air force base. The virtual fence monitors surrounding moving objects in real time by placing radar equipment around the base, so that the base is protected. With the development of electronic technology and computer technology, the electronic fence technology is continuously improved and perfected. In the 70 s of the 20 th century, along with the progress and application of computer technology, electronic fence technology began to enter the commercial field and was applied to occasions such as property safety and prison monitoring. In this case, the electronic fence technology mainly detects movement of an object by using sensors such as infrared and ultrasonic. In the 90 s of the 20 th century, with the rise of video monitoring technology, the electronic fence technology starts to combine with the video monitoring technology, and an electronic fence technology based on video monitoring, namely an image electronic fence technology, is formed. The technology mainly utilizes a video monitoring camera to collect images of surrounding environment, and realizes detection and alarm of abnormal behaviors through algorithms such as image analysis, motion detection and the like. The technology not only improves the efficiency and the precision of safety monitoring, but also can perform functions such as remote monitoring and data storage. The traditional electronic fence technology is mostly realized by hardware, so that the deployment difficulty is high, and the purchase and maintenance cost is high. Disclosure of Invention The invention aims to provide an electronic fence early warning method based on target detection and target tracking, which realizes high-efficiency and accurate early warning of a monitoring area under the simplest hardware condition through YOLOX target detection network and DeepSort target tracking network. The electronic fence early warning method based on target detection and target tracking is characterized by comprising the following steps of: The method comprises the following steps that 1, a user forms a closed area by drawing a plurality of straight lines based on a video shooting scene corresponding to a video acquisition module, and the straight lines are used as electronic fences; Step 2, video is read, video frames are sequentially sent to an operation module, target detection is carried out through YOLOX target detection networks in the operation module to obtain a detection result Bounding Boxes, and the detection result Bounding Boxes is sent to a cache queue; step 3, judging whether a new target appears in the video frame, if so, returning the video frame as a first video frame of the new target to the step 2 and sending the first video frame to YOLOX target detection network for target detection; Otherwise, sending the detection result of the current video frame and the detection result of the previous video frame into DeepSort target tracking network in the operation module to carry out matching, searching the same target in the adjacent frames and distributing the same id to the same target; step 4, confirming the positioning point coordinates of the targets from the detection results Bounding Boxes of the different targets; Step 5, calculating the axial distance between each target positioning point and each straight line, taking the minimum value as the distance between the target and the fence in the real scene, and the axial distance between the positioning point coordinates of the ith target and the straight line j The formula is as follows; x i is a horizontal coordinate point of the object i, y i is a vertical coordinate point of the object i, k j is a slope of the straight line j, and b j is a bias of the straight line j. Step 6, if the minimum shaft distance between the coordinates of the target positioning point and any straight line is greater than or equal to a threshold value, checking whether the target id is in a buffer area, and if the target id is in the buffer area, removing the target id from the buffer area; step 7, if the minimum axis distance between the coordinates of the target locating point and a certain straight line is smaller than a threshold value, judging whether the target id is in a buffer area, and if the target id is not in the buffer area, triggering an alarm at the time; If the alarm is not triggered before the given time interval and the target id is not in the buffer zone, sending the target id into the buffer zone and giving out