1. A method for producing a graph representation of an input image, the method comprising the procedures of: applying convolutional layers of a trained convolutional neural network on said input image; defining a receptive field of a last convolutional layer of said trained convolutional neural network as a vertex of said graph representation; defining a vector of a three dimensional output matrix of said last convolutional layer that is mapped to said receptive field as a descriptor for said vertex; and determining an edge between a pair of vertices of said graph representation by applying an operator on a pair of descriptors respective of said pair of vertices.