Skip to main content
Log in

Improving image classification of one-dimensional convolutional neural networks using Hilbert space-filling curves

  • Published:
Applied Intelligence Aims and scope Submit manuscript

Abstract

Convolutional neural networks (CNNs) have significantly contributed to recent advances in machine learning and computer vision. Although initially designed for image classification, the application of CNNs has stretched far beyond the context of images alone. Some exciting applications, e.g., in natural language processing and image segmentation, implement one-dimensional CNNs, often after a pre-processing step that transforms higher-dimensional input into a suitable data format for the networks. However, local correlations within data can diminish or vanish when one converts higher-dimensional data into a one-dimensional string. The Hilbert space-filling curve can minimize this loss of locality. Here, we study this claim rigorously by comparing an analytical model that quantifies locality preservation with the performance of several neural networks trained with and without Hilbert mappings. We find that Hilbert mappings offer a consistent advantage over the traditional flatten transformation in test accuracy and training speed. The results also depend on the chosen kernel size, agreeing with our analytical model. Our findings quantify the importance of locality preservation when transforming data before training a one-dimensional CNN and show that the Hilbert space-filling curve is a preferential transformation to achieve this goal.

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
Fig. 10
Fig. 11
Fig. 12
Fig. 13
Fig. 14
Fig. 15

Similar content being viewed by others

Data Availability

The datasets generated during and/or analysed during the current study are available from the corresponding author on reasonable request.

Code Availability

Our manuscript has associated data in a data repository.

