面试被面试官问:3D目标检测预处理优化策略有哪些?

01 前言:

3D目标检测是计算机视觉领域中一个重要的任务,广泛应用于自动驾驶、机器人导航、无人机等领域。由于3D数据的复杂性和多样性,数据预处理在3D目标检测中扮演着关键角色。良好的预处理策略不仅可以提升模型的检测精度,还可以显著提高模型的训练和推理效率。本文将探讨几种常用的3D目标检测预处理优化策略。

02 对原始数据进行编码

使用强度信息与时间信息

def absolute_coordinates_encoding(self, points=None):if points is None:num_output_features = len(self.used_feature_list)return num_output_featuresassert points.shape[-1] == len(self.src_feature_list)point_feature_list = [points[:, 0:3]]for x in self.used_feature_list:if x in ['x', 'y', 'z']:continueidx = self.src_feature_list.index(x)point_feature_list.append(points[:, idx:idx+1])point_features = np.concatenate(point_feature_list, axis=1)return point_features, True

使用多帧数据

   def get_lidar_with_sweeps(self, index, max_sweeps=1):info = self.infos[index]lidar_path = self.root_path / info['lidar_path']points = np.fromfile(str(lidar_path), dtype=np.float32, count=-1).reshape([-1, 5])[:, :4]        sweep_points_list = [points]sweep_times_list = [np.zeros((points.shape[0], 1))]for k in np.random.choice(len(info['sweeps']), max_sweeps - 1, replace=False):points_sweep, times_sweep = self.get_sweep(info['sweeps'][k])sweep_points_list.append(points_sweep)sweep_times_list.append(times_sweep)points = np.concatenate(sweep_points_list, axis=0)times = np.concatenate(sweep_times_list, axis=0).astype(points.dtype)points = np.concatenate((points, times), axis=1)return points

03 对原始数据进行处理

打乱数据

    def shuffle_points(self, data_dict=None, config=None):if data_dict is None:return partial(self.shuffle_points, config=config)if config.SHUFFLE_ENABLED[self.mode]:points = data_dict['points']shuffle_idx = np.random.permutation(points.shape[0])points = points[shuffle_idx]data_dict['points'] = pointsreturn data_dict

进行翻转


def double_flip(self, points):# y flippoints_yflip = points.copy()points_yflip[:, 1] = -points_yflip[:, 1]# x flippoints_xflip = points.copy()points_xflip[:, 0] = -points_xflip[:, 0]# x y flippoints_xyflip = points.copy()points_xyflip[:, 0] = -points_xyflip[:, 0]points_xyflip[:, 1] = -points_xyflip[:, 1]return points_yflip, points_xflip, points_xyflip

将其转成voxel

def transform_points_to_voxels(self, data_dict=None, config=None):if data_dict is None:grid_size = (self.point_cloud_range[3:6] - self.point_cloud_range[0:3]) / np.array(config.VOXEL_SIZE)self.grid_size = np.round(grid_size).astype(np.int64)self.voxel_size = config.VOXEL_SIZE# just bind the config, we will create the VoxelGeneratorWrapper later,# to avoid pickling issues in multiprocess spawnreturn partial(self.transform_points_to_voxels, config=config)if self.voxel_generator is None:self.voxel_generator = VoxelGeneratorWrapper(vsize_xyz=config.VOXEL_SIZE,coors_range_xyz=self.point_cloud_range,num_point_features=self.num_point_features,max_num_points_per_voxel=config.MAX_POINTS_PER_VOXEL,max_num_voxels=config.MAX_NUMBER_OF_VOXELS[self.mode],)points = data_dict['points']voxel_output = self.voxel_generator.generate(points)voxels, coordinates, num_points = voxel_output

对数据进行下采样

