sai-bi / FaceAlignment

Face Alignment by Explicit Shape Regression
MIT License
339 stars 205 forks source link

Random Projection #33

Open lck1201 opened 7 years ago

lck1201 commented 7 years ago

I see the paper《Random projection in dimensionality reduction: Applications to image and text data》,which is quite different from your code.

        // RNG random_generator(i);
        Mat_<double> random_direction(landmark_num_ , 2);
        random_generator.fill(random_direction, RNG::UNIFORM, -1.1, 1.1);

        normalize(random_direction,random_direction);
        vector<double> projection_result(regression_targets.size(), 0);  //size = (1, image_num)
        // project regression targets along the random direction 
        for(int j = 0; j < regression_targets.size(); j++){ //for each sample
            double temp = 0;
            temp = sum(regression_targets[j].mul(random_direction))[0]; 
            projection_result[j] = temp;
        } 

However, in the paper, image The left of equation is the projected result, k is the lower dimension, d is the current dimension, N is the number of data. Your projection matrix(random_direction),however, is not consistent with the paper. Neither the computation is.

Second, you fill the matrix by random_generator.fill(random_direction, RNG::UNIFORM, -1.1, 1.1); In the paper, image It subjects itself to some distribution. So what's your consideration of generating total random matrix?