Model training method, recognition method, device, equipment and storage medium

By using labeled vehicle type images and preset neural networks for model training, the vehicle recognition model is generated, and the cost problem that deep models require professional labeling is solved, and the function of identifying fine-grained features of the vehicle is realized.

CN112396003BActive Publication Date: 2025-03-28PING AN TECH (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202011312180.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-11-20
Publication Date
2025-03-28
Estimated Expiration
2040-11-20

AI Technical Summary

Technical Problem

Existing depth models require professionals to label training samples, resulting in higher costs.

Method used

By obtaining the labeled vehicle type image, a preset neural network is determined, and its loss function includes a full connection loss function, a distance loss function, a region loss function and an area loss function, and model training is performed to generate a vehicle identification model.

Benefits of technology

Without labeling fine-grained features, model training is carried out with the assistance of the above loss function to train a vehicle recognition model that recognizes fine-grained features of the vehicle, reducing training costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112396003B_ABST
    Figure CN112396003B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of artificial intelligence technology, and discloses a vehicle recognition model training method, a vehicle recognition method, a device, a computer device and a computer-readable storage medium. The method comprises: obtaining a vehicle type image with a label; determining a preset neural network, wherein the loss function of the preset neural network comprises a full connection loss function for learning vehicle classification information, a distance loss function for learning attribute information of a vehicle feature identifier, a region loss function for learning vehicle feature relationships, and an area loss function for learning hierarchical relationships of cut regions; inputting the vehicle type image with a label into the preset neural network for model training; if the model to be trained converges, generating a vehicle recognition model, realizing model training with the assistance of a full connection loss function, a distance loss function, a region loss function and an area loss function without annotating fine-grained features, and training a vehicle recognition model for recognizing fine-grained features of vehicles.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence technology, and in particular to a vehicle identification model training method, a vehicle identification method, an apparatus, a computer device, and a computer-readable storage medium. Background Art

[0002] Computer vision (CV) is the process of using machines to understand and analyze images, and is an important branch of artificial intelligence. In various research fields of CV, fine-grained image analysis is a long-standing fundamental problem, and it is ubiquitous in various practical applications (such as bird species, car models, product recognition, etc.). The small changes between classes and large changes within classes caused by fine-grained characteristics make this problem extremely challenging. With the deepening of deep learning in image recognition, deep models have an increasing demand for data, and the demand for high-quality labeled data is also increasing. However, with the geometric growth of data volume and the increasing importance of annotation details, high-quality labeled data requires professionals to annotate training samples, which leads to high costs. Summary of the invention

[0003] The main purpose of this application is to provide a vehicle identification model training method, a vehicle identification method, an apparatus, a computer device and a computer-readable storage medium, aiming to solve the technical problem that the existing deep model requires professionals to label the training samples, resulting in high costs.

[0004] In a first aspect, the present application provides a vehicle recognition model training method, the vehicle recognition model training method comprising the following steps:

[0005] Acquire data to be trained, wherein the data to be trained includes labeled vehicle type images;

[0006] Determine a preset neural network, wherein the loss function of the preset neural network includes a full connection loss function, a distance loss function, a region loss function and an area loss function;

[0007] Inputting the labeled vehicle type image into the preset neural network for model training;

[0008] If the training model converges, generate a vehicle recognition model;

[0009] Among them, the fully connected loss function is used to learn vehicle classification information, the distance loss function learns the attribute information of the feature identifier, the region loss function learns the vehicle feature relationship information, and the area loss function learns the hierarchical relationship of the cut area.

[0010] In a second aspect, the present application provides a vehicle identification method, the vehicle identification method comprising the following steps:

[0011] Acquire a vehicle image, wherein the vehicle image includes a first vehicle image and a second vehicle image;

[0012] Recognize the vehicle image based on the vehicle recognition model to obtain a first vehicle fine-grained feature of the first vehicle image, and obtain a second vehicle fine-grained feature of the second vehicle image, wherein the vehicle recognition model is obtained by training the aforementioned vehicle recognition model;

[0013] It is determined whether the vehicle in the first vehicle image and the vehicle in the second vehicle image are the same vehicle according to the first vehicle fine-grained feature and the second vehicle fine-grained feature.

[0014] In a third aspect, the present application further provides a vehicle recognition model training device, the vehicle recognition model training device comprising:

[0015] A first acquisition module is used to acquire data to be trained, wherein the data to be trained includes vehicle type images with labels;

[0016] A first determination module is used to determine a preset neural network, wherein the loss function of the neural network includes a full connection loss function, a distance loss function, a region loss function and an area loss function, wherein the full connection loss function is used to learn vehicle classification information, the distance loss function learns the metric of the feature identifier, the region loss function learns vehicle feature relationship information, and the area loss function learns the hierarchical relationship of the cut area;

[0017] A training module, used for inputting the labeled vehicle type image into the preset neural network for model training;

[0018] A generation module is used to generate a vehicle recognition model if the model to be trained converges.

[0019] In a fourth aspect, the present application further provides a vehicle identification device, the vehicle identification device comprising:

[0020] A second acquisition module, used to acquire a vehicle image, wherein the vehicle image includes a first vehicle image and a second vehicle image;

[0021] a third acquisition module, configured to recognize the vehicle image based on the vehicle recognition model to obtain a first vehicle fine-grained feature of the first vehicle image and a second vehicle fine-grained feature of the second vehicle image, wherein the vehicle recognition model is obtained by training the aforementioned vehicle recognition model;

[0022] The second determination module is used to determine whether the vehicles in the first vehicle image and the second vehicle image are the same vehicle according to the first vehicle fine-grained feature and the second vehicle fine-grained feature.

[0023] In a fifth aspect, the present application also provides a computer device, comprising a processor, a memory, and a computer program stored in the memory and executable by the processor, wherein when the computer program is executed by the processor, it implements the steps of the vehicle identification model training method as described above, and implements the steps of the vehicle identification method as described above.

[0024] In a sixth aspect, the present application also provides a computer-readable storage medium, on which a computer program is stored, wherein when the computer program is executed by a processor, the steps of the vehicle identification model training method as described above and the steps of the vehicle identification method as described above are implemented.

[0025] The present application provides a vehicle recognition model training method, a vehicle recognition method, an apparatus, a computer device and a computer-readable storage medium, which obtain data to be trained, wherein the data to be trained includes labeled vehicle type images; determine a preset neural network, and the loss function of the preset neural network includes a full connection loss function, a distance loss function, a regional loss function and an area loss function, wherein the full connection loss function is used to learn vehicle classification information, the distance loss function is used to learn attribute information of a vehicle feature identifier, the regional loss function is used to learn vehicle feature relationships, and the area loss function is used to learn hierarchical relationships of cut areas; input the labeled vehicle type images into the preset neural network for model training; if the model to be trained converges, a vehicle recognition model is generated, and model training is performed with the assistance of the full connection loss function, the distance loss function, the regional loss function and the area loss function without labeling fine-grained features, so as to train a vehicle recognition model that recognizes fine-grained features of vehicles. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0027] Figure 1 A flow chart of a vehicle recognition model training method provided in an embodiment of the present application;