def sample_points(self, data_dict=None, config=None):if data_dict is None:return partial(self.sample_points, config=config)num_points = config.NUM_POINTS[self.mode]if num_points == -1:return data_dictpoints = data_dict['points']if num_points < len(points):pts_depth = np.linalg.norm(points[:, 0:3], axis=1)pts_near_flag = pts_depth < 40.0far_idxs_choice = np.where(pts_near_flag == 0)[0]near_idxs = np.where(pts_near_flag == 1)[0]choice = []if num_points > len(far_idxs_choice):near_idxs_choice = np.random.choice(near_idxs, num_points - len(far_idxs_choice), replace=False)choice = np.concatenate((near_idxs_choice, far_idxs_choice), axis=0) \if len(far_idxs_choice) > 0 else near_idxs_choiceelse: choice = np.arange(0, len(points), dtype=np.int32)choice = np.random.choice(choice, num_points, replace=False)np.random.shuffle(choice)else:choice = np.arange(0, len(points), dtype=np.int32)if num_points > len(points):extra_choice = np.random.choice(choice, num_points - len(points), replace=False)choice = np.concatenate((choice, extra_choice), axis=0)np.random.shuffle(choice)data_dict['points'] = points[choice]return data_dict

04 对真值数据进行处理

将数据翻转

def random_world_flip(self, data_dict=None, config=None):if data_dict is None:return partial(self.random_world_flip, config=config)gt_boxes, points = data_dict['gt_boxes'], data_dict['points']for cur_axis in config['ALONG_AXIS_LIST']:assert cur_axis in ['x', 'y']gt_boxes, points, enable = getattr(augmentor_utils, 'random_flip_along_%s' % cur_axis)(gt_boxes, points, return_flip=True)data_dict['flip_%s'%cur_axis] = enableif 'roi_boxes' in data_dict.keys():num_frame, num_rois,dim = data_dict['roi_boxes'].shaperoi_boxes, _, _ = getattr(augmentor_utils, 'random_flip_along_%s' % cur_axis)(data_dict['roi_boxes'].reshape(-1,dim), np.zeros([1,3]), return_flip=True, enable=enable)data_dict['roi_boxes'] = roi_boxes.reshape(num_frame, num_rois,dim)data_dict['gt_boxes'] = gt_boxesdata_dict['points'] = pointsreturn data_dict

将数据旋转

def random_world_rotation(self, data_dict=None, config=None):if data_dict is None:return partial(self.random_world_rotation, config=config)rot_range = config['WORLD_ROT_ANGLE']if not isinstance(rot_range, list):rot_range = [-rot_range, rot_range]gt_boxes, points, noise_rot = augmentor_utils.global_rotation(data_dict['gt_boxes'], data_dict['points'], rot_range=rot_range, return_rot=True)if 'roi_boxes' in data_dict.keys():num_frame, num_rois,dim = data_dict['roi_boxes'].shaperoi_boxes, _, _ = augmentor_utils.global_rotation(data_dict['roi_boxes'].reshape(-1, dim), np.zeros([1, 3]), rot_range=rot_range, return_rot=True, noise_rotation=noise_rot)data_dict['roi_boxes'] = roi_boxes.reshape(num_frame, num_rois,dim)data_dict['gt_boxes'] = gt_boxesdata_dict['points'] = pointsdata_dict['noise_rot'] = noise_rotreturn data_dict

将数据缩放

   def random_world_scaling(self, data_dict=None, config=None):if data_dict is None:return partial(self.random_world_scaling, config=config)if 'roi_boxes' in data_dict.keys():gt_boxes, roi_boxes, points, noise_scale = augmentor_utils.global_scaling_with_roi_boxes(data_dict['gt_boxes'], data_dict['roi_boxes'], data_dict['points'], config['WORLD_SCALE_RANGE'], return_scale=True)data_dict['roi_boxes'] = roi_boxeselse:gt_boxes, points, noise_scale = augmentor_utils.global_scaling(data_dict['gt_boxes'], data_dict['points'], config['WORLD_SCALE_RANGE'], return_scale=True)data_dict['gt_boxes'] = gt_boxesdata_dict['points'] = pointsdata_dict['noise_scale'] = noise_scalereturn data_dict

你还知道哪些预处理的方法,留下你的想法?

最后别忘了,帮忙点“在看”。  

您的点赞,在看,是我创作的动力。

关注我的公众号auto_driver_ai(Ai fighting), 第一时间获取更新内容。

