Код: Выделить всё
def voxelize(points, voxel_size):
voxel_indices = np.floor(points / voxel_size).astype(np.int32)
unique_voxel_indices, inverse_indices = np.unique(
voxel_indices, axis=0, return_inverse=True
)
voxel_centers = (unique_voxel_indices + 0.5) * voxel_size
return voxel_indices, unique_voxel_indices, voxel_centers, inverse_indices
Я нахожу похожие вопросы, чтобы ускорить этот процесс но без обратных индексов. В Numba также не реализована эта версия np.unique. Есть ли какой-то метод, который мне не хватает, который значительно быстрее, но также обеспечивает расчет индексов?
Подробнее здесь: https://stackoverflow.com/questions/790 ... se-indices