[0028] Figure 2 A schematic diagram of a vehicle identification method provided in an embodiment of the present application;

[0029] Figure 3 for Figure 2 A schematic flow chart of sub-steps of a vehicle identification method in FIG.

[0030] Figure 4 A schematic block diagram of a vehicle recognition model training device provided in an embodiment of the present application;

[0031] Figure 5 A schematic block diagram of a vehicle identification device provided in an embodiment of the present application;

[0032] Figure 6 The present invention is a block diagram showing the structure of a computer device according to an embodiment of the present application.

[0033] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0034] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are 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 this application.

[0035] The flowcharts shown in the accompanying drawings are only examples and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may be decomposed, combined or partially merged, so the actual execution order may change according to actual conditions.

[0036] The embodiments of the present application provide a vehicle recognition model training method, a vehicle recognition method, an apparatus, a computer device, and a computer-readable storage medium. The vehicle recognition model training method and the vehicle recognition method can be applied to a computer device, which can be an electronic device such as a laptop computer, a desktop computer, or a server.

[0037] In conjunction with the accompanying drawings, some embodiments of the present application are described in detail below. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.

[0038] Please refer to Figure 1 , Figure 1 A flowchart of a vehicle recognition model training method provided in an embodiment of the present application.

[0039] like Figure 1 As shown, the vehicle recognition model training method includes steps S101 to S104.

[0040] Step S101: Acquire data to be trained, wherein the data to be trained includes labeled vehicle type images.

[0041] Exemplarily, data to be trained is obtained, and the data to be trained includes labeled vehicle type images. The labeled vehicle type images include images of various vehicle types, for example, images of various models such as BMW, Mercedes-Benz, and Audi, wherein the images of each model also include various colors, for example, red, white, and the like.

[0042] Step S102: Determine a preset neural network.

[0043] Among them, the loss function of the preset neural network includes a fully connected loss function, a distance loss function, a regional loss function and an area loss function, wherein the fully connected loss function is used to learn vehicle classification information, the distance loss function is used to learn the attribute information of the vehicle feature identifier, the regional loss function is used to learn the vehicle feature relationship, and the area loss function is used to learn the hierarchical relationship of the cutting area.

[0044] Exemplarily, a preset neural network is determined, and the loss function of the preset neural network includes a full connection loss function, a distance loss function, a region loss function, and an area loss function. The preset neural network is stored in a blockchain, and the preset neural network is determined from the blockchain. The full connection loss function includes a softmax loss loss function and a softmax rank loss loss function, and the softmax loss loss function is used to learn the accuracy of vehicle classification; the softmax rank loss loss function is used to learn the increasing relationship of the vehicle classification accuracy. The distance loss function includes a triplet loss loss function and a triplet rank loss loss function, and the triplet loss loss function is used to learn the metric of the vehicle feature identifier; the triplet rank loss loss function is used to learn the increasing relationship of the metric relationship of the vehicle feature identifier. The region loss function includes a region loss loss function, and the region loss loss function is used to learn the vehicle feature relationship, wherein the vehicle feature relationship includes the symmetric relationship of the headlights about the license plate-car logo axis, the left and right relationship of the two headlights, the up and down relationship of the car logo and the license plate, the angle relationship between the key point connection lines, etc. The area loss function includes an area loss loss function, and the area loss loss function is used to learn the hierarchical relationship of the cutting area.

[0045] For example, the type of the vehicle type image to be trained is predicted by the preset softmax function of the preset neural network, and the predicted type value is obtained, and the softmax loss function is trained by the label value of the vehicle type image to be trained and the predicted type value. For example, the softmax loss function is Among them, y′ is the label value, which includes 0 and 1, 1 is the correct type, and 0 is the wrong type; y is the predicted value. Through the label value, predicted value and softmax loss function, it is determined whether the preset neural network parameters need to be optimized. The preset neural network predicts the type of the vehicle type image to be trained, and obtains the probability value of the prediction being type T. The preset neural network predicts the type of the vehicle type image to be trained, and obtains the probability values ​​of the prediction being type T twice, that is, and According to the preset softmax rank loss function, and Determine whether the preset neural network parameters need to be optimized. For example, the preset softmax rank loss function is in, is the first probability value of type T, is the second probability value of type T, and M is the preset threshold. Based on the preset neural network, the Euclidean distance of the same feature and the Euclidean distance of different features in the vehicle type image to be trained are obtained, and according to the preset triplet loss function, it is determined whether the preset neural network parameters need to be optimized. For example, the preset triplet loss function is L tr =max[(D ap +MD an ),0], where D ap is the Euclidean distance of the same feature, D an is the Euclidean distance of different features, where D ap In the above equation, D is the distance, Dap is the distance between the target feature anchor and the positive feature positive, the anchor and positive belong to the same category of features, and the distance, anchor and positive are triplet losses; D an In the equation, D is the distance. anis the distance between the target feature anchor and the negative feature Negative. Anchor and Negative belong to different classes of features. Distance, anchor and Negative are triplet losses. According to the preset triplet rank loss function, determine whether the preset neural network parameters need to be optimized. For example, the first Value, first Value and first Value, based on the triplet loss function Wherein, M is a preset threshold. According to the preset neural network positioning, the symmetric relationship between the license plate and the logo axis, the left-right relationship between the two headlights, and the up-down relationship between the logo and the license plate in the vehicle type image to be trained are obtained. Based on the preset region loss loss function, the symmetric relationship between the license plate and the logo axis, the left-right relationship between the two headlights, and the up-down relationship between the logo and the license plate, it is determined whether the preset neural network parameters need to be optimized. For example, the preset region loss loss function is L loc =L sym +L pos +L angle , where L sym is the symmetry relationship between the license plate and the logo axis, L pos is the left-right relationship between the two headlights, L angle is the upper and lower relationship of the vehicle logo and license plate. According to the preset neural network positioning, the first area in the vehicle type image to be trained is obtained, the second area in the first area is obtained based on the preset neural network positioning, and the third area in the second area is obtained based on the preset neural network positioning. Based on the preset area loss loss function, the first area, the second area and the third area, it is determined whether the preset neural network parameters need to be optimized. For example, the preset area loss loss function is in, For the first region, For the second region, The third area.

[0046] Step S103: input the labeled vehicle type image into the preset neural network for model training.

[0047] Exemplarily, a labeled vehicle type image is input into a preset neural network, and the loss function of the neural network in the model is trained by the labeled vehicle type image. For example, the preset softmax loss function is the standard loss of the classification network, which is specifically expressed as follows: when the category predicted by the network is consistent with the category of the label, the first loss value is less than or equal to the first preset loss value, and the network parameters do not change; when the category predicted by the network is inconsistent with the category of the label, the first loss value is greater than the first preset loss value, and the network parameters need to be adjusted using the gradient descent method, where the first loss value is H y′ The preset softmax rank loss function is based on the softmax loss function, with rank sorting added. The specific expression is: when the network is positioned from coarse to fine and then to precise, the probability of predicting the corresponding category gradually increases, and it is determined that the positioning is relatively accurate. When the second loss value is less than or equal to the second preset loss value, the positioning is determined to be accurate; otherwise, when the second loss value is greater than the second preset loss value, the positioning is determined to be inaccurate, where the second loss value is L smr The role of this rank is to drive the network to gradually increase the prediction probability in the process of moving from coarse to fine targets. The preset triplet loss function is the third loss value of the metric calculation. It solves the defect that the softmax loss function can only classify but not separate sufficiently. The triplet loss function can make the features of the same vehicle close enough and the features of different vehicles far enough apart. The third loss value is L tr When the third loss value is less than or equal to the third preset loss value, it is determined that the preset neural network parameters do not need to be optimized; when the third loss value is greater than the third preset loss value, it is determined that the preset neural network parameters need to be optimized. The preset triplet rank loss function is the fourth loss value obtained on the basis of the triplet loss function, and the rank sorting is added, so that the distance between the detail features of the same vehicle gradually approaches in an orderly manner during the process of being positioned more accurately, which conforms to the visual perception characteristics. Among them, the fourth loss value is L trIf the fourth loss value is less than or equal to the fourth preset loss value, it is determined that the preset neural network parameters do not need to be optimized; if the fourth loss value is greater than the fourth preset loss value, it is determined that the preset neural network parameters need to be optimized. The preset region loss loss function is to make the located headlights have a left-right symmetrical relationship with respect to the axis of the vehicle logo and the license plate, and at the same time, the located license plate and the window sticker have an up-down relationship. When the fifth loss value is obtained based on the preset region loss loss function, if the fifth loss value is less than or equal to the fifth preset loss value, it is determined that the preset neural network parameters do not need to be optimized; if the fifth loss value is greater than the fifth preset loss value, it is determined that the preset neural network parameters need to be optimized, wherein the fifth loss value is L loc The preset area loss function is that the area of ​​the rear of the vehicle is gradually shrunk from coarse to fine positioning. If the sixth loss value is obtained based on the preset area loss function, if the sixth loss value is less than or equal to the sixth preset loss value, it is determined that the preset neural network parameters do not need to be optimized; when the sixth loss value is greater than the sixth preset loss value, it is determined that the preset neural network parameters need to be optimized, wherein the sixth loss value is L area If the preset neural network parameters need to be optimized, the preset neural network model is trained by presetting a first loss value of a softmax loss function, a second loss value of a softmax rank loss function, a third loss value of a triplet loss function, a fourth loss value of a triplet rank loss function, a fifth loss value of a region loss function, and a sixth loss value of a preset area loss function.

