Skip to main content
Log in

Image classification based on quantum K-Nearest-Neighbor algorithm

  • Published:
Quantum Information Processing Aims and scope Submit manuscript

Abstract

Image classification is an important task in the field of machine learning and image processing. However, common classification method, the K-Nearest-Neighbor algorithm, has high complexity, because its two main processes: similarity computing and searching, are time-consuming. Especially in the era of big data, the problem is prominent when the amount of images to be classified is large. In this paper, we try to use the powerful parallel computing ability of quantum computers to optimize the efficiency of image classification. The scheme is based on quantum K-Nearest-Neighbor algorithm. Firstly, the feature vectors of images are extracted on classical computers. Then, the feature vectors are inputted into a quantum superposition state, which is used to achieve parallel computing of similarity. Next, the quantum minimum search algorithm is used to speed up searching process for similarity. Finally, the image is classified by quantum measurement. The complexity of the quantum algorithm is only \(O(\sqrt{kM})\), which is superior to the classical algorithms. Moreover, the measurement step is executed only once to ensure the validity of the scheme. The experimental results show that the classification accuracy is \(83.1\%\) on Graz-01 dataset and \(78\%\) on Caltech-101 dataset, which is close to existing classical algorithms. Hence, our quantum scheme has a good classification performance while greatly improving the efficiency.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7
Fig. 8
Fig. 9

Similar content being viewed by others

References

  1. Feynman, R.P.: Simulating physics with computers. Int. J. Theor. Phys. 21(6), 467–488 (1982)

    Article  MathSciNet  Google Scholar 

  2. Shor, P.W.: Algorithms for Quantum Computation: Discrete Logarithms and Factoring, pp. 124–134. IEEE Computer Society, Washington (1994)

    Google Scholar 

  3. Grover, L.K.: A fast quantum mechanical algorithm for database search. In: ACM, pp. 212–219 (1996)

  4. Le, P.Q., Dong, F., Hirota, K.: A flexible representation of quantum images for polynomial preparation, image compression, and processing operations. Quantum Inf. Process. 10(1), 63 (2011)

    Article  MathSciNet  MATH  Google Scholar 

  5. Sun, B., Iliyasu, A.M., Yan, F., Dong, F., Hirota, K.: An RGB multi-channel representation for images on quantum computers. JACIII 17(3), 404–417 (2013)

    Article  Google Scholar 

  6. Zhang, Y., Lu, K., Gao, Y.H., Wang, M.: NEQR: a novel enhanced quantum representation of digital images. Quantum Inf. Process. 12(8), 2833–2860 (2013)

    Article  ADS  MathSciNet  MATH  Google Scholar 

  7. Jiang, N., Wang, J., Mu, Y.: Quantum image scaling up based on nearest-neighbor interpolation with integer scaling ratio. Quantum Inf. Process. 14(11), 1–26 (2015)

    Article  MathSciNet  MATH  Google Scholar 

  8. Abdolmaleky, M., Naseri, M., Batle, J., Farouk, A., Gong, H.: Red-Green-Blue multi-channel quantum representation of digital images. Optik 128, 121–132 (2017)

    Article  ADS  Google Scholar 

  9. Jiang, N., Wang, L., Wu, W.Y.: Quantum Hilbert image scrambling. Int. J. Theor. Phys. 53(7), 2463–2484 (2014)

    Article  MATH  Google Scholar 

  10. Beheri, M.H., Amin, M., Song, X.H., El-Latif, A.A.A.: Quantum image encryption based on scrambling-diffusion (SD) approach. In: International Conference on Frontiers of Signal Processing. IEEE, pp. 43–47 (2017)

  11. Jiang, N., Zhao, N., Wang, L.: LSB based quantum image steganography algorithm. Int. J. Theor. Phys. 55(1), 107–123 (2016)

    Article  MATH  Google Scholar 

  12. Al-Salhi, Y.E.A., Lu, S.F.: Quantum image steganography and steganalysis based on LSQu-Blocks image information concealing algorithm. Int. J. Theor. Phys. 55(8), 3722–3736 (2016)

    Article  MathSciNet  MATH  Google Scholar 

  13. Jiang, N., Dang, Y.J., Wang, J.: Quantum image matching. Quantum Inf. Process. 15(9), 3543–3572 (2016)

    Article  ADS  MathSciNet  MATH  Google Scholar 

  14. Naseri, M., Heidari, S., Gheibi, R., Gong, L.H., Rajii, M.A., Sadri, A.: A novel quantum binary images thinning algorithm: a quantum version of the Hilditchs algorithm. Optik 131, 678–686 (2017)

    Article  ADS  Google Scholar 

  15. Heidari, S., Naseri, M.: A novel LSB based quantum watermarking. Int. J. Theor. Phys. 55(10), 4205–4218 (2016)

    Article  MATH  Google Scholar 

  16. Naseri, M., Heidari, S., Baghfalaki, M., fatahi, N., Gheibi, R., Batle, J., Farouk, A., Habibi, A.: A new secure quantum watermarking scheme. Optik Int. J. Light Electron Opt. 139, 77–86 (2017)

    Article  Google Scholar 

  17. Yao, X.W., Wang, H., Liao, Z., Chen, M.C., Pan, J., Li, J., Zhang, K., Lin, X., Wang, Z., Luo, Z.: Quantum image processing and its application to edge detection: theory and experiment. Phys. Rev. X. 7(3), 031041 (2017)

    Google Scholar 

  18. Yan, F., Iliyasu, A.M., Khan, A.R., Yang, H.: Measurements-based moving target detection in quantum video. Int. J. Theor. Phys. 55(4), 2162–2173 (2016)

    Article  MATH  Google Scholar 

  19. Wang, S.: Frames motion detection of quantum video. In: Pan, J.S., Tsai, P.W., Huang, H.C. (eds.) Advances in Intelligent Information Hiding and Multimedia Signal Processing. Smart Innovation, Systems and Technologies, vol. 64, pp. 145–151. Springer, Cham (2017)

  20. Yan, F., Iliyasu, A.M., Fatichah, C., Tangel, M.L., Betancourt, J.P., Dong, F., Hirota, K.: Quantum image searching based on probability distributions. J. Quantum Inf. Sci. 2(3), 55–60 (2012)

    Article  Google Scholar 

  21. Iliyasu, A.M., Yan, F., Hirota, K.: Metric for estimating congruity between quantum images. Entropy 18(10), 360 (2016)

    Article  ADS  Google Scholar 

  22. Fukunaga, K., Narendra, P.M.: A branch and bound algorithm for computing K-nearest neighbors. IEEE Trans. Comput. 24(7), 750 (1975)

    Article  MATH  Google Scholar 

  23. Beckmann, N., Kriegel, H.P., Schneider, R., Seeger, B.: The R*-tree: an efficient and robust access method for points and rectangles. SIGMOD Rec. 19(2), 322–331 (1990)

    Article  Google Scholar 

  24. White, D.A., Jain, R.: Similarity indexing with the SS-tree. In: Proceedings of the Twelfth International Conference on Data Engineering, pp. 516–523 (1996)

  25. Katayama, N., Satoh, S.: The SR-tree: an index structure for high-dimensional nearest neighbor queries. SIGMOD Rec. 26(2), 369–380 (1997)

    Article  Google Scholar 

  26. Goodsell, G.: On finding P-th nearest neighbours of scattered points in two dimensions for small p. Comput. Aided Geom. Des. 17(4), 387–392 (2000)

    Article  MathSciNet  MATH  Google Scholar 

  27. Piegl, L.A., Tiller, W.: Algorithm for finding all k nearest neighbors. Comput.-Aided Des. 34(2), 167 (2002)

    Article  MATH  Google Scholar 

  28. Boiman, O., Shechtman, E., Irani, M.: In defense of nearest-neighbor based image classification. In: 2008 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 1–8 (2008)

  29. Opelt, A., Fussenegger, M., Pinz, A., Auer, P.: Weak hypotheses and boosting for generic object detection and recognition. In: European Conference on Computer Vision, pp. 71–84 (2004)

  30. Lazebnik, S., Schmid, C., Ponce, J.: Beyond bags of features: spatial pyramid matching for recognizing natural scene categories. In: Proceedings of the 2006 IEEE Computer Society Conference on Computer Vision and Pattern Recognition, Volume 2, pp. 2169–2178 (2006)

  31. Sokolova, M., Lapalme, G.: A systematic analysis of performance measures for classification tasks. Inf. Process. Manag. 45(4), 427–437 (2009)

    Article  Google Scholar 

  32. Schuld, M., Sinayskiy, I., Petruccione, F.: An introduction to quantum machine learning. Contemp. Phys. 56(2), 172–185 (2015)

    Article  ADS  MATH  Google Scholar 

  33. Biamonte, J., Wittek, P., Pancotti, N., Rebentrost, P., Wiebe, N., Lloyd, S.: Quantum machine learning. Nature 549(7671), 195 (2017)

    Article  ADS  Google Scholar 

  34. Iliyasu, A.M., Fatichah, C.: A quantum hybrid PSO combined with fuzzyk-NN approach to feature selection and cell classification in cervical cancer detection. Sensors 17(12), 2935 (2017)

    Article  Google Scholar 

  35. Lloyd, S., Mohseni, M., Rebentrost, P.: Quantum principal component analysis. Nat. Phys. 10(9), 108–113 (2013)

    Google Scholar 

  36. Rebentrost, P., Mohseni, M., Lloyd, S.: Quantum support vector machine for big feature and big data classification. Phys. Rev. Lett. 113, 130503 (2013)

    Article  Google Scholar 

  37. Kulchytskyy, B., Andriyash, E., Amin, M., Melko, R.: Quantum boltzmann machine. ArXiv 33(2), 489–493 (2016)

    Google Scholar 

  38. Ameur, E., Brassard, G., Gambs, S.: Machine learning in a quantum world. In: International Conference on Advances in Artificial Intelligence: Canadian Society for Computational Studies of Intelligence, pp. 431–442. Springer-Verlag (2006)

  39. Dong, D., Chen, C., Li, H., Tarn, T.J.: Quantum reinforcement learning. IEEE Trans. Syst. Man Cybern. Part B Cybern A Publ. IEEE Syst. Man Cybern. Soc. 38(5), 1207–1220 (2008)

    Article  Google Scholar 

  40. Lloyd, S., Mohseni, M., Rebentrost, P.: Quantum algorithms for supervised and unsupervised machine learning. Eprint Arxiv (2013)

  41. Ruan, Y., Chen, H.W., Tan, J., Li, X.: Quantum computation for large-scale image classification. Quantum Inf. Process. 15(10), 4049–4069 (2016)

    Article  ADS  MathSciNet  MATH  Google Scholar 

  42. Chen, H., Gao, Y., Zhang, J.: Quantum k-nearest neighbor algorithm. Dongnan Daxue Xuebao 45(4), 647–651 (2015)

    MathSciNet  Google Scholar 

  43. Ruan, Y., Xue, X., Liu, H., Tan, J., Li, X.: Quantum algorithm for k-nearest neighbors classification based on the metric of Hamming distance. Int. J. Theor. Phys. 56(11), 3496–3507 (2017)

    Article  MathSciNet  MATH  Google Scholar 

  44. Drr, C., Hyer, P.: A quantum algorithm for finding the minimum. Computer Science (1999)

  45. Chen, T.S.: Comparison and application of image classification. Beijing University of Posts and Telecommunications (2011)

  46. Aharonov, D., Ta-Shma, A.: Adiabatic quantum state generation and statistical zero knowledge. In: Proceedings of the thirty-fifth annual ACM symposium on Theory of computing, pp. 20–29 (2003)

  47. Childs, A.M., Cleve, R., Deotto, E., Farhi, E., Gutmann, S., Spielman, D.A.: Exponential algorithmic speedup by a quantum walk. Physics, pp. 59–68 (2002)

  48. Wiebe, N., Berry, D., Hyer, P., Sanders, B.: Simulating quantum dynamics on a quantum computer. J. Phys. A Math. Theor. 44(44), 3096–3100 (2010)

    MathSciNet  Google Scholar 

  49. Wang, D., Liu, Z.H.: Design of quantum comparator based on extended general Toffoli gates with multiple targets. Comput. Sci. 39(9), 302–306 (2012)

    Google Scholar 

  50. Bennett, C.H.: Logical reversibility of computation. IBM J. Res. Dev. 17(6), 525–532 (1973)

    Article  MathSciNet  MATH  Google Scholar 

  51. Buhrman, H., Cleve, R., Watrous, J., De, W.R.: Quantum fingerprinting. Phys. Rev. Lett. 87(16), 167902 (2001)

    Article  ADS  Google Scholar 

  52. Brassard, G., Hyer, P., Mosca, M., Tapp, A.: Quantum amplitude amplification and estimation. Quantum Inf. Comput. 5494, 53–74 (2012)

    MATH  Google Scholar 

  53. Drr, C., Heiligman, M., Hyer, P., Mhalla, M.: Quantum query complexity of some graph problems. SIAM J. Comput. 35(6), 1310–1328 (2004)

    Article  MathSciNet  Google Scholar 

  54. Li, F.F., Rob, F., Pietro, P.: Learning generative visual models from few training examples: an incremental bayesian approach tested on 101 object categories. Comput. Vis. Image Underst. 106(1), 59–70 (2007)

    Article  Google Scholar 

  55. Arya, S., Mount, D.M., Netanyahu, N.S., Silverman, R., Wu, A.Y.: An optimal algorithm for approximate nearest neighbor searching fixed dimensions. J. ACM 45(6), 891–923 (1998)

    Article  MathSciNet  MATH  Google Scholar 

Download references

Acknowledgements

Funding was provided by National Natural Science Foundation of China (Grant Nos. 61502016, 61771230), the Joint Open Fund of Information Engineering Team in Intelligent Logistics (Grant No. LDXX2017KF152) and Shandong Provincial Key Research and Development Program of China (Grant No. 2017CXGC0701).

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Nan Jiang.

Additional information

This work is supported by the National Natural Science Foundation of China under Grants Nos. 61502016 and 61771230, the Joint Open Fund of Information Engineering Team in Intelligent Logistics under Grants No. LDXX2017KF152, and Shandong Provincial Key Research and Development Program of China under Grant No. 2017CXGC0701.

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Dang, Y., Jiang, N., Hu, H. et al. Image classification based on quantum K-Nearest-Neighbor algorithm. Quantum Inf Process 17, 239 (2018). https://doi.org/10.1007/s11128-018-2004-9

Download citation

  • Received:

  • Accepted:

  • Published:

  • DOI: https://doi.org/10.1007/s11128-018-2004-9

Keywords

Navigation