private boolean checkForNegativeValueFeatures(Classifier classifier) { if (classifier instanceof ValueClassifier) { if (((ValueClassifier) classifier).value < 0) return true; } else { if (checkForNegativeValueFeatures(((HaarFeatureClassifier) classifier).left)) return true; if (checkForNegativeValueFeatures(((HaarFeatureClassifier) classifier).right)) return true; } return false; }
private boolean checkForNegativeValueFeatures(Classifier classifier) { if (classifier instanceof ValueClassifier) { if (((ValueClassifier) classifier).value < 0) return true; } else { if (checkForNegativeValueFeatures(((HaarFeatureClassifier) classifier).left)) return true; if (checkForNegativeValueFeatures(((HaarFeatureClassifier) classifier).right)) return true; } return false; }
private boolean checkForNegativeValueFeatures() { for (int i = 0; i < ensemble.length; i++) { if (checkForNegativeValueFeatures(ensemble[i])) return true; } return false; }
private boolean checkForNegativeValueFeatures() { for (int i = 0; i < ensemble.length; i++) { if (checkForNegativeValueFeatures(ensemble[i])) return true; } return false; }
/** * Construct a new stage. * * @param threshold * the threshold for the stage to pass * @param trees * the classifier trees in the stage * @param successStage * the next stage after this one, or null if this is the last * @param failureStage * the failure stage (for trees rather than cascades) */ public Stage(float threshold, Classifier[] trees, Stage successStage, Stage failureStage) { this.threshold = threshold; this.ensemble = trees; this.successStage = successStage; this.failureStage = failureStage; this.hasNegativeValueFeatures = checkForNegativeValueFeatures(); }
/** * Construct a new stage. * * @param threshold * the threshold for the stage to pass * @param trees * the classifier trees in the stage * @param successStage * the next stage after this one, or null if this is the last * @param failureStage * the failure stage (for trees rather than cascades) */ public Stage(float threshold, Classifier[] trees, Stage successStage, Stage failureStage) { this.threshold = threshold; this.ensemble = trees; this.successStage = successStage; this.failureStage = failureStage; this.hasNegativeValueFeatures = checkForNegativeValueFeatures(); }