[0048] Step S104: If the training model converges, generate a vehicle recognition model.

[0049] Exemplarily, when it is determined that the model to be trained has converged, a corresponding vehicle recognition model is generated. For example, the method for determining whether the model to be trained has converged includes obtaining a first loss value in a softmax loss function, and if the value is less than or equal to a preset first loss value, determining that the model to be trained has converged; and / or, obtaining a second loss value in a softmax rank loss function, and if the value is less than or equal to a preset second loss value, determining that the model to be trained has converged; and / or, obtaining a third loss value in a triplet loss function, and if the value is less than or equal to a preset third loss value, determining that the model to be trained has converged; and / or, obtaining a fourth loss value in a triplet rank loss function, and if the value is less than or equal to a preset fourth loss value, determining that the model to be trained has converged; and / or, obtaining a fifth loss value in a region loss function, and if the value is less than or equal to a preset fifth loss value, determining that the model to be trained has converged; and / or, obtaining a sixth loss value in an area loss function, and if the value is less than or equal to a preset sixth loss value, determining that the model to be trained has converged, and generating a corresponding vehicle recognition model.

[0050] In an embodiment of the present invention, a vehicle type image with a label is input into a preset neural network for model training. The preset neural network includes a fully connected loss function, a distance loss function, a regional loss function and an area loss function. If the model to be trained converges, a vehicle recognition model is generated. In the absence of labeled fine-grained features, model training is performed with the assistance of the fully connected loss function, the distance loss function, the regional loss function and the area loss function, and a vehicle recognition model that recognizes the fine-grained features of the vehicle is trained.

[0051] Please refer to Figure 2 , Figure 2 A schematic flow chart of a vehicle identification method provided in an embodiment of the present application.

[0052] like Figure 2 As shown, the vehicle identification method includes steps S201 to S203.

[0053] Step S201: Acquire vehicle images, where the vehicle images include a first vehicle image and a second vehicle image.

[0054] Exemplarily, a vehicle image to be predicted is obtained, the vehicle image including a first vehicle image and a second vehicle image, and the first vehicle image and the second vehicle image are respectively input into a vehicle recognition model, the vehicle recognition model is obtained by training a preset neural network through labeled vehicle type image training input.

[0055] Step S202: Identify the vehicle image based on the vehicle recognition model to obtain a first vehicle fine-grained feature of the first vehicle image and a second vehicle fine-grained feature of the second vehicle image.

[0056] Exemplarily, based on the vehicle recognition model, the vehicle image is recognized to obtain a first vehicle fine-grained feature of the first vehicle image output by the vehicle recognition model, and a second vehicle fine-grained feature of the second vehicle image output by the vehicle recognition model is obtained. For example, the first vehicle image and the second vehicle image are recognized respectively to obtain a first vehicle fine-grained feature of the first vehicle image output by the vehicle recognition model, and a second vehicle fine-grained feature of the second vehicle image output by the vehicle recognition model is obtained, wherein the vehicle recognition model includes a first path network, a second path network, and a third path network.

[0057] In one embodiment, specifically, referring to Figure 3 , step S202 includes: sub-step S2021 to sub-step S2026.

[0058] Sub-step S2021: determining the vehicle type in the first vehicle image based on the classification function of the first road network.

[0059] Exemplarily, the first path network includes a classification function, through which the vehicle type in the first vehicle image is determined. For example, the vehicle type in the first vehicle image is determined to be a sedan, a medium-sized truck, etc. through the classification function.

[0060] Sub-step S2022: extracting first vehicle coarse-grained features in the first vehicle image according to a first feature extraction function corresponding to the vehicle type.

[0061] Exemplarily, the first path network includes a first feature extraction function, and the corresponding first feature extraction function is determined according to the vehicle type, and the first vehicle coarse-grained feature in the first vehicle image is extracted by the first feature extraction function. For example, the first path network includes a first feature extraction function as an extract feature function, and the first vehicle coarse-grained feature in the first vehicle image is extracted by the extract feature function, for example, the rear end of the vehicle in the first vehicle image is extracted, and the rear end of the vehicle is used as the first vehicle coarse-grained feature.

