本文不讲 PointNet++ 原理,也不讲网络结构
只记录一次真实的:在 Windows 上,从零开始配环境并成功跑通 PointNet++ 官方示例的全过程
如果你也在Windows + Conda + PyTorch Geometric下复现点云网络,这篇文章能帮你少走很多弯路。
一、复现目标说明
我的目标非常明确:
操作系统:Windows 11
使用 PyTorch Geometric(PyG)
不自己写 PointNet++
直接复现官方能跑的 PointNet++ 示例
能正常训练、测试,不追求速度和精度
二、最开始的错误方向:尝试老项目
一开始我尝试的是:
老版 PointNet++
torch-points3d 等 2020 年左右项目
遇到的问题
requirements.txt中大量包pip 已无法安装常见报错包括:
antlr4-python3-runtime==4.8找不到gql==0.2.0不存在omegaconf==2.0.x与新 pip 冲突numpy / distutils / MSVC 编译错误
结论
老点云项目在 2025 年 Windows + 新 PyTorch 环境下,几乎不可直接复现
继续死磕只会无穷无尽修依赖。
三、关键转折:确认官方推荐路径
后来确认了一点非常重要的事实:
PointNet++ 已经被 PyTorch Geometric 官方实现并维护
不需要:
自己写 CUDA
自己写训练流程
自己配一堆老依赖
四、创建 Conda 环境 & 基础依赖
conda create -n pyg-pointnetpp python=3.10 conda activate pyg-pointnetpp
安装 PyTorch(CUDA 版本,按自己显卡选):
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
安装 PyG(官方方式):
pip install torch-geometric pip install torch-scatter torch-sparse torch-cluster torch-spline-conv
验证 PyG 是否可用:
python -c "import torch_geometric; print(torch_geometric.__version__)"
能正常输出版本号即说明环境基础正确。
五、克隆 PyTorch Geometric 官方仓库(重要)
git clone https://github.com/pyg-team/pytorch_geometric.git
实际遇到的问题
多次出现:
RPC failedRecv failure: Connection was reset
浅克隆也失败
最终原因
网络 / GitHub 访问不稳定
在网络正常后重新克隆,成功。
六、确认 PointNet++ 示例位置
成功克隆后,关键目录是:
pytorch_geometric/examples/ ├── pointnet2_classification.py └── pointnet2_segmentation.py
⚠️ 重要认知:
PointNet++ 不在 torch_geometric.nn 里
它是一个example 级别模型
所以不要尝试:
from torch_geometric.nn import PointNet2Classification # ❌
七、第一次运行:数据集直接报错
运行:
python examples/pointnet2_classification.py
出现错误:
zipfile.BadZipFile: File is not a zip file
原因
ModelNet10 自动下载过程中断
zip 文件损坏
解决方式
删除损坏文件:
del data/ModelNet10/ModelNet10.zip
重新运行脚本,让 PyG 重新下载并解压。
成功标志:
data/ModelNet10/raw/ModelNet10/ ├── chair ├── table ├── sofa ...
八、最终状态确认
到这一步为止:
Conda 环境正确
PyTorch / PyG 正常
PointNet++ 示例能跑
数据集正确
训练 & 测试流程完整
👉复现目标达成