CN113065591A - Target detection method and device, electronic equipment and storage medium - Google Patents

Target detection method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN113065591A
CN113065591A CN202110340256.7A CN202110340256A CN113065591A CN 113065591 A CN113065591 A CN 113065591A CN 202110340256 A CN202110340256 A CN 202110340256A CN 113065591 A CN113065591 A CN 113065591A
Authority
CN
China
Prior art keywords
candidate frame
image
sample
network
labeling
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.)
Granted
Application number
CN202110340256.7A
Other languages
Chinese (zh)
Other versions
CN113065591B (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.)
Shanghai Sensetime Intelligent Technology Co Ltd
Original Assignee
Shanghai Sensetime Intelligent 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 Shanghai Sensetime Intelligent Technology Co Ltd filed Critical Shanghai Sensetime Intelligent Technology Co Ltd
Priority to CN202110340256.7A priority Critical patent/CN113065591B/en
Publication of CN113065591A publication Critical patent/CN113065591A/en
Application granted granted Critical
Publication of CN113065591B publication Critical patent/CN113065591B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • 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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/29Graphical models, e.g. Bayesian networks

Landscapes

  • Engineering & Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Artificial Intelligence (AREA)
  • Evolutionary Biology (AREA)
  • Evolutionary Computation (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Image Analysis (AREA)

Abstract

The present disclosure relates to a target detection method and apparatus, an electronic device, and a storage medium, the method including: acquiring an image to be processed; performing image identification processing on an image to be processed through an identification network to obtain at least one identification result of the image to be processed, wherein the identification result comprises a candidate frame and category information corresponding to the candidate frame; and obtaining a detection result of the image to be processed according to each candidate frame and the class information corresponding to each candidate frame, wherein the identification network comprises a candidate frame generation network and a classification network, in the training process of the identification network, a second training set aiming at the classification network is constructed according to the processing result of the pre-trained candidate frame generation network aiming at the sample images in the first training set and the labeling information of the sample images, and the classification network is trained according to the second training set so as to obtain the identification network according to the candidate frame generation network and the trained classification network. The embodiment of the disclosure can reduce the difficulty of target detection.

Description

Target detection method and device, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a target detection method and apparatus, an electronic device, and a storage medium.
Background
With the development of scientific technology, AI (Artificial Intelligence) technology is applied more and more widely in various industries. Computer vision is an important area of AI, and target detection is the basis for many computer vision tasks, so training a target detection network is the first task to implement many computer vision tasks.
Disclosure of Invention
The present disclosure provides a technical solution for implementing target detection.
According to an aspect of the present disclosure, there is provided an object detection method applied to an electronic device, including:
acquiring an image to be processed; performing image identification processing on the image to be processed through an identification network to obtain at least one identification result of the image to be processed, wherein the identification result comprises a candidate frame and category information corresponding to the candidate frame; and obtaining a detection result of the image to be processed according to each candidate frame and class information corresponding to each candidate frame, wherein the identification network comprises a candidate frame generation network and a classification network, in the training process of the identification network, a second training set aiming at the classification network is constructed according to a processing result of the pre-trained candidate frame generation network aiming at a sample image in a first training set and the labeling information of the sample image, and the classification network is trained according to the second training set so as to obtain the identification network according to the candidate frame generation network and the trained classification network.
According to the target detection method provided by the embodiment of the disclosure, target detection aiming at the image to be processed can be realized through the recognition network, and only the classification network needs to be trained in the training process of the recognition network.
In a possible implementation manner, the obtaining a detection result of the image to be processed according to each candidate frame and the category information corresponding to each candidate frame includes:
determining the category information as a first candidate frame of target category information from the candidate frames; determining a target candidate frame from the first candidate frames; and obtaining a detection result of the image to be processed according to the target candidate frame and the category information corresponding to the target candidate frame.
According to the target detection method provided by the embodiment of the disclosure, the target detection aiming at the image to be processed can be realized through the identification network, and the complexity of the target detection is reduced.
In a possible implementation manner, the obtaining a detection result of the image to be processed according to the target candidate frame and the category information corresponding to the target candidate frame includes:
and correcting and adjusting the coordinate information of the target candidate frame, and obtaining the detection result of the image to be processed according to the category information corresponding to the target candidate frame and the adjusted target candidate frame.
According to the target detection method provided by the embodiment of the disclosure, the target candidate frame can be corrected and adjusted to obtain a more accurate detection result, and the accuracy of the detection result is improved.
In a possible implementation manner, the performing, by an identification network, an image identification process on the image to be processed to obtain at least one identification result of the image to be processed includes:
performing image processing on the image to be processed through the candidate frame generation network to obtain at least one candidate frame information of the image to be processed, wherein the candidate frame information comprises a candidate frame and image feature information of the candidate frame; respectively carrying out image recognition on the image content in each candidate frame according to the image characteristic information corresponding to each candidate frame through the classification network to obtain the category information corresponding to each candidate frame; and obtaining at least one recognition result of the image to be processed according to the category information corresponding to at least one candidate frame.
According to the target detection method provided by the embodiment of the disclosure, the target detection aiming at the image to be processed can be realized through the identification network, and the complexity of the target detection can be reduced.
In one possible implementation, the method further includes: training the recognition network according to the first training set, wherein the first training set includes a plurality of sample groups, each sample group includes a sample image and label information of the sample image, and training the recognition network according to the first training set includes:
performing image processing on a sample image through the candidate frame generation network to obtain at least one sample candidate frame information, wherein the sample candidate frame information comprises a sample candidate frame and image characteristic information of the sample candidate frame; obtaining labeling category information corresponding to the sample candidate frame through the labeling information of the sample candidate frame and the sample image; obtaining a second training set according to the sample candidate frame information and the labeling category information corresponding to each sample candidate frame; training the classification network through the second training set; and generating a network according to the trained classification network and the candidate frame to obtain the recognition network.
According to the target detection method provided by the embodiment of the disclosure, a user can create the first training set through simple marking operation to train the recognition network, and in the process of training the recognition network, the recognition network can be obtained by only training the classification network according to the trained classification network and the pre-trained candidate frame, and as the classification network is a light-weight network and has fewer network parameters, the requirements of the network training process on the storage and calculation capacity of electronic equipment can be reduced, and the network training period is shortened.
In one possible implementation, the training of the classification network by the second training set includes:
classifying each sample candidate frame through the classification network according to the image characteristic information corresponding to each sample candidate frame to obtain prediction category information corresponding to each sample candidate frame; and training the classification network according to the prediction class information corresponding to the sample candidate frame and the labeling class information corresponding to the sample candidate frame to obtain the trained classification network.
In a possible implementation manner, the image processing the sample image through the candidate frame generation network to obtain at least one sample candidate frame information includes:
responding to training operation aiming at the recognition network, and calling a candidate box matched with a target format from a link library to generate the network according to the target format supported by the electronic equipment; and carrying out image processing on the sample image through the candidate frame generation network matched with the target format to obtain at least one sample candidate frame information in the sample image.
The target detection method provided by the embodiment of the disclosure can directly call the network in the link library, does not need to install a deep learning frame, can be used in a cross-platform manner, and can also run on windows, linux and macos systems, so that the problem that the target detection network is often realized by depending on the deep learning frame and some existing algorithm packages, the environment depends on a large amount, and the network runs in different operating systems to cause poor compatibility of the target detection method is often solved.
In a possible implementation manner, the obtaining of the annotation category information corresponding to the sample candidate frame according to the annotation information of the sample candidate frame and the sample image includes:
for any sample candidate box, determining the overlapping degree of the sample candidate box and any labeling box; and determining the labeling category information of the sample candidate frame according to the overlapping degree of the sample candidate frame and any labeling frame.
In a possible implementation manner, the determining, according to the overlapping degree of the sample candidate box and any labeling box, the labeling category information of the sample candidate box includes:
determining a target labeling frame from at least one labeling frame under the condition that the overlapping degree of the sample candidate frame and the at least one labeling frame is greater than or equal to an overlapping degree threshold value, wherein the overlapping degree of the target labeling frame and the sample candidate frame is the highest; and taking the labeling category information of the target labeling box as the labeling category information of the sample candidate box.
The target detection method provided by the embodiment of the disclosure can obtain the labeling category information of all sample candidate frames of the sample image, and further can train the classification network according to the labeling category information of the sample candidate frames to obtain the recognition network, and realize the target detection aiming at the image to be processed according to the recognition network.
According to an aspect of the present disclosure, there is provided an object detection apparatus applied to an electronic device, the apparatus including:
the acquisition module is used for acquiring an image to be processed; the first processing module is used for carrying out image identification processing on the image to be processed through an identification network to obtain at least one identification result of the image to be processed, wherein the identification result comprises a candidate frame and category information corresponding to the candidate frame; and the second processing module is used for obtaining the detection result of the image to be processed according to each candidate frame and the class information corresponding to each candidate frame, wherein the identification network comprises a candidate frame generation network and a classification network, in the training process of the identification network, a second training set aiming at the classification network is constructed according to the processing result of the pre-trained candidate frame generation network aiming at the sample images in the first training set and the labeling information of the sample images, and the classification network is trained according to the second training set so as to obtain the identification network according to the candidate frame generation network and the trained classification network.
In a possible implementation manner, the second processing module is further configured to:
determining the category information as a first candidate frame of target category information from the candidate frames; determining a target candidate frame from the first candidate frames; and obtaining a detection result of the image to be processed according to the target candidate frame and the category information corresponding to the target candidate frame.
In a possible implementation manner, the second processing module is further configured to:
and correcting and adjusting the coordinate information of the target candidate frame, and obtaining the detection result of the image to be processed according to the category information corresponding to the target candidate frame and the adjusted target candidate frame.
In a possible implementation manner, the first processing module is further configured to:
performing image processing on the image to be processed through the candidate frame generation network to obtain at least one candidate frame information of the image to be processed, wherein the candidate frame information comprises a candidate frame and image feature information of the candidate frame; respectively carrying out image recognition on the image content in each candidate frame according to the image characteristic information corresponding to each candidate frame through the classification network to obtain the category information corresponding to each candidate frame; and obtaining at least one recognition result of the image to be processed according to the category information corresponding to at least one candidate frame.
In a possible implementation manner, the apparatus further includes a training module, where the training module is configured to train the recognition network according to the first training set, where the first training set includes a plurality of sample groups, and each sample group includes a sample image and label information of the sample image, and the training module is further configured to:
performing image processing on a sample image through the candidate frame generation network to obtain at least one sample candidate frame information, wherein the sample candidate frame information comprises a sample candidate frame and image characteristic information of the sample candidate frame; obtaining labeling category information corresponding to the sample candidate frame through the labeling information of the sample candidate frame and the sample image; obtaining a second training set according to the sample candidate frame information and the labeling category information corresponding to each sample candidate frame; training the classification network through the second training set; and generating a network according to the trained classification network and the candidate frame to obtain the recognition network.
In one possible implementation manner, the training module is further configured to:
classifying each sample candidate frame through the classification network according to the image characteristic information corresponding to each sample candidate frame to obtain prediction category information corresponding to each sample candidate frame; and training the classification network according to the prediction class information corresponding to the sample candidate frame and the labeling class information corresponding to the sample candidate frame to obtain the trained classification network.
In one possible implementation manner, the training module is further configured to:
responding to training operation aiming at the recognition network, and calling a candidate box matched with a target format from a link library to generate the network according to the target format supported by the electronic equipment; and carrying out image processing on the sample image through the candidate frame generation network matched with the target format to obtain at least one sample candidate frame information in the sample image.
In a possible implementation manner, the labeling information includes a labeling box and labeling category information corresponding to the labeling box, and the training module is further configured to:
for any sample candidate box, determining the overlapping degree of the sample candidate box and any labeling box; and determining the labeling category information of the sample candidate frame according to the overlapping degree of the sample candidate frame and any labeling frame.
In one possible implementation manner, the training module is further configured to:
determining a target labeling frame from at least one labeling frame under the condition that the overlapping degree of the sample candidate frame and the at least one labeling frame is greater than or equal to an overlapping degree threshold value, wherein the overlapping degree of the target labeling frame and the sample candidate frame is the highest; and taking the labeling category information of the target labeling box as the labeling category information of the sample candidate box.
According to an aspect of the present disclosure, there is provided an electronic device including: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to invoke the memory-stored instructions to perform the above-described method.
According to an aspect of the present disclosure, there is provided a computer readable storage medium having stored thereon computer program instructions which, when executed by a processor, implement the above-described method.
In the target detection method and apparatus, the electronic device, and the storage medium provided in the embodiments of the present disclosure, target detection for an image to be processed can be achieved through an identification network, and only a classification network needs to be trained in a training process of the identification network.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure. Other features and aspects of the present disclosure will become apparent from the following detailed description of exemplary embodiments, which proceeds with reference to the accompanying drawings.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the disclosure.
FIG. 1 shows a flow diagram of a target detection method according to an embodiment of the present disclosure;
FIG. 2 shows a schematic diagram of a target detection method according to an embodiment of the present disclosure;
FIG. 3 shows a schematic diagram of a target detection method according to an embodiment of the present disclosure;
FIG. 4 shows a schematic diagram of a target detection method according to an embodiment of the present disclosure;
FIG. 5 shows a block diagram of an object detection apparatus according to an embodiment of the present disclosure;
FIG. 6 illustrates a block diagram of an electronic device 800 in accordance with an embodiment of the disclosure;
fig. 7 illustrates a block diagram of an electronic device 1900 in accordance with an embodiment of the disclosure.
Detailed Description
Various exemplary embodiments, features and aspects of the present disclosure will be described in detail below with reference to the accompanying drawings. In the drawings, like reference numbers can indicate functionally identical or similar elements. While the various aspects of the embodiments are presented in drawings, the drawings are not necessarily drawn to scale unless specifically indicated.
The word "exemplary" is used exclusively herein to mean "serving as an example, embodiment, or illustration. Any embodiment described herein as "exemplary" is not necessarily to be construed as preferred or advantageous over other embodiments.
The term "and/or" herein is merely an association describing an associated object, meaning that three relationships may exist, e.g., a and/or B, may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the term "at least one" herein means any one of a plurality or any combination of at least two of a plurality, for example, including at least one of A, B, C, and may mean including any one or more elements selected from the group consisting of A, B and C.
Furthermore, in the following detailed description, numerous specific details are set forth in order to provide a better understanding of the present disclosure. It will be understood by those skilled in the art that the present disclosure may be practiced without some of these specific details. In some instances, methods, means, elements and circuits that are well known to those skilled in the art have not been described in detail so as not to obscure the present disclosure.
The related target detection method can be realized through a target detection network, and the realization of the target detection network usually depends on a deep learning framework and some existing algorithm packages, so that the environment dependence is more, the number of network parameters of the target detection network is huge, and the requirements on the storage and calculation capacity of electronic equipment are extremely high. Therefore, it is of great significance to develop a target detection method which is light in weight, low in resource consumption and simple in operation.
The embodiment of the disclosure provides a target detection method, which may pre-train a candidate frame generation network, where the candidate frame generation network may be used to generate a candidate frame in an image to be processed and extract image feature information corresponding to image content in a candidate frame region. And then, the candidate frame generation network is called to perform image processing on the sample images in the first training set, so that a sample candidate frame corresponding to each sample image and image feature information corresponding to the image content in the sample candidate frame are generated. The sample image has the labeling information (the labeling information may include a labeling frame and labeling category information corresponding to the labeling frame), and further, the labeling category information corresponding to each sample candidate frame is determined according to the matching result and the labeling category information of the labeling frame by matching the labeling frame of the sample image with the sample candidate frame.
Further, a second training set for training the classification network may be constructed according to each sample candidate frame, the image feature information corresponding to each sample candidate frame, and the label category information corresponding to each sample candidate frame, so as to train the classification network through the second training set. Specifically, the image feature information corresponding to the sample candidate frame may be classified through a classification network to obtain prediction category information corresponding to the sample candidate frame, the classification network may be trained according to the prediction category information corresponding to the sample candidate frame and the labeled category information of the sample candidate frame, and the recognition network may be obtained according to the classification network obtained after training and a pre-trained candidate frame generation network.
After the image to be processed is obtained, the image to be processed may be subjected to image recognition processing through a recognition network to obtain at least one recognition result of the image to be processed, where the recognition result may include a candidate frame in the image to be processed and category information corresponding to the candidate frame, and then a detection result of the image to be processed may be obtained according to each candidate frame in the image to be processed and the category information corresponding to each candidate frame. For example, when the target detection object is a person, a candidate frame whose category information is a person may be determined from the recognition result, and a detection result may be obtained according to the candidate frame and the category information of the candidate frame ("person"), and after obtaining the detection result, the detection result may be displayed, for example: the candidate frame corresponding to the detection result may be displayed on the image to be processed, or the category information corresponding to the candidate frame may be displayed while the candidate frame corresponding to the detection result is displayed.
The target detection method provided by the embodiment of the disclosure can realize detection aiming at the image to be processed by using the recognition network, and in the training process of the recognition network, the training of the classification network can be guided by using the pre-trained candidate frame generation network, so that the recognition network can be obtained by constructing the candidate frame generation network and the trained classification network. That is, the target detection method provided by the embodiment of the present disclosure can implement target detection only by training the classification network, and since the classification network is a lightweight network and has few network parameters, the network training process can reduce the requirements on the storage and computation capabilities of the electronic device, and shorten the network training period.
Fig. 1 shows a flowchart of an object detection method according to an embodiment of the present disclosure, which may be performed by an electronic device such as a terminal device or a server, the terminal device may be a User Equipment (UE), a mobile device, a User terminal, a cellular phone, a cordless phone, a Personal Digital Assistant (PDA), a handheld device, a computing device, a vehicle-mounted device, a wearable device, or the like, and the method may be implemented by a processor calling a computer-readable instruction stored in a memory. Alternatively, the method may be performed by a server.
As shown in fig. 1, the target detection method may include:
in step S11, an image to be processed is acquired;
in step S12, performing image recognition processing on the image to be processed through a recognition network to obtain at least one recognition result of the image to be processed, where the recognition result includes a candidate frame and category information corresponding to the candidate frame;
in step S13, a detection result of the image to be processed is obtained based on each candidate frame and the category information corresponding to each candidate frame.
The identification network comprises a candidate frame generation network and a classification network, in the training process of the identification network, a second training set for the classification network is constructed according to the processing result of the pre-trained candidate frame generation network on a sample image in a first training set and the labeling information of the sample image, and the classification network is trained according to the second training set, so that the identification network is obtained according to the candidate frame generation network and the trained classification network.
In the embodiment of the disclosure, the electronic device may acquire the image to be processed in any one of image acquisition modes, such as image data acquisition, image data uploading, image data downloading and the like; alternatively, the image to be processed may be a video frame image in video data acquired by the electronic device. After the image to be processed is obtained, the image to be processed may be subjected to image recognition processing through a recognition network, so as to obtain at least one recognition result of the image to be processed, where the recognition result may include the candidate frame and the category information corresponding to the candidate frame.
The recognition network may be a pre-trained network, and may be configured to perform image recognition on the image to be processed to obtain at least one candidate frame in the image to be processed and category information corresponding to each candidate frame. For example, the identification network may include a candidate frame generation network and a classification network, where the candidate frame generation network may be configured to generate a plurality of candidate frames in the image to be processed and extract image feature information corresponding to image content in each candidate frame region, and the classification network may be configured to process the image feature information corresponding to each candidate frame region to obtain category information corresponding to each candidate frame. Wherein the candidate box is used for representing the area in which the object (such as a person, an object and the like) may exist in the image to be processed.
The candidate frame generation network may be a pre-trained network, and when the user wants to train the recognition network, the candidate frame generation network may be called from the link library to perform image processing on the sample images in the first training set, so as to generate the sample candidate frames corresponding to the sample images and the image feature information corresponding to the image content in the sample candidate frame areas. The sample image has the labeling information (which may include a labeling frame and labeling category information corresponding to the labeling frame), and the labeling category information corresponding to each sample candidate frame is obtained according to the matching result and the labeling category information of each labeling frame by matching the labeling frame of the sample image with the sample candidate frame.
Further, a second training set for training the recognition network may be constructed according to the candidate frames, the image feature information corresponding to the sample candidate frames, and the label category information corresponding to the sample candidate frames, and the classification network may be trained through the second training set. Specifically, the sample candidate frame can be classified by the classification network according to the image feature information corresponding to the sample candidate frame to obtain the prediction category information of the sample candidate frame, the classification loss of the classification network is calculated according to the prediction category information of the sample candidate frame and the labeling category information of the sample candidate frame, the classification network is trained according to the classification loss of the classification network, and then the network is generated according to the trained classification network and the pre-trained candidate frame to form the recognition network.
In a possible implementation manner, the performing, by an identification network, an image identification process on the image to be processed to obtain at least one identification result of the image to be processed may include:
performing image processing on the image to be processed through the candidate frame generation network to obtain at least one candidate frame information of the image to be processed, wherein the candidate frame information comprises a candidate frame and image feature information of the candidate frame;
respectively carrying out image recognition on the image content in each candidate frame according to the image characteristic information corresponding to each candidate frame through the classification network to obtain the category information corresponding to each candidate frame;
and obtaining at least one recognition result of the image to be processed according to the category information corresponding to at least one candidate frame.
For example, the candidate frame generation network may be configured to generate at least one candidate frame in the image to be processed and extract image feature information of image content in each candidate frame region to obtain at least one candidate frame information. The classification network may be configured to classify the candidate frames according to the image feature information of the candidate frames to obtain category information corresponding to each candidate frame.
For example, the candidate frame generation network in the network may be identified to perform image processing on the image to be processed, so as to obtain at least one candidate frame information of the image to be processed, and the at least one candidate frame information is used as the input information of the classification network, so that the classification network performs image identification on the image feature information of each candidate frame, and then obtains the category information corresponding to each candidate frame. And obtaining at least one recognition result of the image to be processed according to each candidate frame and the category information corresponding to each candidate frame.
After the identification network processes the image to be processed, at least one candidate frame in the image to be processed and the category information corresponding to each candidate frame can be obtained from the identification result. The candidate frame corresponding to the target detection object can be determined from the candidate frames according to the category information corresponding to each candidate frame, and a detection result is obtained. For example: the method comprises the steps that a first candidate frame with first appointed type is selected from candidate frames, and a detection result of an image to be processed is obtained according to the first candidate frame with the first appointed type and the type information corresponding to the first candidate frame, wherein the first appointed type is the type information of a target detection object; or, a second candidate frame with category information of a second specified category may be screened out from the candidate frames, and a detection result of the image to be processed is obtained according to a third candidate frame remaining after screening out and the category information corresponding to the third candidate frame, where the category information other than the second specified category is the category information of the target detection object.
In this way, after the electronic device obtains the image to be processed, the image to be processed is subjected to image recognition processing through the recognition network, so as to obtain at least one recognition result of the image to be processed, wherein the recognition result comprises the candidate frame and the category information corresponding to the candidate frame. The electronic device can obtain the detection result of the image to be processed according to each candidate frame and the category information corresponding to each candidate frame. The identification network comprises a candidate frame generation network and a classification network, in the training process of the identification network, a second training set for the classification network can be constructed according to the processing result of the pre-trained candidate frame generation network for the sample images in the first training set and the labeling information of the sample images, the classification network is trained according to the second training set, and the identification network is obtained according to the pre-trained candidate frame generation network and the trained classification network.
According to the target detection method provided by the embodiment of the disclosure, target detection aiming at the image to be processed can be realized through the recognition network, and only the classification network needs to be trained in the training process of the recognition network.
In a possible implementation manner, the obtaining a detection result of the image to be processed according to each candidate frame and the category information corresponding to each candidate frame may include:
determining the category information as a first candidate frame of target category information from the candidate frames;
determining a target candidate frame from the first candidate frames;
and obtaining a detection result of the image to be processed according to the target candidate frame and the category information corresponding to the target candidate frame.
For example, after the recognition network performs recognition processing on the image to be processed to obtain a plurality of candidate frames of the image to be processed and category information corresponding to each candidate frame, the category information may be determined from the plurality of candidate frames to be a first candidate frame of the target category information, where the target category information may include category information corresponding to a target detection object to be detected, or the target category information may be category information excluding a preset category that does not need to be detected. The object category information may be designated or preset by the user as needed, or category information other than the background may be set as default object category information.
For example: a plurality of candidate frames corresponding to the image to be processed respectively correspond to: in the case that the detected target object includes a person, a horse, a car, or a dog, it may be determined that the target category information includes a person, a horse, a car, or a dog, and thus the first candidate frame may be determined from a candidate frame of any category of a person, a horse, a car, or a dog corresponding to the category information.
After obtaining the plurality of first candidate frames, a target candidate frame may be determined from the plurality of first candidate frames, where the target candidate frame may be a candidate frame with the highest precision in the first candidate frames corresponding to the target category information. For example: when the object category information includes a person, a horse, a car, and a dog, object candidate frames corresponding to the four categories of the person, the horse, the car, and the dog may be determined from the first candidate frames, respectively. In the embodiment of the present disclosure, the number of the target candidate frames is not specifically limited, and may be one or multiple.
For example, a candidate frame with the highest accuracy may be determined as the target candidate frame from the first candidate frames with the same category information, where the accuracy may be represented by a confidence of the category information corresponding to the candidate frame output by the recognition network, and the higher the confidence, the higher the accuracy. For example: the first candidate frame with the highest confidence coefficient can be determined as the target candidate frame from the first candidate frames with the category information of human, horse, car and dog.
Alternatively, an NMS (Non-Maximum Suppression) algorithm may be employed to determine the target candidate box from the first candidate boxes. For example, after all the first candidate frames are sorted according to the confidence degree, the first candidate frame with the highest confidence degree is selected as the first target candidate frame. And continuously traversing the rest of the first candidate frames, determining the overlapping degree of the traversed first candidate frame and the first target candidate frame, and deleting the first candidate frame when the overlapping degree of the traversed first candidate frame and the first target candidate frame is greater than a preset threshold value until all the first candidate frames are traversed, and determining all the rest of the first candidate frames (including the first target candidate frame) as the target candidate frames.
The overlapping degree of the traversed first candidate frame and the first target candidate frame may be determined according to the area of the traversed first candidate frame and the area of the first target candidate frame, and for example, the determining manner of the overlapping degree may refer to the following formula (1).
Figure BDA0002999291350000091
Wherein the IOU1 is configured to identify a degree of overlap, S, between a first candidate box currently traversed and the first target candidate box1For identifying the area of the first candidate box traversed, S2Area for identifying a first target candidate box, S1,2The method includes identifying an overlapping area of the traversed first candidate box and the first target candidate box.
After the target candidate frames are obtained, the detection result for the image to be processed may be obtained according to each target candidate frame and the category information of each target candidate frame, where the image content in the target candidate frame is the corresponding target detection object, and the category information of the target candidate frame is the category information of the corresponding target detection object.
In a possible implementation manner, the obtaining a detection result of the image to be processed according to the target candidate frame and the category information corresponding to the target candidate frame may include:
and correcting and adjusting the coordinate information of the target candidate frame, and obtaining the detection result of the image to be processed according to the category information corresponding to the target candidate frame and the adjusted target candidate frame.
For example, after the target candidate frame is obtained, the coordinate information of the target candidate frame may be corrected and adjusted to obtain a more accurate target candidate frame, and further obtain a more accurate detection result.
For example, a regression linear network may be trained according to a sample candidate frame generated by the candidate frame generation network and a label frame in the sample image, and the regression linear network may be used to correct and adjust information such as size and position of the sample candidate frame, so that the information such as size and position of the sample candidate frame and the label frame after adjustment is infinitely close. For example: the regression linear network can be trained according to the coordinates of the upper left corner and the lower right corner of the sample candidate frame and the coordinates of the upper left corner and the lower right corner of the labeling frame, and after the regression linear network corrects and adjusts the coordinates of the upper left corner and the lower right corner of the sample candidate frame, the coordinates of the upper left corner and the lower right corner of the sample candidate frame can be infinitely close to the coordinates of the upper left corner and the lower right corner of the labeling frame.
After the target candidate frame is obtained, the target candidate frame may be corrected and adjusted according to the regression linear network to obtain an adjusted target candidate frame, and a detection result of the image to be processed is obtained according to the category information of the target candidate frame and the adjusted target candidate frame, where the image content in the adjusted target candidate frame in the detection result is a corresponding target detection object, and the category information of the target candidate frame is a category of the corresponding target detection object.
In this way, the target candidate frame can be corrected and adjusted to obtain a more accurate detection result, and the accuracy of the detection result can be improved.
In one possible implementation, the method may further include: training the recognition network according to the first training set, wherein the first training set comprises a plurality of sample groups, each sample group comprises a sample image and the labeling information of the sample image,
training the recognition network according to the first training set may include:
performing image processing on a sample image through the candidate frame generation network to obtain at least one sample candidate frame information, wherein the sample candidate frame information comprises a sample candidate frame and image characteristic information of the sample candidate frame;
obtaining labeling category information corresponding to the sample candidate frame through the labeling information of the sample candidate frame and the sample image;
obtaining a second training set according to the sample candidate frame information and the labeling category information corresponding to each sample candidate frame;
training the classification network through the second training set;
and generating a network according to the trained classification network and the candidate frame to obtain the recognition network.
For example, the electronic device may obtain the first training set through uploading, downloading, and the like; alternatively, the electronic device may obtain the first training set in response to a user creating operation for the first training set. Illustratively, a user can obtain a sample group by marking a label box of a sample image and label type information corresponding to the label box, and then create a first training set by marking a plurality of sample groups obtained. For example: the user can add and display a labeling frame in the sample image by triggering the adding control, can adjust the position and the size of the labeling frame by dragging and the like, can obtain labeling information of the sample image after marking the labeling type information corresponding to the labeling frame, and can obtain a sample group by triggering the determining control after obtaining at least one piece of labeling information of the sample image. By analogy, after obtaining a plurality of sample groups, a first training set can be created from the plurality of sample groups.
And calling a pre-trained candidate frame generation network to process the sample images in the first training set to obtain at least one sample candidate frame in the sample images and image characteristic information corresponding to each sample candidate frame. For example, an annotation frame matching each sample candidate frame may be determined from the annotation frames corresponding to the sample images, and annotation category information corresponding to the annotation frame matching each sample candidate frame may be determined as the annotation category information of each sample candidate frame.
For example, the matching degree of the sample candidate box and each label box can be determined, and the label box with the highest matching degree with the sample candidate box can be determined as the label box matched with the sample candidate box. In the embodiment of the present disclosure, the degree of overlapping between the sample candidate frame and the label frame may be used to represent the matching degree between the sample candidate frame and the label frame, and the higher the degree of overlapping, the higher the matching degree. In one possible implementation manner, the overlapping degree of the sample candidate box and the labeled box may be determined according to the area of the sample candidate box and the area of the labeled box, and for example, the determining manner of the overlapping degree may refer to the following formula (2).
Figure BDA0002999291350000111
Wherein the IOU2 is used for identifying the overlapping degree, S, of the sample candidate box and the label box3Area for identifying sample candidate box, S4Area for marking the marking frame, S3,4For identifying the overlapping area of the sample candidate box and the label box.
After the labeling category information corresponding to the sample candidate frame is obtained, a plurality of sample groups can be obtained according to the information of each sample candidate frame and the labeling category information corresponding to each sample candidate frame, and the plurality of sample groups form a second training set, that is, any sample group in the second training set includes the sample candidate frame, the image feature information corresponding to the sample candidate frame, and the labeling category information corresponding to the sample candidate frame.
The classification network may be trained by using the image feature information corresponding to the sample candidate box in the second training set as input data of the classification network and using the labeling category information corresponding to the sample candidate box as labeling data. After the training of the classification network is completed, the network and the trained classification network can be generated according to the pre-trained candidate frames, an identification network is constructed, the image to be processed is processed through the identification network, at least one candidate frame in the image to be processed and the classification information corresponding to each candidate frame are obtained, at least one identification result is obtained, and the detection result aiming at the image to be processed is obtained according to the identification result.
In the embodiment of the disclosure, a user can create a first training set through simple marking operation to train the recognition network, and in the process of training the recognition network, the recognition network can be obtained by only training the classification network according to the trained classification network and the pre-trained candidate frame.
In one possible implementation, the training the classification network through the second training set may include:
classifying each sample candidate frame through the classification network according to the image characteristic information corresponding to each sample candidate frame to obtain prediction category information corresponding to each sample candidate frame;
and training the classification network according to the prediction class information corresponding to the sample candidate frame and the labeling class information corresponding to the sample candidate frame to obtain the trained classification network.
For example, the image feature information corresponding to the sample candidate frame may be input into a classification network, and the classification network performs classification processing on the image feature information corresponding to the sample candidate frame to obtain prediction category information corresponding to the sample candidate frame. According to the prediction category information corresponding to the sample candidate frame and the labeling category information corresponding to the sample candidate frame, the classification loss of the classification network can be determined, and then the network parameters of the classification network are adjusted according to the classification loss until the classification loss of the classification network meets the training requirement (for example, the classification loss of the classification network is less than a loss threshold), the training aiming at the classification network is completed, and the trained classification network is obtained.
In a possible implementation manner, the image processing the sample image through the candidate frame generation network to obtain at least one sample candidate frame information may include:
responding to training operation aiming at the recognition network, and calling a candidate box matched with a target format from a link library to generate the network according to the target format supported by the electronic equipment;
and carrying out image processing on the sample image through the candidate frame generation network matched with the target format to obtain at least one sample candidate frame information in the sample image.
For example, a candidate frame generation network may be trained on a large-scale Object detection data set in advance, and after the candidate frame generation network is compressed and accelerated by a network model, the candidate frame generation network is packaged into a format suitable for windows, linux, macos, and other systems, and is respectively stored in a Link Library such as dll (Dynamic Link Library ),. so (Shared Object), and. dylib, for external invocation. The network model compression and acceleration process for the candidate frame generation network may be implemented by using a model quantization technology, and the specific process may refer to a related technology, which is not described herein again in the embodiments of the present disclosure.
When a user triggers a training operation for identifying a network (for example, a training instruction is sent in a command line manner or a control for sending the training instruction is triggered), a target format supported by the electronic device may be determined according to a system run by the electronic device, and a candidate frame matched with the target format is called from a link library to generate the network, so that the sample image is processed according to the called candidate frame generation network, and a sample candidate frame in the sample image and image feature information corresponding to the sample candidate frame are obtained. For example: in the case that the electronic device is in a windows format, it may be determined that the target format supported by the electronic device is in a dll format, and a network may be generated by calling a candidate box in the target format from a dll link library.
Therefore, the target detection method provided by the embodiment of the disclosure can directly call the network in the link library, does not need to install a deep learning frame, and can be used in a cross-platform manner, that is, can run on windows, linux, and macos systems, so that the problem that the target detection network often depends on the deep learning frame and some existing algorithm packages, depends on more environments, and often encounters the problem that the network runs in different operating systems to cause poor compatibility of the target detection method is solved.
In a possible implementation manner, the obtaining of the annotation category information corresponding to the sample candidate frame according to the annotation information of the sample candidate frame and the sample image may include:
for any sample candidate box, determining the overlapping degree of the sample candidate box and any labeling box;
and determining the labeling category information of the sample candidate frame according to the overlapping degree of the sample candidate frame and any labeling frame.
For example, after obtaining at least one sample candidate frame of the sample image, the overlapping degree between each sample candidate frame and each label frame of the sample image may be determined, and the determination method of the overlapping degree may refer to the foregoing embodiments, which are not described herein again. The matching relation between the sample candidate frame and the labeling frame can be determined according to the overlapping degree of the sample candidate frame and the labeling frame, and then the labeling category information of the sample candidate frame can be determined according to the matching relation and the labeling category information of the labeling frame, namely the labeling category information of the labeling frame matched with the sample candidate frame is determined as the labeling category information of the sample candidate frame.
In a possible implementation manner, the determining, according to the overlapping degree of the sample candidate box and any labeling box, the labeling category information of the sample candidate box may include:
determining a target labeling frame from at least one labeling frame under the condition that the overlapping degree of the sample candidate frame and the at least one labeling frame is greater than or equal to an overlapping degree threshold value, wherein the overlapping degree of the target labeling frame and the sample candidate frame is the highest;
and taking the labeling category information of the target labeling box as the labeling category information of the sample candidate box.
For example, after the overlapping degree between any sample candidate frame and at least one labeling frame of the sample image is obtained, a labeling frame whose overlapping degree with the sample candidate frame is greater than or equal to an overlapping degree threshold value may be determined, a labeling frame with the highest overlapping degree in the determined labeling frames is used as a target labeling frame, and the labeling category information of the target labeling frame is determined as the labeling category information of the sample candidate frame. The overlapping degree threshold is a preset numerical value, and specific values of the overlapping degree threshold are not specifically limited in the embodiment of the disclosure.
In a possible implementation manner, the determining, according to the overlapping degree of the sample candidate box and any labeling box, the labeling category information of the sample candidate box may include:
and under the condition that the overlapping degree of the sample candidate frame and any one of the labeling frames is smaller than the overlapping degree threshold value, determining that the labeling category information of the sample candidate frame is a background category.
For example, the image content in the region of the annotation frame corresponds to the target detection object, and when the overlap degree between the sample candidate frame and any annotation frame of the sample image is smaller than the overlap degree threshold, it indicates that there is no annotation frame matching the sample candidate frame in the sample image, that is, it may be determined that the sample candidate frame does not frame the target detection object (or does not frame the target detection object completely), and then the annotation frame category of the sample candidate frame may be determined as the background category.
Therefore, the labeling category information of all the sample candidate frames of the sample image can be obtained, the classification network can be trained according to the labeling category information of the sample candidate frames to obtain the identification network, and the target detection aiming at the image to be processed can be realized according to the identification network.
In order that those skilled in the art will better understand the embodiments of the present disclosure, the embodiments of the present disclosure may be described below by way of specific examples.
Referring to fig. 2, a candidate frame generation network may be written in a Programming Language such as C + + (The C + + Programming Language/C plus plus, C + + Language) in advance, and after The candidate frame generation network is trained on a large-scale target detection data set, The candidate frame generation network is packaged into a link library such as. dll,. so,. dylib, and The like for external invocation. The candidate frame generation network can generate a plurality of candidate frames which can be people, objects and the like and image characteristic information corresponding to image contents in each candidate frame area for a given picture.
It should be noted that, because C + + has high operation efficiency and can be conveniently packaged into a dynamic link library to facilitate hybrid programming, the candidate box generation network is written in C + + in the example of the present disclosure, but actually, other programming languages may also be used to write the candidate box generation network, for example: c language, python language, etc., and the embodiment of the present disclosure does not specifically limit the programming language for writing the candidate box generation network.
The user can mark the images in the prepared training set through the labeling software, that is, mark the labeling frame of the sample image and the labeling category information corresponding to the image content in the labeling frame (the marking process can refer to the foregoing embodiment, which is not described herein again in this disclosure), so as to obtain the first training set.
The method includes the steps of generating a network according to a system call matched with an electronic device, performing image processing on a sample image in a first training set to obtain a plurality of sample candidate frames in the sample image and image feature information corresponding to each sample candidate frame, and referring to fig. 3, where an image on the left side in fig. 3 is a sample image, an image on the right side is a sample image processed by the network generated by the candidate frames, and the processed sample image includes the plurality of sample candidate frames.
Determining a labeling frame matched with the sample candidate frame according to the overlapping degree of the sample candidate frame and each labeling frame of the sample image, and taking the labeling category information of the sample labeling frame as the labeling category information of the sample candidate frame; alternatively, in the case where there is no labeling box matching the sample candidate box, the labeling category information of the sample candidate box may be determined to be the background category. And then constructing a second training set according to the sample candidate frame, the image characteristic information corresponding to the sample candidate frame and the labeling category information of the sample candidate frame so as to train the classification network according to the second training set.
The image feature information corresponding to the sample candidate frame in the second training set is classified through the classification network to obtain the prediction category information corresponding to the sample candidate frame, and then the classification network is trained according to the prediction category information of the sample candidate frame and the labeled category information of the sample candidate frame.
And generating a network according to the trained classification network and the pre-trained sample candidate box, so as to form the recognition network.
As shown in fig. 4, after the image to be processed (see the image at the top left corner in fig. 4) is input into the recognition network for recognition processing, at least one candidate frame (see the image at the top right corner in fig. 4) of the image to be processed and the category information corresponding to each candidate frame can be obtained. After a first candidate frame (see the image at the lower right corner in fig. 4) with the category information as the target category information is determined from the candidate frames, the first candidate frame with the highest precision is determined as the target candidate frame (see the image at the lower left corner in fig. 4), the target candidate frame is adjusted and corrected, and then the detection result of the image to be processed is obtained according to the adjusted target candidate frame and the category information corresponding to the target candidate frame.
The target detection method provided by the embodiment of the disclosure can realize detection aiming at the image to be processed by using the recognition network, and because the training of the classification network can be guided by using the pre-trained candidate frame generation network in the training process of the recognition network, the recognition network can be obtained by constructing the candidate frame generation network and the trained classification network. The target detection method provided by the embodiment of the disclosure only needs to train the classification network, and the classification network is a lightweight network and has less network parameters, so that the requirements on the storage and calculation capabilities of electronic equipment can be reduced, the network training period is shortened, the operation is simple, and the method compatibility is high.
It is understood that the above-mentioned method embodiments of the present disclosure can be combined with each other to form a combined embodiment without departing from the logic of the principle, which is limited by the space, and the detailed description of the present disclosure is omitted. Those skilled in the art will appreciate that in the above methods of the specific embodiments, the specific order of execution of the steps should be determined by their function and possibly their inherent logic.
In addition, the present disclosure also provides a target detection apparatus, an electronic device, a computer-readable storage medium, and a program, which can be used to implement any one of the target detection methods provided by the present disclosure, and the corresponding technical solutions and descriptions and corresponding descriptions in the methods section are not repeated.
Fig. 5 shows a block diagram of an object detection apparatus according to an embodiment of the present disclosure, which, as shown in fig. 5, includes:
an obtaining module 51, which may be used to obtain an image to be processed;
the first processing module 52 may be configured to perform image recognition processing on the image to be processed through a recognition network, so as to obtain at least one recognition result of the image to be processed, where the recognition result includes a candidate frame and category information corresponding to the candidate frame;
the second processing module 53 may be configured to obtain a detection result of the image to be processed according to each candidate frame and the category information corresponding to each candidate frame,
the identification network comprises a candidate frame generation network and a classification network, in the training process of the identification network, a second training set for the classification network is constructed according to the processing result of the pre-trained candidate frame generation network on a sample image in a first training set and the labeling information of the sample image, and the classification network is trained according to the second training set, so that the identification network is obtained according to the candidate frame generation network and the trained classification network.
In this way, after the electronic device obtains the image to be processed, the image to be processed is subjected to image recognition processing through the recognition network, so as to obtain at least one recognition result of the image to be processed, wherein the recognition result comprises the candidate frame and the category information corresponding to the candidate frame. The electronic device can obtain the detection result of the image to be processed according to each candidate frame and the category information corresponding to each candidate frame. The identification network comprises a candidate frame generation network and a classification network, in the training process of the identification network, a second training set for the classification network can be constructed according to the processing result of the pre-trained candidate frame generation network for the sample images in the first training set and the labeling information of the sample images, the classification network is trained according to the second training set, and the identification network is obtained according to the pre-trained candidate frame generation network and the trained classification network.
The target detection device provided by the embodiment of the disclosure can realize target detection for the image to be processed through the recognition network, and only the classification network needs to be trained in the training process of the recognition network, and because the classification network is a lightweight network and has fewer network parameters, the requirements of the network training process on the storage and calculation capacity of the electronic equipment can be reduced, the network training period is shortened, and the operation difficulty of the method can be reduced.
In a possible implementation manner, the second processing module 53 may be further configured to:
determining the category information as a first candidate frame of target category information from the candidate frames;
determining a target candidate frame from the first candidate frames;
and obtaining a detection result of the image to be processed according to the target candidate frame and the category information corresponding to the target candidate frame.
In a possible implementation manner, the second processing module 53 may be further configured to:
and correcting and adjusting the coordinate information of the target candidate frame, and obtaining the detection result of the image to be processed according to the category information corresponding to the target candidate frame and the adjusted target candidate frame.
In a possible implementation manner, the first processing module 52 may be further configured to:
performing image processing on the image to be processed through the candidate frame generation network to obtain at least one candidate frame information of the image to be processed, wherein the candidate frame information comprises a candidate frame and image feature information of the candidate frame;
respectively carrying out image recognition on the image content in each candidate frame according to the image characteristic information corresponding to each candidate frame through the classification network to obtain the category information corresponding to each candidate frame;
and obtaining at least one recognition result of the image to be processed according to the category information corresponding to at least one candidate frame.
In a possible implementation manner, the apparatus may further include a training module, where the training module may be configured to train the recognition network according to the first training set, where the first training set includes a plurality of sample groups, and the sample groups include sample images and label information of the sample images, and the training module may be further configured to:
performing image processing on a sample image through the candidate frame generation network to obtain at least one sample candidate frame information, wherein the sample candidate frame information comprises a sample candidate frame and image characteristic information of the sample candidate frame;
obtaining labeling category information corresponding to the sample candidate frame through the labeling information of the sample candidate frame and the sample image;
obtaining a second training set according to the sample candidate frame information and the labeling category information corresponding to each sample candidate frame;
training the classification network through the second training set;
and generating a network according to the trained classification network and the candidate frame to obtain the recognition network.
In a possible implementation manner, the training module may be further configured to:
classifying each sample candidate frame through the classification network according to the image characteristic information corresponding to each sample candidate frame to obtain prediction category information corresponding to each sample candidate frame;
and training the classification network according to the prediction class information corresponding to the sample candidate frame and the labeling class information corresponding to the sample candidate frame to obtain the trained classification network.
In a possible implementation manner, the training module may be further configured to:
responding to training operation aiming at the recognition network, and calling a candidate box matched with a target format from a link library to generate the network according to the target format supported by the electronic equipment;
and carrying out image processing on the sample image through the candidate frame generation network matched with the target format to obtain at least one sample candidate frame information in the sample image.
In a possible implementation manner, the labeling information includes a labeling box and labeling category information corresponding to the labeling box, and the training module is further configured to:
for any sample candidate box, determining the overlapping degree of the sample candidate box and any labeling box;
and determining the labeling category information of the sample candidate frame according to the overlapping degree of the sample candidate frame and any labeling frame.
In a possible implementation manner, the training module may be further configured to:
determining a target labeling frame from at least one labeling frame under the condition that the overlapping degree of the sample candidate frame and the at least one labeling frame is greater than or equal to an overlapping degree threshold value, wherein the overlapping degree of the target labeling frame and the sample candidate frame is the highest;
and taking the labeling category information of the target labeling box as the labeling category information of the sample candidate box.
In some embodiments, functions of or modules included in the apparatus provided in the embodiments of the present disclosure may be used to execute the method described in the above method embodiments, and specific implementation thereof may refer to the description of the above method embodiments, and for brevity, will not be described again here.
Embodiments of the present disclosure also provide a computer-readable storage medium having stored thereon computer program instructions, which when executed by a processor, implement the above-mentioned method. The computer readable storage medium may be a non-volatile computer readable storage medium.
An embodiment of the present disclosure further provides an electronic device, including: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to invoke the memory-stored instructions to perform the above-described method.
The embodiments of the present disclosure also provide a computer program product, which includes computer readable code, and when the computer readable code runs on a device, a processor in the device executes instructions for implementing the object detection method provided in any one of the above embodiments.
The embodiments of the present disclosure also provide another computer program product for storing computer readable instructions, which when executed cause a computer to perform the operations of the object detection method provided in any of the above embodiments.
The electronic device may be provided as a terminal, server, or other form of device.
Fig. 6 illustrates a block diagram of an electronic device 800 in accordance with an embodiment of the disclosure. For example, the electronic device 800 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, or the like terminal.
Referring to fig. 6, electronic device 800 may include one or more of the following components: processing component 802, memory 804, power component 806, multimedia component 808, audio component 810, input/output (I/O) interface 812, sensor component 814, and communication component 816.
The processing component 802 generally controls overall operation of the electronic device 800, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing components 802 may include one or more processors 820 to execute instructions to perform all or a portion of the steps of the methods described above. Further, the processing component 802 can include one or more modules that facilitate interaction between the processing component 802 and other components. For example, the processing component 802 can include a multimedia module to facilitate interaction between the multimedia component 808 and the processing component 802.
The memory 804 is configured to store various types of data to support operations at the electronic device 800. Examples of such data include instructions for any application or method operating on the electronic device 800, contact data, phonebook data, messages, pictures, videos, and so forth. The memory 804 may be implemented by any type or combination of volatile or non-volatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disks.
The power supply component 806 provides power to the various components of the electronic device 800. The power components 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the electronic device 800.
The multimedia component 808 includes a screen that provides an output interface between the electronic device 800 and a user. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front facing camera and/or a rear facing camera. The front camera and/or the rear camera may receive external multimedia data when the electronic device 800 is in an operation mode, such as a shooting mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
The audio component 810 is configured to output and/or input audio signals. For example, the audio component 810 includes a Microphone (MIC) configured to receive external audio signals when the electronic device 800 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals may further be stored in the memory 804 or transmitted via the communication component 816. In some embodiments, audio component 810 also includes a speaker for outputting audio signals.
The I/O interface 812 provides an interface between the processing component 802 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to: a home button, a volume button, a start button, and a lock button.
The sensor assembly 814 includes one or more sensors for providing various aspects of state assessment for the electronic device 800. For example, the sensor assembly 814 may detect an open/closed state of the electronic device 800, the relative positioning of components, such as a display and keypad of the electronic device 800, the sensor assembly 814 may also detect a change in the position of the electronic device 800 or a component of the electronic device 800, the presence or absence of user contact with the electronic device 800, orientation or acceleration/deceleration of the electronic device 800, and a change in the temperature of the electronic device 800. Sensor assembly 814 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 814 may also include a light sensor, such as a Complementary Metal Oxide Semiconductor (CMOS) or Charge Coupled Device (CCD) image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 816 is configured to facilitate wired or wireless communication between the electronic device 800 and other devices. The electronic device 800 may access a wireless network based on a communication standard, such as a wireless network (WiFi), a second generation mobile communication technology (2G) or a third generation mobile communication technology (3G), or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 further includes a Near Field Communication (NFC) module to facilitate short-range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the electronic device 800 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, micro-controllers, microprocessors or other electronic components for performing the above-described methods.
In an exemplary embodiment, a non-transitory computer-readable storage medium, such as the memory 804, is also provided that includes computer program instructions executable by the processor 820 of the electronic device 800 to perform the above-described methods.
Fig. 7 illustrates a block diagram of an electronic device 1900 in accordance with an embodiment of the disclosure. For example, the electronic device 1900 may be provided as a server. Referring to fig. 7, electronic device 1900 includes a processing component 1922 further including one or more processors and memory resources, represented by memory 1932, for storing instructions, e.g., applications, executable by processing component 1922. The application programs stored in memory 1932 may include one or more modules that each correspond to a set of instructions. Further, the processing component 1922 is configured to execute instructions to perform the above-described method.
The electronic device 1900 may also include a power component 1926 configured to perform power management of the electronic device 1900, a wired or wireless network interface 1950 configured to connect the electronic device 1900 to a network, and an input/output (I/O) interface 1958. The electronic device 1900 may operate based on an operating system, such as the Microsoft Server operating system (Windows Server), stored in the memory 1932TM) Apple Inc. of the present application based on the graphic user interface operating System (Mac OS X)TM) Multi-user, multi-process computer operating system (Unix)TM) Free and open native code Unix-like operating System (Linux)TM) Open native code Unix-like operating System (FreeBSD)TM) Or the like.
In an exemplary embodiment, a non-transitory computer readable storage medium, such as the memory 1932, is also provided that includes computer program instructions executable by the processing component 1922 of the electronic device 1900 to perform the above-described methods.
The present disclosure may be systems, methods, and/or computer program products. The computer program product may include a computer-readable storage medium having computer-readable program instructions embodied thereon for causing a processor to implement various aspects of the present disclosure.
The computer readable storage medium may be a tangible device that can hold and store the instructions for use by the instruction execution device. The computer readable storage medium may be, for example, but is not limited to, an electronic memory device, a magnetic memory device, an optical memory device, an electromagnetic memory device, a semiconductor memory device, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a Static Random Access Memory (SRAM), a portable compact disc read-only memory (CD-ROM), a Digital Versatile Disc (DVD), a memory stick, a floppy disk, a mechanical coding device, such as punch cards or in-groove projection structures having instructions stored thereon, and any suitable combination of the foregoing. Computer-readable storage media as used herein is not to be construed as transitory signals per se, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through a waveguide or other transmission medium (e.g., optical pulses through a fiber optic cable), or electrical signals transmitted through electrical wires.
The computer-readable program instructions described herein may be downloaded from a computer-readable storage medium to a respective computing/processing device, or to an external computer or external storage device via a network, such as the internet, a local area network, a wide area network, and/or a wireless network. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers and/or edge servers. The network adapter card or network interface in each computing/processing device receives computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in a computer-readable storage medium in the respective computing/processing device.
The computer program instructions for carrying out operations of the present disclosure may be assembler instructions, Instruction Set Architecture (ISA) instructions, machine-related instructions, microcode, firmware instructions, state setting data, or source or object code written in any combination of one or more programming languages, including an object oriented programming language such as Smalltalk, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The computer-readable program instructions may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider). In some embodiments, the electronic circuitry that can execute the computer-readable program instructions implements aspects of the present disclosure by utilizing the state information of the computer-readable program instructions to personalize the electronic circuitry, such as a programmable logic circuit, a Field Programmable Gate Array (FPGA), or a Programmable Logic Array (PLA).
Various aspects of the present disclosure are described herein with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the disclosure. It will be understood that each block of the flowchart illustrations and/or block diagrams, and combinations of blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer-readable program instructions.
These computer-readable program instructions may be provided to a processor of a general purpose computer, special purpose computer, 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/acts specified in the flowchart and/or block diagram block or blocks. These computer-readable program instructions may also be stored in a computer-readable storage medium that can direct a computer, programmable data processing apparatus, and/or other devices to function in a particular manner, such that the computer-readable medium storing the instructions comprises an article of manufacture including instructions which implement the function/act specified in the flowchart and/or block diagram block or blocks.
The computer readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other devices to cause a series of operational steps to be performed on the computer, other programmable apparatus or other devices to produce a computer implemented process such that the instructions which execute on the computer, other programmable apparatus or other devices implement the functions/acts specified in the flowchart and/or block diagram block or blocks.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of instructions, which comprises one or more executable instructions for implementing the specified logical function(s). In some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The computer program product may be embodied in hardware, software or a combination thereof. In an alternative embodiment, the computer program product is embodied in a computer storage medium, and in another alternative embodiment, the computer program product is embodied in a Software product, such as a Software Development Kit (SDK), or the like.
Having described embodiments of the present disclosure, the foregoing description is intended to be exemplary, not exhaustive, and not limited to the disclosed embodiments. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen in order to best explain the principles of the embodiments, the practical application, or improvements made to the technology in the marketplace, or to enable others of ordinary skill in the art to understand the embodiments disclosed herein.

