WO2018113206A1 - Image processing method and terminal - Google Patents

Image processing method and terminal Download PDF

Info

Publication number
WO2018113206A1
WO2018113206A1 PCT/CN2017/087705 CN2017087705W WO2018113206A1 WO 2018113206 A1 WO2018113206 A1 WO 2018113206A1 CN 2017087705 W CN2017087705 W CN 2017087705W WO 2018113206 A1 WO2018113206 A1 WO 2018113206A1
Authority
WO
WIPO (PCT)
Prior art keywords
target
sample set
feature
target feature
gradient
Prior art date
Application number
PCT/CN2017/087705
Other languages
French (fr)
Chinese (zh)
Inventor
牟永强
张兆丰
杨龙
田第鸿
Original Assignee
深圳云天励飞技术有限公司
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 深圳云天励飞技术有限公司 filed Critical 深圳云天励飞技术有限公司
Publication of WO2018113206A1 publication Critical patent/WO2018113206A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • G06F18/243Classification techniques relating to the number of classes
    • G06F18/24323Tree-organised classifiers

Definitions

  • the present invention relates to the field of image processing technologies, and in particular, to an image processing method and a terminal.
  • face detection is a very basic research direction in the field of vision, and the application range is very wide, such as security, smart business, robot, human-computer interaction and the like. Since the face is a non-rigid object, it is easily interfered by the external environment, such as weather, light, expression, posture, camera distortion and other factors, the detection difficulty is obvious.
  • Commonly used face detection methods include early algorithms based on face geometry, template matching algorithms, machine learning related algorithms, and popular deep learning algorithms in recent years.
  • the feature expression of a class of sub-detectors is more complicated, such as 10 channel features in the integral channel map and HOG features in DPM. Although it shows good performance on face detection, the calculation is too Complex, large amount of feature calculation, large redundant information, difficult to reach the requirements of real-time applications.
  • Another type of face detector although the features used are very simple, representative of such as HAAR, pixel difference features, although the effect is not the same, but the amount of calculation is relatively small, widely used in the engineering field. Therefore, how to obtain a classifier with better feature screening ability and faster calculation speed under the premise of not degrading performance needs to be solved urgently.
  • the embodiment of the invention provides an image processing method and a terminal, so as to realize a classifier with better feature screening capability and faster calculation speed without degradation of performance.
  • a first aspect of the embodiments of the present invention provides an image processing method, including:
  • each of the X first target feature sets is the first target
  • the feature set includes a luminance feature component, two color difference feature components, a gradient magnitude component, and six gradient direction components corresponding to the gradient magnitude component, the X being an integer greater than one;
  • Pixel difference feature extraction is performed on each of the first target feature sets in the X first target feature sets to obtain the X second target feature sets, wherein each of the X second target feature sets
  • the second target feature set includes a plurality of pixel difference features
  • the X second target feature sets are classified by using at least one boosting decision tree to obtain a target classifier.
  • the performing an integral channel feature extraction on the target positive sample set and the target negative sample set respectively includes:
  • the performing the pixel difference feature extraction on each of the first target feature sets of the X first target feature sets includes:
  • the K positions are randomly selected from the first target feature set j correspondence, the first target feature set j is any one of the X first target feature sets, and the K is an even number;
  • Pixel values corresponding to the K positions are formed into K/2 pixel pairs
  • the at least one boosting decision tree is used to classify the multiple second target feature sets to obtain a target weak classifier, including:
  • the A is a positive integer
  • a second-level classifier from the second-level classifier that meets the preset condition is used as a The target classifier.
  • the fourth possible implementation manner of the first aspect before the obtaining the positive sample set and the negative sample set, the method also includes:
  • weights of each of the positive sample set and the negative sample set are initialized according to the following formula, wherein s is any sample, as follows:
  • P is the number of samples in the positive sample set
  • N is the number of samples in the negative sample set
  • C s is the sample class
  • s is any sample
  • w s is the weight of the sample
  • C s ⁇ +1,-1 ⁇ , +1 is a positive sample
  • -1 is a negative sample
  • a second aspect of the embodiments of the present invention provides a terminal, including:
  • An acquisition unit for obtaining a positive sample set and a negative sample set An acquisition unit for obtaining a positive sample set and a negative sample set
  • a processing unit configured to perform smoothing processing on the positive sample set and the negative sample set to obtain a target positive sample set and a target negative sample set;
  • a first extracting unit configured to perform an integral channel feature extraction on the target positive sample set and the target negative sample set, respectively, to obtain X first target feature sets, wherein each of the X first target feature sets
  • a first target feature set includes a luma feature component, two chroma component components, a gradient magnitude component, and six gradient direction components corresponding to the gradient magnitude component, the X being an integer greater than one;
  • a second extracting unit configured to perform pixel difference feature extraction on each of the first target feature sets of the X first target feature sets, to obtain the X second target feature sets, where the X first
  • Each of the second target feature sets includes a plurality of pixel difference features in the second target feature set
  • a classifying unit configured to use the at least one boosting decision tree to the X second target feature sets Classify and get the target classifier.
  • the first extracting unit includes:
  • a conversion module configured to convert the target sample i into the LUV space, to obtain a luminance feature component, and two color difference feature components, wherein the target sample i is any one of the target positive sample set or the target negative sample set;
  • a first determining module configured to determine a gradient calculation for each channel in the target sample i, to obtain a gradient amplitude component and a gradient direction component;
  • a dividing module configured to divide the gradient direction component into 6 parts, to obtain 6 gradient directions
  • a second determining module configured to soft-project the gradient amplitude component to the six gradient directions to obtain six gradient direction components corresponding to the gradient amplitude component, wherein the luminance feature component, the 2 The first color difference feature component, the gradient magnitude component, and the six gradient direction components are combined to form the first target feature set.
  • the second extracting unit includes:
  • a selection module configured to randomly select K locations from the first target feature set j correspondence, the first target feature set j is any one of the X first target feature sets, and the K is an even number ;
  • a combination module configured to form pixel values corresponding to the K locations into K/2 pixel pairs
  • a calculation module configured to calculate a difference value of each of the K/2 pixel pairs, to obtain the K/2 pixel difference feature, that is, a second target feature set.
  • the classification unit includes:
  • a first classification module configured to classify the X second target feature sets by using at least one boosting decision tree, to obtain Y first-level classifiers, where Y is an integer greater than one;
  • a mining module configured to mine the negative sample set by using a hard mining algorithm to obtain Z negative samples
  • a second classification module configured to classify the Z negative samples by using the Y classifiers to obtain A second classifiers, where A is a positive integer;
  • a judging module configured to determine whether there is a second-level classifier that meets a preset condition in the A second-level classifiers
  • a third determining module configured to: when there is a second-level classifier that meets the preset condition in the A second-level classifiers, one of the second-level classifiers that meet the preset condition A second level classifier acts as the target classifier.
  • the terminal further includes:
  • a processing unit configured to initialize a weight of each sample in the positive sample set and the negative sample set according to the following formula before the obtaining unit acquires a positive sample set and a negative sample set, where s is any sample, as follows :
  • P is the number of samples in the positive sample set
  • N is the number of samples in the negative sample set
  • C s is the sample class
  • s is any sample
  • w s is the weight of the sample
  • C s ⁇ +1,-1 ⁇ , +1 is a positive sample
  • -1 is a negative sample
  • a fitting unit configured to perform weighted least squares fitting according to the positive sample set and the negative sample set and the weight of each sample, to obtain the at least one boosting decision tree.
  • a third aspect of the embodiments of the present invention provides a terminal, including:
  • a processor and a memory wherein the processor performs some or all of the steps of the method described in the first aspect by invoking code or instructions in the memory.
  • a positive sample set and a negative sample set are obtained, and the positive sample set and the negative sample set are smoothed to obtain a target positive sample set and a target negative sample set, and the target positive sample set and the target negative sample set are respectively performed. Integrating the channel feature extraction to obtain X first target feature sets, wherein each of the first target feature sets of the X first target feature sets includes a luminance feature component, two color difference feature components, a gradient magnitude component, and the The six gradient direction components corresponding to the gradient amplitude component, X is an integer greater than 1, and the pixel difference feature extraction is performed on each of the first target feature sets of the X first target feature sets to obtain X second target feature sets.
  • Each of the X second target feature sets includes a plurality of pixel difference features in each second target feature set, and the X second target feature sets are classified by using at least one boosting decision tree to obtain a target classifier. In this way, a classifier with better feature screening capability and faster calculation speed can be obtained without degrading performance.
  • 1-1 is a schematic diagram showing a presentation of a face image according to an embodiment of the present invention.
  • FIG. 1-1 is a schematic diagram showing the 10 channel features corresponding to the face image in FIG. 1-1 according to an embodiment of the present invention
  • FIG. 1-3 are response diagrams of the ten channel features in FIG. 1-2 according to an embodiment of the present invention.
  • FIG. 2 is a schematic flowchart of an embodiment of an image processing method according to an embodiment of the present invention
  • FIG. 3 is a schematic structural diagram of a first embodiment of a terminal according to an embodiment of the present disclosure
  • FIG. 3b is a schematic structural diagram of a first extracting unit of the terminal depicted in FIG. 3a according to an embodiment of the present disclosure
  • FIG. 3c is a schematic structural diagram of a second extraction unit of the terminal depicted in FIG. 3a according to an embodiment of the present disclosure
  • FIG. 3 is a schematic structural diagram of a classification unit of the terminal depicted in FIG. 3a according to an embodiment of the present disclosure
  • FIG. 3 e is another schematic structural diagram of the terminal depicted in FIG. 3 a according to an embodiment of the present invention.
  • FIG. 4 is a schematic structural diagram of a second embodiment of a terminal according to an embodiment of the present invention.
  • references to "an embodiment” herein mean that a particular feature, structure, or characteristic described in connection with the embodiments can be included in at least one embodiment of the invention.
  • the appearances of the phrases in various places in the specification are not necessarily referring to the same embodiments, and are not exclusive or alternative embodiments that are mutually exclusive. Those skilled in the art will understand and implicitly understand that the embodiments described herein can be combined with other embodiments.
  • the terminal described in the embodiments of the present invention may include a smart phone (such as an Android mobile phone, an iOS mobile phone, a Windows Phone mobile phone, etc.), a tablet computer, a palmtop computer, a notebook computer, a mobile Internet device (MID, Mobile Internet Devices), or a wearable device.
  • a smart phone such as an Android mobile phone, an iOS mobile phone, a Windows Phone mobile phone, etc.
  • a tablet computer such as an Android mobile phone, an iOS mobile phone, a Windows Phone mobile phone, etc.
  • a palmtop computer such as a notebook computer
  • MID Mobile Internet Devices
  • Boosting classifier can be considered as a feature screening algorithm. Due to its simplicity and generalization ability, it has a very wide application in many fields. Specifically, boosting separates the sample space by character-selecting and enhancing the weight of the misclassified samples.
  • HAAR Face Detector is one of the first algorithms to raise face detection to the application level.
  • the algorithm is mainly divided into three parts, feature generation, boosting to select weak classifier features and strong classifier construction.
  • Feature generation is mainly to construct a number of black and white rectangular blocks. The features are generated by comparing the difference between the pixels of the black and white rectangles. The name is also similar because the calculation process is similar to the calculation process of the HAAR wavelet. The pixels of the rectangular block can be based on the integral map. To calculate, the calculation speed and overhead are considerable; feature selection is performed by the boosting algorithm; finally, the selected weak classifier features are combined to generate many strong classifiers.
  • DPM Deformable Part Model face detector
  • DPM divides a rigid or non-rigid object into a number of sub-components, and finally describes the object to be identified by describing each sub-component, and each component and sub-component are characterized by HOG.
  • the response filter of each part is solved by an optimization algorithm. Due to its relatively complex calculations, its application in many fields is limited.
  • ACF (Aggregated Channel Feature) face detector
  • ICF Intelligent Channel Feature
  • ACF is an extension of ICF (Integral Channel Feature), which is equivalent to doing a sub-sampling on the basis of ICF.
  • the advantage of this is that on the one hand, the feature dimension is reduced, On the one hand, it can increase the resistance to deformation.
  • ACF was first used in the field of pedestrian detection, and some people have achieved good results in the field of application and face detection. However, due to its large computational overhead, the features have large redundancy and the improvement space is also large.
  • PICO Panel Intensity Comparison Object Detector
  • PICO is a feature description algorithm based on statistical characteristics. Its feature description is similar to that of Ferns. Due to its simple calculation and strong description ability, it is applied in many Computer vision areas such as object detection, target recognition, target tracking, etc. Recently, some people have applied it to the field of face detection, and the accuracy is relatively general, but the calculation speed is very fast. The reason is that the feature expression is too simple and there is a relatively large room for improvement.
  • Figure 1-1 shows the original image.
  • Figure 1-2 shows the characteristics of 10 integral channels. It can be seen that the feature expression is relatively strong, covering color space information, gradient amplitude information, and edge information in different directions. Large redundant information.
  • Figure 1-3 shows the response of the 10 channel features in Figure 1-2. It can be seen that the brighter the color, the higher the degree of importance. Figure 1-3 also includes the integral after the response.
  • the channel features are in turn LUV features, gradient magnitude features, and gradient features in six directions.
  • face detectors although the features used are very simple, representative of such as HAAR, pixel difference features, although the effect is not as good as 1, but the amount of calculation is relatively small, widely used in the engineering field.
  • the problem that the fish and the bear's paw cannot be obtained in the existing face detector is mainly the problem that the complex feature has large computational cost and the simple feature expression ability is poor, and a compromise method is proposed. Improve the calculation speed while ensuring performance.
  • An embodiment of the present invention provides an image processing method that includes the following steps:
  • each of the plurality of first target feature sets includes a luminance characteristic component, two color difference characteristic components, a gradient amplitude component, and six gradient direction components corresponding to the gradient amplitude component;
  • each of the plurality of second target feature sets includes a plurality of pixel difference features
  • the embodiment of the present invention is directed to the existing poor performance of the pixel-based difference feature, and is susceptible to complex environments such as illumination and noise; the feature dimension of the integral channel feature is high, and the information redundancy is more; a unified framework is proposed. Under the condition that the detection rate is hardly affected, a more adaptive feature description method is proposed. On the one hand, the robustness of the feature is improved. On the other hand, the detection speed is improved because the dimension of the feature is greatly reduced. For the response maps of the corresponding 10 integral channel features selected by the boosting feature, the color indicates the importance of the features from shallow and deep. Practice has proved that only a small number of areas have obvious corresponding, and the degree of feature redundancy is very high.
  • FIG. 2 is a schematic flowchart of an embodiment of an image processing method according to an embodiment of the present invention.
  • the image processing method described in this embodiment includes the following steps:
  • the positive sample set and the negative sample set may be prepared in the embodiment of the present invention, wherein the positive sample set includes multiple positive samples, the negative sample set includes multiple negative samples, and the positive sample may be a cut containing human face.
  • the image of the region for example, the size of each sample can be normalized to 24x24, and the negative sample can be a background image that does not contain a human face.
  • the noise collection may be performed on the positive sample set and the negative sample set.
  • the noise is also varied due to the number of sample types prepared.
  • the embodiment of the present invention may use a Gaussian filter to smooth the positive and negative samples to remove The high-frequency components suspected of noise are eliminated.
  • experiments have also shown that low-pass filtering of the sample set (including negative samples of the positive sample set) before detection can increase the detection rate and reduce the false detection rate.
  • the set includes a luma feature component, two chroma component components, a gradient magnitude component, and six gradient direction components corresponding to the gradient magnitude component, the X being an integer greater than one.
  • step 203 the feature channel extraction is performed on the target positive sample set and the target negative sample set respectively, which may include the following steps:
  • the above steps 31-34 may be referred to as integral channel feature extraction.
  • the target sample i is either the target positive sample set or the target negative sample set, that is, the sample i (image) is converted to the LUV.
  • Space extract a luminance component and two color difference components; then, perform gradient calculation for each channel of the RGB component in the input image, including gradient magnitude and gradient direction; divide the gradient direction into 6 parts, and gradient each pixel
  • the amplitude is soft-projected according to the six directions, that is, the gradient of each pixel is allocated to two adjacent Bins according to its contribution.
  • the above operations can be performed on the RGB components, and the result can be MAX-operated, thus,
  • the advantage is to increase the robustness of the feature, reduce the impact of noise on the gradient features, and normalize the gradient magnitude.
  • step 204 performing pixel difference feature extraction on each of the plurality of first target feature sets, including the following steps:
  • the above steps 41-43 can be referred to as channel feature-based pixel difference feature calculation, and only how the pixel difference feature of one channel is calculated is as follows.
  • any channel it can be regarded as a 24x24 image, and 400 random positions are randomly generated on the image, and two pairs of pixels form one pixel pair (two pixels in different positions can form one pixel pair), and a total of 200 pixel pairs are generated.
  • Calculate the 200 pixel pairs The difference produces a 200 pixel difference feature.
  • the at least one boosting decision tree may be obtained before step 201.
  • the plurality of second target feature sets are classified by using at least one boosting decision tree, and the target weak classifier is obtained, which may include the following steps:
  • the above uses the hard mining algorithm to select some representative negative samples on a large number of negative sample sets, and each round of the voting decision tree is classified for the more difficult negative samples, so that the characteristics learned by the classifier are guaranteed by Easy to reach, the sample distribution covered is also diverse.
  • the method further includes the following steps:
  • weights of each of the positive sample set and the negative sample set are initialized according to the following formula, wherein s is any sample, as follows:
  • P is the number of samples in the positive sample set
  • N is the number of samples in the negative sample set
  • C s is the sample class
  • s is any sample
  • w s is the weight of the sample
  • C s ⁇ +1,-1 ⁇ , +1 is a positive sample
  • -1 is a negative sample
  • the above-mentioned boosting decision tree is used to classify positive and negative samples.
  • the purpose of the boosting decision tree is to select multiple weak classifiers, and each weak classifier is reclassified on the sample space of the previous weak classifier. This kind of thinking is similar to the "three smugglers top one Zhuge Liang", so, the speed is very fast, in the early stage can be excluded some obvious negative samples.
  • the detailed boosting decision tree algorithm is as follows:
  • P and N are the number of positive and negative samples, respectively.
  • the target classifier obtained above can increase the resistance of the feature to illumination to a certain extent, and can express the target with fewer features, and the feature redundant information is less, further improving the feature calculation speed.
  • a positive sample set and a negative sample set are obtained, and the positive sample set and the negative sample set are smoothed to obtain a target positive sample set and a target negative sample set, respectively, and the target positive sample set and the target are respectively obtained.
  • the negative sample set is subjected to integral channel feature extraction to obtain X first target feature sets, wherein each of the first target feature sets of the X first target feature sets includes one luminance feature component, two color difference feature components, and a gradient magnitude.
  • X is an integer greater than 1
  • pixel feature extraction is performed on each of the first target feature sets of the X first target feature sets to obtain X numbers a second target feature set, wherein each of the second target feature sets includes a plurality of pixel difference features, and at least one boosting decision tree pair X
  • the second target feature set is classified to obtain a target classifier. In this way, a classifier with better feature screening capability and faster calculation speed can be obtained without degrading performance.
  • FIG. 3 is a schematic structural diagram of a first embodiment of a terminal according to an embodiment of the present invention.
  • the terminal described in this embodiment includes: an obtaining unit 301, a processing unit 302, a first extracting unit 303, a second extracting unit 304, and a classifying unit 305, as follows:
  • An obtaining unit 301 configured to acquire a positive sample set and a negative sample set
  • the processing unit 302 is configured to perform smoothing processing on the positive sample set and the negative sample set to obtain a target positive sample set and a target negative sample set;
  • a first extracting unit 303 configured to perform an integrated channel feature extraction on the target positive sample set and the target negative sample set, respectively, to obtain X first target feature sets, wherein the X first target feature sets are Each first target feature set includes a luminance feature component, two color difference feature components, a gradient magnitude component, and six gradient direction components corresponding to the gradient magnitude component, the X being an integer greater than one;
  • a second extracting unit 304 configured to perform pixel difference feature extraction on each of the first target feature sets of the X first target feature sets, to obtain the X second target feature sets, where the X
  • Each of the second target feature sets includes a plurality of pixel difference features in the second target feature set
  • the classification unit 305 is configured to classify the X second target feature sets by using at least one boosting decision tree to obtain a target classifier.
  • FIG. 3b is a specific refinement structure of the first extraction unit 303 of the terminal described in FIG. 3a, where the first extraction unit 303 may include: a conversion module 3031, a first determination module 3032, and a division.
  • the module 3033 and the second determining module 3034 are specifically as follows;
  • the conversion module 3031 is configured to convert the target sample i into the LUV space to obtain a luminance feature component and two color difference feature components, wherein the target sample i is any one of the target positive sample set or the target negative sample set ;
  • a first determining module 3032 configured to determine a gradient calculation for each channel in the target sample i, to obtain a gradient amplitude component and a gradient direction component;
  • a dividing module 3033 configured to divide the gradient direction component into 6 parts, to obtain 6 gradient directions
  • a second determining module 3034 configured to softcast the gradient magnitude component to the six gradient directions, Obtaining six gradient direction components corresponding to the gradient amplitude component, wherein the luminance feature component, the two color difference feature components, the gradient magnitude component, and the six gradient direction components are combined into the first Target feature set.
  • FIG. 3c is a specific refinement structure of the second extraction unit 304 of the terminal described in FIG. 3a, and the second extraction unit 304 may include: a selection module 3041, a combination module 3042, and a calculation module 3043. ,details as follows:
  • the selecting module 3041 is configured to randomly select K locations from the first target feature set j correspondence, where the first target feature set j is any one of the X first target feature sets, where the K is even;
  • the combining module 3042 is configured to group the pixel values corresponding to the K locations into K/2 pixel pairs;
  • the calculating module 3043 is configured to calculate a difference value of each of the K/2 pixel pairs to obtain the K/2 pixel difference feature, that is, a second target feature set.
  • FIG. 3d is a specific refinement structure of the classification unit 305 of the terminal described in FIG. 3a, and the classification unit 305 may include: a first classification module 3051, a mining module 3052, and a second classification module 3053.
  • the determining module 3054 and the third determining module 3055 are as follows:
  • a first classification module 3051 configured to classify the X second target feature sets by using at least one boosting decision tree, to obtain Y first-level classifiers, where Y is an integer greater than one;
  • the mining module 3052 is configured to mine the negative sample set by using a hard mining algorithm to obtain Z negative samples.
  • a second classification module 3053 configured to classify the Z negative samples by using the Y classifiers to obtain A second classifiers, where A is a positive integer;
  • the determining module 3054 is configured to determine whether there is a second-level classifier that meets the preset condition in the A second-level classifiers;
  • a third determining module 3055 configured to: when the second level classifier that meets the preset condition exists in the A second level classifiers, from the second level classifier that meets the preset condition A second level classifier acts as the target classifier.
  • FIG. 3e is a further modified structure of the terminal described in FIG. 3a.
  • the method further includes: a processing unit 306 and a fitting unit 307, as follows:
  • the processing unit 306 is configured to initialize a weight of each sample in the positive sample set and the negative sample set according to the following formula before the obtaining unit 301 acquires the positive sample set and the negative sample set, where s is Any sample, as follows:
  • P is the number of samples in the positive sample set
  • N is the number of samples in the negative sample set
  • C s is the sample class
  • s is any sample
  • w s is the weight of the sample
  • C s ⁇ +1,-1 ⁇ , +1 is a positive sample
  • -1 is a negative sample
  • the fitting unit 307 is configured to perform weighted least squares fitting according to the positive sample set and the negative sample set and the weight of each sample to obtain the at least one boosting decision tree.
  • a positive sample set and a negative sample set can be obtained, and the positive sample set and the negative sample set are smoothed to obtain a target positive sample set and a target negative sample set, respectively.
  • the positive sample set and the target negative sample set are subjected to integral channel feature extraction to obtain X first target feature sets, wherein each of the first target feature sets of the X first target feature sets includes one luminance feature component and two color difference features.
  • X is an integer greater than 1
  • performing pixel difference feature extraction on each of the first target feature sets of the X first target feature sets Obtaining X second target feature sets, wherein each of the second target feature sets includes a plurality of pixel difference features, and the at least one boosting decision tree is used to classify the X second target feature sets , get the target classifier. In this way, a classifier with better feature screening capability and faster calculation speed can be obtained without degrading performance.
  • FIG. 4 it is a schematic structural diagram of a second embodiment of a terminal according to an embodiment of the present invention.
  • the terminal described in this embodiment includes: at least one input device 1000; at least one output device 2000; at least one processor 3000, such as a CPU; and a memory 4000, the input device 1000, the output device 2000, the processor 3000, and the memory 4000 is connected via bus 5000.
  • the input device 1000 may be a touch panel, a physical button, or a mouse.
  • the output device 2000 described above may specifically be a display screen.
  • the above memory 4000 may be a high speed RAM memory or a non-volatile memory such as a magnetic disk memory.
  • the above memory 4000 is used to store a set of program codes, and the input device 1000, the output device 2000, and the processor 3000 are used to call the program code stored in the memory 4000, and perform the following operations:
  • the processor 3000 is configured to:
  • each of the X first target feature sets includes a luminance characteristic component, two color difference characteristic components, a gradient amplitude component, and six gradient direction components corresponding to the gradient amplitude component, wherein X is an integer greater than one;
  • Pixel difference feature extraction is performed on each of the first target feature sets in the X first target feature sets to obtain the X second target feature sets, wherein each of the X second target feature sets
  • the second target feature set includes a plurality of pixel difference features
  • the X second target feature sets are classified by using at least one boosting decision tree to obtain a target classifier.
  • the processor 3000 performs an integral channel feature extraction on the target positive sample set and the target negative sample set, respectively, including:
  • the processor 3000 performs pixel difference feature extraction on each of the first target feature sets of the X first target feature sets, including:
  • the K positions are randomly selected from the first target feature set j correspondence, the first target feature set j is any one of the X first target feature sets, and the K is an even number;
  • Pixel values corresponding to the K positions are formed into K/2 pixel pairs
  • the processor 3000 uses the at least one boosting decision tree to classify the plurality of second target feature sets to obtain a target weak classifier, including:
  • a second-level classifier from the second-level classifier that meets the preset condition is used as a The target classifier.
  • the processor 3000 is further specifically configured to:
  • weights of each of the positive sample set and the negative sample set are initialized according to the following formula, wherein s is any sample, as follows:
  • P is the number of samples in the positive sample set
  • N is the number of samples in the negative sample set
  • C s is the sample class
  • s is any sample
  • w s is the weight of the sample
  • C s ⁇ +1,-1 ⁇ , +1 is a positive sample
  • -1 is a negative sample
  • the embodiment of the present invention further provides a computer storage medium, wherein the computer storage medium can store a program, and the program includes some or all of the steps of any one of the image processing methods described in the foregoing method embodiments.
  • embodiments of the present invention can be provided as a method, apparatus (device), or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or a combination of software and hardware. Moreover, the invention can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) including computer usable program code.
  • the computer program is stored/distributed in a suitable medium, provided with other hardware or as part of the hardware, or in other distributed forms, such as over the Internet or other wired or wireless telecommunication systems.
  • the computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture comprising the instruction device.
  • the apparatus implements the functions specified in one or more blocks of a flow or a flow and/or block diagram of the flowchart.
  • These computer program instructions can also be loaded onto a computer or other programmable data processing device such that a series of operational steps are performed on a computer or other programmable device to produce computer-implemented processing for execution on a computer or other programmable device.
  • the instructions provide steps for implementing the functions specified in one or more of the flow or in a block or blocks of a flow diagram.

