Learning Robust Tractable Models for Vision