A low-computing-power frame difference method for road vehicle visual recognition, medium and system

Through the combination of the frame difference method and the pyramid neural network model, the problem of high computational complexity of the deep learning model is solved, low computing power vehicle recognition is achieved, and real-time recognition requirements are met while maintaining high accuracy.

CN118537819BActive Publication Date: 2024-10-11OCEAN UNIV OF CHINA
View PDF 11 Cites 0 Cited by

Patent Information

Application Number
CN202411000782.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-25
Publication Date
2024-10-11
Estimated Expiration
2044-07-25

AI Technical Summary

Technical Problem

Existing deep learning models have high computational complexity in road vehicle recognition, resulting in huge computing power requirements and making it difficult to deploy efficiently on embedded systems or mobile devices.

Method used

The frame difference method with low computing power is used to detect the moving area through the frame difference method. It is combined with the pyramid neural network model and jump output module to reduce the computational complexity and realize vehicle recognition.

Benefits of technology

It reduces computing power requirements, improves real-time performance, maintains high vehicle recognition accuracy, and is suitable for real-time application scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118537819B_ABST
    Figure CN118537819B_ABST
Patent Text Reader

Abstract

The present invention provides a low-computing-power frame difference method road vehicle visual recognition method, medium and system, belonging to the technical field of road vehicle recognition methods, including: obtaining a video of a target road captured by a camera, performing preprocessing to obtain a preprocessed video; using the frame difference method to calculate the pixel difference of adjacent frame images in the preprocessed video, and detecting the motion area according to a preset pixel difference threshold and morphological processing; performing edge detection and contour extraction on the detected motion area to obtain a motion contour; tracking the detected motion contour to obtain a motion trajectory and motion speed; using a pre-trained distance classification vehicle recognition model, inputting the motion contour, motion trajectory, and motion speed to obtain the vehicle classification corresponding to the motion contour; outputting the vehicle classification and motion speed as the recognition result. The present invention solves the technical problem of the existing technology that the high computational complexity leads to the high computing power required.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of road vehicle recognition methods, and in particular, relates to a low-computing-power frame difference method road vehicle visual recognition method, medium and system. Background Art

[0002] At present, visual recognition technology has been widely used in the field of transportation, especially in road vehicle identification. With the construction and improvement of urban traffic monitoring systems, vehicle recognition technology based on video images has become increasingly important. Vehicle recognition technology can be used in many fields such as traffic monitoring, electronic toll collection, vehicle statistics, and violation investigation and punishment. It is of great significance to ensure urban traffic safety and improve traffic management efficiency. Traditional vehicle recognition methods are mainly based on image processing and pattern recognition technology. Common methods include edge detection, shape matching, texture analysis, etc. These methods usually require image preprocessing, such as denoising, contrast enhancement, etc., and then extract image features such as edges, corners, shapes, etc., and finally match them with pre-established template libraries to identify the type of vehicle. With the development of deep learning technology, vehicle recognition methods based on deep neural networks have received widespread attention and application. Deep neural networks can automatically learn feature representations from large amounts of data, avoiding the tedious process of manually designing features. Common deep learning models include convolutional neural networks (CNN), recurrent neural networks (RNN), generative adversarial networks (GAN), etc. These models can achieve high vehicle recognition accuracy through a large amount of training data and powerful computing power.

[0003] However, deep neural network models usually contain a large number of parameters and require a large number of computing operations. Especially in the scenario of real-time video streaming, each frame of the image needs to go through the forward propagation of the neural network, and the amount of calculation is very huge. This places high demands on the computing power of the hardware device, not only requiring a high-performance GPU or dedicated accelerator, but also relatively large energy consumption. On some embedded systems or mobile devices, the limitations of computing power and energy consumption make it difficult to efficiently deploy deep learning models, affecting actual use. Summary of the invention

[0004] In view of this, the present invention provides a low-computing-power frame difference method road vehicle visual recognition method, medium and system, which can solve the technical problem of the prior art that high computing power is required due to high computational complexity.

[0005] The present invention is achieved in that:

[0006] A first aspect of the present invention provides a low-computing-power frame difference method for road vehicle visual recognition, which includes the following steps:

[0007] S10, obtaining a video of the target road captured by a camera, and performing preprocessing to obtain a preprocessed video;

[0008] S20, using a frame difference method to calculate pixel differences between adjacent frame images in the preprocessed video, and detecting a motion area according to a preset pixel difference threshold and morphological processing;

[0009] S30, performing edge detection and contour extraction on the detected motion area to obtain a motion contour;

[0010] S40, tracking the detected motion profile to obtain a motion trajectory and a motion speed;

[0011] S50, using a pre-trained distance classification vehicle recognition model, inputting the motion profile, motion trajectory, and motion speed to obtain a vehicle classification corresponding to the motion profile;

[0012] S60: Output the vehicle classification and movement speed as the recognition result.

[0013] The specific structure of the distance-graded vehicle recognition model adopts a pyramid neural network model, including five pyramid layers executed sequentially and a jump output module, and each pyramid layer is used to recognize motion contours at different distances in the image.

[0014] Further, the first pyramid layer is used to identify motion contours in a first range of distance ranges;

[0015] The second pyramid layer is used to identify a combination of two motion profiles having distance ranges of the first range and the second range;

[0016] The third pyramid layer is used to identify a combination of three motion profiles having distance ranges of the first range, the second range, and the third range;

[0017] The fourth pyramid layer is used to identify a combination of four motion profiles having distance ranges of a first range, a second range, a third range, and a fourth range;

[0018] The fifth pyramid layer is used to identify a combination of five motion profiles having distance ranges of a first range, a second range, a third range, a fourth range, and a fifth range;

[0019] The distances of the first range, the second range, the third range, the fourth range and the fifth range decrease in sequence.

[0020] Optionally, the first range is 200~250 meters, the second range is 150~200 meters, the third range is 100~150 meters, the fourth range is 50~100 meters, and the fifth range is 10~50 meters.

[0021] Correspondingly, Layer 1: Identify moving targets within a range of 200-250 meters;

[0022] Layer 2: Identify moving targets within a range of 150-250 meters;

