CN114219962A - Model training and target detection method and device, storage medium and electronic equipment - Google Patents
Model training and target detection method and device, storage medium and electronic equipment Download PDFInfo
- Publication number
- CN114219962A CN114219962A CN202111637661.1A CN202111637661A CN114219962A CN 114219962 A CN114219962 A CN 114219962A CN 202111637661 A CN202111637661 A CN 202111637661A CN 114219962 A CN114219962 A CN 114219962A
- Authority
- CN
- China
- Prior art keywords
- frame
- reference frame
- labeling
- distance
- sample image
- 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.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/24—Classification techniques
- G06F18/241—Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/045—Combinations of networks
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- Life Sciences & Earth Sciences (AREA)
- Artificial Intelligence (AREA)
- General Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- Evolutionary Computation (AREA)
- Biophysics (AREA)
- Computational Linguistics (AREA)
- Software Systems (AREA)
- Mathematical Physics (AREA)
- Health & Medical Sciences (AREA)
- Biomedical Technology (AREA)
- Computing Systems (AREA)
- Molecular Biology (AREA)
- General Health & Medical Sciences (AREA)
- Evolutionary Biology (AREA)
- Bioinformatics & Cheminformatics (AREA)
- Bioinformatics & Computational Biology (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Image Analysis (AREA)
Abstract
The specification discloses a model training and target detection method, a model training and target detection device, a storage medium and electronic equipment. When the corresponding relationship between the labeling frame and the reference frame is established, a part of the reference frame closer to the labeling frame can be screened out for the labeling frame according to the positions of the labeling frame and the reference frame, and the corresponding relationship between the part of the reference frame and the screened out reference frame is only established for the labeling frame. Because the calculation resources consumed for determining the positions of the labeling frame and the reference frame and for determining the distance between the labeling frame and the reference frame are smaller than the calculation resources consumed for calculating the contact ratio between the labeling frame and the reference frame, the model training method provided by the specification can be used for establishing the corresponding relationship between the labeling frame and the reference frame more quickly under the condition of occupying less calculation resources.
Description
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method and an apparatus for model training and target detection, a storage medium, and an electronic device.
Background
Currently, target detection can be realized by using an algorithm based on a reference frame through some target detection models.
In the idea of the reference frame-based object detection algorithm, the detection frame may be predicted based on a reference frame anchored in advance, and for example, the detection frame may be located by determining a positional offset based on the reference frame.
In the training process of the target detection model, a labeling frame is usually marked in a sample image of the model to be input, and a plurality of reference frames are generated. The label of the label box can include the position and size of the label box, the semantic of the sub-image framed by the label box, and the like, according to the requirement of the target detection task. Then, screening out a reference frame with the coincidence degree larger than the specified coincidence degree for each labeling frame, and establishing the corresponding relation between the labeling frame and each screened-out reference frame.
And when the output detection frame is obtained based on a certain reference frame, constructing a difference item for training the target detection model according to the difference between the labeling frame corresponding to the reference frame based on which the detection frame is positioned and the detection frame.
However, when determining the correspondence between the reference frames and the labeling frames, for each labeling frame, the overlap ratio between the labeling frame and all the reference frames needs to be calculated, so as to establish the correspondence between the labeling frame and the reference frame with a relatively large overlap ratio between the labeling frame and the reference frame, and the calculation of the overlap ratio consumes a large amount of calculation resources.
Disclosure of Invention
The present specification provides a method, an apparatus, a storage medium, and an electronic device for model training and target detection, which partially solve the above problems in the prior art.
The technical scheme adopted by the specification is as follows:
the present specification provides a model training method, comprising:
determining a sample image, and inputting the sample image into a target detection model to be trained to obtain a characteristic diagram corresponding to the sample image;
generating a plurality of reference frames on a sample image, and for each reference frame, outputting a recognition result based on the reference frame as a recognition result corresponding to the reference frame through the target detection model according to a feature area corresponding to a sub-image framed by the reference frame on a feature map;
based on the established corresponding relation between the reference frame and the labeling frame on the sample image, aiming at each reference frame, taking the minimum difference between the identification result corresponding to the reference frame and the labeling result of the labeling frame corresponding to the reference frame as a target, and adjusting parameters in the target detection model;
the method for establishing the corresponding relationship between the reference frame and the labeling frame on the sample image specifically comprises the following steps:
determining the positions of the reference frames and the marking frames in the sample image;
and aiming at each marking frame, screening out the reference frames of which the distances between at least part of the reference frames and the marking frame are smaller than the specified distance from each reference frame, and establishing the corresponding relation between the marking frame and the screened reference frames.
Optionally, outputting the recognition result based on the reference frame specifically includes:
outputting a positional offset of the prediction frame with respect to the reference frame; or the like, or, alternatively,
and outputting the category of the object contained in the sub-image framed by the prediction frame determined based on the reference frame.
Optionally, the step of screening out a reference frame, in which at least part of the distance between the reference frame and the labeling frame is less than a specified distance, includes:
determining the central point of the marking frame and the central points of the screened reference frames;
judging whether the distance between the center point of the labeling frame and the center point of the reference frame is not greater than a specified distance or not for each screened reference frame, wherein the specified distance is the sum of a first distance and a second distance, the first distance is the distance between the center point of the labeling frame and the corner point of the labeling frame, and the second distance is the distance between the center point of the reference frame and the corner point of the reference frame;
and screening out the reference frames of which the distance between the central point and the central point of the labeling frame is less than the specified distance from the reference frames according to the distance between the central point of the labeling frame and the central point of each reference frame.
Optionally, establishing a corresponding relationship between the labeling frame and the screened reference frame specifically includes:
taking the reference frame which is screened out from each reference frame and the distance between which and the labeling frame is less than the designated distance as the reference frame to be matched with the labeling frame;
determining the coincidence degree between the sub-image framed by the labeling frame and the sub-image framed by each reference frame to be matched of the labeling frame;
and screening the matching reference frame of the labeling frame from the reference frames to be matched of the labeling frame according to the contact ratio, and establishing the corresponding relation between the labeling frame and the matching reference frame of the labeling frame.
Optionally, the reference frame includes at least one rectangular frame having a rotation angle with respect to the sample image.
Optionally, determining the sample image specifically includes:
determining a sample point cloud;
and projecting the sample point cloud to a designated plane in the space where the point cloud data is located to obtain a projection diagram on the designated plane as a sample image to be detected.
The present specification provides a target detection method, including:
determining a target image;
and inputting the target image into a target detection model, and obtaining a recognition result output by the target detection model, wherein the target detection model is obtained by training by adopting the method.
This specification provides a model training device, comprising:
the characteristic extraction module is used for determining a sample image, inputting the sample image to a target detection model to be trained, and obtaining a characteristic diagram corresponding to the sample image;
the identification module is used for generating a plurality of reference frames on the sample image, aiming at each reference frame, outputting an identification result based on the reference frame as an identification result corresponding to the reference frame through the target detection model according to a characteristic area corresponding to the sub-image framed by the reference frame on the characteristic map;
a parameter adjusting module, configured to adjust, for each reference frame, a parameter in the target detection model based on the correspondence between the established reference frame and the labeling frame on the sample image, with a target that a difference between the recognition result corresponding to the reference frame and the labeling result of the labeling frame corresponding to the reference frame is the minimum;
the marking module is used for determining the positions of the reference frames and the marking frames in the sample image; and aiming at each marking frame, screening out the reference frames of which the distances between at least part of the reference frames and the marking frame are smaller than the specified distance from each reference frame, and establishing the corresponding relation between the marking frame and the screened reference frames.
The present specification provides an object detection apparatus comprising:
an image determination module for determining a target image;
and the identification module is used for inputting the target image into the target detection model and obtaining the identification result output by the target detection model, wherein the target detection model is obtained by adopting the method for training.
The present specification provides a computer-readable storage medium storing a computer program which, when executed by a processor, implements the above-described model training and target detection method.
The present specification provides an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the above-mentioned model training and target detection method when executing the program.
The technical scheme adopted by the specification can achieve the following beneficial effects:
in the model training and target detection method provided in this specification, when establishing the correspondence between the annotation frame and the reference frame, a part of the reference frame closer to the annotation frame may be screened for the annotation frame according to the positions of the annotation frame and the reference frame, and the correspondence between the selected reference frame and the annotation frame may be established only for the annotation frame.
Because the calculation resources consumed for determining the positions of the labeling frame and the reference frame and for determining the distance between the labeling frame and the reference frame are smaller than the calculation resources consumed for calculating the contact ratio between the labeling frame and the reference frame, the model training method provided by the specification can be used for establishing the corresponding relationship between the labeling frame and the reference frame more quickly under the condition of occupying less calculation resources.
Drawings
The accompanying drawings, which are included to provide a further understanding of the specification and are incorporated in and constitute a part of this specification, illustrate embodiments of the specification and together with the description serve to explain the specification and not to limit the specification in a non-limiting sense. In the drawings:
FIG. 1 is a schematic flow chart of a model training method in the present specification;
FIG. 2 is a schematic diagram of a sample image provided herein;
FIG. 3 is a schematic diagram of a relationship between a sample image and a feature map provided in the present specification;
FIG. 4 is a schematic diagram of a model training apparatus provided herein;
FIG. 5 is a schematic view of an object detection device provided herein;
fig. 6 is a schematic structural diagram of an electronic device provided in this specification.
Detailed Description
In order to avoid the problem of excessive consumption of computing resources when establishing the correspondence between the labeling frame and the reference frame, the specification provides a model training method.
Because the calculation resources consumed for determining the positions of the labeling frame and the reference frame and for determining the distance between the labeling frame and the reference frame are smaller than the calculation resources consumed for calculating the contact ratio between the labeling frame and the reference frame, the model training method provided by the specification can be used for establishing the corresponding relationship between the labeling frame and the reference frame more quickly under the condition of occupying less calculation resources.
Generally, the object detection task includes locating a position of an object in space by using a detection frame with a relatively simple geometric shape, and classifying the object framed by the detection frame, and the object detection model in this embodiment of the present specification may be a model for performing any one of the above tasks, or may perform both the above two object detection tasks simultaneously, which is not limited in this specification.
In the following, the present specification will be described, by way of example only, with an object detection model executing positioning of a position of an object in space using a detection frame with a simple geometric shape.
In the actual application stage, the input of the target detection model is a target image, and the output is a recognition result of the target detection image, where the recognition result may be a recognition result of any one of the above recognition tasks, and this specification does not limit this.
In this embodiment of the present specification, the target detection model may be any existing machine learning model, for example, a Deep residual network (ResNet), a Multilayer Perceptron (MLP), a machine learning model obtained by combining several existing machine learning models, and the like, which is not limited in this embodiment of the present specification.
In order to make the objects, technical solutions and advantages of the present disclosure more clear, the technical solutions of the present disclosure will be clearly and completely described below with reference to the specific embodiments of the present disclosure and the accompanying drawings. It is to be understood that the embodiments described are only a few embodiments of the present disclosure, and not all embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments in the present specification without any creative effort belong to the protection scope of the present specification.
The technical solutions provided by the embodiments of the present description are described in detail below with reference to the accompanying drawings.
Fig. 1 is a schematic flow chart of a model training method in this specification, which specifically includes the following steps:
s100: and determining a sample image, and inputting the sample image to a target detection model to be trained to obtain a characteristic diagram corresponding to the sample image.
Before the target detection model is actually applied, in order to ensure the accuracy of the recognition result output by the target detection model, the target detection model needs to be trained, and of course, after the target detection model is applied for a period of time, the accuracy of the recognition result output by the target detection model may be poor due to the difference between the newly added data and the sample adopted during training, and at this time, the target detection model may also be trained.
It can be seen that any target detection model with training requirements can be the target detection model to be trained in the embodiments of the present specification. The following embodiments of the present specification provide a model training method for training the target detection model to be trained.
The execution subjects of the object detection method provided by the present specification and the model training method provided by the present specification may be the same or different, and taking the execution subjects of the object detection method provided by the present specification and the model training method provided by the present specification as examples, the execution subjects of the object detection method and the model training method may be any existing server or electronic device, specifically, for each of the execution subjects of the object detection method and the model training method, when the execution subject is an electronic device, the execution subject may be any existing electronic device, for example, a mobile phone, a notebook computer, a tablet computer, and the like, and when the execution subject is a server, the execution subject may be a cluster server, a distributed server, and the like.
In the following description, an execution subject of the target detection method is an automatic driving device, and an execution subject of the model training method is a server.
Before step S100 provided in this specification is executed, a sample image needs to be acquired. In an embodiment of the present specification, any existing image capturing device, such as a camera, may be used to capture an image, and the captured image may be used as a sample image.
In an embodiment of the present specification, the collected sample data may be sample point cloud, and then the sample point cloud may be projected to a designated plane in a space where the point cloud data is located, so as to obtain a projection diagram on the designated plane, which is used as a sample image to be detected. Further, the designated plane may be parallel to the ground.
Then, the sample image may be input into a target detection model to be trained, the target detection model may include a feature extraction layer, and a feature map corresponding to the sample image may be obtained through the feature extraction layer.
S102: and generating a plurality of reference frames on the sample image, aiming at each reference frame, outputting a recognition result based on the reference frame as a recognition result corresponding to the reference frame through the target detection model according to the feature area corresponding to the sub-image framed by the reference frame on the feature map.
Then, several reference frames may be generated on the sample image. The sub-images framed by the reference frame are used as a basis for generating the recognition result.
The embodiment of the specification provides the following two generation methods of reference frames:
first, a plurality of reference frames may be generated on the sample image based on the sample image according to a predetermined reference frame generation algorithm.
Secondly, a plurality of feature regions may be determined based on the generated feature map corresponding to the sample image, and then, for each feature region, an image region corresponding to the feature region on the sample image is determined, so as to obtain a reference frame framing the image region.
It should be noted that, when the reference frames are generated in the first manner, each generated reference frame has a corresponding feature region on the feature map.
In an embodiment of the present specification, the reference frame includes at least one rectangular frame having a rotation angle with respect to the sample image, so as to more accurately match the shape of the object in the sample image, and when the annotation frame is a rectangular frame having no rotation angle with respect to the reference frame, the rotation angle between the annotation frame and the reference frame needs to be calculated one by one when calculating the coincidence degree between the annotation frame and the reference frame.
Then, for each reference frame, according to the feature region corresponding to the sub-image framed by the reference frame on the feature map, the recognition result based on the reference frame can be output through the target detection model as the recognition result corresponding to the reference frame. That is, in the embodiment of the present specification, the target detection is performed with the reference frame as the anchor point, and the detected recognition result is obtained based on the reference frame.
For example, for each feature region, the feature region may be input into a recognition subnet of the target detection model, and based on the recognition subnet, a recognition result based on a reference frame corresponding to the feature region is obtained. That is, the reference frame is used as a basis for generation of the recognition result.
In an embodiment of this specification, when the target detection task is a classification task, the identification subnet may be a classifier, and when the target detection task is a positioning detection frame, the identification subnet may be a convolutional neural network, a full link layer, or the like, which is not limited in this specification.
Furthermore, in this embodiment of the present disclosure, a preset convolution kernel may be used to perform sliding window convolution on the feature map, after each sliding of the convolution kernel, an area covered by the convolution kernel is a feature area, then, the convolution kernel is used to perform convolution on the feature area, and the feature after the convolution is input into any one of the identification subnets.
When the reference frame is determined by the first method, in the embodiment of the present specification, when the convolution kernel slides to each position, the covered feature region can correspond to the image region framed by the reference frame in the sample image.
In the embodiment of the present specification, the reference frames generated on the sample image may be distributed at various positions on the sample image, and the number may be plural. Taking fig. 3 as an example, the upper side in fig. 3 shows a sample image, the lower side shows a feature map extracted based on the sample image, referring to fig. 3, in fig. 3, a dashed line frame shows a reference frame in the sample image, a dashed line frame shows a feature region corresponding to the reference frame on the feature map, taking one of the reference frames as an example, shows a corresponding relationship between the feature region and the reference frame, it should be noted that there is also a corresponding relationship between the corresponding reference frame and a center point of the feature region, that is, a position where the center point of the feature region is mapped to the sample image is a center point of the reference frame corresponding to the feature region.
Further, the size of the feature map may be at least not larger than the size of the sample image, and when the size of the feature map is larger than the size of the sample image, the step size of the convolution kernel may be larger than one.
In an embodiment of the present specification, when the size of the feature map is smaller than the size of the sample image, each feature region may correspond to a plurality of reference frames, that is, recognition results of the plurality of reference frames may be obtained according to features included in one feature region. For example, when the subnet is identified as a classifier, the subnet may include several classifiers, where each classifier corresponds to one reference frame, and the identification result output by the classifier is the identification result corresponding to the corresponding reference frame.
Further, in an embodiment of the present specification, when a feature region corresponds to a plurality of reference frames, a point on the sample image where a center point of the feature region is mapped may be a center point of each reference frame corresponding to the feature region.
S104: and based on the established corresponding relation between the reference frame and the labeling frame on the sample image, aiming at each reference frame, and taking the minimum difference between the identification result corresponding to the reference frame and the labeling result of the labeling frame corresponding to the reference frame as a target to adjust the parameters in the target detection model.
In an embodiment of the present specification, before performing step S104, the following method may be adopted to establish the correspondence between the reference frame and the annotation frame on the sample image. Specifically, the correspondence relationship may be established in the process of executing the model training method provided in the present specification as shown in fig. 1, or may be established before executing step S100, which is not limited in the present specification.
Specifically, the positions of the reference frames and the labeling frames in the sample image may be determined, then, for each labeling frame, a reference frame whose distance between at least a portion of the reference frame and the labeling frame is smaller than a specified distance is screened out from the reference frames, and a corresponding relationship between the labeling frame and the screened reference frame is established.
As can be understood by those skilled in the art, based on the established correspondence between the reference frame and the labeling frame on the sample image, for each reference frame, the parameters in the target detection model may be adjusted with the goal that the difference between the recognition result corresponding to the reference frame and the labeling result of the labeling frame corresponding to the reference frame is minimum. Furthermore, the parameters in the target detection model may be adjusted by targeting that the difference between the recognition result corresponding to each reference frame and the recognition result of the labeled frame corresponding to each reference frame is the minimum.
The recognition result corresponding to the reference frame is a recognition result obtained based on the reference frame, for example, a detection frame obtained based on the reference frame and a position offset from the reference frame, and for example, a category of an object included in a sub-image framed by a prediction frame framed by the reference frame, and the like, and is not a recognition result of the reference frame itself. As shown in fig. 2, after the reference frame shown by the dotted line in fig. 2 is associated with the labeled frame shown by the solid line, the labeled frame may be used to supervise the detection frame shown by the dotted line identified based on the reference frame shown by the dotted line. Namely, the parameters in the target detection model are adjusted by taking the difference between the detection frame and the labeling frame as the minimum target.
Therefore, it can be understood that, taking the minimum difference between the recognition result corresponding to the reference frame and the labeling result of the labeling frame corresponding to the reference frame as the target, adjusting the parameters in the target detection model, that is, using the labeling frame to supervise the recognition result obtained based on the reference frame corresponding to the labeling frame.
Based on the method shown in fig. 1, when the corresponding relationship between the labeling frame and the reference frame is established, a part of the reference frame closer to the labeling frame may be screened out for the labeling frame according to the positions of the labeling frame and the reference frame, and the corresponding relationship between the selected reference frame and the labeling frame may be established only for the labeling frame.
Because the calculation resources consumed for determining the positions of the labeling frame and the reference frame and for determining the distance between the labeling frame and the reference frame are smaller than the calculation resources consumed for calculating the contact ratio between the labeling frame and the reference frame, the model training method provided by the specification can be used for establishing the corresponding relationship between the labeling frame and the reference frame more quickly under the condition of occupying less calculation resources.
Hereinafter, the present specification exemplarily provides a screening method for screening out a reference frame, from among reference frames, at least a portion of which is less than a predetermined distance from the reference frame.
Specifically, the center point of the labeling frame and the center points of the selected reference frames may be determined, and then, for each selected reference frame, it is determined whether the distance between the center point of the labeling frame and the center point of the reference frame is not greater than a specified distance, where the specified distance is the sum of a first distance and a second distance, the first distance is the distance between the center point of the labeling frame and the corner point of the labeling frame, and the second distance is the distance between the center point of the reference frame and the corner point of the reference frame. And then, according to the distance between the center point of the labeling frame and the center point of each reference frame, screening out the reference frames of which the distance between the center point and the center point of the labeling frame is smaller than a specified distance from each reference frame.
Further, in an embodiment of the present specification, after determining the center point of the labeling frame and the center points of the selected reference frames, for each of the labeling frame and the reference frames, a circle having a center point as a center and a distance between the center point and an angular point as a radius may be determined as a circle corresponding to the labeling frame or the reference frame, and a reference frame corresponding to a circle having an overlapping area between the circles corresponding to the labeling frame may be determined as the selected reference frame. For the reference frame corresponding to the circle without the overlapping area between the circles corresponding to the labeling frame, the corresponding relation between the sub-image in the sample image framed by the reference frame and the sub-image in the sample image framed by the labeling frame does not need to be established because the overlapping area does not exist between the sub-image in the sample image framed by the reference frame and the sub-image in the sample image framed by the labeling frame.
Of course, the predetermined distance may be any value, for example, two thirds or half of the sum of the first distance and the second distance, and the predetermined distance may be set as needed, which is not limited in the present specification.
In an embodiment of this specification, after the reference frames whose distance to the labeling frame is smaller than the specified distance are screened out by any of the above manners, a part of the reference frames may be selected from the screened out reference frames to establish a matching relationship with the labeling frame. The following example illustrates one way of screening according to degree of coincidence.
Specifically, the reference frame that is selected from the reference frames and has a distance with the labeling frame smaller than a specified distance may be used as the reference frame to be matched with the labeling frame, then, the coincidence degree between the sub-image framed by the labeling frame and the sub-image framed by each reference frame to be matched with the labeling frame may be determined, then, the matching reference frame of the labeling frame may be selected from the reference frames to be matched with the labeling frame according to the coincidence degree, and the corresponding relationship between the labeling frame and the matching reference frame of the labeling frame may be established.
In an embodiment of the present specification, for each reference frame, the larger the overlapping area between the sub-image in the sample image framed by the reference frame and the sub-image in the sample image framed by the calibration image is, the greater the overlapping degree between the reference frame and the calibration frame may be. Further, the degree of coincidence may be determined according to a ratio of intersection and union (hereinafter referred to as a coincidence ratio) between the sub-images in the sample image framed by the reference frame and the sub-images in the sample image framed by the calibration image, and the degree of coincidence may be determined to be larger as the coincidence ratio is larger.
Based on the same idea, the present specification further provides a corresponding model training and target detecting apparatus, as shown in fig. 4 and 5.
Fig. 4 is a schematic diagram of a model training apparatus provided in the present specification, the apparatus including:
the feature extraction module 400 is configured to determine a sample image, input the sample image to a target detection model to be trained, and obtain a feature map corresponding to the sample image;
the identification module 402 is configured to generate a plurality of reference frames on the sample image, and for each reference frame, output, through the target detection model, an identification result based on the reference frame as an identification result corresponding to the reference frame according to a feature area corresponding to the sub-image framed by the reference frame on the feature map;
a parameter adjusting module 404, configured to adjust, for each reference frame, a parameter in the target detection model based on the established correspondence between the reference frame and the labeling frame on the sample image, with a minimum difference between the identification result corresponding to the reference frame and the labeling result of the labeling frame corresponding to the reference frame as a target;
the labeling module 406 is used for determining the positions of the reference frames and the labeling frames in the sample image; and aiming at each marking frame, screening out the reference frames of which the distances between at least part of the reference frames and the marking frame are smaller than the specified distance from each reference frame, and establishing the corresponding relation between the marking frame and the screened reference frames.
Optionally, the identifying module 402 is specifically configured to output a position offset of the prediction frame relative to the reference frame; or outputting the category of the object contained in the sub-image framed by the prediction frame determined based on the reference frame.
Optionally, the labeling module 406 is specifically configured to determine a central point of the labeling frame and central points of the screened reference frames; judging whether the distance between the center point of the labeling frame and the center point of the reference frame is not greater than a specified distance or not for each screened reference frame, wherein the specified distance is the sum of a first distance and a second distance, the first distance is the distance between the center point of the labeling frame and the corner point of the labeling frame, and the second distance is the distance between the center point of the reference frame and the corner point of the reference frame; and screening out the reference frames of which the distance between the central point and the central point of the labeling frame is less than the specified distance from the reference frames according to the distance between the central point of the labeling frame and the central point of each reference frame.
Optionally, the labeling module 406 is specifically configured to use a reference frame, which is selected from the reference frames and has a distance with the labeling frame smaller than a specified distance, as a reference frame to be matched with the labeling frame; determining the coincidence degree between the sub-image framed by the labeling frame and the sub-image framed by each reference frame to be matched of the labeling frame; and screening the matching reference frame of the labeling frame from the reference frames to be matched of the labeling frame according to the contact ratio, and establishing the corresponding relation between the labeling frame and the matching reference frame of the labeling frame.
Optionally, the reference frame includes at least one rectangular frame having a rotation angle with respect to the sample image.
Optionally, the feature extraction module 400 is specifically configured to determine a sample point cloud; and projecting the sample point cloud to a designated plane in the space where the point cloud data is located to obtain a projection diagram on the designated plane as a sample image to be detected.
Fig. 5 is a schematic diagram of an object detection apparatus provided in the present specification, the apparatus including:
an image determination module 500 for determining a target image;
the recognition module 502 is configured to input a target image into a target detection model, and obtain a recognition result output by the target detection model, where the target detection model is obtained by training using the above method.
The present specification also provides a computer-readable storage medium storing a computer program, which can be used to execute the above-mentioned model training and target detection method.
The present specification also provides a schematic structural diagram of the electronic device shown in fig. 6. As shown in fig. 6, at the hardware level, the electronic device includes a processor, an internal bus, a memory, and a non-volatile memory, but may also include hardware required for other services. The processor reads a corresponding computer program from the nonvolatile memory to the memory and then runs the computer program to realize the model training and target detection method.
Of course, besides the software implementation, the present specification does not exclude other implementations, such as logic devices or a combination of software and hardware, and the like, that is, the execution subject of the following processing flow is not limited to each logic unit, and may be hardware or logic devices.
In the 90 s of the 20 th century, improvements in a technology could clearly distinguish between improvements in hardware (e.g., improvements in circuit structures such as diodes, transistors, switches, etc.) and improvements in software (improvements in process flow). However, as technology advances, many of today's process flow improvements have been seen as direct improvements in hardware circuit architecture. Designers almost always obtain the corresponding hardware circuit structure by programming an improved method flow into the hardware circuit. Thus, it cannot be said that an improvement in the process flow cannot be realized by hardware physical modules. For example, a Programmable Logic Device (PLD), such as a Field Programmable Gate Array (FPGA), is an integrated circuit whose Logic functions are determined by programming the Device by a user. A digital system is "integrated" on a PLD by the designer's own programming without requiring the chip manufacturer to design and fabricate application-specific integrated circuit chips. Furthermore, nowadays, instead of manually making an Integrated Circuit chip, such Programming is often implemented by "logic compiler" software, which is similar to a software compiler used in program development and writing, but the original code before compiling is also written by a specific Programming Language, which is called Hardware Description Language (HDL), and HDL is not only one but many, such as abel (advanced Boolean Expression Language), ahdl (alternate Hardware Description Language), traffic, pl (core universal Programming Language), HDCal (jhdware Description Language), lang, Lola, HDL, laspam, hardward Description Language (vhr Description Language), vhal (Hardware Description Language), and vhigh-Language, which are currently used in most common. It will also be apparent to those skilled in the art that hardware circuitry that implements the logical method flows can be readily obtained by merely slightly programming the method flows into an integrated circuit using the hardware description languages described above.
The controller may be implemented in any suitable manner, for example, the controller may take the form of, for example, a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro) processor, logic gates, switches, an Application Specific Integrated Circuit (ASIC), a programmable logic controller, and an embedded microcontroller, examples of which include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320, the memory controller may also be implemented as part of the control logic for the memory. Those skilled in the art will also appreciate that, in addition to implementing the controller as pure computer readable program code, the same functionality can be implemented by logically programming method steps such that the controller is in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, embedded microcontrollers and the like. Such a controller may thus be considered a hardware component, and the means included therein for performing the various functions may also be considered as a structure within the hardware component. Or even means for performing the functions may be regarded as being both a software module for performing the method and a structure within a hardware component.
The systems, devices, modules or units illustrated in the above embodiments may be implemented by a computer chip or an entity, or by a product with certain functions. One typical implementation device is a computer. In particular, the computer may be, for example, a personal computer, a laptop computer, a cellular telephone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
For convenience of description, the above devices are described as being divided into various units by function, and are described separately. Of course, the functions of the various elements may be implemented in the same one or more software and/or hardware implementations of the present description.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
As will be appreciated by one skilled in the art, embodiments of the present description may be provided as a method, system, or computer program product. Accordingly, the description may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the description may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
This description may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only an example of the present specification, and is not intended to limit the present specification. Various modifications and alterations to this description will become apparent to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present specification should be included in the scope of the claims of the present specification.
Claims (11)
1. A method of model training, comprising:
determining a sample image, and inputting the sample image into a target detection model to be trained to obtain a characteristic diagram corresponding to the sample image;
generating a plurality of reference frames on a sample image, and for each reference frame, outputting a recognition result based on the reference frame as a recognition result corresponding to the reference frame through the target detection model according to a feature area corresponding to a sub-image framed by the reference frame on a feature map;
based on the established corresponding relation between the reference frame and the labeling frame on the sample image, aiming at each reference frame, taking the minimum difference between the identification result corresponding to the reference frame and the labeling result of the labeling frame corresponding to the reference frame as a target, and adjusting parameters in the target detection model;
the method for establishing the corresponding relationship between the reference frame and the labeling frame on the sample image specifically comprises the following steps:
determining the positions of the reference frames and the marking frames in the sample image;
and aiming at each marking frame, screening out the reference frames of which the distances between at least part of the reference frames and the marking frame are smaller than the specified distance from each reference frame, and establishing the corresponding relation between the marking frame and the screened reference frames.
2. The method of claim 1, wherein outputting the recognition result based on the reference frame specifically comprises:
outputting a positional offset of the prediction frame with respect to the reference frame; or the like, or, alternatively,
and outputting the category of the object contained in the sub-image framed by the prediction frame determined based on the reference frame.
3. The method of claim 1, wherein the step of selecting the reference frames from the reference frames with at least a portion of the distance from the labeled frame being less than a predetermined distance comprises:
determining the central point of the marking frame and the central points of the screened reference frames;
judging whether the distance between the center point of the labeling frame and the center point of the reference frame is not greater than a specified distance or not for each screened reference frame, wherein the specified distance is the sum of a first distance and a second distance, the first distance is the distance between the center point of the labeling frame and the corner point of the labeling frame, and the second distance is the distance between the center point of the reference frame and the corner point of the reference frame;
and screening out the reference frames of which the distance between the central point and the central point of the labeling frame is less than the specified distance from the reference frames according to the distance between the central point of the labeling frame and the central point of each reference frame.
4. The method of claim 1, wherein establishing the correspondence between the labeled box and the selected reference box comprises:
taking the reference frame which is screened out from each reference frame and the distance between which and the labeling frame is less than the designated distance as the reference frame to be matched with the labeling frame;
determining the coincidence degree between the sub-image framed by the labeling frame and the sub-image framed by each reference frame to be matched of the labeling frame;
and screening the matching reference frame of the labeling frame from the reference frames to be matched of the labeling frame according to the contact ratio, and establishing the corresponding relation between the labeling frame and the matching reference frame of the labeling frame.
5. The method of claim 1, wherein the reference frame comprises at least one rectangular frame having a rotation angle with respect to the sample image.
6. The method of claim 1, wherein determining the sample image specifically comprises:
determining a sample point cloud;
and projecting the sample point cloud to a designated plane in the space where the point cloud data is located to obtain a projection diagram on the designated plane as a sample image to be detected.
7. A method of object detection, comprising:
determining a target image;
inputting a target image into a target detection model, and obtaining a recognition result output by the target detection model, wherein the target detection model is obtained by training according to the method of any one of claims 1 to 6.
8. A model training device, characterized in that the device specifically includes:
the characteristic extraction module is used for determining a sample image, inputting the sample image to a target detection model to be trained, and obtaining a characteristic diagram corresponding to the sample image;
the identification module is used for generating a plurality of reference frames on the sample image, aiming at each reference frame, outputting an identification result based on the reference frame as an identification result corresponding to the reference frame through the target detection model according to a characteristic area corresponding to the sub-image framed by the reference frame on the characteristic map;
a parameter adjusting module, configured to adjust, for each reference frame, a parameter in the target detection model based on the correspondence between the established reference frame and the labeling frame on the sample image, with a target that a difference between the recognition result corresponding to the reference frame and the labeling result of the labeling frame corresponding to the reference frame is the minimum;
the marking module is used for determining the positions of the reference frames and the marking frames in the sample image; and aiming at each marking frame, screening out the reference frames of which the distances between at least part of the reference frames and the marking frame are smaller than the specified distance from each reference frame, and establishing the corresponding relation between the marking frame and the screened reference frames.
9. An object detection apparatus, characterized in that the apparatus specifically comprises:
an image determination module for determining a target image;
the identification module is used for inputting a target image into a target detection model and obtaining an identification result output by the target detection model, wherein the target detection model is obtained by training according to the method of any one of claims 1 to 6.
10. A computer-readable storage medium, characterized in that the storage medium stores a computer program which, when executed by a processor, implements the method of any of the preceding claims 1 to 7.
11. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the method of any of claims 1 to 7 when executing the program.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111637661.1A CN114219962A (en) | 2021-12-29 | 2021-12-29 | Model training and target detection method and device, storage medium and electronic equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111637661.1A CN114219962A (en) | 2021-12-29 | 2021-12-29 | Model training and target detection method and device, storage medium and electronic equipment |
Publications (1)
Publication Number | Publication Date |
---|---|
CN114219962A true CN114219962A (en) | 2022-03-22 |
Family
ID=80706682
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111637661.1A Pending CN114219962A (en) | 2021-12-29 | 2021-12-29 | Model training and target detection method and device, storage medium and electronic equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114219962A (en) |
-
2021
- 2021-12-29 CN CN202111637661.1A patent/CN114219962A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107358157B (en) | Face living body detection method and device and electronic equipment | |
CN107274442B (en) | Image identification method and device | |
CN109034183B (en) | Target detection method, device and equipment | |
CN112801229A (en) | Training method and device for recognition model | |
CN111368944B (en) | Method and device for recognizing copied image and certificate photo and training model and electronic equipment | |
CN113887608B (en) | Model training method, image detection method and device | |
CN114440903A (en) | High-precision map construction method and device, storage medium and electronic equipment | |
CN111797711A (en) | Model training method and device | |
CN114332873A (en) | Training method and device for recognition model | |
CN114419679B (en) | Data analysis method, device and system based on wearable device data | |
CN111242106A (en) | Facial image acquisition method, device and equipment and facial recognition equipment | |
CN114494381A (en) | Model training and depth estimation method and device, storage medium and electronic equipment | |
CN111368902A (en) | Data labeling method and device | |
CN112902987B (en) | Pose correction method and device | |
CN112883871B (en) | Model training and unmanned vehicle motion strategy determining method and device | |
CN111426299B (en) | Method and device for ranging based on depth of field of target object | |
CN112861831A (en) | Target object identification method and device, storage medium and electronic equipment | |
CN114219962A (en) | Model training and target detection method and device, storage medium and electronic equipment | |
CN111488776A (en) | Object detection method, object detection device and electronic equipment | |
CN112734851B (en) | Pose determination method and device | |
CN114187355A (en) | Image calibration method and device | |
CN112560530B (en) | Two-dimensional code processing method, device, medium and electronic device | |
CN114332201A (en) | Model training and target detection method and device | |
CN114926437A (en) | Image quality evaluation method and device | |
CN111539962A (en) | Target image classification method, device and 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 |