How Does Connected Components Labeling with Decision Trees Perform on GPUs?

  • Stefano Allegretti
  • Federico BolelliEmail author
  • Michele Cancilla
  • Federico Pollastri
  • Laura Canalini
  • Costantino Grana
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 11678)


In this paper the problem of Connected Components Labeling (CCL) in binary images using Graphic Processing Units (GPUs) is tackled by a different perspective. In the last decade, many novel algorithms have been released, specifically designed for GPUs. Because CCL literature concerning sequential algorithms is very rich, and includes many efficient solutions, designers of parallel algorithms were often inspired by techniques that had already proved successful in a sequential environment, such as the Union-Find paradigm for solving equivalences between provisional labels. However, the use of decision trees to minimize memory accesses, which is one of the main feature of the best performing sequential algorithms, was never taken into account when designing parallel CCL solutions. In fact, branches in the code tend to cause thread divergence, which usually leads to inefficiency. Anyway, this consideration does not necessarily apply to every possible scenario. Are we sure that the advantages of decision trees do not compensate for the cost of thread divergence? In order to answer this question, we chose three well-known sequential CCL algorithms, which employ decision trees as the cornerstone of their strategy, and we built a data-parallel version of each of them. Experimental tests on real case datasets show that, in most cases, these solutions outperform state-of-the-art algorithms, thus demonstrating the effectiveness of decision trees also in a parallel environment.