[0023] Layer 3: Identify moving targets at a distance range of 100-250 meters;

[0024] Layer 4: Identify moving targets at a distance range of 50-250 meters;

[0025] Layer 5: Identify moving targets at distances ranging from 10-250 meters.

[0026] Furthermore, the structure of each pyramid layer is as follows:

[0027] Input layer: receives motion contour image, motion trajectory and speed information as input;

[0028] Convolutional layer group: contains multiple convolutional layers, used to extract image features;

[0029] Pooling layer group: contains the maximum pooling layer, which gradually reduces the resolution of the feature map;

[0030] Fully connected layer group: flatten the convolutional features and output the classification probability through the fully connected layer;

[0031] Output layer: Outputs recognition results based on classification probability.

[0032] Furthermore, the jump output module is used to determine whether the output credibility of the current pyramid layer is greater than the credibility threshold. If it is greater than or equal to, the output of the current pyramid layer is used as the output result of the distance-graded vehicle recognition model; if it is less than, continue to the next layer of pyramid or use the output of the last layer of pyramid as the output result of the distance-graded vehicle recognition model.

[0033] The credibility threshold is preset to 0.8-0.9.

[0034] The identified vehicle types include at least sedans, SUVs, trucks, buses, minivans, and large trucks.

[0035] The pixel difference threshold is preset to be 10% to 30%.

[0036] The pixel difference threshold may be adjusted during a specific implementation.

[0037] The specific implementation of step S20 is as follows:

[0038] Step 201, using the frame difference method to calculate the pixel difference between adjacent frame images in the preprocessed video, the formula is: D(x,y,t)=|I(x,y,t)-I(x,y,t-1)|, where D(x,y,t) represents the pixel difference value between the t-th frame and the t-1-th frame at the coordinate (x,y), I(x,y,t) and I(x,y,t-1) represent the pixel values ​​of the t-th frame and the t-1-th frame respectively.

[0039] Step 202: Binarize D(x,y,t) according to a preset pixel difference threshold T to obtain a binary image B(x,y,t): B(x,y,t)={1,D(x,y,t)>=T;0,D(x,y,t) <T}。

[0040] Step 203: Perform morphological processing such as opening and closing operations on the binary image B(x, y, t) to remove noise and fill holes, and finally obtain a motion area mask in the video.

[0041] The specific implementation of step S30 is as follows:

[0042] Step 301: Use the Canny edge detection algorithm to perform edge detection on the motion region mask to obtain a binary edge image. The Canny algorithm can effectively detect clear edge contours and suppress noise.

[0043] Step 302: extract the contour of the edge image and use the findContours() function in the OpenCV library to obtain the contour information of the motion area, including a set of coordinate points of the contour.

[0044] Step 303: Screen the extracted contours, remove contours that are too small or irregular, and retain larger and more regularly shaped motion contours as input features for subsequent recognition.

[0045] The specific implementation of step S40 is as follows:

[0046] Step 401: Use a Kalman filter to track the motion contour, and use the contour information of the previous and next frames to predict the contour position of the current frame, thereby achieving tracking of the moving target.

[0047] Step 402: Calculate the trajectory coordinate sequence of the moving target based on the position information of the motion profile of each frame, which reflects the motion trajectory of the moving target in the video.

[0048] Step 403: Utilize the position change of the motion contours of adjacent frames and combine the frame rate information to calculate the motion speed of the moving target as one of the important features for identifying the vehicle type.

[0049] The specific implementation of step S50 is as follows:

[0050] Step 501: construct a neural network model including five pyramid convolutional layers executed sequentially, for identifying moving targets within different distance ranges.

[0051] Step 502, the first pyramid layer is used to identify moving targets with a distance range of the first range; the second layer is used to identify a combination of moving targets with a distance range of the first range and the second range; the third layer is used to identify a combination of moving targets with distance ranges from the first to the third range; the fourth layer is used to identify a combination of moving targets with distance ranges from the first to the fourth range; the fifth layer is used to identify a combination of moving targets with distance ranges from the first to the fifth range.

[0052] Step 503: Set a jump output module in the neural network to determine whether the output credibility of the current pyramid layer reaches a threshold. If so, output the result of the current layer, otherwise continue to process the next layer.

[0053] Step 504: Input the features such as motion profile, motion trajectory and motion speed into the neural network model to obtain the vehicle type classification result corresponding to the motion target.

[0054] Wherein, the step S60 includes outputting the vehicle type classification result and movement speed information obtained in step S50 as the final recognition result.

[0055] Optionally, the noise reduction processing in the video preprocessing adopts Gaussian filtering; the noise reduction processing in the video preprocessing adopts median filtering; the color space conversion in the video preprocessing is from RGB space to grayscale space; the color space conversion in the video preprocessing is from RGB space to HSV space; the binarization threshold T in the motion area detection ranges from 50 to 150; the high and low thresholds of the Canny edge detection algorithm are 100 and 200 respectively.

[0056] A second aspect of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores program instructions, and when the program instructions are executed, they are used to execute the above-mentioned low-computing-power frame difference method for road vehicle visual recognition.

[0057] A third aspect of the present invention provides a low-computing-power frame difference method road vehicle visual recognition system, which includes the above-mentioned computer-readable storage medium.

[0058] Compared with the prior art, the low-computing-power frame difference method road vehicle visual recognition method, medium and system provided by the present invention have the following beneficial effects:

[0059] 1. Reduced computing power requirements

[0060] The frame difference method is used to detect the moving area, avoiding processing the entire image and greatly reducing the amount of calculation. At the same time, the pyramid structure and jump output mechanism of the distance-graded vehicle recognition model make it possible to obtain recognition results for small targets at a long distance only through simple calculations in the first few layers, without the need to call complex calculations in subsequent layers, thereby further reducing the computing power requirements.

[0061] 2. Improved real-time performance

[0062] Since the computing power requirement is reduced, real-time vehicle recognition can be achieved on a relatively low-computing hardware platform to meet the needs of real-time applications. At the same time, the pyramid model structure and jump output mechanism also speed up the recognition process and improve real-time performance.

