Scalable Nearest Neighbor Search with Compact Codes