A method for detecting vehicle window status at a road checkpoint and counting people in the vehicle
By constructing a window and person recognition model in the road bayonet, combined with deduplication and dynamic correction algorithms, the accuracy and computing power consumption problems of window status detection and vehicle occupant counting are solved, and fast and accurate in-vehicle identification is achieved. People counting and window status monitoring reduce hardware costs and the probability of missed detections.
Patent Information
- Application Number
- CN202110982942.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-25
- Publication Date
- 2024-09-10
- Estimated Expiration
- 2041-08-25
AI Technical Summary
In the existing technology, the detection of car window status at road junctions and the counting of people in the car have problems with accuracy and high computing power consumption, especially the image occlusion phenomenon caused by factors such as camera angle, vehicle body occlusion, car window occlusion, and people occlusion. , resulting in low personnel detection rate and errors in counting the number of people in the vehicle.
By reading the video streams of the cameras on both sides of the road junction detection channel in real time, we build a window position and status recognition model and a head recognition model of the people in the car. We combine the deduplication algorithm and the dynamic correction algorithm to identify the window status and the people in the car. , using a target detection and classification algorithm based on deep learning to replace the original attitude algorithm to achieve fast and accurate counting of people in the vehicle.
It achieves fast and accurate window status monitoring and vehicle occupant counting, reduces computing power requirements, reduces hardware costs, and reduces the probability of missed detection due to image occlusion through dynamic correction algorithms, especially for the middle of the rear row of the vehicle. Seat accuracy.
Smart Images

