Speedups to similar image search.