[0063] 3. Maintain recognition accuracy

[0064] Despite the adoption of a computing power optimization strategy, this method can still maintain a high level of vehicle recognition accuracy by comprehensively utilizing motion information, contour information, and neural network models, meeting the needs of practical applications.

[0065] In general, the low-computing-power frame difference method road vehicle visual recognition method achieves a significant reduction in computing power requirements and an improvement in real-time performance through innovative technical solutions, while maintaining a high recognition accuracy. Therefore, the solution of the present invention solves the technical problem of the existing technology that the high computing power required is due to the high computational complexity. BRIEF DESCRIPTION OF THE DRAWINGS

[0066] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.

[0067] Figure 1 A flow chart of the method provided by the present invention;

[0068] Figure 2 is a schematic diagram of the process of pixel calibration removal in Example 2;

[0069] Figure 3 is a schematic diagram of vehicle identification based on the frame difference method in Example 2;

[0070] Figure 4 is a schematic diagram of the frame difference method result under image shaking in Example 2;

[0071] Figure 5 is a performance data diagram of the AKAZE algorithm in Example 2;

[0072] Figure 6 is a performance data diagram of the ROB algorithm in Example 2;

[0073] Figure 7 is a SIFT algorithm performance data diagram in Example 2;

[0074] Figure 8 This is an example of a visual feature detection algorithm when the image is shaking in Example 2;

[0075] Fig. 9 This is an example of a visual feature detection algorithm when the image is stable in Example 2. DETAILED DESCRIPTION

[0076] In order to make the purpose, technical solution and advantages of the embodiments of the present invention more clear, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention.

[0077] like Figure 1 As shown, it is a flow chart of a low-computing-power frame difference method for road vehicle visual recognition provided by the present invention. The method comprises the following steps:

[0078] S10, obtaining a video of the target road captured by a camera, and performing preprocessing to obtain a preprocessed video;

[0079] S20, using a frame difference method to calculate pixel differences between adjacent frame images in the preprocessed video, and detecting a motion area according to a preset pixel difference threshold and morphological processing;

[0080] S30, performing edge detection and contour extraction on the detected motion area to obtain a motion contour;

[0081] S40, tracking the detected motion profile to obtain a motion trajectory and a motion speed;

[0082] S50, using a pre-trained distance classification vehicle recognition model, inputting a motion profile, a motion trajectory, and a motion speed, and obtaining a vehicle classification corresponding to the motion profile;

[0083] S60: Output the vehicle classification and movement speed as the recognition result.

[0084] The specific implementation methods of the above steps are described in detail below:

[0085] The specific implementation of step S10 is: first, obtain the video data of the target road collected by the camera. Then, pre-process the video data, including the following sub-steps:

[0086] 1) Video noise reduction processing: Use Gaussian filtering or median filtering to remove noise from the video to improve the accuracy of subsequent processing.

[0087] 2) Video screen resizing: reducing the resolution of the original video to an appropriate size, such as 320x240 pixels, to reduce the complexity of subsequent calculations.

[0088] 3) Video color space conversion: convert the original RGB color space into grayscale space or HSV color space, because the subsequent motion area detection and feature extraction are mainly based on grayscale or color information.

[0089] Through the above preprocessing steps, the preprocessed video data is obtained, which is ready for subsequent motion area detection and vehicle model recognition.

[0090] The specific implementation of step S20 is: using the frame difference method to calculate the pixel difference between adjacent frame images in the preprocessed video, and then detecting the motion area in the video according to a preset pixel difference threshold and morphological processing. Wherein:

[0091] 1) The frame difference method calculates the pixel difference between adjacent frames. The specific formula is:

[0092] D(x,y,t)= |I(x,y,t)- I(x,y,t-1)|

[0093] Where D(x,y,t) represents the pixel difference between the t-th frame and the t-1-th frame at the coordinate (x,y), I(x,y,t) and I(x,y,t-1) represent the pixel values ​​of the t-th frame and the t-1-th frame respectively.

[0094] 2) According to the preset pixel difference threshold T, D(x, y, t) is binarized to obtain the binary image B(x, y, t):

[0095] B(x,y,t)= {

[0096] 1, D(x,y,t)>= T

[0097] 0, D(x,y,t) <T

[0098] }

[0099] 3) Perform morphological processing such as opening and closing operations on the binary image B(x, y, t) to remove noise and fill holes, and finally obtain the motion area mask in the video.

[0100] The frame difference method is based on the continuous change of images in the video captured by the camera. In a static environment, the difference between pixels in adjacent images is very small; if there is a moving target, the grayscale value of some pixels in the adjacent images will change significantly, and the moving pixels are screened by the threshold, so as to detect the moving target. The advantage of the frame difference method is more significant when the road camera is fixed and the road image content is single. Since the road camera usually shoots a relatively single road scene, it means that the background changes little, and moving targets such as vehicles or pedestrians are relatively easy to detect. The frame difference method can detect these moving targets quickly and accurately, and when the camera position is fixed, the frame difference method does not require additional calibration or adjustment because the background changes little, making the algorithm implementation simpler. The present invention first preprocesses the raw data collected by the camera, and on this basis obtains the vehicle position data and the vehicle image data based on the frame difference method. For the camera shaking that may occur in the actual scene, the visual feature detection algorithm is used to reduce or eliminate the video shaking to ensure the effect of the frame difference method. Finally, based on the existing vehicle recognition algorithm based on the frame difference method, the moving vehicle is re-identified.

[0101] The specific implementation of step S30 is: edge detection and contour extraction are performed on the detected motion area to obtain a motion contour. Specifically, it includes the following sub-steps:

[0102] 1) Use the Canny edge detection algorithm to detect the edge of the motion area mask and obtain a binary edge image. The advantage of the Canny algorithm is that it can effectively detect clear edge contours while suppressing noise.

[0103] 2) Perform contour extraction on the edge image and use the findContours() function in the OpenCV library to obtain the contour information of the moving area, including the set of coordinate points of the contour.

[0104] 3) Screen the extracted contours, remove those that are too small or irregular, and retain the larger and more regular motion contours as input features for subsequent recognition.

