0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【検証】FPS+kNNを行った際の点群の形状の確認(Score-Based-Denoising)

Last updated at Posted at 2025-08-20

前提の確認

当記事の概要

上記で確認したScore-Based-DenoisingではFPS(Farthest Point Sampling)によってサンプリングを行った後の点に対しkNNを実行することで各パッチを作成しGNN(EdgeConv)への入力とします。当記事ではこのような処理を行った際に点群の形状の情報が保持されるかについて検証を行います。

FPSの処理の実行(PyTorch Cluster)

kNNの実行(PyTorch3D)

FPS+kNNの検証(PyTorch Cluster + PyTorch3D)

検証に用いるコード

import torch
from torch_cluster import fps
import numpy as np
import argparse
import open3d as o3d
import pytorch3d.ops

parser = argparse.ArgumentParser()
parser.add_argument('--input_path', type=str, default='data/10000_poisson/duck.xyz')
parser.add_argument('--ratio', type=float, default=0.01)
parser.add_argument('--neighbor', type=int, default=20)
args = parser.parse_args()


x_numpy = np.loadtxt(args.input_path, delimiter=' ')
x = torch.tensor(x_numpy)

batch = torch.zeros(x.shape[0]).long()
index = fps(x, ratio=args.ratio, random_start=False)
print(x[index, :].unsqueeze(0).shape, x.unsqueeze(0).shape)

_, _, patches = pytorch3d.ops.knn_points(x[index, :].unsqueeze(0).float(), x.unsqueeze(0).float(), K=args.neighbor, return_nn=True)
print(patches.view(1,-1,3).shape)

pcd = o3d.geometry.PointCloud()
pcd.points = o3d.utility.Vector3dVector(patches.view(1,-1,3)[0].numpy())
o3d.visualization.draw_geometries([pcd], zoom=1, front=[0.4257, -0.2125, -0.8795], lookat=[0, 0, 0], up=[-0.0694, -0.9768, 0.2024])

duck.xyz

10000_poisson

FPSkNN_1.png

50000_poisson

n=200
FPSkNN_2.png

n=100
FPSkNN_3.png

Score-Based-Denoisingの実装のデフォルト

FPSkNN_4.png
n=30, k=1000(10000_poisson)

FPSkNN_5.png
n=150, k=1000(50000_poisson)

Score-Based-Denoisingでは入力の点群の数の3/1000倍の点の数の周囲の近傍1000個を元にパッチの作成を行います(点群の点の数が10000の場合n=30, k=1000、点群の点の数が50000の場合n=150, k=1000)。実行結果より、概ね元の形状が再現できていることが確認できます。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?