Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

why my data test very worse? #11

Open
liang00fan opened this issue Aug 21, 2024 · 1 comment
Open

why my data test very worse? #11

liang00fan opened this issue Aug 21, 2024 · 1 comment

Comments

@liang00fan
Copy link

liang00fan commented Aug 21, 2024

https://free3d.com/zh/3d-model/bmw850-12027.html is my test obj file.
i convert it into npy first, then put the frog.npy into pc_examples and run with follow commands:

python main.py --input_dir pc_examples --out_dir pc_output --input_type pc_normal

here is my code to convert obj to npy.

import trimesh
import numpy as np

from utils import mesh_utils

# 读取 .ply 文件
ply_path = r"D:\work\datasets\animal_objs\BMW850\BMW850.obj"  # 请将这里替换为你的 .ply 文件路径
mesh = mesh_utils.load_mesh(ply_path)

# 获取点云中的点坐标和法向量
points = mesh.vertices  # xyz 坐标
normals = mesh.vertex_normals  # 法向量

l2_norms = np.linalg.norm(normals, axis=1, keepdims=True) + 1e-7
normalized_array = normals / l2_norms
mask = np.linalg.norm(normalized_array, axis=-1) > 0.99
normals_array = normalized_array[mask]
points_array = points[mask]
# 将 xyz 和法向量组合
data = np.hstack((points_array, normals_array))

# 保存为 .npy 文件
npy_path = "BMW850.npy"  # 你想要保存的文件名和路径
np.save(npy_path, data)

print(f"点云数据和法向量已成功保存为 {npy_path} 文件!")
@Mrguanglei
Copy link

@liang00fan Hi, do you have the training code? Can you share it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants