Skip to main content

An FPGA-Based Hardware Accelerator for the k-Nearest Neighbor Algorithm Implementation in Wearable Embedded Systems

  • Conference paper
Applied Intelligence and Informatics (AII 2022)

Abstract

The k-Nearest Neighbor (k-NN) is one of the most used Machine-Learning based algorithm performing the classification task. The latter is very used in many application fields, especially in the context of Body Sensor Networks (BSNs) where features of interest have to be extracted from the data collected by wearable sensors. In the last few years, the ever increasing size of the collected data, as well as low-power and high-speed constraints, have brought out the need for hardware-based implementations of the k-NN algorithm. This paper describes an effective approach to design k-NN FPGA-based hardware accelerators. Low-power and high-speed are achieved by exploiting the dedicated Digital Signal Processing (DSP) slices and their fast interconnections typically available in commercial FPGA devices. Moreover, an effective hardware-friendly strategy is proposed in order to avoid the computational bottleneck shown by the sorting step of the algorithm when implemented in software. The new design has been implemented within a complete embedded system on the FPGA platform hosted on the Xilinx Zynq XC7Z020-1CLG400C heterogeneous System on Chip (SoC), and it has been tested for a real wearable application. Compared to the pure software implementation, the new design has shown an execution speed-up of several orders of magnitude, with a total power dissipation of only 198 mW.

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

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 84.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 109.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