References

  1. Krizhevsky A, Sutskever I, Hinton GE (2012) Imagenet classification with deep convolutional neural networks. Adv Neural Inf Process Syst 25:1097–1105

    Google Scholar 

  2. Russakovsky O, Deng J, Su H, Krause J, Satheesh S, Ma S, Huang Z, Karpathy A, Khosla A, Bernstein M et al (2015) Imagenet large scale visual recognition challenge. Int J Comput Vis 115(3):211–252

    Article  MathSciNet  Google Scholar 

  3. Simonyan K, Zisserman A (2015) Very deep convolutional networks for large-scale image recognition. In: International conference on learning representations

  4. LeCun Y, Bottou L, Bengio Y, Haffner P (1998) Gradient-based learning applied to document recognition. Proc IEEE 86(11):2278–2324

    Article  Google Scholar 

  5. Corcoran T, Zamora-Resendiz R, Liu X, Crivelli S (2018) A spatial mapping algorithm with applications in deep learning-based structure classification. arXiv:1802.02532

  6. Denil M, Shakibi B, Dinh L, Ranzato M, De Freitas N (2013) Predicting parameters in deep learning. Advances in neural information processing systems 26

  7. Ji Y, Eisenstein J (2015) Entity-augmented distributional semantics for discourse relations. In: Bengio, Y, LeCun, Y. (eds.) 3rd International conference on learning representations, ICLR 2015, San Diego, CA, USA, May 7-9, 2015, Workshop track proceedings. arXiv:1412.5673

  8. Chen L, Li S, Bai Q, Yang J, Jiang S, Miao Y (2021) Review of image classification algorithms based on convolutional neural networks. Remote Sens 13(22):4712

    Article  Google Scholar 

  9. Wiskott L et al (2020) Improved graph-based sfa: Information preservation complements the slowness principle. Mach Learn 109(5):999–1037

    Article  MathSciNet  MATH  Google Scholar 

  10. Sagan H (2012) Space-filling Curves. Springer

    MATH  Google Scholar 

  11. Ivan C (2019) Convolutional neural networks on randomized data. In: CVPR Workshops, pp 1–8

  12. Hershey S, Chaudhuri S, Ellis DP, Gemmeke JF, Jansen A, Moore RC, Plakal M, Platt D, Saurous RA, Seybold B, et al (2017) Cnn architectures for large-scale audio classification. In: 2017 Ieee International Conference on Acoustics, Speech and Signal Processing (icassp), pp 131–135. IEEE

  13. Kiranyaz S, Avci O, Abdeljaber O, Ince T, Gabbouj M, Inman DJ (2021) 1d convolutional neural networks and applications: A survey. Mech Syst Signal Process 151:107398

    Article  Google Scholar 

  14. Papamarkos N, Strouthopoulos C, Andreadis I (2000) Multithresholding of color and gray-level images through a neural network technique. Image Vis Comput 18(3):213–222

    Article  Google Scholar 

  15. Biswas S (2000) Hilbert scan and image compression. In: Proceedings 15th International conference on pattern recognition. ICPR-2000, vol 3, pp 207–210. IEEE

  16. Zang Y, Huang H, Zhang L (2014) Efficient structure-aware image smoothingby local extrema on space-filling curve. IEEE Trans Vis Comput Graph 20(9):1253–1265

    Article  Google Scholar 

  17. Bai Y, Feng Y, Wang Y, Dai T, Xia S-T, Jiang Y (2019) Hilbert-based generative defense for adversarial examples. In: Proceedings of the IEEE/CVF International conference on computer vision, pp 4784–4793

  18. Gao J, Lan J, Wang B, Li F (2022) Sdanet: spatial deep attention-based for point cloud classification and segmentation. Mach Learn 111(4):1327–1348

    Article  MathSciNet  MATH  Google Scholar 

  19. Ji S, Xu W, Yang M, Yu K (2012) 3d convolutional neural networks for human action recognition. IEEE Transpattern Anal Mach Intell 35(1):221–231

    Article  Google Scholar 

  20. Karpathy A, Toderici G, Shetty S, Leung T, Sukthankar R, Fei-Fei L (2014) Large-scale video classification with convolutional neural networks. In: Proceedings of the IEEE Conference on computer vision and pattern recognition, pp 1725–1732

  21. Simonyan K, Zisserman A (2014) Two-stream convolutional networks for action recognition in videos. Advances in neural information processing systems 27

  22. de Oliveira WA, Barcelos CA, Giraldi G, Guliato D (2012) Hsd: A 3d shape descriptor based on the hilbert curve and a reduction dimensionality approach. In: 2012 IEEE International Conference on Systems, Man, and Cybernetics (SMC), pp 156–161. IEEE

  23. Farid R, Sammut C (2014) Plane-based object categorisation using relational learning. Mach Learn 94(1):3–23

    Article  MathSciNet  Google Scholar 

  24. Ciresan D, Giusti A, Gambardella L, Schmidhuber J (2012) Deep neural networks segment neuronal membranes in electron microscopy images. Adv Neural Inf Process Syst 25:2843-2851

    Google Scholar 

  25. Havaei M, Davy A, Warde-Farley D, Biard A, Courville A, Bengio Y, Pal C, Jodoin P-M, Larochelle H (2017) Brain tumor segmentation with deep neural networks. Med Image Anal 35:18–31

    Article  Google Scholar 

  26. Kayalibay B, Jensen G, van der Smagt P (2017) Cnn-based segmentation of medical imaging data. arXiv:1701.03056

  27. Anders S (2009) Visualization of genomic data with the hilbert curve. Bioinformatics 25(10):1231–1235

    Article  Google Scholar 

  28. Anjum MM, Tahmid IA, Rahman MS (2019) Cnn model with hilbert curve representation of dna sequence for enhancer prediction. bioRxiv:552141

  29. Hu Y, Peng R, Long C, Zhu M (2021) Hilbertepis: Enhancer-promoter interactions prediction with hilbert curve and cnn model. In: 2021 IEEE 9th International Conference on Bioinformatics and Computational Biology (ICBCB), pp 91–95. IEEE

  30. Tsinganos P, Cornelis B, Cornelis J, Jansen B, Skodras A (2019) A hilbert curve based representation of semg signals for gesture recognition. In: 2019 International Conference on Systems, Signals and Image Processing (IWSSIP), pp 201–206. IEEE

  31. Tsinganos P, Cornelis B, Cornelis J, Jansen B, Skodras A (2021) Hilbert semg data scanning for hand gesture recognition based on deep learning. Neural Comput Appl 33(7):2645–2666

    Article  Google Scholar 

  32. Han K, Wang Y, Chen H, Chen X, Guo J, Liu Z, Tang Y, Xiao A, Xu C, Xu Y, et al (2022) A survey on vision transformer. IEEE transactions on pattern analysis and machine intelligence

  33. Dosovitskiy A, Beyer L, Kolesnikov A, Weissenborn D, Zhai X, Unterthiner T, Dehghani M, Minderer M, Heigold G, Gelly S, Uszkoreit J, Houlsby N (2021) An image is worth 16x16 words: Transformers for image recognition at scale. In: International conference on learning representations. https://openreview.net/forum?id=YicbFdNTTy

  34. Parmar N, Vaswani A, Uszkoreit J, Kaiser L, Shazeer N, Ku A, Tran D (2018) Image transformer. In: International conference on machine learning, pp 4055–4064. PMLR

  35. Chen H, Wang Y, Guo T, Xu C, Deng Y, Liu Z, Ma S, Xu C, Xu C, Gao W (2021) Pre-trained image processing transformer. In: Proceedings of the IEEE/CVF Conference on computer vision and pattern recognition, pp 12299–12310

  36. Han Z-Y, Wang J, Fan H, Wang L, Zhang P (2018) Unsupervised generative modeling using matrix product states. Phys Rev X 8(3):031012

    Google Scholar 

  37. Heaney CE, Li Y, Matar OK, Pain CC (2020) Applying convolutional neural networks to data on unstructured meshes with space-filling curves. arXiv:2011.14820

  38. Gotsman C, Lindenbaum M (1996) On the metric properties of discrete space-filling curves. IEEE Trans Image Process 5(5):794–797

    Article  Google Scholar 

  39. Rong Y, Zhang X, Lin J (2021) Modified hilbert curve for rectangles and cuboids and its application in entropy coding for image and video compression. Entropy 23(7):836

    Article  MathSciNet  Google Scholar 

  40. Krizhevsky A, Hinton G, et al (2009) Learning multiple layers of features from tiny images. Technical report, University of Toronto

  41. Harris CR, Millman KJ, van der Walt SJ, Gommers R, Virtanen P, Cournapeau D, Wieser E, Taylor J, Berg S, Smith NJ, Kern R, Picus M, Hoyer S, van Kerkwijk MH, Brett M, Haldane A, del Río JF, Wiebe M, Peterson P, Gérard-Marchant P, Sheppard K, Reddy T, Weckesser W, Abbasi H, Gohlke C, Oliphant TE (2020) Array programming with NumPy. Nature 585(7825):357–362. https://doi.org/10.1038/s41586-020-2649-2

    Article  Google Scholar 

  42. Altay G (2021) hilbertcurve 2.0.5. Construct Hilbert curves. Released Mar 29 2021, MIT License (MIT). https://pypi.org/project/hilbertcurve/

  43. Chollet F, et al (2015) Keras. https://keras.io

  44. Abadi M, Agarwal A, Barham P, Brevdo E, Chen Z, Citro C, Corrado GS, Davis A, Dean J, Devin M, Ghemawat S, Goodfellow I, Harp A, Irving G, Isard M, Jia Y, Jozefowicz R, Kaiser L, Kudlur M, Levenberg J, Mané D, Monga R, Moore S, Murray D, Olah C, Schuster M, Shlens J, Steiner B, Sutskever I, Talwar K, Tucker P, Vanhoucke V, Vasudevan V, Viégas F, Vinyals O, Warden P, Wattenberg M, Wicke M, Yu Y, Zheng X (2015) TensorFlow: Large-scale machine learning on heterogeneous systems. Software available from tensorflow.org. https://www.tensorflow.org/

  45. Kingma DP, Ba J (2014) Adam: A method for stochastic optimization. arXiv:1412.6980

  46. Glorot X, Bengio Y (2010) Understanding the difficulty of training deep feedforward neural networks. In: Proceedings of the 13th International conference on artificial intelligence and statistics, pp 249–256. JMLR Workshop and conference proceedings

  47. Russakovsky O, Deng J, Su H, Krause J, Satheesh S, Ma S, Huang Z, Karpathy A, Khosla A, Bernstein M, Berg AC, Fei-Fei L (2015) ImageNet large scale visual recognition challenge. International Journal of Computer Vision (IJCV) 115(3):211–252. https://doi.org/10.1007/s11263-015-0816-y

  48. He K, Zhang X, Ren S, Sun J (2016) Deep residual learning for image recognition. In: Proceedings of the IEEE Conference on computer vision and pattern recognition, pp 770–778

  49. Howard J (2019) Imagenette: A smaller subset of 10 easily classified classes from Imagenet. https://github.com/fastai/imagenette/

  50. Deng J, Dong W, Socher R, Li L-J, Li K, Fei-Fei L (2009) Imagenet: A large-scale hierarchical image database. In: 2009 IEEE Conference on computer vision and pattern recognition, pp 248–255. Ieee

  51. Vaswani A, Shazeer N, Parmar N, Uszkoreit J, Jones L, Gomez AN, Kaiser Ł, Polosukhin I (2017) Attention is all you need. Advances in neural information processing systems 30

  52. Ramachandran P, Parmar N, Vaswani A, Bello I, Levskaya A, Shlens J (2019) Stand-alone self-attention in vision models. Advances in neural information processing systems 32

  53. Wang X, Girshick R, Gupta A, He K (2018) Non-local neural networks. In: Proceedings of the IEEE Conference on computer vision and pattern recognition, pp 7794–7803

  54. Carion N, Massa F, Synnaeve G, Usunier N, Kirillov A, Zagoruyko S (2020) End-to-end object detection with transformers. In: Computer vision–ECCV 2020: 16th European conference, glasgow, UK, August 23–28, 2020, Proceedings, Part I 16, pp 213–229. Springer

  55. Salama K, et al (2021) Image classification with vision transformer. https://keras.io/examples/vision/image_classification_with_vision_transformer/

