def count_classes_seq(label_files: list): fb_counter = SequentialFeedbackCounter(SEQUENTIAL_FEEDBACK) class_count = NumberDict() for label_file in label_files: fb_counter.count() labels, _, num_labels = fpt.count_labels(label_file) counts = [1] * len(labels) class_count.add(labels, counts) fb_counter.done() return class_count
def count_weights_seq(label_files: list, label_learning_map: dict, label_ignore_map: dict, label_weights: dict): fb_counter = SequentialFeedbackCounter(SEQUENTIAL_FEEDBACK) weight_count = {} for label_file in label_files: fb_counter.count() weight = fpt.get_weight(label_file, label_learning_map, label_ignore_map, label_weights) weight_count[weight] = weight_count.get(weight, 0) + 1 fb_counter.done() return weight_count
def sequential_sum_std_in_sequence(laserscan_files, mean_vector): start = time.time() fb_counter = SequentialFeedbackCounter(SEQUENTIAL_FEEDBACK) scan_sums = [] for laserscan_file in laserscan_files: fb_counter.count() scan_sum = sum_std_values(laserscan_file, mean_vector) scan_sums.append(scan_sum) end = time.time() proc_time = end - start fb_counter.done() scan_sums = np.concatenate(scan_sums, axis=0) return scan_sums, proc_time
def sequential_calc_freq_seq(label_files): start = time.time() freq_dict = NumberDict() fb_counter = SequentialFeedbackCounter(SEQUENTIAL_FEEDBACK) total_num_labels = 0 for label_file in label_files: fb_counter.count() labels, counts, num_labels = fpt.count_labels(label_file) total_num_labels += num_labels freq_dict.add(labels, counts) end = time.time() proc_time = end - start fb_counter.done() return freq_dict, total_num_labels, proc_time
def sequential_downsample_sequence(laserscan_files: list, label_files: list, output_path: str, overwrite: bool): fb_counter = SequentialFeedbackCounter(SEQUENTIAL_FEEDBACK) saved_files = 0 start = time.time() for laserscan_file, label_file in zip(laserscan_files, label_files): fb_counter.count() dwns_laserscan, name = downsample_file(laserscan_file, label_file) fpt.save_scan(dwns_laserscan, name, output_path, overwrite) saved_files += 1 end = time.time() fb_counter.done() proc_time = end - start return proc_time, saved_files
def get_pcd_list(file_dict: dict, cm: dict): print("Collecting laserscans") laserscans = [] if len(file_dict) > 1: raise Exception("Can only draw one sequence at a time.") sequence = list(file_dict.keys())[0] files = file_dict[sequence] laserfiles = files["laserscans"] labelfiles = files["labels"] fb_counter = SequentialFeedbackCounter(FEEDBACK_COUNT) for laserfile, labelfile in zip(laserfiles, labelfiles): fb_counter.count() laserscan, _ = fpt.read_laserscan(laserfile, labelfile) colors = lv.get_label_colors(laserscan, cm) pcd = lv.convert_laserscan_2_open3d(laserscan, colors) laserscans.append(pcd) fb_counter.done() return laserscans