luoyetx / JDA

C++ implementation of Joint Cascade Face Detection and Alignment.
BSD 3-Clause "New" or "Revised" License
184 stars 140 forks source link

Scale problem #6

Closed GarrickLin closed 8 years ago

GarrickLin commented 9 years ago

in JDA/src/jda/data.cpp line34 to 43

            switch (feature.scale) {
            case Feature::ORIGIN:
                scale = 1.0; break;
            case Feature::HALF:
                scale = 0.5; break;
            case Feature::QUARTER:
                scale = 0.25; break;
            default:
                scale = 1.0; break;
            }

for example, if you want to pick up a pix in half scale of original image, you must mutilply a scale of 2(or sqrt(2)?) but not 0.5, so the code should be like this:

            switch (feature.scale) {
            case Feature::ORIGIN:
                scale = 1.0; break;
            case Feature::HALF:
                scale = 2; break;
            case Feature::QUARTER:
                scale = 4; break;
            default:
                scale = 1.0; break;
            }
luoyetx commented 9 years ago

To my understanding, the training samples will be scaled with size 80x80, 40x40, 20x20 (maybe wrong). Currently, I scale the offset not the image, the idea is borrowed form FaceDetect/jointCascade_py, but we can change it later.

luoyetx commented 9 years ago

Yes, the scale is wrong in the code, I will change it. Thanks a lot for pointing out this error.

luoyetx commented 9 years ago

@GreenKing I find it is wrong to scale the offset, since the offset is relative range in [0, radius]. No matter how we scale the image, the offset shouldn't be changed. I will use three scaled image to calculate the feature.

GarrickLin commented 9 years ago

I saw it. You mean offset is in range [0, radius]. If you scale the offset directly, which just means you are scaling the radius. But this will be a little bit different with scaling the images. Isn't it?

luoyetx commented 9 years ago

no, they are different. Since offset is relative to the size of image while radius is relative too, scaling the image means we have different views of the same point, while scaling the offset means we have different points under the same view. I think they are different, so I will reimplement the way to calculate the feature value. The scaled image size I think will be 80x80, 56x56 and 40x40. Am I right?

GarrickLin commented 9 years ago
  1. I agree with your. A pixel in down sampled image might represent an area in origin image.
  2. Actually, I am not sure. But I prefer sqrt(2).