References

  1. Gravina, R., Fortino, G.: Wearable body sensor networks: state-of-the-art and research directions. IEEE Sens. J. 21(11), 12511–12522 (2021)

    Article  Google Scholar 

  2. Rofouei, M., Pedram, M., Fraternali, F., Ashari, Z.E., Ghasemzadeh, H.: Resource-efficient computing in wearable systems. In: 2019 IEEE International Conference on Smart Computing (SMARTCOMP), Washington D.C. (US), pp. 150–155 (2019)

    Google Scholar 

  3. Baraka, A., Shaban, H., Abou El-Nasr, M., Attallah, O.: Wearable accelerometer and sEMG-based upper limb BSN for tele-rehabilitation. Appl. Sci. 9(14), 1–22 (2019)

    Article  Google Scholar 

  4. Balkhi, P., Moallem, M.: A multipurpose wearable sensor-based system for weight training. Automation 3(1), 132–152 (2022)

    Article  Google Scholar 

  5. Raj, S., Ray, K.C., Shankar, O.: Cardiac arrhythmia beat classification using DOST and PSO tuned SVM. Comput. Methods Programs Biomed. 136, 163–177 (2016)

    Article  Google Scholar 

  6. Ferreira, P.J.S., Cardoso, J.M.P., Mendes-Moreira, J.: kNN prototyping schemes for embedded human activity recognition with online learning. Computers 9(4), 1–20 (2020)

    Article  Google Scholar 

  7. Sun, F., Zang, W., Gravina, R., Fortino, G., Li, Y.: Gait-based identification for elderly users in wearable healthcare systems. Inf. Fusion 53, 134–144 (2020)

    Article  Google Scholar 

  8. Shi, W., Cao, J., Zhang, Q., Li, Y., Xu, L.: Edge computing: vision and challenges. IEEE Internet Things J. 3(5), 637–646 (2016)

    Article  Google Scholar 

  9. Savaglio, C., Gerace, P., Di Fatta, G., Fortino, G.: Data mining at the IoT edge. In: 28th International Conference on Computer Communication and Networks, ICCCN 2019, Valencia, Spain, 29 July–1 August, pp. 1–6 (2019)

    Google Scholar 

  10. Liu, X., Zhiqiang, W.: Distributed computing system based on microprocessor cluster for wearable devices. In: 2017 International Conference on Computer Network, Electronic and Automation (ICCNEA), Xi’an, China, pp. 66–71 (2017)

    Google Scholar 

  11. Buschjäger, S., Morik, K.: Decision tree and random forest implementations for fast filtering of sensor data. IEEE Trans. Circuits Syst. I Regul. Pap. 65(1), 209–222 (2018)

    Article  Google Scholar 

  12. Kyrkou, C., Bouganis, C.-S., Theocharides, T., Polycarpou, M.M.: Embedded hardware-efficient real-time classification with cascade support vector machines. IEEE Trans. Neural Netw. Learn. Syst. 27(1), 99–112 (2016)

    Article  MathSciNet  Google Scholar 

  13. Saqib, F., Dutta, A., Plusquellic, J., Ortiz, P., Pattichis, M.S.: Pipelined decision tree classification accelerator implementation in FPGA (DT-CAIF). IEEE Trans. Comput. 64(1), 280–285 (2015)

    Article  MathSciNet  MATH  Google Scholar 

  14. Fernandez, D., Gonzalez, C., Mozos, D., Lopez, S.: FPGA implementation of the principal component analysis algorithm for dimensionality reduction of hyperspectral images. J. Real-Time Image Proc. 16(5), 1395–1406 (2019)

    Article  Google Scholar 

  15. Liu, L., Khalid, M.A.S.: Acceleration of k-nearest neighbor algorithm on FPGA using Intel SDK for OpenCL. In: IEEE 61st International Midwest Symposium on Circuits and Systems (MWSCAS), Windsor, ON, Canada, pp. 1070–1073 (2018)

    Google Scholar 

  16. Li, Z.-H., Jin, J.-F., Zhou, X.-G., Feng, Z.-H.: K-nearest neighbor algorithm implementation on FPGA using high level synthesis. In: IEEE International Conference on Solid-State and Integrated Circuit Technology (ICSICT), Hangzhou, China, pp. 1–4 (2016)

    Google Scholar 

  17. Pu, Y., Peng, J., Huang, L., Chen, J.: An efficient KNN algorithm implemented on FPGA based heterogeneous computing system using OpenCL. In: IEEE 23rd Annual International Symposium on Field-Programmable Custom Computing Machines, Vancouver, BC, Canada, pp. 167–170 (2015)

    Google Scholar 

  18. Zhang, S., Li, X., Zong, M., Zhu, X., Wang, R.: Efficient kNN classification with different numbers of nearest neighbors. IEEE Trans. Neural Netw. Learn. Syst. 49(5), 1774–1785 (2018)

    Article  MathSciNet  Google Scholar 

  19. AMD Xilinx, CORDIC v6.0 - LogiCORE IP Product Guide, PG105 6 August 2021. https://docs.xilinx.com/v/u/en-US/pg105-cordic. Accessed 15 Apr 2022

  20. Saeys, Y., Inza, I., Larrañaga, P.: A review of feature selection techniques in bioinformatics. Bioinformatics 23(19), 2507–2517 (2007)

    Article  Google Scholar 

  21. AMD Xilinx, AXI Reference Guide, UG1037 15 July 2017. https://docs.xilinx.com/v/u/en-US/ug1037-vivado-axi-reference-guide. Accessed 15 Apr 2022

Download references

Acknowledgement

This work was supported in part by PON Ricerca & Innovazione - MUR (grant 062\(\_\)R24\(\_\)INNOVAZIONE), Ministero dell’Università e della Ricerca, Italian Government.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Fabio Frustaci .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2022 The Author(s), under exclusive license to Springer Nature Switzerland AG

About this paper

Cite this paper

Borelli, A., Spagnolo, F., Gravina, R., Frustaci, F. (2022). An FPGA-Based Hardware Accelerator for the k-Nearest Neighbor Algorithm Implementation in Wearable Embedded Systems. In: Mahmud, M., Ieracitano, C., Kaiser, M.S., Mammone, N., Morabito, F.C. (eds) Applied Intelligence and Informatics. AII 2022. Communications in Computer and Information Science, vol 1724. Springer, Cham. https://doi.org/10.1007/978-3-031-24801-6_4

Download citation

Publish with us

Policies and ethics