Skip to content

open3d.utility.Vector3dVector() sometimes slow #5250

@marcelbrucker

Description

@marcelbrucker

Checklist

Describe the issue

I have a strange performance issue with open3d.utility.Vector3dVector().
I use PCD files to visualize 3D point cloud data with open3d and I read these files with pandas because I need additional attributes like intensity from the PCD file.
open3d.utility.Vector3dVector() is much slower when I use the numpy array coming from a file than when I use use some random numpy array.

Vector3dVector data_pd: 		 86.57ms
Vector3dVector data_np: 		 0.51ms

Steps to reproduce the bug

import open3d as o3d
import numpy as np
import pandas as pd
from timeit import default_timer as timer

file = 'frame.csv'
data_np = 400 * np.random.rand(131072, 3) - 200
df_1 = pd.DataFrame(data_np, columns=list('xyz'))
df_1.to_csv(file)
df_2 = pd.read_csv(file, names=list('xyz'), skiprows=1)
data_pd = df_2.loc[:, ['x', 'y', 'z']].to_numpy()

assert data_np.dtype == data_pd.dtype
assert np.allclose(data_np, data_pd)

t2 = timer()
pc_points1 = o3d.utility.Vector3dVector(data_pd)
t3 = timer()
pc_points2 = o3d.utility.Vector3dVector(data_np)
t4 = timer()

print(f'Vector3dVector data_pd: \t\t {((t3 - t2) * 1e3):.2f}ms')
print(f'Vector3dVector data_np: \t\t {((t4 - t3) * 1e3):.2f}ms')

Error message

No response

Expected behavior

I expect comparable speed.

Open3D, Python and System information

- Operating system: Ubuntu 20.04
- Python version: 3.8.10 (default, Mar 15 2022, 12:22:08) \n[GCC 9.4.0]
- Open3D version: output from python: 0.15.2+55ded67
- System architecture: x86
- Is this a remote workstation?: no
- How did you install Open3D?: pip

Additional information

No response

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions