Higher-order Losses and Optimization for Low-level and Deep Segmentation