Learning multiple visual tasks while discovering their structure