CN113111709B - Vehicle matching model generation method, device, computer equipment and storage medium - Google Patents

Vehicle matching model generation method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN113111709B
CN113111709B CN202110260641.0A CN202110260641A CN113111709B CN 113111709 B CN113111709 B CN 113111709B CN 202110260641 A CN202110260641 A CN 202110260641A CN 113111709 B CN113111709 B CN 113111709B
Authority
CN
China
Prior art keywords
frame
vehicle
anchor
sample
tail
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110260641.0A
Other languages
Chinese (zh)
Other versions
CN113111709A (en
Inventor
仇晓松
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Aibee Technology Co Ltd
Original Assignee
Beijing Aibee Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Aibee Technology Co Ltd filed Critical Beijing Aibee Technology Co Ltd
Priority to CN202110260641.0A priority Critical patent/CN113111709B/en
Publication of CN113111709A publication Critical patent/CN113111709A/en
Application granted granted Critical
Publication of CN113111709B publication Critical patent/CN113111709B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V20/00Scenes; Scene-specific elements
    • G06V20/50Context or environment of the image
    • G06V20/52Surveillance or monitoring of activities, e.g. for recognising suspicious objects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • G06F18/241Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches
    • G06F18/2415Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches based on parametric or probabilistic models, e.g. based on likelihood ratio or false acceptance rate versus a false rejection rate
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/74Image or video pattern matching; Proximity measures in feature spaces
    • G06V10/75Organisation of the matching processes, e.g. simultaneous or sequential comparisons of image or video features; Coarse-fine approaches, e.g. multi-scale approaches; using context analysis; Selection of dictionaries
    • G06V10/751Comparing pixel values or logical combinations thereof, or feature values having positional relevance, e.g. template matching
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V2201/00Indexing scheme relating to image or video recognition or understanding
    • G06V2201/08Detecting or categorising vehicles

Abstract

The application relates to a vehicle matching model generation method, a vehicle matching model generation device, computer equipment and a storage medium. The method comprises the following steps: acquiring at least one first anchor frame and a labeling frame; determining a vehicle body sample frame from at least one first anchor frame according to the intersection ratio between the first anchor frame and the vehicle body marking frame; wherein the bodywork sample frame comprises a bodywork positive sample frame; dividing the body positive sample frame to obtain a preset number of second anchor frames; determining a head sample frame and a tail sample frame from a preset number of second anchor frames according to the intersection ratio between the second anchor frames and the head marking frame and the tail marking frame; the vehicle body sample frame, the vehicle head sample frame and the vehicle tail sample frame belong to the same vehicle; training a preset initial vehicle matching model by adopting a vehicle body sample frame, a vehicle head sample frame and a vehicle tail sample frame to obtain a vehicle matching model. The vehicle matching model can identify the body, the head and the tail of the same vehicle, and has high matching precision.

Description

Vehicle matching model generation method, device, computer equipment and storage medium
Technical Field
The present disclosure relates to the field of image processing technologies, and in particular, to a method and apparatus for generating a vehicle matching model, a computer device, and a storage medium.
Background
Along with the development of computer vision technology, a technology for identifying the body, the head, the tail and other parts of the body of the same vehicle in an image appears, and the positioning and tracking of the vehicle can be realized by applying the technology. In the traditional method, a vehicle body frame, a vehicle head frame and a vehicle tail frame are detected through detectors respectively, then the association relationship among the vehicle body frame, the vehicle head frame and the vehicle tail frame is determined through preset matching rules, and whether the vehicle body frame, the vehicle head frame and the vehicle tail frame belong to the same vehicle is further determined.
However, in the conventional method, when the vehicles in the image are dense or the vehicles in the image are blocked from each other, a serious mismatching phenomenon of the vehicles occurs.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a vehicle matching model generation method, apparatus, computer device, and storage medium capable of avoiding a vehicle mismatching phenomenon.
A vehicle matching model generation method, the method comprising:
acquiring at least one first anchor frame and a labeling frame; the marking frame is a frame generated by marking the vehicle type of each vehicle in the image, the vehicle type comprises a vehicle body, a vehicle head and a vehicle tail, and the marking frame comprises a vehicle body marking frame, a vehicle head marking frame and a vehicle tail marking frame;
Determining a vehicle body sample frame from the at least one first anchor frame according to the intersection ratio between the first anchor frame and the vehicle body marking frame; wherein the bodywork sample frame comprises a bodywork positive sample frame and a bodywork negative sample frame;
dividing the positive sample frame of the vehicle body to obtain a preset number of second anchor frames;
determining a head sample frame and a tail sample frame from the preset number of second anchor frames according to the intersection ratio between the second anchor frames and the head marking frame and the tail marking frame; the vehicle body sample frame, the vehicle head sample frame and the vehicle tail sample frame belong to the same vehicle;
training a preset initial vehicle matching model by adopting the vehicle body sample frame, the vehicle head sample frame and the vehicle tail sample frame to obtain a vehicle matching model; wherein the vehicle matching model includes a classification branch and a regression branch; the classification branch is used for outputting the probability that the vehicle output frame is of the corresponding vehicle type, and the regression branch is used for outputting the coordinate parameters of the vehicle output frame.
In one embodiment, the number of layers of the classification branch is 2 (n-1) +1; wherein n is the number of the vehicle types;
The number of layers of the regression branches is m; wherein m is the number of coordinate parameters of the vehicle output frame, and the coordinate parameters include an abscissa, an ordinate, a width and a height of the vehicle output frame.
In one embodiment, the determining the body sample frame from the at least one first anchor frame according to the intersection ratio between the first anchor frame and the body marking frame includes:
for each first anchor frame, acquiring the cross-over ratio between the first anchor frame and the vehicle body marking frame to obtain a first cross-over ratio;
detecting a magnitude relation between the first intersection ratio and a first preset threshold value;
and if the first intersection ratio is larger than the first preset threshold value, determining the first anchor frame as the vehicle body positive sample frame, otherwise, determining the first anchor frame as the vehicle body negative sample frame.
In one embodiment, the determining the head sample frame and the tail sample frame from the preset number of second anchor frames according to the intersection ratio between the second anchor frames and the head marking frame and the tail marking frame includes:
acquiring the intersection ratio between the second anchor frame and the head marking frame to obtain a second intersection ratio;
Acquiring the cross-over ratio between the second anchor frame and the tail marking frame to obtain a third cross-over ratio;
and determining a head sample frame and a tail sample frame from the second anchor frames according to the magnitude relation between the second cross ratio and the third cross ratio.
In one embodiment, the determining, according to the magnitude relation between the second merging ratio and the third merging ratio, a head sample frame and a tail sample frame from the preset number of second anchor frames includes:
detecting a magnitude relationship between the second and third intersection ratios;
and if the second intersection ratio is larger than the third intersection ratio, determining the second anchor frame as the head sample frame, otherwise, determining the second anchor frame as the tail sample frame.
In one embodiment, the headstock sample frame comprises a headstock positive sample frame and a headstock negative sample frame;
the determining the second anchor frame as the head sample frame includes:
detecting a magnitude relation between the second intersection ratio and a second preset threshold value;
and if the second intersection ratio is larger than the second preset threshold value, determining the second anchor frame as the head positive sample frame, otherwise, determining the second anchor frame as the head negative sample frame.
In one embodiment, the tail sample frame includes a tail positive sample frame and a tail negative sample frame;
the determining the second anchor frame as the tail sample frame includes:
detecting a magnitude relation between the third intersection ratio and the second preset threshold value;
and if the third intersection ratio is larger than the second preset threshold value, determining the second anchor frame as the vehicle tail positive sample frame, otherwise, determining the second anchor frame as the vehicle tail negative sample frame.
A vehicle matching model generation device, the device comprising:
the data acquisition module is used for acquiring at least one first anchor frame and a marking frame; the marking frame is a frame generated by marking the vehicle type of each vehicle in the image, the vehicle type comprises a vehicle body, a vehicle head and a vehicle tail, and the marking frame comprises a vehicle body marking frame, a vehicle head marking frame and a vehicle tail marking frame;
the first sample frame determining module is used for determining a vehicle body sample frame from the at least one first anchor frame according to the intersection ratio between the first anchor frame and the vehicle body marking frame; wherein the bodywork sample frame comprises a bodywork positive sample frame and a bodywork negative sample frame;
The anchor frame segmentation module is used for segmenting the positive sample frames of the vehicle body to obtain a preset number of second anchor frames;
the second sample frame determining module is used for determining a head sample frame and a tail sample frame from the preset number of second anchor frames according to the cross-over ratio between the second anchor frames and the head marking frame and the tail marking frame; the vehicle body sample frame, the vehicle head sample frame and the vehicle tail sample frame belong to the same vehicle;
the model generation module is used for training a preset initial vehicle matching model by adopting the vehicle body sample frame, the vehicle head sample frame and the vehicle tail sample frame to obtain a vehicle matching model; wherein the vehicle matching model includes a classification branch and a regression branch; the classification branch is used for outputting the probability that the vehicle output frame is of the corresponding vehicle type, and the regression branch is used for outputting the coordinate parameters of the vehicle output frame.
A computer device comprising a memory storing a computer program and a processor implementing the method of any of the embodiments above when the processor executes the computer program.
A computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the method of any of the embodiments described above.
The vehicle matching model generation method, the vehicle matching model generation device, the computer equipment and the storage medium acquire at least one first anchor frame and at least one labeling frame; the marking frame is a frame generated by marking the vehicle type of each vehicle in the image, the vehicle type comprises a vehicle body, a vehicle head and a vehicle tail, and the marking frame comprises a vehicle body marking frame, a vehicle head marking frame and a vehicle tail marking frame; determining a vehicle body sample frame from at least one first anchor frame according to the intersection ratio between the first anchor frame and the vehicle body marking frame; the body sample frames comprise a body positive sample frame and a body negative sample frame; dividing the body positive sample frame to obtain a preset number of second anchor frames; determining a head sample frame and a tail sample frame from a preset number of second anchor frames according to the intersection ratio between the second anchor frames and the head marking frame and the tail marking frame; the vehicle body sample frame, the vehicle head sample frame and the vehicle tail sample frame belong to the same vehicle; training a preset initial vehicle matching model by adopting a vehicle body sample frame, a vehicle head sample frame and a vehicle tail sample frame to obtain a vehicle matching model; the vehicle matching model comprises a classification branch and a regression branch; the classification branch is used for outputting the probability that the vehicle output frame corresponds to the vehicle type, and the regression branch is used for outputting the coordinate parameters of the vehicle output frame. Because the training sample of the model is a vehicle sample frame of the same vehicle, the model output is also the probability that the vehicle output frame of the same vehicle is of the corresponding vehicle type, so that the vehicle matching model can identify the vehicle body, the vehicle head and the vehicle tail of the same vehicle, can avoid the phenomenon of mismatching of vehicles, and has high matching precision.
Drawings
FIG. 1 is a flow diagram of a method for generating a vehicle matching model in one embodiment;
FIG. 2 is a flow chart of one implementation of step S200 in one embodiment;
FIG. 3 is a flow chart of one implementation of step S400 in one example;
FIG. 4 is a flow chart of a method for generating a vehicle matching model in one embodiment;
FIG. 5 is a schematic diagram of a vehicle association matching sample box in one embodiment;
FIG. 6 is a block diagram showing the construction of a vehicle matching model generating device in one embodiment;
fig. 7 is an internal structural diagram of a computer device in one embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application.
In one embodiment, as shown in fig. 1, a vehicle matching model generating method is provided, where the method is applied to a terminal to illustrate the method, it is understood that the method may also be applied to a server, and may also be applied to a system including the terminal and the server, and implemented through interaction between the terminal and the server. In this embodiment, the method includes the steps of:
Step S100, at least one first anchor frame and a labeling frame are obtained; the marking frame is a frame for marking and generating the vehicle type of each vehicle in the image, the vehicle type comprises a vehicle body, a vehicle head and a vehicle tail, and the marking frame comprises a vehicle body marking frame, a vehicle head marking frame and a vehicle tail marking frame.
Step S200, determining a vehicle body sample frame from at least one first anchor frame according to the intersection ratio between the first anchor frame and the vehicle body marking frame; wherein the bodywork sample frame includes a bodywork positive sample frame and a bodywork negative sample frame.
And step S300, dividing the positive sample frames of the vehicle body to obtain a preset number of second anchor frames.
Step S400, determining a head sample frame and a tail sample frame from a preset number of second anchor frames according to the intersection ratio between the second anchor frames and the head marking frame and the tail marking frame; the vehicle body sample frame, the vehicle head sample frame and the vehicle tail sample frame belong to the same vehicle.
Step S500, training a preset initial vehicle matching model by adopting a vehicle body sample frame, a vehicle head sample frame and a vehicle tail sample frame to obtain a vehicle matching model; the vehicle matching model comprises a classification branch and a regression branch; the classification branch is used for outputting the probability that the vehicle output frame corresponds to the vehicle type, and the regression branch is used for outputting the coordinate parameters of the vehicle output frame.
Wherein, the Anchor frame (Anchor) refers to a frame having a plurality of dimensions and a plurality of aspect ratio examples generated according to the size of an image including a vehicle. The marking frame is a frame for marking and generating the vehicle type of each vehicle in the image, the vehicle type comprises a vehicle body, a vehicle head and a vehicle tail, and the marking frame comprises a vehicle body marking frame, a vehicle head marking frame and a vehicle tail marking frame. The preset number refers to the number of the second anchor frames obtained by dividing the first anchor frames, for example, when the first anchor frames are divided into two parts according to the head and the tail of the vehicle, the preset number is 2, and when the first anchor frames are divided into three parts according to the head, the middle and the tail of the vehicle, the preset number is 3. Alternatively, the preset number may be different from 4, 5, 6.
Specifically, at least one first anchor frame and a marking frame are obtained, a body sample frame of each vehicle is determined from the first anchor frame according to the intersection ratio between the first anchor frame and the body marking frame, the body sample frame comprises a body positive sample frame and a body negative sample frame, the body positive sample frame is a first anchor frame comprising a vehicle body, and the body negative sample frame is a first anchor frame not comprising the vehicle body. And then, dividing the vehicle body positive sample frames to obtain a preset number of second anchor frames, and determining the vehicle head sample frames and the vehicle tail sample frames from the preset number of second anchor frames according to the intersection ratio between the second anchor frames and the vehicle head marking frames and the vehicle tail marking frames. Likewise, the head sample frame comprises a head positive sample frame and a head negative sample frame, and the tail sample frame comprises a tail positive sample frame and a tail negative sample frame. Because the negative sample frame of the vehicle body does not comprise the vehicle body, the negative sample frame of the vehicle body is not processed again, and the sub-sample frames after the negative sample frame of the vehicle body is divided are negative sample frames, namely the negative sample frame of the vehicle head and the negative sample frame of the vehicle tail. After a body sample frame, a head sample frame and a tail sample frame of the same vehicle are obtained, training a preset initial vehicle matching model by adopting the body sample frame, the head sample frame and the tail sample frame to obtain a vehicle matching model, wherein the vehicle matching model comprises a classification branch and a regression branch, the classification branch can output the probability that a vehicle output frame of the same vehicle is of a corresponding vehicle type, and the regression branch can output the coordinate parameters of the vehicle output frame.
The vehicle matching model generating method comprises the steps of obtaining at least one first anchor frame and a labeling frame; the marking frame is a frame generated by marking the vehicle type of each vehicle in the image, the vehicle type comprises a vehicle body, a vehicle head and a vehicle tail, and the marking frame comprises a vehicle body marking frame, a vehicle head marking frame and a vehicle tail marking frame; determining a vehicle body sample frame from at least one first anchor frame according to the intersection ratio between the first anchor frame and the vehicle body marking frame; the body sample frames comprise a body positive sample frame and a body negative sample frame; dividing the body positive sample frame to obtain a preset number of second anchor frames; determining a head sample frame and a tail sample frame from a preset number of second anchor frames according to the intersection ratio between the second anchor frames and the head marking frame and the tail marking frame; training a preset initial vehicle matching model by adopting a vehicle body sample frame, a vehicle head sample frame and a vehicle tail sample frame to obtain a vehicle matching model; the vehicle matching model comprises a classification branch and a regression branch; the classification branch is used for outputting the probability that the vehicle output frame corresponds to the vehicle type, and the regression branch is used for outputting the coordinate parameters of the vehicle output frame. Because the training sample of the model is a vehicle sample frame of the same vehicle, the model output is also the probability that the vehicle output frame of the same vehicle is of the corresponding vehicle type, so that the vehicle matching model can identify the vehicle body, the vehicle head and the vehicle tail of the same vehicle, can avoid the phenomenon of mismatching of vehicles, and has high matching precision.
Optionally, in one embodiment, the number of layers of the classification branches in the vehicle matching model is 2 (n-1) +1; where n is the number of vehicle types; the number of layers of the regression branches of the vehicle matching model is m x n; wherein m is the number of coordinate parameters of the vehicle output frame, and the coordinate parameters include the abscissa, the ordinate, the width and the height of the vehicle output frame.
The classification branches are used for outputting probabilities that the vehicle output boxes of the same vehicle are corresponding to the vehicle types. Because the frame corresponding to the vehicle body is a complete first anchor frame, and the frames corresponding to the vehicle head and the vehicle tail are second anchor frames formed by dividing the first anchor frames, when one first anchor frame corresponding to the vehicle body exists, the first anchor frame needs to be divided into (n-1) second anchor frames, and the types of the (n-1) second anchor frames are judged. The types of the second anchor frame are divided into two types, one including the desired target and one not including the desired target, so 2 (n-1) branches describing the second anchor frame are required. Plus one branch describing the first anchor box, a total of 2 (n-1) +1 branches describing the anchor box are required.
In this embodiment, the types of the vehicle are three types of a vehicle body, a vehicle head and a vehicle tail, n is 3, the first anchor frame is required to be divided into (n-1) =2 second anchor frames (Zuo Zikuang, right subframe), the number of layers of the classification branches is 2 (n-1) +1=5, and each layer of output respectively indicates whether the first anchor frame includes the vehicle body, whether the left subframe includes the vehicle head, whether the left subframe includes the vehicle tail, whether the right subframe includes the vehicle head and whether the right subframe includes the vehicle tail. Alternatively, the specific value of n may be determined according to the number of vehicle types that are determined as desired, and the vehicle types may also include doors, tires, windows, and the like.
The regression branch is used for outputting coordinate parameters of the vehicle output frame, and when the coordinate parameters comprise the abscissa, the ordinate, the width and the height of the vehicle output frame, the number of the coordinate parameters is indicated to be 4, and the number of layers of the regression branch is m=n=12.
Illustratively, taking the model RetinaNet as an initial vehicle matching model, the number of layers of classification branches of the initial vehicle matching model is c1=5, and the number of layers of regression branches is h×w×a×12.
In the model training process, the loss of the classification branch can be calculated according to the matching result of the anchor frame and the marking frame, and the goal is to judge whether the first anchor frame comprises a vehicle body, whether the left subframe comprises a vehicle head, whether the left subframe comprises a vehicle tail, whether the right subframe comprises the vehicle head and whether the right subframe comprises the vehicle tail. And further generating a regression target value through matching result codes, wherein the calculation mode is as formula (1), and the regression loss function is continuously close to the target value. The specific formula (1) is expressed as follows:
wherein,respectively representing the coordinates of the central point and the width and height of the marking frame,/->Representing the coordinates of the central point and the width and height of the anchor frame,/->Representing the deviation of the first anchor frame from the label frame,representing the deviation of the left subframe from the label frame, < >>The deviation of the representative right subframe and the labeling frame is the value required to be regressed.
In the test and call stage of the model, the output of the regression branch of the model needs to be decoded, and the output dimension of each picture is changed into [ X,12] after decoding, wherein X=H×W×A, the first four columns represent the vehicle output frame (vehicle body output frame) after the first anchor frame is regressed, the middle four columns represent the vehicle output frame (vehicle head output frame or vehicle tail output frame) after the left subframe is regressed, the last four columns represent the vehicle output frame (vehicle tail output frame or vehicle head output frame) after the right subframe is regressed, the three frames are in one-to-one correspondence, and have matching states, and are different areas of the same vehicle, and the decoding mode is shown in a formula (2):
wherein (t) x ,t y ,t w ,t h ) Representing the central point coordinates and the variation of width and height of the vehicle body output frame, (t) x1 ,t y1 ,t w1 ,t h1 ) The center point coordinates and the width-height variation of the output frame representing the left subframe, (t) x2 ,t y2 ,t w2 ,t h2 ) The center point coordinates and the variation of the width and height of the output frame representing the right subframe,representing the center point coordinates and width and height of the annotation frame,center point coordinates representing an output frame of a vehicle body and width and height,/->Center point coordinates and width and height of output frame representing left subframe>The center point coordinates and width and height of the output box representing the right subframe.
The classification branch sets the output dimension of each picture as [ X,5], the first column represents the probability that the vehicle output frame is the vehicle body, the second column and the third column represent the probability that the vehicle output frame after the regression of the left subframe is the vehicle head and the vehicle tail respectively, the label of the vehicle head and the vehicle tail at last can be obtained by comparing the probability values of the second column and the third column, and the fourth column and the fifth column represent the class calculation of the right subframe and are the same as the second column and the third column. Finally, a matched vehicle body output frame, a vehicle head output frame and a vehicle tail output frame can be obtained, and if one subframe (Zuo Zikuang, right subframe) does not belong to the vehicle head or the vehicle tail, the vehicle body output frame, the vehicle head output frame and the vehicle tail output frame can be filtered in a mode of setting a probability threshold.
In the embodiment, specific parameters of the model can be set, two processes of vehicle type identification and vehicle type matching can be integrated into one model, the process is simple, the model output is the probability that the vehicle output frame of the same vehicle is the corresponding vehicle type, and the phenomenon of vehicle mismatching can be avoided.
In one example, as shown in fig. 2, a flowchart of an implementation manner of step S200 includes:
step S210, for each first anchor frame, acquiring the cross-over ratio between the first anchor frame and the vehicle body marking frame, and obtaining a first cross-over ratio.
Step S220, detecting a magnitude relation between the first cross-over ratio and a first preset threshold.
And step S230, if the first intersection ratio is larger than a first preset threshold value, determining the first anchor frame as a vehicle body positive sample frame, otherwise, determining the first anchor frame as a vehicle body negative sample frame.
The first preset threshold value is a critical value for determining whether the first anchor frame can represent a vehicle body annotation frame. When the first intersection ratio is larger than a first preset threshold value, the first anchor frame and the vehicle body marking frame are more in overlapping parts, and the vehicle body marking frame can be represented to a certain extent. When the first intersection ratio is smaller than or equal to a first preset threshold value, the overlapping part of the first anchor frame and the vehicle body marking frame is less, and the vehicle body marking frame cannot be replaced. Alternatively, the first preset threshold may be 0.7, 0.8, 0.9, or not.
Specifically, for each first anchor frame, the formula "first intersection ratio= (first anchor frame area n vehicle body labeling frame area)/(first anchor frame area u vehicle body labeling frame area)" is adopted to determine the intersection ratio between the first anchor frame and the vehicle body labeling frame, and the first intersection ratio is obtained. And then, detecting the magnitude relation between the first intersection ratio and a first preset threshold value, and if the first intersection ratio is larger than the first preset threshold value, indicating that the overlapping parts of the first anchor frame and the vehicle body marking frame are more and can represent the vehicle body marking frame to a certain extent, determining the first anchor frame as a vehicle body positive sample frame. Otherwise, the first anchor frame is determined to be a negative sample frame of the vehicle body if the overlapping part of the first anchor frame and the vehicle body marking frame is less and the vehicle body marking frame cannot be replaced.
In the above embodiment, for each first anchor frame, the cross-over ratio between the first anchor frame and the vehicle body marking frame is obtained, so as to obtain a first cross-over ratio; detecting a magnitude relation between the first intersection ratio and a first preset threshold value; and if the first intersection ratio is larger than a first preset threshold value, determining the first anchor frame as a vehicle body positive sample frame, otherwise, determining the first anchor frame as a vehicle body negative sample frame. Therefore, a plurality of positive body sample frames and negative body sample frames can be obtained according to the first anchor frame and the body labeling frame, a large amount of sample data is provided for subsequent model training, and the matching precision of the model is improved.
In an example, as shown in fig. 3, a flowchart of an implementation manner of step S400 includes:
step S411, obtaining the cross-over ratio between the second anchor frame and the head labeling frame, and obtaining a second cross-over ratio.
And step S412, obtaining the cross-over ratio between the second anchor frame and the tail marking frame, and obtaining a third cross-over ratio.
Step S420, determining a head sample frame and a tail sample frame from a preset number of second anchor frames according to the magnitude relation between the second cross-over ratio and the third cross-over ratio.
Specifically, the formula of' second intersection ratio= (second anchor frame area. And obtaining the third intersection ratio between the third anchor frame and the tail marking frame by adopting the formula of' third intersection ratio= (third anchor frame area. And determining a head sample frame and a tail sample frame from a preset number of second anchor frames according to the magnitude relation between the second cross-over ratio and the third cross-over ratio.
Optionally, step S430 includes: detecting a magnitude relation between the second cross-over ratio and the third cross-over ratio; if the second intersection ratio is larger than the third intersection ratio, determining the second anchor frame as a head sample frame, otherwise, determining the second anchor frame as a tail sample frame.
Specifically, the magnitude relation between the second intersection ratio and the third intersection ratio is detected, if the second intersection ratio is larger than the third intersection ratio, the portion of the second anchor frame containing the head of the vehicle is larger than the portion of the tail of the vehicle, and the second anchor frame is determined to be a head sample frame. Otherwise, the part of the second anchor frame containing the head is smaller than or equal to the part of the tail, and the second anchor frame is determined to be a tail sample frame.
Optionally, when determining the second anchor frame as the head sample frame, further detecting a magnitude relation between the second intersection ratio and a second preset threshold; if the second intersection ratio is larger than a second preset threshold value, determining the second anchor frame as a head positive sample frame, otherwise, determining the second anchor frame as a head negative sample frame.
The second preset threshold value is a critical value for determining whether the second anchor frame can represent a head labeling frame or a tail labeling frame. When the second intersection ratio is larger than a second preset threshold value, the overlapping parts of the second anchor frame and the head marking frame are more, and the head marking frame can be represented to a certain extent. When the second intersection ratio is smaller than or equal to a second preset threshold value, the overlapping parts of the second anchor frame and the head marking frame are fewer, and the head marking frame cannot be replaced. Similarly, when the third intersection ratio is larger than the second preset threshold value, the overlapping parts of the second anchor frame and the tail marking frame are more, and the tail marking frame can be represented to a certain extent. When the third intersection ratio is smaller than or equal to a second preset threshold value, the overlapping parts of the second anchor frame and the tail marking frame are fewer, and the tail marking frame cannot be replaced. Alternatively, the second preset threshold may be 0.7, 0.8, 0.9, or not. The headstock sample frame comprises a headstock positive sample frame and a headstock negative sample frame.
Specifically, the size relation between the second intersection ratio and a second preset threshold value is detected, if the second intersection ratio is larger than the second preset threshold value, the fact that the overlapping parts of the second anchor frame and the head labeling frame are more is indicated, the head labeling frame can be represented to a certain extent, and the second anchor frame is determined to be a head positive sample frame. Otherwise, the fact that the overlapping parts of the second anchor frame and the head marking frame are fewer and the head marking frame cannot be replaced is indicated, and the second anchor frame is determined to be a head negative sample frame.
Optionally, when determining the second anchor frame as the tail sample frame, further detecting a magnitude relation between the third intersection ratio and a second preset threshold; and if the third intersection ratio is larger than a second preset threshold value, determining the second anchor frame as a vehicle tail positive sample frame, otherwise, determining the second anchor frame as a vehicle tail negative sample frame.
The vehicle tail sample frame comprises a vehicle tail positive sample frame and a vehicle tail negative sample frame.
Specifically, the size relation between the third intersection ratio and the second preset threshold value is detected, if the third intersection ratio is larger than the second preset threshold value, the fact that the overlapping parts of the second anchor frame and the vehicle tail marking frame are more is indicated, the vehicle tail marking frame can be represented to a certain extent, and the second anchor frame is determined to be a vehicle tail positive sample frame. Otherwise, the fact that the overlapping parts of the second anchor frame and the vehicle tail marking frame are fewer and the vehicle tail table marking frame cannot be replaced is indicated, and the second anchor frame is determined to be the vehicle tail negative sample frame.
In the above embodiment, the second intersection ratio is obtained by obtaining the intersection ratio between the second anchor frame and the head marking frame; acquiring the intersection ratio between the second anchor frame and the tail marking frame to obtain a third intersection ratio; and determining a head sample frame and a tail sample frame from a preset number of second anchor frames according to the magnitude relation between the second cross-over ratio and the third cross-over ratio. Through the mode, a large number of head sample frames and tail sample frames can be obtained rapidly, and specific head positive sample frames, head negative sample frames, tail positive sample frames and tail negative sample frames are further determined. A large amount of sample data can be provided for subsequent model training, and the matching precision of the model is improved.
In a specific embodiment, as shown in fig. 4, a vehicle matching model generation method is provided. The types of vehicles are three, namely a vehicle body, a vehicle head and a vehicle tail. Firstly, a training sample is obtained, and a matching item is added to the training sample, as shown in fig. 5, and a schematic diagram of a vehicle association matching sample frame is shown. The three frames of the upper half part of the figure belong to the body, the head and the tail of one vehicle, the three frames of the lower half part of the figure belong to the body, the head and the tail of the other vehicle, and if the head or the tail of a certain vehicle is invisible due to shielding and the like, the corresponding position is marked for occupying space and zero filling. In the labeling file, the body, the head and the tail of two vehicles are labeled as examples, the labeling frames of the two vehicles of the sample data are stored as two lines of texts, each line has three frame coordinates of one vehicle and three types (the body, the head and the tail) corresponding to the three frames respectively, and each line in the labeling represents one vehicle, so that the association relation is formed. Alternatively, the generation of the above-mentioned label may be generated by an existing algorithm, such as a hungarian algorithm, in addition to the manual label.
In this embodiment, the first anchor frame is matched with the vehicle body labeling frame, the matching method is the same as that described above, and a corresponding vehicle body positive sample frame and a vehicle body negative sample frame can be obtained, in order to enable the first anchor frame to better match the vehicle head and the vehicle tail, the vehicle body positive sample frame (determined from a plurality of first anchor frames) matched with the vehicle is divided into a left sub-frame and a right sub-frame (second anchor frame) by mean of a central line, the cross ratio is calculated with the vehicle head labeling frame and the vehicle tail labeling frame of the same vehicle respectively, and the sub-frames with the cross ratio larger than the cross ratio are used for regressing and classifying the corresponding labeling frames, if the vehicle does not have the visible vehicle head and the vehicle tail, namely, the labeling frame is labeled as 0, and the sub-frames are used as the negative sample frames, as shown in fig. 4.
Firstly, acquiring at least one first anchor frame and marking frames, and acquiring the cross ratio between all the first anchor frames and the vehicle body marking frames, if the cross ratio is larger than a first preset threshold value, determining the first anchor frame as a vehicle body positive sample frame, otherwise, determining the first anchor frame as a vehicle body negative sample frame, wherein left and right subframes corresponding to the vehicle body negative sample frame are negative sample frames (a vehicle head negative sample frame and a vehicle tail negative sample frame). Next, the positive body sample frame is divided into two left and right subframes (second anchor frame), alternatively, may be further divided into more subframes, and here, the case of dividing into two left and right subframes is described as an example. After the left subframe and the right subframe are obtained, the left subframe and the right subframe are divided into a head labeling frame and a tail labeling frame for calculating the cross-over ratio. When the vehicle head intersection ratio (second intersection ratio) is larger than the vehicle tail intersection ratio (third intersection ratio), calculating the size relation between the vehicle head intersection ratio and a second preset threshold value, determining the subframe larger than the second preset threshold value as a vehicle head positive sample frame, and otherwise, determining the subframe as a vehicle head negative sample frame. When the vehicle tail intersection ratio (third intersection ratio) is larger than the vehicle head intersection ratio (second intersection ratio), calculating the size relation between the vehicle tail intersection ratio and a second preset threshold value, determining the subframe larger than the second preset threshold value as a vehicle tail positive sample frame, and otherwise, determining the subframe as a vehicle tail negative sample frame.
Alternatively, in order to make the model output have matching information, the model output can also be directly returned to the head and the tail by using an anchor frame matched with the same vehicle body frame. When the first anchor frame is cut, the first anchor frame can be divided into three parts to solve vehicles with visible sides, and the middle subframe is used for solving vehicles with visible front or back sides.
Optionally, after the body positive sample frame, the body negative sample frame, the head positive sample frame, the head negative sample frame, the tail positive sample frame and the tail negative sample frame are obtained, training a preset initial vehicle matching model by adopting the body positive sample frame, the body negative sample frame, the head positive sample frame, the head negative sample frame, the tail positive sample frame and the tail negative sample frame to obtain a vehicle matching model; the vehicle matching model comprises a classification branch and a regression branch; the classification branch is used for outputting the probability that the vehicle output frame corresponds to the vehicle type, and the regression branch is used for outputting the coordinate parameters of the vehicle output frame.
In the above embodiment, the principle of the mode of splitting the first anchor frame is simple and easy to realize, the influence on the model calculation amount is small, meanwhile, the problem that the side face of the vehicle faces the picture photographed by the camera can be solved, and good results and strong robustness can be obtained for the head marking frame and the tail standard frame of the vehicle with other angles by selecting the splitting frame with larger intersection ratio.
It should be noted that the above solution not only can be used for matching and association of vehicles, but also can be applied to other fields, such as human body, head association matching, etc., and is easy to expand.
It should be understood that, although the steps in the flowcharts of fig. 1-4 are shown in order as indicated by the arrows, these steps are not necessarily performed in order as indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in FIGS. 1-4 may include multiple steps or stages that are not necessarily performed at the same time, but may be performed at different times, nor do the order in which the steps or stages are performed necessarily performed in sequence, but may be performed alternately or alternately with at least a portion of the steps or stages in other steps or other steps.
In one embodiment, as shown in fig. 6, there is provided a vehicle matching model generating apparatus including: a data acquisition module 601, a first sample block determination module 602, an anchor block segmentation module 603, a second sample block determination module 604, and a model generation module 605, wherein:
A data acquisition module 601, configured to acquire at least one first anchor frame and a label frame; the marking frame is a frame generated by marking the vehicle type of each vehicle in the image, the vehicle type comprises a vehicle body, a vehicle head and a vehicle tail, and the marking frame comprises a vehicle body marking frame, a vehicle head marking frame and a vehicle tail marking frame;
the first sample frame determining module 602 is configured to determine a vehicle body sample frame from at least one first anchor frame according to an intersection ratio between the first anchor frame and the vehicle body annotation frame; the body sample frames comprise a body positive sample frame and a body negative sample frame;
the anchor frame segmentation module 603 is configured to segment the body positive sample frame to obtain a preset number of second anchor frames;
the second sample frame determining module 604 is configured to determine a head sample frame and a tail sample frame from a preset number of second anchor frames according to an intersection ratio between the second anchor frames and the head marking frame and the tail marking frame; the vehicle body sample frame, the vehicle head sample frame and the vehicle tail sample frame belong to the same vehicle;
the model generating module 605 is configured to train a preset initial vehicle matching model by using a vehicle body sample frame, a vehicle head sample frame and a vehicle tail sample frame to obtain a vehicle matching model; the vehicle matching model comprises a classification branch and a regression branch; the classification branch is used for outputting the probability that the vehicle output frame corresponds to the vehicle type, and the regression branch is used for outputting the coordinate parameters of the vehicle output frame.
In one embodiment, the number of layers of the classification branch is 2 (n-1) +1; where n is the number of vehicle types; the number of layers of the regression branch is m; wherein m is the number of coordinate parameters of the vehicle output frame, and the coordinate parameters include the abscissa, the ordinate, the width and the height of the vehicle output frame.
In one embodiment, the first sample block determination module 602 is further configured to: for each first anchor frame, acquiring the intersection ratio between the first anchor frame and the vehicle body marking frame to obtain a first intersection ratio; detecting a magnitude relation between the first intersection ratio and a first preset threshold value; and if the first intersection ratio is larger than a first preset threshold value, determining the first anchor frame as a vehicle body positive sample frame, otherwise, determining the first anchor frame as a vehicle body negative sample frame.
In one embodiment, the second sample block determination module 604 is further configured to: acquiring the intersection ratio between the second anchor frame and the head marking frame to obtain a second intersection ratio; acquiring the intersection ratio between the second anchor frame and the tail marking frame to obtain a third intersection ratio; and determining a head sample frame and a tail sample frame from a preset number of second anchor frames according to the magnitude relation between the second cross-over ratio and the third cross-over ratio.
In one embodiment, the second sample block determination module 604 is further configured to: detecting a magnitude relation between the second cross-over ratio and the third cross-over ratio; if the second intersection ratio is larger than the third intersection ratio, determining the second anchor frame as a head sample frame, otherwise, determining the second anchor frame as a tail sample frame.
In one embodiment, the second sample block determination module 604 is further configured to: detecting a magnitude relation between the second cross ratio and a second preset threshold value; if the second intersection ratio is larger than a second preset threshold value, determining the second anchor frame as a head positive sample frame, otherwise, determining the second anchor frame as a head negative sample frame.
In one embodiment, the second sample block determination module 604 is further configured to: detecting the magnitude relation between the third cross ratio and a second preset threshold value; and if the third intersection ratio is larger than a second preset threshold value, determining the second anchor frame as a vehicle tail positive sample frame, otherwise, determining the second anchor frame as a vehicle tail negative sample frame.
The specific definition of the vehicle matching model generating device may be referred to the definition of the vehicle matching model generating method hereinabove, and will not be described in detail herein. The respective modules in the above-described vehicle matching model generation device may be implemented in whole or in part by software, hardware, or a combination thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a computer device is provided, which may be a terminal, and the internal structure of which may be as shown in fig. 7. The computer device includes a processor, a memory, a communication interface, a display screen, and an input device connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The communication interface of the computer device is used for carrying out wired or wireless communication with an external terminal, and the wireless mode can be realized through WIFI, an operator network, NFC (near field communication) or other technologies. The computer program is executed by a processor to implement a vehicle matching model generation method. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, can also be keys, a track ball or a touch pad arranged on the shell of the computer equipment, and can also be an external keyboard, a touch pad or a mouse and the like.
It will be appreciated by those skilled in the art that the structure shown in fig. 7 is merely a block diagram of some of the structures associated with the present application and is not limiting of the computer device to which the present application may be applied, and that a particular computer device may include more or fewer components than shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is provided comprising a memory and a processor, the memory having stored therein a computer program, the processor when executing the computer program performing the steps of:
acquiring at least one first anchor frame and a labeling frame; the marking frame is a frame generated by marking the vehicle type of each vehicle in the image, the vehicle type comprises a vehicle body, a vehicle head and a vehicle tail, and the marking frame comprises a vehicle body marking frame, a vehicle head marking frame and a vehicle tail marking frame;
determining a vehicle body sample frame from at least one first anchor frame according to the intersection ratio between the first anchor frame and the vehicle body marking frame; the body sample frames comprise a body positive sample frame and a body negative sample frame;
dividing the body positive sample frame to obtain a preset number of second anchor frames;
Determining a head sample frame and a tail sample frame from a preset number of second anchor frames according to the intersection ratio between the second anchor frames and the head marking frame and the tail marking frame; the vehicle body sample frame, the vehicle head sample frame and the vehicle tail sample frame belong to the same vehicle;
training a preset initial vehicle matching model by adopting a vehicle body sample frame, a vehicle head sample frame and a vehicle tail sample frame to obtain a vehicle matching model; the vehicle matching model comprises a classification branch and a regression branch; the classification branch is used for outputting the probability that the vehicle output frame corresponds to the vehicle type, and the regression branch is used for outputting the coordinate parameters of the vehicle output frame.
In one embodiment, the processor when executing the computer program further performs the steps of: the number of layers of the classification branches is 2 (n-1) +1; where n is the number of vehicle types; the number of layers of the regression branch is m; wherein m is the number of coordinate parameters of the vehicle output frame, and the coordinate parameters include the abscissa, the ordinate, the width and the height of the vehicle output frame.
In one embodiment, the processor when executing the computer program further performs the steps of: for each first anchor frame, acquiring the intersection ratio between the first anchor frame and the vehicle body marking frame to obtain a first intersection ratio; detecting a magnitude relation between the first intersection ratio and a first preset threshold value; and if the first intersection ratio is larger than a first preset threshold value, determining the first anchor frame as a vehicle body positive sample frame, otherwise, determining the first anchor frame as a vehicle body negative sample frame.
In one embodiment, the processor when executing the computer program further performs the steps of: acquiring the intersection ratio between the second anchor frame and the head marking frame to obtain a second intersection ratio; acquiring the intersection ratio between the second anchor frame and the tail marking frame to obtain a third intersection ratio; and determining a head sample frame and a tail sample frame from a preset number of second anchor frames according to the magnitude relation between the second cross-over ratio and the third cross-over ratio.
In one embodiment, the processor when executing the computer program further performs the steps of: detecting a magnitude relation between the second cross-over ratio and the third cross-over ratio; if the second intersection ratio is larger than the third intersection ratio, determining the second anchor frame as a head sample frame, otherwise, determining the second anchor frame as a tail sample frame.
In one embodiment, the processor when executing the computer program further performs the steps of: detecting a magnitude relation between the second cross ratio and a second preset threshold value; if the second intersection ratio is larger than a second preset threshold value, determining the second anchor frame as a head positive sample frame, otherwise, determining the second anchor frame as a head negative sample frame.
In one embodiment, the processor when executing the computer program further performs the steps of: detecting the magnitude relation between the third cross ratio and a second preset threshold value; and if the third intersection ratio is larger than a second preset threshold value, determining the second anchor frame as a vehicle tail positive sample frame, otherwise, determining the second anchor frame as a vehicle tail negative sample frame.
In one embodiment, a computer readable storage medium is provided having a computer program stored thereon, which when executed by a processor, performs the steps of:
acquiring at least one first anchor frame and a labeling frame; the marking frame is a frame generated by marking the vehicle type of each vehicle in the image, the vehicle type comprises a vehicle body, a vehicle head and a vehicle tail, and the marking frame comprises a vehicle body marking frame, a vehicle head marking frame and a vehicle tail marking frame;
determining a vehicle body sample frame from at least one first anchor frame according to the intersection ratio between the first anchor frame and the vehicle body marking frame; the body sample frames comprise a body positive sample frame and a body negative sample frame;
dividing the body positive sample frame to obtain a preset number of second anchor frames;
determining a head sample frame and a tail sample frame from a preset number of second anchor frames according to the intersection ratio between the second anchor frames and the head marking frame and the tail marking frame; the vehicle body sample frame, the vehicle head sample frame and the vehicle tail sample frame belong to the same vehicle;
training a preset initial vehicle matching model by adopting a vehicle body sample frame, a vehicle head sample frame and a vehicle tail sample frame to obtain a vehicle matching model; the vehicle matching model comprises a classification branch and a regression branch; the classification branch is used for outputting the probability that the vehicle output frame corresponds to the vehicle type, and the regression branch is used for outputting the coordinate parameters of the vehicle output frame.
In one embodiment, the computer program when executed by the processor further performs the steps of: the number of layers of the classification branches is 2 (n-1) +1; where n is the number of vehicle types; the number of layers of the regression branch is m; wherein m is the number of coordinate parameters of the vehicle output frame, and the coordinate parameters include the abscissa, the ordinate, the width and the height of the vehicle output frame.
In one embodiment, the computer program when executed by the processor further performs the steps of: for each first anchor frame, acquiring the intersection ratio between the first anchor frame and the vehicle body marking frame to obtain a first intersection ratio; detecting a magnitude relation between the first intersection ratio and a first preset threshold value; and if the first intersection ratio is larger than a first preset threshold value, determining the first anchor frame as a vehicle body positive sample frame, otherwise, determining the first anchor frame as a vehicle body negative sample frame.
In one embodiment, the computer program when executed by the processor further performs the steps of: acquiring the intersection ratio between the second anchor frame and the head marking frame to obtain a second intersection ratio; acquiring the intersection ratio between the second anchor frame and the tail marking frame to obtain a third intersection ratio; and determining a head sample frame and a tail sample frame from a preset number of second anchor frames according to the magnitude relation between the second cross-over ratio and the third cross-over ratio.
In one embodiment, the computer program when executed by the processor further performs the steps of: detecting a magnitude relation between the second cross-over ratio and the third cross-over ratio; if the second intersection ratio is larger than the third intersection ratio, determining the second anchor frame as a head sample frame, otherwise, determining the second anchor frame as a tail sample frame.
In one embodiment, the computer program when executed by the processor further performs the steps of: detecting a magnitude relation between the second cross ratio and a second preset threshold value; if the second intersection ratio is larger than a second preset threshold value, determining the second anchor frame as a head positive sample frame, otherwise, determining the second anchor frame as a head negative sample frame.
In one embodiment, the computer program when executed by the processor further performs the steps of: detecting the magnitude relation between the third cross ratio and a second preset threshold value; and if the third intersection ratio is larger than a second preset threshold value, determining the second anchor frame as a vehicle tail positive sample frame, otherwise, determining the second anchor frame as a vehicle tail negative sample frame.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, or the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory. By way of illustration, and not limitation, RAM can be in the form of a variety of forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), and the like.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The above examples merely represent a few embodiments of the present application, which are described in more detail and are not to be construed as limiting the scope of the invention. It should be noted that it would be apparent to those skilled in the art that various modifications and improvements could be made without departing from the spirit of the present application, which would be within the scope of the present application. Accordingly, the scope of protection of the present application is to be determined by the claims appended hereto.

