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

网站地区词优化做个网站怎样做的

网站地区词优化,做个网站怎样做的,电商运营自学网站,广州网站建设系统项目地址#xff1a; https://github.com/zhulf0804/PCReg.PyTorch/tree/main 网络简介#xff1a; 网络是基于PointNet Concat FC的#xff0c;它没有其它复杂的结构#xff0c;易于复现。因其简洁性#xff0c;这里暂且把其称作点云配准的Benchmark。因作者源码中复杂…项目地址 https://github.com/zhulf0804/PCReg.PyTorch/tree/main 网络简介 网络是基于PointNet Concat FC的它没有其它复杂的结构易于复现。因其简洁性这里暂且把其称作点云配准的Benchmark。因作者源码中复杂的(四元数, 旋转矩阵, 欧拉角之间)的变换操作和冗余性且其PyTorch版本的不完整性(缺少评估模型等最近又更新了) 项目详细介绍 基于深度学习的点云配准Benchmark 本文方法与常见的图像配准逻辑类似基于采样与transfrom操作从源点云生成目标点云然后进行训练与评测。总体看来效果不如open3d自带的fgr方法可以作为入门级项目进行使用。 1、运行环境安装 1.1 项目下载 打开https://github.com/zhulf0804/PCReg.PyTorch/tree/main点Download ZIP然后将代码解压到指定目录下即可。 1.2 依赖项安装 在装有pytorch的环境终端进入PCReg.PyTorch-main目录执行以下安装命令 pip install -r requirements.txt python -m pip install open3d0.9emd loss编译 如果不做训练使用可以不用进行emd loss编译。 cd loss/cuda/emd_torch python setup.py install 在编译过程中很有可能碰到报错 File C:\Users\Administrator\miniconda3\lib\site-packages\torch\utils\cpp_extension.py, line 499, in build_extensions_check_cuda_version(compiler_name, compiler_version)File C:\Users\Administrator\miniconda3\lib\site-packages\torch\utils\cpp_extension.py, line 387, in _check_cuda_versionraise RuntimeError(CUDA_MISMATCH_MESSAGE.format(cuda_str_version, torch.version.cuda)) RuntimeError: The detected CUDA version (12.1) mismatches the version that was used to compile PyTorch (11.7). Please make sure to use the same CUDA versions.这是由于PyTorch 的cuda版本与系统自带的cuda版本不同所导致的可以先使用一下命令卸载过往的torch版本慎重操作,然后重新安装torch;也可以在conda环境中重新创建一个符合系统cuda版本的torch环境。 pip uninstall torch torchvision torchaudio 在上述信息输出中博主的cuda版本为12.1我们可以打开pytorch官网找打符合自己电脑cuda版本的pytorch安装命令. 如果cuda版本较早可以在 https://pytorch.org/get-started/previous-versions/ 中找到安装命令。 在正确的安装cuda版本后重新执行命令即可实现emd-loss的安装 1.3 模型与数据下载 modelnet40数据集 [here, 435M] 可用的预训练模型 [Complete, pwd: c4z7, 16.09 M] or [Paritial, pwd: pcno, 16.09] first) 模型下载好后将其放置到PCReg.PyTorch项目根路径下即可。 2. 关键代码说明 2.1 数据加载器 在data目录下有CustomData.py和ModelNet40.py两个文件其中ModelNet40文件对应modelnet40数据集的加载CustomData文件对应自己个人数据集的加载。从两个文件的__getitem__函数中可以发现模型不是基于数据对进行训练的。其依据ref_cloud随机采样生成ref_cloud然后对ref_cloud进行transform操作。具体实例如下所示: def __getitem__(self, item):file self.files[item]ref_cloud readpcd(file, rtypenpy)ref_cloud random_select_points(ref_cloud, mself.npts)ref_cloud pc_normalize(ref_cloud)R, t generate_random_rotation_matrix(-20, 20), \generate_random_tranlation_vector(-0.5, 0.5)src_cloud transform(ref_cloud, R, t)if self.train:ref_cloud jitter_point_cloud(ref_cloud)src_cloud jitter_point_cloud(src_cloud)return ref_cloud, src_cloud, R, t在以上代码中需要注意的是所有的点云都进行了坐标值的归一化处理 2.2 模型结构 在model目录下有benchmark.py、fgr.py、icp.py分别为模型配准fgr配准icp配准方法。其中fgr配准与icp配准方法是使用open3d库实现。 benchmark benchmark为本文模型其是基于PointNet所实现的一个孪生网络核心代码如Benchmark类所示。其基于encoder提取2个点云的特征然后简单的使用全连接层将两个点云的特征进行交互然后再输出两个点云的特征。在这里最为重要的是loss的设计,即如何设计优化目标使模型参数以点云配准为优化方向 class Benchmark(nn.Module):def __init__(self, gn, in_dim1, in_dim22048, fcs[1024, 1024, 512, 512, 256, 7]):super(Benchmark, self).__init__()self.in_dim1 in_dim1self.encoder PointNet(in_dimin_dim1, gngn)self.decoder nn.Sequential()for i, out_dim in enumerate(fcs):self.decoder.add_module(ffc_{i}, nn.Linear(in_dim2, out_dim))if out_dim ! 7:if gn:self.decoder.add_module(fgn_{i},nn.GroupNorm(8, out_dim))self.decoder.add_module(frelu_{i}, nn.ReLU(inplaceTrue))in_dim2 out_dimdef forward(self, x, y):x_f, y_f self.encoder(x), self.encoder(y)concat torch.cat((x_f, y_f), dim1)out self.decoder(concat)batch_t, batch_quat out[:, :3], out[:, 3:] / torch.norm(out[:, 3:], dim1, keepdimTrue)batch_R batch_quat2mat(batch_quat)if self.in_dim1 3:transformed_x batch_transform(x.permute(0, 2, 1).contiguous(),batch_R, batch_t)elif self.in_dim1 6:transformed_pts batch_transform(x.permute(0, 2, 1)[:, :, :3].contiguous(),batch_R, batch_t)transformed_nls batch_transform(x.permute(0, 2, 1)[:, :, 3:].contiguous(),batch_R)transformed_x torch.cat([transformed_pts, transformed_nls], dim-1)else:raise ValueErrorreturn batch_R, batch_t, transformed_xclass IterativeBenchmark(nn.Module):def __init__(self, in_dim, niters, gn):super(IterativeBenchmark, self).__init__()self.benckmark Benchmark(gngn, in_dim1in_dim)self.niters nitersdef forward(self, x, y):transformed_xs []device x.deviceB x.size()[0]transformed_x torch.clone(x)batch_R_res torch.eye(3).to(device).unsqueeze(0).repeat(B, 1, 1)batch_t_res torch.zeros(3, 1).to(device).unsqueeze(0).repeat(B, 1, 1)for i in range(self.niters):batch_R, batch_t, transformed_x self.benckmark(transformed_x, y)transformed_xs.append(transformed_x)batch_R_res torch.matmul(batch_R, batch_R_res)batch_t_res torch.matmul(batch_R, batch_t_res) \ torch.unsqueeze(batch_t, -1)transformed_x transformed_x.permute(0, 2, 1).contiguous()batch_t_res torch.squeeze(batch_t_res, dim-1)#transformed_x transformed_x.permute(0, 2, 1).contiguous()return batch_R_res, batch_t_res, transformed_xsfgr配准方法 import copy import open3d as o3ddef fpfh(pcd, normals):pcd.normals o3d.utility.Vector3dVector(normals)pcd_fpfh o3d.registration.compute_fpfh_feature(pcd,o3d.geometry.KDTreeSearchParamHybrid(radius0.3, max_nn64))return pcd_fpfhdef execute_fast_global_registration(source, target, source_fpfh, target_fpfh):distance_threshold 0.01result o3d.registration.registration_fast_based_on_feature_matching(source, target, source_fpfh, target_fpfh,o3d.registration.FastGlobalRegistrationOption(maximum_correspondence_distancedistance_threshold))transformation result.transformationestimate copy.deepcopy(source)estimate.transform(transformation)R, t transformation[:3, :3], transformation[:3, 3]return R, t, estimatedef fgr(source, target, src_normals, tgt_normals):source_fpfh fpfh(source, src_normals)target_fpfh fpfh(target, tgt_normals)R, t, estimate execute_fast_global_registration(sourcesource,targettarget,source_fpfhsource_fpfh,target_fpfhtarget_fpfh)return R, t, estimate ICP配准方法 import copy import numpy as np import open3d as o3ddef icp(source, target):max_correspondence_distance 2 # 0.5 in RPM-Netinit np.eye(4, dtypenp.float32)estimation_method o3d.pipelines.registration.TransformationEstimationPointToPoint()reg_p2p o3d.pipelines.registration.registration_icp(sourcesource,targettarget,initinit,max_correspondence_distancemax_correspondence_distance,estimation_methodestimation_method)transformation reg_p2p.transformationestimate copy.deepcopy(source)estimate.transform(transformation)R, t transformation[:3, :3], transformation[:3, 3]return R, t, estimate3.基本使用 modelnet40数据集的评测及训练可以使用一下代码实现 # Iterative Benchmarkpython modelnet40_evaluate.py --root your_data_path/modelnet40_ply_hdf5_2048 --checkpoint your_ckpt_path/test_min_loss.pth --cuda# Visualization# python modelnet40_evaluate.py --root your_data_path/modelnet40_ply_hdf5_2048 --checkpoint your_ckpt_path/test_min_loss.pth --show# ICP# python modelnet40_evaluate.py --root your_data_path/modelnet40_ply_hdf5_2048 --method icp# FGR# python modelnet40_evaluate.py --root your_data_path/modelnet40_ply_hdf5_2048 --method fgr --normal train CUDA_VISIBLE_DEVICES0 python modelnet40_train.py --root your_data_path/modelnet40_ply_hdf5_2048这里注意讲述训练与评测自己的数据集其中自己数据集的路径如下所示里面都是处理好的pcd点云数据。 具体格式为 |- CustomData(dir)|- train_data(dir)- train1.pcd- train2.pcd- ...|- val_data(dir)- val1.pcd- val2.pcd- ...3.1 ICP方法性能评测 可以加上 --show 参数来查看每一个配准的数据 python custom_evaluate.py --root cumstom_data --infer_npts 2048 --method icp --normal如果出现以下报错则用open3d.pipelines.registration替换open3d.registration具体可以用本博文的ICP配准方法替换掉models\icp.py中的内容 Traceback (most recent call last):File custom_evaluate.py, line 142, in moduleevaluate_icp(args, test_loader)File custom_evaluate.py, line 98, in evaluate_icpR, t, pred_ref_cloud icp(npy2pcd(src_cloud), npy2pcd(ref_cloud))File D:\点云AI配准\PCReg.PyTorch-main\models\icp.py, line 9, in icpestimation_method o3d.registration.TransformationEstimationPointToPoint() AttributeError: module open3d has no attribute registration具体执行输出如下所示 3.2 模型训练 训练命令 python custom_train.py --root cumstom_data --train_npts 2048 训练好的模型保存在work_dirs\models\checkpoints目录中 评测命令 python custom_evaluate.py --infer_npts 2048 --root cumstom_data --checkpoint work_dirs\models\checkpoints\test_min_loss.pth --show 其中绿色点云为源点云红色点云为参考点云蓝色点云为配准后的源点云可以看到蓝色点云与红色点云完全没有对齐这表明训练效果极其不佳。这或许是训练数据太少所导致的毕竟本次实验只有18个点云数据。 4、原文效果 下图是作者论文中的配准效果图 在modelnet40数据集上相关精度信息如下所示可以确定本文方法与FGR方法相比没有显著性优势。 Point-to-Point Correspondences(R error is large due to EMDLoss, see here) Methodisotropic Risotropic tanisotropic R(mse, mae)anisotropic t(mse, mae)time(s)ICP11.440.1617.64(5.48)0.22(0.07)0.07FGR0.010.000.07(0.00)0.00(0.00)0.19IBenchmark5.680.079.77(2.69)0.12(0.03)0.022IBenchmark ICP3.650.049.22(1.66)0.11(0.02) Noise Data(infer_npts 1024) Methodisotropic Risotropic tanisotropic R(mse, mae)anisotropic t(mse, mae)ICP12.140.1718.32(5.86)0.23(0.08)FGR4.270.0611.55(2.43)0.09(0.03)IBenchmark6.250.089.28(2.94)0.12(0.04)IBenchmark ICP5.100.0710.51(2.39)0.13(0.03) Partial-to-Complete Registration(infer_npts 1024) Methodisotropic Risotropic tanisotropic R(mse, mae)anisotropic t(mse, mae)ICP21.330.3222.83(10.51)0.31(0.15)FGR9.490.1219.51(5.58)0.17(0.06)IBenchmark15.020.2215.78(7.45)0.21(0.10)IBenchmark ICP9.210.1314.73(4.43)0.18(0.06)
http://www.yutouwan.com/news/390805/

