Appearance invariance in convolutional networks with neighborhood similarity