/DefectDetection

[WACV'18] Learning to Detect Multiple Photographic Defects

Primary LanguagePython

DefectDetection

  • Caffe implementation for our WACV'18 paper (supplemental) on multiple photographic defect detection.
  • Contact: Ning Yu (ny4kt AT virginia DOT edu)

Prerequisites

  • Linux
  • NVIDIA GPU + CUDA CuDNN
  • Caffe

Dataset

  • Training image addresses and seven defect severity ground truth are in the file data/train/defect_training_gt.csv.
  • Testing image addresses and seven defect severity ground truth are in the file data/test/defect_testing_gt.csv.

Network Architectures (visualize from ethereon)

  • Multi-column holistic-input GoogLeNet is in the file prototxt/GoogLeNet/holistic/deploy_holistic.prototxt.
  • Multi-column patch-input GoogLeNet is in the file prototxt/GoogLeNet/patch/deploy_patch.prototxt.

Pre-trained Models

Infogain Weights

  • If users launch their own training or testing with the infogain loss as Eq. 1 in our paper, they can use our pre-computed weights at data/infogain_mat/, which follows the formulation as Eq. 4 in our supplemental material.

Testing

  • First download testing images from the addresses in the first column in the file data/test/defect_testing_gt.csv into data/test/original_resolution/. Or put customized images into that directory.
  • Then run
python test.py -iPath data/test/original_resolution -oPath output/GoogLeNet -holisticDeployPath prototxt/GoogLeNet/holistic/deploy_holistic.prototxt -holisticWeightsPath model/GoogLeNet/weights_holistic.caffemodel -patchDeployPath prototxt/GoogLeNet/patch/deploy_patch.prototxt -patchWeightsPath model/GoogLeNet/weights_patch.caffemodel -gpu 0
  • The final seven defect severity prediction results are saved in the file output/GoogLeNet/defect_scores_combined.csv.
  • Testing images are sorted in the descent order according to each defect severity prediction and visualized correspondingly to the file output/GoogLeNet/defect_scores_combined_*.html.

Evaluation

  • We use the cross-class ranking correlation (proposed in Section 3.2 in our paper) to evaluate the testing results.
  • Assuming the rows and columns of data/test/defect_testing_gt.csv and output/GoogLeNet/defect_scores_combined.csv align to each other, run
python evaluate.py -gtPath data/test/defect_testing_gt.csv -predPath output/GoogLeNet/defect_scores_combined.csv -oPath output/GoogLeNet
  • The evaluation measures are saved in the file output/GoogLeNet/evaluation.csv.

Citation

@inproceedings{WACV-2018,
    author = {Yu, Ning and Shen, Xiaohui and Lin, Zhe and Měch, Radomír and Barnes, Connelly},
    title = {Learning to Detect Multiple Photographic Defects},
    booktitle = {IEEE Winter Conference on Applications of Computer Vision},
    year = {2018}
}

Acknowledgement

  • This research is supported by Adobe Research Funding.
  • We express gratitudes to the popular caffe-googlenet-bn repository as we benefit a lot from their code.

Note

  • It is for non-commercial research purpose only. Adobe has been filing a patent for this work.