[0105] The specific implementation of step S40 is: tracking the detected motion profile to obtain the motion trajectory and motion speed.

[0106] 1) The Kalman filter is used to track the motion contour, and the contour information of the previous and next frames is used to predict the contour position of the current frame, thereby achieving the tracking of the moving target.

[0107] 2) Based on the position information of the motion contour in each frame, the trajectory coordinate sequence of the moving target is calculated, which reflects the motion trajectory of the moving target in the video.

[0108] 3) Using the position changes of the motion contours of adjacent frames and combining them with the frame rate information, the motion speed of the moving target is calculated as one of the important features for identifying the vehicle model.

[0109] The specific implementation of step S50 is: using a pre-trained distance classification vehicle recognition model, inputting features such as motion profile, motion trajectory and motion speed, and obtaining the vehicle classification corresponding to the motion profile. The distance classification vehicle recognition model adopts a pyramid neural network structure, specifically including:

[0110] 1) Input layer: receives image data of motion contours, motion trajectory coordinate sequence, motion speed, etc. as input features.

[0111] 2) Multiple pyramid convolutional layers: It contains 5 pyramid convolutional layers executed sequentially, each layer is responsible for identifying moving targets within different distance ranges.

[0112] First layer: identify moving targets within the first range;

[0113] The second layer: identifying the combination of moving targets with a distance range of the first range and the second range;

[0114] The third layer: identify the combination of moving targets in the first to third ranges;

[0115] The fourth layer: identifying the combination of moving targets in the first to fourth ranges;

[0116] Fifth layer: Identify the combination of moving targets in the distance range from the first to the fifth range.

[0117] 3) Jump output module: Determine whether the output credibility of the current pyramid layer reaches the threshold. If so, output the result of the current layer, otherwise continue to process the next layer.

[0118] 4) Output layer: Output the vehicle type classification results corresponding to the moving target.

[0119] Optionally, the first range is 200~250 meters, the second range is 150~200 meters, the third range is 100~150 meters, the fourth range is 50~100 meters, and the fifth range is 10~50 meters.

[0120] Correspondingly, Layer 1: Identify moving targets within a range of 200-250 meters;

[0121] Layer 2: Identify moving targets within a range of 150-250 meters;

[0122] Layer 3: Identify moving targets at a distance range of 100-250 meters;

[0123] Layer 4: Identify moving targets at a distance range of 50-250 meters;

[0124] Layer 5: Identify moving targets at distances ranging from 10-250 meters.

[0125] The specific implementation method of step S60 is: outputting the vehicle type classification result and movement speed information obtained in step S50 as the final recognition result.

[0126] In summary, this low-computation frame road vision vehicle recognition method can effectively utilize features such as motion profile, motion trajectory and motion speed through a gradually optimized pyramid neural network structure, accurately identify the type of vehicles on the road within different distance ranges, and output the corresponding results, with low computational complexity. This method can be applied to scenarios such as intelligent traffic monitoring and autonomous driving, and provide valuable vehicle recognition information for related applications.

[0127] A second aspect of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores program instructions, and when the program instructions are executed, they are used to execute the above-mentioned low-computing-power frame difference method for road vehicle visual recognition.

[0128] A third aspect of the present invention provides a low-computing-power frame difference method road vehicle visual recognition system, which includes the above-mentioned computer-readable storage medium.

[0129] In order to better understand and implement the present invention, a specific embodiment 1 of the present invention as a computer program in a computer-readable storage medium or an electronic device or system such as a computer is provided below. In the embodiment 1, first, the video preprocessing process of step S10 can be described by the following formula:

[0130] The video noise reduction process uses a Gaussian filter, and the formula is as follows:

[0131]

[0132] in, After filtering, Frame Coordinates The pixel value at Indicates the original Frame Coordinates The pixel value at is the standard deviation of the Gaussian kernel, is the radius of the Gaussian kernel. The Gaussian filter formula can effectively remove the noise in the video and improve the accuracy of subsequent processing.

[0133] The video resolution can be reduced and adjusted using a bilinear interpolation algorithm, the formula is as follows:

[0134]

[0135] in, Represents the image coordinates after scaling The pixel value at Represents the values ​​of the 4 nearest pixels of the original image. and They are and This formula can be used to reduce the original video resolution to a suitable size to reduce the complexity of subsequent calculations.

[0136] The formula for converting video color space from RGB to grayscale space is as follows:

[0137]

[0138] in, Indicates Frame Coordinates The gray value at , and Respectively represent Frame Coordinates The red, green and blue channel values ​​at . This formula can be used to convert the original RGB color space into a grayscale space that is more suitable for subsequent processing.

[0139] Next, the motion region detection process in step S20 can be described by the following formula:

[0140] The formula for calculating the pixel difference between adjacent frames using the frame difference method is as follows:

[0141]

[0142] in, Representing coordinates Place Frame and The pixel difference value of the frame, and Respectively represent Frame and By calculating the difference between pixels of adjacent frames, the motion area in the video can be detected.

[0143] The binarization process uses the following formula:

[0144] in, Represents the coordinates after binarization Place The pixel value of the frame, is the preset pixel difference threshold. Through this binarization process, the motion area in the video can be highlighted.

[0145] The opening operation formula in morphological processing is as follows:

[0146]

[0147] in, Indicates the first Frame Coordinates The pixel value at represents a binary image, is the structural element, and They represent erosion and dilation operations respectively. The opening operation can remove noise points, and the closing operation can fill holes, thus obtaining a smoother motion area mask.

[0148] Again, the motion contour extraction process of step S30 can be described by the following formula:

[0149] The core formula of the Canny edge detection algorithm is as follows:

[0150]

[0151]

[0152] in, and Respectively represent the images in and The gradient of the direction, represents the gradient amplitude, represents the gradient direction, The Canny algorithm can effectively detect clear edge contours while suppressing noise.

[0153] Contour extraction uses the findContours() function in the OpenCV library, which calculates the contour according to the following formula:

[0154]

[0155] in, Represents a contour, Indicates the contour The coordinates of the points, is the total number of points on the contour. This function can be used to obtain the contour information of the motion area, including the coordinate point set of the contour.

