A vehicle detection method, terminal and computer-readable storage medium
Through the feature extraction and conversion module of the vehicle detection network, the problem of low accuracy of the vehicle detection algorithm in horizontal and rotational direction scenarios is solved, the high accuracy and wide applicability of vehicle detection in intelligent transportation systems is achieved, and the accuracy of parking space status detection is improved.
Patent Information
- Application Number
- CN202210353416.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-06
- Publication Date
- 2025-07-29
- Estimated Expiration
- 2042-04-06
AI Technical Summary
In the prior art, the vehicle detection algorithm has low accuracy in horizontal and rotational scenarios, especially in extreme scenarios, and it is difficult to meet the intelligent demand for parking space detection in intelligent transportation systems.
Vehicle detection network is used to perform vehicle detection. By acquiring images and using feature extraction modules, upsampling modules and detection modules, combined with conversion modules, the direction information and vehicle information of the vehicle are determined, and then the vehicle detection frame is determined, which is suitable for horizontal and non-horizontal directional scenes.
It improves the accuracy of vehicle detection, expands the scope of application, and improves the accuracy of parking space status detection, especially when complex angles and aspect ratios are extremely large.
Smart Images

Figure CN114581891B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and particularly to a vehicle detection method, a terminal, and a computer-readable storage medium. Background Art
[0002] As a key component in a smart city, the intelligent transport system (ITS) makes vehicles an essential part of people's travel and life. The research on vision technology centered around vehicles has received increasing attention from academia and even the industrial community.
[0003] Currently, vehicle postures in intelligent transportation scenarios can be mainly divided into two types: one is the horizontal direction, and the other is the perspective with a rotation angle. Most vehicle detection algorithms detect in the traditional horizontal box manner, and for the scenario with a rotation angle, only the angle prediction is added on the basis of horizontal box detection. Although this method can solve the problem that the horizontal box detection cannot meet the requirements of practical applications to a certain extent, the angle prediction often has great limitations in some extreme scenarios. For example, the aspect ratio is extremely large, or the angle is extremely large or extremely small. Therefore, based on the increasing maturity of current object detection technology, a robust vehicle detection algorithm is particularly important for improving the intelligent level of parking space detection in a parking lot. Summary of the Invention
[0004] The main technical problem to be solved by the present invention is to provide a vehicle detection method, a terminal, and a computer-readable storage medium, so as to solve the problem of low vehicle detection accuracy in the prior art for scenarios in the horizontal direction and the rotation direction.
[0005] To solve the above technical problem, the first technical solution adopted by the present invention is: to provide a vehicle detection method, the vehicle detection method including: obtaining an image to be detected, the image to be detected including a vehicle; performing vehicle detection on the image to be detected to obtain vehicle direction information of the vehicle and at least one piece of vehicle information of the vehicle; in response to the vehicle direction information being target direction information among N preset direction information, determining a vehicle detection frame of the vehicle in the image to be detected based on the target direction information and target vehicle information associated with the target direction information among the at least one piece of vehicle information, where N is an integer greater than 1.
[0006] Wherein, the target direction information includes the horizontal direction, and the target vehicle information associated with the horizontal direction includes vehicle size information of the vehicle.
[0007] Wherein, the target direction information includes a non-horizontal direction, and the target vehicle information associated with the non-horizontal direction includes vehicle boundary vector information of the vehicle.
[0008] Among them, at least one vehicle information further includes the vehicle center point of the vehicle; determining the vehicle detection frame of the vehicle in the image to be detected based on the target direction information and the target vehicle information associated with the target direction information in at least one vehicle information includes: determining the first mask value corresponding to the vehicle based on the horizontal direction of the vehicle; determining the four corner point coordinates of the vehicle according to the first mask value of the vehicle, the vehicle center point of the vehicle, and the vehicle size information of the vehicle; determining the vehicle detection frame of the vehicle in the image to be detected according to the four corner point coordinates of the vehicle.
[0009] Among them, at least one vehicle information further includes the vehicle center point of the vehicle; determining the vehicle detection frame of the vehicle in the image to be detected based on the target direction information and the target vehicle information associated with the target direction information in at least one vehicle information includes: determining the second mask value corresponding to the vehicle based on the non-horizontal direction of the vehicle; determining the four corner point coordinates of the vehicle according to the second mask value of the vehicle, the vehicle center point of the vehicle, and the vehicle boundary vector information of the vehicle; determining the vehicle detection frame of the vehicle in the image to be detected according to the four corner point coordinates of the vehicle.
[0010] Among them, performing vehicle detection on the image to be detected to obtain the vehicle direction information of the vehicle and at least one vehicle information of the vehicle includes: using the trained vehicle detection network to perform vehicle detection on the image to be detected to obtain the vehicle direction information of the vehicle and at least one vehicle information of the vehicle; wherein, the vehicle detection network is trained using the sample images labeled with the vehicle direction information of the training vehicles and at least one vehicle information of the training vehicles.
[0011] Among them, the vehicle detection network includes a feature extraction module, an upsampling module, and a detection module cascaded in sequence; wherein, the feature extraction module includes n feature extraction layers cascaded in sequence, and n is an integer greater than 1; performing vehicle detection on the image to be detected to obtain the vehicle direction information of the vehicle and at least one vehicle information of the vehicle includes: using the n feature extraction layers included in the feature extraction module to perform feature extraction on the image to be detected respectively to obtain the sub-image features corresponding to each feature extraction layer in the n feature extraction layers; using the upsampling module to perform feature fusion on the sub-image features corresponding to each feature extraction layer to obtain a preprocessed feature map; using the detection module to perform detection on the preprocessed feature map to obtain the vehicle direction information of the vehicle and at least one vehicle information of the vehicle.
[0012] Among them, the n feature extraction layers included in the feature extraction module are used to perform feature extraction on the image to be detected respectively, and sub-image features corresponding to each feature extraction layer in the n feature extraction layers are obtained, including: using the first feature extraction layer in the n feature extraction layers to perform feature extraction on the image to be detected to obtain sub-image features corresponding to the first feature extraction layer; and using the (i + 1)-th feature extraction layer to perform feature extraction on the sub-image features corresponding to the i-th feature extraction layer to obtain sub-image features corresponding to the (i + 1)-th feature extraction layer, where i is an integer greater than 0 and less than n - 1.
[0013] Among them, when at least one vehicle information further includes the vehicle center point of the vehicle; the vehicle detection network further includes a conversion module connected to the upsampling module; performing vehicle detection on the image to be detected to obtain the vehicle direction information of the vehicle and at least one vehicle information of the vehicle further includes: using the conversion module to perform vehicle center point detection on the preprocessed feature map and performing data conversion on the detection result of the vehicle center point to obtain the vehicle center point coordinates of the vehicle.
[0014] Among them, the image to be detected is collected for a target scene, and further includes: determining a candidate parking space area based on the parking space information in the image to be detected; in response to the vehicle direction information being the target direction information among N preset direction information, determining the vehicle detection frame of the vehicle in the image to be detected based on the target vehicle information associated with the target direction information in at least one vehicle information, and then further includes: determining whether the vehicle is parked in the candidate parking space area based on the candidate parking space area and the vehicle detection frame.
[0015] Among them, the candidate parking space area includes the target parking space corresponding to the position of the vehicle in the image to be detected; determining whether the vehicle is parked in the candidate parking space area based on the candidate parking space area and the vehicle detection frame includes: determining the vehicle area of the vehicle based on the vehicle detection frame; determining the occupancy ratio corresponding to the target parking space based on the ratio of the vehicle area to the parking space area of the target parking space; in response to the occupancy ratio exceeding the occupancy ratio threshold, determining that the vehicle is parked in the target parking space.
[0016] Among them, the vehicle direction information includes a horizontal direction and a non-horizontal direction; when the first training vehicle is included in the sample image, the vehicle direction information labeled for the first training vehicle in the sample image is the horizontal direction; at least one vehicle information labeled for the first training vehicle in the sample image includes the vehicle size information of the first training vehicle; the first training vehicle is a vehicle whose vehicle direction in the sample image is parallel to the coordinate axis of the sample image; when the second training vehicle is included in the sample image, the vehicle direction information labeled for the second training vehicle in the sample image is the non-horizontal direction; at least one vehicle information labeled for the second training vehicle in the sample image includes the vehicle boundary vector information of the second training vehicle; the second training vehicle is a vehicle whose vehicle direction in the sample image is non-parallel to the coordinate axis of the sample image.
[0017] Among them, the vehicle detection network is trained in the following manner: obtaining a training sample set; using the vehicle detection network during training to perform vehicle detection on sample images to obtain prediction information for training vehicles; the prediction information includes vehicle direction information and at least one vehicle information obtained by predicting the training vehicles; using a loss function, based on the deviation information between the annotation information and the prediction information for the training vehicles, determining a prediction loss value; the annotation information includes the vehicle direction information annotated for the training vehicles and at least one vehicle information annotated for the training vehicles; using the prediction loss value to perform iterative training on the vehicle detection network.
[0018] Among them, the annotation information further includes the vehicle center point information annotated for the training vehicles; using a loss function, based on the deviation information between the annotation information and the prediction information for the training vehicles, determining a prediction loss value includes: calculating the prediction loss value based on the sum of the vehicle center point information loss value, the vehicle direction information loss value, and the vehicle boundary vector information loss value or the vehicle size information loss value of the same training vehicle.
[0019] To solve the above technical problems, the second technical solution adopted by the present invention is: providing a terminal, the terminal includes a memory, a processor, and a computer program stored in the memory and running on the processor, and the processor is used to execute program data to implement the steps in the vehicle detection method as described above.
[0020] To solve the above technical problems, the third technical solution adopted by the present invention is: providing a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it implements the steps in the vehicle detection method as described above.
[0021] The beneficial effects of the present invention are as follows: Different from the prior art, a vehicle detection method, a terminal, and a computer-readable storage medium are provided. The vehicle detection method includes: obtaining an image to be detected, where the image to be detected includes a vehicle; performing vehicle detection on the image to be detected to obtain the vehicle direction information of the vehicle and at least one vehicle information of the vehicle; in response to the vehicle direction information being the target direction information among N preset direction information, determining the vehicle detection frame of the vehicle in the image to be detected based on the target direction information and the target vehicle information associated with the target direction information among the at least one vehicle information, where N is an integer greater than 1. In this application, vehicle detection is performed on the image to be detected, the target vehicle information associated with the vehicle direction information is determined based on the detected vehicle direction information, and then the vehicle detection frame of the vehicle is determined based on the target direction information and the target vehicle information associated with the target direction information. The vehicle detection method can be applied to vehicle detection in horizontal and non-horizontal scenarios, has a wide range of applications, and a high accuracy rate of vehicle detection results, thereby improving the accuracy rate of subsequent parking space status detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the following drawings are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.
[0023] Figure 1 is a schematic flowchart of the vehicle detection method provided by the present invention;
[0024] Figure 2 is a schematic flowchart of a specific embodiment of the vehicle detection method provided by the present invention;
[0025] Figure 3 is Figure 2 a schematic flowchart of a specific embodiment of step S21 in the vehicle detection network training method provided;
[0026] Figure 4 is a relationship diagram between the target boundary vector of the bounding box and the center coordinate point;
[0027] Figure 5 is a schematic flowchart of a specific embodiment of the vehicle detection method provided by the present invention in a parking lot scenario;
[0028] Figure 6 is a schematic structural diagram of a specific embodiment of the vehicle detection network;
[0029] Figure 7 is a schematic diagram of the vehicle detection frame and the parking space area in the image to be detected provided by the present invention;
[0030] Figure 8 It is a schematic block diagram of an embodiment of a terminal provided by the present invention;
[0031] Figure 9 It is a schematic block diagram of an embodiment of a computer-readable storage medium provided by the present invention. Specific embodiments
[0032] Next, in conjunction with the accompanying drawings of the specification, the solutions of the embodiments of the present application will be described in detail.
[0033] In the following description, for the purpose of illustration rather than limitation, specific details such as specific system architectures, interfaces, and technologies are presented in order to thoroughly understand the present application.
[0034] The term "and / or" in this article is merely a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B may represent: A exists alone, A and B exist simultaneously, and B exists alone. In addition, the character " / " in this article generally represents an "or" relationship between the associated objects before and after. In addition, "multiple" in this article means two or more than two.
[0035] To enable those skilled in the art to better understand the technical solutions of the present invention, the vehicle detection network training method and the parking space status detection method provided by the present invention will be further described in detail below in conjunction with the drawings and specific embodiments.
[0036] Please refer to Figure 1 , Figure 1 It is a schematic flowchart of the vehicle detection method provided by the present invention. In this embodiment, a vehicle detection method is provided, and the vehicle detection method is applicable to the detection of target vehicles at different direction angles. Among them, the vehicle detection method specifically includes the following steps.
[0037] S11: Obtain an image to be detected, where the image to be detected includes a vehicle.
[0038] Specifically, the image acquisition device for obtaining the image to be detected is installed at a preset position. Among them, the image acquisition device can be installed in a parking lot and is installed parallel to the parking space lines of the parking lot. It can also be installed according to actual requirements.
[0039] S12: Perform vehicle detection on the image to be detected to obtain the vehicle direction information of the vehicle and at least one vehicle information of the vehicle.
[0040] Specifically, the trained vehicle detection network is used to perform vehicle detection on the image to be detected, obtaining the vehicle direction information of the vehicle and at least one vehicle information of the vehicle; wherein, the vehicle detection network is trained using sample images labeled with the vehicle direction information of the training vehicles and at least one vehicle information of the training vehicles. The vehicle direction includes a horizontal direction and a non-horizontal direction. In this embodiment, the horizontal direction refers to the direction in which the vehicle direction is parallel to the coordinate axes of the sample image. The non-horizontal direction refers to the inclined direction in which the vehicle direction is non-parallel to the coordinate axes of the sample image. For example, the angle between the vehicle direction and the coordinate axes of the sample image is greater than 0° and less than 90°.
[0041] In one embodiment, the vehicle detection network includes a feature extraction module, an upsampling module, and a detection module cascaded in sequence; wherein, the feature extraction module includes n feature extraction layers cascaded in sequence, and n is an integer greater than 1.
[0042] Using the n feature extraction layers included in the feature extraction module, feature extraction is respectively performed on the image to be detected, obtaining the sub-image features corresponding to each feature extraction layer in the n feature extraction layers; using the upsampling module to perform feature fusion on the sub-image features corresponding to each feature extraction layer to obtain a preprocessed feature map; using the detection module to perform detection on the preprocessed feature map, obtaining the vehicle direction information of the vehicle and at least one vehicle information of the vehicle. Among them, using the first feature extraction layer in the n feature extraction layers to perform feature extraction on the image to be detected, obtaining the sub-image features corresponding to the first feature extraction layer; and using the (i + 1)-th feature extraction layer to perform feature extraction on the sub-image features corresponding to the i-th feature extraction layer, obtaining the sub-image features corresponding to the (i + 1)-th feature extraction layer, where i is an integer greater than 0 and less than n - 1.
[0043] Furthermore, when at least one vehicle information further includes the vehicle center point of the vehicle; the vehicle detection network further includes a conversion module connected to the upsampling module. Using the conversion module to perform vehicle center point detection on the preprocessed feature map, and performing data conversion on the detection result of the vehicle center point, obtaining the vehicle center point coordinates of the vehicle.
[0044] S13: In response to the vehicle direction information being the target direction information among N preset direction information, based on the target direction information and the target vehicle information associated with the target direction information in at least one vehicle information, determining the vehicle detection frame of the vehicle in the image to be detected, where N is an integer greater than 1.
[0045] Specifically, the target direction information includes the horizontal direction, and the target vehicle information associated with the horizontal direction includes the vehicle size information of the vehicle. The target direction information includes the non-horizontal direction, and the target vehicle information associated with the non-horizontal direction includes the vehicle boundary vector information of the vehicle.
[0046] At least one vehicle information further includes the vehicle center point of the vehicle.
[0047] Based on the horizontal direction of the vehicle, determine the first mask value corresponding to the vehicle; according to the first mask value of the vehicle, the vehicle center point of the vehicle, and the vehicle size information of the vehicle, determine the four corner point coordinates of the vehicle; according to the four corner point coordinates of the vehicle, determine the vehicle detection frame of the vehicle in the image to be detected.
[0048] Based on the non - horizontal direction of the vehicle, determine the second mask value corresponding to the vehicle; according to the second mask value of the vehicle, the vehicle center point of the vehicle, and the vehicle boundary vector information of the vehicle, determine the four corner point coordinates of the vehicle; according to the four corner point coordinates of the vehicle, determine the vehicle detection frame of the vehicle in the image to be detected.
[0049] In a specific embodiment, due to the diversity of vehicle postures, if four coordinate points of the vehicle are predicted by the initial vehicle detection network, the detection accuracy is relatively low. Therefore, determining the vehicle detection frame of the vehicle in the image to be detected based on the target direction information and the target vehicle information associated with the target direction information in at least one vehicle information can improve the vehicle detection accuracy.
[0050] In another embodiment, based on the parking space information in the image to be detected, determine the candidate parking space area; based on the candidate parking space area and the vehicle detection frame, determine whether the vehicle is parked in the candidate parking space area.
[0051] In a specific embodiment, determine the vehicle area of the vehicle based on the vehicle detection frame; based on the ratio of the vehicle area to the parking space area of the target parking space, determine the occupancy ratio corresponding to the target parking space; in response to the occupancy ratio exceeding the occupancy ratio threshold, determine that the vehicle is parked in the target parking space.
[0052] The vehicle detection method provided in this embodiment includes obtaining an image to be detected, where the image to be detected includes a vehicle; performing vehicle detection on the image to be detected to obtain the vehicle direction information of the vehicle and at least one vehicle information of the vehicle; in response to the vehicle direction information being the target direction information among N preset direction information, based on the target direction information and the target vehicle information associated with the target direction information in at least one vehicle information, determine the vehicle detection frame of the vehicle in the image to be detected, where N is an integer greater than 1. In this application, by performing vehicle detection on the image to be detected, based on the detected vehicle direction information, determine the target vehicle information associated with the vehicle direction information, and then based on the target direction information and the target vehicle information associated with the target direction information, determine the vehicle detection frame of the vehicle. The vehicle detection method can be applicable to vehicle detection in horizontal direction scenarios and non - horizontal direction scenarios, with a wide application range and high vehicle detection result accuracy, and thus can improve the detection accuracy of the subsequent parking space state.
[0053] Please refer to Figure 2 ,Figure 2 It is a schematic flowchart of a specific embodiment of the vehicle detection method provided by the present invention. In this embodiment, a vehicle detection method is provided, and the vehicle detection method is applicable to the detection of target vehicles in different directions. Specifically, the vehicle detection method includes the following steps.
[0054] S21: Train a vehicle detection network.
[0055] Please refer to Figure 3 , Figure 3 is Figure 2 a schematic flowchart of a specific embodiment of step S21 in the vehicle detection network training method provided by
[0056] Specifically, the specific steps of training the initial detection network to obtain the vehicle detection network are as follows.
[0057] S211: Obtain a training sample set.
[0058] Specifically, the training sample set includes multiple sample images containing the first training vehicle and / or the second training vehicle. When the sample image contains the first training vehicle, the vehicle direction information marked for the first training vehicle in the sample image is the horizontal direction; at least one vehicle information marked for the first training vehicle in the sample image includes the vehicle size information of the first training vehicle; the first training vehicle is a vehicle whose vehicle direction in the sample image is parallel to the coordinate axis of the sample image; when the sample image contains the second training vehicle, the vehicle direction information marked for the second training vehicle in the sample image is the non-horizontal direction; at least one vehicle information marked for the second training vehicle in the sample image includes the vehicle boundary vector information of the second training vehicle; the second training vehicle is a vehicle whose vehicle direction in the sample image is non-parallel to the coordinate axis of the sample image.
[0059] In this embodiment, the sample image is an image containing a vehicle, and the preset direction information of the vehicle in the image includes the horizontal direction or the non-horizontal direction. That is, the value of N is 2.
[0060] Please refer to Figure 4 , Figure 4 is a relationship diagram between the target boundary vector and the center coordinate point of the bounding box.
[0061] Specifically, when labeling the first training vehicle and / or the second training vehicle in the sample image, the four corner coordinates (x1, y1), (x2, y2), (x3, y3), and (x4, y4) of the vehicle true box of the first training vehicle and / or the second training vehicle can be labeled. Then, according to the coordinates of the four corners of the vehicle true box, calculate the vehicle center point C (C x , C y ), that is, the vehicle center point information labeled for the first training vehicle and / or the second training vehicle is (Cx , C y ). After that, the labeled vehicle boundary vector information is calculated based on the coordinates of the four corner points of the vehicle's true box and the vehicle center point C 、 、 and . Among them, = (x1 - C x , y1 - C y ); = (x2 - C x , y2 - C y ); = (x3 - C x , y3 - C y ); = (x4 - C x , y4 - C y ). The labeled vehicle size information can be calculated based on the coordinates of the four corner points of the vehicle's true box. In this embodiment, the vehicle size information is the vehicle width and height information.
[0062] In one embodiment, to facilitate subsequent prediction of vehicles in the sample images, the sample images are uniformly adjusted to a preset resolution. Among them, the preset resolution can be 1024 * 1024. The specific preset resolution can be set according to the actual situation. In a specific embodiment, the sample images are uniformly scaled to a resolution of 1024 * 1024.
[0063] In another embodiment, multiple sample images are directly obtained, and the sizes of the sample images are all 1024 * 1024. It can also be set to other preset resolutions.
[0064] S212: Perform vehicle detection on the sample images through the initial vehicle detection network to obtain the prediction information of the vehicles.
[0065] Specifically, the initial vehicle detection network can be an Object Boundary Aware Network (OBAN). Among them, the Object Boundary Aware Network is generally a U-shaped structure. In a specific embodiment, the initial vehicle detection network is an end-to-end differentiable OBAN network structure.
[0066] Vehicle detection is performed on a sample image containing a first training vehicle through an initial vehicle detection network to obtain prediction information of the first training vehicle. The prediction information of the first training vehicle includes predicted vehicle center point information, predicted vehicle direction information, and predicted vehicle size information. Vehicle detection is performed on a sample image containing a second training vehicle through the initial vehicle detection network to obtain prediction information of the second training vehicle. The prediction information of the second training vehicle includes predicted vehicle center point information, predicted vehicle direction information, and predicted vehicle boundary vector information.
[0067] Specifically, the initial vehicle detection network includes an initial feature extraction module, an initial upsampling module, an initial detection module, and an initial conversion module. Among them, the initial feature extraction module, the initial upsampling module, and the initial detection module are cascaded in sequence, and the initial conversion module is connected to the initial upsampling layer.
[0068] The initial feature extraction module is used to extract features from the sample image to obtain a target feature map; the initial upsampling module is used to perform feature fusion on the target feature map to obtain a corresponding feature map; the initial detection module is used to predict the predicted vehicle direction information and the predicted vehicle boundary vector information or the predicted vehicle size information of the first training vehicle and / or the second training vehicle based on the corresponding feature map. The initial conversion module is used to predict the predicted vehicle center point information of the first training vehicle and / or the second training vehicle based on the corresponding feature map. Specifically, the predicted vehicle center point information is the vehicle center point coordinates.
[0069] S213: Using a loss function, based on the deviation information between the annotation information and the prediction information for the training vehicle, determine the prediction loss value.
[0070] In a specific embodiment, the annotation information includes the vehicle direction information annotated for the training vehicle and at least one vehicle information annotated for the training vehicle.
[0071] Based on the sum of the vehicle center point information loss value, the vehicle direction information loss value, and the vehicle boundary vector information loss value or the vehicle size information loss value of the same training vehicle, calculate the prediction loss value.
[0072] Specifically, using the loss function, a prediction loss value is determined based on the deviation information between the annotation information and the prediction information for the first training vehicle. Among them, the annotation information of the first training vehicle includes the vehicle direction information annotated by the first training vehicle, the annotated vehicle center point information, and the annotated vehicle width and height information. The prediction information of the first training vehicle includes the predicted vehicle direction information of the first training vehicle, the predicted vehicle center point information, and the predicted vehicle width and height information. Based on the sum of the vehicle center point information loss value, the vehicle direction information loss value, and the vehicle width and height information loss value of the same first training vehicle, the prediction loss value of the first training vehicle is calculated. The loss function corresponding to the first training vehicle is shown in Formula 1 below.
[0073] (Formula 1)
[0074] In Formula 1: L1 is the prediction loss value of the first training vehicle; L cp is the vehicle center point information loss value; L bv is the boundary vector loss value; L o is the vehicle direction information loss value; L wh is the vehicle width and height information loss value.
[0075] Specifically, using the loss function, a prediction loss value is determined based on the deviation information between the annotation information and the prediction information for the second training vehicle. Among them, the annotation information of the second training vehicle includes the vehicle direction information annotated by the second training vehicle, the annotated vehicle center point information, and the annotated vehicle boundary vector information. The prediction information of the second training vehicle includes the predicted vehicle direction information of the second training vehicle, the predicted vehicle center point information, and the predicted vehicle boundary vector information. Based on the sum of the vehicle center point information loss value, the vehicle direction information loss value, and the vehicle boundary vector information loss value of the same second training vehicle, the prediction loss value of the second training vehicle is calculated. The loss function corresponding to the second training vehicle is shown in Formula 2 below.
[0076] (Formula 2)
[0077] In Formula 2: L2 is the prediction loss value of the second training vehicle; L cp is the vehicle center point information loss value; L bv is the vehicle boundary vector information loss value; L o is the vehicle direction information loss value.
[0078] In a specific embodiment, based on the center point loss function, the vehicle center point information loss value between the vehicle center point information annotated for the same training vehicle and the predicted vehicle center point information is calculated. Specifically, the vehicle center point information loss value L cp is calculated based on Formula 3.
[0079] (Formula 3)
[0080] In Formula 3: is the predicted vehicle center point coordinate; is the labeled vehicle center point coordinate.
[0081] In a specific embodiment, based on the boundary vector loss function, the vehicle boundary vector information loss value between the labeled vehicle boundary vector information and the predicted vehicle boundary vector information of the same training vehicle is calculated. Specifically, the vehicle boundary vector information loss value L is calculated based on Formula 4 bv .
[0082] (Formula 4)
[0083] In Formula 4: is the predicted vehicle boundary vector; is the labeled vehicle boundary vector.
[0084] In a specific embodiment, based on the direction loss function, the vehicle direction information loss value between the labeled vehicle direction information and the predicted vehicle direction information of the same training vehicle is calculated. Specifically, the vehicle direction information loss value L is calculated based on Formula 5 o .
[0085] (Formula 5)
[0086] In Formula 5: is the predicted direction threshold.
[0087] In a specific embodiment, based on the width-height loss function, the vehicle width-height information loss value between the labeled vehicle width-height information and the predicted vehicle width-height information of the same training vehicle is calculated. Specifically, the vehicle width-height information loss value L is calculated based on Formula 6 wh .
[0088] (Formula 6)
[0089] In Formula 6: is the predicted vehicle width-height information; is the labeled vehicle width-height information.
[0090] S214: Use the predicted loss value to iteratively train the initial vehicle detection network to obtain the vehicle detection network.
[0091] Specifically, the initial vehicle detection network is iteratively trained based on the deviation information including the vehicle center point information, predicted vehicle center point information, labeled vehicle direction information, predicted vehicle direction information, labeled vehicle size information, and predicted vehicle size information in the sample images of the first training vehicle, as well as the deviation information including the vehicle center point information, predicted vehicle center point information, labeled vehicle direction information, predicted vehicle direction information, labeled vehicle boundary vector information, and predicted vehicle boundary vector information in the sample images of the second training vehicle.
[0092] In an alternative embodiment, the result of the initial vehicle detection network is backpropagated, and the weights of the initial vehicle detection network are corrected according to the predicted loss value fed back by the loss function. In an alternative embodiment, the parameters of the initial vehicle detection network can also be corrected to achieve the training of the initial vehicle detection network.
[0093] The image containing the vehicle is input into the initial vehicle detection network, and the initial vehicle detection network predicts the vehicle center point information, vehicle direction information, and vehicle boundary vector information or vehicle size information in the image. When the predicted loss values of the labeled vehicle center point information and the predicted vehicle center point information, labeled vehicle direction information and predicted vehicle direction information, labeled vehicle size information and predicted vehicle size information in the sample image of the first training vehicle are less than a preset threshold, which can be set by oneself, such as 1%, 5%, etc., the training of the vehicle detection network can be stopped. When the predicted loss values of the labeled vehicle center point information and the predicted vehicle center point information, labeled vehicle direction information and predicted vehicle direction information, labeled vehicle boundary vector information and predicted vehicle boundary vector information in the sample image of the second training vehicle are less than a preset threshold, which can be set by oneself, such as 1%, 5%, etc., the training of the vehicle detection network can be stopped.
[0094] The vehicle detection network obtained through training can detect both horizontal vehicles and non-horizontal vehicles, thereby achieving accurate detection of vehicles and improving the robustness of the vehicle detection network.
[0095] Please refer to Figure 5 , Figure 5 which is a schematic flowchart of a specific embodiment of the vehicle detection method provided by the present invention in a parking lot scenario.
[0096] S22: Obtain the image to be detected.
[0097] Specifically, the image acquisition device for obtaining the image to be detected is installed at a preset position. Among them, the image acquisition device can be installed in a parking lot, and the image acquisition device is installed parallel to the parking space lines of the parking lot. It can also be installed according to actual requirements. The image of the parking lot is collected by the image acquisition device as the image to be detected. Among them, the target classifications of the image to be detected include vehicles and the background.
[0098] S23: Use a vehicle detection network to detect vehicles in the image to be detected; obtain the vehicle direction information of the vehicle and at least one vehicle information of the vehicle.
[0099] Specifically, the vehicle detection network detects the vehicles in the image to be detected. Please refer to Figure 6 , Figure 6 is a schematic structural diagram of a specific embodiment of the vehicle detection network. The vehicle detection network includes a feature extraction module, an upsampling module, and a detection module cascaded in sequence. Among them, the feature extraction module includes n feature extraction layers cascaded in sequence, where n is a positive integer and greater than 1. In one embodiment, the network structures and parameters of the n cascaded feature extraction layers are the same. In another specific embodiment, the network structures and parameters of the n cascaded feature extraction layers can be set according to actual situations. The feature extraction module adopts the ResNet50 network structure, or other feature extraction network structures can also be adopted. Among them, the number of feature extraction layers can be 1 to 5 layers.
[0100] The (i + 1)-th feature extraction layer performs feature extraction on the feature map obtained by the i-th feature extraction layer; where i is an integer, and 0 ≤ i < n;
[0101] Using the n feature extraction layers included in the feature extraction module, perform feature extraction on the image to be detected respectively, and obtain the sub-image features corresponding to each feature extraction layer in the n feature extraction layers. Specifically, use the first feature extraction layer in the n feature extraction layers to perform feature extraction on the image to be detected, and obtain the sub-image feature corresponding to the first feature extraction layer; and use the (i + 1)-th feature extraction layer to perform feature extraction on the sub-image feature corresponding to the i-th feature extraction layer, and obtain the sub-image feature corresponding to the (i + 1)-th feature extraction layer, where i is an integer greater than 0 and less than n - 1.
[0102] Use the upsampling module to perform feature fusion on the sub-image features corresponding to each feature extraction layer to obtain a preprocessed feature map. The upsampling module can include multiple upsampling layers, and the multiple upsampling layers are cascaded in sequence. Among them, the number of feature extraction layers and the number of upsampling layers can be equal or inconsistent.
[0103] Among them, when there is one upsampling layer, the upsampling module performs feature fusion on the feature maps output by the i feature extraction layers, and performs size amplification processing to obtain a preprocessed feature map.
[0104] In another embodiment, when there are multiple upsampling layers, the upsampling layers perform feature fusion on the sub-image features output by the feature extraction layer and the preprocessed feature map output by the previous upsampling layer, and perform size enlargement processing on the fused preprocessed feature map; specifically, the preprocessed feature map is obtained by size enlargement, and the size of the preprocessed feature map is 1 / 4 of the size of the input image to be detected.
[0105] The upsampling module adopts the method of bilinear interpolation to make the upsampling layer in the upsampling module and the feature extraction layer in the feature extraction module be cross-connected, so as to realize feature fusion, so that the vehicle detection network can more fully learn the local information and overall information of the key points of the vehicle.
[0106] The detection module is used to detect the preprocessed feature map to obtain the vehicle direction information of the vehicle and at least one vehicle information of the vehicle. Specifically, when the vehicle direction information is the horizontal direction, at least one vehicle information of the vehicle includes vehicle size information. In this embodiment, the vehicle size information includes vehicle width and height information. When the vehicle direction information is a non-horizontal direction, at least one vehicle information of the vehicle includes vehicle boundary vector information.
[0107] The vehicle detection network further includes a conversion module, and the conversion module is connected to the upsampling module; the conversion module detects the vehicle center point of the preprocessed feature map and performs data conversion on the detection result of the vehicle center point to obtain the vehicle center point coordinates of the vehicle.
[0108] The conversion module extracts features from the preprocessed feature map to obtain a vehicle feature map, and the conversion module performs data transformation according to the vehicle feature map and the heatmap corresponding to the preprocessed feature map, and then obtains the vehicle center point coordinates. In a specific embodiment, the conversion module can be a differentiable spatial to numerical transform (DSNT) module. The DCNT module generates vehicle center point coordinates based on the vehicle feature map and the heatmap of the preprocessed feature map using the soft-argmax function.
[0109] In this embodiment, the combination of the vehicle center point coordinates converted based on the DSNT module and the vehicle boundary vector information obtained by the detection module alleviates the problem of inaccurate direction prediction in vehicle detection in any direction.
[0110] In a specific embodiment, the vehicle detection network is used to detect a vehicle in the acquired image to be detected to obtain vehicle direction information. Among them, the vehicle detection network trained in the above embodiment is used to detect the image to be detected to obtain vehicle center point coordinates and vehicle direction thresholds. and vehicle boundary vector information or vehicle width and height information. The center point coordinates of the vehicle are (xc, yc), and the vehicle boundary vector information is , , and , and the vehicle direction threshold is . The vehicle width and height information includes the vehicle width and the vehicle height .
[0111] Compare the detected vehicle direction threshold with a preset value to further determine whether the vehicle direction information is in the horizontal direction or the non - horizontal direction. Among them, the preset value can be set to 0.8.
[0112] In one embodiment, when the detected vehicle direction threshold is less than 0.8, the vehicle is determined to be marked with a first identifier, and it is determined that the vehicle direction information in the image to be detected is in the horizontal direction. When the vehicle is in the horizontal direction, the vehicle corresponds to a first mask value, and the first mask value (mask) is set to 0.
[0113] In one embodiment, when the detected vehicle direction threshold is greater than 0.8, the vehicle is determined to be marked with a second identifier, and it is determined that the vehicle direction information in the image to be detected is in the non - horizontal direction. When the vehicle is in the non - horizontal direction, the vehicle corresponds to a second mask value, and the second mask value (mask) is set to 1.
[0114] In a specific embodiment, the coordinate points of the vehicle detection frame are obtained according to the vehicle direction threshold, the center point coordinates of the vehicle, and the vehicle boundary vector information or vehicle width and height information of the same vehicle detected from the image to be detected. Among them, the coordinate points of the vehicle detection frame are shown in Formula 7.
[0115] (Formula 7)
[0116] S24: Determine whether the vehicle direction information is in the horizontal direction.
[0117] Specifically, by determining whether the vehicle direction information of the vehicle in the image to be detected is in the horizontal direction, it is further determined whether the vehicle size information or the vehicle boundary vector information associated with the target direction information in the target vehicle information output by the vehicle detection network.
[0118] If the vehicle direction information is in the horizontal direction, directly jump to step S25; if the vehicle direction information is in the non - horizontal direction, directly jump to step S26.
[0119] S25: Based on the target direction information of the vehicle and the vehicle size information of the vehicle, determine the vehicle detection frame of the vehicle in the image to be detected.
[0120] Specifically, the target direction information includes the horizontal direction, and the target vehicle information associated with the horizontal direction includes the vehicle size information of the vehicle.
[0121] When the detected vehicle direction information is the horizontal direction, the mask is 0, and the regression method is changed to the regression in the horizontal direction, such as tl_x = xc. . According to Equation 7, the coordinates of the four corner points of the vehicle can be obtained (xc, ), ( , yc), (xc, ), and ( , yc), and then the vehicle detection frame can be determined according to the coordinates of the four corner points.
[0122] In response to the vehicle being marked with the first identifier, the vehicle detection network detects and outputs the vehicle direction information, the vehicle center point information, and the vehicle width and height information; based on the vehicle direction information, the vehicle center point information, and the vehicle width and height information, the coordinates of the four corner points of the vehicle can be determined, and according to the coordinates of the four corner points of the vehicle, the vehicle detection frame of the vehicle in the image to be detected is determined.
[0123] S26: Determine the vehicle detection frame of the vehicle in the image to be detected based on the target direction information of the vehicle and the vehicle boundary vector information of the vehicle.
[0124] Specifically, the target direction information includes the non-horizontal direction, and the target vehicle information associated with the horizontal direction includes the vehicle boundary vector information of the vehicle.
[0125] When the detected vehicle direction information is the non-horizontal direction, the mask is 1, and the regression method is changed to the regression in the non-horizontal direction, that is, the regression of the rotated box, tl_x = xc + (x), tl_y = yc + (y). According to Equation 7, the coordinates of the four corner points of the vehicle can be obtained (xc + (x), yc + (y)), (xc + (x), yc + (y)), (xc + (x), yc + (y)), and (xc + (x), yc + (y)), and then the vehicle detection frame can be determined according to the coordinates of the four corner points.
[0126] In response to the vehicle being marked with a second identifier, the vehicle detection network detects and outputs vehicle direction information, vehicle center point information, and vehicle corner vector information; based on the vehicle direction information, vehicle center point information, and vehicle corner vector information, the four corner coordinates of the vehicle can be determined, and based on the four corner coordinates of the vehicle, the vehicle detection frame of the vehicle in the image to be detected is determined.
[0127] Based on the coordinate points of the obtained four corners, the vehicle detection frame of the vehicle in the image to be detected is determined, and then the specific position of the vehicle is determined.
[0128] By using this mask decoding method and simultaneously using the vectorization method inside pytorch, parallel processing of horizontal vehicles and non-horizontal vehicles can be efficiently achieved, thereby improving the detection accuracy of the vehicle detection frame.
[0129] S27: Based on the parking space information in the image to be detected, a candidate parking space area is determined.
[0130] Specifically, the parking space lines of the parking spaces in the parking lot are stored and marked in the image acquisition device. Among them, the parking space lines of the parking spaces in the parking lot are obtained through the cloud. The candidate parking space area is determined according to the position of the vehicle detection frame of the vehicle in the image to be detected. The candidate parking space area is the parking space area that the vehicle in the image to be detected may occupy.
[0131] S28: Based on the candidate parking space area and the vehicle detection frame, it is determined whether the vehicle is parked in the candidate parking space area.
[0132] Specifically, based on the vehicle detection frame, the vehicle area of the vehicle is determined; based on the ratio of the vehicle area to the parking space area of the target parking space, the occupancy ratio corresponding to the target parking space is determined; in response to the occupancy ratio exceeding the occupancy ratio threshold, it is determined that the vehicle is parked in the target parking space; in response to the occupancy ratio not exceeding the occupancy ratio threshold, it is determined that the vehicle is not parked in the target parking space.
[0133] Please refer to Figure 7 , Figure 7 is a schematic diagram of the vehicle detection frame and the parking space area in the image to be detected provided by the present invention.
[0134] In a specific embodiment, the area S of the vehicle detection frame is determined according to the vehicle detection frame 车辆 . The corner coordinates of different lines in the vehicle detection frame are obtained through a linear equation of one variable for a straight line, and the vehicle detection frame is divided into at least two triangles. The area S of the vehicle detection frame is determined by calculating the areas of all triangles 车辆 . It is also possible to use a linear equation of one variable for a straight line to obtain the corner coordinates of different lines in the target parking space, divide the target parking space into at least two triangles, and determine the area S of the target parking space by calculating the areas of all triangles 车位It is also possible to directly obtain the parking space area S of the target parking space in the cloud 车位 。
[0135] Determine whether the vehicle in the image to be detected is parked in the target parking space according to the parking space judgment logic. According to the area S of the vehicle detection frame 车辆 and the area S of the parking space frame 车位 of the ratio, determine the occupancy ratio corresponding to the target parking space, compare the occupancy ratio of the target parking space with the occupancy ratio threshold, and then determine whether the vehicle is parked in the target parking space. Among them, the occupancy ratio threshold can be set to 0.75, or the occupancy ratio threshold can be determined according to the actual situation.
[0136] If the occupancy ratio of the target parking space exceeds the occupancy ratio threshold, it is determined that the vehicle in the image to be detected is parked in the target vehicle; if the occupancy ratio of the target parking space does not exceed the occupancy ratio threshold, it is determined that the vehicle in the image to be detected is not parked in the target vehicle.
[0137] The vehicle detection method provided in this embodiment does not depend on camera parameters, and can directly detect the vehicle area through the vehicle detection network, and then determine whether the vehicle occupies the parking space according to the ratio between the area of the vehicle and the area of the parking space.
[0138] The vehicle detection method provided in this embodiment includes obtaining an image to be detected, where the image to be detected includes a vehicle; performing vehicle detection on the image to be detected to obtain the vehicle direction information of the vehicle and at least one vehicle information of the vehicle; in response to the vehicle direction information being the target direction information among N preset direction information, based on the target direction information and the target vehicle information associated with the target direction information in the at least one vehicle information, determine the vehicle detection frame of the vehicle in the image to be detected, where N is an integer greater than 1. This application performs vehicle detection on the image to be detected, determines the target vehicle information associated with the vehicle direction information based on the detected vehicle direction information, and then determines the vehicle detection frame of the vehicle based on the target direction information and the target vehicle information associated with the target direction information. The vehicle detection method can be applied to vehicle detection in horizontal direction scenarios and non-horizontal direction scenarios, has a wide application range, and the vehicle detection result has high accuracy, and can thus improve the detection accuracy of the subsequent parking space state.
[0139] As Figure 8 shown, Figure 8 is a schematic block diagram of an embodiment of the terminal provided by the present invention. The terminal 500 includes a memory 510, a processor 520, an output device 530, and a bus 540.
[0140] The memory 510 may include a read-only memory and a random access memory, and provide instructions and data to the processor 520. A part of the memory 510 may also include a non-volatile storage medium, such as a non-volatile random access memory (NVRAM).
[0141] The memory 510 stores elements, executable modules or data structures, or subsets or extended sets thereof, including: operation instructions, including various operation instructions for implementing various operations; and an operating system, including various system programs for implementing various basic services and processing hardware-based tasks. The memory 510 also stores a motion trajectory, which is characterized by associated data of the positions, times, and ID values of a moving object in each video frame of a video.
[0142] The output device 530 includes a display device, such as a cathode ray tube (CRT) or a liquid crystal display (LCD), and a speaker or a similar audio output device. Some embodiments include devices such as a touch screen that serves as both an input device and an output device.
[0143] In a specific application, the various components of the terminal are coupled together through a bus 540, which may include a power bus, a control bus, a status signal bus, etc. in addition to a data bus. However, for the sake of clarity, all the various buses are labeled as bus 540 in the figure.
[0144] In some embodiments, the processor 520 can perform the following operations by invoking the instructions stored in the memory 510:
[0145] Obtain an image to be detected, where the image to be detected includes a vehicle; perform vehicle detection on the image to be detected to obtain vehicle direction information of the vehicle and at least one vehicle information of the vehicle; in response to the vehicle direction information being a target direction information among N preset direction information, determine a vehicle detection frame of the vehicle in the image to be detected based on the target direction information and the target vehicle information associated with the target direction information among the at least one vehicle information, where N is an integer greater than 1.
[0146] For a specific description of the functions of the various components of the terminal 500 according to the embodiments of the present invention, please refer to the relevant descriptions of the methods in the corresponding above embodiments.
[0147] The method disclosed in the embodiments of the present invention above can be applied to or implemented by the processor 520. The processor 520 may be an integrated circuit chip with signal processing capabilities. During implementation, the steps of the above method can be completed by the integrated logic circuit in hardware or instructions in software form in the processor 520. The above-mentioned processor 520 can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. It can implement or execute the various methods, steps and logic block diagrams disclosed in the embodiments of the present invention. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in combination with the embodiments of the present invention can be directly embodied as being executed by a hardware decoding processor or executed by a combination of hardware and software modules in the decoding processor. The software module can be located in a mature storage medium in the art such as random access memory, flash memory, read-only memory, programmable read-only memory or electrically erasable programmable memory, registers, etc. This storage medium is located in the memory 510, and the processor 520 reads the information in the memory 510 and combines its hardware to complete the steps of the above method.
[0148] Refer to Figure 9 , Figure 9 is a schematic block diagram of an embodiment of a computer-readable storage medium provided by the present invention.
[0149] In an embodiment of the present application, a computer-readable storage medium 90 is further provided. The computer-readable storage medium 90 stores a computer program 901. The computer program 901 includes program instructions. The processor executes the program instructions to implement the vehicle detection method provided by the embodiment of the present application.
[0150] Among them, the computer-readable storage medium 90 can be an internal storage unit of the computer device in the foregoing embodiment, such as the hard disk or memory of the computer device. The computer-readable storage medium 90 can also be an external storage device of the computer device, such as a plug-in hard disk equipped on the computer device, a smart media card (SMC), a secure digital (SD) card, a flash card, etc.
[0151] The above are only the embodiments of the present invention, and do not limit the patent protection scope of the present invention accordingly. Any equivalent structure or equivalent process transformation made by using the content of the specification and drawings of the present invention, or directly or indirectly applied to other related technical fields, shall be included in the patent protection scope of the present invention by the same token.
Claims
1. A vehicle detection method, characterized in that, The vehicle detection method includes: Obtain a to-be-detected image, where the to-be-detected image includes a vehicle; Perform vehicle detection on the to-be-detected image to obtain the vehicle direction information of the vehicle and at least one vehicle information of the vehicle; the at least one vehicle information includes the vehicle center point of the vehicle; In response to the vehicle direction information being the target direction information among N preset direction information, based on the target direction information and the target vehicle information associated with the target direction information in the at least one vehicle information, determine the vehicle detection frame of the vehicle in the to-be-detected image, where N is an integer greater than 1; The determining based on the target direction information and the target vehicle information associated with the target direction information in the at least one vehicle information includes: When the target direction information includes a horizontal direction, the target vehicle information associated with the horizontal direction includes the vehicle size information of the vehicle; Based on the horizontal direction of the vehicle, determine the first mask value corresponding to the vehicle; According to the first mask value of the vehicle, the vehicle center point of the vehicle, and the vehicle size information of the vehicle, determine the four corner point coordinates of the vehicle; According to the four corner point coordinates of the vehicle, determine the vehicle detection frame of the vehicle in the to-be-detected image; Or, when the target direction information includes a non-horizontal direction, the target vehicle information associated with the non-horizontal direction includes the vehicle boundary vector information of the vehicle; Based on the non-horizontal direction of the vehicle, determine the second mask value corresponding to the vehicle; According to the second mask value of the vehicle, the vehicle center point of the vehicle, and the vehicle boundary vector information of the vehicle, determine the four corner point coordinates of the vehicle; According to the four corner point coordinates of the vehicle, determine the vehicle detection frame of the vehicle in the to-be-detected image.
2. The vehicle detection method according to claim 1, wherein The performing vehicle detection on the to-be-detected image to obtain the vehicle direction information of the vehicle and at least one vehicle information of the vehicle includes: Use a trained vehicle detection network to perform vehicle detection on the to-be-detected image to obtain the vehicle direction information of the vehicle and at least one vehicle information of the vehicle; wherein, the vehicle detection network is trained using a sample image labeled with the vehicle direction information of the training vehicle and at least one vehicle information of the training vehicle.
3. The vehicle detection method according to claim 2, wherein The vehicle detection network includes a feature extraction module, an upsampling module, and a detection module cascaded in sequence; wherein, the feature extraction module includes n feature extraction layers cascaded in sequence, and n is an integer greater than 1; The performing vehicle detection on the to-be-detected image to obtain the vehicle direction information of the vehicle and at least one vehicle information of the vehicle includes: Use the n feature extraction layers included in the feature extraction module to respectively perform feature extraction on the to-be-detected image to obtain the sub-image features corresponding to each feature extraction layer in the n feature extraction layers; Use the upsampling module to perform feature fusion on the sub-image features corresponding to each feature extraction layer to obtain a preprocessed feature map; Using the detection module to detect the preprocessed feature map to obtain the vehicle direction information of the vehicle and at least one vehicle information of the vehicle.
4. The vehicle detection method according to claim 3, wherein Using the n feature extraction layers included in the feature extraction module to respectively extract features from the image to be detected, and obtaining sub-image features corresponding to each feature extraction layer in the n feature extraction layers, including: Using the first feature extraction layer in the n feature extraction layers to extract features from the image to be detected to obtain sub-image features corresponding to the first feature extraction layer; and Using the (i + 1)-th feature extraction layer to extract features from the sub-image features corresponding to the i-th feature extraction layer to obtain sub-image features corresponding to the (i + 1)-th feature extraction layer, where i is an integer greater than 0 and less than n - 1.
5. The vehicle detection method according to claim 3, wherein When the at least one vehicle information further includes the vehicle center point of the vehicle; the vehicle detection network further includes a conversion module connected to the upsampling module; The vehicle detection of the image to be detected to obtain the vehicle direction information of the vehicle and at least one vehicle information of the vehicle further includes: Using the conversion module to detect the vehicle center point of the preprocessed feature map and perform data conversion on the detection result of the vehicle center point to obtain the vehicle center point coordinates of the vehicle.
6. The vehicle detection method according to any one of claims 1 to 5, characterized in that The image to be detected is collected for a target scene, and further includes: Based on the parking space information in the image to be detected, determining a candidate parking space area; In response to the vehicle direction information being the target direction information among N preset direction information, based on the target vehicle information associated with the target direction information in the at least one vehicle information, determining the vehicle detection frame of the vehicle in the image to be detected, and then further including: Based on the candidate parking space area and the vehicle detection frame, determining whether the vehicle is parked in the candidate parking space area.
7. The vehicle detection method according to claim 6, characterized in that The candidate parking space area includes a target parking space corresponding to the position of the vehicle in the image to be detected; The determining whether the vehicle is parked in the candidate parking space area based on the candidate parking space area and the vehicle detection frame includes: Determining the vehicle area of the vehicle based on the vehicle detection frame; Based on the ratio of the vehicle area to the parking space area of the target parking space, determining the occupancy ratio corresponding to the target parking space; In response to the occupancy ratio exceeding the occupancy ratio threshold, determining that the vehicle is parked in the target parking space.
8. The vehicle detection method according to claim 2, wherein The vehicle direction information includes a horizontal direction and a non-horizontal direction; When the sample image contains a first training vehicle, the vehicle direction information labeled for the first training vehicle in the sample image is the horizontal direction; at least one vehicle information labeled for the first training vehicle in the sample image includes the vehicle size information of the first training vehicle; the first training vehicle is a vehicle whose vehicle direction in the sample image is parallel to the coordinate axis of the sample image; When the sample image contains a second training vehicle, the vehicle direction information labeled for the second training vehicle in the sample image is the non-horizontal direction; at least one vehicle information labeled for the second training vehicle in the sample image includes the vehicle boundary vector information of the second training vehicle; the second training vehicle is a vehicle whose vehicle direction in the sample image is non-parallel to the coordinate axes of the sample image.
9. The vehicle detection method according to claim 8, wherein the vehicle detection network is trained in the following manner: Obtain a training sample set; Use the vehicle detection network during training to perform vehicle detection on the sample image to obtain prediction information for the training vehicle; the prediction information includes the vehicle direction information predicted for the training vehicle and at least one vehicle information; Use a loss function to determine a prediction loss value based on the deviation information between the labeled information and the prediction information for the training vehicle; The labeled information includes the vehicle direction information labeled for the training vehicle and at least one vehicle information labeled for the training vehicle; Use the prediction loss value to perform iterative training on the vehicle detection network.
10. The vehicle detection method according to claim 9, wherein The labeled information further includes the vehicle center point information labeled for the training vehicle; The using a loss function to determine a prediction loss value based on the deviation information between the labeled information and the prediction information for the training vehicle includes: Based on the sum of the vehicle center point information loss value, vehicle direction information loss value, and vehicle boundary vector information loss value or vehicle size information loss value of the same training vehicle, calculate the prediction loss value.
11. A terminal, characterized in that, The terminal includes a memory, a processor, and a computer program stored in the memory and running on the processor, and the processor is configured to execute program data to implement the steps in the vehicle detection method according to any one of claims 1 to 10.
12. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium, and when the computer program is executed by the processor, the steps in the vehicle detection method according to any one of claims 1 to 10 are implemented.
Citation Information
Patent Citations
Vehicle parking state determination method and device, equipment and storage medium
CN113065427A