Claims (10)

1. A vehicle matching model generation method, characterized in that the method comprises:
acquiring at least one first anchor frame and a labeling frame; the marking frame is a frame generated by marking the vehicle type of each vehicle in the image, the vehicle type comprises a vehicle body, a vehicle head and a vehicle tail, and the marking frame comprises a vehicle body marking frame, a vehicle head marking frame and a vehicle tail marking frame;
Determining a vehicle body sample frame from the at least one first anchor frame according to the intersection ratio between the first anchor frame and the vehicle body marking frame; wherein the bodywork sample frame comprises a bodywork positive sample frame and a bodywork negative sample frame;
dividing the positive sample frame of the vehicle body to obtain a preset number of second anchor frames;
determining a head sample frame and a tail sample frame from the preset number of second anchor frames according to the intersection ratio between the second anchor frames and the head marking frame and the tail marking frame; the vehicle body sample frame, the vehicle head sample frame and the vehicle tail sample frame belong to the same vehicle;
training a preset initial vehicle matching model by adopting the vehicle body sample frame, the vehicle head sample frame and the vehicle tail sample frame to obtain a vehicle matching model; wherein the vehicle matching model includes a classification branch and a regression branch; the classification branch is used for outputting the probability that the vehicle output frame is of the corresponding vehicle type, and the regression branch is used for outputting the coordinate parameters of the vehicle output frame.
2. The method according to claim 1, wherein the number of layers of the classification branch is 2 (n-1) +1; wherein n is the number of the vehicle types;
The number of layers of the regression branches is m; wherein m is the number of coordinate parameters of the vehicle output frame, and the coordinate parameters include an abscissa, an ordinate, a width and a height of the vehicle output frame.
3. The method of claim 1, wherein determining the body sample box from the at least one first anchor box based on a cross-over ratio between the first anchor box and the body annotation box comprises:
for each first anchor frame, acquiring the cross-over ratio between the first anchor frame and the vehicle body marking frame to obtain a first cross-over ratio;
detecting a magnitude relation between the first intersection ratio and a first preset threshold value;
and if the first intersection ratio is larger than the first preset threshold value, determining the first anchor frame as the vehicle body positive sample frame, otherwise, determining the first anchor frame as the vehicle body negative sample frame.
4. The method according to claim 1, wherein determining the head sample frame and the tail sample frame from the preset number of second anchor frames according to the intersection ratio between the second anchor frames and the head marking frame and the tail marking frame comprises:
Acquiring the intersection ratio between the second anchor frame and the head marking frame to obtain a second intersection ratio;
acquiring the cross-over ratio between the second anchor frame and the tail marking frame to obtain a third cross-over ratio;
and determining a head sample frame and a tail sample frame from the second anchor frames according to the magnitude relation between the second cross ratio and the third cross ratio.
5. The method of claim 4, wherein determining the head sample frame and the tail sample frame from the predetermined number of second anchor frames according to the magnitude relation between the second cross-over ratio and the third cross-over ratio comprises:
detecting a magnitude relationship between the second and third intersection ratios;
and if the second intersection ratio is larger than the third intersection ratio, determining the second anchor frame as the head sample frame, otherwise, determining the second anchor frame as the tail sample frame.
6. The method of claim 5, wherein the headstock sample frame comprises a headstock positive sample frame and a headstock negative sample frame;
the determining the second anchor frame as the head sample frame includes:
Detecting a magnitude relation between the second intersection ratio and a second preset threshold value;
and if the second intersection ratio is larger than the second preset threshold value, determining the second anchor frame as the head positive sample frame, otherwise, determining the second anchor frame as the head negative sample frame.
7. The method of claim 6, wherein the tailstock sample box comprises a tailstock positive sample box and a tailstock negative sample box;
the determining the second anchor frame as the tail sample frame includes:
detecting a magnitude relation between the third intersection ratio and the second preset threshold value;
and if the third intersection ratio is larger than the second preset threshold value, determining the second anchor frame as the vehicle tail positive sample frame, otherwise, determining the second anchor frame as the vehicle tail negative sample frame.
8. A vehicle matching model generation device, characterized by comprising:
the data acquisition module is used for acquiring at least one first anchor frame and a marking frame; the marking frame is a frame generated by marking the vehicle type of each vehicle in the image, the vehicle type comprises a vehicle body, a vehicle head and a vehicle tail, and the marking frame comprises a vehicle body marking frame, a vehicle head marking frame and a vehicle tail marking frame;
The first sample frame determining module is used for determining a vehicle body sample frame from the at least one first anchor frame according to the intersection ratio between the first anchor frame and the vehicle body marking frame; wherein the bodywork sample frame comprises a bodywork positive sample frame and a bodywork negative sample frame;
the anchor frame segmentation module is used for segmenting the positive sample frames of the vehicle body to obtain a preset number of second anchor frames;
the second sample frame determining module is used for determining a head sample frame and a tail sample frame from the preset number of second anchor frames according to the cross-over ratio between the second anchor frames and the head marking frame and the tail marking frame; the vehicle body sample frame, the vehicle head sample frame and the vehicle tail sample frame belong to the same vehicle;
the model generation module is used for training a preset initial vehicle matching model by adopting the vehicle body sample frame, the vehicle head sample frame and the vehicle tail sample frame to obtain a vehicle matching model; wherein the vehicle matching model includes a classification branch and a regression branch; the classification branch is used for outputting the probability that the vehicle output frame is of the corresponding vehicle type, and the regression branch is used for outputting the coordinate parameters of the vehicle output frame.
9. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any of claims 1 to 7 when the computer program is executed.
10. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 7.
CN202110260641.0A 2021-03-10 2021-03-10 Vehicle matching model generation method, device, computer equipment and storage medium Active CN113111709B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110260641.0A CN113111709B (en) 2021-03-10 2021-03-10 Vehicle matching model generation method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110260641.0A CN113111709B (en) 2021-03-10 2021-03-10 Vehicle matching model generation method, device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN113111709A CN113111709A (en) 2021-07-13
CN113111709B true CN113111709B (en) 2023-12-29