[0062] Sub-step S2023: locating the first vehicle coarse-grained feature based on the first positioning function of the second road network, and obtaining a plurality of first coordinates in the first vehicle coarse-grained feature.

[0063] Exemplarily, the second network includes a first positioning function, through which the first vehicle coarse-grained feature is located, and multiple first coordinates in the first vehicle coarse-grained feature are obtained. For example, the second network includes a first positioning function locate, through which the first vehicle coarse-grained feature is located to obtain the corresponding five first coordinates, for example, the rear of the vehicle is located to obtain the approximate position of the lights, license plate, logo, window sticker and center of the rear area of ​​the vehicle, and the center is the center position of the lights, license plate, logo, and window sticker.

[0064] Sub-step S2024: obtaining first sub-images corresponding to the multiple first coordinates by cutting and enlarging the ranges corresponding to the multiple first coordinates.

[0065] Exemplarily, when a plurality of first coordinates are obtained, the regions corresponding to the plurality of first coordinates are cut to obtain the regions corresponding to the plurality of first coordinates. When the regions corresponding to the first coordinates are obtained, the regions are amplified to obtain the first sub-images corresponding to the plurality of first coordinates. For example, when five first coordinates are obtained, the regions corresponding to the five first coordinates are cropped and amplified to obtain a rear image of the vehicle with enlarged details, wherein the rear image of the vehicle is the first vehicle sub-image.

[0066] Sub-step S2025: extracting first vehicle fine-grained features in the first vehicle sub-image based on the second feature extraction function of the second road network.

[0067] Exemplarily, the second path network includes a second feature extraction function, through which the first vehicle fine-grained features in the first sub-image are extracted. For example, the second path network includes a second feature extraction function as an extract feature function, through which the first vehicle fine-grained features in the first vehicle sub-image are extracted, for example, the approximate positions of the headlights, license plates, logos, and window stickers are extracted, and the approximate positions are used as the first vehicle fine-grained features.

[0068] Sub-step S2026: obtaining first vehicle fine-grained features of the first vehicle image according to the third road network and the first vehicle fine-grained features, and outputting the first vehicle fine-grained features.

[0069] Exemplarily, the first vehicle fine-grained features of the first vehicle image are obtained through the third network and the first vehicle fine-grained features, and the first vehicle fine-grained features are output. For example, the first vehicle fine-grained features are identified through the third network to obtain the headlights, license plates, logos, and window stickers of the first vehicle fine-grained features, and the headlights, license plates, logos, and window stickers are used as the first vehicle fine-grained features.

[0070] Specifically, the method of obtaining the first vehicle fine-grained features of the first vehicle image based on the third road network and the first vehicle fine-grained features includes: locating the first vehicle fine-grained features based on the second positioning function of the third road network, and obtaining multiple second coordinates in the first vehicle fine-grained features; obtaining a second sub-image corresponding to the multiple second coordinates by cutting and enlarging the range corresponding to the multiple second coordinates; and obtaining the first vehicle fine-grained features in the second sub-image based on the third feature extraction function of the third road network.

[0071] Exemplarily, the third network includes a second positioning function, through which the first vehicle fine-grained feature is positioned, and multiple second coordinates in the first vehicle fine-grained feature are obtained. For example, the third network includes a second positioning function locate, through which the first vehicle fine-grained feature is positioned to obtain five corresponding second coordinates, for example, the five second coordinates are the center positions of the headlights, license plates, logos, or window stickers in the rear area of ​​the vehicle, and the center is the center position of the headlights, license plates, logos, and window stickers.

[0072] When multiple second coordinates are obtained, the regions corresponding to the multiple second coordinates are cut to obtain the regions corresponding to the multiple second coordinates. When the regions corresponding to the multiple second coordinates are obtained, the regions are amplified to obtain the second sub-images corresponding to the multiple second coordinates. For example, when five second coordinates are obtained, the regions corresponding to the five second coordinates are cropped and amplified to obtain a magnified detail image of a headlight, a license plate, a car logo or a car window sticker, wherein the headlight, license plate, car logo or car window sticker is the second sub-image.

[0073] The third network includes a third feature extraction function, through which the fine-grained features of the first vehicle in the second sub-image are extracted. For example, the third network includes a third feature extraction function as an extractfeature function, through which the fine-grained features of the first vehicle in the second sub-image are extracted, for example, the position of the headlight, license plate, logo or window sticker is extracted, and the position of the headlight, license plate, logo or window sticker is used as the fine-grained feature of the first vehicle.

[0074] Step S203: Determine whether the vehicle in the first vehicle image and the vehicle in the second vehicle image are the same vehicle based on the first vehicle fine-grained features and the second vehicle fine-grained features.

[0075] Exemplarily, when the first vehicle fine-grained feature and the second vehicle fine-grained feature are obtained, the first vehicle fine-grained feature and the second vehicle fine-grained feature are compared. If the first vehicle fine-grained feature and the second vehicle fine-grained feature are the same, it is determined that the vehicle in the first vehicle image corresponding to the first vehicle fine feature and the vehicle in the second vehicle image corresponding to the second vehicle fine feature are the same vehicle. For example, the headlights in the first vehicle image are compared with the headlights in the second vehicle image. If they are the same, it is determined that the vehicle in the first vehicle image and the vehicle in the second vehicle image are the same vehicle.

