欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

PointNet-master复现

程序员文章站 2022-06-15 12:32:57
PointNet-master复现1 准备工作2 Classification分类2.1 训练2.2 评估(我训练出来的结果85.6/88.6)3 Part Segmentation物件分割4 Semantic Segmentation语义分割1 准备工作先激活虚拟环境,再安装h5py# 安装h5pysudo apt-get install libhdf5-devsudo pip install h5py2 Classification分类2.1 训练下载ModelNet40和HDF5文...

1 准备工作

先激活虚拟环境,再安装h5py

# 安装h5py
sudo apt-get install libhdf5-dev
sudo pip install h5py

2 Classification分类

2.1 训练

  • 下载ModelNet40和HDF5文件放置到pointnet-master/data文件夹下,进入data文件夹后再解压
# 解压modelnet40_ply_hdf5_2048.zip
unzip modelnet40_ply_hdf5_2048.zip
  • 再退出data文件夹,执行python train.py
  • 运行中结果
**** EPOCH 000 ****
----0-----
mean loss: 3.827456
accuracy: 0.192383
----1-----
mean loss: 2.796352
accuracy: 0.307598
----2-----
mean loss: 2.345549
accuracy: 0.385742
----3-----
mean loss: 2.171231
accuracy: 0.424316
----4-----
mean loss: 1.869357
accuracy: 0.485352
----0-----
----1-----
eval mean loss: 1.760690
eval accuracy: 0.489854
eval avg class acc: 0.418257
Model saved in file: log/model.ckpt
**** EPOCH 001 ****
----0-----
mean loss: 1.635424
accuracy: 0.538086
----1-----
mean loss: 1.596464
accuracy: 0.542892
----2-----
mean loss: 1.565687
accuracy: 0.545410
----3-----
mean loss: 1.608424
accuracy: 0.558105
----4-----
mean loss: 1.400728
accuracy: 0.592285
----0-----
----1-----
eval mean loss: 1.227646
eval accuracy: 0.619724
eval avg class acc: 0.530451
**** EPOCH 002 ****
  • 使用TensorBoard,查看网络架构和其他的训练参数的变化曲线(最好是从服务器上下载到自己的电脑里查看)
#查看网络架构和其他的训练参数的变化曲线
tensorboard --logdir log

PointNet-master复现
PointNet-master复现

2.2 评估(我训练出来的结果85.6/88.6)

# 评估
python evaluate.py --visu

在上述培训之后,我们可以评估模型并输出错误情况的一些可视化,错误分类的点云将dump默认保存到文件夹中。
PointNet-master复现

3 Part Segmentation物件分割

cd part_seg # 进入part_seg文件夹
sh download_data.sh # 下载ShapeNetPart数据集和HDF5文件

一般最好是自己下载好文件再上传到服务器,服务器上的下载速度是龟速。

python train.py
python test.py
#跑train.py的过程 
>>> Training for the epoch 0/200 ...
Loading train file /workshop/user_data/pointnet/part_seg/./hdf5_data/ply_data_train4.h5
	Training Total Mean_loss: 1.974480
		Training Label Mean_loss: 3.489420
		Training Label Accuracy: 0.046875
		Training Seg Mean_loss: 1.398422
		Training Seg Accuracy: 0.668733
Loading train file /workshop/user_data/pointnet/part_seg/./hdf5_data/ply_data_train5.h5
	Training Total Mean_loss: 0.896463
		Training Label Mean_loss: 3.628423
		Training Label Accuracy: 0.022246
		Training Seg Mean_loss: 0.728734
		Training Seg Accuracy: 0.795286
Loading train file /workshop/user_data/pointnet/part_seg/./hdf5_data/ply_data_train1.h5
	Training Total Mean_loss: 0.796229
		Training Label Mean_loss: 3.660106
		Training Label Accuracy: 0.029785
		Training Seg Mean_loss: 0.654158
		Training Seg Accuracy: 0.809802
Loading train file /workshop/user_data/pointnet/part_seg/./hdf5_data/ply_data_train2.h5
	Training Total Mean_loss: 0.773133
		Training Label Mean_loss: 3.381332
		Training Label Accuracy: 0.041016
		Training Seg Mean_loss: 0.633130
		Training Seg Accuracy: 0.811064
Loading train file /workshop/user_data/pointnet/part_seg/./hdf5_data/ply_data_train3.h5
	Training Total Mean_loss: 0.631645
		Training Label Mean_loss: 3.542044
		Training Label Accuracy: 0.023926
		Training Seg Mean_loss: 0.561357
		Training Seg Accuracy: 0.831671
Loading train file /workshop/user_data/pointnet/part_seg/./hdf5_data/ply_data_train0.h5
	Training Total Mean_loss: 261.794937
		Training Label Mean_loss: 3.207757
		Training Label Accuracy: 0.069336
		Training Seg Mean_loss: 0.966167
		Training Seg Accuracy: 0.712125

<<< Testing on the test dataset ...
Loading test file /workshop/user_data/pointnet/part_seg/./hdf5_data/ply_data_val0.h5
	Testing Total Mean_loss: 2509.134123
		Testing Label Mean_loss: 3.620634
		Testing Label Accuracy: 0.094289
		Testing Seg Mean_loss: 1.736152
		Testing Seg Accuracy: 0.562174

		Category Airplane Object Number: 386
		Category Airplane Label Accuracy: 0.000000
		Category Airplane Seg Accuracy: 0.650140

		Category Bag Object Number: 8
		Category Bag Label Accuracy: 0.000000
		Category Bag Seg Accuracy: 0.000000

		Category Cap Object Number: 5
		Category Cap Label Accuracy: 0.200000
		Category Cap Seg Accuracy: 0.000000

		Category Car Object Number: 79
		Category Car Label Accuracy: 0.000000
		Category Car Seg Accuracy: 0.726321

		Category Chair Object Number: 394
		Category Chair Label Accuracy: 0.307107
		Category Chair Seg Accuracy: 0.593638

		Category Earphone Object Number: 6
		Category Earphone Label Accuracy: 0.000000
		Category Earphone Seg Accuracy: 0.000000

		Category Guitar Object Number: 78
		Category Guitar Label Accuracy: 0.102564
		Category Guitar Seg Accuracy: 0.000000

		Category Knife Object Number: 35
		Category Knife Label Accuracy: 0.000000
		Category Knife Seg Accuracy: 0.000000

		Category Lamp Object Number: 142
		Category Lamp Label Accuracy: 0.316901
		Category Lamp Seg Accuracy: 0.626561

		Category Laptop Object Number: 44
		Category Laptop Label Accuracy: 0.000000
		Category Laptop Seg Accuracy: 0.023748

		Category Motorbike Object Number: 26
		Category Motorbike Label Accuracy: 0.000000
		Category Motorbike Seg Accuracy: 0.000000

		Category Mug Object Number: 16
		Category Mug Label Accuracy: 0.000000
		Category Mug Seg Accuracy: 0.000000

		Category Pistol Object Number: 30
		Category Pistol Label Accuracy: 0.000000
		Category Pistol Seg Accuracy: 0.436865

		Category Rocket Object Number: 8
		Category Rocket Label Accuracy: 0.000000
		Category Rocket Seg Accuracy: 0.000000

		Category Skateboard Object Number: 15
		Category Skateboard Label Accuracy: 0.000000
		Category Skateboard Seg Accuracy: 0.590267

		Category Table Object Number: 584
		Category Table Label Accuracy: 0.000000
		Category Table Seg Accuracy: 0.666422
#跑test.py的过程
0/2874 ...
100/2874 ...
200/2874 ...
300/2874 ...
400/2874 ...
500/2874 ...
600/2874 ...
700/2874 ...
800/2874 ...
900/2874 ...
1000/2874 ...
1100/2874 ...
1200/2874 ...
1300/2874 ...
1400/2874 ...
1500/2874 ...
1600/2874 ...
1700/2874 ...
1800/2874 ...
1900/2874 ...
2000/2874 ...
2100/2874 ...
2200/2874 ...
2300/2874 ...
2400/2874 ...
2500/2874 ...
2600/2874 ...
2700/2874 ...
2800/2874 ...
Accuracy: 0.931741
IoU: 0.828935
  • 跑完test.py后可以通过CloudCompare或者MeshLab来显示test_results文件夹中的点云(但是不知道如何才能调出不同的部件不同的颜色)
    PointNet-master复现

4 Semantic Segmentation语义分割

暂时还没跑

参考的博客
[1]: https://blog.csdn.net/qq_40234695/article/details/86223577?depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1&utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1

本文地址:https://blog.csdn.net/weixin_44581536/article/details/107638165