[0156] The moving target tracking process of step S40 can be described by the following formula:

[0157] The state equation and observation equation of the Kalman filter are as follows:

[0158]

[0159]

[0160] in, For the The state vector at the moment, is the state transfer matrix, is the control input matrix, is the control input vector, is the state noise, For the The observation vector at time instant, is the observation matrix, The Kalman filter can be used to predict the position of the motion contour of the current frame, thereby achieving the tracking of the moving target.

[0161] According to the position change of the motion profile, the motion speed can be calculated :

[0162]

[0163] in and Respectively represent Frame and The position coordinates of the frame moving target, and Respectively represent Frame and The timestamp of the frame. The speed information of the moving target can be calculated by this formula.

[0164] Finally, the distance classification vehicle recognition model in step S50 can be described by the following formula:

[0165] The model adopts a pyramid neural network structure, and the output of each pyramid layer can be expressed as:

[0166]

[0167] in, For the The output vector of the layer, For the The input vector of the layer, and Respectively The weight matrix and bias vector of the layer, is the activation function. Each pyramid layer is responsible for identifying moving targets within different distance ranges.

[0168] The judgment formula for the jump output module is as follows:

[0169]

[0170] in, For the The output vector of the layer, is the credibility threshold, is the total number of pyramid layers. When the output credibility of the current layer reaches the threshold, the result of the current layer is output, otherwise the next layer is processed until the last layer.

[0171] Through the above formula, the specific implementation process of this low-computation frame road vision vehicle recognition method can be described in detail. This method makes full use of the characteristics of motion contour, motion trajectory and motion speed, and uses a pyramid neural network to efficiently realize vehicle recognition within different distance ranges. It has low computational complexity and can be widely used in scenarios such as intelligent traffic monitoring and autonomous driving.

[0172] Specifically, the principle of the present invention is to utilize the motion characteristics of vehicles in video images, such as motion profile, motion trajectory and motion speed, to achieve efficient recognition of vehicles at different distances through a pyramid neural network model. The specific technical principles are as follows:

[0173] 1. Use frame difference method to detect motion area

[0174] First, the video stream is preprocessed, and then the pixel differences between adjacent frames are calculated using the frame difference method. By setting appropriate thresholds and morphological operations, the moving area in the image, namely the vehicle area, can be effectively detected. This motion detection-based method avoids processing the entire image and greatly reduces the amount of calculation.

[0175] 2. Edge detection and contour extraction

[0176] The detected moving area is subjected to edge detection and contour extraction to obtain the contour information of the moving target. This step further reduces the dimension of the data and provides a streamlined feature input for the subsequent recognition process.

[0177] 3. Motion trajectory and velocity estimation

[0178] By tracking the motion profile, the target's motion trajectory and speed information can be estimated, which plays an important auxiliary role in vehicle recognition and classification.

[0179] 4. Distance classification vehicle recognition model

[0180] The present invention proposes a novel distance-classified vehicle recognition model, which adopts a pyramid neural network structure. The model includes five pyramid layers executed in sequence, and each pyramid layer is used to recognize a combination of motion profiles in different distance ranges.

[0181] Specifically, the first pyramid layer recognizes a single motion contour in the farthest distance range, the second layer recognizes a combination of two contours in the first and second distance ranges, the third layer recognizes a combination of three contours in the first, second, and third distance ranges, and so on. The structure of each pyramid layer includes a convolution layer group, a pooling layer group, and a fully connected layer group for feature extraction and classification.

[0182] 5. Jump output module

[0183] The model also introduces a jump output module to determine the output credibility of the current pyramid layer. If the credibility is higher than the threshold, the recognition result of the current layer is directly output without continuing the calculation of the subsequent layers, thus further saving computing power.

[0184] In order to better understand and implement the present invention, an embodiment 2 of the present invention applied in a specific scenario is provided below.

[0185] 1. System deployment

[0186] The main road in the city is about 10 kilometers long and has a large traffic volume. It adopts a two-way four-lane road structure. In order to fully cover the road section, the traffic control department deployed a total of 20 high-definition cameras on both sides of the road, with a spacing of about 500 meters, all connected to the central control room. These cameras use 3 million pixel 1 / 2.8 inch CMOS sensors, which can capture video images with a resolution of 1920x1080 and a frame rate of 30 frames per second.

[0187] In the central control room, the videos collected by all cameras are aggregated to a server for unified processing. The server uses an Intel Core i7-10700 processor, equipped with 32GB of memory and a 512GB SSD solid-state drive. The operating system is Ubuntu 20.04 LTS, and the OpenCV, Tensorflow and other software libraries required by the method of the present invention are pre-installed.

[0188] 2. Video Preprocessing

[0189] First, the server preprocesses the video data collected from each camera in real time. Specifically, it includes:

[0190] (1) Video noise reduction: Gaussian filtering algorithm is used to effectively suppress the noise in the video image. The standard deviation of the Gaussian kernel The value is 1.0, the radius is 3 pixels.

[0191] (2) Video resolution reduction: Reduce the original 1920x1080 video resolution to 320x240, the scaling ratio This can effectively reduce the complexity of subsequent calculations.

[0192] (3) Color space conversion: Convert the video from RGB color space to grayscale space for subsequent motion area detection and feature extraction.

[0193] Through the above preprocessing steps, the server can process 20 grayscale video frames with a resolution of 320x240 from different cameras per second.

[0194] 3. Motion area detection

[0195] Next, the server uses the frame difference method to detect the motion area of ​​the pre-processed video frames. The specific steps are as follows:

[0196] (1) Calculate the pixel difference between adjacent frames:

[0197]

[0198] in, Representing coordinates Place The pixel difference between the frame and the previous frame, and Respectively Frame and The pixel value of the frame.

[0199] (2) Based on the preset difference threshold right Perform binarization to obtain the motion area mask : .

[0200] (3) Binarized image Morphological processing such as opening and closing operations is performed to remove noise and fill holes, and finally a smoother motion area mask is obtained.

[0201] Through the motion area detection process, the server can accurately locate the moving vehicle area in the video.