Image processing Connected components labeling Parallel computing GPU 


  1. 1.
    Agam, G., Argamon, S., Frieder, O., Grossman, D., Lewis, D.: The Complex Document Image Processing (CDIP) Test Collection Project. Illinois Institute of Technology (2006)Google Scholar
  2. 2.
    Allegretti, S., Bolelli, F., Cancilla, M., Grana, C.: Optimizing GPU-based connected components labeling algorithms. In: Third IEEE International Conference on Image Processing, Applications and Systems. IPAS (2018)Google Scholar
  3. 3.
    Baltieri, D., Vezzani, R., Cucchiara, R.: 3DPeS: 3D people dataset for surveillance and forensics. In: Proceedings of the 2011 Joint ACM Workshop on Human Gesture and Behavior Understanding, pp. 59–64. ACM (2011)Google Scholar
  4. 4.
    Bolelli, F.: Indexing of historical document images: ad hoc dewarping technique for handwritten text. In: Grana, C., Baraldi, L. (eds.) IRCDL 2017. CCIS, vol. 733, pp. 45–55. Springer, Cham (2017). Scholar
  5. 5.
    Bolelli, F., Baraldi, L., Cancilla, M., Grana, C.: Connected components labeling on DRAGs. In: International Conference on Pattern Recognition (2018)Google Scholar
  6. 6.
    Bolelli, F., Borghi, G., Grana, C.: Historical handwritten text images word spotting through sliding window HOG features. In: Battiato, S., Gallo, G., Schettini, R., Stanco, F. (eds.) ICIAP 2017. LNCS, vol. 10484, pp. 729–738. Springer, Cham (2017). Scholar
  7. 7.
    Bolelli, F., Borghi, G., Grana, C.: XDOCS: an application to index historical documents. In: Serra, G., Tasso, C. (eds.) IRCDL 2018. CCIS, vol. 806, pp. 151–162. Springer, Cham (2018). Scholar
  8. 8.
    Bolelli, F., Cancilla, M., Baraldi, L., Grana, C.: Connected components labeling on DRAGs: implementation and reproducibility notes. In: 24th International Conference on Pattern Recognition Workshops (2018)Google Scholar
  9. 9.
    Bolelli, F., Cancilla, M., Baraldi, L., Grana, C.: Toward reliable experiments on the performance of Connected Components Labeling algorithms. J. Real-Time Image Process. 1–16 (2018)Google Scholar
  10. 10.
    Bolelli, F., Cancilla, M., Grana, C.: Two more strategies to speed up connected components labeling algorithms. In: Battiato, S., Gallo, G., Schettini, R., Stanco, F. (eds.) ICIAP 2017. LNCS, vol. 10485, pp. 48–58. Springer, Cham (2017). Scholar
  11. 11.
    Brunie, N., Collange, S., Diamos, G.: Simultaneous branch and warp interweaving for sustained GPU performance. In: 39th Annual International Symposium on Computer Architecture (ISCA), pp. 49–60, June 2012Google Scholar
  12. 12.
    Cabaret, L., Lacassagne, L., Etiemble, D.: Distanceless label propagation: an efficient direct connected component labeling algorithm for GPUs. In: International Conference on Image Processing Theory, Tools and Applications. IPTA (2017)Google Scholar
  13. 13.
    Cucchiara, R., Grana, C., Prati, A., Vezzani, R.: Computer vision techniques for PDA accessibility of in-house video surveillance. In: First ACM SIGMM International Workshop on Video Surveillance, pp. 87–97 (2003)Google Scholar
  14. 14.
    Dillencourt, M.B., Samet, H., Tamminen, M.: A general approach to connected-component labeling for arbitrary image representations. J. ACM 39(2), 253–280 (1992)MathSciNetCrossRefGoogle Scholar
  15. 15.
    Dong, F., Irshad, H., Oh, E.Y., et al.: Computational pathology to discriminate benign from malignant intraductal proliferations of the breast. PloS One 9(12), e114885 (2014)CrossRefGoogle Scholar
  16. 16.
    Grana, C., Baraldi, L., Bolelli, F.: Optimized connected components labeling with pixel prediction. In: Blanc-Talon, J., Distante, C., Philips, W., Popescu, D., Scheunders, P. (eds.) ACIVS 2016. LNCS, vol. 10016, pp. 431–440. Springer, Cham (2016). Scholar
  17. 17.
    Grana, C., Bolelli, F., Baraldi, L., Vezzani, R.: YACCLAB - yet another connected components labeling benchmark. In: 23rd International Conference on Pattern Recognition. ICPR (2016)Google Scholar
  18. 18.
    Grana, C., Borghesani, D., Cucchiara, R.: Fast block based connected components labeling. In: 2009 16th IEEE International Conference on Image Processing (ICIP), pp. 4061–4064. IEEE (2009)Google Scholar
  19. 19.
    Grana, C., Borghesani, D., Cucchiara, R.: Optimized block-based connected components labeling with decision trees. IEEE Trans. Image Process. 19(6), 1596–1609 (2010)MathSciNetCrossRefGoogle Scholar
  20. 20.
    Grana, C., Montangero, M., Borghesani, D.: Optimal decision trees for local image processing algorithms. Pattern Recogn. Lett. 33(16), 2302–2310 (2012)CrossRefGoogle Scholar
  21. 21.
    He, L., Zhao, X., Chao, Y., Suzuki, K.: Configuration-transition-based connected-component labeling. IEEE Trans. Image Process. 23(2), 943–951 (2014)MathSciNetCrossRefGoogle Scholar
  22. 22.
    Huiskes, M.J., Lew, M.S.: The MIR flickr retrieval evaluation. In: Proceedings of the 2008 ACM International Conference on Multimedia Information Retrieval, MIR 2008. ACM, New York (2008)Google Scholar
  23. 23.
    Kalentev, O., Rai, A., Kemnitz, S., Schneider, R.: Connected component labeling on a 2D grid using CUDA. J. Parallel Distrib. Comput. 71(4), 615–620 (2011)CrossRefGoogle Scholar
  24. 24.
    Komura, Y.: GPU-based cluster-labeling algorithm without the use of conventional iteration: application to the Swendsen-Wang multi-cluster spin flip algorithm. Comput. Phys. Commun. 194, 54–58 (2015)MathSciNetCrossRefGoogle Scholar
  25. 25.
    Lewis, D., Agam, G., Argamon, S., Frieder, O., Grossman, D., Heard, J.: Building a test collection for complex document information processing. In: Proceedings of the 29th Annual International ACM SIGIR Conference on Research and Development in Information Retrieval, pp. 665–666. ACM (2006)Google Scholar
  26. 26.
    Maltoni, D., Maio, D., Jain, A., Prabhakar, S.: Handbook of Fingerprint Recognition. Springer, Heidelberg (2009). Scholar
  27. 27.
    Nickolls, J., Dally, W.J.: The GPU computing era. IEEE Micro 30(2), 56–69 (2010)CrossRefGoogle Scholar
  28. 28.
    Oliveira, V.M., Lotufo, R.A.: A study on connected components labeling algorithms using GPUs. In: SIBGRAPI, vol. 3, p. 4 (2010)Google Scholar
  29. 29.
    Pollastri, F., Bolelli, F., Paredes, R., Grana, C.: Improving skin lesion segmentation with generative adversarial networks. In: 2018 IEEE 31st International Symposium on Computer-Based Medical Systems (CBMS). IEEE (2018)Google Scholar
  30. 30.
    Pollastri, F., Bolelli, F., Paredes, R., Grana, C.: Augmenting data with GANs to segment melanoma skin lesions. Multimed. Tools Appl. J. (2019)Google Scholar
  31. 31.
    Source Code. Accessed 30 Mar 2019
  32. 32.
    The Hamlet Dataset. Accessed 30 Mar 2019
  33. 33.
    The Legacy Tobacco Document Library (LTDL). University of California (2007)Google Scholar
  34. 34.
    Wu, K., Otoo, E., Suzuki, K.: Two strategies to speed up connected component labeling algorithms. Technical report LBNL-59102, Lawrence Berkeley National Laboratory (2005)Google Scholar
  35. 35.
    Zavalishin, S., Safonov, I., Bekhtin, Y., Kurilin, I.: Block equivalence algorithm for labeling 2D and 3D images on GPU. Electron. Imaging 2016(2), 1–7 (2016)CrossRefGoogle Scholar

Copyright information

© Springer Nature Switzerland AG 2019

Authors and Affiliations

  • Stefano Allegretti
    • 1
  • Federico Bolelli
    • 1
    Email author
  • Michele Cancilla
    • 1
  • Federico Pollastri
    • 1
  • Laura Canalini
    • 1
  • Costantino Grana
    • 1
  1. 1.Dipartimento di Ingegneria “Enzo Ferrari”Università degli Studi di Modena e Reggio EmiliaModenaItaly

Personalised recommendations