Claims (12)

1. An object detection method applied to an electronic device, the method comprising:
acquiring an image to be processed;
performing image identification processing on the image to be processed through an identification network to obtain at least one identification result of the image to be processed, wherein the identification result comprises a candidate frame and category information corresponding to the candidate frame;
obtaining the detection result of the image to be processed according to each candidate frame and the class information corresponding to each candidate frame,
the identification network comprises a candidate frame generation network and a classification network, in the training process of the identification network, a second training set for the classification network is constructed according to the processing result of the pre-trained candidate frame generation network on a sample image in a first training set and the labeling information of the sample image, and the classification network is trained according to the second training set, so that the identification network is obtained according to the candidate frame generation network and the trained classification network.
2. The method according to claim 1, wherein obtaining the detection result of the image to be processed according to each candidate frame and the category information corresponding to each candidate frame comprises:
determining the category information as a first candidate frame of target category information from the candidate frames;
determining a target candidate frame from the first candidate frames;
and obtaining a detection result of the image to be processed according to the target candidate frame and the category information corresponding to the target candidate frame.
3. The method according to claim 2, wherein obtaining the detection result of the image to be processed according to the target candidate frame and the category information corresponding to the target candidate frame comprises:
and correcting and adjusting the coordinate information of the target candidate frame, and obtaining the detection result of the image to be processed according to the category information corresponding to the target candidate frame and the adjusted target candidate frame.
4. The method according to any one of claims 1 to 3, wherein the performing image recognition processing on the image to be processed through a recognition network to obtain at least one recognition result of the image to be processed comprises:
performing image processing on the image to be processed through the candidate frame generation network to obtain at least one candidate frame information of the image to be processed, wherein the candidate frame information comprises a candidate frame and image feature information of the candidate frame;
respectively carrying out image recognition on the image content in each candidate frame according to the image characteristic information corresponding to each candidate frame through the classification network to obtain the category information corresponding to each candidate frame;
and obtaining at least one recognition result of the image to be processed according to the category information corresponding to at least one candidate frame.
5. The method according to any one of claims 1 to 4, further comprising: training the recognition network according to the first training set, wherein the first training set comprises a plurality of sample groups, each sample group comprises a sample image and the labeling information of the sample image,
the training of the recognition network according to the first training set comprises:
performing image processing on a sample image through the candidate frame generation network to obtain at least one sample candidate frame information, wherein the sample candidate frame information comprises a sample candidate frame and image characteristic information of the sample candidate frame;
obtaining labeling category information corresponding to the sample candidate frame through the labeling information of the sample candidate frame and the sample image;
obtaining a second training set according to the sample candidate frame information and the labeling category information corresponding to each sample candidate frame;
training the classification network through the second training set;
and generating a network according to the trained classification network and the candidate frame to obtain the recognition network.
6. The method of claim 5, wherein training the classification network with the second training set comprises:
classifying each sample candidate frame through the classification network according to the image characteristic information corresponding to each sample candidate frame to obtain prediction category information corresponding to each sample candidate frame;
and training the classification network according to the prediction class information corresponding to the sample candidate frame and the labeling class information corresponding to the sample candidate frame to obtain the trained classification network.
7. The method according to claim 5 or 6, wherein the image processing of the sample image through the candidate box generation network to obtain at least one sample candidate box information comprises:
responding to training operation aiming at the recognition network, and calling a candidate box matched with a target format from a link library to generate the network according to the target format supported by the electronic equipment;
and carrying out image processing on the sample image through the candidate frame generation network matched with the target format to obtain at least one sample candidate frame information in the sample image.
8. The method according to any one of claims 5 to 7, wherein the annotation information includes an annotation frame and annotation category information corresponding to the annotation frame, and the obtaining of the annotation category information corresponding to the sample candidate frame from the annotation information of the sample candidate frame and the sample image includes:
for any sample candidate box, determining the overlapping degree of the sample candidate box and any labeling box;
and determining the labeling category information of the sample candidate frame according to the overlapping degree of the sample candidate frame and any labeling frame.
9. The method of claim 8, wherein the determining labeling category information of the sample candidate box according to the overlapping degree of the sample candidate box and any labeling box comprises:
determining a target labeling frame from at least one labeling frame under the condition that the overlapping degree of the sample candidate frame and the at least one labeling frame is greater than or equal to an overlapping degree threshold value, wherein the overlapping degree of the target labeling frame and the sample candidate frame is the highest;
and taking the labeling category information of the target labeling box as the labeling category information of the sample candidate box.
10. An object detection apparatus, applied to an electronic device, the apparatus comprising:
the acquisition module is used for acquiring an image to be processed;
the first processing module is used for carrying out image identification processing on the image to be processed through an identification network to obtain at least one identification result of the image to be processed, wherein the identification result comprises a candidate frame and category information corresponding to the candidate frame;
a second processing module, configured to obtain a detection result of the image to be processed according to each candidate frame and the category information corresponding to each candidate frame,
the identification network comprises a candidate frame generation network and a classification network, in the training process of the identification network, a second training set for the classification network is constructed according to the processing result of the pre-trained candidate frame generation network on a sample image in a first training set and the labeling information of the sample image, and the classification network is trained according to the second training set, so that the identification network is obtained according to the candidate frame generation network and the trained classification network.
11. An electronic device, comprising:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to invoke the memory-stored instructions to perform the method of any of claims 1 to 9.
12. A computer readable storage medium having computer program instructions stored thereon, which when executed by a processor implement the method of any one of claims 1 to 9.
CN202110340256.7A 2021-03-30 2021-03-30 Target detection method and device, electronic equipment and storage medium Active CN113065591B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110340256.7A CN113065591B (en) 2021-03-30 2021-03-30 Target detection method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110340256.7A CN113065591B (en) 2021-03-30 2021-03-30 Target detection method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN113065591A true CN113065591A (en) 2021-07-02
CN113065591B CN113065591B (en) 2023-11-28