Figure CN113822165B
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of security inspection, and in particular to a method for detecting the state of vehicle windows at a road checkpoint and counting people in the vehicle. Background Art
[0002] Road checkpoints are a common public security facility with functions such as security inspection and public security control. In the traditional working mode of road checkpoints, when a vehicle drives to the checkpoint lane, the staff will manually observe the situation of the occupants in the vehicle or require the occupants to get off the vehicle for inspection, which reduces traffic efficiency and wastes human resources.
[0003] In recent years, the industry has gradually begun to use intelligent technology to try to automate the security inspection process, such as using cameras and image algorithms to conduct real-time video monitoring and image analysis of passing vehicles, hoping to achieve rapid and accurate collection of people in the car without human intervention; further, the collected personnel and vehicle information can be used to build upper-level applications such as big data analysis. However, in order to achieve the above goals, there are two unavoidable problems: detecting the window status and counting the number of people in the car.
[0004] Under existing technical conditions, the detection of the window status usually uses the reflective properties of the glass to detect the open and closed status, but the algorithm accuracy and adaptability are not ideal. When counting people in the car, it is easy to think of using face recognition or posture recognition algorithms to deduplicate people, but both algorithms have the problem of high computing power consumption; in addition, due to objective factors such as camera angle, body occlusion, window occlusion, and person occlusion, image occlusion can occur, resulting in low detection rate and incorrect counting of people in the car. Summary of the invention
[0005] In view of the problems in the above-mentioned prior art, the purpose of the present invention is to provide a method for detecting the state of vehicle windows and counting people in a vehicle at a road checkpoint, which reads the video streams of cameras on both sides of the road checkpoint detection channel in real time; constructs a vehicle window position and state recognition model and a vehicle occupant head recognition model to identify the state of the vehicle windows and the state of people in the vehicle, and combines a deduplication algorithm and a dynamic correction algorithm to accurately identify people in the vehicle, with fast detection speed and high recognition accuracy.
[0006] The present invention is implemented by the following technical solution: a method for detecting the state of vehicle windows at a road checkpoint and counting people in the vehicle, characterized in that it comprises the following steps:
[0007] S1. Read the video streams of the cameras on both sides of the road checkpoint detection channel in real time, and the shooting range of the cameras can cover the windows on the same side;
[0008] S2, extracting one frame of image from each of the two video streams synchronously every n frames;
[0009] S3, analyzing the image of the same frame using a window position and state recognition model to obtain the positions and open / closed states of all windows in the image, represented by a tuple list ListW; wherein W is a tuple corresponding to a window;
[0010] S4. When ListW is not empty, it means that a vehicle has entered, and the image of the same frame is analyzed using the head recognition model of the person in the car to identify the person in the car and the position relative to the window, which is represented by a tuple list ListP; where P is a tuple corresponding to a person;
[0011] S5, traverse all tuples P in ListP, and associate ListW data to obtain the absolute positions of all people, that is, the seating positions of the people in the car (left front, right front, left rear, middle rear, right rear), and append the absolute positions to tuple P;
[0012] S6, dynamically modify ListP obtained by extracting each frame according to the time series to obtain ListPR;
[0013] S7. Two people cannot sit in the same position. The people in the car are deduplicated according to the absolute position absolute in ListPR. The tuples containing the same absolute position absolute attribute are deduplicated. Only one tuple is retained for one absolute position absolute attribute. Then, the number of absolute positions or tuples in the current ListPR is counted as the number of people in the current car. In this way, the target detection and classification algorithm can be used to replace the original posture algorithm to complete the counting of people in the car. Since the target detection and classification algorithm is faster than the posture algorithm inference speed and has a smaller amount of calculation, the computing power can be greatly reduced.
[0014] S8. S3-S7 are looped once every n frames to continuously obtain the position and state ListW of the car window, the position ListPR of the people in the car and the position relative to the car window, and the number of people in the car until the car leaves, that is, ListW is empty.
[0015] Furthermore, the process of constructing the window position and state recognition model is specifically as follows: first, a training video is shot by the camera, and frames of the training video are extracted to obtain a vehicle side image sample containing a window; the window contour position and the window opening and closing state (open, close) in the image sample are marked, wherein the window contour position is marked using a minimum rectangular frame that can encompass the window, using manual marking or automatic pre-marking using a pre-trained model; and the window position and state recognition model is trained using a deep learning-based target detection and classification algorithm; the model accuracy is evaluated; and the above sampling, marking, training, and evaluation steps are repeated until an ideal model is obtained.
[0016] Furthermore, the construction process of the vehicle occupant head recognition model is specifically as follows: first, the vehicles passing through the road checkpoint are analyzed through the window position and state recognition model, the vehicles with open windows are filtered out and the corresponding video streams are obtained, and the picture samples are obtained by extracting frames; the head position of the vehicle occupant in the picture sample (the smallest rectangular box that can enclose the head) and the relative window position (near, middle, and far) are marked, wherein the head position of the vehicle occupant is marked using the smallest rectangular box that can enclose the head, using manual marking or automatic pre-marking using a pre-trained model; and the vehicle occupant head recognition model is trained using a deep learning-based target detection and classification algorithm; the model accuracy is evaluated; and the above sampling, marking / pre-marking, training, and evaluation steps are repeated until an ideal model is obtained.
[0017] Further, S3 is specifically as follows: the window position and state recognition model recognizes the coordinate position and opening and closing state of the window in the image, and each window can be represented by a tuple W as: W (left, top, width, height, status, confidence, type), which are respectively the left x-coordinate, top y-coordinate, width, height, opening and closing state (open, close), confidence, and window position type (left front, left rear, right front, right rear) of the window rectangular frame in the picture; by synchronously detecting the real-time images of the two cameras, the real-time position and state of the left front window, the left rear window, the right front window, and the right rear window are obtained, and are represented by a list ListW of the tuple W; wherein the window position type is easily calculated according to the position of the camera capturing the window (left, right) and the relative position between the windows (front, rear).
[0018] Further, S4 is specifically as follows: the head recognition model of the person in the car recognizes the coordinate position of the head of the person in the car in the picture and the position relative to the window in the picture. Each person's head can be represented by a tuple P: P (left, top, width, height, confidence, window, relative), which are respectively the x-coordinate of the left side, the y-coordinate of the top side, the width, height, confidence, and the position of the belonging window and the relative window (near, middle, far) of the rectangular box of the head of the person in the car in the picture; by synchronously monitoring the real-time pictures of the two cameras, the real-time positions of all the heads of the people in the car that are not blocked in the car are obtained, and are represented by a list ListP of the tuple P. Among them, by comparing the head rectangular box with the window rectangular box in ListW, it can be calculated that in which window rectangular box the head rectangular box falls, as the belonging window of the head.
[0019] Further, the S5 is specifically as follows: traverse ListP, associate ListW data, and for each tuple P, calculate its absolute position absolute (left front, right front, left rear, middle rear, right rear), i.e., the seat position of the person in the car, according to its belonging window window and relative window position relative; for example, if the belonging window window is the left front window and relative is near, then absolute is the left front; if the belonging window window is the left rear window and relative is far, then absolute is the right rear;
[0020] Furthermore, S6 is specifically as follows: compare the ListP corresponding to the current frame and the previous frame, and when the absolute position absolute appears in the ListP corresponding to the previous frame but is not in the current frame, create a tuple PR containing the absolute position absolute, and append the PR to the ListP corresponding to the current frame to obtain ListPR; so that the personnel in the current frame ListPn will not be lost due to image occlusion caused by perspective problems. Because the angle at which the personnel in the vehicle appear in the camera is constantly changing when the vehicle is moving and the window is lowered, each person in the vehicle always has the opportunity to appear directly in the camera's field of view during the vehicle's movement, and thus be captured by the algorithm, which can effectively reduce the probability of missed detection due to image occlusion during static counting (i.e., personnel counting when the vehicle is stopped), especially the middle seat in the back row of the vehicle.
[0021] Furthermore, the main network structure of the window position and state recognition model uses the Yolo series model as the backbone, and through multi-layer convolutional networks, downsampling, and upsampling, it can more accurately learn the material, texture, edge and other features of the windows in the image; and the vehicle side image samples include a variety of light conditions and a variety of window shapes; it can improve the recognition accuracy of the window position and state recognition model in complex environments with light interference and diverse vehicle body and window materials.
[0022] Furthermore, the window position and state recognition model shares the network backbone with the head recognition model of the person in the car, and outputs the position and opening and closing state of the window in the image and the position of the person in the car and relative to the window through two convolution output layers. Taking the Yolov4 model network as the backbone network as an example, two convolution output layers WL and PL are used to replace the output layer of the original Yolov4 model. The main features of the image are extracted through the backbone network of the Yolov4 model, and the window position state and the head features of the person are output respectively through the two convolution output layers WL and PL. Among them, the main input features of the convolution output layer WL are downsampled 16 times, and the receptive field is large, which is suitable for the detection and recognition of medium-sized targets and suitable for the detection and recognition of windows; the main input features of the convolution output layer PL are downsampled 8 times, and the receptive field is small, which is suitable for the detection and recognition of small-sized targets and suitable for the detection and recognition of the head of the person. Such a design allows the two models to complete model inference respectively through one feature extraction, which can simplify nearly half of the amount of calculation.
[0023] A computer device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method described in any one of claims 1 to 8 when executing the computer program.
[0024] A computer-readable storage medium having a computer program stored thereon, characterized in that when the computer program is executed by a processor, the steps of the method described in any one of claims 1 to 8 are implemented.
[0025] The beneficial effects of the present invention are as follows: based on the target detection and recognition algorithm, the present invention can complete the window status monitoring and the occupant counting in real time, and has the characteristics of small network structure, fast inference speed and good recognition effect; using the occupant head recognition model, deduplication, dynamic correction and other algorithms based on deep learning to replace the face recognition or posture recognition algorithm, greatly reducing the computing power requirement, and at the same time using the method of sharing the network backbone to further optimize and reduce the computing power requirement, so that the algorithm can be integrated on the hardware equipment with lower configuration, which can greatly reduce the required hardware cost; through the dynamic correction algorithm, the number of people in the car can be accurately judged, and the probability of missed detection caused by image occlusion is reduced, especially the middle seat in the back row of the vehicle. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] Figure 1 This is a flow chart for window status detection and occupant counting.
[0027] Figure 2 Flowchart for training a window position and state recognition model.
[0028] Figure 3 Flowchart for training the head recognition model for people in the car.
[0029] Figure 4 The main network structure diagram is shown in Figure 2.
[0030] Figure 5 This is a schematic diagram of the correction of dynamic counting of people in the car. DETAILED DESCRIPTION
[0031] In order to clearly illustrate the technical features of this solution, this solution is described below through a specific implementation method.
[0032] Example 1, see Figure 1-Figure 5 The present invention is implemented by the following technical solution: A method for detecting the state of vehicle windows at a road checkpoint and counting people in the vehicle, characterized in that it comprises the following steps:
[0033] S1. Read the video streams of the cameras on both sides of the road checkpoint detection channel in real time, and the shooting range of the cameras can cover the windows on the same side;
[0034] S2, extracting one frame of image from each of the two video streams synchronously every n frames;
[0035] S3, analyzing the image of the same frame using a window position and state recognition model to obtain the positions and open / closed states of all windows in the image, represented by a tuple list ListW; wherein W is a tuple corresponding to a window;
[0036] S4. When ListW is not empty, it means that a vehicle has entered, and the image of the same frame is analyzed using the head recognition model of the person in the car to identify the person in the car and the position relative to the window, which is represented by a tuple list ListP; where P is a tuple corresponding to a person;
[0037] S5, traverse all tuples P in ListP, and associate ListW data to obtain the absolute positions of all people, that is, the seating positions of the people in the car (left front, right front, left rear, middle rear, right rear), and append the absolute positions to tuple P;
[0038] S6, dynamically modify ListP obtained by extracting each frame according to the time series to obtain ListPR;
[0039] S7. Two people cannot sit in the same position. The people in the car are deduplicated according to the absolute position absolute in ListPR. The tuples containing the same absolute position absolute attribute are deduplicated. Only one tuple is retained for one absolute position absolute attribute. Then, the number of absolute positions or tuples in the current ListPR is counted as the number of people in the current car. In this way, the number of people in the car can be counted based on the target detection and classification algorithm. Since the target detection and classification algorithm is faster than the posture algorithm inference speed and has a smaller amount of calculation, the computing power can be greatly reduced.
[0040] S8. S3-S7 are looped once every n frames to continuously obtain the position and state ListW of the car window, the position ListPR of the people in the car and the position relative to the car window, and the number of people in the car until the car leaves, that is, ListW is empty.
[0041] The process of constructing the vehicle window position and state recognition model is specifically as follows: first, a training video is shot by the camera, and frames of the training video are extracted to obtain a vehicle side image sample containing a vehicle window; the vehicle window contour position and the window opening and closing state (open, close) in the image sample are marked, wherein the vehicle window contour position is marked using a minimum rectangular frame that can encompass the vehicle window, using manual marking or automatic pre-marking using a pre-trained model; and the vehicle window position and state recognition model is trained using a deep learning-based target detection and classification algorithm; the model accuracy is evaluated; and the above sampling, marking, training, and evaluation steps are repeated until an ideal model is obtained.
[0042] The construction process of the vehicle occupant head recognition model is specifically as follows: first, the vehicle passing through the road checkpoint is analyzed through the window position and state recognition model, the vehicles with open windows are filtered out and the corresponding video stream is obtained, and the frame is extracted to obtain the image sample; the head position of the vehicle occupant in the image sample (the smallest rectangular box that can enclose the head) and the relative window position (near, middle, and far) are marked, wherein the head position of the vehicle occupant is marked using the smallest rectangular box that can enclose the head, using manual marking or using a pre-trained model for automatic pre-marking; and the vehicle occupant head recognition model is trained using a deep learning-based target detection and classification algorithm; the model accuracy is evaluated; and the above sampling, marking / pre-marking, training, and evaluation steps are repeated until an ideal model is obtained.
[0043] Specifically, S3 is as follows: the window position and state recognition model recognizes the coordinate position and opening and closing state of the window in the image, and each window can be represented by a tuple W: W (left, top, width, height, status, confidence, type), which are respectively the left x-coordinate, top y-coordinate, width, height, opening and closing state (open, close), confidence, and window position type (left front, left rear, right front, right rear) of the window rectangular frame in the image; by synchronously detecting the real-time images of the two cameras, the real-time positions and states of the left front window, the left rear window, the right front window, and the right rear window are obtained, and represented by a list ListW of the tuple W; wherein the window position type is easy to calculate according to the position of the camera capturing the window (left, right) and the relative position between the windows (front, rear).
[0044] The S4 is specifically as follows: the head recognition model for the person in the car recognizes the coordinate position of the head of the person in the car in the picture and the position relative to the window in the picture. Each person's head can be represented by a tuple P: P (left, top, width, height, confidence, window, relative), which are respectively the x-coordinate of the left side, the y-coordinate of the top side, the width, height, confidence, and the position (near, middle, far) of the rectangular box of the head of the person in the car in the picture and the position relative to the window; by synchronously monitoring the real-time pictures of the two cameras, the real-time positions of all the heads of the people in the car that are not blocked in the car are obtained, which are represented by a list ListP of the tuple P. Among them, by comparing the head rectangular box with the window rectangular box in ListW, it can be calculated which window rectangular box the head rectangular box falls in, as the window to which the head belongs.
[0045] S5 is specifically as follows: traverse ListP, associate ListW data, and for each tuple P, calculate its absolute position absolute (left front, right front, left rear, middle rear, right rear), i.e., the seat position of the person in the car, according to its belonging window window and relative window position relative; for example, if the belonging window window is the left front window and relative is near, then absolute is the left front; if the belonging window window is the left rear window and relative is far, then absolute is the right rear;
[0046] The S6 is specifically as follows: compare the ListP corresponding to the current frame and the previous frame. When the absolute position absolute appears in the ListP corresponding to the previous frame but is not in the current frame, create a tuple PR containing the absolute position absolute, and append the PR to the ListP corresponding to the current frame to obtain ListPR; so that the people in the current frame ListPn will not be lost due to image occlusion caused by perspective problems. Because the angle at which the people in the car appear in the camera is constantly changing when the vehicle is moving and the windows are lowered, each person in the car always has the opportunity to appear directly in the camera's field of view during the vehicle's movement, and thus be captured by the algorithm. This can effectively reduce the probability of missed detection due to image occlusion during static counting (i.e., counting people when the vehicle is stopped), especially the middle seat in the back row of the vehicle.
[0047] Example 2, see Figure 2 On the basis of the first embodiment, the main network structure of the vehicle window position and state recognition model uses the Yolo series model as the backbone, and through multi-layer convolutional networks, downsampling, and upsampling, it can more accurately learn the material, texture, edge and other features of the vehicle window in the image; and the vehicle side image sample includes a variety of light conditions and a variety of window shapes; it can improve the recognition accuracy of the vehicle window position and state recognition model in a complex environment with light interference, and a variety of vehicle body and window materials, and can effectively distinguish the material characteristics of the vehicle metal body and the window glass, and is almost not affected by the vehicle body. In addition, image enhancement methods such as brightness change, angle selection, and grayscale processing are used to expand the training samples. At the same time, the training samples include samples of various light conditions, scenes, and glass. Therefore, the model has good adaptability and is less affected by ambient light, glass cleanliness, and reflection coefficient. Taking the Yolov3 backbone network as an example, when 10,000 samples are fully trained, the detection accuracy can reach 85%; when the Yolov4 backbone network is used, when 10,000 samples are fully trained, the detection accuracy can reach more than 90%, and when 100,000 samples are fully trained, the accuracy reaches 96%. It can be inferred that the accuracy of the window position and state recognition model can be effectively improved by increasing the number of samples and upgrading the Yolo model version.
[0048] Example 3, see Figure 4 On the basis of the first or second embodiment, the window position and state recognition model and the head recognition model of the occupant share the network backbone, and output the position and open / closed state of the window in the image and the position of the occupant and the position relative to the window through two convolution output layers. Figure 3As shown in the schematic diagram of the model network structure, the Yolov4 model network is used as the backbone network, and two convolution output layers WL and PL are used to replace the output layer of the original Yolov4 model. The main features of the image are extracted through the backbone network of the Yolov4 model, and the window position status and the head features of the person are output respectively through the two convolution output layers WL and PL. Among them, the main input features of the convolution output layer WL are downsampled 16 times, and the receptive field is large, which is suitable for the detection and recognition of medium-sized targets and suitable for the detection and recognition of windows; the main input features of the convolution output layer PL are downsampled 8 times, and the receptive field is small, which is suitable for the detection and recognition of small-sized targets and suitable for the detection and recognition of people's heads. This design allows the two models to complete model inference respectively through one feature extraction, which can simplify the amount of calculation by nearly half.
[0049] Embodiment 4: The algorithms and applications described in Embodiment 3 can all be integrated into a smart industrial box, which greatly reduces hardware costs and enhances deployment flexibility.
[0050] An intelligent industrial box with a GPU card is used to integrate the algorithm model of the present invention as a device for window status detection and in-vehicle personnel counting. The intelligent industrial box can use NVIDIA Jetson Xavier NX series chips. The chip is equipped with ARM64 architecture and Ubuntu18.04 operating system. It has 11 TFLOPS deep learning computing power and can support the operation of the algorithm of the present invention. The algorithm model includes: window position and state recognition model, in-vehicle personnel head recognition model, deduplication algorithm, dynamic correction algorithm, and the parameters of each model are selected as follows:
[0051] Window position and state recognition model and occupant head recognition model: Since the window position and state recognition model and the occupant head recognition model share the network backbone, it is necessary to extract the features of medium and small targets at the same time. Therefore, a larger 608*608 image is selected as input, and the Yolov4 model is used as the backbone network to replace its output layer. The confidence threshold is set to 0.6, and the NMS threshold is set to 0.4, which can effectively reduce the missed detection rate and false detection rate. In addition, the model takes about 60ms to infer under the NVIDIA Jetson Xavier NX chip, and about 120ms to infer the left and right sides simultaneously. The actual frame rate of the video is 25 frames, and a frame extraction ratio of 1 / 12 can be selected, that is, when the vehicle is moving and stopping, dynamic detection and technology are performed approximately every 0.5 seconds.
[0052] Deduplication algorithm: The computing speed of the deduplication algorithm is much faster than that of the vehicle window position and state recognition model and the vehicle occupant head recognition model. Therefore, deduplication calculation can be performed synchronously after each prediction and inference of the vehicle window position and state recognition model and the vehicle occupant head recognition model, that is, once every 0.5 seconds.
[0053] Dynamic counting correction algorithm: The computing speed of the dynamic counting correction algorithm is also much faster than that of the window position and state recognition model and the occupant head recognition model. Therefore, dynamic counting correction can be performed synchronously after each prediction and inference by the window position and state recognition model and the occupant head recognition model, that is, once every 0.5 seconds until the vehicle leaves.
[0054] In the description of the invention, the previous detailed description has been described various embodiments of the apparatus and / or process by using block diagrams, flow charts and / or examples. To the extent that such block diagrams, flow charts and / or examples contain one or more functions and / or operations, it will be understood by those skilled in the art that each function and / or operation within such block diagrams, flow charts or examples can be implemented individually and / or collectively by many various hardware, software, firmware or any combination thereof.
[0055] There is little difference between hardware and software implementations of various aspects of the system; the use of hardware or software is typically (but not always, as the choice between hardware and software may become important in certain scenarios) a design choice that represents a tradeoff between cost and efficiency. There are various means (e.g., hardware, software, and / or firmware) by which the processes and / or systems and / or other techniques described herein may be implemented, and the preferred means will vary depending on the scenario in which the processes and / or systems and / or other techniques are deployed. For example, if the implementer determines that speed and accuracy are extremely important, then the implementer may choose a primarily hardware and / or firmware means; if flexibility is extremely important, then the implementer may choose a primarily software implementation; or, but equally alternatively, the implementer may choose some combination of hardware, software, and / or firmware.
[0056] The terms "first", "second", etc. are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of the technical features indicated. Thus, a feature defined as "first", "second", etc. may explicitly or implicitly include one or more of the features. In the description of the present invention, unless otherwise specified, "plurality" means two or more.
[0057] Technical features not described in the present invention can be achieved through or by adopting existing technologies and will not be described in detail here. Of course, the above description is not a limitation of the present invention, and the present invention is not limited to the above examples. Changes, modifications, additions or substitutions made by ordinary technicians in this technical field within the essential scope of the present invention should also fall within the scope of protection of the present invention.
[0058] In the description of the invention, it should be noted that, unless otherwise clearly specified and limited, the terms "install", "connect", "connect", and "set" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the invention can be understood according to specific circumstances.
Claims
1. A method for detecting the state of vehicle windows at a road checkpoint and counting people in the vehicle, characterized in that: The steps include: S1. Read the video streams of the cameras on both sides of the road checkpoint detection channel in real time, and the shooting range of the cameras can cover the windows on the same side; S2, extracting one frame of image from each of the two video streams synchronously every n frames; S3, analyzing the image of the same frame using a vehicle window position and state recognition model to obtain the positions and opening and closing states of all vehicle windows in the image, represented by a tuple list ListW, where W is a tuple corresponding to a vehicle window; S4. When ListW is not empty, it means that a vehicle has entered, and the image of the same frame is analyzed using the head recognition model of the person in the car to identify the person in the car and the position relative to the window, which is represented by a tuple list ListP, where P is a tuple corresponding to a person; S5, traverse all tuples P in ListP, and associate ListW data to obtain the absolute positions of all personnel, that is, the seating positions of the personnel in the car, and append the absolute positions to tuple P; S6, dynamically modify ListP obtained by extracting each frame according to the time series to obtain ListPR; S7. Since two people cannot sit in the same position, the passengers in the car are deduplicated according to the absolute position absolute in ListPR, and the tuples containing the same absolute position absolute attribute are deduplicated. Only one tuple is retained for one absolute position absolute attribute, and then the number of absolute positions absolute or tuples in the current ListPR is counted as the number of passengers in the current car. S8, loop S3-S7 once every n frames, and continuously obtain the position and state ListW of the car window, the position ListPR of the people in the car and the relative position of the car window, and the number of people in the car, until the car leaves, that is, ListW is empty; The S3 is specifically as follows: the window position and state recognition model recognizes the coordinate position and opening and closing state of the window in the picture in the image, and each window can be represented by a tuple W: W (left, top, width, height, status, confidence, type), wherein left, top, width, height, status, confidence, and type are the left x-coordinate, top y-coordinate, width, height, opening and closing state, confidence, and window position type of the window rectangular frame in the picture respectively; the real-time positions and states of the left front window, the left rear window, the right front window, and the right rear window are obtained by synchronously detecting the real-time pictures of the two cameras, and are represented by a list ListW of the tuple W; The S4 is specifically as follows: the head recognition model for the occupant in the vehicle recognizes the coordinate position of the head of the occupant in the image and the position relative to the window. Each head of the occupant can be represented by a tuple P as: P (left, top, width, height, confidence, window, relative), wherein left, top, width, height, confidence, window, relative are respectively the x-coordinate of the left side, the y-coordinate of the top side, the width, height, confidence, and the position of the occupant's head rectangular frame in the image and the position relative to the window; by synchronously monitoring the real-time images of the two cameras, the real-time positions of all unobstructed heads of the occupants in the vehicle are obtained, which are represented by a list ListP of tuples P; S6 specifically includes: comparing ListP corresponding to the current frame and the previous frame, and when an absolute position absolute appears in ListP corresponding to the previous frame that does not exist in the current frame, creating a tuple PR containing the absolute position absolute, and appending the PR to ListP corresponding to the current frame to obtain ListPR.
2. The method for detecting the state of vehicle windows at a road checkpoint and counting people in a vehicle according to claim 1, characterized in that: The process of constructing the vehicle window position and state recognition model is specifically as follows: first, a training video is shot by the camera, and frames of the training video are extracted to obtain vehicle side image samples containing vehicle windows; the vehicle window contour position and the window opening and closing status in the image samples are marked, wherein the vehicle window contour position is marked using the smallest rectangular frame that can encompass the vehicle window; and the vehicle window position and state recognition model is trained using a deep learning-based target detection and classification algorithm; the model accuracy is evaluated; and the above sampling, labeling, training, and evaluation steps are repeated until an ideal model is obtained.
3. The method for detecting the state of vehicle windows at a road checkpoint and counting people in a vehicle according to claim 2, characterized in that: The construction process of the vehicle occupant head recognition model is specifically as follows: first, the vehicles passing through the road checkpoint are analyzed through the window position and state recognition model, the vehicles with open windows are filtered out and the corresponding video streams are obtained, and the frames are extracted to obtain image samples; the head position of the vehicle occupant and the relative window position in the image sample are marked, wherein the head position of the vehicle occupant is marked using the smallest rectangular box that can enclose the head; and the vehicle occupant head recognition model is trained using a deep learning-based target detection and classification algorithm.
4. The method for detecting the state of vehicle windows at a road checkpoint and counting people in a vehicle according to claim 2, characterized in that: The main network structure of the vehicle window position and state recognition model uses the Yolo series model as the backbone. Through multi-layer convolutional networks, downsampling, and upsampling, it can more accurately learn the material, texture, and edge features of the vehicle windows in the image; and the vehicle side image samples include a variety of light conditions and a variety of window shapes; it can improve the recognition accuracy of the vehicle window position and state recognition model in complex environments with light interference and diverse vehicle body and window materials.
5. The method for detecting the state of vehicle windows at a road checkpoint and counting people in a vehicle according to claim 3, characterized in that: The window position and state recognition model shares the network backbone with the occupant head recognition model, and outputs the position and opening and closing state of the window in the image and the position of the occupant and the relative position of the window through two convolutional output layers.
6. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 5 are implemented.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Rapid vehicle detection method
CN109829400A
Multi-stage driver calling behavior detection method based on deep learning
CN110309764A
Bus passenger flow volume real-time statistical method
CN110610159A
Human-vehicle hybrid verification system and method for intelligent inspection station
CN111354121A
Overload detection system, personnel detection method and electronic equipment
CN111368612A
