pymatting / foreground-estimation-evaluation

Evaluate the quality of foreground estimation methods
MIT License
2 stars 0 forks source link

Evaluate quality of foreground estimation methods

The authors of [1] provide an amazing dataset at http://alphamatting.com/datasets.php to evaluate alpha matting and foreground estimation methods.

The foreground images are stored in linear RGB TIFF files without whitepoint correction.

Although it makes more sense to do math in linear color spaces, the standard seems to be to use the sRGB color space instead.

This repository computes a whitepoint transformation matrix to transforms the linear RGB TIFF images into the sRGB color space.

Next, the estimate_foreground_ml method from the PyMatting library is used to estimate foreground images and the following three error metrics are computed on the region where 0 < alpha < 1:

Installation and Testing

git clone https://github.com/pymatting/foreground-estimation-evaluation.git
cd foreground-estimation-evaluation
pip3 install -r requirements.txt

python3 scripts/download.py
python3 scripts/fit_whitepoint_matrices.py
python3 scripts/convert_lrgb_to_srgb.py
python3 scripts/estimate_foreground.py
python3 scripts/compute_errors.py
python3 scripts/print_results.py

Final output (naive foreground estimation method run separately):

| Foreground | Alpha method         | Metric | Error         |
| ---------- | -------------------- | ------ | ------------- |
| naive      | gt_training_highres  | SAD    | 41.39 * 10^+3 |
| naive      | gt_training_highres  | MSE    |  5.66 * 10^-3 |
| naive      | gt_training_highres  | GRAD   | 20.44 * 10^+3 |
| multilevel | gt_training_highres  | SAD    | 20.85 * 10^+3 |
| multilevel | gt_training_highres  | MSE    |  1.44 * 10^-3 |
| multilevel | gt_training_highres  | GRAD   |  8.89 * 10^+3 |
| multilevel | cf                   | SAD    | 42.07 * 10^+3 |
| multilevel | cf                   | MSE    |  4.21 * 10^-3 |
| multilevel | cf                   | GRAD   | 16.57 * 10^+3 |
| multilevel | idx                  | SAD    | 47.90 * 10^+3 |
| multilevel | idx                  | MSE    |  5.66 * 10^-3 |
| multilevel | idx                  | GRAD   | 15.80 * 10^+3 |
| multilevel | ifm                  | SAD    | 29.36 * 10^+3 |
| multilevel | ifm                  | MSE    |  2.35 * 10^-3 |
| multilevel | ifm                  | GRAD   | 11.33 * 10^+3 |
| multilevel | knn                  | SAD    | 31.71 * 10^+3 |
| multilevel | knn                  | MSE    |  2.38 * 10^-3 |
| multilevel | knn                  | GRAD   | 11.96 * 10^+3 |

Notes

References

[1] Christoph Rhemann, Carsten Rother, Jue Wang, Margrit Gelautz, Pushmeet Kohli, Pamela Rott. A Perceptually Motivated Online Benchmark for Image Matting. Conference on Computer Vision and Pattern Recognition (CVPR), June 2009.