Family

ID=76564543

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110340256.7A Active CN113065591B (en) 2021-03-30 2021-03-30 Target detection method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113065591B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114241374A (en) * 2021-12-14 2022-03-25 百度在线网络技术(北京)有限公司 Training method of live broadcast processing model, live broadcast processing method, device and equipment
CN114821513A (en) * 2022-06-29 2022-07-29 威海凯思信息科技有限公司 Image processing method and device based on multilayer network and electronic equipment
CN116128954A (en) * 2022-12-30 2023-05-16 上海强仝智能科技有限公司 Commodity layout identification method, device and storage medium based on generation network

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109409517A (en) * 2018-09-30 2019-03-01 北京字节跳动网络技术有限公司 The training method and device of object detection network
US20190279045A1 (en) * 2016-12-16 2019-09-12 Beijing Sensetime Technology Development Co., Ltd Methods and apparatuses for identifying object category, and electronic devices
WO2020228179A1 (en) * 2019-05-15 2020-11-19 平安科技(深圳)有限公司 Picture instance detection method and apparatus, computer device, and storage medium

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190279045A1 (en) * 2016-12-16 2019-09-12 Beijing Sensetime Technology Development Co., Ltd Methods and apparatuses for identifying object category, and electronic devices
CN109409517A (en) * 2018-09-30 2019-03-01 北京字节跳动网络技术有限公司 The training method and device of object detection network
WO2020228179A1 (en) * 2019-05-15 2020-11-19 平安科技(深圳)有限公司 Picture instance detection method and apparatus, computer device, and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
张磊;姜军生;李昕昱;宋健;解福祥;: "基于快速卷积神经网络的果园果实检测试验研究", 中国农机化学报, no. 10 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114241374A (en) * 2021-12-14 2022-03-25 百度在线网络技术(北京)有限公司 Training method of live broadcast processing model, live broadcast processing method, device and equipment
CN114821513A (en) * 2022-06-29 2022-07-29 威海凯思信息科技有限公司 Image processing method and device based on multilayer network and electronic equipment
CN116128954A (en) * 2022-12-30 2023-05-16 上海强仝智能科技有限公司 Commodity layout identification method, device and storage medium based on generation network
CN116128954B (en) * 2022-12-30 2023-12-05 上海强仝智能科技有限公司 Commodity layout identification method, device and storage medium based on generation network