Landscapes

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

Abstract

An image processing method and a terminal. The method comprises: acquiring a positive sample set and a negative sample set (201); performing smoothing processing on the positive sample set and the negative sample set to obtain a target positive sample set and a target negative sample set (202); performing integral channel feature extraction respectively on the target positive sample set and the target negative sample set to obtain a number X of first target feature sets (203); performing pixel difference feature extraction on the each first target feature set in the X first target feature sets to obtain X second target feature sets, the each second target feature set in the X second target feature sets comprising a plurality of pixel difference features (204); and classifying the X second target feature sets by using at least one boosting decision-making tree to obtain a target classifier (205). The method can obtain a classifier having better feature selection ability and higher computing speed without performance degradation.

Description

一种图像处理方法及终端Image processing method and terminal 技术领域Technical field
本发明涉及图像处理技术领域,具体涉及一种图像处理方法及终端。The present invention relates to the field of image processing technologies, and in particular, to an image processing method and a terminal.
背景技术Background technique
现有技术中,人脸检测是视觉领域的一个非常基础的研究方向,应用范围非常广泛,如安防、智慧商业、机器人、人机交互等领域。由于人脸是一个非刚性的物体,容易受到外界环境的干扰,如天气、光照、表情、姿态、相机畸变等因素的影响,检测难度是显而易见的。常用的人脸检测方法有基于人脸几何形状的早期算法、模板匹配算法、机器学习相关的算法以及近些年来比较流行的深度学习算法。In the prior art, face detection is a very basic research direction in the field of vision, and the application range is very wide, such as security, smart business, robot, human-computer interaction and the like. Since the face is a non-rigid object, it is easily interfered by the external environment, such as weather, light, expression, posture, camera distortion and other factors, the detection difficulty is obvious. Commonly used face detection methods include early algorithms based on face geometry, template matching algorithms, machine learning related algorithms, and popular deep learning algorithms in recent years.
现存人脸检测器中,一类分检测器的特征表达比较复杂,如积分通道图中10个通道特征、DPM中的HOG特征,虽然在人脸检测上表现出很好的性能,但是计算过于复杂,特征计算量大,存在较大冗余信息,难到达实时应用的要求。另一类人脸检测器,虽然使用的特征非常简单,具有代表性的如HAAR、像素差值特征,效果虽然不前一类,但是计算量比较小,在工程领域应用的非常广泛。因而,如何得到在性能不下降的前提下,实现具有较好特征筛选能力和较快计算速度的分类器的问题亟待解决。In the existing face detector, the feature expression of a class of sub-detectors is more complicated, such as 10 channel features in the integral channel map and HOG features in DPM. Although it shows good performance on face detection, the calculation is too Complex, large amount of feature calculation, large redundant information, difficult to reach the requirements of real-time applications. Another type of face detector, although the features used are very simple, representative of such as HAAR, pixel difference features, although the effect is not the same, but the amount of calculation is relatively small, widely used in the engineering field. Therefore, how to obtain a classifier with better feature screening ability and faster calculation speed under the premise of not degrading performance needs to be solved urgently.
发明内容Summary of the invention
本发明实施例提供了一种图像处理方法及终端,以期实现一种在性能不下降的前提下,具有较好特征筛选能力和较快计算速度的分类器。The embodiment of the invention provides an image processing method and a terminal, so as to realize a classifier with better feature screening capability and faster calculation speed without degradation of performance.
本发明实施例第一方面提供了一种图像处理方法,包括:A first aspect of the embodiments of the present invention provides an image processing method, including:
获取正样本集和负样本集;Obtaining a positive sample set and a negative sample set;
对所述正样本集和所述负样本集进行平滑处理,得到目标正样本集和目标负样本集;Smoothing the positive sample set and the negative sample set to obtain a target positive sample set and a target negative sample set;
分别对所述目标正样本集和所述目标负样本集进行积分通道特征提取,得到X个第一目标特征集合,其中,所述X个第一目标特征集合中每一第一目标 特征集合包含一个亮度特征分量、2个色差特征分量、梯度幅值分量和与所述梯度幅值分量对应的6个梯度方向分量,所述X为大于1的整数;Performing integral channel feature extraction on the target positive sample set and the target negative sample set respectively to obtain X first target feature sets, wherein each of the X first target feature sets is the first target The feature set includes a luminance feature component, two color difference feature components, a gradient magnitude component, and six gradient direction components corresponding to the gradient magnitude component, the X being an integer greater than one;
对所述X个第一目标特征集合中每一第一目标特征集合进行像素差值特征提取,得到所述X个第二目标特征集,其中,所述X个第二目标特征集中每一第二目标特征集中包含多个像素差值特征;Pixel difference feature extraction is performed on each of the first target feature sets in the X first target feature sets to obtain the X second target feature sets, wherein each of the X second target feature sets The second target feature set includes a plurality of pixel difference features;
采用至少一个boosting决策树对所述X个第二目标特征集进行分类,得到目标分类器。The X second target feature sets are classified by using at least one boosting decision tree to obtain a target classifier.
结合第一方面,在第一方面的第一种可能实现方式中,所述分别对所述目标正样本集和所述目标负样本集进行积分通道特征提取,包括:In conjunction with the first aspect, in a first possible implementation manner of the first aspect, the performing an integral channel feature extraction on the target positive sample set and the target negative sample set respectively includes:
将目标样本i转化到LUV空间,得到亮度特征分量、2个色差特征分量,其中,所述目标样本i为所述目标正样本集或者所述目标负样本集中的任一个;Converting the target sample i into the LUV space to obtain a luminance feature component and two color difference feature components, wherein the target sample i is any one of the target positive sample set or the target negative sample set;
确定所述目标样本i中的每一通道进行梯度计算,得到梯度幅值分量和梯度方向分量;Determining each channel in the target sample i to perform a gradient calculation to obtain a gradient amplitude component and a gradient direction component;
将所述梯度方向分量划分为6份,得到6个梯度方向;Dividing the gradient direction component into 6 parts to obtain 6 gradient directions;
将所述梯度幅值分量软投影到所述6个梯度方向,得到所述梯度幅值分量对应的6个梯度方向分量,其中,所述亮度特征分量、所述2个色差特征分量、所述梯度幅值分量和所述6个梯度方向分量合成所述第一目标特征集合。Softly projecting the gradient magnitude component into the six gradient directions to obtain six gradient direction components corresponding to the gradient amplitude component, wherein the luminance feature component, the two color difference feature components, the The gradient magnitude component and the six gradient direction components are combined to form the first target feature set.
结合第一方面,在第一方面的第二种可能实现方式中,所述对所述X个第一目标特征集合中每一第一目标特征集合进行像素差值特征提取,包括:With reference to the first aspect, in a second possible implementation manner of the first aspect, the performing the pixel difference feature extraction on each of the first target feature sets of the X first target feature sets includes:
从所述第一目标特征集合j对应中随机选取K个位置,所述第一目标特征集合j为所述X个第一目标特征集合中的任一个,所述K为偶数;K positions are randomly selected from the first target feature set j correspondence, the first target feature set j is any one of the X first target feature sets, and the K is an even number;
将所述K个位置对应的像素值组成K/2个像素对;Pixel values corresponding to the K positions are formed into K/2 pixel pairs;
计算所述K/2个像素对中每一像素对的差值,得到所述K/2个像素差值特征,即第二目标特征集。Calculating a difference value of each of the K/2 pixel pairs to obtain the K/2 pixel difference feature, that is, a second target feature set.
结合第一方面,在第一方面的第三种可能实现方式中,所述采用至少一个boosting决策树对所述多个第二目标特征集进行分类,得到目标弱分类器,包括:With reference to the first aspect, in a third possible implementation manner of the first aspect, the at least one boosting decision tree is used to classify the multiple second target feature sets to obtain a target weak classifier, including:
采用至少一个boosting决策树对所述X个第二目标特征集进行分类,得到Y个第一级分类器,所述Y为大于1的整数;And classifying the X second target feature sets by using at least one boosting decision tree to obtain Y first-level classifiers, where Y is an integer greater than 1;
使用hard mining算法对所述负样本集进行挖掘,得到Z个负样本;Mining the negative sample set using a hard mining algorithm to obtain Z negative samples;
采用所述Y个级分类器对所述Z个负样本进行分类,得到A个第二级分类 器,所述A为正整数;Using the Y classifiers to classify the Z negative samples to obtain A second class classification The A is a positive integer;
判断所述A个第二级分类器中是否存在符合预设条件的第二级分类器,Determining whether there is a second-level classifier in the A second-level classifier that meets a preset condition,
在所述A个第二级分类器中存在符合所述预设条件的第二级分类器时,从所述符合所述预设条件的第二级分类器中一个第二级分类器作为所述目标分类器。When there is a second-level classifier that meets the preset condition in the A second-stage classifiers, a second-level classifier from the second-level classifier that meets the preset condition is used as a The target classifier.
结合第一方面或第一方面的第一种至第三种种任一种可能实施方式,在第一方面的第四种可能实现方式中,所述获取正样本集和负样本集之前,所述方法还包括:With reference to the first aspect, or any one of the first to third possible implementation manners of the first aspect, in the fourth possible implementation manner of the first aspect, before the obtaining the positive sample set and the negative sample set, The method also includes:
按照如下公式初始化所述正样本集和所述负样本集中每一样本的权重,其中,s为任一样本,如下:The weights of each of the positive sample set and the negative sample set are initialized according to the following formula, wherein s is any sample, as follows:
Figure PCTCN2017087705-appb-000001
Figure PCTCN2017087705-appb-000001
其中P为正样本集中的样本个数,N为负样本集中的样本个数,Cs为样本类别,s为任一样本,ws为样本的权重,Cs∈{+1,-1},+1为正样本,-1为负样本;Where P is the number of samples in the positive sample set, N is the number of samples in the negative sample set, C s is the sample class, s is any sample, w s is the weight of the sample, C s ∈{+1,-1} , +1 is a positive sample, and -1 is a negative sample;
根据所述正样本集和所述负样本集以及每一样本的权重进行加权最小二乘拟合,得到所述至少一个boosting决策树。And performing at least one boosting decision tree according to the weighted least squares fit of the positive sample set and the negative sample set and the weight of each sample.
本发明实施例第二方面提供了一种终端,包括:A second aspect of the embodiments of the present invention provides a terminal, including:
获取单元,用于获取正样本集和负样本集;An acquisition unit for obtaining a positive sample set and a negative sample set;
处理单元,用于对所述正样本集和所述负样本集进行平滑处理,得到目标正样本集和目标负样本集;a processing unit, configured to perform smoothing processing on the positive sample set and the negative sample set to obtain a target positive sample set and a target negative sample set;
第一提取单元,用于分别对所述目标正样本集和所述目标负样本集进行积分通道特征提取,得到X个第一目标特征集合,其中,所述X个第一目标特征集合中每一第一目标特征集合包含一个亮度特征分量、2个色差特征分量、梯度幅值分量和与所述梯度幅值分量对应的6个梯度方向分量,所述X为大于1的整数;a first extracting unit, configured to perform an integral channel feature extraction on the target positive sample set and the target negative sample set, respectively, to obtain X first target feature sets, wherein each of the X first target feature sets A first target feature set includes a luma feature component, two chroma component components, a gradient magnitude component, and six gradient direction components corresponding to the gradient magnitude component, the X being an integer greater than one;
第二提取单元,用于对所述X个第一目标特征集合中每一第一目标特征集合进行像素差值特征提取,得到所述X个第二目标特征集,其中,所述X个第二目标特征集中每一第二目标特征集中包含多个像素差值特征;a second extracting unit, configured to perform pixel difference feature extraction on each of the first target feature sets of the X first target feature sets, to obtain the X second target feature sets, where the X first Each of the second target feature sets includes a plurality of pixel difference features in the second target feature set;
分类单元,用于采用至少一个boosting决策树对所述X个第二目标特征集 进行分类,得到目标分类器。a classifying unit, configured to use the at least one boosting decision tree to the X second target feature sets Classify and get the target classifier.
结合第二方面,在第二方面的第一种可能实现方式中,所述第一提取单元包括:With reference to the second aspect, in a first possible implementation manner of the second aspect, the first extracting unit includes:
转化模块,用于将目标样本i转化到LUV空间,得到亮度特征分量、2个色差特征分量,其中,所述目标样本i为所述目标正样本集或者所述目标负样本集中的任一个;a conversion module, configured to convert the target sample i into the LUV space, to obtain a luminance feature component, and two color difference feature components, wherein the target sample i is any one of the target positive sample set or the target negative sample set;
第一确定模块,用于确定所述目标样本i中的每一通道进行梯度计算,得到梯度幅值分量和梯度方向分量;a first determining module, configured to determine a gradient calculation for each channel in the target sample i, to obtain a gradient amplitude component and a gradient direction component;
划分模块,用于将所述梯度方向分量划分为6份,得到6个梯度方向;a dividing module, configured to divide the gradient direction component into 6 parts, to obtain 6 gradient directions;
第二确定模块,用于将所述梯度幅值分量软投影到所述6个梯度方向,得到所述梯度幅值分量对应的6个梯度方向分量,其中,所述亮度特征分量、所述2个色差特征分量、所述梯度幅值分量和所述6个梯度方向分量合成所述第一目标特征集合。a second determining module, configured to soft-project the gradient amplitude component to the six gradient directions to obtain six gradient direction components corresponding to the gradient amplitude component, wherein the luminance feature component, the 2 The first color difference feature component, the gradient magnitude component, and the six gradient direction components are combined to form the first target feature set.
结合第二方面,在第二方面的第二种可能实现方式中,所述第二提取单元包括:With reference to the second aspect, in a second possible implementation manner of the second aspect, the second extracting unit includes:
选取模块,用于从所述第一目标特征集合j对应中随机选取K个位置,所述第一目标特征集合j为所述X个第一目标特征集合中的任一个,所述K为偶数;a selection module, configured to randomly select K locations from the first target feature set j correspondence, the first target feature set j is any one of the X first target feature sets, and the K is an even number ;
组合模块,用于将所述K个位置对应的像素值组成K/2个像素对;a combination module, configured to form pixel values corresponding to the K locations into K/2 pixel pairs;
计算模块,用于计算所述K/2个像素对中每一像素对的差值,得到所述K/2个像素差值特征,即第二目标特征集。And a calculation module, configured to calculate a difference value of each of the K/2 pixel pairs, to obtain the K/2 pixel difference feature, that is, a second target feature set.
结合第二方面,在第二方面的第三种可能实现方式中,所述分类单元包括:With reference to the second aspect, in a third possible implementation manner of the second aspect, the classification unit includes:
第一分类模块,用于采用至少一个boosting决策树对所述X个第二目标特征集进行分类,得到Y个第一级分类器,所述Y为大于1的整数;a first classification module, configured to classify the X second target feature sets by using at least one boosting decision tree, to obtain Y first-level classifiers, where Y is an integer greater than one;
挖掘模块,用于使用hard mining算法对所述负样本集进行挖掘,得到Z个负样本;a mining module, configured to mine the negative sample set by using a hard mining algorithm to obtain Z negative samples;
第二分类模块,用于采用所述Y个级分类器对所述Z个负样本进行分类,得到A个第二级分类器,所述A为正整数;a second classification module, configured to classify the Z negative samples by using the Y classifiers to obtain A second classifiers, where A is a positive integer;
判断模块,用于判断所述A个第二级分类器中是否存在符合预设条件的第二级分类器, a judging module, configured to determine whether there is a second-level classifier that meets a preset condition in the A second-level classifiers,
第三确定模块,用于在所述A个第二级分类器中存在符合所述预设条件的第二级分类器时,从所述符合所述预设条件的第二级分类器中一个第二级分类器作为所述目标分类器。a third determining module, configured to: when there is a second-level classifier that meets the preset condition in the A second-level classifiers, one of the second-level classifiers that meet the preset condition A second level classifier acts as the target classifier.
结合第二方面或第二方面的第一种至第三种种任一种可能实施方式,在第二方面的第四种可能实现方式中,所述终端还包括:With reference to the second aspect, or the first to the third possible implementation manner of the second aspect, in a fourth possible implementation manner of the second aspect, the terminal further includes:
处理单元,用于在所述获取单元获取正样本集和负样本集之前,按照如下公式初始化所述正样本集和所述负样本集中每一样本的权重,其中,s为任一样本,如下:a processing unit, configured to initialize a weight of each sample in the positive sample set and the negative sample set according to the following formula before the obtaining unit acquires a positive sample set and a negative sample set, where s is any sample, as follows :
Figure PCTCN2017087705-appb-000002
Figure PCTCN2017087705-appb-000002
其中P为正样本集中的样本个数,N为负样本集中的样本个数,Cs为样本类别,s为任一样本,ws为样本的权重,Cs∈{+1,-1},+1为正样本,-1为负样本;Where P is the number of samples in the positive sample set, N is the number of samples in the negative sample set, C s is the sample class, s is any sample, w s is the weight of the sample, C s ∈{+1,-1} , +1 is a positive sample, and -1 is a negative sample;
拟合单元,用于根据所述正样本集和所述负样本集以及每一样本的权重进行加权最小二乘拟合,得到所述至少一个boosting决策树。And a fitting unit, configured to perform weighted least squares fitting according to the positive sample set and the negative sample set and the weight of each sample, to obtain the at least one boosting decision tree.
本发明实施例第三方面提供了一种终端,包括:A third aspect of the embodiments of the present invention provides a terminal, including:
处理器和存储器;其中,所述处理器通过调用所述存储器中的代码或指令以执行第一方面所描述的方法的部分或者全部步骤。A processor and a memory; wherein the processor performs some or all of the steps of the method described in the first aspect by invoking code or instructions in the memory.
实施本发明实施例,具有如下有益效果:Embodiments of the present invention have the following beneficial effects:
通过本发明实施例,获取正样本集和负样本集,对正样本集和负样本集进行平滑处理,得到目标正样本集和目标负样本集,分别对目标正样本集和目标负样本集进行积分通道特征提取,得到X个第一目标特征集合,其中,X个第一目标特征集合中每一第一目标特征集合包含一个亮度特征分量、2个色差特征分量、梯度幅值分量和与该梯度幅值分量对应的6个梯度方向分量,X为大于1的整数,对X个第一目标特征集合中每一第一目标特征集合进行像素差值特征提取,得到X个第二目标特征集,其中,X个第二目标特征集中每一第二目标特征集中包含多个像素差值特征,采用至少一个boosting决策树对X个第二目标特征集进行分类,得到目标分类器。如此,可在性能不下降的前提下,得到具有较好特征筛选能力和较快计算速度的分类器。 According to the embodiment of the present invention, a positive sample set and a negative sample set are obtained, and the positive sample set and the negative sample set are smoothed to obtain a target positive sample set and a target negative sample set, and the target positive sample set and the target negative sample set are respectively performed. Integrating the channel feature extraction to obtain X first target feature sets, wherein each of the first target feature sets of the X first target feature sets includes a luminance feature component, two color difference feature components, a gradient magnitude component, and the The six gradient direction components corresponding to the gradient amplitude component, X is an integer greater than 1, and the pixel difference feature extraction is performed on each of the first target feature sets of the X first target feature sets to obtain X second target feature sets. Each of the X second target feature sets includes a plurality of pixel difference features in each second target feature set, and the X second target feature sets are classified by using at least one boosting decision tree to obtain a target classifier. In this way, a classifier with better feature screening capability and faster calculation speed can be obtained without degrading performance.
附图说明DRAWINGS
为了更清楚地说明本发明实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the description of the embodiments will be briefly described below. It is obvious that the drawings in the following description are some embodiments of the present invention, Those skilled in the art can also obtain other drawings based on these drawings without paying any creative work.
图1-1是本发明实施例提供的人脸图像的演示示意图;1-1 is a schematic diagram showing a presentation of a face image according to an embodiment of the present invention;
图1-2是本发明实施例提供的图1-1中的人脸图像对应的10个通道特征的演示示意图;1-2 is a schematic diagram showing the 10 channel features corresponding to the face image in FIG. 1-1 according to an embodiment of the present invention;
图1-3是本发明实施例提供的图1-2中的10个通道特征的响应图;1-3 are response diagrams of the ten channel features in FIG. 1-2 according to an embodiment of the present invention;
图2是本发明实施例提供的一种图像处理方法的实施例流程示意图;2 is a schematic flowchart of an embodiment of an image processing method according to an embodiment of the present invention;
图3a是本发明实施例提供的一种终端的第一实施例结构示意图;FIG. 3 is a schematic structural diagram of a first embodiment of a terminal according to an embodiment of the present disclosure;
图3b是本发明实施例提供的图3a所描述的终端的第一提取单元的结构示意图;FIG. 3b is a schematic structural diagram of a first extracting unit of the terminal depicted in FIG. 3a according to an embodiment of the present disclosure;
图3c是本发明实施例提供的图3a所描述的终端的第二提取单元的结构示意图;FIG. 3c is a schematic structural diagram of a second extraction unit of the terminal depicted in FIG. 3a according to an embodiment of the present disclosure;
图3d是本发明实施例提供的图3a所描述的终端的分类单元的结构示意图;FIG. 3 is a schematic structural diagram of a classification unit of the terminal depicted in FIG. 3a according to an embodiment of the present disclosure;
图3e是本发明实施例提供的图3a所描述的终端的又一结构示意图;FIG. 3 e is another schematic structural diagram of the terminal depicted in FIG. 3 a according to an embodiment of the present invention; FIG.
图4是本发明实施例提供的一种终端的第二实施例结构示意图。FIG. 4 is a schematic structural diagram of a second embodiment of a terminal according to an embodiment of the present invention.
具体实施方式detailed description
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The technical solutions in the embodiments of the present invention are clearly and completely described in the following with reference to the accompanying drawings in the embodiments of the present invention. It is obvious that the described embodiments are a part of the embodiments of the present invention, but not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative efforts are within the scope of the present invention.
本发明的说明书和权利要求书及所述附图中的术语“第一”、“第二”、“第三”和“第四”等是用于区别不同对象,而不是用于描述特定顺序。此外,术语“包括”和“具有”以及它们任何变形,意图在于覆盖不排他的包含。例如包含了一系列步骤或单元的过程、方法、***、产品或设备没有限定于已列出的步骤或单元,而是可选地还包括没有列出的步骤或单元,或可选地还包括对于这些过程、方法、产品或设备固有的其它步骤或单元。 The terms "first", "second", "third", and "fourth" and the like in the specification and claims of the present invention are used to distinguish different objects, and are not intended to describe a specific order. . Furthermore, the terms "comprises" and "comprising" and "comprising" are intended to cover a non-exclusive inclusion. For example, a process, method, system, product, or device that comprises a series of steps or units is not limited to the listed steps or units, but optionally also includes steps or units not listed, or alternatively Other steps or units inherent to these processes, methods, products or equipment.
在本文中提及“实施例”意味着,结合实施例描述的特定特征、结构或特性可以包含在本发明的至少一个实施例中。在说明书中的各个位置展示该短语并不一定均是指相同的实施例,也不是与其它实施例互斥的独立的或备选的实施例。本领域技术人员显式地和隐式地理解的是,本文所描述的实施例可以与其它实施例相结合。References to "an embodiment" herein mean that a particular feature, structure, or characteristic described in connection with the embodiments can be included in at least one embodiment of the invention. The appearances of the phrases in various places in the specification are not necessarily referring to the same embodiments, and are not exclusive or alternative embodiments that are mutually exclusive. Those skilled in the art will understand and implicitly understand that the embodiments described herein can be combined with other embodiments.
本发明实施例所描述终端可以包括智能手机(如Android手机、iOS手机、Windows Phone手机等)、平板电脑、掌上电脑、笔记本电脑、移动互联网设备(MID,Mobile Internet Devices)或穿戴式设备等,上述仅是举例,而非穷举,包含但不限于上述终端。The terminal described in the embodiments of the present invention may include a smart phone (such as an Android mobile phone, an iOS mobile phone, a Windows Phone mobile phone, etc.), a tablet computer, a palmtop computer, a notebook computer, a mobile Internet device (MID, Mobile Internet Devices), or a wearable device. The above is merely an example, and not an exhaustive, including but not limited to the above terminals.
下面列举几种常见的人脸检测算法。Here are a few common face detection algorithms.
Boosting分类器,boosting可以认为是一种特征筛选算法,由于其简单和泛化能力强等特点,在很多领域都有着非常广的应用。具体来讲,boosting将原始交织在一起的特征空间,通过特征挑选和加强错分样本的权重来逐步将样本空间分开。Boosting classifier, boosting can be considered as a feature screening algorithm. Due to its simplicity and generalization ability, it has a very wide application in many fields. Specifically, boosting separates the sample space by character-selecting and enhancing the weight of the misclassified samples.
HAAR人脸检测器,HAAR人脸检测器是最早将人脸检测提升至应用级别的算法之一。算法主要分为三个部分,特征生成、boosting挑选弱分类器特征以及强分类器构建。特征生成主要是构建许多黑白相间的矩形块,通过比较黑白矩形的像素和的差值来生成特征,取名也是由于其计算过程和HAAR小波的计算过程类似,矩形块的像素和可以基于积分图来计算,计算速度和开销相当可观;特征挑选是通过boosting算法进行的;最后将挑选出来的弱分类器特征通过特征组合来生成许多强分类器。HAAR Face Detector, HAAR Face Detector is one of the first algorithms to raise face detection to the application level. The algorithm is mainly divided into three parts, feature generation, boosting to select weak classifier features and strong classifier construction. Feature generation is mainly to construct a number of black and white rectangular blocks. The features are generated by comparing the difference between the pixels of the black and white rectangles. The name is also similar because the calculation process is similar to the calculation process of the HAAR wavelet. The pixels of the rectangular block can be based on the integral map. To calculate, the calculation speed and overhead are considerable; feature selection is performed by the boosting algorithm; finally, the selected weak classifier features are combined to generate many strong classifiers.
DPM(Deformable Part Model)人脸检测器,DPM将刚性或非刚性的物体分成许多子部件,通过对各子部件进行描述来最终表达所要识别检测的物体,各部件和子部件通过HOG进行特征描述。通过优化算法来求解每个部分的响应滤波器。由于其计算相对比较复杂,限制了其在许多领域的应用。DPM (Deformable Part Model) face detector, DPM divides a rigid or non-rigid object into a number of sub-components, and finally describes the object to be identified by describing each sub-component, and each component and sub-component are characterized by HOG. The response filter of each part is solved by an optimization algorithm. Due to its relatively complex calculations, its application in many fields is limited.
ACF(Aggregated Channel Feature)人脸检测器,ACF是ICF(Integral Channel Feature)的一种扩展,相当于在ICF的基础上做了一个子采样,这样做的好处是一方面降低特征的维度,两一方面可以增加对形变的抵御能力。ACF最早应用于行人检测领域,之后有人将其应用与人脸检测领域也取得了不错的效果。但是由于其计算开销仍然比较大,特征存在较大冗余,改进空间也很大。 ACF (Aggregated Channel Feature) face detector, ACF is an extension of ICF (Integral Channel Feature), which is equivalent to doing a sub-sampling on the basis of ICF. The advantage of this is that on the one hand, the feature dimension is reduced, On the one hand, it can increase the resistance to deformation. ACF was first used in the field of pedestrian detection, and some people have achieved good results in the field of application and face detection. However, due to its large computational overhead, the features have large redundancy and the improvement space is also large.
PICO(Pixel Intensity Comparison Object Detector)人脸检测器,PICO是一种基于统计特性的特征描述算法,其特征描述与Ferns比较类似,由于其计算的简单性和较强的描述能力,被应用在很多计算机视觉领域如物体检测、目标识别、目标跟踪等领域。最近有人将其应用在人脸检测领域,精度比较一般,但是计算速度非常快。究其原因还是特征表达过于简单,有比较大的提升空间。PICO (Pixel Intensity Comparison Object Detector) face detector, PICO is a feature description algorithm based on statistical characteristics. Its feature description is similar to that of Ferns. Due to its simple calculation and strong description ability, it is applied in many Computer vision areas such as object detection, target recognition, target tracking, etc. Recently, some people have applied it to the field of face detection, and the accuracy is relatively general, but the calculation speed is very fast. The reason is that the feature expression is too simple and there is a relatively large room for improvement.
需要说明的是,现有技术中的人脸检测器中,一些检测器的特征表达比较复杂,如积分通道图中10个通道特征、DPM中的HOG特征,虽然在人脸检测上表现出很好的性能,但是计算过于复杂,很难到达实时应用的要求。图1-1为原始图像,图1-2表示10个积分通道特征,可以看出特征的表达能力比较强,涵盖了色彩空间信息、梯度幅值信息,不同方向的边缘信息,同时也存在较大冗余信息。如图1-3所示,图1-3为图1-2中10个通道特征对应的响应图,可看出颜色越亮表示重要程度越高,图1-3中也包括响应后的积分通道特征,依次分别为LUV特征,梯度幅值特征,6个方向的梯度特征。另外,有一些人脸检测器,虽然使用的特征非常简单,具有代表性的如HAAR、像素差值特征,效果虽然不如1,但是计算量比较小,在工程领域应用的非常广泛。It should be noted that in the face detector of the prior art, the feature expressions of some detectors are relatively complex, such as 10 channel features in the integral channel map and HOG features in the DPM, although the surface detection is very good. Good performance, but the calculation is too complicated to reach the requirements of real-time applications. Figure 1-1 shows the original image. Figure 1-2 shows the characteristics of 10 integral channels. It can be seen that the feature expression is relatively strong, covering color space information, gradient amplitude information, and edge information in different directions. Large redundant information. As shown in Figure 1-3, Figure 1-3 shows the response of the 10 channel features in Figure 1-2. It can be seen that the brighter the color, the higher the degree of importance. Figure 1-3 also includes the integral after the response. The channel features are in turn LUV features, gradient magnitude features, and gradient features in six directions. In addition, there are some face detectors, although the features used are very simple, representative of such as HAAR, pixel difference features, although the effect is not as good as 1, but the amount of calculation is relatively small, widely used in the engineering field.
本发明实施例中,主要就现有人脸检测器中所遇到的“鱼和熊掌不可兼得”问题,即复杂特征计算开销大、简单特征表达能力差,提出一种折中的方式,在保证性能的前提下,提高计算速度。本发明实施例提出了如下的一种图像处理方法,包含如下步骤:In the embodiment of the present invention, the problem that the fish and the bear's paw cannot be obtained in the existing face detector is mainly the problem that the complex feature has large computational cost and the simple feature expression ability is poor, and a compromise method is proposed. Improve the calculation speed while ensuring performance. An embodiment of the present invention provides an image processing method that includes the following steps:
获取正样本集和负样本集;Obtaining a positive sample set and a negative sample set;
对所述正样本集和所述负样本集进行平滑处理,得到目标正样本集和目标负样本集;Smoothing the positive sample set and the negative sample set to obtain a target positive sample set and a target negative sample set;
分别对所述目标正样本集和所述目标负样本集进行积分通道特征提取,得到多个第一目标特征集合,其中,所述多个第一目标特征集合中每一第一目标特征集合包含一个亮度特征分量、2个色差特征分量、梯度幅值分量和与所述梯度幅值分量对应的6个梯度方向分量;Performing integration channel feature extraction on the target positive sample set and the target negative sample set, respectively, to obtain a plurality of first target feature sets, wherein each of the plurality of first target feature sets includes a luminance characteristic component, two color difference characteristic components, a gradient amplitude component, and six gradient direction components corresponding to the gradient amplitude component;
对所述多个第一目标特征集合中每一第一目标特征集合进行像素差值特征提取,得到所述多个第二目标特征集,其中,所述多个第二目标特征集中每一第二目标特征集中包含多个像素差值特征; Performing pixel difference feature extraction on each of the plurality of first target feature sets to obtain the plurality of second target feature sets, wherein each of the plurality of second target feature sets The second target feature set includes a plurality of pixel difference features;
其中,本发明实施例针对现有基于像素差值特征表达能力差,易受光照、噪声等复杂环境的影响;积分通道特征的特征维度高、信息冗余多等问题;提出一个统一的框架,在几乎不影响检测率的条件下,提出一种适应性更强的特征描述方法,一方面提高特征的鲁棒性,另一方面由于特征的维度大幅度下降,可以提升检测速度。对于其对应的10个积分通道特征经过boosting特征挑选后的响应图,颜色由浅及深分别表示特征的重要程度。实践证明,只有在少部分区域有明显的相应,特征冗余程度很高。The embodiment of the present invention is directed to the existing poor performance of the pixel-based difference feature, and is susceptible to complex environments such as illumination and noise; the feature dimension of the integral channel feature is high, and the information redundancy is more; a unified framework is proposed. Under the condition that the detection rate is hardly affected, a more adaptive feature description method is proposed. On the one hand, the robustness of the feature is improved. On the other hand, the detection speed is improved because the dimension of the feature is greatly reduced. For the response maps of the corresponding 10 integral channel features selected by the boosting feature, the color indicates the importance of the features from shallow and deep. Practice has proved that only a small number of areas have obvious corresponding, and the degree of feature redundancy is very high.
请参阅图2,为本发明实施例提供的一种图像处理方法的实施例流程示意图。本实施例中所描述的图像处理方法,包括以下步骤:FIG. 2 is a schematic flowchart of an embodiment of an image processing method according to an embodiment of the present invention. The image processing method described in this embodiment includes the following steps:
201、获取正样本集和负样本集。201. Obtain a positive sample set and a negative sample set.
其中,本发明实施例中可准备好正样本集和负样本集,其中,正样本集包含多个正样本,负样本集中包含多个负样本,正样本可为裁切好的包含人脸的区域的图像,例如,可将每一样本的大小归一化至24x24,负样本可为不包含人脸的背景图像,对于正样本集和负样本集的数量没有绝对限制,例如,正样本数量可为50000张包含人脸的区域的图像,负样本集可为100,0000张背景大图。The positive sample set and the negative sample set may be prepared in the embodiment of the present invention, wherein the positive sample set includes multiple positive samples, the negative sample set includes multiple negative samples, and the positive sample may be a cut containing human face. The image of the region, for example, the size of each sample can be normalized to 24x24, and the negative sample can be a background image that does not contain a human face. There is no absolute limit on the number of positive and negative sample sets, for example, the number of positive samples. It can be an image of 50,000 areas containing faces, and a negative sample set can be 100,0000 backgrounds.
202、对所述正样本集和所述负样本集进行平滑处理,得到目标正样本集和目标负样本集。202. Perform smoothing on the positive sample set and the negative sample set to obtain a target positive sample set and a target negative sample set.
其中,可对正样本集和所述负样本集进行噪声去除,由于准备的样本种类比较多,噪声也是多种多样,本发明实施例可使用高斯滤波器对正负样本进行平滑处理,以去除掉疑似噪声的高频分量,事实上实验也证明,在检测之前对样本集(包含正样本集合负样本)进行低通滤波可以增加检测率和降低误检率。The noise collection may be performed on the positive sample set and the negative sample set. The noise is also varied due to the number of sample types prepared. The embodiment of the present invention may use a Gaussian filter to smooth the positive and negative samples to remove The high-frequency components suspected of noise are eliminated. In fact, experiments have also shown that low-pass filtering of the sample set (including negative samples of the positive sample set) before detection can increase the detection rate and reduce the false detection rate.
203、分别对所述目标正样本集和所述目标负样本集进行积分通道特征提取,得到X个第一目标特征集合,其中,所述X个第一目标特征集合中每一第一目标特征集合包含一个亮度特征分量、2个色差特征分量、梯度幅值分量和与所述梯度幅值分量对应的6个梯度方向分量,所述X为大于1的整数。203. Perform feature extraction of the target channel on the target positive sample set and the target negative sample set, respectively, to obtain X first target feature sets, where each of the X first target feature sets has a first target feature. The set includes a luma feature component, two chroma component components, a gradient magnitude component, and six gradient direction components corresponding to the gradient magnitude component, the X being an integer greater than one.
可选的,步骤203中,分别对所述目标正样本集和所述目标负样本集进行积分通道特征提取,可包括如下步骤:Optionally, in step 203, the feature channel extraction is performed on the target positive sample set and the target negative sample set respectively, which may include the following steps:
31)、将目标样本i转化到LUV空间,得到亮度特征分量、2个色差特征分量,其中,所述目标样本i为所述目标正样本集或者所述目标负样本集中的任一 个;31) Converting the target sample i into the LUV space to obtain a luminance feature component and two color difference feature components, wherein the target sample i is the target positive sample set or the target negative sample set One
32)、确定所述目标样本i中的每一通道进行梯度计算,得到梯度幅值分量和梯度方向分量;32) determining, by each of the target samples i, performing a gradient calculation to obtain a gradient amplitude component and a gradient direction component;
33)、将所述梯度方向分量划分为6份,得到6个梯度方向;33) dividing the gradient direction component into 6 parts to obtain 6 gradient directions;
34)、将所述梯度幅值分量软投影到所述6个梯度方向,得到所述梯度幅值分量对应的6个梯度方向分量,其中,所述亮度特征分量、所述2个色差特征分量、所述梯度幅值分量和所述6个梯度方向分量合成所述第一目标特征集合。34) soft projection of the gradient amplitude component to the six gradient directions to obtain six gradient direction components corresponding to the gradient amplitude component, wherein the luminance feature component and the two color difference feature components And the gradient magnitude component and the six gradient direction components are combined to form the first target feature set.
其中,上述步骤31-步骤34可称之为积分通道特征提取,以目标样本i为例,目标样本i为目标正样本集或者目标负样本集中的任一个,即将样本i(图像)转换至LUV空间,提取一个亮度分量和两个色差分量;然后,针对输入图像中RGB分量的每一个通道进行梯度计算,包含梯度幅值和梯度方向;将梯度方向划分为6份,把每一个像素的梯度幅值按照这6个方向进行软投影,即每一个像素的梯度按照其贡献分配至临近的两个Bin,当然,可对RGB分量依次进行上述操作,还可对结果进行MAX操作,如此,这样做的好处是增加特征的鲁棒性,减少噪声对梯度特征的影响;对梯度幅值进行归一化操作。Wherein, the above steps 31-34 may be referred to as integral channel feature extraction. Taking the target sample i as an example, the target sample i is either the target positive sample set or the target negative sample set, that is, the sample i (image) is converted to the LUV. Space, extract a luminance component and two color difference components; then, perform gradient calculation for each channel of the RGB component in the input image, including gradient magnitude and gradient direction; divide the gradient direction into 6 parts, and gradient each pixel The amplitude is soft-projected according to the six directions, that is, the gradient of each pixel is allocated to two adjacent Bins according to its contribution. Of course, the above operations can be performed on the RGB components, and the result can be MAX-operated, thus, The advantage is to increase the robustness of the feature, reduce the impact of noise on the gradient features, and normalize the gradient magnitude.
204、对所述X个第一目标特征集合中每一第一目标特征集合进行像素差值特征提取,得到所述X个第二目标特征集,其中,所述X个第二目标特征集中每一第二目标特征集中包含多个像素差值特征。204. Perform pixel difference feature extraction on each of the first target feature sets in the X first target feature sets to obtain the X second target feature sets, where the X second target feature sets are each A second target feature set includes a plurality of pixel difference features.
可选地,上述步骤204中,对所述多个第一目标特征集合中每一第一目标特征集合进行像素差值特征提取,包括如下步骤:Optionally, in the foregoing step 204, performing pixel difference feature extraction on each of the plurality of first target feature sets, including the following steps:
41)、从所述第一目标特征集合j对应中随机选取K个位置,所述第一目标特征集合j为所述多个第一目标特征集合中的任一个,所述K为偶数;41) randomly selecting K locations from the first target feature set j correspondence, the first target feature set j being any one of the plurality of first target feature sets, where K is an even number;
42)、将所述K个位置对应的像素值组成K/2个像素对;42), grouping the pixel values corresponding to the K positions into K/2 pixel pairs;
43)、计算所述K/2个像素对中每一像素对的差值,得到所述K/2个像素差值特征,即第二目标特征集。43) Calculating a difference value of each of the K/2 pixel pairs to obtain the K/2 pixel difference feature, that is, a second target feature set.
上述步骤41-步骤43,可称之为基于通道特征的像素差值特征计算,如下仅介绍一个通道的像素差值特征是如何计算的。在任一通道可看作24x24大小的图像,在该图像上随机产生400个随机位置,两两组成一个像素对(不同位置上的2个像素可组成一个像素对),共产生200个像素对,计算该200个像素对 的差值,产生200个像素差值特征。对上述步骤103中的10个通道特征使用相同的方法计算像素差值特征,可共计产生2000=200x10个通道像素差值特征。The above steps 41-43 can be referred to as channel feature-based pixel difference feature calculation, and only how the pixel difference feature of one channel is calculated is as follows. In any channel, it can be regarded as a 24x24 image, and 400 random positions are randomly generated on the image, and two pairs of pixels form one pixel pair (two pixels in different positions can form one pixel pair), and a total of 200 pixel pairs are generated. Calculate the 200 pixel pairs The difference produces a 200 pixel difference feature. Using the same method to calculate the pixel difference features for the 10 channel features in the above step 103, a total of 2000=200×10 channel pixel difference features can be generated.
205、采用至少一个boosting决策树对所述X个第二目标特征集进行分类,得到目标分类器。205. Classify the X second target feature sets by using at least one boosting decision tree to obtain a target classifier.
其中,上述至少一个boosting决策树可在步骤201之前得到。The at least one boosting decision tree may be obtained before step 201.
可选地,上述步骤205中,采用至少一个boosting决策树对所述多个第二目标特征集进行分类,得到目标弱分类器,可包括如下步骤:Optionally, in the foregoing step 205, the plurality of second target feature sets are classified by using at least one boosting decision tree, and the target weak classifier is obtained, which may include the following steps:
51)、采用至少一个boosting决策树对所述X个第二目标特征集进行分类,得到Y个第一级分类器,所述Y为大于1的整数;51) categorizing the X second target feature sets by using at least one boosting decision tree to obtain Y first-level classifiers, where Y is an integer greater than 1.
52)、使用hard mining算法对所述负样本集进行挖掘,得到Z个负样本;52) mining the negative sample set using a hard mining algorithm to obtain Z negative samples;
53)、采用所述Y个级分类器对所述Z个负样本进行分类,得到A个第二级分类器,所述A为正整数;53) categorizing the Z negative samples by using the Y classifiers to obtain A second classifiers, where A is a positive integer;
54)、判断所述A个第二级分类器中是否存在符合预设条件的第二级分类器,54) determining whether there is a second-level classifier in the A second-level classifier that meets a preset condition,
55)、在所述A个第二级分类器中存在符合所述预设条件的第二级分类器时,从所述符合所述预设条件的第二级分类器中一个第二级分类器作为所述目标分类器。55), when there is a second-level classifier that meets the preset condition in the A second-stage classifiers, a second-level classification from the second-level classifier that meets the preset condition As the target classifier.
其中,上述使用hard mining算法在大量负样本集上挑选一些有代表性的负样本,每一轮boosting决策树都是针对更难的负样本进行分类,这样可以保证分类器学到的特征是由易到难的,涵盖的样本分布也具有多样性。Among them, the above uses the hard mining algorithm to select some representative negative samples on a large number of negative sample sets, and each round of the voting decision tree is classified for the more difficult negative samples, so that the characteristics learned by the classifier are guaranteed by Easy to reach, the sample distribution covered is also diverse.
可选地,在步骤201,获取正样本集和负样本集之前,还可包括包含如下步骤:Optionally, before the obtaining the positive sample set and the negative sample set in step 201, the method further includes the following steps:
按照如下公式初始化所述正样本集和所述负样本集中每一样本的权重,其中,s为任一样本,如下:The weights of each of the positive sample set and the negative sample set are initialized according to the following formula, wherein s is any sample, as follows:
Figure PCTCN2017087705-appb-000003
Figure PCTCN2017087705-appb-000003
其中P为正样本集中的样本个数,N为负样本集中的样本个数,Cs为样本类别,s为任一样本,ws为样本的权重,Cs∈{+1,-1},+1为正样本,-1为负样本;Where P is the number of samples in the positive sample set, N is the number of samples in the negative sample set, C s is the sample class, s is any sample, w s is the weight of the sample, C s ∈{+1,-1} , +1 is a positive sample, and -1 is a negative sample;
根据所述正样本集和所述负样本集以及每一样本的权重进行加权最小二乘 拟合,得到所述至少一个boosting决策树。Weighted least squares according to the positive sample set and the negative sample set and the weight of each sample Fitting to obtain the at least one boosting decision tree.
其中,上述使用boosting决策树对正负样本进行分类,boosting决策树的目的是挑选多个弱分类器,每一个弱分类器都是在前一个弱分类器分错的样本空间上进行重分类,这样的思想有点类类似于“三个臭皮匠顶一个诸葛亮”,如此,速度很快,在前期可以排除掉一些明显的负样本。详细boosting决策树算法,如下:Wherein, the above-mentioned boosting decision tree is used to classify positive and negative samples. The purpose of the boosting decision tree is to select multiple weak classifiers, and each weak classifier is reclassified on the sample space of the previous weak classifier. This kind of thinking is similar to the "three smugglers top one Zhuge Liang", so, the speed is very fast, in the early stage can be excluded some obvious negative samples. The detailed boosting decision tree algorithm is as follows:
1、提取正样本集和负样本集的像素差值特征1. Extract pixel difference features of positive sample set and negative sample set
2、对于每一个样本fs初始化其权重为ws,类别为Cs∈{+1,-1},则:2. Initialize each sample f s with a weight of w s and a class of C s ∈{+1,-1}, then:
Figure PCTCN2017087705-appb-000004
Figure PCTCN2017087705-appb-000004
其中P,N分别为正负样本的个数。Where P and N are the number of positive and negative samples, respectively.
3、当k=1,2,...,K;3. When k=1, 2,..., K;
(1)、对正样本集和负样本集中每一样本的权重,进行加权最小二乘拟合,构建决策树Tk (1) Perform a weighted least squares fit on the weights of each sample in the positive sample set and the negative sample set to construct a decision tree T k
(2)、更新每一个样本的权重ws=wsexp(-CsTk(fs)),其中,Tk(fs)表示特征fs经过决策树Tk的输出。(2) Updating the weight of each sample w s =w s exp(-C s T k (f s )), where T k (f s ) represents the output of the feature f s through the decision tree T k .
(3)、对权重重新进行归一(3), re-normalize the weight
(4)、输出所有{Tk=1,2,3,4......}(4), output all {T k =1, 2, 3, 4...}
如此,上述得到的目标分类器可以在一定程度上增加特征对光照的抵御能力,可以使用较少的特征对目标进行表达,特征冗余信息少,进一步提高了特征计算速度。In this way, the target classifier obtained above can increase the resistance of the feature to illumination to a certain extent, and can express the target with fewer features, and the feature redundant information is less, further improving the feature calculation speed.
可以看出,通过本发明实施例,获取正样本集和负样本集,对正样本集和负样本集进行平滑处理,得到目标正样本集和目标负样本集,分别对目标正样本集和目标负样本集进行积分通道特征提取,得到X个第一目标特征集合,其中,X个第一目标特征集合中每一第一目标特征集合包含一个亮度特征分量、2个色差特征分量、梯度幅值分量和与该梯度幅值分量对应的6个梯度方向分量,X为大于1的整数,对X个第一目标特征集合中每一第一目标特征集合进行像素差值特征提取,得到X个第二目标特征集,其中,X个第二目标特征集中每一第二目标特征集中包含多个像素差值特征,采用至少一个boosting决策树对X 个第二目标特征集进行分类,得到目标分类器。如此,可在性能不下降的前提下,得到具有较好特征筛选能力和较快计算速度的分类器。It can be seen that, by using an embodiment of the present invention, a positive sample set and a negative sample set are obtained, and the positive sample set and the negative sample set are smoothed to obtain a target positive sample set and a target negative sample set, respectively, and the target positive sample set and the target are respectively obtained. The negative sample set is subjected to integral channel feature extraction to obtain X first target feature sets, wherein each of the first target feature sets of the X first target feature sets includes one luminance feature component, two color difference feature components, and a gradient magnitude. a component and six gradient direction components corresponding to the gradient magnitude component, X is an integer greater than 1, and pixel feature extraction is performed on each of the first target feature sets of the X first target feature sets to obtain X numbers a second target feature set, wherein each of the second target feature sets includes a plurality of pixel difference features, and at least one boosting decision tree pair X The second target feature set is classified to obtain a target classifier. In this way, a classifier with better feature screening capability and faster calculation speed can be obtained without degrading performance.
与上述一致地,以下为实施上述图像处理方法的装置,具体如下:Consistent to the above, the following is an apparatus for implementing the above image processing method, as follows:
请参阅图3a,为本发明实施例提供的一种终端的第一实施例结构示意图。本实施例中所描述的终端,包括:获取单元301、处理单元302、第一提取单元303、第二提取单元304和分类单元305,具体如下:FIG. 3 is a schematic structural diagram of a first embodiment of a terminal according to an embodiment of the present invention. The terminal described in this embodiment includes: an obtaining unit 301, a processing unit 302, a first extracting unit 303, a second extracting unit 304, and a classifying unit 305, as follows:
获取单元301,用于获取正样本集和负样本集;An obtaining unit 301, configured to acquire a positive sample set and a negative sample set;
处理单元302,用于对所述正样本集和所述负样本集进行平滑处理,得到目标正样本集和目标负样本集;The processing unit 302 is configured to perform smoothing processing on the positive sample set and the negative sample set to obtain a target positive sample set and a target negative sample set;
第一提取单元303,用于分别对所述目标正样本集和所述目标负样本集进行积分通道特征提取,得到X个第一目标特征集合,其中,所述X个第一目标特征集合中每一第一目标特征集合包含一个亮度特征分量、2个色差特征分量、梯度幅值分量和与所述梯度幅值分量对应的6个梯度方向分量,所述X为大于1的整数;a first extracting unit 303, configured to perform an integrated channel feature extraction on the target positive sample set and the target negative sample set, respectively, to obtain X first target feature sets, wherein the X first target feature sets are Each first target feature set includes a luminance feature component, two color difference feature components, a gradient magnitude component, and six gradient direction components corresponding to the gradient magnitude component, the X being an integer greater than one;
第二提取单元304,用于对所述X个第一目标特征集合中每一第一目标特征集合进行像素差值特征提取,得到所述X个第二目标特征集,其中,所述X个第二目标特征集中每一第二目标特征集中包含多个像素差值特征;a second extracting unit 304, configured to perform pixel difference feature extraction on each of the first target feature sets of the X first target feature sets, to obtain the X second target feature sets, where the X Each of the second target feature sets includes a plurality of pixel difference features in the second target feature set;
分类单元305,用于采用至少一个boosting决策树对所述X个第二目标特征集进行分类,得到目标分类器。The classification unit 305 is configured to classify the X second target feature sets by using at least one boosting decision tree to obtain a target classifier.
可选地,如图3b,图3b为图3a所描述的终端的第一提取单元303的具体细化结构,所述第一提取单元303可包括:转化模块3031、第一确定模块3032、划分模块3033和第二确定模块3034,具体如下;Optionally, as shown in FIG. 3b, FIG. 3b is a specific refinement structure of the first extraction unit 303 of the terminal described in FIG. 3a, where the first extraction unit 303 may include: a conversion module 3031, a first determination module 3032, and a division. The module 3033 and the second determining module 3034 are specifically as follows;
转化模块3031,用于将目标样本i转化到LUV空间,得到亮度特征分量、2个色差特征分量,其中,所述目标样本i为所述目标正样本集或者所述目标负样本集中的任一个;The conversion module 3031 is configured to convert the target sample i into the LUV space to obtain a luminance feature component and two color difference feature components, wherein the target sample i is any one of the target positive sample set or the target negative sample set ;
第一确定模块3032,用于确定所述目标样本i中的每一通道进行梯度计算,得到梯度幅值分量和梯度方向分量;a first determining module 3032, configured to determine a gradient calculation for each channel in the target sample i, to obtain a gradient amplitude component and a gradient direction component;
划分模块3033,用于将所述梯度方向分量划分为6份,得到6个梯度方向;a dividing module 3033, configured to divide the gradient direction component into 6 parts, to obtain 6 gradient directions;
第二确定模块3034,用于将所述梯度幅值分量软投影到所述6个梯度方向, 得到所述梯度幅值分量对应的6个梯度方向分量,其中,所述亮度特征分量、所述2个色差特征分量、所述梯度幅值分量和所述6个梯度方向分量合成所述第一目标特征集合。a second determining module 3034, configured to softcast the gradient magnitude component to the six gradient directions, Obtaining six gradient direction components corresponding to the gradient amplitude component, wherein the luminance feature component, the two color difference feature components, the gradient magnitude component, and the six gradient direction components are combined into the first Target feature set.
可选地,如图3c,图3c为图3a所描述的终端的第二提取单元304的具体细化结构,所述第二提取单元304可包括:选取模块3041、组合模块3042和计算模块3043,具体如下:Optionally, as shown in FIG. 3c, FIG. 3c is a specific refinement structure of the second extraction unit 304 of the terminal described in FIG. 3a, and the second extraction unit 304 may include: a selection module 3041, a combination module 3042, and a calculation module 3043. ,details as follows:
选取模块3041,用于从所述第一目标特征集合j对应中随机选取K个位置,所述第一目标特征集合j为所述X个第一目标特征集合中的任一个,所述K为偶数;The selecting module 3041 is configured to randomly select K locations from the first target feature set j correspondence, where the first target feature set j is any one of the X first target feature sets, where the K is even;
组合模块3042,用于将所述K个位置对应的像素值组成K/2个像素对;The combining module 3042 is configured to group the pixel values corresponding to the K locations into K/2 pixel pairs;
计算模块3043,用于计算所述K/2个像素对中每一像素对的差值,得到所述K/2个像素差值特征,即第二目标特征集。The calculating module 3043 is configured to calculate a difference value of each of the K/2 pixel pairs to obtain the K/2 pixel difference feature, that is, a second target feature set.
可选地,如图3d,图3d为图3a所描述的终端的分类单元305的具体细化结构,所述分类单元305可包括:第一分类模块3051、挖掘模块3052、第二分类模块3053、判断模块3054和第三确定模块3055,具体如下:Optionally, as shown in FIG. 3d, FIG. 3d is a specific refinement structure of the classification unit 305 of the terminal described in FIG. 3a, and the classification unit 305 may include: a first classification module 3051, a mining module 3052, and a second classification module 3053. The determining module 3054 and the third determining module 3055 are as follows:
第一分类模块3051,用于采用至少一个boosting决策树对所述X个第二目标特征集进行分类,得到Y个第一级分类器,所述Y为大于1的整数;a first classification module 3051, configured to classify the X second target feature sets by using at least one boosting decision tree, to obtain Y first-level classifiers, where Y is an integer greater than one;
挖掘模块3052,用于使用hard mining算法对所述负样本集进行挖掘,得到Z个负样本;The mining module 3052 is configured to mine the negative sample set by using a hard mining algorithm to obtain Z negative samples.
第二分类模块3053,用于采用所述Y个级分类器对所述Z个负样本进行分类,得到A个第二级分类器,所述A为正整数;a second classification module 3053, configured to classify the Z negative samples by using the Y classifiers to obtain A second classifiers, where A is a positive integer;
判断模块3054,用于判断所述A个第二级分类器中是否存在符合预设条件的第二级分类器;The determining module 3054 is configured to determine whether there is a second-level classifier that meets the preset condition in the A second-level classifiers;
第三确定模块3055,用于在所述A个第二级分类器中存在符合所述预设条件的第二级分类器时,从所述符合所述预设条件的第二级分类器中一个第二级分类器作为所述目标分类器。a third determining module 3055, configured to: when the second level classifier that meets the preset condition exists in the A second level classifiers, from the second level classifier that meets the preset condition A second level classifier acts as the target classifier.
可选地,如图3e,图3e为图3a所描述的终端又一变型结构,与图3a所描述的终端相比较,其还包括:处理单元306和拟合单元307,具体如下:Optionally, as shown in FIG. 3e, FIG. 3e is a further modified structure of the terminal described in FIG. 3a. Compared with the terminal described in FIG. 3a, the method further includes: a processing unit 306 and a fitting unit 307, as follows:
处理单元306,用于在所述获取单元301获取正样本集和负样本集之前,按照如下公式初始化所述正样本集和所述负样本集中每一样本的权重,其中,s为 任一样本,如下:The processing unit 306 is configured to initialize a weight of each sample in the positive sample set and the negative sample set according to the following formula before the obtaining unit 301 acquires the positive sample set and the negative sample set, where s is Any sample, as follows:
Figure PCTCN2017087705-appb-000005
Figure PCTCN2017087705-appb-000005
其中P为正样本集中的样本个数,N为负样本集中的样本个数,Cs为样本类别,s为任一样本,ws为样本的权重,Cs∈{+1,-1},+1为正样本,-1为负样本;Where P is the number of samples in the positive sample set, N is the number of samples in the negative sample set, C s is the sample class, s is any sample, w s is the weight of the sample, C s ∈{+1,-1} , +1 is a positive sample, and -1 is a negative sample;
拟合单元307,用于根据所述正样本集和所述负样本集以及每一样本的权重进行加权最小二乘拟合,得到所述至少一个boosting决策树。The fitting unit 307 is configured to perform weighted least squares fitting according to the positive sample set and the negative sample set and the weight of each sample to obtain the at least one boosting decision tree.
可以看出,通过本发明实施例所描述的终端,可获取正样本集和负样本集,对正样本集和负样本集进行平滑处理,得到目标正样本集和目标负样本集,分别对目标正样本集和目标负样本集进行积分通道特征提取,得到X个第一目标特征集合,其中,X个第一目标特征集合中每一第一目标特征集合包含一个亮度特征分量、2个色差特征分量、梯度幅值分量和与该梯度幅值分量对应的6个梯度方向分量,X为大于1的整数,对X个第一目标特征集合中每一第一目标特征集合进行像素差值特征提取,得到X个第二目标特征集,其中,X个第二目标特征集中每一第二目标特征集中包含多个像素差值特征,采用至少一个boosting决策树对X个第二目标特征集进行分类,得到目标分类器。如此,可在性能不下降的前提下,得到具有较好特征筛选能力和较快计算速度的分类器。It can be seen that, by using the terminal described in the embodiment of the present invention, a positive sample set and a negative sample set can be obtained, and the positive sample set and the negative sample set are smoothed to obtain a target positive sample set and a target negative sample set, respectively. The positive sample set and the target negative sample set are subjected to integral channel feature extraction to obtain X first target feature sets, wherein each of the first target feature sets of the X first target feature sets includes one luminance feature component and two color difference features. a component, a gradient magnitude component, and six gradient direction components corresponding to the gradient magnitude component, X is an integer greater than 1, and performing pixel difference feature extraction on each of the first target feature sets of the X first target feature sets Obtaining X second target feature sets, wherein each of the second target feature sets includes a plurality of pixel difference features, and the at least one boosting decision tree is used to classify the X second target feature sets , get the target classifier. In this way, a classifier with better feature screening capability and faster calculation speed can be obtained without degrading performance.
与上述一致地,请参阅图4,为本发明实施例提供的一种终端的第二实施例结构示意图。本实施例中所描述的终端,包括:至少一个输入设备1000;至少一个输出设备2000;至少一个处理器3000,例如CPU;和存储器4000,上述输入设备1000、输出设备2000、处理器3000和存储器4000通过总线5000连接。With reference to FIG. 4, it is a schematic structural diagram of a second embodiment of a terminal according to an embodiment of the present invention. The terminal described in this embodiment includes: at least one input device 1000; at least one output device 2000; at least one processor 3000, such as a CPU; and a memory 4000, the input device 1000, the output device 2000, the processor 3000, and the memory 4000 is connected via bus 5000.
其中,上述输入设备1000具体可为触控面板、物理按键或者鼠标。The input device 1000 may be a touch panel, a physical button, or a mouse.
上述输出设备2000具体可为显示屏。The output device 2000 described above may specifically be a display screen.
上述存储器4000可以是高速RAM存储器,也可为非易失存储器(non-volatile memory),例如磁盘存储器。上述存储器4000用于存储一组程序代码,上述输入设备1000、输出设备2000和处理器3000用于调用存储器4000中存储的程序代码,执行如下操作: The above memory 4000 may be a high speed RAM memory or a non-volatile memory such as a magnetic disk memory. The above memory 4000 is used to store a set of program codes, and the input device 1000, the output device 2000, and the processor 3000 are used to call the program code stored in the memory 4000, and perform the following operations:
上述处理器3000,用于:The processor 3000 is configured to:
获取正样本集和负样本集;Obtaining a positive sample set and a negative sample set;
对所述正样本集和所述负样本集进行平滑处理,得到目标正样本集和目标负样本集;Smoothing the positive sample set and the negative sample set to obtain a target positive sample set and a target negative sample set;
分别对所述目标正样本集和所述目标负样本集进行积分通道特征提取,得到X个第一目标特征集合,其中,所述X个第一目标特征集合中每一第一目标特征集合包含一个亮度特征分量、2个色差特征分量、梯度幅值分量和与所述梯度幅值分量对应的6个梯度方向分量,所述X为大于1的整数;Performing integration channel feature extraction on the target positive sample set and the target negative sample set respectively to obtain X first target feature sets, wherein each of the X first target feature sets includes a luminance characteristic component, two color difference characteristic components, a gradient amplitude component, and six gradient direction components corresponding to the gradient amplitude component, wherein X is an integer greater than one;
对所述X个第一目标特征集合中每一第一目标特征集合进行像素差值特征提取,得到所述X个第二目标特征集,其中,所述X个第二目标特征集中每一第二目标特征集中包含多个像素差值特征;Pixel difference feature extraction is performed on each of the first target feature sets in the X first target feature sets to obtain the X second target feature sets, wherein each of the X second target feature sets The second target feature set includes a plurality of pixel difference features;
采用至少一个boosting决策树对所述X个第二目标特征集进行分类,得到目标分类器。The X second target feature sets are classified by using at least one boosting decision tree to obtain a target classifier.
可选地,上述处理器3000分别对所述目标正样本集和所述目标负样本集进行积分通道特征提取,包括:Optionally, the processor 3000 performs an integral channel feature extraction on the target positive sample set and the target negative sample set, respectively, including:
将目标样本i转化到LUV空间,得到亮度特征分量、2个色差特征分量,其中,所述目标样本i为所述目标正样本集或者所述目标负样本集中的任一个;Converting the target sample i into the LUV space to obtain a luminance feature component and two color difference feature components, wherein the target sample i is any one of the target positive sample set or the target negative sample set;
确定所述目标样本i中的每一通道进行梯度计算,得到梯度幅值分量和梯度方向分量;Determining each channel in the target sample i to perform a gradient calculation to obtain a gradient amplitude component and a gradient direction component;
将所述梯度方向分量划分为6份,得到6个梯度方向;Dividing the gradient direction component into 6 parts to obtain 6 gradient directions;
将所述梯度幅值分量软投影到所述6个梯度方向,得到所述梯度幅值分量对应的6个梯度方向分量,其中,所述亮度特征分量、所述2个色差特征分量、所述梯度幅值分量和所述6个梯度方向分量合成所述第一目标特征集合。Softly projecting the gradient magnitude component into the six gradient directions to obtain six gradient direction components corresponding to the gradient amplitude component, wherein the luminance feature component, the two color difference feature components, the The gradient magnitude component and the six gradient direction components are combined to form the first target feature set.
可选地,上述处理器3000对所述X个第一目标特征集合中每一第一目标特征集合进行像素差值特征提取,包括:Optionally, the processor 3000 performs pixel difference feature extraction on each of the first target feature sets of the X first target feature sets, including:
从所述第一目标特征集合j对应中随机选取K个位置,所述第一目标特征集合j为所述X个第一目标特征集合中的任一个,所述K为偶数;K positions are randomly selected from the first target feature set j correspondence, the first target feature set j is any one of the X first target feature sets, and the K is an even number;
将所述K个位置对应的像素值组成K/2个像素对;Pixel values corresponding to the K positions are formed into K/2 pixel pairs;
计算所述K/2个像素对中每一像素对的差值,得到所述K/2个像素差值特征,即第二目标特征集。 Calculating a difference value of each of the K/2 pixel pairs to obtain the K/2 pixel difference feature, that is, a second target feature set.
可选地,上述处理器3000采用至少一个boosting决策树对所述多个第二目标特征集进行分类,得到目标弱分类器,包括:Optionally, the processor 3000 uses the at least one boosting decision tree to classify the plurality of second target feature sets to obtain a target weak classifier, including:
采用至少一个boosting决策树对所述X个第二目标特征集进行分类,得到Y个第一级分类器,所述Y为大于1的整数;And classifying the X second target feature sets by using at least one boosting decision tree to obtain Y first-level classifiers, where Y is an integer greater than 1;
使用hard mining算法对所述负样本集进行挖掘,得到Z个负样本;Mining the negative sample set using a hard mining algorithm to obtain Z negative samples;
采用所述Y个级分类器对所述Z个负样本进行分类,得到A个第二级分类器,所述A为正整数;And classifying the Z negative samples by using the Y classifiers to obtain A second classifiers, where A is a positive integer;
判断所述A个第二级分类器中是否存在符合预设条件的第二级分类器,Determining whether there is a second-level classifier in the A second-level classifier that meets a preset condition,
在所述A个第二级分类器中存在符合所述预设条件的第二级分类器时,从所述符合所述预设条件的第二级分类器中一个第二级分类器作为所述目标分类器。When there is a second-level classifier that meets the preset condition in the A second-stage classifiers, a second-level classifier from the second-level classifier that meets the preset condition is used as a The target classifier.
可选地,上述处理器3000获取正样本集和负样本集之前,还具体用于:Optionally, before the foregoing processor 3000 obtains the positive sample set and the negative sample set, the processor 3000 is further specifically configured to:
按照如下公式初始化所述正样本集和所述负样本集中每一样本的权重,其中,s为任一样本,如下:The weights of each of the positive sample set and the negative sample set are initialized according to the following formula, wherein s is any sample, as follows:
Figure PCTCN2017087705-appb-000006
Figure PCTCN2017087705-appb-000006
其中P为正样本集中的样本个数,N为负样本集中的样本个数,Cs为样本类别,s为任一样本,ws为样本的权重,Cs∈{+1,-1},+1为正样本,-1为负样本;Where P is the number of samples in the positive sample set, N is the number of samples in the negative sample set, C s is the sample class, s is any sample, w s is the weight of the sample, C s ∈{+1,-1} , +1 is a positive sample, and -1 is a negative sample;
根据所述正样本集和所述负样本集以及每一样本的权重进行加权最小二乘拟合,得到所述至少一个boosting决策树。And performing at least one boosting decision tree according to the weighted least squares fit of the positive sample set and the negative sample set and the weight of each sample.
本发明实施例还提供一种计算机存储介质,其中,该计算机存储介质可存储有程序,该程序执行时包括上述方法实施例中记载的任何一种图像处理方法的部分或全部步骤。The embodiment of the present invention further provides a computer storage medium, wherein the computer storage medium can store a program, and the program includes some or all of the steps of any one of the image processing methods described in the foregoing method embodiments.
尽管在此结合各实施例对本发明进行了描述,然而,在实施所要求保护的本发明过程中,本领域技术人员通过查看所述附图、公开内容、以及所附权利要求书,可理解并实现所述公开实施例的其他变化。在权利要求中,“包括”(comprising)一词不排除其他组成部分或步骤,“一”或“一个”不排除多个的情况。单个处理器或其他单元可以实现权利要求中列举的若干项功能。相互不同 的从属权利要求中记载了某些措施,但这并不表示这些措施不能组合起来产生良好的效果。Although the present invention has been described herein in connection with the embodiments of the present invention, it will be understood by those skilled in the <RTIgt; Other variations of the disclosed embodiments are achieved. In the claims, the word "comprising" does not exclude other components or steps, and "a" or "an" does not exclude a plurality. A single processor or other unit may fulfill several of the functions recited in the claims. Different from each other Certain measures are recited in the dependent claims, but this does not mean that these measures cannot be combined to produce a good effect.
本领域技术人员应明白,本发明的实施例可提供为方法、装置(设备)、或计算机程序产品。因此,本发明可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本发明可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。计算机程序存储/分布在合适的介质中,与其它硬件一起提供或作为硬件的一部分,也可以采用其他分布形式,如通过Internet或其它有线或无线电信***。Those skilled in the art will appreciate that embodiments of the present invention can be provided as a method, apparatus (device), or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or a combination of software and hardware. Moreover, the invention can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) including computer usable program code. The computer program is stored/distributed in a suitable medium, provided with other hardware or as part of the hardware, or in other distributed forms, such as over the Internet or other wired or wireless telecommunication systems.
本发明是参照本发明实施例的方法、装置(设备)和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present invention has been described with reference to flowchart illustrations and/or block diagrams of the methods, apparatus, and computer program products of the embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or FIG. These computer program instructions can be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing device to produce a machine for the execution of instructions for execution by a processor of a computer or other programmable data processing device. Means for implementing the functions specified in one or more of the flow or in a block or blocks of the flow chart.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。The computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture comprising the instruction device. The apparatus implements the functions specified in one or more blocks of a flow or a flow and/or block diagram of the flowchart.
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded onto a computer or other programmable data processing device such that a series of operational steps are performed on a computer or other programmable device to produce computer-implemented processing for execution on a computer or other programmable device. The instructions provide steps for implementing the functions specified in one or more of the flow or in a block or blocks of a flow diagram.
尽管结合具体特征及其实施例对本发明进行了描述,显而易见的,在不脱离本发明的精神和范围的情况下,可对其进行各种修改和组合。相应地,本说明书和附图仅仅是所附权利要求所界定的本发明的示例性说明,且视为已覆盖本发明范围内的任意和所有修改、变化、组合或等同物。显然,本领域的技术人员可以对本发明进行各种改动和变型而不脱离本发明的精神和范围。这样,倘若本发明的这些修改和变型属于本发明权利要求及其等同技术的范围之内, 则本发明也意图包含这些改动和变型在内。 While the invention has been described with respect to the specific embodiments and embodiments thereof, various modifications and combinations may be made without departing from the spirit and scope of the invention. Accordingly, the specification and drawings are to be construed as the It is apparent that those skilled in the art can make various modifications and variations to the invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the appended claims The invention is also intended to cover such modifications and variations.