Family

ID=76711008

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110260641.0A Active CN113111709B (en) 2021-03-10 2021-03-10 Vehicle matching model generation method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113111709B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105654067A (en) * 2016-02-02 2016-06-08 北京格灵深瞳信息技术有限公司 Vehicle detection method and device
CN108875577A (en) * 2018-05-11 2018-11-23 深圳市易成自动驾驶技术有限公司 Object detection method, device and computer readable storage medium
CN110910375A (en) * 2019-11-26 2020-03-24 北京明略软件系统有限公司 Detection model training method, device, equipment and medium based on semi-supervised learning
CN111401264A (en) * 2020-03-19 2020-07-10 上海眼控科技股份有限公司 Vehicle target detection method and device, computer equipment and storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9665802B2 (en) * 2014-11-13 2017-05-30 Nec Corporation Object-centric fine-grained image classification

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105654067A (en) * 2016-02-02 2016-06-08 北京格灵深瞳信息技术有限公司 Vehicle detection method and device
CN108875577A (en) * 2018-05-11 2018-11-23 深圳市易成自动驾驶技术有限公司 Object detection method, device and computer readable storage medium
CN110910375A (en) * 2019-11-26 2020-03-24 北京明略软件系统有限公司 Detection model training method, device, equipment and medium based on semi-supervised learning
CN111401264A (en) * 2020-03-19 2020-07-10 上海眼控科技股份有限公司 Vehicle target detection method and device, computer equipment and storage medium

Also Published As

Publication number Publication date
CN113111709A (en) 2021-07-13

Similar Documents

Publication Publication Date Title
CN108038474B (en) Face detection method, convolutional neural network parameter training method, device and medium
CN111126359B (en) High-definition image small target detection method based on self-encoder and YOLO algorithm
CN110111334B (en) Crack segmentation method and device, electronic equipment and storage medium
CN111091123A (en) Text region detection method and equipment
CN111028246A (en) Medical image segmentation method and device, storage medium and electronic equipment
CN111612822B (en) Object tracking method, device, computer equipment and storage medium
CN112149677A (en) Point cloud semantic segmentation method, device and equipment
CN113822116A (en) Text recognition method and device, computer equipment and storage medium
CN116310656B (en) Training sample determining method and device and computer equipment
CN112308069A (en) Click test method, device, equipment and storage medium for software interface
CN115147598A (en) Target detection segmentation method and device, intelligent terminal and storage medium
CN116051575A (en) Image segmentation method, apparatus, computer device, and storage medium program product
CN111401309A (en) CNN training and remote sensing image target identification method based on wavelet transformation
Wang et al. End-to-end trainable network for superpixel and image segmentation
CN111488930A (en) Training method of classification network, target detection method and device and electronic equipment
CN110097108A (en) Recognition methods, device, equipment and the storage medium of non-motor vehicle
CN110874170A (en) Image area correction method, image segmentation method and device
CN113111709B (en) Vehicle matching model generation method, device, computer equipment and storage medium
CN113111708B (en) Vehicle matching sample generation method, device, computer equipment and storage medium
CN115984634B (en) Image detection method, apparatus, device, storage medium, and program product
CN116342628A (en) Pathological image segmentation method, pathological image segmentation device and computer equipment
CN113160126B (en) Hardware Trojan detection method, hardware Trojan detection device, computer equipment and storage medium
CN114549833A (en) Instance partitioning method and device, electronic equipment and storage medium
CN110688511A (en) Fine-grained image retrieval method and device, computer equipment and storage medium
US20230401691A1 (en) Image defect detection method, electronic device and readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant