Adapting k-d Trees to Visual Retrieval