Please include the following references when citing the YACCLAB project/dataset:
Allegretti, Stefano; Bolelli, Federico; Grana, Costantino "Optimized Block-Based Algorithms to Label Connected Components on GPUs." IEEE Transactions on Parallel and Distributed Systems, 2019. BibTex.
Bolelli, Federico; Cancilla, Michele; Baraldi, Lorenzo; Grana, Costantino "Towards Reliable Experiments on the Performance of Connected Components Labeling Algorithms" Journal of Real-Time Image Processing, 2018. BibTex.
Grana, Costantino; Bolelli, Federico; Baraldi, Lorenzo; Vezzani, Roberto "YACCLAB - Yet Another Connected Components Labeling Benchmark" Proceedings of the 23rd International Conference on Pattern Recognition, Cancun, Mexico, 4-8 Dec 2016. BibTex.
YACCLAB is an open source C++ project that enables researchers to test CCL algorithms under extremely variable points of view, running and testing algorithms on a collection of datasets described below. The benchmark performs the following tests which will be described later in this readme: correctness, average run-time (average), average run-time with steps (average_ws), density, size, granularity and memory accesses (memory). Notice that 8-connectivity is always used in the project.
To correctly install and run YACCLAB following packages, libraries and utility are needed: - CMake 3.8.2 or higher (https://cmake.org), - OpenCV 3.0 or higher (http://opencv.org), - Gnuplot (http://www.gnuplot.info/), - One of your favourite IDE/compiler with C++14 support GPU algorithms also require: - CUDA Toolkit 9.2 or higher (https://developer.nvidia.com/cuda-toolkit) Notes for gnuplot: - on Windows system: be sure add gnuplot to system path if you want YACCLAB automatically generates charts. - on MacOS system: 'pdf terminal' seems to be not available due to old version of cairo, 'postscript' is used instead.
Clone the GitHub repository (HTTPS clone URL: https://github.com/prittt/YACCLAB.git) or simply download the full master branch zip file and extract it (e.g YACCLAB folder).
Install software in YACCLAB/bin subfolder (suggested) or wherever you want using CMake (point 2 of the example image). Note that CMake should automatically find the OpenCV path whether correctly installed on your OS (3), download the YACCLAB Dataset (be sure to check the box if you want to download it (4a) and (4b) or to select the correct path if the dataset is already on your file system (7)), and create a C++ project for the selected IDE/compiler (9-10). Moreover, if you want to test 3D or GPU algorithms tick the corresponding boxes (5) and (6).
Set the configuration file (config.yaml) placed in the installation folder (bin in this example) in order to select desired tests.
Open the project, compile and run it: the work is done!
If your project requires a Connected Components Labeling algorithm and you are not interested in the whole YACCLAB benchmark you can use the connectedComponent function of the OpenCV library which implements the BBDT and SAUF algorithms since version 3.2.
Anyway, when the connectedComponents function is called, lot of additional code will be executed together with the core function. If your project requires the best performance you can include an algorithm implemented in YACCLAB adding the following files to your project:
Algorithm Name | Authors | Year | Acronym | Required Files | Templated on Labels Solver | |
---|---|---|---|---|---|---|
CPU | - | L. Di Stefano, A. Bulgarelli [3] |
1999 | DiStefano | labeling_distefano_1999.h | NO |
Contour Tracing | F. Chang,C.J. Chen,C.J. Lu [1] | 1999 | CT | labeling_fchang_2003.h | NO | |
Run-Based Two-Scan | L. He,Y. Chao,K. Suzuki [7] | 2008 | RBTS | labeling_he_2008.h | YES | |
Scan Array-based with Union Find | K. Wu,E. Otoo,K. Suzuki [6] | 2009 | SAUF | labeling_wu_2009.h, labeling_wu_2009_tree.inc | YES | |
Stripe-Based Labeling Algorithm | H.L. Zhao,Y.B. Fan,T.X. Zhang,H.S. Sang [8] | 2010 | SBLA | labeling_zhao_2010.h | NO | |
Block-Based with Decision Tree | C. Grana,D. Borghesani,R. Cucchiara [4] | 2010 | BBDT | labeling_grana_2010.h, labeling_grana_2010_tree.inc | YES | |
Configuration Transition Based | L. He,X. Zhao,Y. Chao,K. Suzuki [7] | 2014 | CTB | labeling_he_2014.h, labeling_he_2014_graph.inc | YES | |
Block-Based with Binary Decision Trees | W.Y. Chang,C.C. Chiu,J.H. Yang [2] | 2015 | CCIT | labeling_wychang_2015.h, labeling_wychang_2015_tree.inc, labeling_wychang_2015_tree_0.inc | YES | |
Light Speed Labeling | L. Cabaret,L. Lacassagne,D. Etiemble [5] | 2016 | LSL_STD ILSL_STDZ IILSL_RLE III | labeling_lacassagne_2016.h, labeling_lacassagne_2016_code.inc | YES IV | |
Pixel Prediction | C.Grana,L. Baraldi,F. Bolelli [9] | 2016 | PRED | labeling_grana_2016.h, labeling_grana_2016_forest.inc, labeling_grana_2016_forest_0.inc | YES | |
Directed Rooted Acyclic Graph | F. Bolelli,L. Baraldi,M. Cancilla,C. Grana [23] | 2018 | DRAG | labeling_bolelli_2018.h, labeling_grana_2018_drag.inc | YES | |
Spaghetti Labeling | F. Bolelli,S. Allegretti,L. Baraldi,C. Grana [13] | 2019 | Spaghetti | labeling_bolelli_2019.h, labeling_bolelli_2019_forest.inc, labeling_bolelli_2019_forest_firstline.inc, labeling_bolelli_2019_forest_lastline.inc, labeling_bolelli_2019_forest_singleline.inc | YES | |
Null Labeling | F. Bolelli,M. Cancilla,L. Baraldi,C. Grana [13] | - | NULL V | labeling_null.h | NO | |
GPU | Union Find | V. Oliveira,R. Lotufo [18] | 2010 | UF | labeling_CUDA_UF.cu | NO |
OptimizedLabel Equivalence | O. Kalentev,A. Rai,S. Kemnitz,R. Schneider [19] | 2011 | OLE | labeling_CUDA_OLE.cu | NO | |
Block Equivalence | S. Zavalishin,I. Safonov,Y. Bekhtin,I. Kurilin [20] | 2016 | BE | labeling_CUDA_BE.cu | NO | |
DistancelessLabel Propagation | L. Cabaret,L. Lacassagne,D. Etiemble [21] | 2017 | DLP | labeling_CUDA_DLP.cu | NO | |
CUDA SAUF | S. Allegretti,F. Bolelli,M. Cancilla,C. Grana [29] | - | C-SAUF | labeling_CUDA_SAUF.cu,labeling_wu_2009_tree.inc | NO | |
CUDA BBDT | S. Allegretti,F. Bolelli,M. Cancilla,C. Grana [29] | - | C-BBDT | labeling_CUDA_BBDT.cu, labeling_grana_2010_tree.inc | NO | |
CUDA DRAG | S. Allegretti,F. Bolelli,M. Cancilla,C. Grana [29] | - | C-DRAG | labeling_CUDA_DRAG.cu | NO | |
Block-based Union Find | S. Allegretti,F. Bolelli,C. Grana [24] | 2019 | BUF | labeling_CUDA_BUF.cu | NO | |
Block-based Komura Equivalence | S. Allegretti,F. Bolelli,C. Grana [24] | 2019 | BKE | labeling_CUDA_BKE.cu | NO |
(I) standard version (II) with zero-offset optimization (III) with RLE compression (IV) only on TTA and UF (V) it only copies the pixels from the input image to the output one simply defining a lower bound limit for the execution time of CCL algorithms on a given machine and dataset.
#include "labels_solver.h"
#include "labeling_algorithms.h"
#include "labeling_grana_2010.h" // To include the algorithm code (BBDT in this example)
#include <opencv2/opencv.hpp>
using namespace cv;
int main()
{
BBDT<UFPC> BBDT_UFPC; // To create an object of the desired algorithm (BBDT in this example)
// templated on the labels solving strategy. See the README for the
// complete list of the available labels solvers, available algorithms
// (N.B. non all the algorithms are templated on the solver) and their
// acronyms.
BBDT_UFPC.img_ = imread("test_image.png", IMREAD_GRAYSCALE); // To load into the CCL object
// the BINARY image to be labeled
threshold(BBDT_UFPC.img_, BBDT_UFPC.img_, 100, 1, THRESH_BINARY); // Just to be sure that the
// loaded image is binary
BBDT_UFPC.PerformLabeling(); // To perform Connected Components Labeling!
Mat1i output = BBDT_UFPC.img_labels_; // To get the output labeled image
unsigned n_labels = BBDT_UFPC.n_labels_; // To get the number of labels found in the input img
return EXIT_SUCCESS;
}
A YAML configuration file placed in the installation folder lets you specify which kinds of tests should be performed, on which datasets and on which algorithms. Four categories of algorithms are supported: 2D CPU, 2D GPU, 3D CPU and 3D GPU. For each of them, the configuration parameters are reported below.
execute - boolean value which specifies whether the current category of algorithms will be tested:
execute: true
perform - dictionary which specifies the kind of tests to perform:
perform:
correctness: false
average: true
average_with_steps: false
density: false
granularity: false
memory: false
correctness_tests - dictionary indicating the kind of correctness tests to perform:
correctness_tests:
eight_connectivity_standard: true
eight_connectivity_steps: true
eight_connectivity_memory: true
tests_number - dictionary which sets the number of runs for each test available:
tests_number:
average: 10
average_with_steps: 10
density: 10
granularity: 10
algorithms - list of algorithms on which apply the chosen tests:
algorithms:
- SAUF_RemSP
- SAUF_TTA
- BBDT_RemSP
- BBDT_UFPC
- CT
- labeling_NULL
check_datasets, average_datasets, average_ws_datasets and memory_datasets - lists of datasets on which, respectively, correctness, average, average_ws and memory tests should be run:
Federico Bolelli π» π π§ π π€ |
Stefano Allegretti π» π§ π π€ π |
Costantino Grana π» π π€ π |
Michele Cancilla π» π¦ π§ |
Lorenzo Baraldi π» π¦ |
This project follows the all-contributors specification. Contributions of any kind welcome
[1] |
F. Chang, C.-J. Chen, and C.-J. Lu, βA linear-time component-labeling algorithm using contour tracing technique,β Computer Vision and Image Understanding, vol. 93, no. 2, pp. 206β220, 2004. |
[2] |
W.-Y. Chang, C.-C. Chiu, and J.-H. Yang, βBlock-based connected-component labeling algorithm using binary decision trees,β Sensors, vol. 15, no. 9, pp. 23 763β23 787, 2015. |
[3] |
L. Di Stefano and A. Bulgarelli, βA Simple and Efficient Connected Components Labeling Algorithm,β in International Conference on Image Analysis and Processing. IEEE, 1999, pp. 322β327. |
[4] |
C. Grana, D. Borghesani, and R. Cucchiara, βOptimized Block-based Connected Components Labeling with Decision Trees,β IEEE Transac-tions on Image Processing, vol. 19, no. 6, pp. 1596β1609, 2010. |
[5] |
L. Lacassagne and B. Zavidovique, βLight speed labeling: efficient connected component labeling on risc architectures,β Journal of Real-Time Image Processing, vol. 6, no. 2, pp. 117β135, 2011. |
[6] |
K. Wu, E. Otoo, and K. Suzuki, "Optimizing two-pass connected-component labeling algorithms,β Pattern Analysis and Applications," vol. 12, no. 2, pp. 117β135, 2009. |
[7] |
L. He, X. Zhao, Y. Chao, and K. Suzuki, "Configuration-Transition-Based Connected-Component Labeling", IEEE Transactions on Image Processing, vol. 23, no. 2, pp. 943β951, 2014. |
[8] |
H. Zhao, Y. Fan, T. Zhang, and H. Sang, "Stripe-based connected components labelling," Electronics letters, vol. 46, no. 21, pp. 1434β1436, 2010. |
[9] |
C. Grana, L. Baraldi, and F. Bolelli, "Optimized Connected Components Labeling with Pixel Prediction," in Advanced Concepts for Intelligent Vision Systems, 2016. |
[10] |
M. J. Huiskes and M. S. Lew, βThe MIR Flickr Retrieval Evaluation,β in MIR β08: Proceedings of the 2008 ACM International Conference on Multimedia Information Retrieval. New York, NY, USA: ACM, 2008. |
[11] |
G. Agam, S. Argamon, O. Frieder, D. Grossman, and D. Lewis, βThe Complex Document Image Processing (CDIP) Test Collection Project,β Illinois Institute of Technology, 2006. |
[12] |
D. Lewis, G. Agam, S. Argamon, O. Frieder, D. Grossman, and J. Heard, β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. ACM, 2006, pp. 665β666. |
[13] |
F. Bolelli, M. Cancilla, L. Baraldi, C. Grana, "Towards Reliable Experiments on the Performance of Connected Components Labeling Algorithms," Journal of Real-Time Image Processing, 2018. |
[14] |
D. Baltieri, R. Vezzani, and R. Cucchiara, β3DPeS: 3D People Dataset for Surveillance and Forensics,β in Proceedings of the 2011 joint ACM workshop on Human gesture and behavior understanding. ACM, 2011, pp. 59β64. |
[15] |
F. Dong, H. Irshad, E.-Y. Oh, M. F. Lerwill, E. F. Brachtel, N. C. Jones, N. W. Knoblauch, L. Montaser-Kouhsari, N. B. Johnson, L. K. Rao et al., βComputational Pathology to Discriminate Benign from Malignant Intraductal Proliferations of the Breast,β PloS one, vol. 9, no. 12, p. e114885, 2014. |
[16] |
D. Maltoni, D. Maio, A. Jain, and S. Prabhakar, "Handbook of fingerprint recognition", Springer Science & Business Media, 2009. |
[17] |
C.Grana, F.Bolelli, L.Baraldi, and R.Vezzani, "YACCLAB - Yet Another Connected Components Labeling Benchmark," Proceedings of the 23rd International Conference on Pattern Recognition, Cancun, Mexico, 4-8 Dec 2016, 2016. |
[18] |
V. Oliveira and R. Lotufo, "A study on connected components labeling algorithms using GPUs," in SIBGRAPI. vol. 3, p. 4, 2010. |
[19] |
O. Kalentev, A. Rai, S. Kemnitz, R. Schneider," Connected component labeling on a 2D grid using CUDA," in Journal of Parallel and Distributed Computing 71(4), 615β620, 2011. |
[20] |
S. Zavalishin, I. Safonov, Y. Bekhtin, I. Kurilin, "Block Equivalence Algorithm for Labeling 2D and 3D Images on GPU," in Electronic Imaging 2016(2), 1β7, 2016. |
[21] |
L. Cabaret, L. Lacassagne, D. Etiemble, "Distanceless Label Propagation: an Efficient Direct Connected Component Labeling Algorithm for GPUs," in Seventh International Conference on Image Processing Theory, Tools and Applications, IPTA, 2017. |
[22] |
S. Allegretti, F. Bolelli, M. Cancilla, C. Grana, "Optimizing GPU-Based Connected Components Labeling Algorithms," in Third IEEE International Conference on Image Processing, Applications and Systems, IPAS, 2018. |
[23] |
F. Bolelli, L. Baraldi, M. Cancilla, C. Grana, "Connected Components Labeling on DRAGs," in International Conference on Pattern Recognition, 2018. |
[24] |
S. Allegretti, F. Bolelli, C. Grana, "Optimized Block-Based Algorithms to Label Connected Components on GPUs," in IEEE Transactions on Parallel and Distributed Systems, 2019. |
[26] |
F. Bolelli, S. Allegretti, L. Baraldi, C. Grana, "Spaghetti Labeling: Directed Acyclic Graphs for Block-Based Connected Components Labeling," IEEE Transactions on Image Processing, 2019. |
[27] |
D. S. Marcus, A. F. Fotenos, J. G. Csernansky, J. C. Morris, R. L. Buckner, βOpen Access Series of Imaging Studies (OASIS): Longitudinal MRI Data in Nondemented and Demented OlderAdults,β J. Cognitive Neurosci., vol. 22, no. 12, pp. 2677β2684, 2010. |
[28] |
A. Lucchi, Y. Li, and P. Fua, βLearning for Structured Prediction Using Approximate Subgradient Descent with Working Sets,β in Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2013, pp. 1987β1994. |
[29] |
S. Allegretti, F, Bolelli, M. Cancilla, F. Pollastri, L. Canalini, C. Grana, "How does Connected Components Labeling with Decision Trees perform on GPUs?," In 18th International Conference on Computer Analysis of Images and Patterns, 2019. |
[30] |
L. He, Y. Chao, K. Suzuki. "A run-based two-scan labeling algorithm." IEEE Transactions on Image Processing, 2008. |