1. Field of the Invention
The present invention is related to a classifier generating apparatus and a classifier generating method, for generating classifiers having tree structures for performing multi class multi view classification of objects. The present invention is also related to a program that causes a computer to execute the classifier generating method.
2. Description of the Related Art
Conventionally, correction of skin tones in snapshots photographed with digital cameras by investigating color distributions within facial regions of people, and recognition of people who are pictured in digital images obtained by digital video cameras of security systems, are performed. In these cases, it is necessary to detect regions (facial regions) within digital images that correspond to people's faces. For this reason, various techniques for detecting faces from within digital images have been proposed. Among these techniques, there is a known detecting method that employs appearance models constructed by a machine learning technique. The detecting method that employs appearance models employs a plurality of linked weak classifiers which are obtained by learning a great number of sample images by machine learning. Therefore, this method is robust and superior in detection accuracy.
The detecting method that employs appearance models will be described as a technique for detecting images within digital images. In this method, features of faces are learned by employing a face sample image group consisting of a plurality of sample images of different faces, and a non face sample image group consisting of a plurality of sample images which are known not to be of faces, as learning data to generate classifiers capable of judging whether an image is an image of a face. Then, partial images are sequentially cut out from an image in which faces are to be detected (hereinafter, referred to as “detection target image”), and the aforementioned classifiers are employed to judge whether the partial images are of faces. Finally, the regions of the detection target image corresponding to the partial images which are judged to be faces are extracted, to detect faces within the detection target image.
Not only forward facing faces, but images in which faces are rotated along the plane of the image (hereinafter, referred to as “in plane rotation”) and images in which faces are rotated within the plane of the image (hereinafter, referred to as “out of plane rotation”) are input to the classifiers. In the case that learning is performed using learning data that include faces of a variety of orientations (faces in multiple views), it is difficult to realize a general use classifier capable of detecting faces in all orientations. For example, the rotational range of faces that a single classifier is capable of classifying is limited to approximately 30 degrees for in plane rotated images, and approximately 30 to 60 degrees for out of plane rotated images. For this reason, classifiers for faces are constituted by a plurality of strong classifiers for respectively discriminating faces in each of a plurality of orientations, in order to efficiently extract statistical features of faces, which are detection targets. Specifically, multi class classifying methods have been proposed, in which a plurality of strong classifiers, which have performed multi class learning to enable classification of images in each orientation, are prepared. Next, all of the strong classifiers are caused to perform classification regarding whether images are faces in specific orientations. Then, it is judged whether the images represent faces, from the ultimate outputs of each of the strong classifiers.
The techniques disclosed in U.S. Patent Application Publication Nos. 20090116693 and 20090157707 and Japanese Unexamined Patent Publication No. 2006-251955 have been proposed as multi class classifying methods. Note that here, descriptions will be given regarding faces as classification targets, in order to simplify explanations of the techniques. In addition, a class C1 including leftward facing faces, a class C2 including forward facing faces, and a class C3 including rightward facing faces will be described as three classes of faces to be classified.
First, the technique disclosed in U.S. Patent Application Publication No. 20090116693 will be described. In this technique, strong classifiers are independently constructed for each class. That is, strong classifiers HC1, HC2, and HC3, respectively constituted by weak classifiers hiC1, hiC2, and hiC3, are generated for each of classes C1 through C3 by a boosting learning method, as illustrated in
Next, the technique disclosed in U.S. Patent Application Publication No. 20090157707 will be described. In the technique disclosed in U.S. Patent Application Publication No. 20090157707, the root portion of a tree structure is constituted by classifiers for classifying faces and non faces. The characteristic features of the technique disclosed in U.S. Patent Application Publication No. 20090157707 are that classes C1 through C3 are not distinguished at the root portion of the tree structure as illustrated in
The technique disclosed in Japanese Unexamined Patent Publication No. 2006-251955 will be described. In the technique disclosed in Japanese Unexamined Patent Publication No. 2006-251955, multi class, multi view classifiers are constructed employing the Ada Boost. MH, LogitBoost, or the Joint Boost learning algorithm, for example.
However, the techniques of U.S. Patent Application Publication Nos. 20090116693 and 20090157707 and Japanese Unexamined Patent Publication No. 2006-251955 exhibit the following problems. That is, the technique disclosed in U.S. Patent Application Publication No. 20090116693 is easy to execute because learning for each class is performed individually, but it is necessary to reduce the number of m weak classifiers for each class at the root portion of the tree structure, in order to obtain high detection speed. However, detection accuracy deteriorates if the number of weak classifiers at the root portion is small. Conversely, if the number of weak classifiers at the root portion of the tree structure is increased, the detection speed deteriorates. In addition, there are many cases in which clear borders among each class are not present. Depending on how learning data that represent the borders among classes are handled during independent learning of strong classifiers for each class, flexible branching to perform classification becomes impossible. In addition, because learning is performed independently for the strong classifiers of each class, the amount of calculations for calculating features during pattern classification becomes great. Further, it is difficult to construct classifiers having tree structures with a great number of branches.
In the technique disclosed in U.S. Patent Application Publication No. 20090157707, it is possible to construct classifiers having tree structures with a great number of branches. However, it is difficult to appropriately design branching timings and branching structures. In addition, the classification performance of the classifiers is dependent on the knowledge and experience of designers, and therefore if the design is not appropriate, classification accuracy and classification speed deteriorate. In addition, because classifiers are constructed by trial and error, a long amount of time is necessary for learning. It is often the case that the filters for determining branching destinations are individually constructed for each class. In such cases, because the correlations among classes are not utilized, the amount of calculations for constructing the filters also becomes great. Further, the learning results prior to branching cannot be passed on following branching, because the characteristics of the classes change greatly after branching (that is, because weighting of learning data prior to and following branching is not connected seamlessly). Therefore, the classifying performance of the classifiers as a whole deteriorates.
In the technique disclosed in Japanese Unexamined Patent Publication No. 2006-251955, classes perform learning in common. Therefore, correlations among the classes can be maximally utilized. However, because no clear branches are present, it is necessary to perform classification using all weak classifiers of each class to ultimately obtain classification results. As a result, a long time is required for classifying calculations. High detection speed and execution of real time detection are demanded in applications for detecting faces and people from within images and videos. Therefore, it is preferable for classifiers to be of tree structures having a great number of branches. However, sharing of features among classes in the Joint Boost learning algorithm is sharing of weak classifiers themselves. Accordingly, discriminating performance among classes is low, and it is not possible to satisfy branching requirements of tree structures.
The present invention has been developed in view of the foregoing circumstances. It is an object of the present invention to solve the problem related to tree structures of classifiers when generating classifiers for performing multi class, multi view classification, to generate high performance classifiers that realize both classification accuracy and high classification speed.
A classifier generating apparatus of the present invention generates classifiers, which are combinations of a plurality of weak classifiers, for discriminating objects included in detection target images by employing features extracted from the detection target images to perform multi class discrimination including a plurality of classes regarding the objects, and is characterized by comprising:
learning means, for determining branching positions and branching structures of the weak classifiers of the plurality of classes, according to the learning results of the weak classifiers in each of the plurality of classes.
The “weak classifiers” are classifiers that judge whether features obtained from images represents objects, in order to classify the objects.
The “branching structures” include branching conditions and the number of branching destinations. The branching conditions are conditions that determine how learning data are branched and how features are shared among classes after branching. Specifically, in the case that there are five classes as illustrated in
Note that in the classifier generating apparatus of the present invention, the learning means may perform learning of the weak classifiers of the plurality of classes, sharing only the features.
In the Joint Boost learning algorithm, not only the features, but weak classifiers, more specifically, classifying mechanisms that define how classification is performed within the weak classifiers, are shared among classes. “Learning . . . sharing only the features” differs from the Joint Boost learning algorithm, and shares only the features, not the classifying mechanisms of the weak classifiers.
The classifier generating apparatus of the present invention may further comprise:
learning data input means, for inputting a plurality of positive and negative learning data for the weak classifiers to perform learning for each of the plurality of classes; and
filter storage means, for storing a plurality of filters that extract the features from the learning data. In this case, the learning means extracts the features from the learning data using filters selected from those stored in the filter storage means, and performs learning using the extracted features.
The “filters that extract the features” are those that define the positions of pixels which are employed to calculate features within images, the method for calculating features using the pixel values of pixels at these positions, and the sharing relationship of features among classes.
In the classifier generating apparatus of the present invention, the learning means may perform labeling with respect to all of the learning data to be utilized for learning according to degrees of similarity to positive learning data of classes to be learned, to stabilize learning.
In the classifier generating apparatus of the present invention, the learning means may perform learning by:
defining a total sum of weighted square errors of the outputs of weak classifiers at the same level in the plurality of classes with respect to the labels and input features;
defining the total sum of the total sums for the plurality of classes as classification loss error; and
determining weak classifiers such that the classification loss error becomes minimal.
In the classifier generating apparatus of the present invention, the learning means may be a means for calculating the classification loss error of the weak classifiers of each of the plurality of classes at levels for which judgments are made regarding whether branching is to be performed, and for determining the weak classifiers of these levels as branching positions when the amount of change from the classification loss error of an upper level and that of these levels is less than or equal to a predetermined threshold value.
When all positive learning data for each class are branched by branching structures, positive learning data for a certain class should be branched to the branching destination that the class belongs to. However, there are cases in which the positive learning data for the class will be branched to a branching destination other than that of the class. This may occur due to the multi class classifiers' performance up to the branching timing being insufficient to correctly classify all of the learning data because the patterns of the learning data are complex, because fluctuations in the learning data are great and effective features cannot be found, or because the properties of filters and learning data are not matched. This may occur also due to the branching conditions of the branching structure being inappropriate. In these cases, it is preferable for the learning data, which are branched to branching destinations that the class does not belong to, to not be used for learning after branching in order to improve learning accuracy. Accordingly, the learning data, which are branched to branching destinations that the class does not belong to, are lost by branching. Here, the percentage of lost learning data may be calculated by subtracting the percentage of the number of positive learning data which are branched to the branching destination that the class belongs to with respect to the number of positive learning data for the class from 1. “Classification loss error” may be calculated as a weighted integrated value of the percentages of lost learning data for all of the classes obtained by the branching structure. Note that branching structures that will result in the classification error loss becoming minimal are selected from among a pool of branching structures that include utilizable branching structures to determine the branching portions of the classifiers having tree structures, in order to maximize the performance of the classifiers (that is, the classification speed and the classification accuracy).
The classifier generating apparatus of the present invention may further comprise:
storage means, for storing a plurality of branching structures which are determined in advance. In this case, the learning means is a means for selecting branching structures from among the plurality of branching structures such that branching loss errors become minimal at levels for which judgments are made regarding whether branching is to be performed.
In the classifier generating apparatus of the present invention, the learning means may inherit the learning results prior to branching for learning of the weak classifiers following the branching.
A classifier generating method of the present invention generates classifiers, which are combinations of a plurality of weak classifiers, for discriminating objects included in detection target images by employing features extracted from the detection target images to perform multi class discrimination including a plurality of classes regarding the objects, and is characterized by comprising:
a learning step, for determining branching positions and branching structures of the weak classifiers of the plurality of classes, according to the learning results of the weak classifiers in each of the plurality of classes.
A program of the present invention is characterized by causing a computer to execute the functions of the classifier generating apparatus of the present invention.
The present invention determines the branching positions and the branching structures of weak classifiers of a plurality of classes according to the results of learning of the weak classifiers in each class. For this reason, the branching positions and the branching structures of the weak classifiers during multi class learning does not depend on the designer. As a result, classification of objects can be performed accurately and at high speeds using the generated classifiers. In addition, the occurrence of learning not converging will decrease compared to cases in which branching positions and branching structures are determined by designers, and as a result, the converging properties of learning can be improved.
In addition, learning results prior to branching may be inherited for learning of the weak classifiers following the branching. In this case, the weak classifiers are seamlessly connected prior to and following branching. Therefore, the consistency of classifying structures can be maintained in classifiers generated by the present invention. Accordingly, both classification accuracy and high classification speed can be realized.
Hereinafter, embodiments of the present invention will be described with reference to the attached drawings.
The learning data input section 10 inputs learning data to be utilized for classifier learning into the classifier generating apparatus 1. Here, the classifiers which are generated by the present embodiment are those that perform multi class classification. For example, in the case that the classification target object is a face, the classifiers are those that perform multi class classification to classify faces which have different orientations along the plane of the image and different facing directions within the images. Accordingly, the classifier generating apparatus 1 of the present invention generates m classes of classifiers, each capable of classifying faces of a different orientation. For this reason, the learning data input section 10 inputs different learning data xiCu (i=1−NCu, u=1−m, and NCu is the number of pieces of learning data corresponding to each class Cu), that is, learning data in which the orientations and facing directions of faces are different, into the classifier generating apparatus 1. Note that in the present embodiment, the learning data are image data, in which the sizes and the positions of feature points (such as eyes, noses, etc.) are normalized.
In addition, learning data xibkg (number of data Nbkg) that represent backgrounds that do not belong to any class of the classification target object are also input into the classifier generating apparatus 1 of the present embodiment. Accordingly, learning data for m+1 classes as illustrated in
A plurality of filters ft, for extracting features to be employed to judge whether classification target image data belong in a certain class from the learning data, are stored in the feature pool 20. The filters ft define the positions of pixels which are employed to calculate features within the learning data, the method for calculating features using the pixel values of pixels at these positions, and the sharing relationship of features among classes.
The initializing section 30 performs the processes of labeling learning data, normalizing the number of pieces of learning data, setting weighting for learning data, and initializing classifiers. Hereinafter, each of the processes performed by the initialing section 30 will be described. Note that the initializing section 30 includes: a labeling section 30A for labeling learning data; a normalizing section 30B for normalizing the number of pieces of learning data; a weight setting section 30C for setting weighting for learning data; and a classifier initializing section 30D for initializing classifiers. First, labeling of learning data will be described. Labeling of learning data is performed to indicate whether pieces of learning data belong to a learning target class during learning of weak classifiers for each class. As shown below, labels for all classes are set for each piece of learning data xiC. Note that setting labels for all classes clarifies whether each piece of learning data xiC (belonging to class C) is to be treated as positive teacher data or negative teacher data during learning of each class Cu. Whether each piece of learning data is to be treated as positive teacher data or negative teacher data is determined by the labels.
xiC→(ziC1, ziC2, . . . , ziCm)
Here, assuming that C∈ [C1, C2, . . . , Cm, bkg], in the case that C=Cu (u=1 through m, that is, learning data are not background images), the labeling section 30A of the initializing section 30 sets the value of the label to +1 (ziCu=+1). Conversely, in the case that C=bkg (that is, learning data are background images), the value of the label is set to −1 (ziCbkg=−1). In addition, in the case that the learning data are not background images, the values of labels are set further, as described below. In cases that the class of the weak classifier which is a learning target and the class of a piece of learning data does not match, for example, a case in which the class of the learning target weak classifier is C1, and the class of a piece of learning data to be utilized for the learning is C3 (a piece of learning data xiC3, for example), the value of the label is set according to the degree of similarity within the class of the learning data for the learning target weak classifier and the learning data of different classes. For example, in cases that the class of the learning target weak classifier and the classes of the learning data are similar, such as a case in which the class of the learning target weak classifier is C3 and the classes of the learning data are C2 or C4, the values of labels are set to 0 (ziCu=0). Conversely, in cases that the class of the learning target weak classifier and the classes of the learning data are not similar, such as a case in which the class of the learning target weak classifier is C3 and the classes of the learning data are C1 or C6, the values of labels are set to −1 (ziCu=−1). Note that pieces of learning data having labels valued +1 are positive teacher data, and pieces of learning data having labels valued −1 are negative teacher data.
Note that judgments regarding whether learning data of a class (designated as Ca) for a learning target weak classifier and learning data of another class (designated as Cb) are similar are performed based on the appearance spaces thereof. That is, if an appearance space represented by class Cb is adjacent to or partially overlaps an appearance space represented by class Ca, it is judged that the data of class Cb are similar to the data of class Ca. In cases that an appearance space represented by class Cb is not adjacent to or does not partially overlaps an appearance space represented by class Ca, it is judged that the data of class Cb are not similar to the data of class Ca.
It is necessary to perform learning for seven classes, each of which are assigned faces having different facing directions in 20 degree increments, from a leftward facing face in profile to a rightward facing face in profile, in order to detect faces and to classify the facing directions thereof. The results of labeling for learning data for such a case are illustrated in
Note that judgments regarding whether learning data are similar to each other may alternatively be performed by calculating correlations among the learning data of the classes, and judging that the learning data are similar if the correlation is a predetermined value or higher. As a further alternative, users may judge whether learning data of different classes are similar, by manual operations.
Next, the normalizing process for the number of pieces of learning data performed by the normalizing section 30 will be described. As described above, learning data are prepared for each class. However, there are cases in which the numbers of pieces of learning data differ among classes. In addition, in the classifier generating apparatus 1 of the present embodiment, learning data of classes having labels ziCu valued +1 and −1 with respect to the classes of learning target weak classifiers are employed for learning, and learning data of classes having labels ziCu valued 0 are weighted as 0 and are not utilized, as will be described later. Here, learning data having labels ziCu valued +1 with respect to a certain class Cu are employed as positive learning data, and learning data having labels ziCu valued −1 are employed as negative learning data. If the number of pieces of positive learning data is designated as N+Cu and the number of pieces of negative learning data is designated as N−Cu for a certain class Cu, the number of pieces of learning data NtchrCu for the class Cu can be expressed as N+Cu+N−Cu.
In the present embodiment, the numbers of pieces of learning data NtchrCu for all classes Cu are normalized such that the number of pieces of learning data NtchrCu for each class is equal to a number minNtchrCu of pieces of learning data of a class Cu having the smallest number of pieces of learning data. Note that it is necessary to reduce the number of pieces of learning data for classes other than the class having the smallest number of pieces of learning data minNtchrCu. At this time, randomly selected pieces of learning data from among background learning data xibkg may be removed from the negative learning data, to reduce the number of pieces of learning data. The number of pieces of learning data NtchrCu for each class Cu is updated to become the normalized number of pieces of learning data, and the normalizing process with respect to the learning data is completed.
Next, the weight setting process administered on the learning data will be described by the weight setting section 30C. Weighting refers to weighting of the learning data during learning of the weak classifiers of each class Cu. As shown below, weighting values for m classes are set for each piece of learning data xiC.
xiC→wi(wiC1, wiC2, . . . , wiCm)
Here, assuming that C∈ [C1, C2, . . . , Cm, bkg] weighting values wiCu are set with respect to pieces of learning data xiCu within a class Cu, based on the values of the labels ziCu thereof. Specifically, weighting wiCu is set as 1/(2N+Cu) for positive learning data having labels ziCu with values of +1 for a certain class Cu, set as 1/(2N−Cu) for positive learning data having labels ziCu with values of −1 for the class Cu, set as 0 for positive learning data having labels ziCu with values of 0 for the class Cu. Accordingly, the learning data having labels valued 0 are not utilized for learning of the class Cu. Note that N+Cu is the number of pieces of positive learning data within a class Cu, and N−Cu is the number of negative pieces of negative learning data within a class Cu.
Note that the classifier initializing section 30D initializes the classifiers of the classes Cu such that the number of weak classifiers is 0 for each class. That is, the classifiers are initialized such that no weak classifiers are present, by setting the initial values of each classifier to 0 (HC1, HC1, . . . , HCm=0).
The learning section 40 includes: a branch learning section 40A, a completion judging section 40B, a branch timing judging section 40C, a branch structure determining section 40D, a learning data determining section 40E, and a recursive learning section 40F. Hereinafter, the learning processes performed by the learning section 40 will be described. The multi class classifiers which are generated by the present embodiment are those in which a plurality of weak classifiers htCu (t=1−n, n is the number of weak classifier steps) which are linked to have tree structures (that is, HCu=ΣhtCu).
In the present embodiment, histogram type classifying functions are utilized as classifying mechanisms. Weak classifiers are determined by generating histograms that determine scores with respect to the values of features obtained from the learning data. In the classifying mechanisms of histogram type classifying functions, the probability that an object is the object of a classification target class increases as the score is greater in the positive direction, and probability that an object is not the object of a classification target class increases as the score is greater in the negative direction.
Here, the purpose of learning is to determine weak classifiers. For this reason, the learning section 40 employs the labels ziCu and weights wiCu of the learning data xi of each class and defines weighted square errors of the labels ziCu and the scores as loss error, to determine the weak classifiers. The learning section defines a total sum of loss errors for all pieces of learning data xi in this manner. For example, the amount of loss error JC1 for class C1 may be defined by Formula (1) below. Note that in Formula (1), Ntchr is the total number of pieces of learning data.
Then, the branch learning section 40A defines the total sum of loss errors JCu for all classes within each branch (or the root) as classification loss error Jwse according to Formula (2) below. Note that Formula 2 is a formula for calculating classification loss error in cases that the degree of importance for each class being learned is the same. In the case that the degree of importance of the classes being learned are different, the degree of importance for each class in Formula (2) may be weighted. Classification loss error, in which weighting is performed with respect to the degrees of importance, can be calculated by Formula (2′).
wherein γC1, γC2, γCm, are weights (degrees of importance) for classes C1, C2, . . . Cm, respectively.
Next, the branch learning section 40A determines weak classifiers htCu such that the classification loss error Jwse becomes minimal (Step ST3). In the present embodiment, the classifying mechanisms are histogram type classifying functions. Therefore, weak classifiers htCu are determined by generating histograms to determine scores with respect to features obtained from learning data. Note that the method by which the weak classifiers htCu are determined will be described later. After the weak classifiers htCu are determined in this manner, the weights wiCu of the learning data xiCu are updated as shown in Formula (3) below (step ST4). Note that the updated weights wiCu are normalized as shown in Formula (4) below. In Formula (3), htCu represents scores output by the weak classifiers with respect to the learning data xiCu.
Here, in the case that the score output by a weak classifier htCu with respect to a piece of learning data is positive, the probability that the learning data is an object is the object of a classification target class is high, and if the score output by a weak classifier htCu with respect to a piece of learning data is negative, the probability that the learning data is an object is the object of a classification target class is low. For this reason, if scores are positive for pieces of learning data having labels htCu valued +1, the weighting wiCu is updated to become smaller, and if scores are negative, the weighting wiCu is updated to become greater. Meanwhile, if scores are positive for pieces of learning data having labels htCu valued −1, the weighting wiCu is updated to become greater, and if scores are negative, the weighting wiCu is updated to become smaller. This means that if a weak classifier htCu classifies a piece of positive learning data and the score output thereby is positive, the weighting of the piece of learning data is updated to become smaller, and if the score output by the weak classifier htCu is negative, the weighting of the piece of learning data is updated to become greater. Likewise, if a weak classifier htCu classifies a piece of negative learning data and the score output thereby is positive, the weighting of the piece of learning data is updated to become greater, and if the score output by the weak classifier htCu is negative, the weighting of the piece of learning data is updated to become smaller.
Weak classifiers htCu are determined for each class of each branch (or root), and the weights wiCu are updated in this manner. Thereafter, the branch learning section 40A adds newly determined weak classifiers htCu to previously determined weak classifiers (step ST5). Note that in a first process, there are no weak classifiers in the classes. Therefore, weak classifiers htCu for the first step of each class are added in the first process. Newly determined weak classifiers are added thereafter, in a second and subsequent processes.
After new weak classifiers htCu are added to each class in this manner, the completion judging section 40B judges whether to complete learning. Specifically, it is judged whether the percentage of correct answers of a combination HCu=ΣhtCu of n weak classifiers htCu which have been determined up to that point exceeds a predetermined threshold value Th1 (step ST6). That is, the weak classifiers htCu which have been determined up to that point are combined and utilized to classify positive learning data for each class. It is judged whether the percentage of results of classification that match the correct answers as to whether the pieces of learning data actually represent the object of the classification target class exceeds the threshold value Th1. In cases that the percentage of correct answers exceeds the predetermined threshold value Th1, the classification target object can be classified with a sufficiently high probability by using the weak classifiers htCu which have been determined up to that point. Therefore, the classifiers are set for the classes (step ST7), and the learning process is completed.
In contrast, if the percentage of correct answers is the threshold value Th1 or less, the completion judging section 40B judges whether the current number of weak classifiers htCu within each class has reached a predetermined threshold value Th2 (step ST8). If the number of weak classifiers htCu has reached the predetermined threshold value Th2, the process proceeds to step ST7, the classifiers are set for the classes (step ST7), and the learning process is completed, because if the number of weak classifiers htCu is increased further, the learning process and the classifying process by the classifiers will require long amounts of time.
In the case that the number of weak classifiers htCu has not reached the threshold value Th2, the branch timing judging section 40C of the learning section 40 judges whether learning has reached a branching timing (step ST9). Specifically, the branch timing judging section 40C calculates a difference ΔJwse between classification loss error Jwse calculated by determined weak classifiers htCu and classification loss error Jwse-1 calculated by weak classifiers htCu determined in a previous process for all classes. Then, the branch timing judging section 40C judges whether a branching timing has been reached, based on whether the difference ΔJwse is less than a predetermined threshold value Th3 for all classes.
Here, in the learning process of the present embodiment, the number of weak classifiers increases as learning proceeds, and classification loss error decreases accompanying the increase in the number of weak classifiers.
For this reason, the branch timing judging section 40C judges whether a branching timing has been reached, based on whether the difference ΔJwse is less than a predetermined threshold value Th3 for all classes Cu included in each branch (or root). In the case that the difference ΔJwse is less than the predetermined threshold value Th3 for all classes Cu, the positions of the weak classifiers htCu determined up to that point are set as branching positions (step ST10). Next, the branch structure determining section 40D determines the branching structures at the branching positions (step ST11). The manner in which the branching structures are determined will be described later. After the branching structures are determined, the learning data determining section 40E of the learning section 40 determines learning data to be utilized for learning by each class Cu after branching (step ST12). The manner in which the learning data to be utilized for learning after branching are determined will also be described later. After the learning data are determined, the recursive learning section 40F causes the initializing section 30 to perform initializing processes other than the weight setting processes, that is, the labeling of learning data, the normalization of the numbers of pieces of learning data, and the initialization of the classifiers, such that the same learning as prior to branching can be performed after branching (step ST13). Then, the recursive learning section 40F returns to step ST3 and repeats the steps of the process therefrom, to perform learning that shares features in each branch which is a branching destination and to determine additional weak classifiers htCu to link the branching destinations with the weak classifiers htCu which were determined prior to branching. In this case, the weights wiCu which have been set already are utilized. Note that the filters ft which are employed for second and subsequent learning steps are arbitrarily selected. Therefore, there are cases in which the same filter ft is selected again before learning is completed.
Note that in the case that it is judged at step ST9 that a branching timing has not been reached, that is, in the case that the difference in loss errors ΔJwse for all classes is not less than the threshold value Th3, the process returns to step ST3 and learning is repeated, to determine additional weak classifiers htCu to be linked with weak classifiers htCu which have already been determined. N this case as well, the filters ft which are employed for second and subsequent learning steps are arbitrarily selected. Therefore, there are cases in which the same filter ft is selected again before learning is completed.
The determined weak classifiers htCu are linked linearly in the order that they are determined. In addition, score tables are generated for calculating scores according to features, based on histograms with respect to each weak classifier htCu. Note that the histograms themselves may be employed as the score tables. In this case, the classification points of the histograms become the scores. The multi class classifiers are generated by performing learning of classifiers for each class in this manner.
Next, the process by which the branch structure determining section 40D determines branching structures will be described. In the present embodiment, the branching structures define branching conditions and the number of branching destinations. Branching conditions are conditions that determine how the learning data are branched among classes of the branching destinations following branching, and how the features are to be shared. The branching structure candidate pool 50 has a plurality of branching structure candidates that define various branching conditions and numbers of branching destinations for classifiers.
Here, how the learning data xiCu are branched within branching structure Xbr1 will be described in detail. In branching structure Xbr1, scores ScorexCu (u=1˜3) with respect to a piece of learning data xiCu are calculated using the weak classifiers of each class which are generated prior to branching. Then, the piece of learning data is branched to the leaf node corresponding to the class in which the calculated score is the highest. For example, in the case that ScorexC1 assumes the highest value, the piece of learning data is branched into leaf node Gr1. In addition, how the learning data xiCu are branched within branching structure Xbr2 will be described in detail. In branching structure Xbr2, scores ScorexCu (u=1˜3) with respect to apiece of learning data xiCu are calculated using the weak classifiers of each class which are generated prior to branching. Then, the scores are ranked, and the piece of learning data is branched to the leaf node corresponding to the two classes having the top two rankings. For example, in the case that ScorexC1 and ScorexC2 assume the two highest values, the piece of learning data is branched into leaf nodes Gr1, which corresponds to classes C1 and C2. In branching structures Xbr3 through Xbr5, scores ScorexCu (u=1˜3) are calculated and ranked in the same manner as in branching structure Xbr2. Then, the learning data are branched to the leaf nodes corresponding to the class in which the rankings are highest. For example, in branching structure Xbr5, if ScorexC3 assumes the highest value, the piece of learning data is branched into leaf node Gr1 which corresponds to Class C3. Meanwhile, if ScorexC1 or ScorexC2 assumes the highest value, the piece of learning data is branched into leaf node Gr2, which corresponds to classes C1 and C2.
Here, when positive learning data for the classes are branched by branching structures, positive learning data for a certain class are to be branched into the branching destination in which the class belongs. However, in multi class classifiers up to the branching timing, there are cases in which learning data are branched to branching destinations that the classes they correspond to do not belong in. This is caused by reasons, such as not all pieces of learning data are correctly classified, branching conditions of branching structures not being appropriate, etc. In these cases, it is preferable for the erroneously branched pieces of learning data to not be used for further learning after the branching, in order to improve learning accuracy. Accordingly, learning data, which are branched into branching destinations that the classes that they correspond to do not belong in, are lost by branching. In the present embodiment, this loss is defined as branching loss error. The learning section 40 calculates branching loss error as described below.
The branching structure determining section 40D calculates branching loss error BLxbrTchr for all of the learning data by weighting and adding branching loss errors BLxbrCu of all of the classes Cu according to Formula (6) below. Note that in Formula (6), wBLu is weighting with respect to branching loss errors BLxbrCu of each class. Here, the weighting wBLu is set by a designer. For example, in the case that the degrees of importance of the classes being learned are the same, wBLu is set to 1.0. In contrast, in the case that the degrees of importance of the classes being learned are different, the weighting wBLu is set to be greater for a class of forward facing faces than for other classes, for example. The learning section 40 employs all of the branching structures to calculate branching loss error BLxbrTchr for each branching structure, and determines a branching structure by selecting a branching structure that yields the smallest branching loss error BLxbrTchr.
Next, the process by which the learning data determining section 40E determines learning data to be employed after branching will be described. The learning data determining section 40E determines learning data to be utilized by each class in the branching destination leaf nodes Grd. The determination of learning data utilizes the counting results of the numbers of pieces of learning data within each of the leaf nodes Gr1 through Grb. For example, in the case that the branching structure is determined to be branching structure Xbr2 of
Leaning that shares features is continued following branching, according to the branching conditions of the determined branching structure.
Hereinafter, learning after the branching structure is determined will be described in greater detail.
The weak classifiers of classes C1 through C5 illustrated in
Note that after branching, the numbers of pieces of learning data are normalized in a similar manner to that performed prior to branching, such that the numbers of pieces of learning data for each class within each of leaf nodes Gr1 through Gr4 become equal. In addition, the classifiers are initialized such that the number of classifiers in each class within each of leaf nodes Gr1 through Gr4 becomes 0. Note that the weighting of the pieces of learning data is not initialized, and the weighting prior to branching is inherited after branching.
Weak classifiers are determined for each of leaf nodes Gr1 through Gr4 according to the flow chart of
Here, the reason why leaf nodes Gr2 and Gr3 do not branch again is because the results of multi class learning for classes C2 and C3 that shares features have reached desirable classification performance. The classifiers illustrated in
Next, the process by which weak classifiers are determined by the branch learning section 40A will be described. The present embodiment utilizes histogram type classifying functions as classifying mechanisms.
In the present embodiment, weak classifiers htCu are determined by generating histograms which are classifying mechanisms of the weak classifiers htCu, such that the classification loss error Jwse becomes minimal. Here, the weak classifiers htCu of each step share features. However, a description will be given for a case in which features are not shared among some classes, to describe a general process. Thereby, the classification loss error Jwse of Formula (2) can be modified to a sum of loss error Jshare for classes that share features and loss error Junshare for classes that do not share features, as shown in Formula (7) below. Note that because htCu(xi)=gtCu(ft(xi)), the values of the horizontal axis of the histogram is substituted as ft(xi)=ri in Formula (7). In Formula (7), the “share” and “unshare” beneath the Σ indicate that a total sum of loss error for classes that share features and a total sum of loss error for classes that do not share features are calculated.
In Formula (7), if the values of both loss error Jshare and loss error Junshare become minimal, a minimal classification loss error Jwse can be achieved. For this reason, assuming that the number of classes that share features is k, the loss error Jshare of classes that share features can be represented by Formula (8) below. Note that in Formula (8), s1 through sk indicate the numerals of classes, which have been renumbered as those that share features, from among the classes of all of the classifiers. In Formula (8), if the items toward the right side of each line are represented as JCs1share through JCs1share, Formula (8) may be rewritten as Formula (9).
In Formula (9), if the values of JCs1share through JCs1share, which are the items toward the right side of each line of Formula (8) that represent loss errors for classes that share features, become minimal, a minimal classification loss error Jshare can be achieved. Here, because the calculation for minimizing loss errors JCs1share through JCs1share are the same for all classes, a calculation for minimizing loss error JCsjshare for a class Csj (j=1˜k) will be described.
Here, the values that the features can assume are limited to a predetermined range. The present embodiment segments ranges within the horizontal axis of the histogram and quantizes them into sections P1 through Pv (v=100, for example), as illustrated in
Because the histogram is quantized into sections P1 through PV as illustrated in
Here, the values of labels ziCsj in Formula (11) are either +1 or −1. Accordingly, (ziCsjθqCsj) is either (1−θqCsj) or (−1−θqCsj). Accordingly, Formula (11) can be modified into Formula (12) below.
If the value calculated by Formula (12) becomes minimal, the loss error JCsjshare will become minimal. The value of θCsj may be determined for each section Pq such that the value calculated by Formula (12) partially differentiated by θqCsj becomes 0. Accordingly, θqCsj can be calculated by Formula (13) below.
Here, WqCsj+ is the total sum of weights wiCsj with respect to pieces of learning data xi having labels valued 1, that is, positive learning data xi, within sections Pq of the histogram. WqCsj− is the total sum of weights wiCsj with respect to pieces of learning data xi having labels valued ¥1, that is, negative learning data xi, within sections Pq of the histogram. Because the weights wiCsj are known, wqCsj+ and WqCsj− can be calculated, and accordingly, the vertical axis of the histogram for sections Pq, that is, the scores θqCsj, can be calculated by Formula (13) above.
The weak classifiers htCu are determined for the class Csj that shares features, by calculating the values of the vertical axis, that is, the scores θqCsj, for all sections P1 through Pv of a histogram which is the classifying mechanism of the weak classifiers htCu to generate a histogram such that the loss error JCsjshare becomes minimal, by the steps described above. An example of a generated histogram is illustrated in
Next, how to minimize loss error Junshare with respect to classes that do not share features will be considered. The loss error JCsjunshare for a class Csj which does not share features can be expressed by Formula (14) below. Here, the characteristic of the present embodiment is that features are shared. Therefore, the scores gtCu(ri) for classes that do not share features are designated as a constant ρCsj as shown in Formula (15), and a constant ρCsj that yields the minimum loss error JCsjunshare is determined.
If the value calculated by Formula (15) is minimized, the loss error JCsjunshare can be minimized. In order to minimize the value calculated by Formula (15), ρCsj may be set to a value such that the value calculated by Formula (15) partially differentiated by ρCsj becomes 0. Accordingly, ρCsj can be calculated by Formula (16) below.
The present embodiment determines the branching positions and branching structures of weak classifiers of a plurality of classes according to the learning results of the weak classifiers of each class, as described above. For this reason, the branching positions and the branching structures of the weak classifiers during multi class learning does not depend on the designer. As a result, classification of objects can be performed accurately and at high speeds using the generated classifiers. In addition, the occurrence of learning not converging will decrease compared to cases in which branching positions and branching structures are determined by designers, and as a result, the converging properties of learning can be improved.
In addition, learning results prior to branching may be inherited for learning of the weak classifiers following the branching. In this case, the weak classifiers are seamlessly connected prior to and following branching. Therefore, the consistency of classifying structures can be maintained in classifiers generated by the present invention. Accordingly, both classification accuracy and high classification speed can be realized.
As a result of experiments conducted by the present applicant, the stability and flexibility of learning of the classifiers generated by the present invention are higher than those of classifiers generated by the Joint Boost method. In addition, it was also found that the accuracy and detected speed of classifiers generated by the present invention were higher than those of classifiers generated by the Joint Boost method.
Note that the embodiment described above employs a histogram type classifying function as a classifying mechanism. Alternatively, it is possible to employ a decision tree as a classifying function. Hereinafter, determination of weak classifiers in the case that a decision tree is employed as the classifying function will be described. In the case that a decision tree is employed as the classifying function as well, the weak classifiers htCu are determined such that classification loss error Jwse becomes minimal. For this reason, in the case that a decision tree is employed as the classifying function as well, calculations for minimizing the loss error JCsjshare for a class Csj that shares features as shown in Formula (9) will be described. Note that in the following description, a decision tree is defined as shown in Formula (17) below. In Formula (17), ΦtCsj is a threshold value, and is defined in the filter for features. In addition, δ( ) is a delta function that assumes a value of 1 when ri>ΦtCsj and assumes a value of 0 in all other cases. Further, atCsj and btCsj are parameters. By defining a decision tree in this manner, the relationship between the input and the output of the decision tree becomes that illustrated in
g
t
Csj(ri)=atCsj·δ(ri>φtCsj)+btCsj (17)
In the embodiment in which the classifying mechanism is a decision tree, the loss error JCsjshare for a class Csj that shares features can be expressed by Formula (18) below.
If the value calculated by Formula (18) is minimized, the loss error JCsjshare can be minimized. In order to minimize the value calculated by Formula (18), the values of atCsj+btCsj and btCsj may be set to a value such that the value calculated by Formula (18) partially differentiated by atCsj and btCsj respectively becomes 0. The value of atCsj+btCsj may be determined by partially differentiating the value calculated by Formula (18) by atCsj as shown in Formula (19) below. Note that ri>φqCsj beneath the Σ in Formula (19) indicates that the total sum of weights wiCsj when ri>φqCsj and products of the weights wiCsj and labels ziCsj are calculated. Accordingly, Formula (19) is equivalent to Formula (20).
Meanwhile, the value of btCsj may be set to a value such that the value calculated by Formula (18) partially differentiated by btCsj becomes 0, as shown in Formula (22) below.
weights wiCsj are normalized, and therefore
The value of btCsj can be calculated from Formula (20) and Formula (21).
Note that with respect to classes that do not share features in the case that the classifying mechanism is a decision tree, the values output by the decision tree may be designated as a constant ρCsj, and a constant ρCsj that yields the minimum loss error JCsjunshare may be determined in the same manner as in the case that the classifying mechanism is a histogram type classifying function. In this case, the constant ρCsj may be determined in the same manner as shown in Formula (16).
As described above, in the case that the classifying mechanism is a decision tree as well, the present invention determines the branching positions and the branching structures of weak classifiers of a plurality of classes according to the results of learning of the weak classifiers in each class. For this reason, the branching positions and the branching structures of the weak classifiers during multi class learning does not depend on a user. As a result, classification of objects can be performed accurately and at high speeds using the generated classifiers. In addition, the occurrence of learning not converging will decrease compared to cases in which branching positions and branching structures are determined by designers, and as a result, the converging properties of learning can be improved.
An apparatus 1 according to an embodiment of the present invention has been described above. However, a program that causes a computer to function as means corresponding to the learning data input section 10, the feature pool 20, the initializing section 30, the learning section 40, and the branching structure candidate pool 50 described above to perform the process illustrated in
Number | Date | Country | Kind |
---|---|---|---|
065537/2010 | Mar 2010 | JP | national |