├── .gitattributes ├── .gitignore ├── ClusteringTests ├── datasets │ ├── data1.csv │ ├── data10.csv │ ├── data11.csv │ ├── data12.csv │ ├── data13.csv │ ├── data14.csv │ ├── data15.csv │ ├── data2.csv │ ├── data3.csv │ ├── data4.csv │ ├── data5.csv │ ├── data6.csv │ ├── data7.csv │ ├── data8.csv │ └── data9.csv ├── generate_datasets.py ├── plot_clusters.py └── speeduptest ├── LICENSE ├── MeanShift ├── .idea │ ├── MeanShift.iml │ ├── codeStyles │ │ └── codeStyleConfig.xml │ ├── misc.xml │ ├── modules.xml │ ├── vcs.xml │ └── workspace.xml ├── CMakeLists.txt ├── Cluster.cpp ├── Cluster.hpp ├── ClustersBuilder.cpp ├── ClustersBuilder.hpp ├── Point.cpp ├── Point.hpp ├── csvUtils.cpp ├── csvUtils.hpp ├── main.cpp ├── meanShift.cpp ├── meanShift.hpp └── test │ ├── CMakeLists.txt │ ├── ClusterTest.cpp │ ├── ClustersBuilderTest.cpp │ ├── PointTest.cpp │ ├── csvUtilsTest.cpp │ ├── lib │ └── googletest │ │ ├── CMakeLists.txt │ │ ├── CONTRIBUTORS │ │ ├── LICENSE │ │ ├── Makefile.am │ │ ├── README.md │ │ ├── cmake │ │ ├── Config.cmake.in │ │ ├── gtest.pc.in │ │ ├── gtest_main.pc.in │ │ └── internal_utils.cmake │ │ ├── codegear │ │ ├── gtest.cbproj │ │ ├── gtest.groupproj │ │ ├── gtest_all.cc │ │ ├── gtest_link.cc │ │ ├── gtest_main.cbproj │ │ └── gtest_unittest.cbproj │ │ ├── configure.ac │ │ ├── docs │ │ ├── Pkgconfig.md │ │ ├── PumpManual.md │ │ ├── XcodeGuide.md │ │ ├── advanced.md │ │ ├── faq.md │ │ ├── primer.md │ │ └── samples.md │ │ ├── include │ │ └── gtest │ │ │ ├── gtest-death-test.h │ │ │ ├── gtest-message.h │ │ │ ├── gtest-param-test.h │ │ │ ├── gtest-param-test.h.pump │ │ │ ├── gtest-printers.h │ │ │ ├── gtest-spi.h │ │ │ ├── gtest-test-part.h │ │ │ ├── gtest-typed-test.h │ │ │ ├── gtest.h │ │ │ ├── gtest_pred_impl.h │ │ │ ├── gtest_prod.h │ │ │ └── internal │ │ │ ├── custom │ │ │ ├── README.md │ │ │ ├── gtest-port.h │ │ │ ├── gtest-printers.h │ │ │ └── gtest.h │ │ │ ├── gtest-death-test-internal.h │ │ │ ├── gtest-filepath.h │ │ │ ├── gtest-internal.h │ │ │ ├── gtest-param-util-generated.h │ │ │ ├── gtest-param-util-generated.h.pump │ │ │ ├── gtest-param-util.h │ │ │ ├── gtest-port-arch.h │ │ │ ├── gtest-port.h │ │ │ ├── gtest-string.h │ │ │ ├── gtest-type-util.h │ │ │ └── gtest-type-util.h.pump │ │ ├── m4 │ │ ├── acx_pthread.m4 │ │ └── gtest.m4 │ │ ├── make │ │ └── Makefile │ │ ├── msvc │ │ └── 2010 │ │ │ ├── gtest-md.sln │ │ │ ├── gtest-md.vcxproj │ │ │ ├── gtest-md.vcxproj.filters │ │ │ ├── gtest.sln │ │ │ ├── gtest.vcxproj │ │ │ ├── gtest.vcxproj.filters │ │ │ ├── gtest_main-md.vcxproj │ │ │ ├── gtest_main-md.vcxproj.filters │ │ │ ├── gtest_main.vcxproj │ │ │ ├── gtest_main.vcxproj.filters │ │ │ ├── gtest_prod_test-md.vcxproj │ │ │ ├── gtest_prod_test-md.vcxproj.filters │ │ │ ├── gtest_prod_test.vcxproj │ │ │ ├── gtest_prod_test.vcxproj.filters │ │ │ ├── gtest_unittest-md.vcxproj │ │ │ ├── gtest_unittest-md.vcxproj.filters │ │ │ ├── gtest_unittest.vcxproj │ │ │ └── gtest_unittest.vcxproj.filters │ │ ├── samples │ │ ├── prime_tables.h │ │ ├── sample1.cc │ │ ├── sample1.h │ │ ├── sample10_unittest.cc │ │ ├── sample1_unittest.cc │ │ ├── sample2.cc │ │ ├── sample2.h │ │ ├── sample2_unittest.cc │ │ ├── sample3-inl.h │ │ ├── sample3_unittest.cc │ │ ├── sample4.cc │ │ ├── sample4.h │ │ ├── sample4_unittest.cc │ │ ├── sample5_unittest.cc │ │ ├── sample6_unittest.cc │ │ ├── sample7_unittest.cc │ │ ├── sample8_unittest.cc │ │ └── sample9_unittest.cc │ │ ├── scripts │ │ ├── common.py │ │ ├── fuse_gtest_files.py │ │ ├── gen_gtest_pred_impl.py │ │ ├── gtest-config.in │ │ ├── pump.py │ │ ├── release_docs.py │ │ ├── test │ │ │ └── Makefile │ │ ├── upload.py │ │ └── upload_gtest.py │ │ ├── src │ │ ├── gtest-all.cc │ │ ├── gtest-death-test.cc │ │ ├── gtest-filepath.cc │ │ ├── gtest-internal-inl.h │ │ ├── gtest-port.cc │ │ ├── gtest-printers.cc │ │ ├── gtest-test-part.cc │ │ ├── gtest-typed-test.cc │ │ ├── gtest.cc │ │ └── gtest_main.cc │ │ ├── test │ │ ├── BUILD.bazel │ │ ├── googletest-break-on-failure-unittest.py │ │ ├── googletest-break-on-failure-unittest_.cc │ │ ├── googletest-catch-exceptions-test.py │ │ ├── googletest-catch-exceptions-test_.cc │ │ ├── googletest-color-test.py │ │ ├── googletest-color-test_.cc │ │ ├── googletest-death-test-test.cc │ │ ├── googletest-death-test_ex_test.cc │ │ ├── googletest-env-var-test.py │ │ ├── googletest-env-var-test_.cc │ │ ├── googletest-filepath-test.cc │ │ ├── googletest-filter-unittest.py │ │ ├── googletest-filter-unittest_.cc │ │ ├── googletest-json-outfiles-test.py │ │ ├── googletest-json-output-unittest.py │ │ ├── googletest-list-tests-unittest.py │ │ ├── googletest-list-tests-unittest_.cc │ │ ├── googletest-listener-test.cc │ │ ├── googletest-message-test.cc │ │ ├── googletest-options-test.cc │ │ ├── googletest-output-test-golden-lin.txt │ │ ├── googletest-output-test.py │ │ ├── googletest-output-test_.cc │ │ ├── googletest-param-test-invalid-name1-test.py │ │ ├── googletest-param-test-invalid-name1-test_.cc │ │ ├── googletest-param-test-invalid-name2-test.py │ │ ├── googletest-param-test-invalid-name2-test_.cc │ │ ├── googletest-param-test-test.cc │ │ ├── googletest-param-test-test.h │ │ ├── googletest-param-test2-test.cc │ │ ├── googletest-port-test.cc │ │ ├── googletest-printers-test.cc │ │ ├── googletest-shuffle-test.py │ │ ├── googletest-shuffle-test_.cc │ │ ├── googletest-test-part-test.cc │ │ ├── googletest-test2_test.cc │ │ ├── googletest-throw-on-failure-test.py │ │ ├── googletest-throw-on-failure-test_.cc │ │ ├── googletest-uninitialized-test.py │ │ ├── googletest-uninitialized-test_.cc │ │ ├── gtest-typed-test2_test.cc │ │ ├── gtest-typed-test_test.cc │ │ ├── gtest-typed-test_test.h │ │ ├── gtest-unittest-api_test.cc │ │ ├── gtest_all_test.cc │ │ ├── gtest_assert_by_exception_test.cc │ │ ├── gtest_environment_test.cc │ │ ├── gtest_help_test.py │ │ ├── gtest_help_test_.cc │ │ ├── gtest_json_test_utils.py │ │ ├── gtest_list_output_unittest.py │ │ ├── gtest_list_output_unittest_.cc │ │ ├── gtest_main_unittest.cc │ │ ├── gtest_no_test_unittest.cc │ │ ├── gtest_pred_impl_unittest.cc │ │ ├── gtest_premature_exit_test.cc │ │ ├── gtest_prod_test.cc │ │ ├── gtest_repeat_test.cc │ │ ├── gtest_skip_test.cc │ │ ├── gtest_sole_header_test.cc │ │ ├── gtest_stress_test.cc │ │ ├── gtest_test_macro_stack_footprint_test.cc │ │ ├── gtest_test_utils.py │ │ ├── gtest_testbridge_test.py │ │ ├── gtest_testbridge_test_.cc │ │ ├── gtest_throw_on_failure_ex_test.cc │ │ ├── gtest_unittest.cc │ │ ├── gtest_xml_outfile1_test_.cc │ │ ├── gtest_xml_outfile2_test_.cc │ │ ├── gtest_xml_outfiles_test.py │ │ ├── gtest_xml_output_unittest.py │ │ ├── gtest_xml_output_unittest_.cc │ │ ├── gtest_xml_test_utils.py │ │ ├── production.cc │ │ └── production.h │ │ └── xcode │ │ ├── Config │ │ ├── DebugProject.xcconfig │ │ ├── FrameworkTarget.xcconfig │ │ ├── General.xcconfig │ │ ├── ReleaseProject.xcconfig │ │ ├── StaticLibraryTarget.xcconfig │ │ └── TestTarget.xcconfig │ │ ├── Resources │ │ └── Info.plist │ │ ├── Samples │ │ └── FrameworkSample │ │ │ ├── Info.plist │ │ │ ├── WidgetFramework.xcodeproj │ │ │ └── project.pbxproj │ │ │ ├── runtests.sh │ │ │ ├── widget.cc │ │ │ ├── widget.h │ │ │ └── widget_test.cc │ │ ├── Scripts │ │ ├── runtests.sh │ │ └── versiongenerate.py │ │ └── gtest.xcodeproj │ │ └── project.pbxproj │ ├── meanShiftTest.cpp │ ├── resources │ ├── empty.csv │ ├── out.csv │ └── test.csv │ └── runAllTests.cpp ├── Paper ├── MeanShift.pdf ├── MeanShift.tex ├── cvpr.sty └── fig │ ├── speedup100-eps-converted-to.pdf │ ├── speedup100.eps │ ├── speedup1000-eps-converted-to.pdf │ ├── speedup1000.eps │ ├── speedup10000-eps-converted-to.pdf │ ├── speedup10000.eps │ ├── speedup10000Colors-eps-converted-to.pdf │ ├── speedup10000Colors.eps │ ├── speedup10b-eps-converted-to.pdf │ ├── speedup10b.eps │ ├── speedup1b-eps-converted-to.pdf │ ├── speedup1b.eps │ ├── speedup20000-eps-converted-to.pdf │ ├── speedup20000.eps │ ├── speedup2b-eps-converted-to.pdf │ ├── speedup2b.eps │ ├── speedup50000-eps-converted-to.pdf │ └── speedup50000.eps ├── README.md ├── ReadmeImg ├── 1cluster.png └── 3clusters.png └── Slides ├── MeanShiftSlides.nav ├── MeanShiftSlides.pdf ├── MeanShiftSlides.snm ├── MeanShiftSlides.tex └── MeanShiftSlides.vrb /.gitattributes: -------------------------------------------------------------------------------- 1 | * text eol=lf 2 | *.jpg binary 3 | *.png binary 4 | *.gif binary 5 | *.jpeg binary 6 | *.JPG binary 7 | *.npz binary 8 | *.pdf binary 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *build* 2 | *.log 3 | codeStyles 4 | 5 | ### LaTeX ### 6 | ## Core latex/pdflatex auxiliary files: 7 | *.aux 8 | *.lof 9 | *.log 10 | *.lot 11 | *.fls 12 | *.out 13 | *.toc 14 | *.fmt 15 | *.fot 16 | *.cb 17 | *.cb2 18 | .*.lb 19 | -------------------------------------------------------------------------------- /ClusteringTests/generate_datasets.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | import sklearn.datasets as datasets 4 | import pandas as pd 5 | 6 | 7 | DATASETS_DIR = './datasets' 8 | 9 | 10 | def generate_dataset(points, n_features, centers, std, file_name): 11 | data, __ = datasets.make_blobs( 12 | points, n_features, centers, cluster_std=std, shuffle=True, 13 | random_state=1000 14 | ) 15 | pd.DataFrame(data).to_csv( 16 | os.path.join(DATASETS_DIR, file_name), header=False, index=False 17 | ) 18 | 19 | 20 | def main(): 21 | 22 | dataset_num = 1 23 | 24 | ####################################################### 25 | #### Datasets with std=1 and well defined clusters #### 26 | ####################################################### 27 | 28 | # two dimensional datasets 29 | for c in range(1, 6): 30 | generate_dataset( 31 | points=10000, n_features=2, centers=c, std=1, 32 | file_name=f'data{dataset_num}.csv' 33 | ) 34 | dataset_num += 1 35 | # three dimensional datasets 36 | for c in range(1, 6): 37 | generate_dataset( 38 | points=10000, n_features=3, centers=c, std=1, 39 | file_name=f'data{dataset_num}.csv' 40 | ) 41 | dataset_num += 1 42 | 43 | ####################################################### 44 | ### Datasets with an increasing number of points ###### 45 | ####################################################### 46 | 47 | for points in [100, 1000, 10000, 20000, 50000]: 48 | generate_dataset( 49 | points, n_features=3, centers=5, std=1, 50 | file_name=f'data{dataset_num}.csv' 51 | ) 52 | dataset_num += 1 53 | 54 | if __name__ == '__main__': 55 | main() 56 | -------------------------------------------------------------------------------- /ClusteringTests/plot_clusters.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | import subprocess 4 | 5 | import numpy as np 6 | import matplotlib.pyplot as plt 7 | from mpl_toolkits.mplot3d import Axes3D 8 | 9 | 10 | EXECUTABLE = '../MeanShift/cmake-build-releasepar/meanshift' 11 | 12 | 13 | def main(): 14 | output_file = 'out' 15 | out = subprocess.check_call([ 16 | EXECUTABLE, sys.argv[1], sys.argv[2], '--write-output', 'out' 17 | ]) 18 | data = np.genfromtxt('{}.csv'.format(output_file), delimiter=',') 19 | num_clusters = int(np.max(data[:,-1] + 1)) 20 | clusters = np.ndarray(shape=num_clusters, dtype=np.ndarray) 21 | for i in range(0, num_clusters): 22 | clusters[i] = np.float32( 23 | [point[:-1] for point in data if point[-1] == i] 24 | ) 25 | fig = plt.figure() 26 | if len(clusters[0][0]) == 2: 27 | # 2D plot 28 | for cluster in clusters: 29 | plt.scatter(cluster[:,0], cluster[:,1], s=3) 30 | else: 31 | # 3D plot 32 | ax = Axes3D(fig) 33 | for cluster in clusters: 34 | ax.scatter(cluster[:,0], cluster[:,1], cluster[:,2], s=3) 35 | plt.show() 36 | os.remove('{}.csv'.format(output_file)) 37 | 38 | 39 | if __name__ == '__main__': 40 | main() 41 | -------------------------------------------------------------------------------- /ClusteringTests/speeduptest: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Execute the sequential version of the algorithm and compare it with various 4 | # parallel versions with a different number of threads. 5 | # Calculate the speedup of each parallel execution, that is: 6 | # time_sequential_version / time_parallel_version 7 | # Ideally, it should be equal to the number of threads used in the parallel 8 | # version (if that number is not greater of the number of CPUs). 9 | 10 | 11 | # create a .log file with name "date_time.log" 12 | LOG_FILE="$(date "+%d%m%Y_%H%M%S").log" 13 | DATASET="./datasets/data12.csv" 14 | BANDWIDTH=3 15 | 16 | 17 | # Execute the program and return its execution time 18 | # 19 | # $1 executable 20 | function executeProgram() { 21 | "$1" "$DATASET" $BANDWIDTH >> "$LOG_FILE" 22 | 23 | # the final output is "Elapsed time: