基于pointNet++模型的个性化数据集训练测试及可视化[附源码]_cloudcompare pointnet++

img
img

网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。

需要这份系统化的资料的朋友,可以戳这里获取

一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!

1.1分类点云数据
1.1.1原数据集介绍

每个点云类别文件夹下有若干个txt的点云数据
在这里插入图片描述
每个点云数据有若干行点数据,每行点数据包含x,y,z,nx,ny,nz等6个数据。
x、y、z为点云的空间坐标,nx、ny、nz为点云的法向量。
在这里插入图片描述
安装 CloudCompare软件可以打开txt点云文件
在这里插入图片描述

1.1.2制作个性化数据集

本次实验目标是检测受电弓开合状态,需要采集open和close两类点云数据,Test是一个存放最终真实无标签测试数据的空目录,process_data.py是一个自动生成数据集配置文件的脚本,后续会介绍
在这里插入图片描述

1.2 记录点云数据的配置文件
1.2.1原数据集介绍

除了分类点云数据外,还需要一些记录点云数据文件路径、类别、训练集、测试集的配置文件。
(1)filelist.txt记录了点云数据的相对文件路径
在这里插入图片描述
(2)modelnet40_shape_names.txt记录了全部类别
在这里插入图片描述
(3)modelnet40_train.txt记录了从数据集中划分的训练集
在这里插入图片描述
(4)modelnet40_test.txt记录了从数据集中划分的测试集
在这里插入图片描述

1.2.2制作个性化数据集

编写process_data.py数据集预处理脚本文件

import os
import random
import shutil
from pathlib import Path

# 获取当前程序执行的工作目录
current_directory = os.getcwd()
directory_name = os.path.basename(current_directory)
# 带类别标签的数据集所在目录
folder_paths = [Path(current_directory + "/open"), Path(current_directory + "/close")]

# 初始化目录中文件
test_folder_path = Path(current_directory + "/Test")
shutil.rmtree(test_folder_path)
os.mkdir(test_folder_path)
for folder\_path in folder_paths:
    file_list = list(folder_path.glob("\*"))
    for i, file_path in enumerate(file_list, start=1):
        new_file_name = f"{str(i).zfill(4)}{file\_path.suffix}"
        new_file_path = folder_path / new_file_name
        if new_file_path.exists():
            continue
        file_path.rename(new_file_path)

# 生成以下目标文件(配置文件)
txt_file_path = Path(current_directory + "/filelist.txt")  # 记录全部带标签的数据集文件(带后缀名)
txt_file_path2 = Path(current_directory + f"/{directory\_name}\_train.txt")  # 记录全部带标签的训练文件(不带后缀名)
txt_file_path3 = Path(current_directory + f"/{directory\_name}\_test.txt")  # 记录全部带标签的测试文件(不带后缀名)
txt_file_path4 = Path(current_directory + f"/{directory\_name}\_shape\_names.txt")  # 记录全部类别(不带后缀名)
txt_file_path5 = Path(current_directory + f"/{directory\_name}\_realtest.txt")  # 记录不带标签的真实测试文件(不带后缀名)
# 打开目标文件
with txt_file_path.open("w") as txt_file, txt_file_path2.open("w") as txt_file2, txt_file_path3.open(
        "w") as txt_file3, txt_file_path4.open("w") as txt_file4:
    for folder\_path in folder_paths:
        folder_name = folder_path.name
        file_list = list(folder_path.glob("\*"))
        random.shuffle(file_list)  # 随机打乱文件列表
        total_files = len(file_list)
        train_files_count = int(total_files * 0.8)  # 80% of the files for training


![img](https://img-blog.csdnimg.cn/img_convert/572f906dc56a6e4ef0af965667ef7743.png)
![img](https://img-blog.csdnimg.cn/img_convert/81de42075c11b5864547f69e9809edb7.png)

**网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。**

**[需要这份系统化的资料的朋友,可以戳这里获取](https://bbs.csdn.net/forums/4f45ff00ff254613a03fab5e56a57acb)**

**一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!**

**

**一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!**

  • 3
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
好的,我可以为你提供一个Python+pandas+matplotlib的数据分析与可视化案例,包括源码。这个案例是基于一个汽车销售数据集的分析,目的是探索不同汽车品牌的销售情况以及价格分布等信息。 首先,我们需要导入必要的库和数据集: ```python import pandas as pd import matplotlib.pyplot as plt # 读取数据集 df = pd.read_csv("car_sales.csv") ``` 接下来,我们可以先对数据集进行一些基本的探索,例如查看数据集的前几行、统计描述等: ```python # 查看前几行数据 print(df.head()) # 统计描述 print(df.describe()) ``` 然后,我们可以通过使用pandas的groupby()函数对不同品牌的销售情况进行分组统计,然后绘制柱状图进行可视化: ```python # 按品牌分组统计销售量 brand_sales = df.groupby("Brand")["Units Sold"].sum() print(brand_sales) # 绘制柱状图 brand_sales.plot(kind="bar") plt.title("Car Sales by Brand") plt.xlabel("Brand") plt.ylabel("Units Sold") plt.show() ``` 接着,我们可以通过使用pandas的cut()函数将价格范围分段,然后绘制直方图进行价格分布的可视化: ```python # 将价格范围分段 price_bins = pd.cut(df["Sale Price"], 10) print(price_bins.value_counts()) # 绘制直方图 df["Sale Price"].plot(kind="hist", bins=10) plt.title("Price Distribution") plt.xlabel("Price Range") plt.ylabel("Frequency") plt.show() ``` 最后,我们可以将以上的可视化结果组合在一起,形成一个完整的数据分析和可视化报告: ```python # 按品牌分组统计销售量 brand_sales = df.groupby("Brand")["Units Sold"].sum() # 绘制柱状图 brand_sales.plot(kind="bar") plt.title("Car Sales by Brand") plt.xlabel("Brand") plt.ylabel("Units Sold") plt.show() # 将价格范围分段 price_bins = pd.cut(df["Sale Price"], 10) # 绘制直方图 df["Sale Price"].plot(kind="hist", bins=10) plt.title("Price Distribution") plt.xlabel("Price Range") plt.ylabel("Frequency") plt.show() ``` 以上就是一个简单的Python+pandas+matplotlib数据分析与可视化案例,你可以通过这个案例学习如何使用这些工具进行数据分析和可视化。如果你想查看完整的源码,可以在这里找到:https://github.com/ChitGPT/Python-Data-Analysis-and-Visualization-Examples/blob/main/Car_Sales_Analysis.py
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值