AiFighing是全网第一且唯一以代码、项目的形式讲解自动驾驶感知方向的关键技术,关注我,一起学习自动驾驶感知技术。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/web/51451.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

并发知识笔记

一、使用线程持有变量获取线程执行结果 /*** 线程持有变量*/private static final ThreadLocal<Map<String, Object>> MAP_THREAD_LOCAL ThreadLocal.withInitial(HashMap::new);// ----------------------------------------------------------------正文int dat…

Day1:88. 合并两个有序数组、27.移除元素、26.删除有序数组中的重复项

此次挑战的是leetcode面试150题&#xff0c;每天刷三题&#xff0c;争取一小时内结束。 88. 合并两个有序数组 思路直接想到&#xff0c;双指针&#xff0c;从后往前放&#xff08;避免数组移动&#xff09;&#xff0c;但是没有考虑到nums1结束了&#xff0c; nums2还没结束…

Flat Ads:全球金融应用的营销投放洞察

随着移动互联网的普及,金融应用在全球范围内迅速崛起。无论是移动银行、支付服务,还是理财工具,金融类应用已经成为现代生活中不可或缺的一部分。根据最新的行业报告,全球金融应用的下载量和用户活跃度在过去几年里持续增长,尤其是在新兴市场,用户对数字金融服务的需求不断攀升…

力扣top100-链表类题易错点总结-c++实现(更新中)

首先给一个我之前写的双指针在链表类题中的妙用的link&#xff1a;双指针在链表中的妙用 tip1 来自“合并两个有序链表” 题目链接戳这里 这道题注意的就是如果是要返回一个新链表的头结点&#xff0c;一定要新建一个头结点&#xff1a; ListNode* prehead new ListNode…

java框架第二课(Reflection反射机制)

一.关于反射 (1)使用场景介绍 平常我们写代码时&#xff0c;都是已知类名&#xff0c;类的属性&#xff0c;构造方法&#xff0c;其他方法等信息&#xff0c;然后根据类名new对象&#xff0c;这个过程称为正向操作(例如&#xff1a;有一个管理员类&#xff0c;有账号和密码属…

【SQL】三角形判断

目录 题目 分析 代码 题目 表: Triangle ------------------- | Column Name | Type | ------------------- | x | int | | y | int | | z | int | ------------------- 在 SQL 中&#xff0c;(x, y, z)是该表的主键列。 该表的每一行包…

Sigmoid 函数及其导数推导

Sigmoid 函数及其导数推导 1. 了解 Sigmoid 函数 Sigmoid 函数是神经网络中常用的激活函数&#xff0c;因其平滑的S形曲线和将输入压缩至 (0, 1) 的特性&#xff0c;在神经网络的激活函数中扮演着重要角色。其定义如下&#xff1a; σ ( x ) 1 1 e − x \sigma(x) \frac{1…

FunASR自动语音识别的创新平台

1. 什么是自动语音识别&#xff08;ASR&#xff09; 自动语音识别&#xff08;ASR, Automatic Speech Recognition&#xff09;是一种将语音信号转换为文本的技术。随着语音助手、智能家居、翻译系统等应用的兴起&#xff0c;ASR技术的重要性日益凸显。传统的ASR系统依赖于复杂…

操作系统线程属性

线程属性 int pthread_create (pthread_t* restrict thread,const pthread_attr_t* restrict attr,void* (*start_routine) (void*),void* restrict arg); ​ //创建线程函数的第二个参数即为线程属性&#xff0c;传空指针表示使用缺省属性。 typedef struct {// 分离状态int …

【应用开发】解决正点原子I.MX6ull应用编程zlib移植问题

问题描述 在正点原子应用开发移植zlib库的时候&#xff0c;文档中有这样一段描述&#xff0c;先删除开发板中的zlib库&#xff0c;然后再拷贝zlib库 这就会导致在使用scp命令拷贝编译好的zlib库的时候报错没有zlib.so.1&#xff0c;如下图所示&#xff1a; 解决方法 千万不…

《算法竞赛进阶指南》0x27A*