相关文章:

  • 怎么做招聘网站的调研wordpress漏洞扫描器
  • 网页设计与网站建设 入门必练建e网全景
  • 毕设网站开发什么题目好wordpress子网页
  • 网站的不足之处深圳正规燃气公司一览表
  • 不懂网站建设.怎么销售网络工程师简历
  • wordpress标签页无效链接seo刷排名软件
  • 专门做包包的网站办公系统软件oa
  • 有了域名如何建网站营销型网站开发推广
  • 网站页面关键字在哪里北京已经开始二次感染了
  • 网站建设技术需求wordpress电商ar
  • 温州专业网站制作公司有什么兼职做设计的网站
  • 企业网站的设计风格高校网站建设前言
  • 网站开发顶岗报告房产网站推广
  • wordpress多站点site id郑州市网络公司
  • 网站开发常用jquery插件总结(四)验证插件validation人类命运共同体
  • 安徽门户网站建设代理记账公司排名大全
  • 网站建设维护宣传广州天河区建设网站
  • 网站建设视频lcdr可不可做网站
  • 用织梦做网站需不需授权在线设计海报的网站
  • 建立网站成本最低网站栏目结构
  • 有关网站建设的书Wordpress编辑工具
  • 制作网页模版宁波超值关键词优化
  • 做网站价格和配置企业网站推广的策略有哪些
  • 微信公众号开发是否需要建立网站福州最好的网站设计服务公司
  • 做网站生意不赚钱源码之家
  • 酷站百分百精准软件
  • 黄冈做网站价格wordpress接入扫码支付宝
  • 广东平台网站建设制作做自己的网站的作用
  • 长沙的在线商城网站建设网站关键词搜索优化是怎么做的
  • 家装公司网站建设网站长沙做网站开发价格多少