[0202] 4. Motion contour extraction

[0203] Based on the detected motion area, the server then uses the Canny edge detection algorithm to extract the motion contour of the vehicle. The specific steps are as follows:

[0204] (1) Calculate the gradient amplitude of Canny edge detection and direction :

[0205]

[0206]

[0207] Among them, and respectively represent the gradients of the image in the and directions.

[0208] (2) According to the preset high threshold and low threshold , perform non-maximum suppression and hysteresis edge linking on the gradient magnitude to obtain the output of Canny edge detection .

[0209] (3) Use the findContours() function of the OpenCV library to extract the motion contour of the vehicle from the Canny edge output , where are the coordinate points on the contour, is the total number of points.

[0210] For traditional vehicle detection, during the process of forming a grayscale image by taking the difference between consecutive frames using the frame difference method, there are duplicate detection areas in the useless areas of the road, increasing the cost and operation time of the device. Therefore, in the preprocessing stage, the image calibration method is first adopted to calibrate and record the non-road areas that do not need to be recalculated, and a mask array of the same size as the read image is created by reading the calibration area. Set the pixel values at the specified coordinate positions in the mask to 0 and remove these pixel points from the mask, thereby achieving the effect of removing the background and realizing the optimization process of the frame difference method. The specific interface calibration process is as Figure 2 shown. As Figure 3 shown, use edge detection to find the vehicle contour in the binary image. By finding the connectivity between pixel points, closed contours are found and each contour is processed. Calculate the area of each found contour, set the maximum area S2 and minimum area S1 of the estimated pixel area occupied by the road vehicle area. If the area C of the detected area contour satisfies S1 < C < S2, obtain the minimum bounding rectangle of the contour and obtain the four vertex coordinates of the rectangle. Since the line of sight of the camera is not perpendicular to the ground plane but has an angle, the proportion of the frame difference of the vehicle contour box selected in the overall picture at different positions in the picture is different. For this problem, in this embodiment, the picture is divided and the number of edge detection points inside the rectangular contour in the video is adjusted according to the divided area, so as to limit the possible contour sizes of the pixel areas in the box selected areas at different positions in the picture, thereby improving the accuracy of the box selection.

[0211] According to the actual situation of the road traffic environment, since most of the objects in the road camera's frame are stationary, only vehicles are in high-speed movement and are the main objects of our data collection; in addition, the picture changes caused by the shaking of the shooting equipment are often continuous, and only cause small changes in the picture under the support of the lamp pole. In this case, it is a possible solution to correct the picture based on the edge points of the surrounding stationary objects. By identifying the edges of objects with obvious stationary features on the roadside and the road, and performing inter-frame comparison, and then using them as the key points for picture correction, the shaking of the camera picture can be effectively reduced without occupying more CPU computing power and memory. In view of the problem of image shaking, this embodiment proposes a video stabilization solution that uses a visual feature detection algorithm to improve the frame difference method to perform image acquisition stability in a video shaking road scene, aiming to reduce the video jitter caused by camera shaking. This embodiment is verified by experimental comparison, aiming to find an algorithm that is more suitable for the road lamp pole scene to stabilize the picture, among which the SIFT algorithm, ORB algorithm, and AKAZE each have advantages for actual scenes.

[0212] Through experiments, AKAZE provides a good balance between performance and speed. Although its effect may not be as good as SIFT, its speed advantage makes it more suitable in application scenarios that have certain requirements for processing speed and accuracy. Although ORB is faster, its shortcomings in robustness and matching accuracy may cause it to perform poorly in some application scenarios. The reason for this result is that the SIFT method identifies key points by detecting extreme points in the image and constructs direction histograms around the key points to create feature descriptors. These descriptors are scale-invariant and also maintain a certain degree of invariance to rotation and lighting changes. The complex calculation process enables SIFT to provide very robust matching results, but the calculation cost is high and the speed is slow, which is not suitable for real-time applications and scenarios with limited computing resources in this embodiment.

[0213] ORB uses the FAST algorithm to detect corners. The FAST algorithm runs very fast because it only needs to consider a small number of pixels around the pixel to determine whether the point is a corner point. ORB uses the BRIEF method to generate descriptors for these points. BRIEF provides a very fast feature descriptor calculation method. The core idea is to generate a binary string by comparing randomly selected pixel pairs around the key point. The calculation speed of this descriptor is very fast because it only involves simple pixel comparison operations without complex gradient or directional histogram calculations.

[0214] However, although ORB has advantages in speed, its robustness and accuracy are low, and it cannot accurately match satisfactory results. The AKAZE algorithm provides a good balance between ORB and SIFT. It uses nonlinear filters and efficient binary descriptors to achieve both fast and robust feature detection and matching effects. AKAZE is a feature detector based on nonlinear scale space theory. It uses fast explicit diffusion filters to construct scale space, which provides a faster way to construct scale space and is much faster than the traditional Gaussian blur of SIFT. In addition, AKAZE uses the so-called M-LDB descriptor. Compared with the BRIEF descriptor used in ORB, M-LDB performs more local pixel comparisons and more complex patterns, which can provide better description capabilities and higher robustness.

[0215] Therefore, based on the comparison of three different algorithm methods, from the specific experimental results, the AKAZE algorithm is Figure 5 As shown in Figure 2, the average time to process each image is 0.08 seconds, and the CPU usage is 9.23%. Figure 6 As shown in Figure 2, the average time to process each image is 0.03 seconds, and the CPU usage is 5.59%. Figure 7 As shown, the average time for processing each picture is 0.12 seconds, and the CPU occupancy rate is 10.01%. Compared with the other two algorithms, the AKAZE algorithm has a medium speed and computing power, and the implementation effect is better, so the AKAZE algorithm is more suitable as a solution for picture correction in the scenario of this embodiment. The AKAZE algorithm is used to detect feature points and calculate descriptors on the selected ROI. The AKAZE algorithm is an algorithm for detecting image feature points and generating descriptors, which is suitable for image matching and recognition tasks. Initialize the FLANN matcher and set its parameters (using the KD tree algorithm and minimized search check) to speed up the matching of feature points. In each frame of the video, the original ROI is expanded to avoid feature point loss, and then the AKAZE algorithm is used to detect feature points and calculate descriptors. The descriptors of the current frame and the previous frame are matched using the FLANN matcher to filter out good matching points. If there are enough matching points, calculate the transformation matrix from the current frame to the previous frame, and apply this transformation matrix for perspective transformation to align the images. Afterwards, the processed image is further operated using the frame difference method and contour detection, contours are searched on the processed difference image, and contour information that meets the conditions is saved.

