Context Models for Understanding Images and Videos