Ejemplo n.º 1
1
  private static void testAdaBoost(int features) {
    Vector<IntegralImage> falseSet = new Vector<IntegralImage>();
    Vector<IntegralImage> trueSet = new Vector<IntegralImage>();
    {
      File noDirectory = new File("C:/Users/BOOBIES/Desktop/trainingData/no");
      File yesDirectory = new File("C:/Users/BOOBIES/Desktop/trainingData/yes");

      System.out.println("no directory = " + noDirectory);
      System.out.println("yes directory = " + yesDirectory);
      loadGifsAtDirectoryIntoVector(falseSet, noDirectory);
      loadGifsAtDirectoryIntoVector(trueSet, yesDirectory);
    }
    System.out.println("Gifs loaded!\t\t\ttrue:" + trueSet.size() + " false:" + falseSet.size());

    ViolaJones vj = new ViolaJones();
    Vector<HaarFeature> allFeatures = vj.getHaarFeatures();
    System.out.println("Generated all features!\t\tcount:" + allFeatures.size());

    AdaBoost boost = new AdaBoost();
    Vector<HaarFeature> bestFeatures =
        boost.startTraining(trueSet, falseSet, allFeatures, features);

    HaarFeatureChain chain = new HaarFeatureChain();
    chain.save(bestFeatures);

    System.out.println("dun learnin!! Wow!");
  }
Ejemplo n.º 2
0
  private static void testStaticFeatureList() {

    Vector<IntegralImage> falseSet = new Vector<IntegralImage>();
    Vector<IntegralImage> trueSet = new Vector<IntegralImage>();
    {
      File noDirectory = new File("C:/Users/BOOBIES/Desktop/trainingData/no");
      File yesDirectory = new File("C:/Users/BOOBIES/Desktop/trainingData/yes");

      System.out.println("no directory = " + noDirectory);
      System.out.println("yes directory = " + yesDirectory);
      loadGifsAtDirectoryIntoVector(falseSet, noDirectory);
      loadGifsAtDirectoryIntoVector(trueSet, yesDirectory);
    }

    HaarFeatureChain hfc = new HaarFeatureChain();
    Vector<HaarFeature> features = hfc.load();

    System.out.println("\ntest " + trueSet.size() + " positives!");
    testTargetFeaturesAgainstImages(features, trueSet);

    System.out.println("\ntest " + falseSet.size() + " negatives!");
    testTargetFeaturesAgainstImages(features, falseSet);
  }