Pointnet和Pointnet++的pytorch版源码链接参考
https://github.com/yanx27/Pointnet_Pointnet2_pytorch
安装git–>安装g++
安装git:https://so.csdn.net/so/search?q=%E5%AE%89%E8%A3%85git&t=&u=
安装g++: http://c.biancheng.net/view/8077.html
可通过linux系统或者已安装的git中bash环境运行build.sh脚本
安装完毕g++之后可通过sh build.sh运行,见上图
该文件位于链接https://github.com/KuangenZhang/ldgcnn的part_seg的文件夹下
对于sh download_data运行问题的错误,主要原因为Issued certificate has expired,win10系统下解决方案为:通过记事本打开sh文件,wget指令后添加–no-check-certificate
若显示无–no-check-certificate参数,参考https://blog.csdn.net/topsogn/article/details/121217646?spm=1001.2014.3001.5501
def download():
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
DATA_DIR = os.path.join(BASE_DIR, 'data')
if not os.path.exists(DATA_DIR):
os.mkdir(DATA_DIR)
if not os.path.exists(os.path.join(DATA_DIR, 'modelnet40_ply_hdf5_2048')):
www = 'https://shapenet.cs.stanford.edu/media/modelnet40_ply_hdf5_2048.zip'
zipfile = os.path.basename(www)
os.system('wget --no-check-certificate %s' % (www))
os.system('unzip %s' % (zipfile))
os.system('mv %s %s' % (zipfile[:-4], DATA_DIR))
os.system('rm %s' % (zipfile))
若显示unzip不是内部或外部命令,也不是可运行的程序或批处理文件。则可通过在系统环境变量中添加windows下的zip.exe和unzip.exe的路径
在运行PointNet的可视化程序时,作者只提供了linux平台下的动态链接库程序源码,自己的windows平台下无法调用。发现是动态链接库的文件格式不对,遂学习如何将.so文件转换成.dll文件
#ifndef PCH_H
#define PCH_H
// 添加要在此处预编译的标头
#include "framework.h"
#endif //PCH_H
//定义宏
#ifdef IMPORT_DLL
#else
#define IMPORT_DLL extern "C" _declspec(dllimport) //指的是允许将其给外部调用
#endif
// 改为你所需要的链接库函数
IMPORT_DLL void render_ball(int h, int w, unsigned char* show, int n, int* xyzs, float* c0, float* c1, float* c2, int r);
// dllmain.cpp : 定义 DLL 应用程序的入口点。
#include "pch.h"
#include
#include
#include
#include
using namespace std;
struct PointInfo {
int x, y, z;
float r, g, b;
};
void render_ball(int h, int w, unsigned char* show, int n, int* xyzs, float* c0, float* c1, float* c2, int r) {
r = max(r, 1);
vector<int> depth(h * w, -2100000000);
vector<PointInfo> pattern;
for (int dx = -r; dx <= r; dx++)
for (int dy = -r; dy <= r; dy++)
if (dx * dx + dy * dy < r * r) {
double dz = sqrt(double(r * r - dx * dx - dy * dy));
PointInfo pinfo;
pinfo.x = dx;
pinfo.y = dy;
pinfo.z = dz;
pinfo.r = dz / r;
pinfo.g = dz / r;
pinfo.b = dz / r;
pattern.push_back(pinfo);
}
double zmin = 0, zmax = 0;
for (int i = 0; i < n; i++) {
if (i == 0) {
zmin = xyzs[i * 3 + 2] - r;
zmax = xyzs[i * 3 + 2] + r;
}
else {
zmin = min(zmin, double(xyzs[i * 3 + 2] - r));
zmax = max(zmax, double(xyzs[i * 3 + 2] + r));
}
}
for (int i = 0; i < n; i++) {
int x = xyzs[i * 3 + 0], y = xyzs[i * 3 + 1], z = xyzs[i * 3 + 2];
for (int j = 0; j<int(pattern.size()); j++) {
int x2 = x + pattern[j].x;
int y2 = y + pattern[j].y;
int z2 = z + pattern[j].z;
if (!(x2 < 0 || x2 >= h || y2 < 0 || y2 >= w) && depth[x2 * w + y2] < z2) {
depth[x2 * w + y2] = z2;
double intensity = min(1.0, (z2 - zmin) / (zmax - zmin) * 0.7 + 0.3);
show[(x2 * w + y2) * 3 + 0] = pattern[j].b * c2[i] * intensity;
show[(x2 * w + y2) * 3 + 1] = pattern[j].g * c0[i] * intensity;
show[(x2 * w + y2) * 3 + 2] = pattern[j].r * c1[i] * intensity;
}
}
}
}
// 具体内容改为你的文件内容
转载链接:https://blog.csdn.net/Moringstarluc/article/details/105702543