[0216] Using the AKAZE algorithm to reduce shaking has two advantages while ensuring computing power and storage space occupation. First, the visual feature detection algorithm can effectively reduce the error information in the picture, such as Figure 8As shown in the figure, the left side shows the effect of not using the visual feature detection algorithm, and the right side shows the effect of using the visual feature detection algorithm. The white part is the noise. It can be seen that the noise is greatly reduced, which has a very great practical significance for the implementation of the frame difference method. Secondly, even if the picture is not shaking, the visual feature detection algorithm can still improve the stability of the image and the accuracy of the edge, thereby improving the effect of the frame difference method. Fig. 9 As shown in the figure, the white area is the frame difference result of the moving vehicle. It can be seen that the frame difference result is significantly improved after using the visual feature detection algorithm on the right side, thereby increasing the effect of the frame difference method.

[0217] Through experiments, AKAZE provides a good balance between performance and speed. Although its effect may not be as good as SIFT, its speed advantage makes it more suitable in application scenarios that have certain requirements for processing speed and accuracy. Although ORB is faster, its shortcomings in robustness and matching accuracy may cause it to perform poorly in some application scenarios. The reason for this result is that the SIFT method identifies key points by detecting extreme points in the image and constructs direction histograms around the key points to create feature descriptors. These descriptors are scale-invariant and also maintain a certain degree of invariance to rotation and lighting changes. The complex calculation process enables SIFT to provide very robust matching results, but the calculation cost is high and the speed is slow, which is not suitable for real-time applications and scenarios with limited computing resources in this embodiment. ORB uses the FAST algorithm to detect corners. The FAST algorithm runs very fast because it only needs to consider a small number of pixels around the pixel to determine whether the point is a corner point. ORB uses the BRIEF method to generate descriptors for these points. BRIEF provides a very fast feature descriptor calculation method. Its core idea is to generate a binary string by comparing randomly selected pixel pairs around the key point. The calculation speed of this descriptor is very fast because it only involves simple pixel comparison operations without complex gradient or directional histogram calculations. However, although ORB has an advantage in speed, its robustness and accuracy are low, and it cannot accurately match satisfactory results. The AKAZE algorithm provides a good balance between ORB and SIFT. It uses nonlinear filters and efficient binary descriptors to achieve fast and robust feature detection and matching effects. AKAZE is a feature detector based on nonlinear scale space theory. It uses a fast explicit diffusion filter to construct the scale space, which provides a faster scale space construction method and is much faster than the traditional SIFT Gaussian blur. In addition, AKAZE adopts the so-called M-LDB descriptor. Compared with the BRIEF descriptor used in ORB, M-LDB performs more local pixel comparisons and more complex patterns, which can provide better description capabilities and higher robustness.

[0218] 5. Moving target tracking

[0219] After obtaining the motion profile information, the server then uses the Kalman filter to track these moving targets and calculate their movement speed. The specific steps are as follows:

[0220] (1) The state equation and observation equation of Kalman filtering are:

[0221]

[0222]

[0223] in, For the The state vector at a moment (including position and velocity), is the state transfer matrix, is the control input matrix, is the control input vector, is the state noise, For the The observation vector at the moment (i.e., the motion profile coordinates), is the observation matrix, is the observation noise.

[0224] (2) State transition matrix of Kalman filter and the observation matrix Set to:

[0225] ;

[0226]

[0227] (3) Noise covariance matrix and Set to:

[0228] ;

[0229]

[0230] Through the above-mentioned Kalman filter parameter settings, the server can accurately track the motion trajectory and speed information of each vehicle in the video.

[0231] 6. Distance-based vehicle model recognition

[0232] Finally, the server uses the pre-trained pyramid neural network model to identify the vehicle model based on the detected motion features. The specific structure of the model is as follows:

[0233] Input layer: receives motion contour image data, motion trajectory coordinate sequence, motion speed and other features.

[0234] 5 pyramid convolutional layers:

[0235] Layer 1: Identify moving targets at a distance range of 200-250 meters;

[0236] Layer 2: Identify moving targets within a range of 150-250 meters;

[0237] Layer 3: Identify moving targets at a distance range of 100-250 meters;

[0238] Layer 4: Identify moving targets at a distance range of 50-250 meters;

[0239] Layer 5: Identify moving targets at distances ranging from 10-250 meters.

[0240] The internal structure of each pyramid layer includes:

[0241] 1) Convolutional layer group: extract motion features;

[0242] 2) Pooling layer group: gradually reduce the feature map resolution;

[0243] 3) Fully connected layer group: flattens the features and outputs classification probabilities.

[0244] Jump output module: Determine whether the output credibility of the current pyramid layer reaches 0.8. If so, output the result of the current layer, otherwise continue to process the next layer.

[0245] Output layer: Output the final vehicle model recognition result according to the classification probability.

[0246] Through this pyramid-like multi-scale recognition mechanism, the neural network model can effectively utilize the motion characteristics at different distances and improve the overall vehicle model recognition accuracy.

[0247] 7. Recognition result output

[0248] After completing the above steps, the server transmits the final vehicle model recognition results and movement speed information to the intelligent traffic control system of the traffic management department through the network. The system will summarize and analyze this information to provide valuable data support for urban traffic management.

[0249] For example, according to the recognition results, a total of 100 vehicles were detected on the road section in a certain period of time, including 50 cars, 30 SUVs, and 20 trucks. These data can be used to evaluate the traffic capacity of the road section and reasonably allocate traffic diversion resources. Furthermore, combined with the movement speed information of each vehicle, the congestion points on the road section can also be found, providing a basis for traffic planning.