Claims (10)

  1. 一种图像处理方法,其特征在于,包括:An image processing method, comprising:
    获取正样本集和负样本集;Obtaining a positive sample set and a negative sample set;
    对所述正样本集和所述负样本集进行平滑处理,得到目标正样本集和目标负样本集;Smoothing the positive sample set and the negative sample set to obtain a target positive sample set and a target negative sample set;
    分别对所述目标正样本集和所述目标负样本集进行积分通道特征提取,得到X个第一目标特征集合,其中,所述X个第一目标特征集合中每一第一目标特征集合包含一个亮度特征分量、2个色差特征分量、梯度幅值分量和与所述梯度幅值分量对应的6个梯度方向分量,所述X为大于1的整数;Performing integration channel feature extraction on the target positive sample set and the target negative sample set respectively to obtain X first target feature sets, wherein each of the X first target feature sets includes a luminance characteristic component, two color difference characteristic components, a gradient amplitude component, and six gradient direction components corresponding to the gradient amplitude component, wherein X is an integer greater than one;
    对所述X个第一目标特征集合中每一第一目标特征集合进行像素差值特征提取,得到所述X个第二目标特征集,其中,所述X个第二目标特征集中每一第二目标特征集中包含多个像素差值特征;Pixel difference feature extraction is performed on each of the first target feature sets in the X first target feature sets to obtain the X second target feature sets, wherein each of the X second target feature sets The second target feature set includes a plurality of pixel difference features;
    采用至少一个boosting决策树对所述X个第二目标特征集进行分类,得到目标分类器。The X second target feature sets are classified by using at least one boosting decision tree to obtain a target classifier.
  2. 根据权利要求1所述的方法,其特征在于,所述分别对所述目标正样本集和所述目标负样本集进行积分通道特征提取,包括:The method according to claim 1, wherein the performing the integral channel feature extraction on the target positive sample set and the target negative sample set respectively comprises:
    将目标样本i转化到LUV空间,得到亮度特征分量、2个色差特征分量,其中,所述目标样本i为所述目标正样本集或者所述目标负样本集中的任一个;Converting the target sample i into the LUV space to obtain a luminance feature component and two color difference feature components, wherein the target sample i is any one of the target positive sample set or the target negative sample set;
    确定所述目标样本i中的每一通道进行梯度计算,得到梯度幅值分量和梯度方向分量;Determining each channel in the target sample i to perform a gradient calculation to obtain a gradient amplitude component and a gradient direction component;
    将所述梯度方向分量划分为6份,得到6个梯度方向;Dividing the gradient direction component into 6 parts to obtain 6 gradient directions;
    将所述梯度幅值分量软投影到所述6个梯度方向,得到所述梯度幅值分量对应的6个梯度方向分量,其中,所述亮度特征分量、所述2个色差特征分量、所述梯度幅值分量和所述6个梯度方向分量合成所述第一目标特征集合。Softly projecting the gradient magnitude component into the six gradient directions to obtain six gradient direction components corresponding to the gradient amplitude component, wherein the luminance feature component, the two color difference feature components, the The gradient magnitude component and the six gradient direction components are combined to form the first target feature set.
  3. 根据权利要求1所述的方法,其特征在于,所述对所述X个第一目标特征集合中每一第一目标特征集合进行像素差值特征提取,包括: The method according to claim 1, wherein the performing pixel difference feature extraction on each of the first target feature sets of the X first target feature sets comprises:
    从所述第一目标特征集合j对应中随机选取K个位置,所述第一目标特征集合j为所述X个第一目标特征集合中的任一个,所述K为偶数;K positions are randomly selected from the first target feature set j correspondence, the first target feature set j is any one of the X first target feature sets, and the K is an even number;
    将所述K个位置对应的像素值组成K/2个像素对;Pixel values corresponding to the K positions are formed into K/2 pixel pairs;
    计算所述K/2个像素对中每一像素对的差值,得到所述K/2个像素差值特征,即第二目标特征集。Calculating a difference value of each of the K/2 pixel pairs to obtain the K/2 pixel difference feature, that is, a second target feature set.
  4. 根据权利要求1所述的方法,其特征在于,所述采用至少一个boosting决策树对所述多个第二目标特征集进行分类,得到目标弱分类器,包括:The method according to claim 1, wherein the classifying the plurality of second target feature sets by using at least one boosting decision tree to obtain a target weak classifier comprises:
    采用至少一个boosting决策树对所述X个第二目标特征集进行分类,得到Y个第一级分类器,所述Y为大于1的整数;And classifying the X second target feature sets by using at least one boosting decision tree to obtain Y first-level classifiers, where Y is an integer greater than 1;
    使用hard mining算法对所述负样本集进行挖掘,得到Z个负样本;Mining the negative sample set using a hard mining algorithm to obtain Z negative samples;
    采用所述Y个级分类器对所述Z个负样本进行分类,得到A个第二级分类器,所述A为正整数;And classifying the Z negative samples by using the Y classifiers to obtain A second classifiers, where A is a positive integer;
    判断所述A个第二级分类器中是否存在符合预设条件的第二级分类器,Determining whether there is a second-level classifier in the A second-level classifier that meets a preset condition,
    在所述A个第二级分类器中存在符合所述预设条件的第二级分类器时,从所述符合所述预设条件的第二级分类器中一个第二级分类器作为所述目标分类器。When there is a second-level classifier that meets the preset condition in the A second-stage classifiers, a second-level classifier from the second-level classifier that meets the preset condition is used as a The target classifier.
  5. 根据权利要求1至4任一项所述的方法,其特征在于,所述获取正样本集和负样本集之前,所述方法还包括:The method according to any one of claims 1 to 4, wherein before the obtaining of the positive sample set and the negative sample set, the method further comprises:
    按照如下公式初始化所述正样本集和所述负样本集中每一样本的权重,其中,s为任一样本,如下:The weights of each of the positive sample set and the negative sample set are initialized according to the following formula, wherein s is any sample, as follows:
    Figure PCTCN2017087705-appb-100001
    Figure PCTCN2017087705-appb-100001
    其中P为正样本集中的样本个数,N为负样本集中的样本个数,Cs为样本类别,s为任一样本,ws为样本的权重,Cs∈{+1,-1},+1为正样本,-1为负样本;Where P is the number of samples in the positive sample set, N is the number of samples in the negative sample set, C s is the sample class, s is any sample, w s is the weight of the sample, C s ∈{+1,-1} , +1 is a positive sample, and -1 is a negative sample;
    根据所述正样本集和所述负样本集以及每一样本的权重进行加权最小二乘拟合,得到所述至少一个boosting决策树。 And performing at least one boosting decision tree according to the weighted least squares fit of the positive sample set and the negative sample set and the weight of each sample.
  6. 一种终端,其特征在于,包括:A terminal, comprising:
    获取单元,用于获取正样本集和负样本集;An acquisition unit for obtaining a positive sample set and a negative sample set;
    处理单元,用于对所述正样本集和所述负样本集进行平滑处理,得到目标正样本集和目标负样本集;a processing unit, configured to perform smoothing processing on the positive sample set and the negative sample set to obtain a target positive sample set and a target negative sample set;
    第一提取单元,用于分别对所述目标正样本集和所述目标负样本集进行积分通道特征提取,得到X个第一目标特征集合,其中,所述X个第一目标特征集合中每一第一目标特征集合包含一个亮度特征分量、2个色差特征分量、梯度幅值分量和与所述梯度幅值分量对应的6个梯度方向分量,所述X为大于1的整数;a first extracting unit, configured to perform an integral channel feature extraction on the target positive sample set and the target negative sample set, respectively, to obtain X first target feature sets, wherein each of the X first target feature sets A first target feature set includes a luma feature component, two chroma component components, a gradient magnitude component, and six gradient direction components corresponding to the gradient magnitude component, the X being an integer greater than one;
    第二提取单元,用于对所述X个第一目标特征集合中每一第一目标特征集合进行像素差值特征提取,得到所述X个第二目标特征集,其中,所述X个第二目标特征集中每一第二目标特征集中包含多个像素差值特征;a second extracting unit, configured to perform pixel difference feature extraction on each of the first target feature sets of the X first target feature sets, to obtain the X second target feature sets, where the X first Each of the second target feature sets includes a plurality of pixel difference features in the second target feature set;
    分类单元,用于采用至少一个boosting决策树对所述X个第二目标特征集进行分类,得到目标分类器。And a classification unit, configured to classify the X second target feature sets by using at least one boosting decision tree to obtain a target classifier.
  7. 根据权利要求6所述的终端,其特征在于,所述第一提取单元包括:The terminal according to claim 6, wherein the first extracting unit comprises:
    转化模块,用于将目标样本i转化到LUV空间,得到亮度特征分量、2个色差特征分量,其中,所述目标样本i为所述目标正样本集或者所述目标负样本集中的任一个;a conversion module, configured to convert the target sample i into the LUV space, to obtain a luminance feature component, and two color difference feature components, wherein the target sample i is any one of the target positive sample set or the target negative sample set;
    第一确定模块,用于确定所述目标样本i中的每一通道进行梯度计算,得到梯度幅值分量和梯度方向分量;a first determining module, configured to determine a gradient calculation for each channel in the target sample i, to obtain a gradient amplitude component and a gradient direction component;
    划分模块,用于将所述梯度方向分量划分为6份,得到6个梯度方向;a dividing module, configured to divide the gradient direction component into 6 parts, to obtain 6 gradient directions;
    第二确定模块,用于将所述梯度幅值分量软投影到所述6个梯度方向,得到所述梯度幅值分量对应的6个梯度方向分量,其中,所述亮度特征分量、所述2个色差特征分量、所述梯度幅值分量和所述6个梯度方向分量合成所述第一目标特征集合。a second determining module, configured to soft-project the gradient amplitude component to the six gradient directions to obtain six gradient direction components corresponding to the gradient amplitude component, wherein the luminance feature component, the 2 The first color difference feature component, the gradient magnitude component, and the six gradient direction components are combined to form the first target feature set.
  8. 根据权利要求6所述的终端,其特征在于,所述第二提取单元包括:The terminal according to claim 6, wherein the second extracting unit comprises:
    选取模块,用于从所述第一目标特征集合j对应中随机选取K个位置,所述第一目标特征集合j为所述X个第一目标特征集合中的任一个,所述K为偶 数;a selection module, configured to randomly select K locations from the first target feature set j correspondence, where the first target feature set j is any one of the X first target feature sets, and the K is an even number;
    组合模块,用于将所述K个位置对应的像素值组成K/2个像素对;a combination module, configured to form pixel values corresponding to the K locations into K/2 pixel pairs;
    计算模块,用于计算所述K/2个像素对中每一像素对的差值,得到所述K/2个像素差值特征,即第二目标特征集。And a calculation module, configured to calculate a difference value of each of the K/2 pixel pairs, to obtain the K/2 pixel difference feature, that is, a second target feature set.
  9. 根据权利要求6所述的终端,其特征在于,所述分类单元包括:The terminal according to claim 6, wherein the classification unit comprises:
    第一分类模块,用于采用至少一个boosting决策树对所述X个第二目标特征集进行分类,得到Y个第一级分类器,所述Y为大于1的整数;a first classification module, configured to classify the X second target feature sets by using at least one boosting decision tree, to obtain Y first-level classifiers, where Y is an integer greater than one;
    挖掘模块,用于使用hard mining算法对所述负样本集进行挖掘,得到Z个负样本;a mining module, configured to mine the negative sample set by using a hard mining algorithm to obtain Z negative samples;
    第二分类模块,用于采用所述Y个级分类器对所述Z个负样本进行分类,得到A个第二级分类器,所述A为正整数;a second classification module, configured to classify the Z negative samples by using the Y classifiers to obtain A second classifiers, where A is a positive integer;
    判断模块,用于判断所述A个第二级分类器中是否存在符合预设条件的第二级分类器,a judging module, configured to determine whether there is a second-level classifier that meets a preset condition in the A second-level classifiers,
    第三确定模块,用于在所述A个第二级分类器中存在符合所述预设条件的第二级分类器时,从所述符合所述预设条件的第二级分类器中一个第二级分类器作为所述目标分类器。a third determining module, configured to: when there is a second-level classifier that meets the preset condition in the A second-level classifiers, one of the second-level classifiers that meet the preset condition A second level classifier acts as the target classifier.
  10. 根据权利要求6至9任一项所述的终端,其特征在于,所述终端还包括:The terminal according to any one of claims 6 to 9, wherein the terminal further comprises:
    处理单元,用于在所述获取单元获取正样本集和负样本集之前,按照如下公式初始化所述正样本集和所述负样本集中每一样本的权重,其中,s为任一样本,如下:a processing unit, configured to initialize a weight of each sample in the positive sample set and the negative sample set according to the following formula before the obtaining unit acquires a positive sample set and a negative sample set, where s is any sample, as follows :
    Figure PCTCN2017087705-appb-100002
    Figure PCTCN2017087705-appb-100002
    其中P为正样本集中的样本个数,N为负样本集中的样本个数,Cs为样本类别,s为任一样本,ws为样本的权重,Cs∈{+1,-1},+1为正样本,-1为负样本;Where P is the number of samples in the positive sample set, N is the number of samples in the negative sample set, C s is the sample class, s is any sample, w s is the weight of the sample, C s ∈{+1,-1} , +1 is a positive sample, and -1 is a negative sample;
    拟合单元,用于根据所述正样本集和所述负样本集以及每一样本的权重进行加权最小二乘拟合,得到所述至少一个boosting决策树。 And a fitting unit, configured to perform weighted least squares fitting according to the positive sample set and the negative sample set and the weight of each sample, to obtain the at least one boosting decision tree.