[0076] In this embodiment, the recognition model is used to respectively identify the first vehicle image and the second vehicle image, identify the first fine-grained features of the first vehicle image and the second fine-grained features of the second vehicle image, and determine whether the vehicle in the first vehicle image and the vehicle in the second vehicle image are the same vehicle based on the first fine-grained features and the second fine-grained features, thereby realizing the identification of the fine-grained features in the first vehicle image and the second vehicle image without labeling the fine-grained features in the first vehicle image and / or the second vehicle image.

[0077] Please refer to Figure 4 , Figure 4 A schematic block diagram of a vehicle recognition model training device provided in an embodiment of the present application.

[0078] like Figure 4 As shown, the vehicle recognition model training device 400 includes: a first acquisition module 401, a first determination module 402, a training module 403, and a generation module 404.

[0079] A first acquisition module 401 is used to acquire data to be trained, wherein the data to be trained includes vehicle type images with labels;

[0080] A first determination module 402 is used to determine a preset neural network, wherein the loss function of the neural network includes a full connection loss function, a distance loss function, a region loss function and an area loss function;

[0081] A training module 403, used for inputting the labeled vehicle type image into the preset neural network for model training;

[0082] A generating module 404 is used to generate a vehicle recognition model if the model to be trained converges;

[0083] Among them, the fully connected loss function is used to learn vehicle classification information, the distance loss function learns the metric of the feature identifier, the region loss function learns vehicle feature relationship information, and the area loss function learns the hierarchical relationship of the cut area.

[0084] The training module 403 is also specifically used for:

[0085] Learning vehicle classification accuracy based on the first loss function;

[0086] An increasing relationship of vehicle classification accuracy is learned based on the second loss function.

[0087] The training module 403 is also specifically used for:

[0088] learning a metric for a vehicle feature identifier based on the third loss function;

[0089] An incremental relationship of the metric relationship of the vehicle feature identifier is learned based on the fourth loss function.

[0090] It should be noted that technicians in the relevant field can clearly understand that for the convenience and simplicity of description, the specific working process of the above-described device and each module and unit can refer to the corresponding process in the aforementioned vehicle identification model training method embodiment, and will not be repeated here.

[0091] Please refer to Figure 5 , Figure 5 A schematic block diagram of a vehicle identification device provided in an embodiment of the present application.

[0092] like Figure 5 As shown, the vehicle identification device 500 includes: a second acquisition module 501 , a third acquisition module 502 , and a second determination module 503 .

[0093] A second acquisition module 501 is used to acquire a vehicle image, wherein the vehicle image includes a first vehicle image and a second vehicle image;

[0094] A third acquisition module 502 is used to recognize the vehicle image based on the vehicle recognition model to obtain a first vehicle fine-grained feature of the first vehicle image and a second vehicle fine-grained feature of the second vehicle image, wherein the vehicle recognition model is obtained by training the aforementioned vehicle recognition model;

[0095] The second determination module 503 is used to determine whether the vehicle in the first vehicle image and the vehicle in the second vehicle image are the same vehicle according to the first vehicle fine-grained feature and the second vehicle fine-grained feature.

[0096] The third acquisition module 502 is further configured to:

[0097] determining a vehicle type in the first vehicle image based on the classification function of the first road network;

[0098] extracting a first vehicle coarse-grained feature in the first vehicle image according to a first feature extraction function corresponding to the vehicle type;

[0099] Based on the first positioning function of the second road network, locate the first vehicle coarse-grained feature and obtain a plurality of first coordinates in the first vehicle coarse-grained feature;

[0100] Obtaining first sub-images corresponding to the plurality of first coordinates by cutting and enlarging the ranges corresponding to the plurality of first coordinates;

[0101] Extracting a first vehicle fine-grained feature in the first sub-image based on a second feature extraction function of the second path network;

[0102] A first vehicle fine-grained feature of a first vehicle image is obtained according to the third path network and the first vehicle fine-grained feature, and the first vehicle fine-grained feature is output.

[0103] The third acquisition module 502 is further configured to:

[0104] Based on the second positioning function of the third road network, locate the first vehicle fine-grained feature, and obtain a plurality of second coordinates in the first vehicle fine-grained feature;

[0105] Obtaining second sub-images corresponding to the plurality of second coordinates by cutting and enlarging the ranges corresponding to the plurality of second coordinates;

[0106] Based on the third feature extraction function of the third network, a first vehicle fine-grained feature in the second sub-image is obtained.

[0107] It should be noted that those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices and modules and units can refer to the corresponding processes in the aforementioned vehicle identification method embodiment, and will not be repeated here.

[0108] The apparatus provided in the above embodiment may be implemented in the form of a computer program. The computer program may be Figure 6 Runs on the computer device shown.

[0109] See also Figure 6 , Figure 6 A schematic block diagram of the structure of a computer device provided in an embodiment of the present application. The computer device may be a terminal.

[0110] like Figure 6 As shown, the computer device includes a processor, a memory, and a network interface connected via a system bus, wherein the memory may include a non-volatile storage medium and an internal memory.

[0111] The non-volatile storage medium can store an operating system and a computer program. The computer program includes program instructions, and when the program instructions are executed, the processor can execute any vehicle identification model training method and any vehicle identification method.

