Unsupervised learning of foreground object detection