Re-ranking for image retrieval and transductive few-shot classification