[0112] The processor is used to provide computing and control capabilities and support the operation of the entire computer equipment.

[0113] The internal memory provides an environment for the operation of the computer program in the non-volatile storage medium. When the computer program is executed by the processor, the processor can execute any vehicle identification model training method and any vehicle identification method.

[0114] The network interface is used for network communication, such as sending assigned tasks, etc. Those skilled in the art will understand that Figure 6 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0115] It should be understood that the processor may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0116] In one embodiment, the processor is used to run a computer program stored in the memory to implement the following steps:

[0117] Acquire data to be trained, wherein the data to be trained includes labeled vehicle type images;

[0118] Determine a preset neural network, wherein the loss function of the preset neural network includes a full connection loss function, a distance loss function, a region loss function and an area loss function;

[0119] Inputting the labeled vehicle type image into the preset neural network for model training;

[0120] If the training model converges, generate a vehicle recognition model;

[0121] Among them, the fully connected loss function is used to learn vehicle classification information, the distance loss function is used to learn attribute information of the vehicle feature identifier, the region loss function is used to learn vehicle feature relationships, and the area loss function is used to learn the hierarchical relationship of the cut area.

[0122] In one embodiment, the processor said fully connected loss function includes a first loss function and a second loss function, and the fully connected loss function is used to implement learning vehicle classification information to achieve:

[0123] Learning vehicle classification accuracy based on the first loss function;

[0124] An increasing relationship of vehicle classification accuracy is learned based on the second loss function.

[0125] In one embodiment, the distance loss function of the processor includes a third loss function and a fourth loss function, and when the distance loss function learns the attribute information of the feature identifier, it is used to implement:

[0126] learning a metric for a vehicle feature identifier based on the third loss function;

[0127] An incremental relationship of the metric relationship of the vehicle feature identifier is learned based on the fourth loss function.

[0128] In one embodiment, the processor is used to run a computer program stored in the memory to implement the following steps:

[0129] Acquire a vehicle image, wherein the vehicle image includes a first vehicle image and a second vehicle image;

[0130] Recognize the vehicle image based on the vehicle recognition model to obtain a first vehicle fine-grained feature of the first vehicle image, and obtain a second vehicle fine-grained feature of the second vehicle image, wherein the vehicle recognition model is obtained by training the aforementioned vehicle recognition model;

[0131] It is determined whether the vehicle in the first vehicle image and the vehicle in the second vehicle image are the same vehicle according to the first vehicle fine-grained feature and the second vehicle fine-grained feature.

[0132] In one embodiment, the vehicle recognition model of the processor includes a first network, a second network and a third network; when the first vehicle fine-grained feature of the first vehicle image output by the vehicle recognition model based on the vehicle recognition model is obtained, it is used to implement:

[0133] determining a vehicle type in the first vehicle image based on the classification function of the first road network;

[0134] extracting a first vehicle coarse-grained feature in the first vehicle image according to a first feature extraction function corresponding to the vehicle type;

[0135] Based on the first positioning function of the second road network, locate the first vehicle coarse-grained feature and obtain a plurality of first coordinates in the first vehicle coarse-grained feature;

[0136] Obtaining first sub-images corresponding to the plurality of first coordinates by cutting and enlarging the ranges corresponding to the plurality of first coordinates;

[0137] Extracting a first vehicle fine-grained feature in the first sub-image based on a second feature extraction function of the second path network;

[0138] A first vehicle fine-grained feature of a first vehicle image is obtained according to the third path network and the first vehicle fine-grained feature, and the first vehicle fine-grained feature is output.

[0139] In one embodiment, when the processor obtains the first vehicle fine-grained feature of the first vehicle image according to the third road network and the first vehicle fine-grained feature, it is used to implement:

[0140] Based on the second positioning function of the third road network, locate the first vehicle fine-grained feature, and obtain a plurality of second coordinates in the first vehicle fine-grained feature;

[0141] Obtaining second sub-images corresponding to the plurality of second coordinates by cutting and enlarging the ranges corresponding to the plurality of second coordinates;

[0142] Based on the third feature extraction function of the third network, a first vehicle fine-grained feature in the second sub-image is obtained.

[0143] An embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored. The computer program includes program instructions. The method implemented when the program instructions are executed can refer to the various embodiments of the vehicle identification model training method and the vehicle identification method of the present application.