PCT/CN2017/087705 2016-12-23 2017-06-09 Image processing method and terminal WO2018113206A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201611204326.1A CN106845520B (en) 2016-12-23 2016-12-23 A kind of image processing method and terminal
CN201611204326.1 2016-12-23

Publications (1)

Publication Number Publication Date
WO2018113206A1 true WO2018113206A1 (en) 2018-06-28

Family

ID=59135092

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/087705 WO2018113206A1 (en) 2016-12-23 2017-06-09 Image processing method and terminal

Country Status (2)

Country Link
CN (1) CN106845520B (en)
WO (1) WO2018113206A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110969173A (en) * 2018-09-28 2020-04-07 杭州海康威视数字技术股份有限公司 Target classification method and device

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107886110A (en) * 2017-10-23 2018-04-06 深圳云天励飞技术有限公司 Method for detecting human face, device and electronic equipment
CN110991551B (en) * 2019-12-13 2023-09-15 北京百度网讯科技有限公司 Sample processing method, device, electronic equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103870811A (en) * 2014-03-06 2014-06-18 中国人民解放军国防科学技术大学 Method for quickly recognizing front face through video monitoring
CN103871077A (en) * 2014-03-06 2014-06-18 中国人民解放军国防科学技术大学 Extraction method for key frame in road vehicle monitoring video
CN105138987A (en) * 2015-08-26 2015-12-09 电子科技大学 Vehicle detection method based on aggregation channel characteristic and motion estimation
CN105760858A (en) * 2016-03-21 2016-07-13 东南大学 Pedestrian detection method and apparatus based on Haar-like intermediate layer filtering features
CN105975921A (en) * 2016-04-29 2016-09-28 厦门大学 Local feature symbiosis and partial least square method-based pedestrian detection method

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103514460B (en) * 2013-07-30 2017-02-01 深圳市智美达科技有限公司 Video monitoring multi-view-angle vehicle detecting method and device
CN103605977B (en) * 2013-11-05 2017-01-18 奇瑞汽车股份有限公司 Extracting method of lane line and device thereof
CN103824050B (en) * 2014-02-17 2017-03-15 北京旷视科技有限公司 A kind of face key independent positioning method returned based on cascade
CN103824089B (en) * 2014-02-17 2017-05-03 北京旷视科技有限公司 Cascade regression-based face 3D pose recognition method
CN103902968B (en) * 2014-02-26 2015-03-25 中国人民解放军国防科学技术大学 Pedestrian detection model training method based on AdaBoost classifier
US9195904B1 (en) * 2014-05-08 2015-11-24 Mitsubishi Electric Research Laboratories, Inc. Method for detecting objects in stereo images
CN104050460B (en) * 2014-06-30 2017-08-04 南京理工大学 The pedestrian detection method of multiple features fusion
CN105809123B (en) * 2016-03-04 2019-11-12 智慧眼科技股份有限公司 Method for detecting human face and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103870811A (en) * 2014-03-06 2014-06-18 中国人民解放军国防科学技术大学 Method for quickly recognizing front face through video monitoring
CN103871077A (en) * 2014-03-06 2014-06-18 中国人民解放军国防科学技术大学 Extraction method for key frame in road vehicle monitoring video
CN105138987A (en) * 2015-08-26 2015-12-09 电子科技大学 Vehicle detection method based on aggregation channel characteristic and motion estimation
CN105760858A (en) * 2016-03-21 2016-07-13 东南大学 Pedestrian detection method and apparatus based on Haar-like intermediate layer filtering features
CN105975921A (en) * 2016-04-29 2016-09-28 厦门大学 Local feature symbiosis and partial least square method-based pedestrian detection method

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110969173A (en) * 2018-09-28 2020-04-07 杭州海康威视数字技术股份有限公司 Target classification method and device
CN110969173B (en) * 2018-09-28 2023-10-24 杭州海康威视数字技术股份有限公司 Target classification method and device

