当前位置: 首页 > news >正文

面试被面试官问: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是全网第一且唯一以代码、项目的形式讲解自动驾驶感知方向的关键技术,关注我,一起学习自动驾驶感知技术。

相关文章:

  • 北京网站建设多少钱?
  • 辽宁网页制作哪家好_网站建设
  • 高端品牌网站建设_汉中网站制作
  • 计算机网络模型
  • kafak集群搭建-基于zookeeper方式
  • 七牛云文件存储
  • 大模型在应用开发安全左移实践
  • 【C/C++】Sleep()函数详解
  • GPIO(通用输入/输出)、中断(hal库)
  • Chrome 中的 RCE 会在 JIT 编译器中产生不正确的副作用
  • 【Linux】匿名管道
  • TypeSript8 泛型学习
  • 【算法进阶1】贪心算法、背包问题(0-1背包、分数背包)、拼接最大数字问题、活动选择问题
  • 6 - Linux PXE高效批量网络装机
  • CacheLoader和装饰器模式
  • 无刷电机、有刷电机和步进电机的区别
  • 初赛笔记1
  • OD C卷 - 项目排期/最少交付时间
  • 《剑指offer》分解让复杂问题更简单
  • CSS盒模型深入
  • Java基本数据类型之Number
  • JS函数式编程 数组部分风格 ES6版
  • laravel5.5 视图共享数据
  • open-falcon 开发笔记(一):从零开始搭建虚拟服务器和监测环境
  • puppeteer stop redirect 的正确姿势及 net::ERR_FAILED 的解决
  • SegmentFault 2015 Top Rank
  • WinRAR存在严重的安全漏洞影响5亿用户
  • 从零开始在ubuntu上搭建node开发环境
  • 回顾 Swift 多平台移植进度 #2
  • 基于OpenResty的Lua Web框架lor0.0.2预览版发布
  • 力扣(LeetCode)21
  • 用 Swift 编写面向协议的视图
  • 看到一个关于网页设计的文章分享过来!大家看看!
  • 如何通过报表单元格右键控制报表跳转到不同链接地址 ...
  • 智能情侣枕Pillow Talk,倾听彼此的心跳
  • #Datawhale X 李宏毅苹果书 AI夏令营#3.13.2局部极小值与鞍点批量和动量
  • #define MODIFY_REG(REG, CLEARMASK, SETMASK)
  • #HarmonyOS:软件安装window和mac预览Hello World
  • (超详细)语音信号处理之特征提取
  • (附源码)springboot助农电商系统 毕业设计 081919
  • (欧拉)openEuler系统添加网卡文件配置流程、(欧拉)openEuler系统手动配置ipv6地址流程、(欧拉)openEuler系统网络管理说明
  • (一)80c52学习之旅-起始篇
  • (转)EXC_BREAKPOINT僵尸错误
  • (转)JVM内存分配 -Xms128m -Xmx512m -XX:PermSize=128m -XX:MaxPermSize=512m
  • (轉貼) VS2005 快捷键 (初級) (.NET) (Visual Studio)
  • *(长期更新)软考网络工程师学习笔记——Section 22 无线局域网
  • .bat批处理(一):@echo off
  • .java 指数平滑_转载:二次指数平滑法求预测值的Java代码
  • .net core 6 集成 elasticsearch 并 使用分词器
  • .NET 服务 ServiceController
  • .NET设计模式(8):适配器模式(Adapter Pattern)
  • .pub是什么文件_Rust 模块和文件 - 「译」
  • .vimrc 配置项
  • ??Nginx实现会话保持_Nginx会话保持与Redis的结合_Nginx实现四层负载均衡
  • @PreAuthorize与@Secured注解的区别是什么?
  • @RequestParam,@RequestBody和@PathVariable 区别
  • [ Linux 长征路第五篇 ] make/Makefile Linux项目自动化创建工具
  • [Android] Amazon 的 android 音视频开发文档