<jupyter_start><jupyter_text>Getting bounding boxes and grep statistics for sequence<jupyter_code>PATH_TO_DATASET = '../dataset/sequences/00/'
VELODYNE        = 'velodyne/'
LABELS          = 'labels/'
PREFIX_SCAN     = '000'
import glob
scan_lst = sorted(glob.glob(PATH_TO_DATASET + VELODYNE + "*.bin"))
labels_lst = sorted(glob.glob(PATH_TO_DATASET + LABELS + "*.label"))
assert len(scan_lst) == len(labels_lst)
print('READ OK, number of scans ', len(scan_lst))
params = {'x_voxels'     : 0.3, 'y_voxels': 0.2,  'z_voxels': 0.5, 
          'roi_x_min'    : 0,   'roi_x_max'                 : 45,
          'roi_y_min'    : -14, 'roi_y_max'                 : 14,
          'roi_z_min'    : -2,  'roi_z_max'                 : 1, 
          'tol_distance' : 0.7, 'min_cluster_size'          : 30,
          'radius_search': 0.3,   'min_neighbors_in_radius' : 5}
%%time
pcl_utils = reload(pcl_utils)
pcl_pipeline = reload(pcl_pipeline)
test = reload(test)
n_scan = -1
write_path = PATH_TO_DATASET + 'clusters/'
# write_path = None
pipeline = pipeline_optimized_pcl
bbox_dct, exec_time_dct, stats = test.get_bbox_and_stat(scan_lst, labels_lst, obstacle_lst,
                                                        pipeline, write_path=write_path, 
                                                        OBB=True, detailed=True, write_seg_id=False,
                                                        **params)
steps = list(stats[0].keys())
steps_exec_time = []
for step in steps:
    steps_exec_time.append([stat[step] for stat in stats])
plt.figure(figsize=(14,5))
for i, step in enumerate(steps):
    plt.plot(steps_exec_time[i], label=step)
plt.legend(loc='best')
plt.xlabel('Scan')
plt.ylabel('Time, seconds')
plt.grid()
plt.show()
time_stat = list(exec_time_dct.values())
print('Min process time {} s'.format(min(time_stat)))
print('Mean process time {} s'.format(np.mean(time_stat)))
print('Std process time {} s'.format(np.std(time_stat)))
print('Max process time {} s'.format(max(time_stat)))
ox = [int(x) for x in list(exec_time_dct.keys())]
oy = time_stat
plt.figure(figsize=(16, 5))
plt.plot(ox, oy)
plt.xlabel('Scan')
plt.ylabel('Time in seconds')
plt.grid()
plt.xticks(rotation=45)
plt.show()<jupyter_output><empty_output><jupyter_text>Grep statistics of execution time<jupyter_code>exec_lst = []
n_epoch = 3
for i in range(n_epoch):
    exec_time_dct = {}
    _, exec_time_dct, _ = test.get_bbox_and_stat_pcl(scan_lst[:n_scan], labels_lst[:n_scan], obstacle_lst,
                                                 pipeline, 
                                                 write_path=None, **params_)
    exec_lst.append(exec_time_dct)
exec_time_dct
several_exec_time_lst = [] 
for epoch in exec_lst:
    several_exec_time_lst.append([tdelta for tdelta in epoch.values()])
several_exec_time_lst = list(zip(several_exec_time_lst[0],
                                 several_exec_time_lst[1],
                                 several_exec_time_lst[2]))
oy_mean = [np.mean(exec_times) for exec_times in several_exec_time_lst]
oy_min = [min(exec_times) for exec_times in several_exec_time_lst]
oy_max = [max(exec_times) for exec_times in several_exec_time_lst]
plt.figure(figsize=(16, 6))
plt.plot(ox, oy_mean, label='mean exec time')
plt.plot(ox, oy_min, '.', label='min exec time')
plt.plot(ox, oy_max, '.', label='max exec time')
ax = plt.axes()        
ax.yaxis.grid()
plt.xticks(rotation=45)
plt.xlabel('Scan')
plt.ylabel('Time in seconds')
plt.legend()
plt.show()
time_stat = list(exec_time_dct.values())
print('Min process time {}s'.format(min(oy_mean)))
print('Mean process time {}s'.format(np.mean(oy_mean)))
print('Std process time {}s'.format(np.std(oy_mean)))
print('Max process time {}s'.format(max(oy_mean)))<jupyter_output>Min process time 0.209287s
Mean process time 0.2678662016011645s
Std process time 0.02793672891606516s
Max process time 0.5238816666666667s
{'fraction_non_alphanumeric': 0.13558013892462054, 'fraction_numerical': 0.02701312065860561, 'mean_word_length': 3.2445414847161573, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 1, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '606678', 'license': 'MIT', 'n_tokens_mistral': 1478, 'n_tokens_neox': 1371, 'n_words': 264, 'path': 'obstacle-detection/examples/pcl_pipeline.ipynb', 'repo_name': 'orrrrtem/PointCloudSegmentation', 'size': '3887'}