|
UC Berkeley Group for User Interface Research Updated November 17, 2000 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.berkeley.guir.lib.gesture.Classifier
Gesture classifier/recogizer, using Dean Rubine's algorithm, with guidance from Rob Miller's C++ port, which is part of the Amulet package. Note: for performance reasons, the Classifier does not retrain automatically when the underlying GestureSet changes. It will retrain automatically the next time it needs to (e.g., for classify()). Known bugs: training may take some time, but train() does not check to see if its thread gets interrupted.
Inner Class Summary | |
class |
Classifier.FeatureDirection
|
protected class |
Classifier.MyCollectionListener
|
protected class |
Classifier.MyPropChangeListener
|
class |
Classifier.Result
Used to return the results of a classification. |
Field Summary | |
protected double[][] |
ccm
|
protected double[][] |
ccmInv
|
protected GestureCategory |
dotCategory
|
protected List |
enabledCategories
|
protected static double |
EPSILON
|
protected Class[] |
featureClasses
|
protected BitSet |
featuresUsed
|
protected GestureSet |
gestureSet
|
protected double[][] |
meanFeatureValues
|
static String |
MISRECOGNIZED_PROP
Set on gestures that are misrecognized, with a Result value |
protected CollectionListener |
myCollectionListener
|
protected PropertyChangeListener |
myPropChangeListener
|
protected PropertyChangeSupport |
propChangeSupport
|
protected boolean |
trained
|
static String |
TRAINED_PROP
a Boolean property indicating whether the classifier is trained or not |
protected double[][] |
weights
|
Constructor Summary | |
Classifier()
|
|
Classifier(GestureSet gs)
Does not automatically train. |
Method Summary | |
void |
addPropertyChangeListener(PropertyChangeListener listener)
|
void |
addPropertyChangeListener(String propertyName,
PropertyChangeListener listener)
|
double |
categoryDistance(GestureCategory categoryA,
GestureCategory categoryB)
Return the square of the distance between the two categories (which must in the GestureSet). |
double |
categoryDistance(int categoryA,
int categoryB)
Return the square of the distance between the two categories. |
protected void |
checkForInterrupt()
|
Classifier.Result |
classify(Gesture gesture)
Determine which GestureCategory the Gesture is most likely a member of, and return an appropriate Result. |
Classifier.Result |
classifyWithoutTraining(Gesture gesture)
Only call this if you know the GestureSet the classifier is using hasn't changed since the last time classify() or train() was called. |
protected double[][] |
computeCovarianceMatrix(GestureCategory gestureCategory,
double[] meanFeatureVector)
Compute and return covariance matrix and fill in the mean feature value array (if provided) (Note: only upper triangular part computed) |
double |
distanceToCategory(Gesture gesture,
GestureCategory category)
|
double |
distanceToCategory(Gesture gesture,
int catIndex)
|
void |
dump(PrintStream out)
|
void |
dumpMFV(PrintStream out)
Return a matrix where A[Ci][Cj] is a Vector of category Ci examples (i.e. |
void |
dumpRelativeVariance(PrintStream out)
|
int |
findPrincipleComponent(double[] featureVals)
Return the index of the largest component of featureVals, using the current training weights. |
Classifier.FeatureDirection |
findPrincipleFeature(int catA,
int catB)
Find the feature class on which catA and catB differ most (based on current weights). |
protected boolean |
fixClassifier(double[][] ccm,
double[][] ccmInv)
|
static Class[] |
getDefaultFeatureClasses()
|
double[] |
getDistancesByFeature(int catA,
int catB)
Use the current weights to get normalized distances along each feature between two categories. |
protected Feature |
getFeature(GestureCategory gc,
int gIndex,
Class featureClass)
|
protected Feature |
getFeature(GestureCategory gc,
int gIndex,
int fIndex)
|
Class[] |
getFeatureClasses()
|
BitSet |
getFeaturesUsed()
Features actually used in current classification (null if untrained) |
GestureSet |
getGestureSet()
|
double[] |
getNormalizedDistancesByFeature(Gesture gesture,
GestureCategory gc)
Use the weights for the category to get normalized distance of the gesture from the category. |
double[] |
getNormalizedDistancesByFeature(Gesture gesture,
int categoryIndex)
Use the weights for the category to get normalized distance of the gesture from the category. |
double[] |
getNormalizedDistancesByFeature(Gesture gesture,
String categoryName)
Use the weights for the category to get normalized distance of the gesture from the category. |
List |
getTrainingCategories()
Returns an unmodifiable List of the categories that were used to train the classifier. |
double[][] |
getWeights()
|
boolean |
isTrained()
|
double |
MahalanobisDistance(double[] v,
double[] u)
Return the square of the distance between the two vectors. |
static double |
MahalanobisDistance(double[] v,
double[] u,
double[][] sigma)
Return the square of the distance between the two vectors, using the specified dispersion matrix. |
void |
removePropertyChangeListener(PropertyChangeListener listener)
|
void |
removePropertyChangeListener(String propertyName,
PropertyChangeListener listener)
|
void |
setFeatureClasses(Class[] featureClasses)
|
void |
setGestureSet(GestureSet gs)
Does not automatically train. |
protected void |
setTrained(boolean isTrained)
|
boolean |
testRecognition(Gesture gesture)
return true iff the gesture was correctly recognized |
List |
testRecognition(GestureContainer container)
|
List |
testRecognition(Iterator iter)
iter should contain Gestures or GestureContainers. |
List |
testRecognition(Iterator iter,
boolean onlyEnabled)
iter should contain Gestures or GestureContainers. |
void |
train()
(Re)trains the current Classifier. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String TRAINED_PROP
public static final String MISRECOGNIZED_PROP
protected Class[] featureClasses
protected static final double EPSILON
protected GestureSet gestureSet
protected double[][] weights
protected double[][] meanFeatureValues
protected double[][] ccm
protected double[][] ccmInv
protected GestureCategory dotCategory
protected boolean trained
protected BitSet featuresUsed
protected List enabledCategories
protected CollectionListener myCollectionListener
protected PropertyChangeListener myPropChangeListener
protected transient PropertyChangeSupport propChangeSupport
Constructor Detail |
public Classifier()
public Classifier(GestureSet gs)
Method Detail |
public void setFeatureClasses(Class[] featureClasses)
public Class[] getFeatureClasses()
public static Class[] getDefaultFeatureClasses()
public double[][] getWeights()
public void setGestureSet(GestureSet gs)
public GestureSet getGestureSet()
public BitSet getFeaturesUsed()
protected Feature getFeature(GestureCategory gc, int gIndex, int fIndex)
protected Feature getFeature(GestureCategory gc, int gIndex, Class featureClass)
protected double[][] computeCovarianceMatrix(GestureCategory gestureCategory, double[] meanFeatureVector)
protected void setTrained(boolean isTrained)
public boolean isTrained()
protected void checkForInterrupt() throws InterruptedException
public void train() throws TrainingException, InterruptedException
protected boolean fixClassifier(double[][] ccm, double[][] ccmInv)
public Classifier.Result classify(Gesture gesture) throws TrainingException, InterruptedException
public Classifier.Result classifyWithoutTraining(Gesture gesture)
public List testRecognition(GestureContainer container) throws InterruptedException, TrainingException
public List testRecognition(Iterator iter) throws InterruptedException, TrainingException
public List testRecognition(Iterator iter, boolean onlyEnabled) throws InterruptedException, TrainingException
public boolean testRecognition(Gesture gesture) throws InterruptedException, TrainingException
public double categoryDistance(GestureCategory categoryA, GestureCategory categoryB)
public double categoryDistance(int categoryA, int categoryB)
public double distanceToCategory(Gesture gesture, GestureCategory category)
public double distanceToCategory(Gesture gesture, int catIndex)
public double[] getNormalizedDistancesByFeature(Gesture gesture, String categoryName)
public double[] getNormalizedDistancesByFeature(Gesture gesture, GestureCategory gc)
public double[] getNormalizedDistancesByFeature(Gesture gesture, int categoryIndex)
public double[] getDistancesByFeature(int catA, int catB)
public List getTrainingCategories()
public double MahalanobisDistance(double[] v, double[] u)
public static double MahalanobisDistance(double[] v, double[] u, double[][] sigma)
public int findPrincipleComponent(double[] featureVals)
public Classifier.FeatureDirection findPrincipleFeature(int catA, int catB)
public void dumpMFV(PrintStream out)
public void dump(PrintStream out)
public void dumpRelativeVariance(PrintStream out)
public void addPropertyChangeListener(PropertyChangeListener listener)
public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
public void removePropertyChangeListener(PropertyChangeListener listener)
public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)
|
Copyright Information | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |