void cascade (Sample samp[], int nbPos, int nbNeg, float f, float FTarget, float D) { /* f correspond au nombre maximum de faux positif * FTarget est le nombre * D est le taux minimum de detection */ int etape = 3; float FMinus, FCurrent, dMinus, d; FMinus = 1; dMinus = 1; // Initialisation des F(n-1), d(n-1), F(n) et d(n) int nFeat = 2; int neg = nbNeg; printf("1er tableau\n"); writeSam(samp, nbPos, nbNeg); for (int i = 0; i < etape; i++) { nbNeg = neg; Sample *samples = malloc(sizeof (Sample) * (nbPos + nbNeg)); for (int a = 0; a < nbPos + nbNeg; a++) samples[a] = samp[a]; //printf("\n1er tableau %d\n", i); //writeSam(samples, nbPos, nbNeg); StrongClassifier strong; do { FCurrent = FMinus; do { nFeat++; //StrongClassifier strong with n[j] feature; printf("\nTableau %d, %d, %d\n", i, nbPos, nbNeg); writeSam(samples, nbPos, nbNeg); strong = adaBoost(samples, nbPos, nbNeg, nFeat, 162336); //Operation taux de faux positif courrant d = rateSetter(strong, samples, nbPos, 0, 2); FCurrent = rateSetter(strong, samples, nbNeg, nbPos, 2); int j = 2; while(D * dMinus > d) { printf("dMinus, %f d, %f\n",dMinus,d); d = rateSetter(strong, samples, nbPos, 0, j++); } printf("\nd, %f\n",d); FCurrent = rateSetter(strong, samples, nbNeg, nbPos, j); nbNeg = sampleUp(strong, samples, nbPos, nbNeg, j); FMinus = FCurrent; dMinus = d; }while(FCurrent > f*FMinus); }while(FCurrent > FTarget); write(strong); printf("\nTableauSortie %d\n", i); writeSam(samples, nbPos, nbNeg); free(samples); } printf("END\n"); }
int main(int argc, char* argv[]) { boostStruct bst; char input_file_name[1024], model_file_name[1024]; boost_config(&bst); parse_command_line(argc, argv, &input_file_name[0], &model_file_name[0], &bst); read_problem(input_file_name, &bst); adaBoost(&bst); writeModel(&bst, model_file_name); boost_destroy(&bst); }