Raschka-research-group / coral-cnn

Rank Consistent Ordinal Regression for Neural Networks with Application to Age Estimation
https://www.sciencedirect.com/science/article/pii/S016786552030413X
MIT License
335 stars 62 forks source link

Prediction on low resolution images #14

Open KwanghyunOn opened 4 years ago

KwanghyunOn commented 4 years ago

Hello, I'm trying to predict the age of my custom test images with your pretrained model, but it doesn't seem to work well. (I didn't calculated MAE or any other evaluation metrics, but just by seeing the results and comparing to the images, it seems to be so inaccurate and inconsistent; predicting totally different ages for similar images.) One thing I am concerned is that my test dataset has low resolution. (This is because my images are from low resolution video.) Resolution of the images in the dataset is most likely around 64 x 64.

So here are my questions.

  1. Do you think using low resolution images will give significant decrease in accuracy?
  2. What do you suggest to improve accuracy? (I am thinking about training the model with low-resolution datasets; like 64x64 resized CACD.)
  3. Is CORAL-CNN model sensitive to its trained dataset? Is it better to fine-tune the model or retrain the model if you have a new dataset?
rasbt commented 4 years ago

Hi there,

it could be due to the low resolution indeed. Also, I suspect that a model trained on one dataset does not generalize well to other datasets. To get a model that gets a better performance on a larger variety of images, you would need to pool all the training sets and train a model on those.

In any case, another thing to consider is the location of the face in the image. I would suggest you use the same cropping and centering that was used for CACD if you are using the pre-trained CACD model. You can find the code for that here

let me know if that improves things.

KwanghyunOn commented 4 years ago

Thank you so much for the speedy reply. I've just tested the AFAD test dataset with transform.resize(64,64) added before transform.resize(128,128). The resulting MAE was 3.54 which was comparable to the original MAE 3.48. It seems that low resolution really doesn't affect much. So maybe the alignment part is the problem. I'll checkout and let you know.

rasbt commented 4 years ago

That makes sense! One thing to note though is that AFAD does come with several low-resolution images, which could result in the AFAD network being a bit more robust to that. Not sure if the same is true with CACD. I suspect the cropping is a bigger factor though.

KwanghyunOn commented 4 years ago

Maybe I should try with CACD, too. By the way, why do you use different code when preprocessing CACD and MORPH2? Which one do you suggest when applying to new dataset?

rasbt commented 4 years ago

Both preprocessing steps work fine. The one for MORPH-2 is a bit more expensive (takes much longer). The main reason was that we already had the datasets preprocessed from other projects where we only worked with one or the other dataset. If you work with the pre-trained CACD model, it'd be better to use the CACD preprocessing.

KwanghyunOn commented 4 years ago

Here are the MAE values when datasets are resized in to smaller shape. AFAD seems little bit more robust to low resolution images.

Resized shape AFAD CACD
128 x 128 (Original) 3.48 5.48
64 x 64 3.54 5.96
32 x 32 3.79 8.06
16 x 16 4.70 10.82
KwanghyunOn commented 4 years ago

[MAE values for different alignments with AAF(All-Age-Faces) dataset] Using the same alignment method gives significant improvement in accuracy. (Even when you use AFAD-pretrained model.) I think using AFAD-model gets better MAE than using CACD-model because (1) AAF dataset mostly includes Asian images. (2) I ignored the images with ages that cannot be detected by the dataset, and AFAD dataset has narrower range than CACD.

I think applying the same alignment used in AFAD will give the best result for the AAF dataset.

Pretrained Model CACD Alignment Custom Alignment
CACD 8.71 10.46
AFAD 4.94 7.06
rasbt commented 4 years ago

Here are the MAE values when datasets are resized in to smaller shape. AFAD seems little bit more robust to low resolution images.

Thanks for this analysis. That's very interesting to know. I think that's then consistent with the hypothesis that we expect it to work better on AFAD, because AFAD itself contains several low resolution images (CACD images are all consistent in the resolution, I think).

I think applying the same alignment used in AFAD will give the best result for the AAF dataset.

Yes, that would make sense.

Using the same alignment method gives significant improvement in accuracy.

Good to hear that this helped a little.