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.
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
Krizhevsky A, Sutskever I, Hinton GE (2012) Imagenet classification with deep convolutional neural networks. Adv Neural Inf Process Syst 25:1097–1105
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
Simonyan K, Zisserman A (2015) Very deep convolutional networks for large-scale image recognition. In: International conference on learning representations
LeCun Y, Bottou L, Bengio Y, Haffner P (1998) Gradient-based learning applied to document recognition. Proc IEEE 86(11):2278–2324
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
Denil M, Shakibi B, Dinh L, Ranzato M, De Freitas N (2013) Predicting parameters in deep learning. Advances in neural information processing systems 26
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
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
Wiskott L et al (2020) Improved graph-based sfa: Information preservation complements the slowness principle. Mach Learn 109(5):999–1037
Sagan H (2012) Space-filling Curves. Springer
Ivan C (2019) Convolutional neural networks on randomized data. In: CVPR Workshops, pp 1–8
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
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
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
Biswas S (2000) Hilbert scan and image compression. In: Proceedings 15th International conference on pattern recognition. ICPR-2000, vol 3, pp 207–210. IEEE
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
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
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
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
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
Simonyan K, Zisserman A (2014) Two-stream convolutional networks for action recognition in videos. Advances in neural information processing systems 27
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
Farid R, Sammut C (2014) Plane-based object categorisation using relational learning. Mach Learn 94(1):3–23
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
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
Kayalibay B, Jensen G, van der Smagt P (2017) Cnn-based segmentation of medical imaging data. arXiv:1701.03056
Anders S (2009) Visualization of genomic data with the hilbert curve. Bioinformatics 25(10):1231–1235
Anjum MM, Tahmid IA, Rahman MS (2019) Cnn model with hilbert curve representation of dna sequence for enhancer prediction. bioRxiv:552141
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
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
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
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
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
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
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
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
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
Gotsman C, Lindenbaum M (1996) On the metric properties of discrete space-filling curves. IEEE Trans Image Process 5(5):794–797
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
Krizhevsky A, Hinton G, et al (2009) Learning multiple layers of features from tiny images. Technical report, University of Toronto
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
Altay G (2021) hilbertcurve 2.0.5. Construct Hilbert curves. Released Mar 29 2021, MIT License (MIT). https://pypi.org/project/hilbertcurve/
Chollet F, et al (2015) Keras. https://keras.io
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/
Kingma DP, Ba J (2014) Adam: A method for stochastic optimization. arXiv:1412.6980
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
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
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
Howard J (2019) Imagenette: A smaller subset of 10 easily classified classes from Imagenet. https://github.com/fastai/imagenette/
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
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
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
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
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
Salama K, et al (2021) Image classification with vision transformer. https://keras.io/examples/vision/image_classification_with_vision_transformer/
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
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
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.
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.
About this article
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
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s10489-023-04945-2