Imported from https://github.com/JXingZhao/ContrastPrior