SMS dit: Class-based grouping in perspective images