Method, device and equipment for counting number of vehicle types and medium
By detecting the location, tracking the trajectory, and identifying the confidence level of vehicles in the surveillance video stream, a time-series data sequence is generated, which solves the problem of accuracy in vehicle model identification and counting, and achieves efficient vehicle model statistics.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHINA MERCHANTS FINANCE HLDG CO LTD
- Filing Date
- 2025-12-16
- Publication Date
- 2026-05-01
AI Technical Summary
Existing technologies for vehicle model recognition suffer from high deployment and maintenance costs, insufficient system reliability, and low accuracy in vehicle model recognition and counting in complex real-world scenarios.
By performing vehicle location detection on each frame of the surveillance video stream, assigning trajectory numbers to construct motion trajectories, identifying vehicle model confidence, and generating time-series data sequences when the vehicle leaves the monitoring area, combined with vehicle model counts within a preset time range, confidence-based vehicle model identification and counting are achieved.
It improves the accuracy of vehicle model recognition and the precision of counting, avoids duplicate counting or missed detection, reduces invalid data redundancy, and solves the problems of misjudgment in single-frame detection and trajectory breakage caused by occlusion.
Smart Images

Figure CN121963106A_ABST
Abstract
Description
A method, apparatus, equipment, and medium for counting the number of vehicle models. Technical Field
[0001] This invention relates to the field of intelligent decision-making technology, and in particular to a method, apparatus, device, and medium for counting the number of vehicle models. Background Technology
[0002] Vehicle model recognition technology refers to the use of physical sensors, RFID, visual perception and other technologies to accurately detect, classify and count the number of specific vehicle models entering and leaving the vehicle in scenarios such as logistics parks, assembly lines of manufacturing plants and import and export ports, so as to support key business operations such as inventory management, production cycle control and tariff collection.
[0003] In the fintech field, vehicle model recognition technology can accurately collect and analyze circulation and inventory data of specific vehicle models, providing data support for related asset accounting, circulation efficiency assessment, and other tasks, thereby helping to standardize and improve the efficiency of business processes.
[0004] In the healthcare field, vehicle type recognition technology can quickly identify special vehicles such as ambulances, opening up priority passage lanes for them. At the same time, it can efficiently guide vehicles related to medical treatment to park quickly, reducing the time wasted in seeking medical treatment and alleviating traffic pressure around hospitals.
[0005] However, existing technical solutions generally suffer from high deployment and maintenance costs, insufficient system reliability, or low accuracy in vehicle model recognition and counting due to the inability to effectively utilize time-series information in complex real-world scenarios. Summary of the Invention
[0006] This invention provides a method, apparatus, device, and medium for counting the number of vehicle models, in order to solve the technical problem of low accuracy in vehicle model counting due to inaccurate model identification.
[0007] Firstly, a method for counting vehicle models is provided, comprising: locating and detecting vehicles in each frame of a real-time acquired surveillance video stream to obtain a vehicle detection box for each vehicle; assigning a trajectory number to the first vehicle appearing in the surveillance video stream, and constructing a motion trajectory for each vehicle based on the trajectory number and the vehicle detection box, wherein the motion trajectory refers to a path record formed by sequentially associating the coordinates of the detection boxes corresponding to the vehicle detection boxes of vehicles with the same trajectory number in different time frames of the surveillance video stream; identifying multiple vehicle models and the model confidence level corresponding to each vehicle model in each time frame of the motion trajectory based on the vehicle detection box; and determining the target vehicle's motion trajectory. If the target vehicle has not left the monitoring area corresponding to the monitoring video stream, the process returns to the step of locating and detecting the target vehicle in each frame of the real-time acquired monitoring video stream. If the target vehicle has left the monitoring area, a time-series data sequence of the target vehicle is generated based on the vehicle detection box, the trajectory number, the vehicle type, and the vehicle type confidence score. The vehicle type is then identified based on the vehicle type confidence score using the time-series data sequence to obtain the vehicle type identification result. Within a preset time range, vehicle type counting is performed on all target vehicles to obtain the number of vehicle types in the monitoring video stream within the time range.
[0008] Secondly, a vehicle model number counting device is provided, comprising: a vehicle detection box localization module, used to locate and detect vehicles in each frame of a real-time acquired monitoring video stream to obtain a vehicle detection box for each vehicle; a motion trajectory construction module, used to assign a trajectory number to the first vehicle appearing in the monitoring video stream, and construct a motion trajectory for each vehicle based on the trajectory number and the vehicle detection box, wherein the motion trajectory refers to a path record formed by associating the detection box coordinates corresponding to the vehicle detection boxes of vehicles with the same trajectory number in different time frames of the monitoring video stream in chronological order; a vehicle model recognition module, used to identify multiple vehicle models corresponding to each vehicle and the vehicle model confidence level corresponding to each vehicle model in each time frame of the motion trajectory based on the vehicle detection box; and a vehicle position determination module, used to determine the position of the target vehicle based on its movement. The trajectory determination module determines whether the target vehicle has left the monitoring area corresponding to the monitoring video stream. If the target vehicle has not left the monitoring area, the process returns to the step of locating and detecting the target vehicle in each frame of the real-time acquired monitoring video stream. The time-series data sequence generation module generates a time-series data sequence for the target vehicle based on its vehicle detection frame, trajectory number, vehicle type, and vehicle type confidence score if the target vehicle leaves the monitoring area. The vehicle type result determination module performs vehicle type recognition based on the vehicle type confidence score using the time-series data sequence to obtain the vehicle type recognition result. The vehicle type quantity statistics module performs vehicle type counting processing on all target vehicles within a preset time range to obtain the number of vehicle types in the monitoring video stream within that time range.
[0009] Thirdly, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the above-described method for counting the number of vehicle models.
[0010] Fourthly, a computer-readable storage medium is provided, which stores a computer program that, when executed by a processor, implements the steps of the above-described method for counting the number of vehicle models.
[0011] The aforementioned scheme, implemented by the vehicle model number counting method, device, equipment, and medium, can perform vehicle location detection on each frame of the real-time monitoring video stream to obtain vehicle detection boxes. A trajectory number is assigned to the first vehicle appearing, and the motion trajectory is constructed by associating the detection box coordinates in chronological order. Multiple vehicle models and their corresponding confidence levels are simultaneously identified in each frame. The system determines whether a vehicle has left the monitoring area; if not, detection continues; if it has left, a time-series data sequence is generated, and confidence-based model identification is performed accordingly. Finally, the number of each model is counted within a preset time period. This method improves the accuracy of model counting. In this invention, trajectory number allocation and motion trajectory construction ensure the unique identification and continuous tracking of each vehicle, avoiding duplicate counting or missed detection. Furthermore, the confidence-weighted fusion of multiple frame model identification results improves the accuracy of model judgment. Simultaneously, the mechanism of triggering time-series data generation when a vehicle leaves reduces invalid data redundancy. Combined with targeted counting within a preset time range, accurate statistics of the number of different models within a specific time period are achieved. This solves problems such as misjudgment in single-frame detection, trajectory breakage caused by occlusion, and unstable model identification, thus improving the accuracy of model identification and counting. Attached Figure Description
[0012] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0013] Figure 1 is a schematic diagram of an application environment for a vehicle model quantity counting method according to an embodiment of the present invention; Figure 2 is a flowchart of a vehicle model quantity counting method according to an embodiment of the present invention; Figure 3 is a flowchart of a specific implementation of step S1 in Figure 2; Figure 4 is a flowchart of a specific implementation of step S6 in Figure 2; Figure 5 is a structural schematic diagram of a vehicle model quantity counting device according to an embodiment of the present invention; Figure 6 is a structural schematic diagram of a computer device according to an embodiment of the present invention; Figure 7 is another structural schematic diagram of a computer device according to an embodiment of the present invention. Detailed Implementation
[0014] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0015] The vehicle model counting method provided in this invention can be applied in the application environment shown in Figure 1, where the client communicates with the server via a network. The server can use the client to perform vehicle location detection on each frame of the real-time monitoring video stream to obtain vehicle detection boxes. A trajectory number is assigned to the first vehicle to appear, and the motion trajectory is constructed by associating the detection box coordinates in chronological order. Multiple vehicle models and their corresponding confidence levels are identified synchronously in each frame. The system determines whether a vehicle has left the monitoring area; if not, detection continues; if it has left, a time-series data sequence is generated, and confidence-based model identification is completed accordingly. Finally, the number of each vehicle model is counted within a preset time. This method improves the accuracy of vehicle model counting. In this invention, unique identification and continuous tracking of each vehicle are ensured through trajectory number allocation and motion trajectory construction, avoiding duplicate counting or missed detection. Furthermore, the accuracy of vehicle type judgment is improved by using confidence-weighted fusion of multi-frame vehicle type recognition results. Simultaneously, the mechanism of generating time-series data triggered by vehicle departure reduces invalid data redundancy. Combined with targeted counting within a preset time range, accurate statistics on the number of different vehicle types within a specific time period are achieved. This solves problems such as misjudgment in single-frame detection, trajectory breakage caused by occlusion, and unstable vehicle type recognition, thus improving the accuracy of vehicle type recognition and counting. The client can be, but is not limited to, various personal computers, laptops, smartphones, tablets, and portable wearable devices. The server can be implemented using a standalone server or a server cluster consisting of multiple servers. The invention will be described in detail below through specific embodiments.
[0016] Please refer to Figure 2, which is a flowchart of a vehicle model number counting method provided in an embodiment of the present invention, including the following steps: S1, locate and detect vehicles in each frame of the real-time acquired monitoring video stream to obtain the vehicle detection box for each vehicle.
[0017] In this embodiment of the invention, the vehicle detection box refers to a rectangular image carrier determined from the surveillance video stream image through positioning detection technology, used to accurately select a single vehicle area. Its spatial range is designed to completely cover the vehicle's main body (including the body, front, rear, and other core structures, without exceeding 5% to 10% of the vehicle's outermost contour, and without including large background areas). For example, in a surveillance image of a car parked on the roadside, the vehicle detection box obtained after positioning detection completely encompasses the car's body, front, and rear, excluding surrounding background elements such as curbs and pedestrians, as well as the associated pixel position of the car in the image.
[0018] In this embodiment of the invention, referring to Figure 3, the step of locating and detecting vehicles in each frame of the real-time acquired monitoring video stream to obtain a vehicle detection box for each vehicle includes: S31, sampling frames of the real-time acquired monitoring video stream to obtain a frame sequence; S32, marking the position of each vehicle in each frame of the frame sequence to obtain the detection box coordinates for each vehicle; S33, cropping the vehicle region image corresponding to each vehicle based on the detection box coordinates, and determining the vehicle region image as the vehicle detection box for each vehicle.
[0019] In detail, when sampling the monitoring video stream, keyframes can be extracted by combining frame difference analysis with vehicle dynamic feature recognition. The pixel difference (e.g., the sum of grayscale differences) between adjacent frames is calculated frame by frame. When the difference exceeds a preset threshold, it is determined that there is a dynamic change such as a vehicle entering, leaving, or moving violently, and the frame is marked as a candidate keyframe. Preliminary vehicle contour detection is performed on each frame. If a new vehicle is detected or the position change of an existing vehicle exceeds 10% of the image width, the frame is also marked as a candidate keyframe. Next, duplicate keyframes are de-duplicated to avoid redundancy. A preset time interval of 0.5 seconds is set before and after (this can be adjusted according to the video frame rate, e.g., 15 frames before and after 30fps). Video image frames within this time interval of each keyframe are sampled at fixed intervals (e.g., every 3 frames). All keyframes and their corresponding sampled frames within the time interval are collected to obtain a frame sequence.
[0020] By sampling using the above method, we can avoid the excessive number of samples caused by fixed time interval sampling in conventional methods, while ensuring that key image frames are not lost. By combining the sampling logic with vehicle dynamic behavior, key frames are identified through dual indicators of frame difference and vehicle contour change. Only the effective intervals before and after the key frames are sampled. This improves the sampling accuracy of the monitoring video stream, reduces the number of samples, and shortens the time required for subsequent analysis of the frame sequence.
[0021] Specifically, the detection box coordinates describe the vehicle's position in the image, usually represented by the pixel coordinates of two diagonal points.
[0022] In this embodiment of the invention, the step of marking the location of each vehicle in each frame of the frame sequence to obtain the detection box coordinates of each vehicle includes: extracting a multi-scale feature map of each frame of the frame sequence; setting preset anchor boxes on the multi-scale feature map, and selecting anchor boxes containing vehicles as candidate bounding boxes for each vehicle; adjusting the boundary parameters of the candidate bounding boxes to obtain adjusted bounding boxes; evaluating the confidence of the adjusted bounding boxes to obtain a boundary confidence score; selecting the adjusted bounding box with the highest boundary confidence score, and generating the detection box coordinates of each vehicle based on the coordinates corresponding to the adjusted bounding box.
[0023] In detail, a single frame image from the frame sequence is input into a pre-defined convolutional neural network (such as a ResNet-FPN fusion architecture). The first convolutional layer performs preliminary feature extraction on the image to obtain a low-dimensional, high-resolution initial feature map, preserving basic details such as vehicle edges and textures. Then, the pooling layer in the network downsamples the initial feature map, reducing the feature map resolution while expanding the receptive field, generating intermediate feature maps of different scales (such as 1 / 2, 1 / 4, and 1 / 8 resolution) to adapt to vehicle targets of different sizes (large, medium, and small). Based on the top-down path and lateral connection structure of the Feature Pyramid Network (FPN), the high-level low-resolution feature map is fused with the low-level high-resolution feature map to supplement the detailed information of the high-level features, finally obtaining a multi-scale feature map from local vehicle details to the overall outline.
[0024] By using the above feature extraction method, we can avoid the problems of low vehicle detection accuracy and high false detection rate caused by the unbalanced feature extraction and semantic information gaps of a single backbone network in conventional methods. This ensures that small vehicles receive more detail in high-resolution feature maps, while large vehicles have enhanced semantic information in low-resolution feature maps, thereby improving the overall detection efficiency.
[0025] Specifically, multiple anchor boxes of different scales and aspect ratios are predefined. Multiple different anchor boxes are matched for each possible vehicle. Boundary box regression is performed on the anchor boxes, and adjustment parameters are output to correct the anchor boxes. The adjusted bounding box is obtained by calculating the offset and scaling factor of each anchor box through the regression branch of the object detection model. Based on these parameters, the coordinates of the original anchor boxes are corrected to better fit the actual contour of the vehicle, resulting in an accurate adjusted bounding box.
[0026] The above method of obtaining the adjusted bounding box can avoid the problem of insufficient vehicle shape matching caused by conventional single anchor point box design, and overcome the defect of poor adaptability of traditional offset regression to vehicle perspective deformation, thus achieving accurate coverage and contour fitting for various vehicle models.
[0027] Furthermore, the confidence evaluation of the adjusted bounding boxes refers to calculating the probability of a vehicle being contained within each adjusted bounding box through the model's classification branch, outputting the probability value as the boundary confidence score, sorting all adjusted bounding boxes in descending order of their boundary confidence scores, applying a non-maximum suppression algorithm, setting an intersection-over-union threshold (e.g., 0.5) to remove redundant bounding boxes with excessive overlap, and finally, for each vehicle target, selecting the adjusted bounding box with the highest boundary confidence score after filtering, whose corresponding coordinates [x1, y1, x2, y2] are the detection box coordinates of that vehicle.
[0028] The confidence assessment method described above can avoid the misjudgment problem caused by the single assessment in the traditional anchor box stage, and can also perform secondary verification based on the complete vehicle features of the corrected bounding box. This avoids the redundant box problem caused by the traditional non-maximum suppression algorithm relying solely on the intersection-union threshold. Furthermore, it can combine the actual distribution pattern of vehicles in the monitoring scene for screening, thereby improving the detection accuracy in dense vehicle scenes.
[0029] Furthermore, the coordinates of the detection box are checked to see if they exceed the image boundary and corrected. Then, the corresponding region is cropped from the original image according to the corrected coordinates. This yields a vehicle region image for each vehicle, which is then used as the vehicle detection box for each vehicle. During the cropping process, an intelligent coordinate calibration and occlusion compensation mechanism is added. If partial occlusion of a vehicle is detected, the cropping range is adaptively expanded based on the vehicle region size in adjacent unoccluded frames.
[0030] By using the above method, we can avoid the incomplete vehicle area and loss of key features in occluded scenes caused by direct cropping in conventional methods, and ensure that the vehicle detection box can accurately and completely retain the effective features of the vehicle, thereby improving processing efficiency.
[0031] In this embodiment of the invention, a target detection model (such as YOLO or Faster R-CNN) can be used to accurately separate vehicle targets from complex surveillance video streams, eliminate background environmental interference, and provide a clear target area for subsequent vehicle tracking, identification, counting and other processing, thereby improving the efficiency and accuracy of subsequent processing.
[0032] In the fintech field, it can be applied to vehicle monitoring in bank parking lots. By using vehicle detection frames to determine the location of vehicles entering the parking lot, and combining it with license plate recognition technology, it can achieve precise guidance and management of bank customers' vehicles, ensuring the safety of customer vehicles.
[0033] In the healthcare field, it can be applied to the monitoring of hospital ambulance access routes. The vehicle detection frame can quickly identify the location of ambulances and monitor in real time whether ambulances can enter the hospital smoothly. If an ambulance is detected to be blocked by other vehicles, an early warning can be triggered in time to notify relevant personnel to direct traffic and ensure that the emergency access route is unobstructed.
[0034] S2. Assign a trajectory number to the vehicle that appears for the first time in the monitoring video stream, and construct the motion trajectory of each vehicle based on the trajectory number and the vehicle detection box. The motion trajectory refers to the path record formed by associating the detection box coordinates of the vehicles with the same trajectory number in different time frames in the monitoring video stream in chronological order.
[0035] In this embodiment of the invention, the trajectory number refers to a unique identifier code (which can be numbers, letters, or a combination of numbers and letters) assigned to the first vehicle appearing in the monitoring video stream, used to distinguish the movement process of different vehicles; the movement trajectory refers to a path record formed by associating the coordinates of the detection boxes corresponding to the vehicle detection boxes in different time frames of the same vehicle in chronological order, including the vehicle's position information (detection box coordinates) at different time points, the corresponding frame number, and the timestamp.
[0036] In this embodiment of the invention, constructing the motion trajectory of each vehicle based on the trajectory number and the vehicle detection box includes: performing vehicle matching on the vehicle detection boxes corresponding to each vehicle in adjacent frames within the frame sequence to obtain a vehicle matching relationship; determining the trajectory number of each vehicle in each frame within the frame sequence based on the vehicle matching relationship; and combining the coordinates of the detection boxes corresponding to vehicles with the same trajectory number and the frame number within the frame sequence corresponding to the vehicle, according to the time order of the frame sequence, to obtain the motion trajectory of each vehicle.
[0037] In detail, for adjacent frames within a frame sequence, a multi-target tracking algorithm is used to match the vehicle detection boxes corresponding to each vehicle in the adjacent frames, obtaining the vehicle matching relationship between the detection boxes of the previous frame and the detection boxes of the current frame. The multi-target tracking algorithm includes, but is not limited to: motion model-based tracking algorithms (such as SORT and its improved algorithms, which use Kalman filtering to predict the vehicle's position in the next frame and use the Hungarian algorithm to associate vehicle detection boxes between frames based on the intersection-union ratio), appearance feature-based tracking algorithms (such as the DeepSORT algorithm, which introduces a ReID network to extract vehicle appearance features based on the motion model and combines them with motion information to complete the association), and global optimization-based tracking algorithms (such as offline tracking algorithms based on graph models or minimum cost flow, which first process all frames of a video segment and then construct a global network model to solve for the optimal trajectory association result).
[0038] Specifically, an appropriate algorithm can be selected based on the computing resources, accuracy requirements, and environmental complexity of the actual application scenario, or the advantages of multiple algorithms can be combined for matching. For example, the SORT algorithm can be enabled in scenarios with high real-time requirements and few occlusions, while the DeepSORT algorithm can be switched in complex scenarios with frequent occlusions. A global optimization algorithm can be used in offline high-precision counting scenarios. At the same time, the matching process not only relies on single features such as position or appearance, but also combines information such as changes in the size of the vehicle detection box to improve matching accuracy.
[0039] The above method avoids the problem of poor adaptability of a single tracking algorithm in conventional methods, and solves the tracking robustness problem in complex scenarios, thereby improving the accuracy and efficiency of vehicle counting.
[0040] Furthermore, the trajectory number counter is initialized (initial value is 1). For the first frame of the frame sequence, all vehicle detection boxes in the frame are marked as newly appearing vehicles and assigned trajectory numbers (e.g., if there are 3 vehicles in the first frame, they are assigned "Track_001", "Track_002", and "Track_003" respectively). For the subsequent nth frame (n≥2), based on the vehicle matching relationship between adjacent frames, if a detection box in the nth frame matches a detection box in the (n-1)th frame, the trajectory number corresponding to the detection box in the (n-1)th frame is assigned to that detection box in the nth frame; if there is an unmatched detection box (newly appearing vehicle) in the nth frame, a new trajectory number is assigned starting from the current counter value, and the counter increments accordingly after assignment; if there is an unmatched detection box (possibly leaving the vehicle) in the (n-1)th frame, its trajectory number is retained and marked as pending confirmation, ultimately ensuring that each vehicle detection box in each frame of the frame sequence corresponds to a unique trajectory number.
[0041] The above method avoids the problems of the same vehicle being repeatedly assigned a new number (track breakage) or different vehicles being incorrectly associated with the same number (track confusion) due to occlusion or vehicles briefly leaving the frame, which are common in conventional methods. It ensures the continuity of the track number of each vehicle in the frame sequence and can accurately distinguish different vehicles.
[0042] Furthermore, a storage structure (such as a dictionary with trajectory numbers as the keys) is established using trajectory numbers as indexes. Then, the vehicle detection box information of all frames in the frame sequence is traversed. For each detection box, the coordinates of the detection box and the frame number of the frame it belongs to are stored in the corresponding trajectory number list according to its corresponding trajectory number. After traversal, the data in each trajectory number list is sorted in ascending order of frame number (i.e., chronological order). After sorting, the list corresponding to each trajectory number is the motion trajectory data of the vehicle. The list is associated with the trajectory number and saved to form a complete vehicle motion trajectory.
[0043] The above method avoids the problems of chaotic trajectory data and scattered storage of different frames of the same vehicle caused by the lack of a unified index structure in conventional methods. It effectively solves the problems of low efficiency, frame-by-frame traversal matching, and trajectory time sequence disorder caused by inter-frame processing delay or matching error in existing technologies.
[0044] In this embodiment of the invention, a unique trajectory number can be used to accurately track the entire process of a vehicle from its appearance to its disappearance, avoiding confusion of motion data of different vehicles. The constructed motion trajectory can completely record the vehicle's movement path and time information, providing data support for vehicle behavior analysis, anomaly monitoring, and other purposes.
[0045] In the fintech field, it can be applied to the monitoring of bank armored trucks. By tracking the movement of armored trucks around banks and along transportation routes through trajectory numbers, a security alert can be triggered in a timely manner if the armored truck deviates from the preset route or stays for too long, thus ensuring the safety of fund transportation.
[0046] In the healthcare field, it can be applied to the management of medical supply transport vehicles within hospitals. By tracking the movement of supply vehicles from the warehouse to various departments through trajectory numbers, the transportation time and route of the vehicles are recorded to ensure that medical supplies are delivered on time.
[0047] S3. In each time frame of the motion trajectory, identify the multiple vehicle models corresponding to each vehicle and the vehicle model confidence level corresponding to each vehicle model based on the vehicle detection box.
[0048] In this embodiment of the invention, the vehicle model refers to an identification code used to distinguish different vehicle types. For example, in scenarios such as vehicle logistics parks, manufacturing plant assembly lines, and import / export ports, a specific vehicle model refers to a vehicle category with clear business attributes that needs to be monitored, managed, and statistically analyzed. This could include vehicle types predefined according to business needs (such as sedans, SUVs, and trucks), vehicles with specific configurations or models (such as a specific model of a brand), or vehicles in a specific circulation state (such as new cars awaiting delivery, newly produced vehicles, or standardized models awaiting export). The vehicle model confidence level refers to the probability assessment value of the accuracy of the recognition result when the computer performs vehicle model identification.
[0049] In this embodiment of the invention, the step of identifying multiple vehicle models corresponding to each vehicle and the confidence level of each vehicle model based on the vehicle detection box in each time frame of the motion trajectory includes: extracting the detection box coordinates of each vehicle frame by frame in the motion trajectory of each vehicle, and selecting a vehicle detection box based on the detection box coordinates; extracting vehicle model features from the vehicle detection box to obtain vehicle model features; and performing feature matching between the vehicle model features and vehicle features in a preset vehicle feature library to obtain the identification results of multiple vehicle models corresponding to each vehicle and the confidence level of each vehicle model.
[0050] In detail, the motion trajectory data of the corresponding vehicle is retrieved according to the trajectory number. This data is sorted by frame number and contains the detection box coordinates and frame number of each frame. The detection box coordinates corresponding to each frame are extracted one by one according to the frame number. The vehicle detection box image of the corresponding frame is retrieved according to the extracted coordinates, and finally the vehicle detection boxes of multiple frames in the vehicle motion trajectory are formed.
[0051] Specifically, vehicle characteristics are the appearance, structure, and detailed attributes of a vehicle, used to distinguish different vehicle types.
[0052] In this embodiment of the invention, the step of extracting vehicle model features from the vehicle detection frame to obtain vehicle model features includes: identifying the key point coordinates of preset vehicle key points in the vehicle detection frame; performing coordinate correction transformation on the key point coordinates to obtain corrected key point coordinates; calculating the geometric features of the vehicle in the vehicle detection frame based on the corrected key point coordinates; extracting pixel blocks within a preset threshold range corresponding to the corrected key point coordinates and extracting the texture features of the pixel blocks; and combining the geometric features and the texture features to form the vehicle model features of the vehicle in the vehicle detection frame.
[0053] In detail, the original coordinates of key points such as headlights, wheel centers, and roof corners in the vehicle detection frame can be identified through a pre-trained key point detection model. Then, the actual tilt angle, pitch angle, and other attitude parameters of the vehicle are analyzed by attitude estimation algorithms (such as angle calculation based on the relative positions of key points). By selecting affine transformation (suitable for in-plane tilt correction) or perspective transformation (suitable for three-dimensional attitude correction) algorithms, the transformation matrix is dynamically adjusted according to the attitude parameters to map the original key point coordinates to a standard viewpoint that matches the actual attitude of the vehicle (such as adjusting to the standard viewpoint corresponding to the tilt angle based on the tilt angle), and finally obtaining the corrected key point coordinates.
[0054] By obtaining the coordinates of the key points through the above method, we can avoid the problems caused by the mismatch between the vehicle posture and the correction perspective and the offset of the key point coordinates due to the fixed perspective correction in conventional methods, which leads to the distortion of geometric feature calculation. Furthermore, the corrected key point coordinates can better fit the actual structure of the vehicle, thereby improving the accuracy of subsequent vehicle type recognition. In particular, the recognition effect of vehicles with special postures, such as trucks and forklifts, is significantly improved in logistics scenarios.
[0055] Specifically, calculating vehicle geometric features based on the coordinates of corrected key points involves extracting the coordinates of corrected key points in the vehicle image to calculate geometric relationships such as relative distances, included angles, and size ratios between key points, and combining these quantified relationships into a high-dimensional feature vector. Pixel blocks within a preset threshold range are extracted centered on the corrected key points, and algorithms such as local binary mode or histogram of oriented gradients are used to extract the texture features of the pixel blocks. The geometric feature vector and the texture feature vector are concatenated into a high-dimensional vector, which serves as the vehicle model feature.
[0056] By using the above method, the problems of insufficient distinguishability of single geometric features and poor anti-interference of single texture features in conventional methods can be avoided. The fine-grained geometric features of the present invention can significantly improve the distinguishability of similar vehicle models.
[0057] Among them, extracting vehicle model features from the vehicle region image corresponding to the vehicle detection box can also be done by using a pre-trained vehicle model classification model (such as ResNet or EfficientNet). The vehicle region image is preprocessed (such as resizing to the model input size and normalizing pixel values) and then input into the model. Through the model's convolutional layers, pooling layers and other feature extraction networks, a high-dimensional feature vector is output as the vehicle model feature.
[0058] Furthermore, extract the standard vehicle feature vectors and corresponding vehicle models stored in the preset vehicle feature library. Then, calculate the similarity between the vehicle model feature vector of the current vehicle detection box and the feature vector of each standard vehicle model in the feature library (e.g., by calculating Euclidean distance or cosine similarity). Based on the similarity calculation results, convert the similarity of each standard vehicle model into a confidence score (e.g., use cosine similarity directly as the confidence score, or map the similarity to a confidence score value in the range of 0-1 using a preset function). Output the first N (e.g., the first 3) vehicle models and their corresponding confidence scores in descending order of confidence score. If the confidence score of a certain vehicle model is lower than a preset threshold (e.g., 0.3), then that vehicle model is not output.
[0059] By using the above method, we can avoid the problems of high vehicle model misjudgment rate (such as feature distortion caused by vehicle occlusion and angle deviation in a single frame), inaccurate confidence assessment, and low-quality matching result erroneous output caused by reliance on single-frame feature matching in conventional methods. This improves the stability of vehicle model recognition, makes the confidence level more consistent with the actual matching accuracy, facilitates accurate weighting when fusing subsequent vehicle model results, and improves the accuracy of the final vehicle model judgment.
[0060] In this embodiment of the invention, vehicle type classification is achieved based on the appearance features of the vehicle in different frames. The reliability of the recognition results can be evaluated by combining the confidence level, providing accurate vehicle type data for subsequent applications such as vehicle type statistics and specific vehicle type monitoring. At the same time, the recognition is performed by using multiple vehicle detection boxes in the motion trajectory, which can reduce the recognition error of a single frame image and improve the overall recognition accuracy.
[0061] In the fintech field, it can be applied to the management of exclusive parking lots for bank customers. By identifying vehicle models, it can determine whether the vehicles entering the parking lot are the customer's designated models. Combined with confidence level, it can judge the accuracy of the identification, provide customers with exclusive parking services, and improve the customer experience.
[0062] In the healthcare field, it can be applied to hospital emergency vehicle identification. By identifying the vehicle type, it can distinguish ambulances from ordinary vehicles and quickly confirm the identity of the ambulance by combining confidence level. When the ambulance approaches the hospital, it can trigger the in-hospital emergency preparation process in advance, buying time for patient treatment.
[0063] S4. Determine whether the target vehicle has left the monitoring area corresponding to the monitoring video stream based on the movement trajectory of the target vehicle. If the target vehicle has not left the monitoring area, return to the step of locating and detecting the target vehicle in each frame of the real-time acquired monitoring video stream.
[0064] In this embodiment of the invention, the monitoring area refers to the area that can be adjusted according to the actual scene, such as the entrance and exit area of a parking lot, the emergency passage area of a hospital, or the port of entry and exit. When a vehicle is within the area, it can be continuously tracked, and when it leaves the area, the tracking strategy will stop or be adjusted.
[0065] In detail, the coordinate parameters of the preset monitoring area are obtained, and then the motion trajectory data of the corresponding vehicle is retrieved. The coordinates of the vehicle detection boxes in the latest N frames (e.g., the latest 5 frames) of the trajectory are extracted, and the center point coordinates of each detection box are calculated. It is determined whether the center point coordinates of each center point are within the monitoring area. If the center point coordinates of the latest N frames are not within the monitoring area, and the vehicle does not return to the monitoring area within the subsequent preset number of frames (e.g., 10 frames), it is determined that the vehicle has left the monitoring area. If the center point coordinates of at least one frame in the latest N frames are within the monitoring area, or the center point coordinates return to the monitoring area within the subsequent preset number of frames, it is determined that the vehicle has not left the monitoring area. The process returns to the step of locating and detecting the vehicle in each frame of the real-time acquired monitoring video stream, and continues to locate, detect, and track the vehicle to ensure that the vehicle's movement within the monitoring area is continuously recorded.
[0066] In this embodiment of the invention, the vehicle's existence status within the monitoring area is monitored in real time to ensure continuous tracking of vehicles that have not left, avoid data loss caused by tracking interruption, and promptly identify vehicles that have left to free up computing resources and improve system operating efficiency.
[0067] In the fintech field, it can be applied to vehicle monitoring in bank self-service banking areas. By determining whether a vehicle has left, it can provide timely warnings about suspicious items left behind after the vehicle leaves, while continuously tracking vehicles that have not yet left.
[0068] In the healthcare field, it can be applied to vehicle monitoring in hospitals, continuously tracking vehicles entering the area and determining whether they leave along the prescribed route. If they do not leave and remain for too long, an alert is triggered.
[0069] S5. If the target vehicle leaves the monitoring area, a time-series data sequence of the target vehicle is generated based on the vehicle detection frame of the target vehicle, the trajectory number, the vehicle model and the confidence level of the vehicle model.
[0070] In this embodiment of the invention, the time-series data sequence refers to the key data generated by the vehicle during the entire process from its appearance to its departure from the monitoring area after the vehicle leaves the monitoring area. This includes the vehicle's unique trajectory number, vehicle detection box information (coordinates and area image association identifier) corresponding to each frame, vehicle model and corresponding confidence level obtained from vehicle model identification in each frame, and the frame number and timestamp corresponding to each data.
[0071] In detail, after identifying that a vehicle has left the monitored area, all historical data associated with the vehicle's trajectory number are retrieved. These data are sorted in ascending order of frame number based on timestamps to ensure that the data is arranged according to the time sequence of the vehicle's movement. The sorted single-frame data is then encapsulated into data objects, each containing fields such as "trajectory number, frame number, timestamp, detection box coordinates, vehicle type list, and confidence level list". Finally, all single-frame data objects are combined sequentially to form the time-series data sequence of the vehicle.
[0072] In this embodiment of the invention, key information such as the movement and identification of vehicles within the monitoring area is structured and integrated in a time sequence to avoid data loss or confusion caused by fragmented storage, and to provide complete and orderly data support for subsequent accurate vehicle model judgment, historical data backtracking, and anomaly investigation.
[0073] In the fintech field, it can be applied to the monitoring of bank cash transport vehicles. After the cash transport vehicle leaves the bank's monitoring area, the generated time-series data sequence can completely record its movement trajectory around the bank, vehicle type identification and confirmation information, etc.
[0074] In the healthcare field, it can be applied to the management of hospital emergency supplies transport vehicles. After a vehicle leaves the hospital's monitoring area, the time-series data can record its driving route within the hospital, vehicle type confirmation information, and relevant data related to the loading time of the supplies. If problems such as incorrect delivery of supplies or transportation delays occur later, the responsibility can be traced back through the time-series data to ensure the standardization of emergency supplies transportation.
[0075] S6. Based on the time-series data sequence, perform vehicle model identification on the target vehicle according to the vehicle model confidence level to obtain the vehicle model identification result of the target vehicle.
[0076] In this embodiment of the invention, the vehicle model result refers to the unique vehicle model category identifier that is finally determined based on the vehicle's time-series data sequence, by weighting and comprehensively analyzing the vehicle model identified in each frame and its corresponding confidence level.
[0077] In this embodiment of the invention, referring to Figure 4, the step of performing vehicle model recognition based on the vehicle model confidence level on the target vehicle according to the time-series data sequence to obtain the vehicle model recognition result of the target vehicle includes: S41, assigning weights to the various vehicle models of the target vehicle in each frame of the time-series data sequence using a preset weight decreasing function; S42, calculating the score value of each vehicle model in the time-series data sequence according to the vehicle model confidence level and the weights; S43, selecting the vehicle model with the highest score value as the vehicle model recognition result of the target vehicle.
[0078] In detail, using a preset weighting function (e.g., the weight of the first-ranked car model is 0.8, the weight of the second-ranked car model is 0.15, the weight of the third-ranked car model and so on is 0.05, and the total weight is 1), for each frame of multiple car models that have been sorted in descending order, according to their ranking in the list (1st, 2nd, etc.), the corresponding weight value is assigned to each car model corresponding to the ranking by calling the weighting function.
[0079] The above method avoids the problem in conventional methods where low-confidence vehicles interfere with the final result due to assigning equal weights to vehicles with different confidence levels within the same frame. It also strengthens the role of vehicles in high-confidence frames by using a weight reduction function. Furthermore, by combining multi-frame information from time-series data sequences, it reduces the impact of single-frame recognition errors and improves the stability and accuracy of vehicle type judgment results.
[0080] Next, a score accumulator with vehicle model as the key is established (initial value is 0 for all models). Then, each frame is traversed, and for each vehicle model, the single-frame score is calculated as confidence level × weight. For example, if the confidence level of vehicle model 001 in a certain frame is 0.92 and the weight is 0.8, then the score for that frame is 0.92 × 0.8 = 0.736. The calculated single-frame score is accumulated into the score accumulator of the corresponding vehicle model. After traversing all frames and all vehicle models, the value in the score accumulator of each vehicle model is the final score value for that vehicle model. For example, if the single-frame scores of vehicle model 001 in the three frames are 0.736, 0.72, and 0.68 respectively, then its final score value is 0.736 + 0.72 + 0.68 = 2.136.
[0081] The above method avoids the random errors caused by relying solely on high-confidence results of a single frame (such as misidentification of a frame due to a sudden change in lighting affecting the final judgment) or the problem of diluting the effective frame weights due to simply averaging the confidence of all frames, which are common in conventional methods. Furthermore, it can highlight the recognition value of high-quality frames through weight allocation, making the final score more reflective of the vehicle's true model characteristics.
[0082] Furthermore, iterate through all vehicle models and their corresponding final scores, compare the scores pairwise, record the vehicle model with the highest current score and its corresponding score. If multiple vehicle models have the same score and are both the highest, retrieve the highest confidence scores of these two vehicle models in each frame, select the vehicle model with the higher highest confidence score as the final result, and convert the vehicle model into its corresponding vehicle name.
[0083] In this embodiment of the invention, by combining the confidence and ranking weight of multi-frame recognition data for comprehensive calculation, errors caused by factors such as lighting and occlusion in single-frame recognition can be effectively avoided, thereby improving the accuracy of vehicle model judgment.
[0084] In the fintech field, it can be applied to bank customer parking lot management, accurately identifying customers' exclusive vehicles through vehicle model results, thus avoiding vehicles occupying parking spaces due to incorrect vehicle model identification.
[0085] In the healthcare field, it can be applied to the identification of special vehicles in hospitals (such as ambulances and medical examination vehicles). Accurate vehicle type results can ensure that special vehicles can pass quickly and receive priority services, thus guaranteeing the timeliness and accuracy of medical services.
[0086] S7. Within a preset time range, perform vehicle model counting on all target vehicles to obtain the number of vehicle models in the monitoring video stream within the time range.
[0087] In this embodiment of the invention, the preset time range refers to the time (e.g., within one day) pre-set for vehicle model counting according to monitoring requirements.
[0088] Furthermore, the system acquires the trajectory data of all vehicles that have left the monitoring area within a preset time range in real time, finds the corresponding vehicle model by associating the trajectory number, increments the counter value of the corresponding vehicle model name by 1, and adds the trajectory number to the deduplication set; if the trajectory number is already in the deduplication set, the data is skipped directly, and each vehicle model name and its corresponding counter value are compiled into a statistical list of vehicle model names and quantities.
[0089] In this embodiment of the invention, the number of vehicles passing through or staying in a monitored area within a specific time period can be quickly and accurately counted, providing data support for traffic flow analysis, regional management optimization, and other purposes.
[0090] In the fintech field, it can be applied to time-based vehicle counting in parking lots around bank branches, such as counting the number of each vehicle type during weekday morning rush hour.
[0091] In the healthcare field, it can be used to count vehicle types in the monitoring area at hospital entrances, and to count the number of various vehicle types such as ambulances, private cars, and taxis during peak hours.
[0092] As can be seen, in the above scheme, by assigning a unique trajectory number to each vehicle and constructing a motion trajectory, the counting subject is transformed from easily repeated detection boxes to vehicle trajectories with spatiotemporal continuity, effectively avoiding duplicate counting and missed detection. Multi-frame vehicle type recognition is performed at the trajectory level and fused based on confidence weighting, which significantly improves the accuracy and robustness of vehicle type recognition. It overcomes the misjudgment caused by factors such as occlusion and lighting in single-frame recognition. By judging the vehicle departure status in real time and generating time-series data sequences, the integrity of the data and real-time processing efficiency are ensured. Finally, statistics are performed based on high-confidence vehicle type results within a preset time range, which improves the accuracy of vehicle type counting.
[0093] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0094] In one embodiment, a vehicle model number counting device is provided, which corresponds one-to-one with the vehicle model number counting method in the above embodiments. As shown in FIG5, the vehicle model number counting device includes a vehicle detection box positioning module 101, a motion trajectory construction module 102, a vehicle model recognition module 103, a vehicle position judgment module 104, a time-series data sequence generation module 105, a vehicle model result judgment module 106, and a vehicle model number counting module 107. The functional modules are described in detail below: Vehicle detection box localization module 101 is used to locate and detect vehicles in each frame of the real-time acquired monitoring video stream, obtaining a vehicle detection box for each vehicle; Motion trajectory construction module 102 is used to assign a trajectory number to the first vehicle appearing in the monitoring video stream, and construct the motion trajectory of each vehicle based on the trajectory number and the vehicle detection box. The motion trajectory refers to a path record formed by sequentially associating the detection box coordinates of vehicles with the same trajectory number in different time frames of the monitoring video stream; Vehicle type recognition module 103 is used to identify multiple vehicle types and the confidence level of each vehicle type in each time frame of the motion trajectory based on the vehicle detection box; Vehicle position determination module 104 is used to determine the vehicle's position based on the target vehicle's motion trajectory. The system determines whether the target vehicle has left the monitoring area corresponding to the monitoring video stream. If the target vehicle has not left the monitoring area, the system returns to the step of locating and detecting the target vehicle in each frame of the real-time acquired monitoring video stream. The time-series data sequence generation module 105 is used to generate a time-series data sequence of the target vehicle based on the vehicle detection box, the trajectory number, the vehicle type, and the vehicle type confidence score if the target vehicle leaves the monitoring area. The vehicle type result judgment module 106 is used to perform vehicle type recognition based on the vehicle type confidence score on the target vehicle according to the time-series data sequence to obtain the vehicle type recognition result of the target vehicle. The vehicle type number statistics module 107 is used to perform vehicle type counting processing on all target vehicles within a preset time range to obtain the number of vehicle types of the vehicles in the monitoring video stream within the time range.
[0095] In one embodiment, the vehicle detection box localization module 101, when performing vehicle localization detection on each frame of the real-time acquired monitoring video stream to obtain the vehicle detection box of each vehicle, is configured to: perform frame sampling on the real-time acquired monitoring video stream to obtain a frame sequence; mark the position of each vehicle in each frame of the frame sequence to obtain the detection box coordinates of each vehicle; and extract the vehicle region image corresponding to each vehicle according to the detection box coordinates, and determine the vehicle region image as the vehicle detection box of each vehicle.
[0096] In one embodiment, the vehicle detection box localization module 101, when performing position marking on each vehicle in each frame of the frame sequence to obtain the detection box coordinates of each vehicle, is configured to: extract a multi-scale feature map of each frame of the frame sequence; set preset anchor boxes on the multi-scale feature map, and select anchor boxes containing vehicles as candidate bounding boxes for each vehicle; adjust the boundary parameters of the candidate bounding boxes to obtain adjusted bounding boxes; evaluate the confidence of the adjusted bounding boxes to obtain a boundary confidence score; select the adjusted bounding box with the highest boundary confidence score, and generate the detection box coordinates of each vehicle based on the coordinates corresponding to the adjusted bounding box.
[0097] In one embodiment, the motion trajectory construction module 102, when constructing the motion trajectory of each vehicle based on the trajectory number and the vehicle detection box, is configured to: perform vehicle matching on the vehicle detection boxes corresponding to each vehicle in adjacent frames within the frame sequence to obtain a vehicle matching relationship; determine the trajectory number of each vehicle in each frame within the frame sequence based on the vehicle matching relationship; and combine the detection box coordinates corresponding to vehicles with the same trajectory number and the frame number within the frame sequence corresponding to the vehicle, according to the time order of the frame sequence, to obtain the motion trajectory of each vehicle.
[0098] In one embodiment, the vehicle model recognition module 103, when performing the recognition of multiple vehicle models corresponding to each vehicle and the vehicle model confidence level corresponding to each vehicle model in each time frame of the motion trajectory, is configured to: extract the coordinates of the detection box of each vehicle frame by frame in the motion trajectory of each vehicle, and select the vehicle detection box according to the detection box coordinates; extract vehicle model features from the vehicle detection box to obtain vehicle model features; and perform feature matching between the vehicle model features and vehicle features in a preset vehicle feature library to obtain the recognition results of multiple vehicle models corresponding to each vehicle and the vehicle model confidence level corresponding to each vehicle model.
[0099] In one embodiment, the vehicle model recognition module 103, when performing vehicle model feature extraction on the vehicle detection frame to obtain vehicle model features, is configured to: identify the key point coordinates of preset vehicle key points in the vehicle detection frame; perform coordinate correction transformation on the key point coordinates to obtain corrected key point coordinates; calculate the geometric features of the vehicle in the vehicle detection frame based on the corrected key point coordinates; extract pixel blocks within a preset threshold range corresponding to the corrected key point coordinates, and extract the texture features of the pixel blocks; and combine the geometric features and the texture features to form the vehicle model features of the vehicle in the vehicle detection frame.
[0100] In one embodiment, the vehicle model result judgment module 106, when performing vehicle model recognition based on the vehicle model confidence level for the target vehicle according to the time-series data sequence to obtain the vehicle model recognition result of the target vehicle, is configured to: assign weights to the various vehicle models of the target vehicle in each frame of the time-series data sequence using a preset weight decrement function; calculate the score value of each vehicle model in the time-series data sequence according to the vehicle model confidence level and the weights; and select the vehicle model with the highest score value as the vehicle model recognition result of the target vehicle.
[0101] This invention provides a vehicle model counting device. By assigning a unique trajectory number to each vehicle and constructing a motion trajectory, the counting subject is transformed from easily repeated detection boxes to vehicle trajectories with spatiotemporal continuity, effectively avoiding duplicate counting and missed detection. Multi-frame vehicle model recognition is performed at the trajectory level and fused based on confidence weighting, significantly improving the accuracy and robustness of vehicle model recognition. It overcomes the misjudgment caused by factors such as occlusion and lighting in single-frame recognition. By judging the vehicle departure status in real time and generating time-series data sequences, the integrity of the data and real-time processing efficiency are ensured. Finally, statistics are performed based on high-confidence vehicle model results within a preset time range, improving the accuracy of vehicle model counting.
[0102] Specific limitations regarding the vehicle model counting device can be found in the above section on the limitations of the vehicle model counting method, and will not be repeated here. Each module in the aforementioned vehicle model counting device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the corresponding operations of each module.
[0103] In one embodiment, a computer device is provided, which can be a server, and its internal structure diagram is shown in Figure 6. The computer device includes a processor, memory, a network interface, and a database connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile and / or volatile storage media and internal memory. The non-volatile storage media stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The network interface of the computer device is used to communicate with external clients via a network connection. When the computer program is executed by the processor, it implements the functions or steps of a vehicle model quantity statistics method on the server side.
[0104] In one embodiment, a computer device is provided, which can be a client, and its internal structure diagram is shown in Figure 7. The computer device includes a processor, memory, network interface, display screen, and input device connected via a system bus. The processor of the computer device provides computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external server via a network connection. When the computer program is executed by the processor, it implements the functions or steps of a vehicle model quantity counting method on the client side.
[0105] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it performs the following steps: locating and detecting vehicles in each frame of a real-time acquired surveillance video stream to obtain a vehicle detection box for each vehicle; assigning a trajectory number to the first vehicle appearing in the surveillance video stream, and constructing a motion trajectory for each vehicle based on the trajectory number and the vehicle detection box, wherein the motion trajectory refers to a path record formed by sequentially associating the coordinates of the detection boxes corresponding to the vehicle detection boxes of vehicles with the same trajectory number in different time frames of the surveillance video stream; and identifying multiple vehicle models and each model type corresponding to each vehicle in each time frame of the motion trajectory based on the vehicle detection box. The corresponding vehicle model confidence score is used; based on the movement trajectory of the target vehicle, it is determined whether the target vehicle has left the monitoring area corresponding to the monitoring video stream. If the target vehicle has not left the monitoring area, the process returns to the step of locating and detecting the target vehicle in each frame of the real-time acquired monitoring video stream; if the target vehicle has left the monitoring area, a time-series data sequence of the target vehicle is generated based on the vehicle detection box of the target vehicle, the trajectory number, the vehicle model, and the vehicle model confidence score; vehicle model recognition is performed on the target vehicle based on the vehicle model confidence score according to the time-series data sequence to obtain the vehicle model recognition result of the target vehicle; within a preset time range, vehicle model counting processing is performed on all target vehicles to obtain the number of vehicle models in the monitoring video stream within the time range.
[0106] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon. When executed by a processor, the computer program performs the following steps: locating and detecting vehicles in each frame of a real-time acquired surveillance video stream to obtain a vehicle detection box for each vehicle; assigning a trajectory number to the first vehicle appearing in the surveillance video stream, and constructing a motion trajectory for each vehicle based on the trajectory number and the vehicle detection box, wherein the motion trajectory refers to a path record formed by sequentially associating the coordinates of the detection boxes corresponding to the vehicle detection boxes of vehicles with the same trajectory number in different time frames of the surveillance video stream; and identifying multiple vehicle models and the vehicle model confidence level for each vehicle model in each time frame of the motion trajectory based on the vehicle detection box. The process involves determining whether the target vehicle has left the monitoring area corresponding to the surveillance video stream based on its movement trajectory. If the target vehicle has not left the monitoring area, the process returns to the step of locating and detecting the target vehicle in each frame of the real-time acquired surveillance video stream. If the target vehicle has left the monitoring area, a time-series data sequence of the target vehicle is generated based on the vehicle detection box, the trajectory number, the vehicle model, and the vehicle model confidence score. The target vehicle is then identified based on the vehicle model confidence score using the time-series data sequence to obtain the vehicle model identification result. Within a preset time range, all target vehicles are counted to obtain the number of vehicle models in the surveillance video stream within that time range.
[0107] It should be noted that the functions or steps that can be implemented by the computer-readable storage medium or computer device described above can be referred to the relevant descriptions on the server side and client side in the foregoing method embodiments. To avoid repetition, they will not be described one by one here.
[0108] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0109] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is used as an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.
[0110] It should be noted that if any software tools or components not belonging to our company appear in the embodiments of this application, they are merely for illustrative purposes and do not represent actual use.
[0111] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included within the protection scope of the present invention.
Claims
1. A method for counting the number of vehicle models, characterized in that, include: Vehicles are located and detected in each frame of the real-time acquired surveillance video stream to obtain the vehicle detection box for each vehicle. A trajectory number is assigned to the first vehicle appearing in the surveillance video stream, and a motion trajectory for each vehicle is constructed based on the trajectory number and the vehicle detection box. The motion trajectory refers to a path record formed by sequentially associating the coordinates of the detection boxes corresponding to the vehicle detection boxes of vehicles with the same trajectory number in different time frames of the surveillance video stream. In each time frame of the motion trajectory, multiple vehicle models and the vehicle model confidence level are identified for each vehicle based on the vehicle detection box. Based on the motion trajectory of the target vehicle, it is determined whether the target vehicle has left the monitoring area corresponding to the surveillance video stream. If the target vehicle has not left the monitoring area, the process returns to the step of locating and detecting the target vehicle in each frame of the real-time acquired surveillance video stream. If the target vehicle has left the monitoring area, a time-series data sequence of the target vehicle is generated based on the vehicle detection box, the trajectory number, the vehicle model, and the vehicle model confidence level. The target vehicle is identified based on the vehicle model confidence level according to the time-series data sequence to obtain the vehicle model identification result; within a preset time range, all target vehicles are counted to obtain the number of vehicle models in the monitoring video stream within the time range.
2. The method for counting the number of vehicle models as described in claim 1, characterized in that, The step of locating and detecting vehicles in each frame of the real-time acquired surveillance video stream to obtain a vehicle detection box for each vehicle includes: sampling frames of the real-time acquired surveillance video stream to obtain a frame sequence; marking the position of each vehicle in each frame of the frame sequence to obtain the detection box coordinates for each vehicle; and cropping a vehicle region image corresponding to each vehicle based on the detection box coordinates, and determining the vehicle region image as the vehicle detection box for each vehicle.
3. The method for counting the number of vehicle models as described in claim 2, characterized in that, The step of marking the location of each vehicle in each frame of the frame sequence to obtain the detection box coordinates of each vehicle includes: extracting a multi-scale feature map of each frame of the frame sequence; setting preset anchor boxes on the multi-scale feature map, and selecting anchor boxes containing vehicles as candidate bounding boxes for each vehicle; adjusting the boundary parameters of the candidate bounding boxes to obtain adjusted bounding boxes; evaluating the confidence of the adjusted bounding boxes to obtain a boundary confidence score; selecting the adjusted bounding box with the highest boundary confidence score, and generating the detection box coordinates of each vehicle based on the coordinates corresponding to the adjusted bounding box.
4. The method for counting the number of vehicle models as described in claim 1, characterized in that, The step of constructing the motion trajectory of each vehicle based on the trajectory number and the vehicle detection box includes: performing vehicle matching on the vehicle detection boxes corresponding to each vehicle in adjacent frames within the frame sequence to obtain a vehicle matching relationship; determining the trajectory number of each vehicle in each frame within the frame sequence based on the vehicle matching relationship; and combining the coordinates of the detection boxes corresponding to vehicles with the same trajectory number and the frame number within the frame sequence corresponding to the vehicle, according to the time order of the frame sequence, to obtain the motion trajectory of each vehicle.
5. The method for counting the number of vehicle models as described in claim 1, characterized in that, The step of identifying multiple vehicle models and the confidence level of each vehicle model based on the vehicle detection box in each time frame of the motion trajectory includes: extracting the detection box coordinates of each vehicle frame by frame in the motion trajectory of each vehicle, and selecting a vehicle detection box based on the detection box coordinates; extracting vehicle model features from the vehicle detection box to obtain vehicle model features; and performing feature matching between the vehicle model features and vehicle features in a preset vehicle feature library to obtain the identification results of multiple vehicle models corresponding to each vehicle and the confidence level of each vehicle model.
6. The method for counting the number of vehicle models as described in claim 5, characterized in that, The step of extracting vehicle model features from the vehicle detection frame to obtain vehicle model features includes: identifying the key point coordinates of preset vehicle key points in the vehicle detection frame; performing coordinate correction transformation on the key point coordinates to obtain corrected key point coordinates; calculating the geometric features of the vehicle in the vehicle detection frame based on the corrected key point coordinates; extracting pixel blocks within a preset threshold range corresponding to the corrected key point coordinates and extracting the texture features of the pixel blocks; and combining the geometric features and the texture features to form the vehicle model features of the vehicle in the vehicle detection frame.
7. The method for counting the number of vehicle models as described in claim 1, characterized in that, The step of performing vehicle model recognition based on the vehicle model confidence level for the target vehicle according to the time-series data sequence to obtain the vehicle model recognition result of the target vehicle includes: assigning weights to multiple vehicle models of the target vehicle in each frame of the time-series data sequence using a preset weight decrement function; calculating the score of each vehicle model in the time-series data sequence according to the vehicle model confidence level and the weights; and selecting the vehicle model with the highest score as the vehicle model recognition result of the target vehicle.
8. A vehicle model quantity counting device, characterized in that, include: The vehicle detection box localization module is used to locate and detect vehicles in each frame of the real-time acquired monitoring video stream, and obtain the vehicle detection box for each vehicle. The motion trajectory construction module is used to assign a trajectory number to the vehicle that appears for the first time in the monitoring video stream, and to construct the motion trajectory of each vehicle based on the trajectory number and the vehicle detection box. The motion trajectory refers to the path record formed by associating the detection box coordinates of the vehicle detection boxes in different time frames of the monitoring video stream with the same trajectory number in chronological order. The vehicle model recognition module is used to identify multiple vehicle models and the vehicle model confidence level corresponding to each model model in each time frame of the motion trajectory based on the vehicle detection box. The vehicle position determination module is used to determine whether the target vehicle has left the monitoring area corresponding to the monitoring video stream based on the movement trajectory of the target vehicle. If the target vehicle has not left the monitoring area, the process returns to the step of locating and detecting the target vehicle in each frame of the real-time acquired monitoring video stream. A time-series data sequence generation module is used to generate a time-series data sequence of the target vehicle based on the vehicle detection frame of the target vehicle, the trajectory number, the vehicle type, and the confidence level of the vehicle type if the target vehicle leaves the monitoring area. The vehicle model result judgment module is used to perform vehicle model recognition on the target vehicle based on the vehicle model confidence level according to the time series data sequence, and obtain the vehicle model recognition result of the target vehicle; The vehicle model count module is used to count the vehicle models of all target vehicles within a preset time range, and obtain the number of vehicle models in the monitoring video stream within the time range.
9. 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, it implements the steps of the method for counting the number of vehicle models as described in any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the steps of the method for counting the number of vehicle models as described in any one of claims 1 to 7.