[0250] In general, by deploying this low-computing-power frame road visual vehicle recognition system, the traffic control department can achieve comprehensive monitoring and intelligent management of vehicles on the main roads, providing strong support for urban traffic management. Through monitoring and statistics, the road vehicle information obtained is shown in Table 1:

[0251] Table 1 Vehicle information table

[0252] Time period car SUV truck Average speed (km / h) 08:00-08:15 12 7 5 52 08:15-08:30 15 9 6 48 08:30-08:45 13 8 4 51 08:45-09:00 10 6 5 50

[0253] From the bar chart, we can see that during the morning rush hour, the average speed of cars is the highest, about 53-55 km / h, followed by SUVs, and trucks are the lowest, averaging 42-46 km / h. This result shows that there are certain differences in vehicle types on this road section, and targeted traffic control measures need to be taken according to the driving characteristics of different vehicle types.

[0254] 9. System performance evaluation

[0255] In order to evaluate the actual performance of the low-computing-power frame road vision vehicle recognition system, the traffic control department conducted a one-week trial run and collected the following key indicator data:

[0256] 1. Vehicle type recognition accuracy

[0257] This indicator reflects the system's recognition accuracy for different vehicle models. After statistical analysis, among 10,000 vehicles, the recognition accuracy of sedans reached 93%, SUVs 90%, and trucks 88%. Compared with the existing method based on appearance feature recognition, the overall accuracy of this system has increased by about 5 percentage points.

[0258] 2. Identify response time

[0259] This indicator reflects the delay time from video acquisition to output of recognition results. After testing, the average response time of the system is 150 milliseconds, which can meet the needs of real-time traffic monitoring. Compared with the method based on video target tracking, the response time is shortened by more than 30%.

[0260] 3. System throughput

[0261] This indicator reflects the concurrent processing capability of the system. After testing, the server can process 20 channels of 1080P video at the same time and output 100 vehicle recognition results per second. This is consistent with the expected goal when the system was designed and can meet the needs of full coverage of the city's main roads.

[0262] 4. System stability

[0263] This indicator reflects the reliability of the system in long-term operation. After a week of trial operation, the system did not experience any failures or crashes, and the system availability reached 99.9%.

[0264] Based on the above performance indicators, the traffic control department highly evaluated the low-computing-power frame road visual vehicle recognition system. The system not only has high recognition accuracy, but also has fast response speed, strong processing capability and good stability, which fully meets the actual needs of urban traffic management.

[0265] The above description is only a specific implementation mode of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be covered by the protection scope of the present invention.

Claims

1. A low-computing-power frame difference method for road vehicle visual recognition, characterized in that: The following steps are involved: S10, obtaining a video of the target road captured by a camera, and performing preprocessing to obtain a preprocessed video; S20, using a frame difference method to calculate pixel differences between adjacent frame images in the preprocessed video, and detecting a motion area according to a preset pixel difference threshold and morphological processing; S30, performing edge detection and contour extraction on the detected motion area to obtain a motion contour; S40, tracking the detected motion profile to obtain a motion trajectory and a motion speed; S50, using a pre-trained distance classification vehicle recognition model, inputting the motion profile, motion trajectory, and motion speed to obtain a vehicle classification corresponding to the motion profile; S60, outputting the vehicle classification and movement speed as the recognition result; The specific structure of the distance-classified vehicle recognition model adopts a pyramid neural network model, including five pyramid layers executed in sequence and a jump output module, each pyramid layer is used to recognize motion contours at different distances in the image; Wherein, the first pyramid layer is used to identify motion contours in a first range of distance ranges; The second pyramid layer is used to identify a combination of two motion profiles having distance ranges of the first range and the second range; The third pyramid layer is used to identify a combination of three motion profiles having distance ranges of the first range, the second range, and the third range; The fourth pyramid layer is used to identify a combination of four motion profiles having distance ranges of a first range, a second range, a third range, and a fourth range; The fifth pyramid layer is used to identify a combination of five motion profiles having distance ranges of a first range, a second range, a third range, a fourth range, and a fifth range; The distances of the first range, the second range, the third range, the fourth range and the fifth range decrease in sequence, specifically: the first range is 200-250 meters, the second range is 150-200 meters, the third range is 100-150 meters, the fourth range is 50-100 meters, and the fifth range is 10-50 meters; Among them, the structure of each pyramid layer is as follows: Input layer: receives motion contour image, motion trajectory and speed information as input; Convolutional layer group: contains multiple convolutional layers, used to extract image features; Pooling layer group: contains the maximum pooling layer, which gradually reduces the resolution of the feature map; Fully connected layer group: flatten the convolutional features and output the classification probability through the fully connected layer; Output layer: output recognition results based on classification probability; Among them, the jump output module is used to determine whether the output credibility of the current pyramid layer is greater than the credibility threshold. If it is greater than or equal to, the output of the current pyramid layer is used as the output result of the distance-graded vehicle recognition model; if it is less than, continue to the next layer of pyramid or use the output of the last layer of pyramid as the output result of the distance-graded vehicle recognition model.

2. The low-computing-power frame difference method for road vehicle visual recognition according to claim 1, characterized in that: The identified vehicle types include at least sedans, SUVs, trucks, buses, minivans, and large trucks.

3. The low-computing-power frame difference method for road vehicle visual recognition according to claim 1, characterized in that: The pixel difference threshold is preset to 10%~30%.

4. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores program instructions, which, when executed, are used to execute the low-computing-power frame difference method for road vehicle visual recognition as described in any one of claims 1 to 3.

5. A low-computing-power frame difference method road vehicle visual recognition system, characterized in that: Contains the computer-readable storage medium of claim 4.

Citation Information

Patent Citations

  • Vehicle flow statistics method based on video analysis

    CN105427626A

  • Method and system for identifying abnormal driving behavior on road

    CN106652465A

  • Urban moving vehicle behavior recognition method based on machine vision

    CN106875424A

  • Visual detecting and counting method for vehicle flow rate under complex road condition

    CN107133610A

  • Vehicle line-crossing detection method based on intelligent video analysis technology

    CN108596129A