Download references

Acknowledgements

This work is partly funded the Research Foundation Flanders (FWO-Vlaanderen).

Funding

This work is partly funded the Research Foundation Flanders (FWO-Vlaanderen).

Author information

Authors and Affiliations

Authors

Contributions

Both authors have made made substantial contributions to the conception and design of the work, the analysis and interpretation of data. Both authors have revised the work critically for important intellectual content and have approved the version to be published.

Corresponding author

Correspondence to Bert Verbruggen.

Ethics declarations

Conflicts of interest

The authors have no relevant financial or non-financial interests to disclose.

Ethics approval

N/A

Consent to participate

N/A

Consent for publication

N/A

Additional information

Publisher's Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Appendix A: Empirical results for different resolutions

Appendix A: Empirical results for different resolutions

Below we report the results of the empirical study as presented in Section 3 for different resolutions of the input images but with a similar methodology. One change to the example shown in the paper is the choice of radii over which we expand our search. In the general report, we use each distance at which a point can be found for any selection of anchor point. The below results only use the distances along the diagonal of the original two-dimensional input image, but the result remains the same.

Fig. 16
figure 16

We show the progression of the density plots as introduced in Fig. 5 for increasing resolutions of the input image. The resolutions increase from left to right and top to bottom, spanning (\(8\times 8\),\(16\times 16\),\(32\times 32\),\(64\times 64\) pixels). The density plot shows the logarithm of the distance ratio for each combination of an anchor point labeled according to the flatten operation and a radius (\(r_{0}\)). We find that the Hilbert mapping preserves the relative distance better for most anchor points than the flattened string

Fig. 17
figure 17

Results show the data distribution for the different resolutions of the input data. Figures on the left show the distribution of the ratio’s \(\frac{d_{H}}{d_{F}}(r_{0},\left( i,j\right) )\) for each choice of radius \(r_{0}\). The distribution of the logarithm of these ratios is shown in the right figures. Most of these ratios favor the Hilbert SFC mapping

Rights and permissions

Springer Nature or its licensor (e.g. a society or other partner) holds exclusive rights to this article under a publishing agreement with the author(s) or other rightsholder(s); author self-archiving of the accepted manuscript version of this article is solely governed by the terms of such publishing agreement and applicable law.

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Verbruggen, B., Ginis, V. Improving image classification of one-dimensional convolutional neural networks using Hilbert space-filling curves. Appl Intell 53, 26655–26671 (2023). https://doi.org/10.1007/s10489-023-04945-2

Download citation

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s10489-023-04945-2

Keywords

Navigation