Also Published As

Publication number Publication date
CN113065591B (en) 2023-11-28

Similar Documents

Publication Publication Date Title
CN109697734B (en) Pose estimation method and device, electronic equipment and storage medium
WO2021051857A1 (en) Target object matching method and apparatus, electronic device and storage medium
TW202113680A (en) Method and apparatus for association detection for human face and human hand, electronic device and storage medium
CN113065591B (en) Target detection method and device, electronic equipment and storage medium
US11461925B2 (en) Pose prediction method and apparatus, and model training method and apparatus
CN110443366B (en) Neural network optimization method and device, and target detection method and device
CN110633755A (en) Network training method, image processing method and device and electronic equipment
CN112001321A (en) Network training method, pedestrian re-identification method, network training device, pedestrian re-identification device, electronic equipment and storage medium
CN112465843A (en) Image segmentation method and device, electronic equipment and storage medium
CN110458218B (en) Image classification method and device and classification network training method and device
EP3147802B1 (en) Method and apparatus for processing information
CN107563994B (en) Image significance detection method and device
CN112991553B (en) Information display method and device, electronic equipment and storage medium
CN114240882A (en) Defect detection method and device, electronic equipment and storage medium
US20210326649A1 (en) Configuration method and apparatus for detector, storage medium
CN111242303A (en) Network training method and device, and image processing method and device
CN113806054A (en) Task processing method and device, electronic equipment and storage medium
CN110633715B (en) Image processing method, network training method and device and electronic equipment
EP3825894A1 (en) Method, device and terminal for performing word segmentation on text information, and storage medium
CN110955800A (en) Video retrieval method and device
CN112102300A (en) Counting method and device, electronic equipment and storage medium
CN109635926B (en) Attention feature acquisition method and device for neural network and storage medium
CN111784773A (en) Image processing method and device and neural network training method and device
CN110333903B (en) Method and device for determining page loading duration
CN111488964A (en) Image processing method and device and neural network training method and device

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