1. A method for image processing comprising: training a convolutional network defined by nodes and edges, between nearest neighbor nodes, that form a lattice of multiple layers of filters arranged in successive layers of filters to produce at least one image in the successive layers of filters with at least a same resolution as an original image, wherein images at nodes of a given layer of the successive layers compose a given image of the given layer as a function of images at nodes of a previous layer convolved with corresponding filters of the previous layer, the previous layer immediately preceding the given layer in the convolutional network, the training including partitioning an affinity graph, representing affinities between affinity nodes of an output of the convolutional network, by cutting affinity edges with weak affinity to create clusters of affinity nodes that correspond to different image segments, the training further including cutting edges between nodes on boundaries of the edges.