예제 #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!");
  }