[0144] The computer-readable storage medium may be an internal storage unit of the computer device described in the foregoing embodiment, such as a hard disk or memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart memory card (SmartMedia Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc., equipped on the computer device.

[0145] Furthermore, the computer-readable storage medium may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function, etc.; the data storage area may store data created according to the use of the blockchain node, etc.

[0146] The blockchain referred to in the present invention is a new application mode of computer technologies such as storage, point-to-point transmission, consensus mechanism, encryption algorithm, etc. of preset neural networks, models to be trained and vehicle identification models. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the blockchain underlying platform, platform product service layer, and application service layer.

[0147] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system 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 system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.

[0148] The serial numbers of the embodiments of the present application are for description only and do not represent the advantages and disadvantages of the embodiments. The above description is only a specific implementation mode of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present application, and these modifications or replacements should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.

Claims

1. A vehicle recognition model training method, characterized in that: include: Acquire data to be trained, wherein the data to be trained includes labeled vehicle type images; Determine a preset neural network, wherein the loss function of the preset neural network includes a full connection loss function, a distance loss function, a region loss function and an area loss function, wherein the full connection loss function is used to learn vehicle classification information, the distance loss function is used to learn attribute information of a vehicle feature identifier, the region loss function is used to learn vehicle feature relationships, and the area loss function is used to learn hierarchical relationships of cut regions; Inputting the labeled vehicle type image into the preset neural network for model training; If the training model converges, generate a vehicle recognition model; The fully connected loss function includes a first loss function and a second loss function, wherein the first loss function is used to learn the vehicle classification accuracy, and the second loss function is used to learn the increasing relationship of the vehicle classification accuracy.

2. The vehicle recognition model training method according to claim 1, characterized in that: The distance loss function includes a third loss function and a fourth loss function, the third loss function is used to learn the metric of the vehicle feature identifier, and the fourth loss function is used to learn the increasing relationship of the metric relationship of the vehicle feature identifier.

3. A vehicle identification method, characterized in that: The method comprises: Acquire a vehicle image, wherein the vehicle image includes a first vehicle image and a second vehicle image; Recognize the vehicle image based on the vehicle recognition model to obtain a first vehicle fine-grained feature of the first vehicle image, and obtain a second vehicle fine-grained feature of the second vehicle image, wherein the vehicle recognition model is trained by the vehicle recognition model training method according to any one of claims 1 to 2; It is determined whether the vehicle in the first vehicle image and the vehicle in the second vehicle image are the same vehicle according to the first vehicle fine-grained feature and the second vehicle fine-grained feature.

4. The vehicle identification method according to claim 3, characterized in that: The vehicle recognition model includes a first network, a second network and a third network; the vehicle image is recognized based on the vehicle recognition model to obtain a first vehicle fine-grained feature of the first vehicle image, including: determining a vehicle type in the first vehicle image based on the classification function of the first road network; extracting a first vehicle coarse-grained feature in the first vehicle image according to a first feature extraction function corresponding to the vehicle type; Based on the first positioning function of the second road network, locate the first vehicle coarse-grained feature and obtain a plurality of first coordinates in the first vehicle coarse-grained feature; Obtaining first sub-images corresponding to the plurality of first coordinates by cutting and enlarging the ranges corresponding to the plurality of first coordinates; Extracting a first vehicle fine-grained feature in the first sub-image based on a second feature extraction function of the second path network; A first vehicle fine-grained feature of a first vehicle image is obtained according to the third road network and the first vehicle fine-grained feature.

5. The vehicle identification method according to claim 4, characterized in that: The step of obtaining the first vehicle fine-grained feature of the first vehicle image according to the third road network and the first vehicle fine-grained feature comprises: Based on the second positioning function of the third road network, locate the first vehicle fine-grained feature, and obtain a plurality of second coordinates in the first vehicle fine-grained feature; Obtaining second sub-images corresponding to the plurality of second coordinates by cutting and enlarging the ranges corresponding to the plurality of second coordinates; Based on the third feature extraction function of the third network, a first vehicle fine-grained feature in the second sub-image is obtained.

6. A vehicle recognition model training device, characterized in that: include: A first acquisition module is used to acquire data to be trained, wherein the data to be trained includes vehicle type images with labels; A first determination module is used to determine a preset neural network, wherein the loss function of the neural network includes a full connection loss function, a distance loss function, a region loss function and an area loss function, wherein the full connection loss function is used to learn vehicle classification information, the distance loss function learns the metric of the feature identifier, the region loss function learns vehicle feature relationship information, and the area loss function learns the hierarchical relationship of the cut area; A training module, used for inputting the labeled vehicle type image into the preset neural network for model training; A generation module is used to generate a vehicle recognition model if the training model converges; the fully connected loss function includes a first loss function and a second loss function, the first loss function is used to learn the vehicle classification accuracy, and the second loss function is used to learn the increasing relationship of the vehicle classification accuracy.

7. A vehicle identification device, characterized in that: include: A second acquisition module, used to acquire a vehicle image, wherein the vehicle image includes a first vehicle image and a second vehicle image; A third acquisition module is used to recognize the vehicle image based on the vehicle recognition model to obtain a first vehicle fine-grained feature of the first vehicle image and a second vehicle fine-grained feature of the second vehicle image, wherein the vehicle recognition model is trained by the vehicle recognition model training method according to any one of claims 1 to 2; The second determination module is used to determine whether the vehicles in the first vehicle image and the second vehicle image are the same vehicle according to the first vehicle fine-grained feature and the second vehicle fine-grained feature.

8. A computer device, characterized in that: The computer device includes a processor, a memory, and a computer program stored in the memory and executable by the processor, wherein when the computer program is executed by the processor, the steps of the vehicle identification model training method as described in any one of claims 1 to 2 and the steps of the vehicle identification method as described in any one of claims 3 to 5 are implemented.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the steps of the vehicle identification model training method as described in any one of claims 1 to 2 and the steps of the vehicle identification method as described in any one of claims 3 to 5 are implemented.

Citation Information

Patent Citations

  • Vehicle fine-grained identification model generation method, system and device and storage medium

    CN111767954A

  • Vehicle re-identification method based on improved depth relative distance learning model

    CN111914911A