Approximate Nearest Neighbor Search Using Enhanced Accumulative Quantization
Abstract
:1. Introduction
2. Related Works
2.1. Quarter-Point Product Quantization
2.2. Accumulative Quantization
3. Enhanced Accumulative Quantization
3.1. Codebook Training
3.1.1. Initial Codebook Training
3.1.2. Codebooks Optimization
Algorithm 1: Codebook optimization pseudocode. | |
Inputs: initial codebooks {, i = 1, …, M}, quantization outputs {, i = 1, …, M; n = 1, …, N}, overall error vectors {, n = 1, …, N}, the number K of centroids in each codebook | |
Outputs: optimized codebooks {, i = 1, …, M} | |
1. | while true do |
2. | for i from 1 to M |
3. | compute input vectors by (n = 1, …, N) |
4. | find the nearest centroid in codebook for each input vector |
5. | for j from 1 to K |
6. | collect the input vectors whose nearest centroid is in |
7. | a mean mechanism is designed in which the mean vector of the above selected input vectors is computed as the new |
8. | end for |
9. | with updated , recompute the quarter point for each input vector and take it as new quantization output |
10. | update each error vector by |
11. | end for |
12. | if the MSE computed by Formula (5) converges |
13. | terminate the algorithm |
14. | end if |
15. | end while |
3.2. Quantizing Vector Based on E-AQ
Algorithm 2: Quantization output optimization pseudocode. | |
Inputs: codebooks , i = 1, …, M}, initial quantization outputs , m = 1, …, M} of vector y, overall error vector e | |
Outputs: optimized quantization outputs , m = 1, …, M}, | |
1. | while true do |
2. | for m from 1 to M |
3. | compute the input vector by |
4. | compute the quarter vector and take it as new quantization output |
5. | compute the residual vector by |
6. | end for |
7. | if quantization outputs do not change |
8. | terminate the algorithm |
9. | end if |
10. | end while |
4. E-AQ-Based Exhaustive ANN Search Method
5. Experiments
5.1. Datasets
5.2. Convergence of Training Codebooks
5.3. Comparison of Training Error and Quantization Error
5.4. ANN Search Performance
5.5. Comparison with the State-of-the-Arts
6. Conclusions
Author Contributions
Funding
Data Availability Statement
Acknowledgments
Conflicts of Interest
References
- Jang, Y.K.; Cho, N.I. Self-supervised Product Quantization for Deep Unsupervised Image Retrieval. In Proceedings of the IEEE/CVF International Conference on Computer Vision, Montreal, QC, Canada, 10–17 October 2021; pp. 12085–12094. [Google Scholar]
- Li, W.; Zhang, Y.; Sun, Y.; Wang, W.; Li, M.; Zhang, W.; Lin, X. Approximate nearest neighbor search on high dimensional data—Experiments, analyses, and improvement. IEEE Trans. Knowl. Data Eng. 2019, 32, 1475–1488. [Google Scholar] [CrossRef]
- Ozan, E.C.; Kiranyaz, S.; Gabbouj, M. K-subspaces quantization for approximate nearest neighbor search. IEEE Trans. Knowl. Data Eng. 2016, 28, 1722–1733. [Google Scholar] [CrossRef]
- Liu, H.; Ji, R.; Wang, J.; Shen, C. Ordinal Constraint Binary Coding for Approximate Nearest Neighbor Search. IEEE Trans. Pattern Anal. Mach. Intell. 2019, 41, 941–955. [Google Scholar] [CrossRef] [PubMed]
- Pan, Z.; Wang, L.; Wang, Y.; Liu, Y. Product quantization with dual codebooks for approximate nearest neighbor search. Neurocomputing 2020, 401, 59–68. [Google Scholar] [CrossRef]
- Ai, L.; Yu, J.; He, Y.; Guan, T. High-dimensional indexing technologies for large scale content-based image retrieval: A review. J. Zhejiang Univ.-Sci. C 2013, 14, 505–520. [Google Scholar] [CrossRef]
- Paulevé, L.; Jégou, H.; Amsaleg, L. Locality sensitive hashing: A comparison of hash function types and querying mechanisms. Pattern Recognit. Lett. 2010, 31, 1348–1358. [Google Scholar] [CrossRef] [Green Version]
- Xu, H.; Wang, J.; Li, Z.; Zeng, G.; Li, S.; Yu, N. Complementary hashing for approximate nearest neighbor search. In Proceedings of the International Conference on Computer Vision, Barcelona, Spain, 6–13 November 2011; pp. 1631–1638. [Google Scholar]
- Zhang, X.; Liu, W.; Dundar, M.; Badve, S.; Zhang, S. Towards large-scale histopathological image analysis: Hashing-based image retrieval. IEEE Trans. Med. Imaging 2014, 34, 496–506. [Google Scholar] [CrossRef]
- Huang, Q.; Feng, J.; Zhang, Y.; Fang, Q.; Ng, W. Query-aware locality-sensitive hashing for approximate nearest neighbor search. Proc. VLDB Endow. 2015, 9, 1–12. [Google Scholar] [CrossRef] [Green Version]
- Lu, X.; Zheng, X.; Li, X. Latent semantic minimal hashing for image retrieval. IEEE Trans. Image Process. 2016, 26, 355–368. [Google Scholar] [CrossRef]
- Gu, Y.; Yang, J. Multi-level magnification correlation hashing for scalable histopathological image retrieval. Neurocomputing 2019, 351, 134–145. [Google Scholar] [CrossRef]
- Cai, D. A revisit of hashing algorithms for approximate nearest neighbor search. IEEE Trans. Knowl. Data Eng. 2019, 33, 2337–2348. [Google Scholar] [CrossRef]
- Lu, H.; Zhang, M.; Xu, X.; Li, Y.; Shen, H.T. Deep fuzzy hashing network for efficient image retrieval. IEEE Trans. Fuzzy Syst. 2020, 29, 166–176. [Google Scholar] [CrossRef]
- Liu, X.; Du, B.; Deng, C.; Liu, M.; Lang, B. Structure sensitive hashing with adaptive product quantization. IEEE Trans. Cybern. 2015, 46, 2252–2264. [Google Scholar] [CrossRef] [PubMed]
- Ozan, E.C.; Kiranyaz, S.; Gabbouj, M. M-pca binary embedding for approximate nearest neighbor search. In Proceedings of the 2015 IEEE Trustcom/BigDataSE/ISPA, Helsinki, Finland, 20–22 August 2015; pp. 1–5. [Google Scholar]
- Wang, J.; Zhang, T.; Song, J.; Sebe, N.; Shen, H.T. A survey on learning to hash. IEEE Trans. Pattern Anal. Mach. Intell. 2017, 40, 769–790. [Google Scholar] [CrossRef] [PubMed]
- Jegou, H.; Douze, M.; Schmid, C. Product quantization for nearest neighbor search. IEEE Trans. Pattern Anal. Mach. Intell. 2010, 33, 117–128. [Google Scholar] [CrossRef] [Green Version]
- Ge, T.; He, K.; Ke, Q.; Sun, J. Optimized product quantization. IEEE Trans. Pattern Anal. Mach. Intell. 2013, 36, 744–755. [Google Scholar] [CrossRef]
- Kalantidis, Y.; Avrithis, Y. Locally optimized product quantization for approximate nearest neighbor search. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Columbus, OH, USA, 23–28 June 2014; pp. 2321–2328. [Google Scholar]
- Heo, J.P.; Lin, Z.; Yoon, S.E. Distance encoded product quantization. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Columbus, OH, USA, 23–28 June 2014; pp. 2131–2138. [Google Scholar]
- Zhan, J.; Mao, J.; Liu, Y.; Guo, J.; Zhang, M.; Ma, S. Jointly optimizing query encoder and product quantization to improve retrieval performance. In Proceedings of the 30th ACM International Conference on Information & Knowledge Management, Queensland, Australia, 1–5 November 2021; pp. 2487–2496. [Google Scholar]
- Chen, T.; Li, L.; Sun, Y. Differentiable product quantization for end-to-end embedding compression. In Proceedings of the International Conference on Machine Learning, Vienna, Austria, 12–18 July 2020; pp. 1617–1626. [Google Scholar]
- An, S.; Huang, Z.; Bai, S.; Che, G.; Ma, X.; Luo, J.; Chen, Y. Quarter-Point Product Quantization for approximate nearest neighbor search. Pattern Recognit. Lett. 2019, 125, 187–194. [Google Scholar] [CrossRef]
- Yuan, X.; Liu, Q.; Long, J.; Hu, L.; Wang, S. Multi-PQTable for Approximate Nearest-Neighbor Search. Information 2019, 10, 190. [Google Scholar] [CrossRef] [Green Version]
- Gong, Y.; Lazebnik, S.; Gordo, A.; Perronnin, F. Iterative quantization: A procrustean approach to learning binary codes for large-scale image retrieval. IEEE Trans. Pattern Anal. Mach. Intell. 2012, 35, 2916–2929. [Google Scholar] [CrossRef] [Green Version]
- Babenko, A.; Lempitsky, V. Tree quantization for large-scale similarity search and classification. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Boston, MA, USA, 7–12 June 2015; pp. 4240–4248. [Google Scholar]
- Wang, J.; Zhang, T. Composite quantization. IEEE Trans. Pattern Anal. Mach. Intell. 2018, 41, 1308–1322. [Google Scholar] [CrossRef]
- Babenko, A.; Lempitsky, V. Additive quantization for extreme vector compression. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Columbus, OH, USA, 23–28 June 2014; pp. 931–938. [Google Scholar]
- Chen, Y.; Guan, T.; Wang, C. Approximate nearest neighbor search by residual vector quantization. Sensors 2010, 10, 1259–11273. [Google Scholar] [CrossRef] [PubMed] [Green Version]
- Ai, L.; Yu, J.; Wu, Z.; He, Y.; Guan, T. Optimized residual vector quantization for efficient approximate nearest neighbor search. Multimed. Syst. 2017, 23, 169–181. [Google Scholar] [CrossRef]
- Wei, B.; Guan, T.; Yu, J. Projected residual vector quantization for ANN search. IEEE Multimed. 2014, 21, 41–51. [Google Scholar] [CrossRef]
- Ai, L.; Cheng, H.; Tao, Y.; Yu, J.; Zheng, X.; Liu, D. Codewords-Expanded Enhanced Residual Vector Quantization for Approximate Nearest Neighbor Search. J. Comput.-Aided Des. Comput. Graph. 2022, 34, 459–469. [Google Scholar]
- Ai, L.; Tao, Y.; Cheng, H.; Wang, Y.; Xie, S.; Liu, D. Accumulative Quantization for Approximate Nearest Neighbor Search. Comput. Intell. Neurosci. 2022, 2022, 4364252. [Google Scholar] [CrossRef] [PubMed]
- Yu, T.; Yuan, J.; Fang, C.; Jin, H. Product quantization network for fast image retrieval. In Proceedings of the European Conference on Computer Vision, Munich, Germany, 9–14 September 2018; pp. 186–201. [Google Scholar]
- Klein, B.; Wolf, L. End-to-end supervised product quantization for image search and retrieval. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Long Beach, CA, USA, 15–20 June 2019; pp. 5041–5050. [Google Scholar]
- Jang, Y.K.; Cho, N.I. Generalized product quantization network for semi-supervised image retrieval. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Long Beach, CA, USA, 15–20 June 2020; pp. 3420–3429. [Google Scholar]
- Zhai, Q.; Jiang, M. Deep Product Quantization for Large-Scale Image Retrieval. In Proceedings of the IEEE 4th International Conference on Big Data Analytics, Suzhou, China, 15–18 March 2019; pp. 198–202. [Google Scholar]
- Yu, T.; Meng, J.; Fang, C.; Jin, H.; Yuan, J. Product Quantization Network for Fast Visual Search. Int. J. Comput. Vis. 2020, 128, 2325–2343. [Google Scholar] [CrossRef]
- Liu, M.; Dai, Y.; Bai, Y.; Duan, L.-Y. Deep Product Quantization Module for Efficient Image Retrieval. In Proceedings of the ICASSP 2020—2020 IEEE International Conference on Acoustics, Speech and Signal Processing, Barcelona, Spain, 4–8 May 2020; pp. 4382–4386. [Google Scholar]
- Feng, Y.; Chen, B.; Dai, T.; Xia, S.T. Adversarial attack on deep product quantization network for image retrieval. In Proceedings of the AAAI Conference on Artificial Intelligence, New York, NY, USA, 7–12 February 2020; pp. 10786–10793. [Google Scholar]
- Severo, V.; Leitao, H.; Lima, J.; Lopes, W.; Madeiro, F. Modified firefly algorithm applied to image vector quantisation codebook design. Int. J. Innov. Comput. Appl. 2016, 7, 202–213. [Google Scholar] [CrossRef]
- Fonseca, C.; Ferreira, F.; Madeiro, F. Vector quantization codebook design based on Fish School Search algorithm. Appl. Soft Comput. J. 2018, 73, 958–968. [Google Scholar] [CrossRef]
- Horng, M. Vector quantization using the firefly algorithm for image compression. Expert Syst. Appl. 2012, 39, 1078–1091. [Google Scholar] [CrossRef]
- Filho, C.; Neto, F.; Lins, A.; Nascimento, A.; Lima, M.P. A novel search algorithm based on fish school behavior. In Proceedings of the IEEE International Conference on Systems, Man and Cybernetics, Singapore, 12–15 October 2008; pp. 2646–2651. [Google Scholar]
- Jegou, H.; Douze, M.; Schmid, C. Hamming embedding and weak geometric consistency for large scale image search. In Proceedings of the European Conference on Computer Vision, Berlin/Heidelberg, Germany, 12–18 October 2008; pp. 304–317. [Google Scholar]
- The INRIA Holidays Dataset. Available online: http://lear.inrialpes.fr/people/jegou/data.php#holidays (accessed on 13 June 2022).
- Torralba, A.; Fergus, F.; Freeman, W.T. 80 million tiny images: A large database for non-parametric object and scene recognition. IEEE Trans. PAMI 2008, 30, 1958–1970. [Google Scholar] [CrossRef]
Information | SIFT-1M | GIST-1M |
---|---|---|
Dimension | 128 | 960 |
Size of learning set | 100,000 | 500,000 |
Size of database set | 1,000,000 | 1,000,000 |
Size of query set | 10,000 | 1000 |
Methods | Recall@1 | Recall@10 | Recall@100 |
---|---|---|---|
PQ | 0.228 | 0.603 | 0.922 |
OPQ | 0.245 | 0.639 | 0.940 |
RVQ | 0.257 | 0.659 | 0.952 |
NOCQ | 0.290 | 0.715 | 0.970 |
QPQ | 0.315 | 0.745 | 0.975 |
AQ | 0.300 | 0.740 | 0.980 |
E-AQ (M = 6) | 0.284 | 0.737 | 0.963 |
E-AQ (M = 7) | 0.368 | 0.811 | 0.989 |
E-AQ (M = 8) | 0.401 | 0.852 | 0.996 |
Methods | Recall@1 | Recall@10 | Recall@100 |
---|---|---|---|
PQ | 0.054 | 0.121 | 0.319 |
OPQ | 0.128 | 0.344 | 0.696 |
RVQ | 0.113 | 0.325 | 0.676 |
NOCQ | 0.140 | 0.378 | 0.730 |
QPQ | 0.063 | 0.152 | 0.377 |
AQ | 0.110 | 0.350 | 0.740 |
E-AQ (M = 6) | 0.121 | 0.332 | 0.669 |
E-AQ (M = 7) | 0.123 | 0.360 | 0.744 |
E-AQ (M = 8) | 0.145 | 0.410 | 0.776 |
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations. |
© 2022 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Ai, L.; Cheng, H.; Wang, X.; Chen, C.; Liu, D.; Zheng, X.; Wang, Y. Approximate Nearest Neighbor Search Using Enhanced Accumulative Quantization. Electronics 2022, 11, 2236. https://doi.org/10.3390/electronics11142236
Ai L, Cheng H, Wang X, Chen C, Liu D, Zheng X, Wang Y. Approximate Nearest Neighbor Search Using Enhanced Accumulative Quantization. Electronics. 2022; 11(14):2236. https://doi.org/10.3390/electronics11142236
Chicago/Turabian StyleAi, Liefu, Hongjun Cheng, Xiaoxiao Wang, Chunsheng Chen, Deyang Liu, Xin Zheng, and Yuanzhi Wang. 2022. "Approximate Nearest Neighbor Search Using Enhanced Accumulative Quantization" Electronics 11, no. 14: 2236. https://doi.org/10.3390/electronics11142236
APA StyleAi, L., Cheng, H., Wang, X., Chen, C., Liu, D., Zheng, X., & Wang, Y. (2022). Approximate Nearest Neighbor Search Using Enhanced Accumulative Quantization. Electronics, 11(14), 2236. https://doi.org/10.3390/electronics11142236