Recursive segmentation and recognition templates for image parsing