Learning to Solve Structured Vision Problems