如果给定一个“目标状态”&#xff0c;需要求出从初态到目标状态的最小代价&#xff0c;那么优先队列BFS的“优先策略”显然不完善。一个状态的当前代价最小&#xff0c;只能说明从起始状态到当前状态得到代价很小&#xff0c;而在未来的搜索中&#xff0c;从该状态到目标状态可…

安卓好软-----手机端提取apk的小工具 方便简单 无需root权限

apk提取工具 工具小巧。可以提取手机上面当前安装的apk和系统应用apk。而且无需root权限即可正常使用。 效果非常不错。比其他工具提取系统app方便好使。 下载&#xff1a;https://download.csdn.net/download/mg668/89683199?spm1001.2014.3001.5503

探索贪心算法:解决优化问题的高效策略

贪心算法是一种在每一步选择中都采取当前最佳选择的算法&#xff0c;以期在整体上达到最优解。它广泛应用于各种优化问题&#xff0c;如最短路径、最小生成树、活动选择等。本文将介绍贪心算法的基本概念、特点、应用场景及其局限性。 贪心算法的基本概念 贪心算法的核心思想是…

详解ACL限制SSH、Telnet远程登录及抓包实验

要求&#xff1a;lsw5只能lsw6登录&#xff0c;lsw6只能PC2登录 <Huawei>sys [Huawei]sysname sw2 [sw2]int vlanif1 [sw2-Vlanif1]ip address 192.168.10.2 24 [sw2-Vlanif1]q [sw2] <Huawei>sys [Huawei]sysname sw1 [sw1]int vlanif1 [sw1-Vlanif1]ip address …

动态代理IP的适用范围与优势分析

1. 什么是动态代理IP&#xff1f; 动态代理IP是一种在每次连接时更换IP地址的代理服务。与静态代理IP不同&#xff0c;动态代理IP会在每次访问时分配一个新的IP地址&#xff0c;或在设定的时间间隔内自动更换。这种机制使得动态代理IP非常适合需要频繁更换IP的应用场景。 2. …

视频单条剪、脚本靠手写?云微客开启海量视频时代

老板们注意了&#xff0c;现在已不再是视频单条剪&#xff0c;脚本靠手写的时代&#xff01;在这个信息爆炸的时代&#xff0c;短视频已经成为了现代信息传播和娱乐消费的重要载体&#xff0c;那么我们该如何高效、快速地制作出大量高质量的短视频内容呢&#xff1f;这就需要云…

面试必备:接口自动化测试精选面试题大全

一、 请问你是如何做接口测试的&#xff1f; 大体来说&#xff0c;经历以下过程&#xff1a;接口需求调研、接口测试工具选择、接口测试用例编写、接口测试执行、接口测试回归、接口测试自动化持续集成。具体来说&#xff0c;接口测试流程分成以下九步&#xff1a; 第一步&am…

SpringBoot集成kafka开发-消息消费的分区策略(消费者如何判断从哪个分区中消费消息的?)

这里写目录标题 1、kafak消息者消费消息的4种分区策略2、kafka默认的消费分区策略1-RangeAssignor&#xff08;均匀分配、默认分配策略&#xff09;2.1、代码验证RangeAssignor的消息分区策略2.1.1、消费者2.1.2、生产者2.1.3、kafak配置类2.1.4、对象实体类2.1.5、项目配置文件…

基于vue框架的病床管理信息系统odt4v(程序+源码+数据库+调试部署+开发环境)系统界面在最后面。

系统程序文件列表 开题报告内容 基于Vue框架的病床管理信息系统开题报告 一、引言 随着医疗技术的不断进步和人口老龄化的加剧&#xff0c;医院面临着日益增长的医疗服务需求。病床作为医院资源的重要组成部分&#xff0c;其管理效率直接影响到患者的就医体验和医院的运营效…

Elasticsearch(面试篇)

目录 Elasticsearch的倒排索引是什么&#xff1f; 详细描述一下Elasticsearch更新和删除文档的过程 描述一下Elasticsearch搜索的过程 兄弟们一起加油 &#xff01; &#xff01; &#xff01; Elasticsearch的倒排索引是什么&#xff1f; 传统我们索引通过文章&#xff0c…