WO2019201029A1 - Candidate box update method and apparatus - Google Patents
Candidate box update method and apparatus Download PDFInfo
- Publication number
- WO2019201029A1 WO2019201029A1 PCT/CN2019/077397 CN2019077397W WO2019201029A1 WO 2019201029 A1 WO2019201029 A1 WO 2019201029A1 CN 2019077397 W CN2019077397 W CN 2019077397W WO 2019201029 A1 WO2019201029 A1 WO 2019201029A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- candidate
- box
- overlap
- boxes
- updated
- 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.)
- Ceased
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/285—Selection of pattern recognition techniques, e.g. of classifiers in a multi-classifier system
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
Definitions
- the present application relates to the field of computers, and in particular, to a method and apparatus for updating an alternative frame.
- Non-Maximum Suppression is widely used in computer vision algorithms such as face recognition, edge detection or target detection.
- the classifier is an important part of the NMS computer vision algorithm, which can be used to detect objects in an image, such as whether it is a face or the like. For an object in the image, the classifier generates a plurality of candidate boxes. The classifier calculates the classifier score for each candidate box. In order to accurately detect or identify an object, only one optimal candidate frame is reserved for one object, and the content of the optimal candidate frame is used as an object to be identified or detected.
- the candidate box with the highest score of the classifier in all the candidate frames in the image is selected, and the overlapping area of the candidate frame with the highest score of the other candidate frame and the classifier is calculated by traversing, and the parts of the other candidate frames are deleted according to the overlapping area.
- Optional box. The candidate box with the highest score of the classifier is again selected in the other candidate boxes that have not been deleted, and the traversal calculation of the overlap area is performed again until all the alternative boxes except the optimal candidate frame are deleted.
- the number of candidate frames is very large, resulting in an increase in the amount of traversal calculation, which in turn increases the computational complexity of the NMS algorithm, reducing the efficiency of image recognition and detection.
- the present application provides a method and apparatus for updating an alternative frame, which can improve the efficiency of updating an optional frame, thereby improving the efficiency of image recognition and detection.
- the present application provides an alternative frame update method, including: obtaining, according to location information and a location vector of a first candidate frame, an overlap between a first candidate frame and a plurality of second candidate frames, An alternative box is an alternative box with the highest score of the classifier in the set of candidate boxes, and the second candidate box is an alternative box in the set of candidate boxes except the first candidate box, the position vector includes a plurality of second Position information of the candidate box; comparing the overlap degree and the overlap degree threshold of the first candidate box with the plurality of second candidate boxes to obtain an updated set of candidate boxes.
- the degree of overlap between the first candidate frame and the plurality of second candidate frames can be obtained by one calculation.
- the calculated overlap and overlap degree thresholds of the first candidate box and the second candidate box may be used to obtain an candidate box in the updated candidate box set.
- the position vector can greatly reduce the time required to update the candidate box in the candidate box set, and the efficiency of updating the candidate box is improved, thereby improving the use of the candidate box in the present application.
- the efficiency of the method's NMS method improves the efficiency of image recognition and detection.
- the first candidate box is compared with the overlap degree and the overlap threshold of the plurality of second candidate boxes to obtain an updated set of candidate boxes, including: When the overlap degree of the second candidate box and the first candidate box in the second candidate box is less than or equal to the overlap degree threshold, determining that the second candidate box remains in the updated candidate box set; When the degree of overlap of the second candidate box and the first candidate box in the candidate box is greater than the overlap threshold, it is determined that the second candidate box is not retained in the updated set of candidate boxes.
- Maintaining a second candidate frame with a degree of overlap with the first candidate frame that is less than or equal to the overlap degree threshold as an alternative frame in the updated candidate set of frames, and deleting the overlap with the first candidate frame is greater than the overlap threshold The second alternative box.
- the candidate frame updating method further includes: using the location information of the first candidate frame in the updated candidate frame set and the updated location vector to obtain the updated candidate.
- each target recognition frame can identify one target object.
- the degree of overlap between the first candidate frame and the second candidate frame is obtained by using the position vector for each update of the candidate frame set, thereby reducing the time taken to identify the plurality of target objects in the image, and improving the plurality of recognition images. The productivity of the target object.
- the set of candidate boxes includes a plurality of candidate boxes for identifying faces in the image.
- the present application provides an alternative frame updating apparatus, including: an overlap acquiring module, configured to obtain a first candidate frame and multiple second devices according to location information and a location vector of the first candidate frame.
- the overlap of the marquee, the first candidate box is the candidate box with the highest score of the classifier in the set of candidate boxes, and the second candidate box is the candidate box of the set of candidate boxes except the first candidate box.
- the location vector includes location information of the plurality of second candidate frames, and an update module, configured to compare the overlap degree and the overlap threshold of the first candidate frame with the plurality of second candidate frames to obtain an updated candidate frame set.
- the updating module is specifically configured to determine, when the overlap degree of the second candidate box and the first candidate box in the multiple second candidate frames is less than or equal to the overlap degree threshold
- the second candidate box is reserved in the updated candidate box set; when the overlap degree of the second candidate box and the first candidate box in the plurality of second candidate boxes is greater than the overlap degree threshold, determining the second standby The marquee does not remain in the updated set of alternate boxes.
- the overlap acquiring module is further configured to obtain the updated candidate frame by using the location information of the first candidate frame in the updated candidate set of frames and the updated location vector.
- the update module is further configured to compare the overlap between the first candidate box in the updated set of candidate boxes and the overlap and overlap thresholds of the plurality of second candidate boxes in the updated set of candidate boxes To obtain the updated candidate box set again, until the overlap degree of the first candidate box in the updated candidate box set obtained by the overlap degree acquiring module and the second candidate box in the updated candidate box set All of which are greater than the overlap threshold, the update module is configured to stop updating the set of candidate boxes, and to use the first candidate box in the set of candidate boxes and the first candidate box in the set of candidate boxes after each update. , as the target recognition box.
- the set of candidate boxes includes a plurality of candidate boxes for identifying faces in the image.
- the second aspect and the candidate frame updating device in the implementation of the second aspect can also achieve the same technical effects as the candidate frame updating method in the above technical solution.
- the present application provides an alternative frame updating apparatus, including a memory, a processor, and a program stored on the memory and executable on the processor, and the processor implements an alternative as in the foregoing technical solution when executing the program.
- the frame update method can achieve the same technical effect as the candidate frame update method in the above technical solution.
- the present application provides a storage medium on which a program is stored, and when the program is executed by the processor, an optional frame update method in the foregoing technical solution is implemented, and an optional block update in the foregoing technical solution can be achieved.
- the same technical effect of the method is not limited to:
- FIG. 3 is a schematic diagram showing changes of an alternative box for two screenings in NMS calculation according to an embodiment of the present application
- FIG. 4 is a schematic diagram of an alternative frame in the image to be tested in the embodiment of the present application.
- FIG. 5 is a schematic structural diagram of an apparatus for updating an alternative frame according to an embodiment of the present application.
- FIG. 6 is a schematic structural diagram of hardware of an alternative frame updating device in an embodiment of the present application.
- the present application provides an alternative frame updating method and apparatus, which can be applied to a scene of visual image processing.
- a target recognition frame can be generated.
- the content in the target recognition frame is the target object in the image under test.
- a plurality of identification frames may be generated for one target object, and the plurality of identification frames are candidates for the target recognition frame, hereinafter referred to as an optional frame (including the first candidate frame and the first Two alternative boxes).
- An optimal candidate box ie, the first candidate box
- the target image may include multiple target objects, and multiple rounds of candidate boxes need to be filtered to obtain an optimal candidate box corresponding to all target objects.
- the screening of each round of alternative boxes, except for the screening of the last round of alternate boxes, will be updated to get the set of candidate boxes that are filtered in the next round of candidate boxes.
- the update of the candidate boxes in the set of candidate boxes may employ the alternate box update method in this application.
- the candidate frame update in the embodiment of the present application may be implemented by adding a vector processing unit to the image processing device or adding a vector processing function to the existing unit in the image processing device.
- the candidate box update in the embodiment of the present application is specifically applicable to a method of Non-Maximum Suppression (NMS).
- NMS Non-Maximum Suppression
- the NMS method can be used in target object recognition for visual image processing.
- the image processing device may be specifically a non-maximum suppression device.
- the non-maximum suppression device may collect non-maximum suppression data including the classifier score of the candidate frame in the measured image and the position information of the candidate frame.
- the collected non-maximum suppression data can be transferred from the system double data rate (English: Double Data Rate, DDR) to the local storage space (ie, Local Memory) through integrated direct memory access (IDMA). )in.
- the size of the local storage space is limited, and the non-maximum suppression data in the system DDR needs to be transferred to the local storage space in batches.
- the unit implementing the vector processing function in the non-maximum suppression device may generate a position vector according to the vectorization instruction and the non-maximum value suppression data, and perform calculation of the position vector and other data until all the recognition target objects in the measured image are obtained. Or track the target recognition frame of the target object.
- FIG. 1 is a flowchart of an alternate frame update method in an embodiment of the present application.
- the candidate frame updating method may include step S101 and step S102.
- step S101 the degree of overlap between the first candidate frame and the plurality of second candidate frames is obtained according to the location information of the first candidate frame and the location vector.
- the first candidate box is an candidate box with the highest score of the classifier in the set of candidate boxes.
- the second alternative box is an alternative box in the set of candidate boxes other than the first candidate box.
- the set of candidate boxes includes a plurality of candidate boxes.
- the location information can characterize the location of the candidate frame in the image being measured. For example, if the candidate frame is a rectangular frame, the position information may be the coordinates of the four vertices of the rectangular frame in the image to be measured, or the position information may be a pair of vertices on the diagonal line of the rectangular frame in the image to be tested. The coordinates in . Based on the location information of the two candidate boxes, the degree of overlap of the two candidate boxes can be calculated.
- the location vector includes location information of a plurality of second candidate frames. That is to say, the position vector includes a plurality of elements, and one element is position information of a second alternative frame. Using the position information of the first candidate frame and the position vector, the degree of overlap of the first candidate frame and the plurality of second candidate frames can be calculated at one time.
- step S102 the first candidate box is compared with the overlap degree and the overlap degree threshold of the plurality of second candidate boxes to obtain an updated set of candidate boxes.
- the degree of overlap may be an Intersection Over Union (IOU) or a ratio of the area of the overlap to the area of the candidate frame, which is not limited herein.
- the overlap degree threshold may be a overlap area threshold, or may be a ratio threshold of the overlap area to the candidate frame area, and is not limited herein.
- the second candidate box with the degree of overlap with the first candidate box being less than or equal to the overlap degree threshold is reserved as an alternative box in the updated set of candidate boxes.
- the second candidate box having a degree of overlap with the first candidate box that is greater than the overlap degree threshold is not retained in the updated set of candidate boxes.
- the second candidate box with the overlap degree of the first candidate frame greater than the overlap degree threshold is deleted. That is, the second candidate box with the degree of overlap with the first candidate box being greater than the overlap threshold does not participate in the next round of candidate box screening.
- the calculation amount required for updating the next round of the candidate box set is reduced, and the resources occupied by the calculation of the next round of the candidate box set are also reduced, and the efficiency of updating the candidate box set is improved, thereby further improving The efficiency of the NMS method.
- the NMS method can be implemented by using the candidate frame update method of the embodiment of the present application. Specifically, the overlap degree calculation in the step S101 and the step S102 and the updated content of the candidate frame set can be repeated by using the updated candidate frame set until the update is performed. The degree of overlap of the first candidate block in the subsequent set of candidate blocks with the second candidate block in the updated set of candidate blocks is greater than the overlap threshold, and the updating of the set of candidate blocks may be stopped. All of the first candidate boxes obtained during the process of updating the candidate box multiple times can be used as the target recognition box.
- the degree of overlap between the first candidate frame and the plurality of second candidate frames can be obtained by one calculation.
- the calculated overlap and overlap degree thresholds of the first candidate box and the second candidate box may be used to obtain an candidate box in the updated candidate box set.
- the location vector can greatly reduce the time required for updating the candidate box in the candidate box set, and the efficiency of updating the candidate box is improved, thereby improving the utilization of the embodiment of the present application.
- the efficiency of the NMS method of the marquee update method improves the efficiency of image recognition and detection.
- the following is an example of identifying a target object in a measured image by using a non-maximum suppression method, and explaining the details of the non-maximum suppression method using the candidate frame update method and the candidate frame update method therein.
- FIG. 2 is a flowchart of a method for non-maximum value suppression in the embodiment of the present application. As shown in FIG. 2, the method of non-maximum value suppression may include steps S201 to S205.
- step S201 in the candidate box set, the candidate box with the highest score of the classifier is selected as the first candidate box.
- the initial set of candidate boxes includes all candidate boxes on the image to be tested.
- the classifier calculates the classifier score for each candidate box. By inputting the measured image and the candidate box on the measured image into the classifier, the classifier score of each candidate frame on the measured image can be obtained.
- the classifier can gradually improve the classification and scoring standards through machine learning.
- the classifier score reflects the degree to which each candidate box matches the target object in the image being measured. The higher the classifier score of the candidate box, the higher the degree to which the candidate box matches the target object in the image under test.
- Multiple candidate boxes may be generated for each target object in the image being measured.
- multiple screenings are required.
- a first candidate box is obtained in each screening, and the first candidate box is an alternative box that best matches the target object.
- the candidate box with the highest score of the classifier can be selected as the first candidate box.
- the candidate frame updating method and the NMS method in the embodiments of the present application can be applied to scenes such as face recognition, edge detection, or target detection.
- scenes such as face recognition, edge detection, or target detection.
- the set of candidate boxes contains a plurality of candidate boxes for identifying faces in the image.
- the face in the image can be recognized more efficiently by using the candidate frame updating method and the NMS method in the embodiment of the present application.
- step S202 a position vector is generated using the position information of the second candidate frame.
- the second candidate box includes an alternative box in the set of candidate boxes except the first candidate box.
- the 6 candidate boxes are D1, D2, D3, D4, D5 and D6.
- the classifier score of the candidate box D1 is 0.98
- the classifier score of the candidate box D2 is 0.81
- the classifier score of the candidate box D3 is 0.69
- the classifier score of the candidate box D4 is 0.48
- the classifier score is 0.24 and the classifier score for candidate box D6 is 0.58.
- the first candidate box is the candidate box D1
- the second candidate box is the candidate box D2, the candidate box D3, the candidate box D4, the candidate box D5, and the candidate box D6.
- Each location vector includes location information for a plurality of second candidate frames.
- the position information of each second candidate box can be used as an element in the position vector.
- the number of elements in the position vector can be preset, for example, according to a specific work scene and work requirements, and is not limited herein.
- the number of second candidate boxes may be divisible by the number of elements preset by the position vector, ie, at least one position vector is generated. Then, in the candidate frame update process, the degree of overlap between the first candidate frame and all the second candidate frames is obtained according to the location information of the first candidate frame and the at least one location vector. For example, in the process of an alternate box update, the number of elements of the preset position vector is four, and the number of the second candidate frame is eight, and two position vectors can be generated.
- the number of second candidate frames may not be divisible by the number of elements preset by the position vector, and based on the generation of the at least one position vector, there is also an integer single second candidate that does not form a position vector.
- the degree of overlap of the first candidate frame with the second candidate frame involved in the location vector may be obtained according to the location information of the first candidate frame and the at least one location vector.
- the location information of the first candidate frame and the location information of the integer single second candidate frame may be used to obtain the degree of overlap between the first candidate frame and the integer single second candidate frame. For example, in one screening, there are 8 second candidate boxes, and the number of elements of the preset position vector is 3, and position information of 2 position vectors and 2 single second candidate boxes is generated.
- the second candidate frame may be sorted in descending order of the classifier score, and the number of elements per preset position vector may be second selected in descending order of the classifier score.
- the position information of the box is used as a position vector.
- the remainder obtained by quoting the number of the second candidate frames and the number of elements of the preset position vector is selected according to the order of the classifier scores of the second candidate frame from low to high, and the remaining second candidate frames are selected.
- the position information of the remaining second candidate boxes is taken as the position information of the integer single second candidate frame. That is to say, if at least one position vector is generated, there is also position information of P second candidate frames in which the position vector is not formed, and P is a positive integer. Then, the location information of the P second candidate frames is the location information of the P second candidate frames with the lowest score of the classifier.
- step S203 vector calculation is performed on the position information and the position vector of the first candidate frame to obtain the degree of overlap between the first candidate frame and the second candidate frame.
- a vectorization instruction can be generated in the case where vector calculation is required, and vector calculation is triggered according to the vectorization instruction.
- the vector calculation may calculate the degree of overlap of the first candidate box with the plurality of second candidate boxes in a position vector at one time. For example, let the number of second candidate boxes be 8, and the number of elements in the position vector be four. If the NMS method in the prior art is used, it is necessary to perform 8 calculations in order to obtain the overlap of the first candidate box and all the 8 second candidate boxes in one screening. With the NMS method in the embodiment of the present application, the degree of overlap between the first candidate box and all the eight second candidate boxes is obtained in one screening, and only two calculations are needed. The amount of calculation in the NMS method is greatly reduced, and the calculation time spent by the NMS method is reduced.
- step S204 if the degree of overlap between the first candidate frame and the second candidate frame is not all greater than the overlap threshold, the candidate set of frames is updated to include the overlap with the first candidate frame being less than or A second alternative box equal to the overlap threshold.
- step S205 if the degree of overlap between the first candidate box and the second candidate box is greater than the overlap degree threshold, the updating of the candidate box set is stopped.
- multiple screenings may be required.
- the first candidate box is selected in each screening, and the degree of overlap between the first candidate box and the second candidate box in the current screening is calculated.
- the screening is stopped until the overlap between the first candidate box and all the second candidate boxes in the current screening is greater than the overlap threshold.
- the first candidate box is obtained in each screening, that is, an alternative frame that best matches each of the target objects in the image to be measured is obtained.
- a second candidate box with a degree of overlap with the first candidate box that is greater than the overlap threshold may be deleted in each screening. That is to say, the second candidate box whose overlap degree with the first candidate box in the current screening is greater than the overlap degree threshold is no longer involved in the calculation of the screening after the current screening. The calculation amount and the time taken for calculation are reduced, and the resources occupied by the calculation are also reduced, and the efficiency of the NMS method is further improved.
- an index number (ie, Index) can be set for each candidate box, and an attribute (ie, Flags) is set for each candidate box, and the attribute of the candidate box indicates the candidate box and the first candidate in the current filter. Whether the overlap of the boxes is greater than the overlap threshold.
- FIG. 3 is a schematic diagram showing changes of an alternative box for two screenings in NMS calculation in the embodiment of the present application. As shown in FIG. 3, an attribute of 0 indicates that the degree of overlap with the first candidate box is less than or equal to the overlap degree threshold, and an attribute of 1 indicates that the degree of overlap with the first candidate box is greater than the overlap threshold.
- the attributes corresponding to the index numbers 0, 1, 2, and 3 are 0, 1, 1, and 0, respectively.
- the candidate box with the attribute 1 is deleted, and the candidate box with the index numbers 0 and 3 is left in the mth filter.
- FIG. 4 is a schematic diagram of an alternative frame in the image to be tested in the embodiment of the present application.
- the test image includes a total of seven candidate boxes, which are an optional box D1, an optional box D2, an optional box D3, an optional box D4, an optional box D5, an optional box D6, and a standby device. Box D7.
- the classifier scores of the candidate block D1, the candidate box D2, the candidate box D3, the candidate box D4, the candidate box D5, the candidate box D6, and the candidate box D7 are 0.98, 0.81, 0.69, 0.48, 0.58, respectively. 0.24 and 0.36.
- the overlap threshold is the percentage of the overlap area to the area of the candidate frame, and the overlap threshold is 20%.
- the seven candidate boxes can be arranged according to the classifier score, and the order of arrangement is the candidate box D1, the candidate box D2, the candidate box D3, the candidate box D6, the candidate box D4, the candidate box D7, and the candidate box. D5.
- the candidate box D1 with the highest score of the classifier is selected as the first candidate box, the candidate box D2, the candidate box D3, the candidate box D6, the candidate box D4, the candidate box D7, and the preparation Box D5 is the second alternative box.
- the first position vector includes position information of the candidate box D2, position information of the candidate box D3, and position information of the candidate box D6.
- the second position vector includes position information of the candidate box D4, position information of the candidate box D7, and position information of the candidate box D5. Then, the calculation needs to be performed twice, and the first calculation results the overlap degree between the first candidate box D1 and the candidate box D2, the candidate box D3 and the candidate box D6 in the first position vector, and the second calculation is obtained. The degree of overlap of each of the first candidate box D1 and the candidate box D4, the candidate box D5, and the candidate box D7 in the second position vector.
- the degree of overlap of the first candidate box D1 and the candidate box D2 is greater than 20%; the degree of overlap of the first candidate box D1 with the candidate box D3 is greater than 20%; the degree of overlap of the first candidate box D1 with the candidate box D6 Less than 20%; the degree of overlap of the first candidate box D1 and the candidate box D4 is greater than 20%; the degree of overlap of the first candidate box D1 with the candidate box D7 is less than 20%; the first candidate box D5 and the candidate box The overlap of D2 is less than 20%. Then, the candidate box D2 and the candidate box D3 are deleted.
- the set of candidate boxes includes an alternative box D6, an alternate box D4, an alternate box D7, and an alternate box D5.
- the candidate box D6 with the highest score of the classifier is selected as the first candidate box.
- a position vector is generated, which includes the position information of the candidate box D4, the position information of the candidate box D7, and the position information of the candidate box D5.
- the degree of overlap The degree of overlap of the first candidate block D6 and the candidate box D4 is less than 20%; the degree of overlap of the first candidate box D6 with the candidate box D7 is greater than 20%; the degree of overlap of the first candidate box D6 with the candidate box D5 More than 20%.
- the candidate box D4 is deleted.
- the candidate box D7 is selected as the first candidate box, and the degree of overlap between the first candidate box D7 and the candidate box D5 is calculated.
- the degree of overlap of the first candidate block D7 with the candidate box D5 is less than 20%.
- the candidate box D5 is also used as the first candidate box, and the update of the candidate box in the candidate box set is stopped, and the NMS calculation is completed.
- the position information of one calculation vector and two single second candidate frames is generated in the first screening.
- the seven candidate boxes can be arranged according to the classifier score, and the order of arrangement is the candidate box D1, the candidate box D2, the candidate box D3, the candidate box D6, the candidate box D4, the candidate box D7, and the candidate box. D5.
- the candidate box D1 with the highest score of the classifier is selected as the first candidate box.
- the location vector includes location information of the candidate frame D2, location information of the candidate frame D3, location information of the candidate frame D6, and location information of the candidate frame D4.
- the location information of the two single second candidate frames is the location information of the candidate frame D7 and the location information of the candidate frame D5, respectively.
- the first calculation calculates the degree of overlap between the first candidate box D1 and the candidate box D2, the candidate box D3, the candidate box D6 and the candidate box D4 in the position vector, and the second calculation results the first candidate box.
- the degree of overlap of D1 with the candidate box D5 is calculated for the third time to obtain the degree of overlap between the first candidate box D1 and the candidate box D7.
- the degree of overlap of the first candidate box D1 and the candidate box D2 is greater than 20%; the degree of overlap of the first candidate box D1 with the candidate box D3 is greater than 20%; the degree of overlap of the first candidate box D1 with the candidate box D6 Less than 20%; the degree of overlap of the first candidate box D1 and the candidate box D4 is greater than 20%; the degree of overlap of the first candidate box D1 with the candidate box D7 is less than 20%; the first candidate box D5 and the candidate box The overlap of D2 is less than 20%. Then, the candidate box D2 and the candidate box D3 are deleted.
- the set of candidate boxes includes an alternative box D6, an alternate box D4, an alternate box D7, and an alternate box D5.
- the candidate box D6 with the highest score of the classifier is selected as the first candidate box.
- the degree of overlap of the first candidate box D6 with the candidate box D4, the candidate box D7, and the candidate box D5, respectively, is calculated.
- the degree of overlap of the first candidate block D6 and the candidate box D4 is less than 20%; the degree of overlap of the first candidate box D6 with the candidate box D7 is greater than 20%; the degree of overlap of the first candidate box D6 with the candidate box D5 More than 20%.
- the candidate box D4 is deleted.
- the candidate box D7 is selected as the first candidate box, and the degree of overlap between the first candidate box D7 and the candidate box D5 is calculated.
- the degree of overlap of the first candidate block D7 with the candidate box D5 is less than 20%.
- the candidate box D5 is also used as the first candidate box, and the update of the candidate box in the candidate box set is stopped, and the NMS calculation is completed.
- FIG. 5 is a schematic structural diagram of an apparatus for updating an alternative frame according to an embodiment of the present application.
- the candidate box updating apparatus 300 may include an overlap degree acquiring module 301 and an updating module 302.
- the overlap obtaining module 301 is configured to obtain the degree of overlap between the first candidate frame and the plurality of second candidate frames according to the location information and the location vector of the first candidate frame.
- the first candidate box is an candidate box with the highest score of the classifier in the set of candidate boxes.
- the second alternative box is an alternative box in the set of candidate boxes other than the first candidate box.
- the location vector includes location information of a plurality of second candidate frames.
- the updating module 302 is configured to compare the first candidate box with the overlap degree and the overlap degree threshold of the plurality of second candidate boxes to obtain an updated set of candidate frames.
- the foregoing update module 302 is specifically configured to determine that the second candidate frame remains in the updated state when the overlap degree of the second candidate frame and the first candidate frame in the multiple second candidate frames is less than or equal to the overlap degree threshold. In the set of candidate boxes; determining that the second candidate box does not remain in the updated candidate when the degree of overlap of the second candidate box and the first candidate box in the plurality of second candidate boxes is greater than the overlap threshold In the box collection.
- the overlap acquiring module 301 is further configured to use the location information of the first candidate frame in the updated candidate set of frames and the updated location vector to obtain the updated candidate set.
- the updated location vector includes location information of a plurality of second candidate frames in the updated set of candidate frames.
- the update module 302 is further configured to compare the overlap degree and the overlap threshold of the first candidate block in the updated set of candidate blocks with the plurality of second candidate blocks in the updated set of candidate blocks to obtain again The updated set of candidate boxes until the overlap degree of the first candidate frame in the updated candidate set of the block obtained by the overlap obtaining module 301 and the second candidate frame in the updated set of candidate blocks is greater than
- the overlap threshold the update module 302 is further configured to stop updating the set of candidate boxes, and to use the first candidate box in the set of candidate boxes and the first candidate box in the set of candidate boxes after each update. , as the target recognition box.
- the set of candidate boxes contains a plurality of candidate boxes for identifying faces in the image.
- the set of candidate boxes contains a plurality of candidate boxes for identifying the target objects in the image.
- FIG. 6 is a schematic structural diagram of hardware of an alternative frame updating device 400 in the embodiment of the present application.
- the alternate frame update device 400 includes a memory 401, a processor 402, and a computer program stored on the memory 401 and executable on the processor 402.
- the processor 402 described above can include a central processing unit (CPU), or an specific integrated circuit (ASIC), or can be configured to implement one or more integrated circuits of embodiments of the present application.
- CPU central processing unit
- ASIC specific integrated circuit
- Memory 401 can include mass storage for data or instructions.
- the memory 401 may comprise a HDD, a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape or a universal serial bus (USB) drive, or a combination of two or more of these.
- Memory 401 may include removable or non-removable (or fixed) media, where appropriate.
- Memory 401 may be internal or external to data query device 400, where appropriate.
- memory 401 is a non-volatile solid state memory.
- memory 401 includes a read only memory (ROM).
- the ROM may be a mask programmed ROM, a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (EEPROM), an electrically rewritable ROM (EAROM) or flash memory or A combination of two or more of these.
- PROM programmable ROM
- EPROM erasable PROM
- EEPROM electrically erasable PROM
- EAROM electrically rewritable ROM
- flash memory or A combination of two or more of these.
- the processor 402 runs a program corresponding to the executable program code by reading the executable program code stored in the memory 401 for performing the alternate frame update method in the various embodiments described above and the NMS method including the candidate frame update. .
- the alternate frame update device 400 can also include a communication interface 403 and a bus 404. As shown in FIG. 6, the memory 401, the processor 402, and the communication interface 403 are connected by the bus 404 and complete communication with each other.
- the communication interface 403 is mainly used to implement communication between modules, devices, units and/or devices in the embodiments of the present application. Communication interface 403 is also accessible to input devices and/or output devices.
- Bus 404 includes hardware, software, or both, coupling components of data querying device 400 to each other.
- bus 404 may include an accelerated graphics port (AGP) or other graphics bus, an enhanced industry standard architecture (EISA) bus, a front side bus (FSB), a super transfer (HT) interconnect, an industry standard architecture (ISA) Bus, Infinite Bandwidth Interconnect, Low Pin Count (LPC) Bus, Memory Bus, Micro Channel Architecture (MCA) Bus, Peripheral Component Interconnect (PCI) Bus, PCI-Express (PCI-X) Bus, Serial Advanced Technical Attachment (SATA) bus, Video Electronics Standards Association Local (VLB) bus or other suitable bus or a combination of two or more of these.
- Bus 404 may include one or more buses, where appropriate. Although a particular bus is described and illustrated in this application, the present application contemplates any suitable bus or interconnect.
- An embodiment of the present application further provides a storage medium, where the program is stored, and when the program is executed by the processor, the candidate box update method in the foregoing embodiments and the NMS method including the candidate box update may be implemented.
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Data Mining & Analysis (AREA)
- Bioinformatics & Cheminformatics (AREA)
- Bioinformatics & Computational Biology (AREA)
- Life Sciences & Earth Sciences (AREA)
- Evolutionary Biology (AREA)
- Evolutionary Computation (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Artificial Intelligence (AREA)
- Image Analysis (AREA)
Abstract
Description
本申请要求于2018年04月19日提交中国国家知识产权局、申请号为201810355286.3、申请名称为“备选框更新方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese Patent Application filed on April 19, 2018, the Chinese National Intellectual Property Office, the application number is 201810355286.3, and the application name is "Alternative Box Update Method and Device", the entire contents of which are incorporated herein by reference. In the application.
本申请涉及计算机领域,尤其涉及一种备选框更新的方法及装置。The present application relates to the field of computers, and in particular, to a method and apparatus for updating an alternative frame.
非极大值抑制(英文:Non-Maximum Suppression,NMS)被广泛应用在计算机视觉算法中,比如,人脸识别、边缘检测或目标检测等方面。分类器为NMS计算机视觉算法中的重要部分,其可以用于检测图像中的对象,比如是否为人脸等,针对图像中的一个对象,分类器会产生多个备选框。分类器会对每一个备选框计算分类器得分。为了能够准确地进行对象的检测或识别,对于一个对象只保留一个最优的备选框,将最优的备选框中的内容作为识别或检测出的对象。Non-Maximum Suppression (NMS) is widely used in computer vision algorithms such as face recognition, edge detection or target detection. The classifier is an important part of the NMS computer vision algorithm, which can be used to detect objects in an image, such as whether it is a face or the like. For an object in the image, the classifier generates a plurality of candidate boxes. The classifier calculates the classifier score for each candidate box. In order to accurately detect or identify an object, only one optimal candidate frame is reserved for one object, and the content of the optimal candidate frame is used as an object to be identified or detected.
具体的,选取图像中所有备选框中分类器得分最高的备选框,遍历计算其他备选框与分类器得分最高的备选框的重叠面积,根据重叠面积删除其他备选框中的部分备选框。在未被删除的其他备选框中再次选取分类器得分最高的备选框,再次执行重叠面积的遍历计算,直至除最优备选框外的其他备选框全部被删除。在较复杂的图像中,备选框的数目非常大,导致遍历计算量增大,从而使得NMS算法的计算量也随之增大,降低了图像识别和检测的工作效率。Specifically, the candidate box with the highest score of the classifier in all the candidate frames in the image is selected, and the overlapping area of the candidate frame with the highest score of the other candidate frame and the classifier is calculated by traversing, and the parts of the other candidate frames are deleted according to the overlapping area. Optional box. The candidate box with the highest score of the classifier is again selected in the other candidate boxes that have not been deleted, and the traversal calculation of the overlap area is performed again until all the alternative boxes except the optimal candidate frame are deleted. In a more complex image, the number of candidate frames is very large, resulting in an increase in the amount of traversal calculation, which in turn increases the computational complexity of the NMS algorithm, reducing the efficiency of image recognition and detection.
发明内容Summary of the invention
本申请提供了一种备选框更新的方法及装置,能够提高更新备选框的效率,进而提高图像识别和检测的工作效率。The present application provides a method and apparatus for updating an alternative frame, which can improve the efficiency of updating an optional frame, thereby improving the efficiency of image recognition and detection.
第一方面,本申请提供了一种备选框更新方法,包括:根据第一备选框的位置信息和位置向量,得到第一备选框与多个第二备选框的重叠度,第一备选框为备选框集合中分类器得分最高的备选框,第二备选框为备选框集合中除第一备选框之外的备选框,位置向量包括多个第二备选框的位置信息;将第一备选框与多个第二备选框的重叠度和重叠度阈值进行比较以得到更新后的备选框集合。In a first aspect, the present application provides an alternative frame update method, including: obtaining, according to location information and a location vector of a first candidate frame, an overlap between a first candidate frame and a plurality of second candidate frames, An alternative box is an alternative box with the highest score of the classifier in the set of candidate boxes, and the second candidate box is an alternative box in the set of candidate boxes except the first candidate box, the position vector includes a plurality of second Position information of the candidate box; comparing the overlap degree and the overlap degree threshold of the first candidate box with the plurality of second candidate boxes to obtain an updated set of candidate boxes.
在本申请实施例中,利用第一备选框的位置信息和位置向量,通过一次计算即可得到第一备选框与多个第二备选框的重叠度。并可利用计算得到的第一备选框与第二备选框的重叠度与重叠度阈值,得到更新后的备选框集合中的备选框。在更新备选框的过程中,利用位置向量可大大减少更新备选框集合中的备选框所需要的时间,提高了更新备选框的效率,从而提高了利用本申请中备选框更新方法的NMS方法的效率,进而提高了图像识别和检测的工作效率。In the embodiment of the present application, by using the location information and the location vector of the first candidate frame, the degree of overlap between the first candidate frame and the plurality of second candidate frames can be obtained by one calculation. The calculated overlap and overlap degree thresholds of the first candidate box and the second candidate box may be used to obtain an candidate box in the updated candidate box set. In the process of updating the candidate box, the position vector can greatly reduce the time required to update the candidate box in the candidate box set, and the efficiency of updating the candidate box is improved, thereby improving the use of the candidate box in the present application. The efficiency of the method's NMS method, in turn, improves the efficiency of image recognition and detection.
在第一方面的一种实现方式中,将第一备选框与多个第二备选框的重叠度和重叠 度阈值进行比较以得到更新后的备选框集合,包括:在多个第二备选框中的第二备选框和第一备选框的重叠度小于或等于重叠度阈值时,确定第二备选框保留在更新后的备选框集合中;在多个第二备选框中的第二备选框和第一备选框的重叠度大于重叠度阈值时,确定第二备选框不保留在更新后的备选框集合中。In an implementation manner of the first aspect, the first candidate box is compared with the overlap degree and the overlap threshold of the plurality of second candidate boxes to obtain an updated set of candidate boxes, including: When the overlap degree of the second candidate box and the first candidate box in the second candidate box is less than or equal to the overlap degree threshold, determining that the second candidate box remains in the updated candidate box set; When the degree of overlap of the second candidate box and the first candidate box in the candidate box is greater than the overlap threshold, it is determined that the second candidate box is not retained in the updated set of candidate boxes.
保留与第一备选框的重叠度小于或等于重叠度阈值的第二备选框作为更新后的备选框集合中的备选框,删除与第一备选框的重叠度大于重叠度阈值的第二备选框。从而减少了参与下一次备选框集合更新的备选框的数目,相应减小了下一次备选框集合更新所需的运算量和占用资源,进一步提高了备选框集合更新的效率。Maintaining a second candidate frame with a degree of overlap with the first candidate frame that is less than or equal to the overlap degree threshold as an alternative frame in the updated candidate set of frames, and deleting the overlap with the first candidate frame is greater than the overlap threshold The second alternative box. Thereby, the number of candidate blocks participating in the next candidate box set update is reduced, and the amount of operation and occupied resources required for the next candidate box set update are correspondingly reduced, thereby further improving the efficiency of updating the candidate box set.
在第一方面的一种实现方式中,备选框更新方法还包括:利用更新后的备选框集合中的第一备选框的位置信息和更新后的位置向量,得到更新后的备选框集合中的第一备选框与更新后的备选框集合中多个第二备选框的重叠度,更新后的位置向量包括更新后的备选框集合中的多个第二备选框的位置信息;将更新后的备选框集合中的第一备选框与更新后的备选框集合中的多个第二备选框的重叠度和重叠度阈值进行比较以再次得到更新后的备选框集合,直至更新后的备选框集合中的第一备选框与更新后的备选框集合中的第二备选框的重叠度均大于重叠度阈值,停止对备选框集合的更新;将备选框集合中的第一备选框和每次更新后的备选框集合中的第一备选框,作为目标识别框。In an implementation manner of the first aspect, the candidate frame updating method further includes: using the location information of the first candidate frame in the updated candidate frame set and the updated location vector to obtain the updated candidate. The degree of overlap of the first candidate box in the set of boxes with the plurality of second candidate boxes in the updated set of candidate boxes, the updated position vector comprising a plurality of second alternatives in the updated set of candidate blocks Position information of the box; comparing the overlap between the first candidate box in the updated set of candidate boxes with the overlap and overlap thresholds of the plurality of second candidate boxes in the updated set of candidate boxes to be updated again The subsequent set of candidate boxes until the overlap between the first candidate box in the updated set of candidate boxes and the second candidate box in the updated set of candidate boxes is greater than the overlap threshold, stopping the candidate An update of the set of boxes; the first candidate box in the set of candidate boxes and the first candidate box in the set of candidate boxes after each update are used as target recognition frames.
在图像中存在多个目标对象的场景下,通过多次更新备选框集合中的备选框,可得到多个目标识别框,每个目标识别框可识别一个目标对象。而且,在每次更新备选框集合利用位置向量得到第一备选框与第二备选框的重叠度,可减少识别图像中多个目标对象所花费的时间,提高了识别图像中多个目标对象的工作效率。In a scenario where there are multiple target objects in the image, by updating the candidate boxes in the candidate box set multiple times, multiple target recognition frames can be obtained, and each target recognition frame can identify one target object. Moreover, the degree of overlap between the first candidate frame and the second candidate frame is obtained by using the position vector for each update of the candidate frame set, thereby reducing the time taken to identify the plurality of target objects in the image, and improving the plurality of recognition images. The productivity of the target object.
在第一方面的一种实现方式中,备选框集合中包含多个用于识别图像中人脸的备选框。In one implementation of the first aspect, the set of candidate boxes includes a plurality of candidate boxes for identifying faces in the image.
第二方面,本申请提供了一种备选框更新装置,包括:重叠度获取模块,用于根据第一备选框的位置信息和位置向量,得到第一备选框与多个第二备选框的重叠度,第一备选框为备选框集合中分类器得分最高的备选框,第二备选框为备选框集合中除第一备选框之外的备选框,位置向量包括多个第二备选框的位置信息;更新模块,用于将第一备选框与多个第二备选框的重叠度和重叠度阈值进行比较以得到更新后的备选框集合。In a second aspect, the present application provides an alternative frame updating apparatus, including: an overlap acquiring module, configured to obtain a first candidate frame and multiple second devices according to location information and a location vector of the first candidate frame. The overlap of the marquee, the first candidate box is the candidate box with the highest score of the classifier in the set of candidate boxes, and the second candidate box is the candidate box of the set of candidate boxes except the first candidate box. The location vector includes location information of the plurality of second candidate frames, and an update module, configured to compare the overlap degree and the overlap threshold of the first candidate frame with the plurality of second candidate frames to obtain an updated candidate frame set.
在第二方面的一种实现方式中,更新模块具体用于:在多个第二备选框中的第二备选框和第一备选框的重叠度小于或等于重叠度阈值时,确定第二备选框保留在更新后的备选框集合中;在多个第二备选框中的第二备选框和第一备选框的重叠度大于重叠度阈值时,确定第二备选框不保留在更新后的备选框集合中。In an implementation manner of the second aspect, the updating module is specifically configured to determine, when the overlap degree of the second candidate box and the first candidate box in the multiple second candidate frames is less than or equal to the overlap degree threshold The second candidate box is reserved in the updated candidate box set; when the overlap degree of the second candidate box and the first candidate box in the plurality of second candidate boxes is greater than the overlap degree threshold, determining the second standby The marquee does not remain in the updated set of alternate boxes.
在第二方面的一种实现方式中,重叠度获取模块还用于利用更新后的备选框集合中的第一备选框的位置信息和更新后的位置向量,得到更新后的备选框集合中的第一备选框与更新后的备选框集合中多个第二备选框的重叠度,更新后的位置向量包括更新后的备选框集合中的多个第二备选框的位置信息;更新模块还用于将更新后的备选框集合中的第一备选框与更新后的备选框集合中的多个第二备选框的重叠度和重叠度阈值进行比较以再次得到更新后的备选框集合,直至重叠度获取模块得到的更新后的 备选框集合中的第一备选框与更新后的备选框集合中的第二备选框的重叠度均大于重叠度阈值,更新模块用于停止对备选框集合的更新,并用于将备选框集合中的第一备选框和每次更新后的备选框集合中的第一备选框,作为目标识别框。In an implementation manner of the second aspect, the overlap acquiring module is further configured to obtain the updated candidate frame by using the location information of the first candidate frame in the updated candidate set of frames and the updated location vector. The degree of overlap of the first candidate box in the set with the plurality of second candidate boxes in the updated set of candidate boxes, the updated position vector including the plurality of second candidate boxes in the updated set of candidate boxes Position information; the update module is further configured to compare the overlap between the first candidate box in the updated set of candidate boxes and the overlap and overlap thresholds of the plurality of second candidate boxes in the updated set of candidate boxes To obtain the updated candidate box set again, until the overlap degree of the first candidate box in the updated candidate box set obtained by the overlap degree acquiring module and the second candidate box in the updated candidate box set All of which are greater than the overlap threshold, the update module is configured to stop updating the set of candidate boxes, and to use the first candidate box in the set of candidate boxes and the first candidate box in the set of candidate boxes after each update. , as the target recognition box.
在第二方面的一种实现方式中,备选框集合中包含多个用于识别图像中人脸的备选框。In an implementation of the second aspect, the set of candidate boxes includes a plurality of candidate boxes for identifying faces in the image.
第二方面以及第二方面的实现方式中的备选框更新装置也可达到与上述技术方案中的备选框更新方法相同的技术效果。The second aspect and the candidate frame updating device in the implementation of the second aspect can also achieve the same technical effects as the candidate frame updating method in the above technical solution.
第三方面,本申请提供了一种备选框更新装置,包括存储器、处理器及存储在存储器上并可在处理器上运行的程序,处理器执行程序时实现如上述技术方案中的备选框更新方法,可达到与上述技术方案中的备选框更新方法相同的技术效果。In a third aspect, the present application provides an alternative frame updating apparatus, including a memory, a processor, and a program stored on the memory and executable on the processor, and the processor implements an alternative as in the foregoing technical solution when executing the program. The frame update method can achieve the same technical effect as the candidate frame update method in the above technical solution.
第四方面,本申请提供了一种存储介质,其上存储有程序,程序被处理器执行时实现如上述技术方案中的备选框更新方法,可达到与上述技术方案中的备选框更新方法相同的技术效果。In a fourth aspect, the present application provides a storage medium on which a program is stored, and when the program is executed by the processor, an optional frame update method in the foregoing technical solution is implemented, and an optional block update in the foregoing technical solution can be achieved. The same technical effect of the method.
图1为本申请实施例中一种备选框更新方法的流程图;1 is a flowchart of an alternate frame update method in an embodiment of the present application;
图2为本申请实施例中一种非极大值抑制的方法的流程图;2 is a flowchart of a method for non-maximum value suppression in the embodiment of the present application;
图3为本申请实施例中NMS计算中两次筛选的备选框的变化示意图;FIG. 3 is a schematic diagram showing changes of an alternative box for two screenings in NMS calculation according to an embodiment of the present application; FIG.
图4为本申请实施例中被测图像中的备选框示意图;4 is a schematic diagram of an alternative frame in the image to be tested in the embodiment of the present application;
图5为本申请实施例中一种备选框更新装置的结构示意图;FIG. 5 is a schematic structural diagram of an apparatus for updating an alternative frame according to an embodiment of the present application;
图6为本申请实施例中的一种备选框更新设备的硬件结构示意图。FIG. 6 is a schematic structural diagram of hardware of an alternative frame updating device in an embodiment of the present application.
本申请提供了一种备选框更新方法及装置,可应用于视觉图像处理的场景中。在视觉图像处理的场景中,需要在被测图像中识别目标对象或追踪目标对象。为了标识被测图像中的目标对象,可生成目标识别框。目标识别框中的内容即为被测图像中的目标对象。在识别目标对象的过程中,对于一个目标对象可能会产生多个识别框,这多个识别框均为目标识别框的备选,在下文中简称为备选框(包括第一备选框和第二备选框)。在一个目标对象的备选框中筛选出最优的备选框(即第一备选框)作为目标备选框。在一些情况下,被测图像中可能包括多个目标对象,则需要进行多轮备选框的筛选,得到所有目标对象对应的最优的备选框。除最后一轮备选框的筛选以外的每一轮备选框的筛选均会更新得到下一轮备选框的筛选中被筛选的备选框集合。备选框集合中的备选框的更新即可采用本申请中的备选框更新方法。The present application provides an alternative frame updating method and apparatus, which can be applied to a scene of visual image processing. In a scene of visual image processing, it is necessary to identify a target object or track a target object in the image to be measured. To identify the target object in the image under test, a target recognition frame can be generated. The content in the target recognition frame is the target object in the image under test. In the process of identifying the target object, a plurality of identification frames may be generated for one target object, and the plurality of identification frames are candidates for the target recognition frame, hereinafter referred to as an optional frame (including the first candidate frame and the first Two alternative boxes). An optimal candidate box (ie, the first candidate box) is selected as an target candidate box in an candidate box of a target object. In some cases, the target image may include multiple target objects, and multiple rounds of candidate boxes need to be filtered to obtain an optimal candidate box corresponding to all target objects. The screening of each round of alternative boxes, except for the screening of the last round of alternate boxes, will be updated to get the set of candidate boxes that are filtered in the next round of candidate boxes. The update of the candidate boxes in the set of candidate boxes may employ the alternate box update method in this application.
在本申请实施例中,可通过在图像处理设备中增加向量处理单元或在图像处理设备中已有的单元中增添向量处理功能实现本申请实施例中的备选框更新。本申请实施例中的备选框更新具体可应用于非极大值抑制(英文:Non-Maximum Suppression,NMS)的方法中。NMS方法可用于视觉图像处理的目标对象识别中。在一个示例中,图像处理设备可具体为非极大值抑制设备。非极大值抑制设备可采集非极大值抑制数据,非极大值抑制数据包括被测图像中备选框的分类器得分以及备选框的位置信息等。采集 的非极大值抑制数据可通过集成直接存储访问(英文:Integrated Direct Memory Access,IDMA)从系统双倍数据速率(英文:Double Data Rate,DDR)分批次传输本地存储空间(即Local Memory)中。本地存储空间大小是有限的,需要将系统DDR中的非极大值抑制数据分批传输至本地存储空间中。非极大值抑制设备中实现向量处理功能的单元可根据向量化指令和非极大值抑制数据生成位置向量,并进行位置向量与其他数据的计算,直至得到被测图像中的所有识别目标对象或追踪目标对象的目标识别框。In the embodiment of the present application, the candidate frame update in the embodiment of the present application may be implemented by adding a vector processing unit to the image processing device or adding a vector processing function to the existing unit in the image processing device. The candidate box update in the embodiment of the present application is specifically applicable to a method of Non-Maximum Suppression (NMS). The NMS method can be used in target object recognition for visual image processing. In one example, the image processing device may be specifically a non-maximum suppression device. The non-maximum suppression device may collect non-maximum suppression data including the classifier score of the candidate frame in the measured image and the position information of the candidate frame. The collected non-maximum suppression data can be transferred from the system double data rate (English: Double Data Rate, DDR) to the local storage space (ie, Local Memory) through integrated direct memory access (IDMA). )in. The size of the local storage space is limited, and the non-maximum suppression data in the system DDR needs to be transferred to the local storage space in batches. The unit implementing the vector processing function in the non-maximum suppression device may generate a position vector according to the vectorization instruction and the non-maximum value suppression data, and perform calculation of the position vector and other data until all the recognition target objects in the measured image are obtained. Or track the target recognition frame of the target object.
图1为本申请实施例中一种备选框更新方法的流程图。如图1所示,备选框更新方法可包括步骤S101和步骤S102。FIG. 1 is a flowchart of an alternate frame update method in an embodiment of the present application. As shown in FIG. 1, the candidate frame updating method may include step S101 and step S102.
在步骤S101中,根据第一备选框的位置信息和位置向量,得到第一备选框与多个第二备选框的重叠度。In step S101, the degree of overlap between the first candidate frame and the plurality of second candidate frames is obtained according to the location information of the first candidate frame and the location vector.
其中,第一备选框为备选框集合中分类器得分最高的备选框。第二备选框为备选框集合中除第一备选框之外的备选框。备选框集合包括多个备选框。位置信息可表征备选框在被测图像中的位置。比如,备选框为矩形框,则位置信息可为矩形框的四个顶点在被测图像中的坐标,或者,位置信息可为矩形框的一对位于对角线上的顶点在被测图像中的坐标。根据两个备选框的位置信息,可计算这两个备选框的重叠度。The first candidate box is an candidate box with the highest score of the classifier in the set of candidate boxes. The second alternative box is an alternative box in the set of candidate boxes other than the first candidate box. The set of candidate boxes includes a plurality of candidate boxes. The location information can characterize the location of the candidate frame in the image being measured. For example, if the candidate frame is a rectangular frame, the position information may be the coordinates of the four vertices of the rectangular frame in the image to be measured, or the position information may be a pair of vertices on the diagonal line of the rectangular frame in the image to be tested. The coordinates in . Based on the location information of the two candidate boxes, the degree of overlap of the two candidate boxes can be calculated.
位置向量包括多个第二备选框的位置信息。也就是说,位置向量包括多个元素,一个元素为一个第二备选框的位置信息。利用第一备选框的位置信息与位置向量,可一次性计算得到第一备选框和多个第二备选框的重叠度。The location vector includes location information of a plurality of second candidate frames. That is to say, the position vector includes a plurality of elements, and one element is position information of a second alternative frame. Using the position information of the first candidate frame and the position vector, the degree of overlap of the first candidate frame and the plurality of second candidate frames can be calculated at one time.
在步骤S102中,将第一备选框与多个第二备选框的重叠度和重叠度阈值进行比较以得到更新后的备选框集合。In step S102, the first candidate box is compared with the overlap degree and the overlap degree threshold of the plurality of second candidate boxes to obtain an updated set of candidate boxes.
需要说明的是,重叠度可以为重叠面积(Intersection Over Union,IOU),也可为重叠面积占备选框面积的比例,在此并不限定。对应的,重叠度阈值可以为重叠面积阈值,也可以为重叠面积占备选框面积的比例阈值,在此也并不限定。It should be noted that the degree of overlap may be an Intersection Over Union (IOU) or a ratio of the area of the overlap to the area of the candidate frame, which is not limited herein. Correspondingly, the overlap degree threshold may be a overlap area threshold, or may be a ratio threshold of the overlap area to the candidate frame area, and is not limited herein.
其中,保留与第一备选框的重叠度小于或等于重叠度阈值的第二备选框作为更新后的备选框集合中的备选框。与第一备选框的重叠度大于重叠度阈值的第二备选框不保留在更新后的备选框集合中。比如,将与第一备选框的重叠度大于重叠度阈值的第二备选框删除。即与第一备选框的重叠度大于重叠度阈值的第二备选框不参与下一轮备选框筛选。减小了下一轮备选框集合更新时所需的计算量,也减小了下一轮备选框集合更新时计算所占用的资源,提高了备选框集合更新的效率,从而进一步提高了NMS方法的效率。Wherein, the second candidate box with the degree of overlap with the first candidate box being less than or equal to the overlap degree threshold is reserved as an alternative box in the updated set of candidate boxes. The second candidate box having a degree of overlap with the first candidate box that is greater than the overlap degree threshold is not retained in the updated set of candidate boxes. For example, the second candidate box with the overlap degree of the first candidate frame greater than the overlap degree threshold is deleted. That is, the second candidate box with the degree of overlap with the first candidate box being greater than the overlap threshold does not participate in the next round of candidate box screening. The calculation amount required for updating the next round of the candidate box set is reduced, and the resources occupied by the calculation of the next round of the candidate box set are also reduced, and the efficiency of updating the candidate box set is improved, thereby further improving The efficiency of the NMS method.
利用本申请实施例的备选框更新方法可实现NMS方法,具体的,可利用更新后的备选框集合重复步骤S101和步骤S102中的重叠度计算以及备选框集合更新的内容,直至更新后的备选框集合中的第一备选框与更新后的备选框集合中的第二备选框的重叠度均大于重叠度阈值,可停止对备选框集合的更新。在多次对备选框进行更新的过程中得到的所有第一备选框可作为目标识别框。The NMS method can be implemented by using the candidate frame update method of the embodiment of the present application. Specifically, the overlap degree calculation in the step S101 and the step S102 and the updated content of the candidate frame set can be repeated by using the updated candidate frame set until the update is performed. The degree of overlap of the first candidate block in the subsequent set of candidate blocks with the second candidate block in the updated set of candidate blocks is greater than the overlap threshold, and the updating of the set of candidate blocks may be stopped. All of the first candidate boxes obtained during the process of updating the candidate box multiple times can be used as the target recognition box.
在本申请实施例中,利用第一备选框的位置信息和位置向量,通过一次计算即可得到第一备选框与多个第二备选框的重叠度。并可利用计算得到的第一备选框与第二备选框的重叠度与重叠度阈值,得到更新后的备选框集合中的备选框。在更新备选框的过程中,利用位置向量可大大减少在更新备选框集合中的备选框所需要的时间,提 高了更新备选框的效率,从而提高了利用本申请实施例中备选框更新方法的NMS方法的效率,进而提高了图像识别和检测的工作效率。In the embodiment of the present application, by using the location information and the location vector of the first candidate frame, the degree of overlap between the first candidate frame and the plurality of second candidate frames can be obtained by one calculation. The calculated overlap and overlap degree thresholds of the first candidate box and the second candidate box may be used to obtain an candidate box in the updated candidate box set. In the process of updating the candidate box, the location vector can greatly reduce the time required for updating the candidate box in the candidate box set, and the efficiency of updating the candidate box is improved, thereby improving the utilization of the embodiment of the present application. The efficiency of the NMS method of the marquee update method improves the efficiency of image recognition and detection.
下面将以采用非极大值抑制方法识别被测图像中的目标对象为例,说明利用备选框更新方法的非极大值抑制方法以及其中的备选框更新方法的细节内容。The following is an example of identifying a target object in a measured image by using a non-maximum suppression method, and explaining the details of the non-maximum suppression method using the candidate frame update method and the candidate frame update method therein.
图2为本申请实施例中一种非极大值抑制的方法的流程图。如图2所示,非极大值抑制的方法可包括步骤S201至步骤S205。FIG. 2 is a flowchart of a method for non-maximum value suppression in the embodiment of the present application. As shown in FIG. 2, the method of non-maximum value suppression may include steps S201 to S205.
在步骤S201中,在备选框集合中,选取分类器得分最高的备选框作为第一备选框。In step S201, in the candidate box set, the candidate box with the highest score of the classifier is selected as the first candidate box.
其中,初始的备选框集合包括被测图像上的所有备选框。分类器会对每个备选框计算分类器得分。将被测图像及被测图像上的备选框输入分类器,则可得到被测图像上每个备选框的分类器得分。分类器可通过机器学习逐步完善分类打分标准。分类器得分体现了每个备选框与被测图像中的目标对象的匹配程度。备选框的分类器得分越高,表示该备选框与被测图像中的目标对象的匹配程度越高。Wherein, the initial set of candidate boxes includes all candidate boxes on the image to be tested. The classifier calculates the classifier score for each candidate box. By inputting the measured image and the candidate box on the measured image into the classifier, the classifier score of each candidate frame on the measured image can be obtained. The classifier can gradually improve the classification and scoring standards through machine learning. The classifier score reflects the degree to which each candidate box matches the target object in the image being measured. The higher the classifier score of the candidate box, the higher the degree to which the candidate box matches the target object in the image under test.
对于被测图像中的每个目标对象都可能产生多个备选框。为了能够识别出被测图像中的与每个目标对象最匹配的第一备选框,需要进行多次筛选。在每次筛选中均可得到一个第一备选框,第一备选框即为与目标对象最匹配的备选框。比如,可选取分类器得分最高的备选框作为第一备选框。Multiple candidate boxes may be generated for each target object in the image being measured. In order to be able to identify the first candidate box in the measured image that best matches each target object, multiple screenings are required. A first candidate box is obtained in each screening, and the first candidate box is an alternative box that best matches the target object. For example, the candidate box with the highest score of the classifier can be selected as the first candidate box.
本申请实施例中的备选框更新方法以及NMS方法可应用于人脸识别、边缘检测或目标检测等场景中。比如,在人脸识别场景中,备选框集合包含多个用于识别图像中人脸的备选框。利用本申请实施例中的备选框更新方法以及NMS方法可更高效率的识别图像中的人脸。The candidate frame updating method and the NMS method in the embodiments of the present application can be applied to scenes such as face recognition, edge detection, or target detection. For example, in a face recognition scene, the set of candidate boxes contains a plurality of candidate boxes for identifying faces in the image. The face in the image can be recognized more efficiently by using the candidate frame updating method and the NMS method in the embodiment of the present application.
在步骤S202中,利用第二备选框的位置信息,生成位置向量。In step S202, a position vector is generated using the position information of the second candidate frame.
其中,第二备选框包括备选框集合中除第一备选框外的备选框。比如,被测图像中共有6个备选框,6个备选框分别为D1、D2、D3、D4、D5和D6。其中,备选框D1的分类器得分为0.98,备选框D2的分类器得分为0.81,备选框D3的分类器得分为0.69,备选框D4的分类器得分为0.48,备选框D5的分类器得分为0.24,备选框D6的分类器得分为0.58。则在第一次筛选中,第一备选框为备选框D1,第二备选框为备选框D2、备选框D3、备选框D4、备选框D5和备选框D6。The second candidate box includes an alternative box in the set of candidate boxes except the first candidate box. For example, there are 6 candidate boxes in the measured image, and the 6 candidate boxes are D1, D2, D3, D4, D5 and D6. Wherein, the classifier score of the candidate box D1 is 0.98, the classifier score of the candidate box D2 is 0.81, the classifier score of the candidate box D3 is 0.69, and the classifier score of the candidate box D4 is 0.48, the candidate box D5. The classifier score is 0.24 and the classifier score for candidate box D6 is 0.58. Then in the first screening, the first candidate box is the candidate box D1, and the second candidate box is the candidate box D2, the candidate box D3, the candidate box D4, the candidate box D5, and the candidate box D6.
需要说明的是,生成的位置向量的数目可以为一个,也可以为多个,在此并不限定。每个位置向量包括多个第二备选框的位置信息。每个第二备选框的位置信息均可作为位置向量中的一个元素。位置向量中的元素数目可预先设定,比如根据具体工作场景以及工作需求设定,在此并不限定。It should be noted that the number of generated position vectors may be one or plural, and is not limited herein. Each location vector includes location information for a plurality of second candidate frames. The position information of each second candidate box can be used as an element in the position vector. The number of elements in the position vector can be preset, for example, according to a specific work scene and work requirements, and is not limited herein.
在一个示例中,第二备选框的数目可以被位置向量预设的元素数目整除,即生成了至少一个位置向量。则在备选框更新过程中,根据第一备选框的位置信息和至少一个位置向量,得到第一备选框与所有第二备选框的重叠度。比如,在一次备选框更新的过程中,预设位置向量的元素数目为4个,第二备选框的数目为8个,则可生成2个位置向量。In one example, the number of second candidate boxes may be divisible by the number of elements preset by the position vector, ie, at least one position vector is generated. Then, in the candidate frame update process, the degree of overlap between the first candidate frame and all the second candidate frames is obtained according to the location information of the first candidate frame and the at least one location vector. For example, in the process of an alternate box update, the number of elements of the preset position vector is four, and the number of the second candidate frame is eight, and two position vectors can be generated.
在另一个示例中,第二备选框的数目不可以被位置向量预设的元素数目整除,则在生成至少一个位置向量的基础上,还存在未形成位置向量的整数个单个第二备选框的位置信息。在备选框更新过程中,可根据第一备选框的位置信息和至少一个位置向 量,得到第一备选框与位置向量涉及的第二备选框的重叠度。此外,还可利用第一备选框的位置信息分别与整数个单个第二备选框的位置信息,得到第一备选框与这整数个单个第二备选框的重叠度。比如,在一次筛选中,第二备选框共有8个,预设位置向量的元素数目为3个,则生成2个位置向量和2个单个的第二备选框的位置信息。In another example, the number of second candidate frames may not be divisible by the number of elements preset by the position vector, and based on the generation of the at least one position vector, there is also an integer single second candidate that does not form a position vector. The location information of the box. In the candidate frame update process, the degree of overlap of the first candidate frame with the second candidate frame involved in the location vector may be obtained according to the location information of the first candidate frame and the at least one location vector. In addition, the location information of the first candidate frame and the location information of the integer single second candidate frame may be used to obtain the degree of overlap between the first candidate frame and the integer single second candidate frame. For example, in one screening, there are 8 second candidate boxes, and the number of elements of the preset position vector is 3, and position information of 2 position vectors and 2 single second candidate boxes is generated.
在上述实施例中,可按照分类器得分从高到低的顺序将第二备选框排序,并按照分类器得分由高至低的顺序将每预设位置向量的元素数目个第二备选框的位置信息作为一个位置向量。第二备选框的数目与预设位置向量的元素数目求商得到的余数,按照第二备选框的分类器得分从低到高的排列顺序,选取余数个第二备选框。将余数个第二备选框的位置信息,作为整数个单个第二备选框的位置信息。也就是说,若在生成至少一个位置向量的基础上,还存在未形成位置向量的P个第二备选框的位置信息,P为正整数。则这P个第二备选框的位置信息为分类器得分最低的P个第二备选框的位置信息。In the above embodiment, the second candidate frame may be sorted in descending order of the classifier score, and the number of elements per preset position vector may be second selected in descending order of the classifier score. The position information of the box is used as a position vector. The remainder obtained by quoting the number of the second candidate frames and the number of elements of the preset position vector is selected according to the order of the classifier scores of the second candidate frame from low to high, and the remaining second candidate frames are selected. The position information of the remaining second candidate boxes is taken as the position information of the integer single second candidate frame. That is to say, if at least one position vector is generated, there is also position information of P second candidate frames in which the position vector is not formed, and P is a positive integer. Then, the location information of the P second candidate frames is the location information of the P second candidate frames with the lowest score of the classifier.
在步骤S203中,对第一备选框的位置信息和位置向量进行向量计算,得到第一备选框与第二备选框的重叠度。In step S203, vector calculation is performed on the position information and the position vector of the first candidate frame to obtain the degree of overlap between the first candidate frame and the second candidate frame.
可在需要进行向量计算的情况下,生成向量化指令,根据向量化指令触发向量计算。向量计算可一次性计算第一备选框与一个位置向量中的多个第二备选框的重叠度。比如,设第二备选框的数目为8,位置向量中的元素数目为4个。若采用现有技术中的NMS方法,在一次筛选中想得到第一备选框与所有8个第二备选框的重叠度,需要进行8次计算。而采用本申请实施例中的NMS方法,在一次筛选中想得到第一备选框与所有8个第二备选框的重叠度,只需要进行两次计算。大大的缩减了NMS方法中的计算量,降低了NMS方法所花费的计算时间。A vectorization instruction can be generated in the case where vector calculation is required, and vector calculation is triggered according to the vectorization instruction. The vector calculation may calculate the degree of overlap of the first candidate box with the plurality of second candidate boxes in a position vector at one time. For example, let the number of second candidate boxes be 8, and the number of elements in the position vector be four. If the NMS method in the prior art is used, it is necessary to perform 8 calculations in order to obtain the overlap of the first candidate box and all the 8 second candidate boxes in one screening. With the NMS method in the embodiment of the present application, the degree of overlap between the first candidate box and all the eight second candidate boxes is obtained in one screening, and only two calculations are needed. The amount of calculation in the NMS method is greatly reduced, and the calculation time spent by the NMS method is reduced.
在步骤S204中,第一备选框与第二备选框的重叠度并非均大于重叠度阈值的情况下,则将备选框集合更新为,包括与第一备选框的重叠度小于或等于重叠度阈值的第二备选框。In step S204, if the degree of overlap between the first candidate frame and the second candidate frame is not all greater than the overlap threshold, the candidate set of frames is updated to include the overlap with the first candidate frame being less than or A second alternative box equal to the overlap threshold.
在步骤S205中,第一备选框与第二备选框的重叠度均大于重叠度阈值的情况下,停止对备选框集合的更新。In step S205, if the degree of overlap between the first candidate box and the second candidate box is greater than the overlap degree threshold, the updating of the candidate box set is stopped.
在被测图像中包括多个备选框的场景中,可能需要进行多次筛选。每次筛选中均需选取第一备选框,并计算第一备选框与当前筛选中的第二备选框的重叠度。与当前筛选的第一备选框的重叠度小于或等于重叠度阈值的第二备选框,作为下一次筛选中的备选框集合中的备选框。直至当前筛选中第一备选框与所有第二备选框的重叠度均大于重叠度阈值,停止筛选。每次筛选中均可得到第一备选框,即得到了与被测图像中所有目标对象各自最匹配的备选框。In a scenario where multiple candidate frames are included in the image being measured, multiple screenings may be required. The first candidate box is selected in each screening, and the degree of overlap between the first candidate box and the second candidate box in the current screening is calculated. A second candidate box having a degree of overlap with the currently selected first candidate box that is less than or equal to the overlap degree threshold as an alternative box in the set of candidate boxes in the next screening. The screening is stopped until the overlap between the first candidate box and all the second candidate boxes in the current screening is greater than the overlap threshold. The first candidate box is obtained in each screening, that is, an alternative frame that best matches each of the target objects in the image to be measured is obtained.
在一个示例中,可以在每次筛选中,将与第一备选框的重叠度大于重叠度阈值的第二备选框删除。也就是说当前筛选中被删除的与第一备选框的重叠度大于重叠度阈值的第二备选框不再参与当前筛选之后的筛选的计算。减小了计算量和计算占用的时间,也减小了计算所占用的资源,进一步地提高了NMS方法的效率。In one example, a second candidate box with a degree of overlap with the first candidate box that is greater than the overlap threshold may be deleted in each screening. That is to say, the second candidate box whose overlap degree with the first candidate box in the current screening is greater than the overlap degree threshold is no longer involved in the calculation of the screening after the current screening. The calculation amount and the time taken for calculation are reduced, and the resources occupied by the calculation are also reduced, and the efficiency of the NMS method is further improved.
比如,可针对每个备选框设置索引号(即Index),并为每个备选框设置属性(即Flags),备选框的该属性表示当前筛选中该备选框与第一备选框的重叠度是否大于重叠度阈值。图3为本申请实施例中NMS计算中两次筛选的备选框的变化示意图。如 图3所示,属性为0表示与第一备选框的重叠度小于或等于重叠度阈值,属性为1表示与第一备选框的重叠度大于重叠度阈值。在第m-1次筛选中,索引号为0、1、2和3依次对应的属性分别为0、1、1和0。在第m-1次筛选删除属性为1的备选框,在第m次筛选中留下了索引号为0和3的备选框。For example, an index number (ie, Index) can be set for each candidate box, and an attribute (ie, Flags) is set for each candidate box, and the attribute of the candidate box indicates the candidate box and the first candidate in the current filter. Whether the overlap of the boxes is greater than the overlap threshold. FIG. 3 is a schematic diagram showing changes of an alternative box for two screenings in NMS calculation in the embodiment of the present application. As shown in FIG. 3, an attribute of 0 indicates that the degree of overlap with the first candidate box is less than or equal to the overlap degree threshold, and an attribute of 1 indicates that the degree of overlap with the first candidate box is greater than the overlap threshold. In the m-1th screening, the attributes corresponding to the
下面将以两个实例对本申请实施例中的NMS方法进行说明。图4为本申请实施例中被测图像中的备选框示意图。如图4所示,被测图像中共包括7个备选框,分别为备选框D1、备选框D2、备选框D3、备选框D4、备选框D5、备选框D6和备选框D7。备选框D1、备选框D2、备选框D3、备选框D4、备选框D5、备选框D6和备选框D7的分类器得分分别为0.98、0.81、0.69、0.48、0.58、0.24和0.36。重叠度阈值为重叠面积占备选框面积的百分比,重叠度阈值为20%。The NMS method in the embodiment of the present application will be described below with two examples. FIG. 4 is a schematic diagram of an alternative frame in the image to be tested in the embodiment of the present application. As shown in FIG. 4, the test image includes a total of seven candidate boxes, which are an optional box D1, an optional box D2, an optional box D3, an optional box D4, an optional box D5, an optional box D6, and a standby device. Box D7. The classifier scores of the candidate block D1, the candidate box D2, the candidate box D3, the candidate box D4, the candidate box D5, the candidate box D6, and the candidate box D7 are 0.98, 0.81, 0.69, 0.48, 0.58, respectively. 0.24 and 0.36. The overlap threshold is the percentage of the overlap area to the area of the candidate frame, and the overlap threshold is 20%.
第一个实例:The first instance:
设位置向量中的元素数目为3,则第一次筛选中生成2个位置向量。可将7个备选框按照分类器得分排列,得到排列顺序为备选框D1、备选框D2、备选框D3、备选框D6、备选框D4、备选框D7和备选框D5。在第一次筛选中,选取分类器得分最高的备选框D1作为第一备选框,备选框D2、备选框D3、备选框D6、备选框D4、备选框D7和备选框D5为第二备选框。第1个位置向量包括备选框D2的位置信息、备选框D3的位置信息和备选框D6的位置信息。第2个位置向量包括备选框D4的位置信息、备选框D7的位置信息和备选框D5的位置信息。则需要进行两次计算,第一次计算得到第一备选框D1与第1个位置向量中的备选框D2、备选框D3和备选框D6各自的重叠度,第二次计算得到第一备选框D1与第2个位置向量中的备选框D4、备选框D5和备选框D7各自的重叠度。第一备选框D1与备选框D2的重叠度大于20%;第一备选框D1与备选框D3的重叠度大于20%;第一备选框D1与备选框D6的重叠度小于20%;第一备选框D1与备选框D4的重叠度大于20%;第一备选框D1与备选框D7的重叠度小于20%;第一备选框D5与备选框D2的重叠度小于20%。则删除备选框D2和备选框D3。在第二次筛选中,备选框集合包括备选框D6、备选框D4、备选框D7和备选框D5。选取分类器得分最高的备选框D6作为第一备选框。对应的,生成了1个位置向量,该位置向量包括备选框D4的位置信息、备选框D7的位置信息和备选框D5的位置信息。对第一备选框D6的位置信息与这1个计算向量进行一次向量计算,得到第一备选框D6与第2个计算向量中的备选框D4、备选框D7和备选框D5各自的重叠度。第一备选框D6与备选框D4的重叠度小于20%;第一备选框D6与备选框D7的重叠度大于20%;第一备选框D6与备选框D5的重叠度大于20%。则删除备选框D4。在第三次筛选中,选取备选框D7作为第一备选框,计算第一备选框D7与备选框D5的重叠度。第一备选框D7与备选框D5的重叠度小于20%。则将备选框D5也作为第一备选框,并停止对备选框集合中的备选框的更新,完成了NMS计算。Let the number of elements in the position vector be 3, then generate 2 position vectors in the first screening. The seven candidate boxes can be arranged according to the classifier score, and the order of arrangement is the candidate box D1, the candidate box D2, the candidate box D3, the candidate box D6, the candidate box D4, the candidate box D7, and the candidate box. D5. In the first screening, the candidate box D1 with the highest score of the classifier is selected as the first candidate box, the candidate box D2, the candidate box D3, the candidate box D6, the candidate box D4, the candidate box D7, and the preparation Box D5 is the second alternative box. The first position vector includes position information of the candidate box D2, position information of the candidate box D3, and position information of the candidate box D6. The second position vector includes position information of the candidate box D4, position information of the candidate box D7, and position information of the candidate box D5. Then, the calculation needs to be performed twice, and the first calculation results the overlap degree between the first candidate box D1 and the candidate box D2, the candidate box D3 and the candidate box D6 in the first position vector, and the second calculation is obtained. The degree of overlap of each of the first candidate box D1 and the candidate box D4, the candidate box D5, and the candidate box D7 in the second position vector. The degree of overlap of the first candidate box D1 and the candidate box D2 is greater than 20%; the degree of overlap of the first candidate box D1 with the candidate box D3 is greater than 20%; the degree of overlap of the first candidate box D1 with the candidate box D6 Less than 20%; the degree of overlap of the first candidate box D1 and the candidate box D4 is greater than 20%; the degree of overlap of the first candidate box D1 with the candidate box D7 is less than 20%; the first candidate box D5 and the candidate box The overlap of D2 is less than 20%. Then, the candidate box D2 and the candidate box D3 are deleted. In the second screening, the set of candidate boxes includes an alternative box D6, an alternate box D4, an alternate box D7, and an alternate box D5. The candidate box D6 with the highest score of the classifier is selected as the first candidate box. Correspondingly, a position vector is generated, which includes the position information of the candidate box D4, the position information of the candidate box D7, and the position information of the candidate box D5. Performing a vector calculation on the position information of the first candidate box D6 and the one calculation vector to obtain the candidate box D4, the candidate box D7, and the candidate box D5 in the first candidate box D6 and the second calculation vector. The degree of overlap. The degree of overlap of the first candidate block D6 and the candidate box D4 is less than 20%; the degree of overlap of the first candidate box D6 with the candidate box D7 is greater than 20%; the degree of overlap of the first candidate box D6 with the candidate box D5 More than 20%. Then the candidate box D4 is deleted. In the third screening, the candidate box D7 is selected as the first candidate box, and the degree of overlap between the first candidate box D7 and the candidate box D5 is calculated. The degree of overlap of the first candidate block D7 with the candidate box D5 is less than 20%. Then, the candidate box D5 is also used as the first candidate box, and the update of the candidate box in the candidate box set is stopped, and the NMS calculation is completed.
第二个实例:The second example:
设位置向量中的元素数目为4个,则第一次筛选中生成了1个计算向量和2个单个第二备选框的位置信息。可将7个备选框按照分类器得分排列,得到排列顺序为备选框D1、备选框D2、备选框D3、备选框D6、备选框D4、备选框D7和备选框D5。在第一次筛选中,选取分类器得分最高的备选框D1作为第一备选框。位置向量包括 备选框D2的位置信息、备选框D3的位置信息、备选框D6的位置信息和备选框D4的位置信息。2个单个第二备选框的位置信息分别为备选框D7的位置信息和备选框D5的位置信息。则需要进行三次计算。第一次计算得到第一备选框D1与位置向量中的备选框D2、备选框D3、备选框D6和备选框D4各自的重叠度,第二次计算得到第一备选框D1与备选框D5的重叠度,第三次计算得到第一备选框D1与备选框D7的重叠度。第一备选框D1与备选框D2的重叠度大于20%;第一备选框D1与备选框D3的重叠度大于20%;第一备选框D1与备选框D6的重叠度小于20%;第一备选框D1与备选框D4的重叠度大于20%;第一备选框D1与备选框D7的重叠度小于20%;第一备选框D5与备选框D2的重叠度小于20%。则删除备选框D2和备选框D3。在第二次筛选中,备选框集合包括备选框D6、备选框D4、备选框D7和备选框D5。选取分类器得分最高的备选框D6作为第一备选框。计算第一备选框D6分别与备选框D4、备选框D7和备选框D5各自的重叠度。第一备选框D6与备选框D4的重叠度小于20%;第一备选框D6与备选框D7的重叠度大于20%;第一备选框D6与备选框D5的重叠度大于20%。则删除备选框D4。在第三次筛选中,选取备选框D7作为第一备选框,计算第一备选框D7与备选框D5的重叠度。第一备选框D7与备选框D5的重叠度小于20%。则将备选框D5也作为第一备选框,并停止对备选框集合中的备选框的更新,完成了NMS计算。If the number of elements in the position vector is four, the position information of one calculation vector and two single second candidate frames is generated in the first screening. The seven candidate boxes can be arranged according to the classifier score, and the order of arrangement is the candidate box D1, the candidate box D2, the candidate box D3, the candidate box D6, the candidate box D4, the candidate box D7, and the candidate box. D5. In the first screening, the candidate box D1 with the highest score of the classifier is selected as the first candidate box. The location vector includes location information of the candidate frame D2, location information of the candidate frame D3, location information of the candidate frame D6, and location information of the candidate frame D4. The location information of the two single second candidate frames is the location information of the candidate frame D7 and the location information of the candidate frame D5, respectively. Then you need to do three calculations. The first calculation calculates the degree of overlap between the first candidate box D1 and the candidate box D2, the candidate box D3, the candidate box D6 and the candidate box D4 in the position vector, and the second calculation results the first candidate box. The degree of overlap of D1 with the candidate box D5 is calculated for the third time to obtain the degree of overlap between the first candidate box D1 and the candidate box D7. The degree of overlap of the first candidate box D1 and the candidate box D2 is greater than 20%; the degree of overlap of the first candidate box D1 with the candidate box D3 is greater than 20%; the degree of overlap of the first candidate box D1 with the candidate box D6 Less than 20%; the degree of overlap of the first candidate box D1 and the candidate box D4 is greater than 20%; the degree of overlap of the first candidate box D1 with the candidate box D7 is less than 20%; the first candidate box D5 and the candidate box The overlap of D2 is less than 20%. Then, the candidate box D2 and the candidate box D3 are deleted. In the second screening, the set of candidate boxes includes an alternative box D6, an alternate box D4, an alternate box D7, and an alternate box D5. The candidate box D6 with the highest score of the classifier is selected as the first candidate box. The degree of overlap of the first candidate box D6 with the candidate box D4, the candidate box D7, and the candidate box D5, respectively, is calculated. The degree of overlap of the first candidate block D6 and the candidate box D4 is less than 20%; the degree of overlap of the first candidate box D6 with the candidate box D7 is greater than 20%; the degree of overlap of the first candidate box D6 with the candidate box D5 More than 20%. Then the candidate box D4 is deleted. In the third screening, the candidate box D7 is selected as the first candidate box, and the degree of overlap between the first candidate box D7 and the candidate box D5 is calculated. The degree of overlap of the first candidate block D7 with the candidate box D5 is less than 20%. Then, the candidate box D5 is also used as the first candidate box, and the update of the candidate box in the candidate box set is stopped, and the NMS calculation is completed.
图5为本申请实施例中一种备选框更新装置的结构示意图。如图5所示,备选框更新装置300可包括重叠度获取模块301和更新模块302。FIG. 5 is a schematic structural diagram of an apparatus for updating an alternative frame according to an embodiment of the present application. As shown in FIG. 5, the candidate
重叠度获取模块301,用于根据第一备选框的位置信息和位置向量,得到第一备选框与多个第二备选框的重叠度。The overlap obtaining module 301 is configured to obtain the degree of overlap between the first candidate frame and the plurality of second candidate frames according to the location information and the location vector of the first candidate frame.
其中,第一备选框为备选框集合中分类器得分最高的备选框。第二备选框为备选框集合中除第一备选框之外的备选框。位置向量包括多个第二备选框的位置信息。The first candidate box is an candidate box with the highest score of the classifier in the set of candidate boxes. The second alternative box is an alternative box in the set of candidate boxes other than the first candidate box. The location vector includes location information of a plurality of second candidate frames.
更新模块302,用于将第一备选框与多个第二备选框的重叠度和重叠度阈值进行比较以得到更新后的备选框集合。The updating module 302 is configured to compare the first candidate box with the overlap degree and the overlap degree threshold of the plurality of second candidate boxes to obtain an updated set of candidate frames.
上述更新模块302具体可用于在多个第二备选框中的第二备选框和第一备选框的重叠度小于或等于重叠度阈值时,确定第二备选框保留在更新后的备选框集合中;在多个第二备选框中的第二备选框和第一备选框的重叠度大于重叠度阈值时,确定第二备选框不保留在更新后的备选框集合中。The foregoing update module 302 is specifically configured to determine that the second candidate frame remains in the updated state when the overlap degree of the second candidate frame and the first candidate frame in the multiple second candidate frames is less than or equal to the overlap degree threshold. In the set of candidate boxes; determining that the second candidate box does not remain in the updated candidate when the degree of overlap of the second candidate box and the first candidate box in the plurality of second candidate boxes is greater than the overlap threshold In the box collection.
在一个示例中,上述重叠度获取模块301还用于利用更新后的备选框集合中的第一备选框的位置信息和更新后的位置向量,得到更新后的备选框集合中的第一备选框与更新后的备选框集合中多个第二备选框的重叠度。更新后的位置向量包括更新后的备选框集合中的多个第二备选框的位置信息。In an example, the overlap acquiring module 301 is further configured to use the location information of the first candidate frame in the updated candidate set of frames and the updated location vector to obtain the updated candidate set. The degree of overlap between an alternate box and a plurality of second candidate boxes in the updated set of candidate boxes. The updated location vector includes location information of a plurality of second candidate frames in the updated set of candidate frames.
更新模块302还用于将更新后的备选框集合中的第一备选框与更新后的备选框集合中的多个第二备选框的重叠度和重叠度阈值进行比较以再次得到更新后的备选框集合,直至重叠度获取模块301得到的更新后的备选框集合中的第一备选框与更新后的备选框集合中的第二备选框的重叠度均大于重叠度阈值,更新模块302还用于停止对备选框集合的更新,并用于将备选框集合中的第一备选框和每次更新后的备选框集合 中的第一备选框,作为目标识别框。The update module 302 is further configured to compare the overlap degree and the overlap threshold of the first candidate block in the updated set of candidate blocks with the plurality of second candidate blocks in the updated set of candidate blocks to obtain again The updated set of candidate boxes until the overlap degree of the first candidate frame in the updated candidate set of the block obtained by the overlap obtaining module 301 and the second candidate frame in the updated set of candidate blocks is greater than The overlap threshold, the update module 302 is further configured to stop updating the set of candidate boxes, and to use the first candidate box in the set of candidate boxes and the first candidate box in the set of candidate boxes after each update. , as the target recognition box.
在人脸识别场景中,备选框集合中包含多个用于识别图像中人脸的备选框。在目标识别场景中,备选框集合中包含多个用于识别图像中目标对象的备选框。In the face recognition scene, the set of candidate boxes contains a plurality of candidate boxes for identifying faces in the image. In the target recognition scenario, the set of candidate boxes contains a plurality of candidate boxes for identifying the target objects in the image.
上述重叠度获取模块301和更新模块302的具体功能和有益效果说明可参见上述实施例中步骤S101和步骤S102,以及步骤S201至步骤S205的相关细节说明内容,在此不再赘述。For the specific functions and the beneficial effects of the above-mentioned overlapping degree obtaining module 301 and the updating module 302, reference may be made to the descriptions of the steps S101 and S102 in the above embodiment, and the related details of the steps S201 to S205, and details are not described herein again.
结合图1至图5描述的根据本申请实施例的备选框更新方法和装置可以由备选框更新设备400来实现。图6为本申请实施例中的一种备选框更新设备400的硬件结构示意图。The alternate block update method and apparatus according to embodiments of the present application described in conjunction with FIGS. 1 through 5 may be implemented by the alternate
备选框更新设备400包括存储器401、处理器402及存储在存储器401上并可在处理器402上运行的计算机程序。The alternate
在一个示例中,上述处理器402可以包括中央处理器(CPU),或者特定集成电路(ASIC),或者可以被配置成实施本申请实施例的一个或多个集成电路。In one example, the processor 402 described above can include a central processing unit (CPU), or an specific integrated circuit (ASIC), or can be configured to implement one or more integrated circuits of embodiments of the present application.
存储器401可以包括用于数据或指令的大容量存储器。举例来说而非限制,存储器401可包括HDD、软盘驱动器、闪存、光盘、磁光盘、磁带或通用串行总线(USB)驱动器或者两个或更多个以上这些的组合。在合适的情况下,存储器401可包括可移除或不可移除(或固定)的介质。在合适的情况下,存储器401可在数据查询设备400的内部或外部。在特定实施例中,存储器401是非易失性固态存储器。在特定实施例中,存储器401包括只读存储器(ROM)。在合适的情况下,该ROM可以是掩模编程的ROM、可编程ROM(PROM)、可擦除PROM(EPROM)、电可擦除PROM(EEPROM)、电可改写ROM(EAROM)或闪存或者两个或更多个以上这些的组合。Memory 401 can include mass storage for data or instructions. By way of example and not limitation, the memory 401 may comprise a HDD, a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape or a universal serial bus (USB) drive, or a combination of two or more of these. Memory 401 may include removable or non-removable (or fixed) media, where appropriate. Memory 401 may be internal or external to
处理器402通过读取存储器401中存储的可执行程序代码来运行与可执行程序代码对应的程序,以用于执行上述各个实施例中的备选框更新方法和包含备选框更新的NMS方法。The processor 402 runs a program corresponding to the executable program code by reading the executable program code stored in the memory 401 for performing the alternate frame update method in the various embodiments described above and the NMS method including the candidate frame update. .
在一个示例中,备选框更新设备400还可包括通信接口403和总线404。其中,如图6所示,存储器401、处理器402、通信接口403通过总线404连接并完成相互间的通信。In one example, the alternate
通信接口403,主要用于实现本申请实施例中各模块、装置、单元和/或设备之间的通信。也可通信接口403接入输入设备和/或输出设备。The communication interface 403 is mainly used to implement communication between modules, devices, units and/or devices in the embodiments of the present application. Communication interface 403 is also accessible to input devices and/or output devices.
总线404包括硬件、软件或两者,将数据查询设备400的部件彼此耦接在一起。举例来说而非限制,总线404可包括加速图形端口(AGP)或其他图形总线、增强工业标准架构(EISA)总线、前端总线(FSB)、超传输(HT)互连、工业标准架构(ISA)总线、无限带宽互连、低引脚数(LPC)总线、存储器总线、微信道架构(MCA)总线、外围组件互连(PCI)总线、PCI-Express(PCI-X)总线、串行高级技术附件(SATA)总线、视频电子标准协会局部(VLB)总线或其他合适的总线或者两个或更多个以上这些的组合。在合适的情况下,总线404可包括一个或多个总线。尽管本申请实施例描述和示出了特定的总线,但本申请考虑任何合适的总线或互连。Bus 404 includes hardware, software, or both, coupling components of
本申请一实施例还提供一种存储介质,该存储介质上存储有程序,该程序被处理器执行时可实现上述各个实施例中的备选框更新方法和包含备选框更新的NMS方法。An embodiment of the present application further provides a storage medium, where the program is stored, and when the program is executed by the processor, the candidate box update method in the foregoing embodiments and the NMS method including the candidate box update may be implemented.
本说明书的各个部分均采用递进的方式进行描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点介绍的都是与其他实施例不同之处。尤其,对于装置实施例、设备实施例和存储介质实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例部分的说明即可。The various parts of the specification are described in a progressive manner, and the same or similar parts between the various embodiments may be referred to each other, and each embodiment focuses on differences from other embodiments. In particular, for the device embodiment, the device embodiment, and the storage medium embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the description of the method embodiment.
以上,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以权利要求的保护范围为准。The above is only a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto, and any person skilled in the art can easily think of changes or substitutions within the technical scope of the present invention, and should cover Within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of protection of the claims.
Claims (10)
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201810355286.3A CN110390344B (en) | 2018-04-19 | 2018-04-19 | Alternative frame updating method and device |
| CN201810355286.3 | 2018-04-19 |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2019201029A1 true WO2019201029A1 (en) | 2019-10-24 |
Family
ID=68240408
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2019/077397 Ceased WO2019201029A1 (en) | 2018-04-19 | 2019-03-08 | Candidate box update method and apparatus |
Country Status (2)
| Country | Link |
|---|---|
| CN (1) | CN110390344B (en) |
| WO (1) | WO2019201029A1 (en) |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN111783655A (en) * | 2020-06-30 | 2020-10-16 | Oppo广东移动通信有限公司 | An image processing method, device, electronic device and storage medium |
| CN114611666A (en) * | 2022-03-08 | 2022-06-10 | 安谋科技(中国)有限公司 | NMS function quantization method, electronic device and medium |
Families Citing this family (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN111145215B (en) * | 2019-12-25 | 2023-09-05 | 北京迈格威科技有限公司 | A target tracking method and device |
| CN112817881A (en) * | 2021-02-26 | 2021-05-18 | 上海阵量智能科技有限公司 | Information processing method, device, equipment and storage medium |
Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN106529398A (en) * | 2016-09-23 | 2017-03-22 | 深圳云天励飞技术有限公司 | Quick and accurate face detection method based on cascade structure |
| US20180060649A1 (en) * | 2016-08-30 | 2018-03-01 | Irida Labs S.A. | Fast, embedded, hybrid video face recognition system |
| CN107808143A (en) * | 2017-11-10 | 2018-03-16 | 西安电子科技大学 | Dynamic gesture identification method based on computer vision |
Family Cites Families (8)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| EP3022525B1 (en) * | 2013-07-18 | 2020-04-29 | a.tron3d GmbH | Method of capturing three-dimensional (3d) information on a structure |
| US11120478B2 (en) * | 2015-01-12 | 2021-09-14 | Ebay Inc. | Joint-based item recognition |
| CN104573731B (en) * | 2015-02-06 | 2018-03-23 | 厦门大学 | Fast target detection method based on convolutional neural networks |
| US20170330059A1 (en) * | 2016-05-11 | 2017-11-16 | Xerox Corporation | Joint object and object part detection using web supervision |
| CN106960178B (en) * | 2017-02-23 | 2020-02-07 | 中国科学院自动化研究所 | Training method of insulator recognition model and insulator recognition and positioning method |
| CN107301383B (en) * | 2017-06-07 | 2020-11-24 | 华南理工大学 | A Road Traffic Sign Recognition Method Based on Fast R-CNN |
| CN107577990B (en) * | 2017-08-09 | 2020-02-18 | 武汉世纪金桥安全技术有限公司 | A large-scale face recognition method based on GPU-accelerated retrieval |
| CN107657224B (en) * | 2017-09-19 | 2019-10-11 | 武汉大学 | A Component-Based Multilayer Parallel Network SAR Image Aircraft Target Detection Method |
-
2018
- 2018-04-19 CN CN201810355286.3A patent/CN110390344B/en active Active
-
2019
- 2019-03-08 WO PCT/CN2019/077397 patent/WO2019201029A1/en not_active Ceased
Patent Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20180060649A1 (en) * | 2016-08-30 | 2018-03-01 | Irida Labs S.A. | Fast, embedded, hybrid video face recognition system |
| CN106529398A (en) * | 2016-09-23 | 2017-03-22 | 深圳云天励飞技术有限公司 | Quick and accurate face detection method based on cascade structure |
| CN107808143A (en) * | 2017-11-10 | 2018-03-16 | 西安电子科技大学 | Dynamic gesture identification method based on computer vision |
Cited By (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN111783655A (en) * | 2020-06-30 | 2020-10-16 | Oppo广东移动通信有限公司 | An image processing method, device, electronic device and storage medium |
| CN114611666A (en) * | 2022-03-08 | 2022-06-10 | 安谋科技(中国)有限公司 | NMS function quantization method, electronic device and medium |
| CN114611666B (en) * | 2022-03-08 | 2024-05-31 | 安谋科技(中国)有限公司 | Quantification method of NMS function, electronic equipment and medium |
Also Published As
| Publication number | Publication date |
|---|---|
| CN110390344A (en) | 2019-10-29 |
| CN110390344B (en) | 2021-10-26 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US11734954B2 (en) | Face recognition method, device and electronic equipment, and computer non-volatile readable storage medium | |
| JP6871314B2 (en) | Object detection method, device and storage medium | |
| KR102578209B1 (en) | Apparatus and method for image processing | |
| US20200005022A1 (en) | Method, terminal, and storage medium for tracking facial critical area | |
| US20240256377A1 (en) | Fault diagnosis method and apparatus, electronic device, and storage medium | |
| CN105894464B (en) | A kind of medium filtering image processing method and device | |
| CN109086734B (en) | Method and device for positioning pupil image in human eye image | |
| WO2019051941A1 (en) | Method, apparatus and device for identifying vehicle type, and computer-readable storage medium | |
| WO2017197620A1 (en) | Detection of humans in images using depth information | |
| WO2019201029A1 (en) | Candidate box update method and apparatus | |
| KR101969623B1 (en) | Face recognition with parallel detection and tracking, and/or grouped feature motion shift tracking | |
| CN118587175A (en) | Optical lens defect detection method and system | |
| CN111753722B (en) | Fingerprint identification method and device based on feature point type | |
| CN110910445A (en) | Object size detection method and device, detection equipment and storage medium | |
| CN115004245A (en) | Target detection method, target detection device, electronic equipment and computer storage medium | |
| JP7121132B2 (en) | Image processing method, apparatus and electronic equipment | |
| CN114399791B (en) | Pedestrian detection method, device, equipment and medium | |
| CN114842205B (en) | Vehicle loss detection method, device, equipment and storage medium | |
| CN114898155A (en) | Vehicle damage assessment method, device, equipment and storage medium | |
| WO2025025465A1 (en) | Infrared face image quality evaluation method and apparatus | |
| CN114067145B (en) | Passive optical splitter detection method, device, equipment and medium | |
| CN113537199B (en) | Image boundary box screening method, system, electronic device and medium | |
| CN105160333B (en) | A kind of model recognizing method and identification device | |
| CN116129496A (en) | Image shielding method and device, computer equipment and storage medium | |
| CN115393337A (en) | Industrial defect detection method, device, equipment and computer-readable storage medium |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| 121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 19788579 Country of ref document: EP Kind code of ref document: A1 |
|
| NENP | Non-entry into the national phase |
Ref country code: DE |
|
| 122 | Ep: pct application non-entry in european phase |
Ref document number: 19788579 Country of ref document: EP Kind code of ref document: A1 |