A training method and device for vehicle logo detection network
Through self-supervised pre-training and pseudo-label data construction methods, the vehicle logo detection network is trained, which solves the dependence problem of feature selection and large amounts of labeled data in the prior art, and realizes high-precision vehicle logo detection and strong robust detection capabilities.
Patent Information
- Application Number
- CN202410640728.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-22
- Publication Date
- 2025-03-25
- Estimated Expiration
- 2044-05-22
AI Technical Summary
In the prior art, it is necessary to manually select features or a large amount of labeled data are required to train the detection model, and the problem that small sample data cannot obtain ideal detection effects.
By obtaining the car logo logo for self-supervised pre-training, obtaining the car logo detection sample, and combining it with the preset background picture to construct pseudo-label data, and training the preset car logo detection network. This method combines self-supervised learning and adaptive clustering to reduce dependence on large amounts of labeled data.
Without the need for a large amount of labeling data, high-precision car logo detection can be realized, manual labeling costs can be reduced, network model training speed can be improved, and detection robustness and generalization capabilities can be improved.
Smart Images

Figure CN118586472B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of intelligent detection of vehicle logos and computer artificial intelligence technology, and in particular to a training method and device for a vehicle logo detection network. Background Art
[0002] With the continuous development of technology, image recognition technology has gradually matured and has been widely used. Among them, vehicle logo detection technology is an application of image recognition technology. It can identify various types of vehicle logos in the image. With the continuous development of intelligent transportation systems and intelligent driving technologies, vehicle logo detection, as a key link, plays an important role in realizing intelligent traffic management, improving traffic safety, and improving driving experience.
[0003] Vehicle logo detection refers to the process of accurately identifying the vehicle's logo, such as the brand logo or model logo, by analyzing and processing the vehicle image or video in the vehicle recognition system. This technology has important application value in the fields of intelligent transportation systems, intelligent driving, vehicle tracking, and security monitoring.
[0004] At present, in order to improve the recognition accuracy, image feature extraction and model network training are introduced. Among them, traditional target detection methods, such as feature extraction and classifiers based on manual design, often rely on manual selection of features and adjustment of parameters, which are difficult to adapt to changes in different scenes and environments, and have poor robustness. Although the target detection method based on deep learning has achieved great success in the field of target detection, it requires a large amount of labeled data during the training process, and the training performance for small samples is not satisfactory. Summary of the invention
[0005] The purpose of the embodiment of the present application is to provide a training method for a vehicle logo detection network, which solves the problem in the prior art that features need to be manually selected, or a large amount of labeled data is needed to train the detection model, and ideal detection results cannot be obtained for small sample data. The specific technical solution is as follows:
[0006] According to a first aspect of an embodiment of the present application, a method for training a vehicle logo detection network is provided, the method comprising:
[0007] Obtain a vehicle logo, perform self-supervised pre-training on the vehicle logo, and obtain a vehicle logo detection sample;
[0008] Combining the vehicle logo detection sample with a preset background image to construct pseudo label data corresponding to the vehicle logo detection sample, wherein the pseudo label data includes label annotation information based on the vehicle logo detection sample;
[0009] Input the pseudo-label data into a preset vehicle logo detection network for convolution processing, obtain a first convolution result and a second convolution result respectively, perform scaling processing on the first convolution result to obtain a first output result, perform clustering processing on the second convolution result to obtain a second output result;
[0010] Combining the first output result with the second output result to obtain a first combined result, and performing pooling processing on the first combined result to obtain label detection information corresponding to the vehicle logo detection sample;
[0011] According to the label annotation information and the label detection information, a loss function for the preset vehicle logo detection network is calculated, and network parameters of the preset vehicle logo detection network are adjusted according to the loss function. The training is repeated until the training end condition is met to obtain a trained vehicle logo detection network.
[0012] Optionally, before acquiring the vehicle logo, performing self-supervised pre-training on the vehicle logo, and obtaining the vehicle logo detection sample, the method further includes:
[0013] Obtain a vehicle logo name, and obtain a vehicle logo image corresponding to the vehicle logo name;
[0014] The vehicle logo image is segmented to extract the vehicle logo symbol in the vehicle logo image.
[0015] Optionally, combining the vehicle logo detection sample with a preset background image to construct pseudo label data corresponding to the vehicle logo detection sample includes:
[0016] Obtaining a segmentation mask of the vehicle logo detection sample, and obtaining a minimum circumscribed rectangle of the segmentation mask;
[0017] If the length of the circumscribed minimum rectangle exceeds the first threshold, the length and width of the segmentation mask are both reduced by half;
[0018] Acquire a number of background images, place a first number of vehicle logo detection samples in the background images, and obtain the pseudo label data;
[0019] The length and width of the circumscribed minimum rectangle are the length and width of the vehicle logo detection sample, and the multiple vehicle logos placed in the same background image do not overlap each other.
[0020] Optionally, the inputting the pseudo-label data set into a preset vehicle logo detection network for convolution processing, obtaining a first convolution result and a second convolution result respectively, performing scaling processing on the first convolution result to obtain a first output result, and performing clustering processing on the second convolution result to obtain a second output result, includes:
[0021] Inputting the pseudo-label data into the preset vehicle logo detection network to perform chain residual pooling processing to obtain a first sub-feature;
[0022] Inputting the first sub-feature into a first convolution pool to obtain the first convolution result, and inputting the first sub-feature into a second convolution pool to obtain the second convolution result;
[0023] Scaling, normalizing, and scaling the first convolution result to obtain the first output result;
[0024] The second convolution result is clustered according to the first clustering module to obtain the second output result, wherein the first clustering module is an adaptive clustering module based on a hash function.
[0025] Optionally, the label detection information corresponding to the vehicle logo detection sample includes at least a detection frame and category information of the vehicle logo detection sample, and the performing pooling processing on the first combination result to obtain the label detection information corresponding to the vehicle logo detection sample includes:
[0026] Inputting the first combination result into the pooling layer for pooling processing to obtain a pooling result;
[0027] Input the pooling result into the fully connected layer for dense processing to obtain the detection frame corresponding to the vehicle logo detection sample;
[0028] The pooling result is normalized to obtain category information corresponding to the vehicle logo detection sample.
[0029] Optionally, adjusting the network parameters of the preset vehicle logo detection network according to the loss function, cyclically training until a training end condition is met, and obtaining the trained vehicle logo detection network includes:
[0030] Perform back propagation according to the loss function value of the loss function;
[0031] Update the weight and bias parameters of the preset vehicle logo detection network in combination with the output result of back propagation;
[0032] Execute cyclic training on the preset vehicle logo detection network, and obtain a trained vehicle logo detection network when the cumulative number of training rounds reaches a second threshold, or when the preset vehicle logo detection network meets a convergence condition.
[0033] Optionally, after the cyclic training is performed until a training end condition is met and a trained vehicle logo detection network is obtained, the method further includes:
[0034] Obtaining a second loss function, and obtaining a candidate region output by the trained vehicle logo detection network;
[0035] If the overlapping area between the candidate area and the segmentation mask of the vehicle logo detection sample is less than a third threshold, the loss function value corresponding to the candidate area is ignored;
[0036] If the overlapping area between the candidate area and the segmentation mask of the vehicle logo detection sample exceeds the third threshold, the network parameters of the trained vehicle logo detection network are adjusted according to the loss function value of the second loss function.
[0037] According to a second aspect of an embodiment of the present application, a training device for a vehicle logo detection network is provided, the device comprising:
[0038] The first sample module is used to obtain a vehicle logo, perform self-supervised pre-training on the vehicle logo, and obtain a vehicle logo detection sample;
[0039] A first construction module is used to combine the vehicle logo detection sample with a preset background image to construct pseudo label data corresponding to the vehicle logo detection sample, wherein the pseudo label data includes label annotation information based on the vehicle logo detection sample;
[0040] A first training module is used to input the pseudo-label data into a preset vehicle logo detection network for convolution processing, obtain a first convolution result and a second convolution result respectively, perform scaling processing on the first convolution result to obtain a first output result, and perform clustering processing on the second convolution result to obtain a second output result;
[0041] A first detection module, used for combining the first output result with the second output result to obtain a first combination result, and performing pooling processing on the first combination result to obtain label detection information corresponding to the vehicle logo detection sample;
[0042] The first network module is used to calculate the loss function for the preset vehicle logo detection network according to the label annotation information and the label detection information, and adjust the network parameters of the preset vehicle logo detection network according to the loss function, and perform cyclic training until the training end condition is met to obtain the trained vehicle logo detection network.
[0043] According to a third aspect of an embodiment of the present application, there is provided an electronic device, including:
[0044] One or more processors; a memory; one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to execute the training method of the vehicle logo detection network described in the first aspect.
[0045] According to a fourth aspect of an embodiment of the present application, a readable storage medium is provided, including:
[0046] A computer-readable storage medium stores a computer program for use in conjunction with an electronic device, wherein the computer program can be executed by a processor to complete the training method for a vehicle logo detection network described in the first aspect.
[0047] Compared with the prior art, the technical solution provided by the embodiment of the present application has the following beneficial effects:
[0048] The training method of the vehicle logo detection network disclosed in the embodiment of the present application obtains the vehicle logo sign, obtains the vehicle logo detection sample by self-supervised pre-training of the vehicle logo sign; combines the vehicle logo detection sample with a preset background image to construct pseudo-label data, wherein the pseudo-label data corresponds to the vehicle logo detection sample, and the pseudo-label data contains label annotation information based on the vehicle logo detection sample annotation; trains the preset vehicle logo detection network according to the pseudo-label data, inputs the pseudo-label data into the preset vehicle logo detection network, obtains a first convolution result and a second convolution result respectively, obtains a first output result by scaling the first convolution result, and obtains a second output result by clustering the second convolution result; obtains a first combination result according to the first output result and the second output result, and obtains the label detection information corresponding to the vehicle logo detection sample by pooling; calculates the loss function of the preset vehicle logo detection network by combining the label annotation information and the label detection information, adjusts the network parameters of the preset vehicle logo detection network according to the loss function, and repeats the training until the training end condition is met to obtain the trained vehicle logo detection network.
[0049] This application obtains vehicle logo detection samples based on self-supervised learning and constructs pseudo data. It can achieve high-precision vehicle logo detection without the need for a large amount of labeled data by combining the advantages of self-supervised learning and adaptive clustering. Among them, the self-supervised learning method is used to reduce the dependence on a large amount of labeled data to a certain extent, effectively reduce the cost of manual labeling, and improve the training speed of the network model. At the same time, the adaptive clustering module is used to process the vehicle logo detection samples, which can automatically adjust the model parameters according to the characteristics of different scenes and environments, so that the vehicle logo detection network can better adapt to complex and changeable road conditions and lighting scenes, thereby improving the robustness and generalization ability of detection.
[0050] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0052] Figure 1 It is a flowchart of a method for training a vehicle logo detection network provided in an embodiment of the present application;
[0053] Figure 2 It is a schematic diagram of a framework of a vehicle logo detection network training method and its application provided in an embodiment of the present application;
[0054] Figure 3 It is a flow chart of a first clustering module in a training method of a vehicle logo detection network provided in an embodiment of the present application;
[0055] Figure 4 It is a structural schematic diagram of a training device for a vehicle logo detection network provided in an embodiment of the present application;
[0056] Figure 5 It is a block diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0057] The embodiment of the present application provides a training method for a vehicle logo detection network, which can be applicable to the training process of a vehicle logo detection network. The vehicle logo detection network can be used to identify and detect vehicle logos, providing important data support for intelligent traffic management and improving driving experience.
[0058] Traditional target detection methods mostly use feature extraction and classifiers based on manual design, which rely to a large extent on manual selection and labeling of features, as well as adjustment of parameters during the training process. They cannot adapt to different application scenarios and environmental changes and have poor robustness. In order to improve the accuracy of recognition and detection, network models with various structures are introduced. Among them, target detection methods based on deep learning have effectively improved the accuracy and speed of target detection, but a large amount of labeled data needs to be obtained during the training process of the network model, which consumes high labor costs. Accordingly, when the number of training data samples is small, ideal detection effects cannot be obtained. In addition, for smaller detection targets or when the detection targets are occluded, the detection performance is also very limited.
[0059] Therefore, an embodiment of the present application provides a training method for a vehicle logo detection network, which obtains the vehicle logo (logotype) in the foreground part by performing image segmentation on the vehicle logo image, and performs self-supervised pre-training on the vehicle logo. Without obtaining the standard true value, a large amount of unlabeled data is obtained. Furthermore, background pictures of different driving scenes are obtained, and the vehicle logo is randomly pasted on the background pictures to construct pseudo data for training the network model. An adaptive clustering module is used in the vehicle logo detection network to reduce the complexity of the attention mechanism, balance accuracy and computational cost, and achieve high-precision vehicle logo detection that adapts to various driving scenes without the need for a large amount of labeled data.
[0060] In order to make the above-mentioned purposes, features and advantages of the present application more obvious and understandable, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present application.
[0061] The following is a detailed description of the training method and device for the vehicle logo detection network provided in the embodiment of the present application through specific embodiments and their application scenarios in conjunction with the accompanying drawings.
[0062] Reference Figure 1 , shows a flow chart of a method for training a vehicle logo detection network according to an embodiment of the present application, which may specifically include the following steps:
[0063] Step 101, obtain a vehicle logo, perform self-supervised pre-training on the vehicle logo, and obtain a vehicle logo detection sample.
[0064] Step 102 , combining the vehicle logo detection sample with a preset background image, constructing pseudo label data corresponding to the vehicle logo detection sample, wherein the pseudo label data includes label annotation information based on the vehicle logo detection sample.
[0065] In an embodiment of the present application, firstly, a number of car logo images containing car logos are obtained from a preset image library. In order to reduce the storage resources occupied by the training data, the foreground part, i.e., the car logo, is segmented from the car logo image. Then, the segmented car logo is self-supervised pre-trained to obtain car logo detection samples, wherein the car logo refers to the logos of various automobile brands.
[0066] The self-supervised pre-training method is a method that trains the model by designing prediction tasks without the need for manually labeled data. In an embodiment of the present application, when the vehicle logo detection sample is first obtained to train the vehicle logo detection network, since the deviation value between the predicted value and the actual labeled label cannot be obtained, it cannot be fully confirmed that the segmentation mask obtained by image segmentation based on the vehicle logo detection sample is the true value. At this time, a self-supervised learning method is used to design the prediction task, and the vehicle logo detection sample is self-supervised pre-trained. The vehicle logo detection network is trained without obtaining labeled data from the vehicle logo detection sample.
[0067] In order to improve the scalability of the network model in actual scenarios, the acquired car logo is combined with different actual images to construct pseudo data with strong scalability. Taking into account the large differences in lighting conditions and environmental factors in different driving scenarios, and excessive or insufficient lighting will affect the accuracy of car logo detection, this application obtains multiple scene images from different real scenes as background images for constructing pseudo-label data, and combines the car logo detection samples with the preset background images respectively to construct pseudo-label data for training the car logo detection network. In the embodiment of the present application, the pseudo-label data refers to the car logo detection samples constructed by simulating real scenes. Data, by combining the acquired vehicle logo detection samples with a variety of background images from real scenes, the vehicle logo signs in different driving scenes are obtained, thereby improving the scalability and adaptability of the vehicle logo detection network to different driving scenes. Among them, the pseudo-label data contains real label annotation information for vehicle logo detection samples and background images. In order to reflect different driving scenes, the background images can be high-speed scenes, underground scenes, street scenes and corresponding scene images under different weather conditions. The source of the background images can be crawled from network resources or obtained from a local image database, and this application does not limit this.
[0068] Step 103, input the pseudo-label data into a preset vehicle logo detection network for convolution processing, obtain a first convolution result and a second convolution result respectively, perform scaling processing on the first convolution result to obtain a first output result, perform clustering processing on the second convolution result to obtain a second output result.
[0069] Step 104 , combining the first output result with the second output result to obtain a first combined result, performing pooling processing on the first combined result, and obtaining label detection information corresponding to the vehicle logo detection sample.
[0070] In an embodiment of the present application, after completing the acquisition of vehicle logo detection samples and the construction of pseudo-label data, the pseudo-label data is input into a preset vehicle logo detection network, and the preset vehicle logo detection network is trained. Specifically, the pseudo-label data is input into the preset vehicle logo detection network for convolution processing to obtain a first convolution result and a second convolution result, respectively, wherein the first convolution result and the second convolution result are intermediate output results obtained by the preset vehicle logo detection network during the training process, the first convolution result is scaled to obtain a first output result, and the second convolution result is clustered to obtain a second output result.
[0071] In order to improve the recognition efficiency in the target detection process, deep learning is introduced and applied in target detection. For example, convolutional neural network (Region-Convolutional Neural Networks, CNN) target detection algorithm (Region-Convolutional Neural Networks, R-CNN) or other deep learning models, machine learning models, wherein R-CNN is an algorithm based on convolutional network, linear regression and support vector machine, etc., which uses extraction frame to extract features for each frame, image classification, and non-maximum suppression to perform detection. In the feature extraction step, a deep convolutional network is used for extraction. Preferably, in an embodiment of the present application, R-CNN can be used to construct a preset car logo detection network for training, and feature extraction is performed on car logo detection samples based on the deep convolutional network. At the same time, an adaptive clustering module is set to perform adaptive query and hierarchical clustering on the acquired training features, so as to effectively reduce the complexity within the self-attention mechanism.
[0072] By combining the first output result with the second output result, a first combined result can be obtained, and the first combined result is input into the pooling layer for pooling processing to obtain label detection information corresponding to the vehicle logo detection sample, wherein the first output result is combined with the second output result to obtain an accurate preliminary regional result, that is, the first combined result, and by pooling the preliminary regional result, label detection information corresponding to the vehicle logo detection sample output by the preset vehicle logo detection network can be obtained.
[0073] Step 105, based on the label annotation information and the label detection information, calculate the loss function for the preset vehicle logo detection network, and adjust the network parameters of the preset vehicle logo detection network according to the loss function, and repeat the training until the training end condition is met to obtain the trained vehicle logo detection network.
[0074] Specifically, the label annotation information extracted from the pseudo-label data is compared with the label detection information corresponding to the output of the preset vehicle logo detection network. According to the comparison result of the predicted information output by the network and the real annotation information, the loss function of the vehicle logo detection network is calculated to measure the gap between the network prediction and the real information. Among them, the label annotation information extracted from the pseudo-label data refers to the real annotation information extracted from the preset background and vehicle logo detection samples, and the label detection information output by the preset vehicle logo detection network may include the detection box and category information of the vehicle logo to be detected.
[0075] In the embodiment of the present application, after obtaining the loss function, the function value of the loss function is used for back propagation to adjust and update the network parameters of the preset vehicle logo detection network. A variety of loss functions can be used to update the parameters of the preset vehicle logo detection network. Considering the long-tail problem between categories, the present application preferably uses the Equalization Loss (balanced loss function) to improve the detection effect of the long-tail detection task. The preset vehicle logo detection network is cyclically trained, and the process of forward propagation, loss function calculation, back propagation and parameter update is repeated until the training end condition is met, the training is completed, and the trained vehicle logo detection network is obtained.
[0076] This application constructs pseudo data by acquiring vehicle logo detection samples. It can achieve high-precision vehicle logo detection without the need for a large amount of labeled data by combining the advantages of self-supervised learning and adaptive clustering. The self-supervised learning method is used to reduce the dependence on a large amount of labeled data to a certain extent, effectively reduce the cost of manual labeling, and improve the training speed of the network model. At the same time, the adaptive clustering module is used for processing, which can automatically adjust the model parameters according to the characteristics of different scenes and environments, so that the vehicle logo detection network can better adapt to complex and changeable road conditions and lighting scenes, thereby improving the robustness and generalization ability of detection.
[0077] In a possible embodiment, before step 101, the following steps may also be included:
[0078] a1. Get the car logo name and the car logo image corresponding to the car logo name.
[0079] a2. Segment the vehicle logo image and extract the vehicle logo symbol in the vehicle logo image.
[0080] Specifically, this application obtains the car logo name based on the currently common vehicle brands or vehicle-related companies, and obtains the car logo image corresponding to the car logo name from network resources or local databases. In order to avoid the influence of irrelevant pixels on the training results and reduce the storage resources occupied by the training data, image segmentation technology is used to segment the car logo image to obtain the background part and foreground part corresponding to the car logo image, where the foreground part is the car logo logo, so as to extract the car logo from the car logo image, and then perform self-supervised pre-training based on the obtained car logo logo to obtain the car logo detection sample.
[0081] Among them, a variety of image segmentation algorithms can be used to segment the car logo image. Preferably, the Tokencut algorithm can be used to segment the car logo image to obtain the foreground and background parts of the car logo image, and obtain the segmentation mask (mask) corresponding to the car logo after segmentation. The circumscribed minimum rectangle of the segmentation mask is used as the detection frame of the car logo. The length and width of the circumscribed minimum rectangle refer to the length and width of the car logo.
[0082] Specifically, step 102 may include the following steps:
[0083] b1, obtain the segmentation mask of the vehicle logo detection sample and obtain the minimum circumscribed rectangle of the segmentation mask.
[0084] b2: If the length of the circumscribed minimum rectangle exceeds the first threshold, the length and width of the segmentation mask are halved.
[0085] b3, obtaining a number of background images, placing a first number of vehicle logo detection samples in the background images, and obtaining pseudo label data.
[0086] In the embodiment of the present application, a vehicle logo is extracted from a vehicle logo image, and a vehicle logo detection sample is obtained through self-supervised pre-training. While extracting the vehicle logo, a segmentation mask of the vehicle logo can be obtained based on an image segmentation algorithm, and the circumscribed minimum rectangle of the segmentation mask is obtained as the detection frame of the vehicle logo detection sample. Before constructing pseudo-label data, the size of the vehicle logo is prevented from being too large, which affects the accuracy of the training. A first threshold is set, and the size of the detection frame of each vehicle logo detection sample is detected and limited, which is equivalent to detecting and limiting the size of the circumscribed minimum rectangle corresponding to each vehicle logo detection sample. Specifically, the length of each circumscribed minimum rectangle is obtained. If the circumscribed minimum rectangle is If the length of the vehicle logo exceeds the first threshold, the length and width of the circumscribed minimum rectangle are halved, wherein the first threshold can be set according to specific needs. In the embodiment of the present application, since the size of the background image is determined, it is preferably 1920×1080 (unit: pixel). In order to make the ratio of the long side of the vehicle logo to the long side of the background image within a preset range, the first threshold can be set to 360 (unit: pixel). Thus, the preset range of the ratio of the long side of the vehicle logo to the long side of the background image is preferably 8% to 16%. After completing the preprocessing of each vehicle logo detection sample, pseudo-label data is constructed according to the vehicle logo detection sample and the preset background image.
[0087] Specifically, in order to improve the scalability of the network model in actual scenarios, the vehicle logo detection samples are placed in background pictures and combined to construct pseudo-label data. Taking into account the large differences in lighting conditions and environmental factors in different driving scenarios, which will affect the accuracy of vehicle logo detection, the present application obtains several background pictures based on real scenes, and places a first number of vehicle logo detection samples in the background pictures to combine and obtain pseudo-label data. In order to improve the scalability of the training data, the acquired background pictures can be real scene images reflecting different driving scenarios. Preferably, the background pictures can be highway scenes, underground garage scenes, street scenes, and corresponding scene images in different weather conditions, such as sunny days, rainy days, nights, etc. The source of the background pictures can be crawled from network resources or obtained from a local image database, and the present application does not limit this.
[0088] In an embodiment of the present application, in order to construct pseudo-label data, a first number of vehicle logo detection samples are randomly placed in the background image. Specifically, the first number can be set according to demand. In the present application, the first number is preferably five, that is, five vehicle logo detection samples are placed in the same background image. In order to ensure the number of training for each vehicle logo, the number of pseudo-label data constructed can be set for each vehicle logo detection sample, such as setting the number of pseudo-label data constructed for each vehicle logo detection sample to 20, 30, or 50. Preferably, the present application constructs fifty pseudo-label data for each vehicle logo detection sample. At the same time, considering that in actual applications, when detecting the vehicle logo, there is no occlusion of the vehicle logo. In the process of constructing pseudo-label data, the present application makes the multiple vehicle logos placed in the same background image non-overlapping.
[0089] Specifically, step 103 to step 104 describe the training process of the preset vehicle logo detection network, referring to Figure 2 , showing a framework diagram of a training method for a vehicle logo detection network and its application. In the process of training a preset vehicle logo detection network, firstly, a vehicle logo detection sample is obtained, the vehicle logo detection sample is input into a chained residual pooling (CRP) module for processing, and a first sub-feature is convolved, the first sub-feature after the convolution processing is input into a first convolution pool to obtain a first convolution result, the first sub-feature after the convolution processing is input into a second convolution pool to obtain a second convolution result, and the first convolution result and the second convolution result are processed respectively, wherein the first convolution result is scaled to obtain a first output result, the second convolution result is clustered to obtain a second output result, the first output result and the second output result are combined to obtain a first combined result, that is, a candidate area of the preset vehicle logo detection network, the first combined result is pooled to obtain a pooled result, the pooled results are processed respectively, and the pooled results are input into a fully connected layer for dense processing to obtain a detection frame corresponding to the vehicle logo detection sample; the pooled result is normalized to obtain the category information corresponding to the vehicle logo detection sample.
[0090] Specifically, the chained residual pool is composed of a series of pooling layers and convolution layers, which are arranged in the form of residuals. The first sub-feature is obtained through the chained residual pooling module, and the first sub-feature is convolved. In order to improve the nonlinear ability of the network, an activation layer is usually set after the convolution layer. In the embodiment of the present application, scaling, normalization, and scaling are sequentially performed on the first convolution result to perform resolution scaling processing to obtain a first output result. At the same time, the second convolution result is clustered based on the first clustering module to obtain a second output result. Considering the computational cost of high-resolution input, the present application adopts an adaptive clustering module based on a hash function as the first clustering module, and the first combination result is sequentially input into the ROIPooling (Region of Interest Pooling, region of interest pooling) layer, the fully connected layer and the activation layer for processing to obtain a pooling result.
[0091] Preferably, refer to Figure 3 , shows a flow chart for the first clustering module in the training method of the vehicle logo detection network of the present application. The first clustering module ACHT uses a locality-sensitive hashing function (LSH) to adaptively query and hierarchically cluster features. At the same time, the prototype-key interaction is used to approximate the Query-key (a keyword used to mark a search query), thereby reducing the complexity within the self-attention mechanism and achieving a good balance between accuracy and computational cost. Specifically, the training features are input into the first clustering module, the key is extracted from the features, and the features are queried, and a hierarchical clustering query is performed to obtain prototype objects (Prototypes), and the key is combined with the prototype object to obtain an attention image (Attention map). At the same time, the value (Value) is obtained by convolution processing the features, and the value and the attention image are aggregated in a certain ratio to obtain an output aggregation result, wherein the aggregation ratio can be set according to demand.
[0092] Optionally, step 105 may specifically include the following steps:
[0093] c1, back propagates according to the loss function value of the loss function.
[0094] c2, combined with the output results of back propagation, updates the weights and bias parameters of the preset vehicle logo detection network.
[0095] c3, performing cyclic training on the preset vehicle logo detection network, when the cumulative number of training rounds reaches a second threshold, or when the preset vehicle logo detection network meets the convergence condition, obtaining the trained vehicle logo detection network.
[0096] Specifically, the preset vehicle logo detection network is trained according to the pseudo-label data, and the loss function of the vehicle logo detection network is calculated after obtaining the output result of the preset vehicle logo detection network to measure the gap between the network prediction and the real information. After obtaining the loss function, the function value of the loss function is used for back propagation to adjust and update the network parameters of the preset vehicle logo detection network. Specifically, the weights and bias parameters of the preset vehicle logo detection network are updated, and the preset vehicle logo detection network is cyclically trained, and the process of forward propagation, loss function calculation, back propagation and parameter updating is repeated until the cumulative number of training rounds reaches a second threshold, or the preset vehicle logo detection network meets the convergence condition, then the training is considered to be completed, and the trained vehicle logo detection network is obtained. Vehicle logo detection network, in which forward propagation refers to the process of calculating the output results of each layer in the neural network from the input layer to the output layer in turn, and back propagation is an optimization method based on the gradient descent method, which is used to calculate the gradient value of each parameter in the neural network, so as to use the gradient descent method or other optimization methods to update the parameters, thereby minimizing the loss function. The smaller the loss function value, the closer it is to the true value, which means the stronger the detection ability. The vehicle logo detection network is cyclically trained by the method of forward propagation-loss function calculation-backward propagation-parameter update. According to the comparison of the label detection information output each time and the label annotation information, the network parameters are repeatedly corrected and updated, thereby improving the detection accuracy of the vehicle logo detection network.
[0097] Among them, the second threshold is set to the threshold of the number of rounds of cyclic training of the preset vehicle logo detection network. Preferably, in the present application, the second threshold is set to 200 rounds, that is, when the cumulative number of training rounds reaches 200 rounds, or the preset vehicle logo detection network meets the convergence conditions, the training is considered to be completed and the trained vehicle logo detection network is obtained.
[0098] In the embodiment of the present application, taking into account the possibility of missing some pixels in the segmentation mask obtained by the Tokencut algorithm through segmentation of the car logo image, the obtained segmentation mask is not directly used as the true value used in the subsequent loop training. Instead, after obtaining the car logo detection network, the car logo detection network is trained again based on the DropLoss (original loss function) in the car logo detection network. When the overlapping area between the candidate area of the car logo detection network and the segmentation mask is less than the third threshold, the loss value of the candidate area is ignored, and the detection network is encouraged to explore different image areas. When the overlapping area between the candidate area of the car logo detection network and the segmentation mask exceeds the third threshold, the network parameters of the car logo detection network are adjusted according to the original loss function. The specific execution method of step 105 can be referred to, which will not be repeated here. The third threshold can be set according to actual needs. In the embodiment of the present application, the preferred value of the third threshold is set to 0.01.
[0099] During the training of the preset vehicle logo detection network, various indicators of the detection network can be evaluated periodically. For example, the performance accuracy, recall rate and other parameters of the vehicle logo detection network can be regularly evaluated to obtain the training progress of the detection network, and further adjust the hyperparameters according to the training progress. Hyperparameters refer to parameters in machine learning and deep learning models. Unlike the weights and bias parameters of the detection network, hyperparameters are set before the detection network starts training, and are not learned during the training process. Common hyperparameters may include learning rate, batch size, number of iterations, etc.
[0100] It should be noted that, for the method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present application are not limited by the described order of actions, because according to the embodiments of the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present application.
[0101] The present application also provides a training device for a vehicle logo detection network, referring to Figure 4 , shows a schematic diagram of the structure of a training device for a vehicle logo detection network according to an embodiment of the present application, which specifically includes the following modules:
[0102] The first sample module 401 is used to obtain a vehicle logo, perform self-supervised pre-training on the vehicle logo, and obtain a vehicle logo detection sample;
[0103] A first construction module 402 is used to combine the vehicle logo detection sample with a preset background image to construct pseudo label data corresponding to the vehicle logo detection sample, wherein the pseudo label data includes label annotation information based on the vehicle logo detection sample;
[0104] The first training module 403 is used to input the pseudo-label data into a preset vehicle logo detection network for convolution processing, obtain a first convolution result and a second convolution result respectively, perform scaling processing on the first convolution result to obtain a first output result, and perform clustering processing on the second convolution result to obtain a second output result;
[0105] The first detection module 404 is used to combine the first output result with the second output result to obtain a first combined result, and perform pooling processing on the first combined result to obtain label detection information corresponding to the vehicle logo detection sample;
[0106] The first network module 405 is used to calculate the loss function for the preset vehicle logo detection network according to the label annotation information and the label detection information, and adjust the network parameters of the preset vehicle logo detection network according to the loss function, and perform cyclic training until the training end condition is met to obtain the trained vehicle logo detection network.
[0107] This application constructs pseudo data by acquiring vehicle logo detection samples. It can achieve high-precision vehicle logo detection without the need for a large amount of labeled data by combining the advantages of self-supervised learning and adaptive clustering. The self-supervised learning method is used to reduce the dependence on a large amount of labeled data to a certain extent, effectively reduce the cost of manual labeling, and improve the training speed of the network model. At the same time, the adaptive clustering module is used for processing, which can automatically adjust the model parameters according to the characteristics of different scenes and environments, so that the vehicle logo detection network can better adapt to complex and changeable road conditions and lighting scenes, thereby improving the robustness and generalization ability of detection.
[0108] Optionally, the device further comprises:
[0109] The first image module is used to obtain the vehicle logo name and obtain the vehicle logo image corresponding to the vehicle logo name;
[0110] The first segmentation module segments the vehicle logo image and extracts the vehicle logo symbol in the vehicle logo image.
[0111] Optionally, the first sample module 401 includes:
[0112] The first mask module is used to obtain the segmentation mask of the vehicle logo detection sample and obtain the circumscribed minimum rectangle of the segmentation mask;
[0113] A first judgment module, configured to reduce the length and width of the segmentation mask by half if the length of the circumscribed minimum rectangle exceeds a first threshold;
[0114] A first construction submodule is configured to obtain a plurality of background images, place a first number of vehicle logo detection samples in the background images, and obtain pseudo label data;
[0115] The length and width of the circumscribed minimum rectangle are the length and width of the vehicle logo detection sample, and multiple vehicle logos placed in the same background image do not overlap each other.
[0116] Optionally, the first training module 403 includes:
[0117] A first sub-feature module, used for inputting the pseudo-label data into the preset vehicle logo detection network for chain residual pooling processing to obtain a first sub-feature;
[0118] A first convolution module, used for inputting the first sub-feature into a first convolution pool to obtain the first convolution result;
[0119] A second convolution module, used for inputting the first sub-feature into a second convolution pool to obtain the second convolution result;
[0120] A first output module, configured to first scale, normalize and scale the first convolution result to obtain the first output result;
[0121] The second output module is used to perform clustering processing on the second convolution result according to the first clustering module to obtain the second output result, wherein the first clustering module is an adaptive clustering module based on a hash function.
[0122] Optionally, the first detection module 404 includes:
[0123] A first pooling module, used for inputting the first combination result into a pooling layer for pooling processing to obtain a pooling result;
[0124] A detection frame acquisition module, used to input the pooling result into a fully connected layer for dense processing to obtain a detection frame corresponding to the vehicle logo detection sample;
[0125] The category acquisition module is used to normalize the pooling results to obtain category information corresponding to the vehicle logo detection sample.
[0126] Optionally, the first network module 405 includes:
[0127] A back propagation module, used for performing back propagation according to the loss function value of the loss function;
[0128] A parameter updating module, used to update the weight and bias parameters of the preset vehicle logo detection network in combination with the output result of back propagation;
[0129] The cyclic training module is used to perform cyclic training on the preset vehicle logo detection network, and obtain the trained vehicle logo detection network when the cumulative number of training rounds reaches a second threshold, or when the preset vehicle logo detection network meets the convergence condition.
[0130] In a possible implementation, the device may further include:
[0131] A candidate region module, used to obtain a second loss function and obtain a candidate region output by the trained vehicle logo detection network;
[0132] an ignoring loss module, configured to ignore the loss function value corresponding to the candidate region if the overlapping area between the candidate region and the segmentation mask of the vehicle logo detection sample is less than a third threshold;
[0133] The second loss module is used to adjust the network parameters of the trained vehicle logo detection network according to the loss function value of the second loss function if the overlapping area between the candidate area and the segmentation mask of the vehicle logo detection sample exceeds the third threshold.
[0134] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0135] Reference Figure 5 The embodiment of the present application also provides an electronic device 500, including a memory 520, a processor 510, and a program stored in the memory and executable on the processor; wherein the processor is configured to read the program on the memory and execute the training method of the vehicle logo detection network disclosed in any of the above embodiments.
[0136] The memory 520 can be used to store the computer program and / or module. The processor 510 implements various functions of the training device for the vehicle logo detection network by running or executing the computer program and / or module stored in the memory 520 and calling the data stored in the memory 520. The memory 520 may include a random access memory (RAM) or a non-volatile memory, such as at least one disk storage. Optionally, the memory 520 may also be at least one storage device located away from the aforementioned processor.
[0137] The above-mentioned processor 510 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.
[0138] An embodiment of the present application also provides a non-volatile readable storage medium. When the instructions in the non-volatile readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the steps in the training method of the vehicle logo detection network disclosed in the embodiment of the present application.
[0139] Based on the same inventive concept, the present application also provides a vehicle, which may specifically include a training device for the vehicle logo detection network disclosed in the embodiment of the present application.
[0140] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0141] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "including one..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.
[0142] The above is a detailed introduction to the training method and device for a vehicle logo detection network provided by the present application. This article uses specific examples to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for general technical personnel in this field, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A training method for a vehicle logo detection network, characterized in that: The method comprises: Obtain a vehicle logo, perform self-supervised pre-training on the vehicle logo, and obtain a vehicle logo detection sample; Combining the vehicle logo detection sample with a preset background image to construct pseudo label data corresponding to the vehicle logo detection sample, wherein the pseudo label data includes label annotation information based on the vehicle logo detection sample; Inputting the pseudo-label data into a preset vehicle logo detection network for convolution processing, obtaining a first convolution result and a second convolution result respectively, performing scaling processing on the first convolution result to obtain a first output result, and performing clustering processing on the second convolution result according to a first clustering module to obtain a second output result, wherein the first clustering module is an adaptive clustering module based on a hash function; Combining the first output result with the second output result to obtain a first combined result, and performing pooling processing on the first combined result to obtain label detection information corresponding to the vehicle logo detection sample; According to the label annotation information and the label detection information, a loss function for the preset vehicle logo detection network is calculated, and network parameters of the preset vehicle logo detection network are adjusted according to the loss function. The training is repeated until the training end condition is met to obtain a trained vehicle logo detection network.
2. The method according to claim 1, characterized in that Before obtaining the vehicle logo, performing self-supervised pre-training on the vehicle logo, and obtaining a vehicle logo detection sample, the method further includes: Obtain a vehicle logo name, and obtain a vehicle logo image corresponding to the vehicle logo name; The vehicle logo image is segmented to extract the vehicle logo symbol in the vehicle logo image.
3. The method according to claim 1, characterized in that The step of combining the vehicle logo detection sample with a preset background image to construct pseudo label data corresponding to the vehicle logo detection sample includes: Obtaining a segmentation mask of the vehicle logo detection sample, and obtaining a minimum circumscribed rectangle of the segmentation mask; If the length of the circumscribed minimum rectangle exceeds the first threshold, the length and width of the segmentation mask are both reduced by half; Acquire a number of background images, place a first number of vehicle logo detection samples in the background images, and obtain the pseudo label data; The length and width of the circumscribed minimum rectangle are the length and width of the vehicle logo detection sample, and the multiple vehicle logos placed in the same background image do not overlap each other.
4. The method according to claim 1, characterized in that: The step of inputting the pseudo-label data set into a preset vehicle logo detection network for convolution processing, obtaining a first convolution result and a second convolution result respectively, and performing scaling processing on the first convolution result to obtain a first output result includes: Inputting the pseudo-label data into the preset vehicle logo detection network to perform chain residual pooling processing to obtain a first sub-feature; Inputting the first sub-feature into a first convolution pool to obtain the first convolution result, and inputting the first sub-feature into a second convolution pool to obtain the second convolution result; Scaling, normalizing, and scaling the first convolution result to obtain the first output result.
5. The method according to claim 1, characterized in that The label detection information corresponding to the vehicle logo detection sample includes at least a detection frame and category information of the vehicle logo detection sample, and the pooling process is performed on the first combination result to obtain the label detection information corresponding to the vehicle logo detection sample, including: Inputting the first combination result into the pooling layer for pooling processing to obtain a pooling result; Input the pooling result into the fully connected layer for dense processing to obtain the detection frame corresponding to the vehicle logo detection sample; The pooling result is normalized to obtain category information corresponding to the vehicle logo detection sample.
6. The method according to claim 1, characterized in that The step of adjusting the network parameters of the preset vehicle logo detection network according to the loss function, and cyclically training until a training end condition is met to obtain a trained vehicle logo detection network includes: Perform back propagation according to the loss function value of the loss function; Update the weight and bias parameters of the preset vehicle logo detection network in combination with the output result of back propagation; Execute cyclic training on the preset vehicle logo detection network, and obtain a trained vehicle logo detection network when the cumulative number of training rounds reaches a second threshold, or when the preset vehicle logo detection network meets a convergence condition.
7. The method according to claim 6, characterized in that After the cyclic training is performed until the training end condition is met and the trained vehicle logo detection network is obtained, the method further includes: Obtaining a second loss function, and obtaining a candidate region output by the trained vehicle logo detection network; If the overlapping area between the candidate area and the segmentation mask of the vehicle logo detection sample is less than a third threshold, the loss function value corresponding to the candidate area is ignored; If the overlapping area between the candidate area and the segmentation mask of the vehicle logo detection sample exceeds the third threshold, the network parameters of the trained vehicle logo detection network are adjusted according to the loss function value of the second loss function.
8. A training device for a vehicle logo detection network, characterized in that: The device comprises: The first sample module is used to obtain a vehicle logo, perform self-supervised pre-training on the vehicle logo, and obtain a vehicle logo detection sample; A first construction module is used to combine the vehicle logo detection sample with a preset background image to construct pseudo label data corresponding to the vehicle logo detection sample, wherein the pseudo label data includes label annotation information based on the vehicle logo detection sample; A first training module is used to input the pseudo-label data into a preset vehicle logo detection network for convolution processing, obtain a first convolution result and a second convolution result respectively, perform scaling processing on the first convolution result to obtain a first output result, and perform clustering processing on the second convolution result according to a first clustering module to obtain a second output result, wherein the first clustering module is an adaptive clustering module based on a hash function; A first detection module, used for combining the first output result with the second output result to obtain a first combination result, and performing pooling processing on the first combination result to obtain label detection information corresponding to the vehicle logo detection sample; The first network module is used to calculate the loss function for the preset vehicle logo detection network according to the label annotation information and the label detection information, and adjust the network parameters of the preset vehicle logo detection network according to the loss function, and perform cyclic training until the training end condition is met to obtain the trained vehicle logo detection network.
9. An electronic device, comprising: one or more processors; Memory; One or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to execute the training method of the vehicle logo detection network described in any one of claims 1-7.
10. A readable storage medium, comprising: A computer-readable storage medium stores a computer program used in combination with an electronic device, wherein the computer program can be executed by a processor to complete the training method of a vehicle logo detection network as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Vehicle detection method based on multistage convolution feature cascading
CN112926495A
Method for detecting target in high-resolution aerial image
CN116310321A