Also Published As

Publication number Publication date
CN106845520B (en) 2018-05-18
CN106845520A (en) 2017-06-13

Similar Documents

Publication Publication Date Title
US10096122B1 (en) Segmentation of object image data from background image data
CN108875540B (en) Image processing method, device and system and storage medium
Varish et al. Image retrieval scheme using quantized bins of color image components and adaptive tetrolet transform
TWI686774B (en) Human face live detection method and device
US8750573B2 (en) Hand gesture detection
US8792722B2 (en) Hand gesture detection
US9008365B2 (en) Systems and methods for pedestrian detection in images
WO2018113523A1 (en) Image processing method and device, and storage medium
WO2019033569A1 (en) Eyeball movement analysis method, device and storage medium
Loke et al. Indian sign language converter system using an android app
JP6351243B2 (en) Image processing apparatus and image processing method
WO2018210047A1 (en) Data processing method, data processing apparatus, electronic device and storage medium
Buza et al. Skin detection based on image color segmentation with histogram and k-means clustering
WO2018082308A1 (en) Image processing method and terminal
JP3970877B2 (en) Tracking device and tracking method
Parashar et al. Intra-class variations with deep learning-based gait analysis: A comprehensive survey of covariates and methods
WO2018113206A1 (en) Image processing method and terminal
US20110182497A1 (en) Cascade structure for classifying objects in an image
Lejmi et al. A Novel Spatio-Temporal Violence Classification Framework Based on Material Derivative and LSTM Neural Network.
Saif et al. An efficient method for hand gesture recognition using robust features vector
CN108255298B (en) Infrared gesture recognition method and device in projection interaction system
JP2007241479A (en) Variable area detecting device and method thereof
Mustafah et al. Face detection system design for real time high resolution smart camera
Kuang et al. Learner posture recognition via a fusing model based on improved SILTP and LDP
Zhou et al. On contrast combinations for visual saliency detection

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: 17884847

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS (EPO FORM 1205A DATED 24.10.2019)

122 Ep: pct application non-entry in european phase

Ref document number: 17884847

Country of ref document: EP

Kind code of ref document: A1