CN109961079B - Image detection method and device - Google Patents

Image detection method and device Download PDF

Info

Publication number
CN109961079B
CN109961079B CN201711420991.9A CN201711420991A CN109961079B CN 109961079 B CN109961079 B CN 109961079B CN 201711420991 A CN201711420991 A CN 201711420991A CN 109961079 B CN109961079 B CN 109961079B
Authority
CN
China
Prior art keywords
current
window
weak classifier
current window
array
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201711420991.9A
Other languages
Chinese (zh)
Other versions
CN109961079A (en
Inventor
于晓静
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Ingenic Semiconductor Co Ltd
Original Assignee
Beijing Ingenic Semiconductor Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Ingenic Semiconductor Co Ltd filed Critical Beijing Ingenic Semiconductor Co Ltd
Priority to CN201711420991.9A priority Critical patent/CN109961079B/en
Publication of CN109961079A publication Critical patent/CN109961079A/en
Application granted granted Critical
Publication of CN109961079B publication Critical patent/CN109961079B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/285Selection of pattern recognition techniques, e.g. of classifiers in a multi-classifier system

Abstract

The invention provides an image detection method and device. The method comprises the following steps: traversing a frame of image by using a current weak classifier in a row window unit, and traversing the current window by using a next weak classifier in the row direction after the current weak classifier finishes traversing the current window; if the current weak classifier does not pass through the current window, the current window is not taken as a target window, and the next weak classifier does not perform re-verification on the current window; and if all weak classifiers pass through the current window, taking the current window as a target window. The invention can effectively reduce the influence of high-speed miss and improve the performance of image detection.

Description

Image detection method and device
Technical Field
The present invention relates to the field of image processing technologies, and in particular, to an image detection method and an image detection device.
Background
When the CPU accesses data from the memory, the embedded device or PC having a Cache first checks whether the required data is in the Cache, and if the required data exists, the data can be directly accessed without inserting any wait state, which is the best state and is also called a Cache hit. When the information needed by the CPU is not in the Cache, the main memory needs to be switched and stored, and due to the fact that the speed is low, waiting needs to be inserted, and the situation is called high-speed miss, which is also called Dcache miss.
The directional gradient map is to find the gradient amplitude and direction of a frame image, and the gradient amplitude is projected to the gradient direction of the unit. For example, the degree of 0-180 is divided into 9 units, namely every 20 degrees is taken as a unit, and a total of 9 directional gradient maps are generated. The finer the unit is, the larger the generated directional gradient map occupies space. For example, every 20 degrees as one, the space of 9 figures is used.
The core idea of the cascade classifier is to train different classifiers (weak classifiers) aiming at the same training set, and then assemble the weak classifiers to form a stronger final classifier (strong classifier).
The space of 9 graphs is required for calculating features based on the directional gradient graph, and in the application of an embedded device, the size of Cache is limited in consideration of area and cost, so that whether Dcache can be reduced or not is a key problem influencing performance.
At present, in the image detection process, the traditional scheme flow is as follows: inputting a frame of image, traversing windows by taking step as 1, wherein each window traverses all weak classifiers, if any weak classifier fails, exiting, and the window is not taken as a target window, and if all weak classifiers pass, the window is taken as the target window.
According to the scheme, if 3000-level weak classifiers exist, any continuous 9 weak classifiers may correspond to different 9 directional gradient graphs, and data needs to be read from a memory continuously, so that Cache jolt of the data can be caused, Cache miss occurs, and image detection performance is affected.
Disclosure of Invention
The image detection method and the image detection device provided by the invention can effectively reduce the influence of high-speed miss and improve the performance of image detection.
In a first aspect, the present invention provides an image detection method, including:
traversing a frame of image by using a current weak classifier in a row window unit, and traversing the current window by using a next weak classifier in the row direction after the current weak classifier finishes traversing the current window;
if the current weak classifier does not pass through the current window, the current window is not taken as a target window, and the next weak classifier does not perform re-verification on the current window;
and if all weak classifiers pass through the current window, taking the current window as a target window.
Optionally, if the current weak classifier fails in the current window, the step of not considering the current window as the target window and not verifying the next weak classifier again in the current window includes: and if the current weak classifier does not pass through the current window, setting the flag bit to be 1, not taking the current window as a target window, and judging that the next weak classifier does not perform re-verification on the current window according to the flag bit.
Optionally, the method further comprises:
setting an array, and initializing the size of the array to be the width of one line of data;
after one weak classifier traverses one line, recording the number of the classifiers which can pass through, and updating the size of the array;
when the size of the array is updated to zero, the loop is directly exited and the next row is entered.
Optionally, the recording the number of classifiers that can pass through, and updating the size of the array includes: the size of the array is reduced by 1 for each pass through one classifier.
In a second aspect, the present invention provides an image detection apparatus comprising:
the traversal unit is used for traversing a frame of image by adopting a current weak classifier in a row window unit, and traversing the current window by adopting a next weak classifier in the row direction after the current weak classifier finishes traversing the current window;
the first processing unit is used for taking the current window as a target window and not verifying the next weak classifier again in the current window when the current weak classifier fails in the current window;
and the second processing unit is used for taking the current window as a target window when all the weak classifiers pass through the current window.
Optionally, the first processing unit is configured to mark a flag bit as 1 when the current weak classifier fails in the current window, and determine that the next weak classifier does not perform re-verification in the current window according to the flag bit, where the current window is not used as a target window.
Optionally, the apparatus further comprises:
the initialization unit is used for setting an array and initializing the size of the array as the width of a line of data;
the updating unit is used for recording the number of the classifiers which can pass through and updating the size of the array after one weak classifier finishes traversing one line;
and the conversion unit is used for directly exiting the cycle and entering the next row when the size of the array is updated to zero.
Optionally, the updating unit is configured to reduce the size of the array by 1 every time the classifier is passed.
According to the image detection method and device provided by the embodiment of the invention, for a frame of image, a current weak classifier is adopted to traverse in a row window unit, after the current weak classifier traverses a current window, a next weak classifier is adopted to traverse the current window in the row direction, if the current weak classifier does not pass through the current window, the current window is not used as a target window, the next weak classifier does not perform re-verification on the current window, and if all the weak classifiers pass through the current window, the current window is used as the target window. Compared with the prior art, each weak classifier only uses one directional gradient map on the calculation of the window in the whole row direction, and does not need to read data from a memory frequently, so that the algorithm performance of image detection can be improved; the loop exit is controlled in a dynamic array mode, and the calculated amount can be effectively reduced.
Drawings
FIG. 1 is a flowchart of an image detection method according to an embodiment of the present invention
Fig. 2 is a schematic structural diagram of an image detection apparatus according to an embodiment of the invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
An embodiment of the present invention provides an image detection method, as shown in fig. 1, the method includes:
and S11, traversing a frame of image by using the current weak classifier in a row window unit, and traversing the current window by using the next weak classifier in the row direction after the current weak classifier finishes traversing the current window.
S12, if the current weak classifier fails in the current window, the current window is not taken as the target window, and the next weak classifier is not verified again in the current window.
And S13, if all weak classifiers pass through the current window, taking the current window as a target window.
In the image detection method provided by the embodiment of the invention, for a frame of image, a current weak classifier is adopted to traverse in a row window unit, after the current weak classifier traverses a current window, a next weak classifier is adopted to traverse the current window in the row direction, if the current weak classifier does not pass through the current window, the current window is not used as a target window, the next weak classifier does not perform re-verification on the current window, and if all the weak classifiers pass through the current window, the current window is used as the target window. Compared with the prior art, each weak classifier only uses one directional gradient map on the calculation of the window in the whole row direction, and does not need to read data from a memory frequently, so that the algorithm performance of image detection can be improved; the loop exit is controlled in a dynamic array mode, and the calculated amount can be effectively reduced.
The image detection method of the present invention is explained in detail below.
Firstly, inputting a frame of image, traversing all windows in the row direction by each weak classifier, and then walking the next weak classifier, namely, replacing the original window unit by one row;
then, if the current classifier fails in the current window, setting the flag bit to be 1, not taking the current window as a target window, and not carrying out re-verification on the next weak classifier according to the flag bit;
and if all the weak classifiers pass through the current window, taking the current window as the target window.
By adopting the image detection method, each weak classifier only uses one directional gradient map on the calculation of the window in the whole row direction, and data do not need to be read from a memory frequently, so that the performance of the algorithm can be improved.
In order to further optimize the algorithm, the loop exit can be controlled in a dynamic array mode, so that the calculated amount is effectively reduced, and the specific scheme is as follows:
setting an array, and initializing the size of the array as the width of a line of data;
after one weak classifier traverses one line, recording the number of the classifiers which can pass through, updating the size of the array, and controlling the next weak classifier, thereby saving most of cyclic judgment and time; specifically, the size of the array is reduced by 1 for each classifier;
when the size of the array is updated to zero, the loop is directly exited and the next row is entered.
An embodiment of the present invention further provides an image detection apparatus, as shown in fig. 2, the apparatus includes:
the traversal unit 11 is configured to traverse a frame of image in a row window unit by using a current weak classifier, and traverse a current window in a row direction by using a next weak classifier after the current weak classifier finishes traversing the current window;
the first processing unit 12 is configured to, when the current weak classifier fails in the current window, take the current window as a target window, and perform no re-verification on the next weak classifier in the current window;
and the second processing unit 13 is configured to, when all weak classifiers pass through the current window, take the current window as a target window.
The image detection device provided in the embodiment of the present invention traverses a frame of image by using a current weak classifier in a row window unit, traverses a current window by using a next weak classifier after the current weak classifier has traversed the current window, does not perform re-verification on the current window if the current weak classifier fails to pass through the current window, and determines the current window as the target window if all weak classifiers pass through the current window. Compared with the prior art, each weak classifier only uses one directional gradient map on the calculation of the window in the whole row direction, and does not need to read data from a memory frequently, so that the algorithm performance of image detection can be improved; the loop exit is controlled in a dynamic array mode, and the calculated amount can be effectively reduced.
Optionally, the first processing unit 12 is configured to mark a flag bit as 1 when the current weak classifier fails in the current window, and determine that the next weak classifier does not perform re-verification in the current window according to the flag bit, where the current window is not used as the target window.
Optionally, the apparatus further comprises:
the initialization unit is used for setting an array and initializing the size of the array as the width of a line of data;
the updating unit is used for recording the number of the classifiers which can pass through and updating the size of the array after one weak classifier finishes traversing one line;
and the conversion unit is used for directly exiting the cycle and entering the next row when the size of the array is updated to zero.
Optionally, the updating unit is configured to reduce the size of the array by 1 every time the classifier is passed.
The apparatus of this embodiment may be configured to implement the technical solutions of the above method embodiments, and the implementation principles and technical effects are similar, which are not described herein again.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.
The above description is only for the specific embodiment of the present invention, but the scope of the present invention is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present invention are included in the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (6)

1. An image detection method, comprising:
traversing a frame of image by using a current weak classifier in a row window unit, and traversing the current window by using a next weak classifier in the row direction after the current weak classifier finishes traversing the current window;
if the current weak classifier does not pass through the current window, the current window is not taken as a target window, and the next weak classifier does not perform re-verification on the current window;
if all weak classifiers pass through the current window, taking the current window as a target window;
the method further comprises the following steps: setting an array, and initializing the size of the array to be the width of one line of data; after one weak classifier traverses one line, recording the number of the classifiers which can pass through, and updating the size of the array; when the size of the array is updated to zero, the loop is directly exited and the next row is entered.
2. The method of claim 1, wherein the de-targeting the current window if the current weak classifier fails in the current window, and the non-re-validating of the next weak classifier in the current window comprises: and if the current weak classifier does not pass through the current window, setting the flag bit to be 1, not taking the current window as a target window, and judging that the next weak classifier does not perform re-verification on the current window according to the flag bit.
3. The method of claim 1, wherein recording the number of classifiers that can pass through and updating the size of the array comprises: the size of the array is reduced by 1 for each pass through one classifier.
4. An image detection apparatus, characterized by comprising:
the traversal unit is used for traversing a frame of image by adopting a current weak classifier in a row window unit, and traversing the current window by adopting a next weak classifier in the row direction after the current weak classifier finishes traversing the current window;
the first processing unit is used for taking the current window as a target window and not verifying the next weak classifier again in the current window when the current weak classifier fails in the current window;
the second processing unit is used for taking the current window as a target window when all the weak classifiers pass through the current window;
the device further comprises: the initialization unit is used for setting an array and initializing the size of the array as the width of a line of data; the updating unit is used for recording the number of the classifiers which can pass through and updating the size of the array after one weak classifier finishes traversing one line; and the conversion unit is used for directly exiting the cycle and entering the next row when the size of the array is updated to zero.
5. The apparatus of claim 4, wherein the first processing unit is configured to set a flag bit to 1 when the current weak classifier fails in a current window, and to set the current window as a target window, and determine that the next weak classifier does not perform re-verification in the current window according to the flag bit.
6. The apparatus of claim 4, wherein the updating unit is configured to reduce the size of the array by 1 per pass through one classifier.
CN201711420991.9A 2017-12-25 2017-12-25 Image detection method and device Active CN109961079B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711420991.9A CN109961079B (en) 2017-12-25 2017-12-25 Image detection method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711420991.9A CN109961079B (en) 2017-12-25 2017-12-25 Image detection method and device

Publications (2)

Publication Number Publication Date
CN109961079A CN109961079A (en) 2019-07-02
CN109961079B true CN109961079B (en) 2021-06-04

Family

ID=67020833

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711420991.9A Active CN109961079B (en) 2017-12-25 2017-12-25 Image detection method and device

Country Status (1)

Country Link
CN (1) CN109961079B (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101996405A (en) * 2010-08-30 2011-03-30 中国科学院计算技术研究所 Method and device for rapidly detecting and classifying defects of glass image
CN102509259A (en) * 2011-09-28 2012-06-20 上海大学 Image scaling method based on directions of pixels in image
CN102713934A (en) * 2009-12-30 2012-10-03 诺基亚公司 Method, device and computer program product for detecting objects in digital images
WO2012168538A1 (en) * 2011-06-07 2012-12-13 Nokia Corporation Method, apparatus and computer program product for object detection
CN104504397A (en) * 2014-12-31 2015-04-08 云智视像科技(上海)有限公司 Monitoring video abstraction method and system based on face identification
CN104636749A (en) * 2013-11-14 2015-05-20 中国移动通信集团公司 Target object detection method and device
CN107077621A (en) * 2014-09-30 2017-08-18 高通股份有限公司 For scanning window in the hardware of low-power object detection in image

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101398893B (en) * 2008-10-10 2010-09-01 北京科技大学 Adaboost arithmetic improved robust human ear detection method
CN101853389A (en) * 2009-04-01 2010-10-06 索尼株式会社 Detection device and method for multi-class targets
CN102722723B (en) * 2012-05-24 2014-11-05 杭州海康威视数字技术股份有限公司 Multi-scale-based Adaboost detection method and system

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102713934A (en) * 2009-12-30 2012-10-03 诺基亚公司 Method, device and computer program product for detecting objects in digital images
CN101996405A (en) * 2010-08-30 2011-03-30 中国科学院计算技术研究所 Method and device for rapidly detecting and classifying defects of glass image
WO2012168538A1 (en) * 2011-06-07 2012-12-13 Nokia Corporation Method, apparatus and computer program product for object detection
CN102509259A (en) * 2011-09-28 2012-06-20 上海大学 Image scaling method based on directions of pixels in image
CN104636749A (en) * 2013-11-14 2015-05-20 中国移动通信集团公司 Target object detection method and device
CN107077621A (en) * 2014-09-30 2017-08-18 高通股份有限公司 For scanning window in the hardware of low-power object detection in image
CN104504397A (en) * 2014-12-31 2015-04-08 云智视像科技(上海)有限公司 Monitoring video abstraction method and system based on face identification

Also Published As

Publication number Publication date
CN109961079A (en) 2019-07-02

Similar Documents

Publication Publication Date Title
WO2018103608A1 (en) Text detection method, device and storage medium
WO2021056746A1 (en) Image model testing method and apparatus, electronic device and storage medium
CN105825524A (en) Target tracking method and apparatus
WO2020047854A1 (en) Detecting objects in video frames using similarity detectors
KR102476897B1 (en) Method and apparatus for tracking object, and 3d display device thereof
US9047173B2 (en) Tracking and eliminating bad prefetches generated by a stride prefetcher
KR102141296B1 (en) Object tracking method and apparatus performing the same
US20130185515A1 (en) Utilizing Negative Feedback from Unexpected Miss Addresses in a Hardware Prefetcher
WO2017162023A1 (en) License plate detection method and device
CN110135318A (en) Cross determination method, apparatus, equipment and the storage medium of vehicle record
CN108830385A (en) deep learning model training method and device and computer readable storage medium
US20100166317A1 (en) Method, apparatus and computer program product for providing face pose estimation
CN106919891A (en) A kind of image processing method and device
CN107330387A (en) Pedestrian detection method based on view data
US11455252B2 (en) Multi-class multi-label classification using clustered singular decision trees for hardware adaptation
KR102103557B1 (en) Method for face recognition, apparatus for face recognition and computer program for the same
WO2017045275A1 (en) Method, device for navigation graph plotting and storage medium thereof
CN109961079B (en) Image detection method and device
CN109034032B (en) Image processing method, apparatus, device and medium
US11544173B1 (en) Detecting performance regressions in software for controlling autonomous vehicles
CN110147724A (en) For detecting text filed method, apparatus, equipment and medium in video
US11226819B2 (en) Selective prefetching in multithreaded processing units
CN115713111A (en) Method for training object detection model and object detection method
Li et al. Collaborating visual tracker based on particle filter and correlation filter
Zheng et al. Real-time visual object tracking based on reinforcement learning with twin delayed deep deterministic algorithm

Legal Events

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