Skip to content

Commit

Permalink
update to 0.14
Browse files Browse the repository at this point in the history
  • Loading branch information
kewlbear committed Jan 23, 2022
1 parent a840c02 commit f4bc97a
Show file tree
Hide file tree
Showing 59 changed files with 6,045 additions and 143 deletions.
37 changes: 26 additions & 11 deletions Sources/Open3DSupport/site-packages/open3d/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# ----------------------------------------------------------------------------
# The MIT License (MIT)
#
# Copyright (c) 2018 www.open3d.org
# Copyright (c) 2018-2021 www.open3d.org
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -38,6 +38,7 @@
from ctypes import CDLL as _CDLL
from ctypes.util import find_library as _find_library
from pathlib import Path as _Path
import warnings

from open3d._build_config import _build_config
if _build_config["BUILD_GUI"] and not (_find_library('c++abi') or
Expand All @@ -55,7 +56,10 @@
try: # StopIteration if cpu version not available
_CDLL(str(next((_Path(__file__).parent / 'cpu').glob('pybind*'))))
except StopIteration:
pass
warnings.warn(
"Open3D was built with CUDA support, but Open3D CPU Python "
"bindings were not found. Open3D will not work on systems without"
" CUDA devices.", ImportWarning)
try:
# Check CUDA availability without importing CUDA pybind symbols to
# prevent "symbol already registered" errors if first import fails.
Expand All @@ -66,19 +70,30 @@
utility, t)
from open3d.cuda import pybind
__DEVICE_API__ = 'cuda'
except OSError: # CUDA not installed
pass
except StopIteration: # pybind cuda library not available
pass
else:
warnings.warn(
"Open3D was built with CUDA support, but no suitable CUDA "
"devices found. If your system has CUDA devices, check your "
"CUDA drivers and runtime.", ImportWarning)
except OSError:
warnings.warn(
"Open3D was built with CUDA support, but CUDA libraries could "
"not be found! Check your CUDA installation. Falling back to the "
"CPU pybind library.", ImportWarning)
except StopIteration:
warnings.warn(
"Open3D was built with CUDA support, but Open3D CUDA Python "
"binding library not found! Falling back to the CPU Python "
"binding library.", ImportWarning)

if __DEVICE_API__ == 'cpu':
from open3d.cpu.pybind import (camera, geometry, io, pipelines, utility)
from open3d.cpu.pybind import (camera, geometry, io, pipelines, utility, t)
from open3d.cpu import pybind

import open3d.core
#import open3d.visualization
import open3d.visualization

__version__ = "0.13.0+1dcd2d62a"
__version__ = "0.14.1+69d3cc5"

if int(sys.version_info[0]) < 3:
raise Exception("Open3D only supports Python 3.")
Expand All @@ -100,8 +115,8 @@
except NameError:
pass
else:
print("Open3D WebVisualizer is not supported on ARM for now.")
pass
warnings.warn("Open3D WebVisualizer is not supported on ARM for now.",
RuntimeWarning)

# OPEN3D_ML_ROOT points to the root of the Open3D-ML repo.
# If set this will override the integrated Open3D-ML.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"BUILD_LIBREALSENSE" : False,
"BUILD_SHARED_LIBS" : False,
"BUILD_GUI" : False,
"BUILD_RPC_INTERFACE": False,
"ENABLE_HEADLESS_RENDERING" : False,
"BUILD_JUPYTER_EXTENSION" : False,
"BUNDLE_OPEN3D_ML" : False,
Expand Down
14 changes: 3 additions & 11 deletions Sources/Open3DSupport/site-packages/open3d/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# ----------------------------------------------------------------------------
# The MIT License (MIT)
#
# Copyright (c) 2018 www.open3d.org
# Copyright (c) 2018-2021 www.open3d.org
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand All @@ -27,14 +27,6 @@
import open3d as o3d

if o3d.__DEVICE_API__ == 'cuda':
from open3d.cuda.pybind.core import (Tensor, Scalar, Hashmap, Dtype,
DtypeCode, Device, cuda, nns,
SizeVector, DynamicSizeVector, matmul,
lstsq, solve, det, lu, lu_ipiv, inv,
svd, triu, tril, triul)
from open3d.cuda.pybind.core import *
else:
from open3d.cpu.pybind.core import (Tensor, Scalar, Hashmap, Dtype,
DtypeCode, Device, cuda, nns,
SizeVector, DynamicSizeVector, matmul,
lstsq, solve, det, lu, lu_ipiv, inv,
svd, triu, tril, triul)
from open3d.cpu.pybind.core import *
Binary file not shown.
2 changes: 1 addition & 1 deletion Sources/Open3DSupport/site-packages/open3d/ml/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# ----------------------------------------------------------------------------
# The MIT License (MIT)
#
# Copyright (c) 2018 www.open3d.org
# Copyright (c) 2018-2021 www.open3d.org
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion Sources/Open3DSupport/site-packages/open3d/ml/configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# ----------------------------------------------------------------------------
# The MIT License (MIT)
#
# Copyright (c) 2020 www.open3d.org
# Copyright (c) 2018-2021 www.open3d.org
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# ----------------------------------------------------------------------------
# The MIT License (MIT)
#
# Copyright (c) 2018 www.open3d.org
# Copyright (c) 2018-2021 www.open3d.org
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion Sources/Open3DSupport/site-packages/open3d/ml/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# ----------------------------------------------------------------------------
# The MIT License (MIT)
#
# Copyright (c) 2020 www.open3d.org
# Copyright (c) 2018-2021 www.open3d.org
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand Down
3 changes: 2 additions & 1 deletion Sources/Open3DSupport/site-packages/open3d/ml/tf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# ----------------------------------------------------------------------------
# The MIT License (MIT)
#
# Copyright (c) 2020 www.open3d.org
# Copyright (c) 2018-2021 www.open3d.org
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand All @@ -24,6 +24,7 @@
# IN THE SOFTWARE.
# ----------------------------------------------------------------------------
"""TensorFlow specific machine learning functions."""

import os as _os
from tensorflow import __version__ as _tf_version
from open3d import _build_config
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# ----------------------------------------------------------------------------
# The MIT License (MIT)
#
# Copyright (c) 2020 www.open3d.org
# Copyright (c) 2018-2021 www.open3d.org
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# ----------------------------------------------------------------------------
# The MIT License (MIT)
#
# Copyright (c) 2020 www.open3d.org
# Copyright (c) 2018-2021 www.open3d.org
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# ----------------------------------------------------------------------------
# The MIT License (MIT)
#
# Copyright (c) 2020 www.open3d.org
# Copyright (c) 2018-2021 www.open3d.org
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# ----------------------------------------------------------------------------
# The MIT License (MIT)
#
# Copyright (c) 2020 www.open3d.org
# Copyright (c) 2018-2021 www.open3d.org
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion Sources/Open3DSupport/site-packages/open3d/ml/tf/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# ----------------------------------------------------------------------------
# The MIT License (MIT)
#
# Copyright (c) 2020 www.open3d.org
# Copyright (c) 2018-2021 www.open3d.org
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# ----------------------------------------------------------------------------
# The MIT License (MIT)
#
# Copyright (c) 2020 www.open3d.org
# Copyright (c) 2018-2021 www.open3d.org
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# ----------------------------------------------------------------------------
# The MIT License (MIT)
#
# Copyright (c) 2020 www.open3d.org
# Copyright (c) 2018-2021 www.open3d.org
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# ----------------------------------------------------------------------------
# The MIT License (MIT)
#
# Copyright (c) 2020 www.open3d.org
# Copyright (c) 2018-2021 www.open3d.org
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# ----------------------------------------------------------------------------
# The MIT License (MIT)
#
# Copyright (c) 2020 www.open3d.org
# Copyright (c) 2018-2021 www.open3d.org
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -545,6 +545,13 @@ def call(self,
if inp_importance is None:
inp_importance = tf.ones((0,), dtype=tf.float32)

if isinstance(inp_features, tf.RaggedTensor):
if not (isinstance(inp_positions, tf.RaggedTensor) and
isinstance(out_positions, tf.RaggedTensor)):
raise Exception(
"All of inp_positions, inp_features and out_positions must be tf.Tensor, or tf.RaggedTensor"
)

hash_table_size_factor = 1 / 64
self.nns = self.fixed_radius_search(
inp_positions,
Expand All @@ -553,6 +560,13 @@ def call(self,
hash_table_size_factor=hash_table_size_factor,
hash_table=fixed_radius_search_hash_table)

out_positions_split = None
if isinstance(inp_positions, tf.RaggedTensor):
inp_positions = inp_positions.values
inp_features = inp_features.values
out_positions_split = out_positions.row_splits
out_positions = out_positions.values

# for stats and debugging
num_pairs = tf.shape(self.nns.neighbors_index)[0]
self._avg_neighbors = num_pairs / tf.shape(out_positions)[0]
Expand Down Expand Up @@ -584,6 +598,10 @@ def call(self,
out_features += self.bias
out_features = self.activation(out_features)

if out_positions_split is not None:
out_features = tf.RaggedTensor.from_row_splits(
values=out_features, row_splits=out_positions_split)

return out_features

def compute_output_shape(self, inp_features_shape):
Expand Down Expand Up @@ -745,6 +763,13 @@ def call(self,

empty_vec = tf.ones((0,), dtype=tf.float32)

if isinstance(inp_features, tf.RaggedTensor):
if not (isinstance(inp_positions, tf.RaggedTensor) and
isinstance(out_positions, tf.RaggedTensor)):
raise Exception(
"All of inp_positions, inp_features and out_positions must be tf.Tensor, or tf.RaggedTensor"
)

hash_table_size_factor = 1 / 64
self.nns_inp = self.fixed_radius_search(
out_positions,
Expand All @@ -753,6 +778,13 @@ def call(self,
hash_table_size_factor=hash_table_size_factor,
hash_table=fixed_radius_search_hash_table)

out_positions_split = None
if isinstance(inp_positions, tf.RaggedTensor):
inp_positions = inp_positions.values
inp_features = inp_features.values
out_positions_split = out_positions.row_splits
out_positions = out_positions.values

num_out = tf.shape(out_positions, out_type=tf.int64)[0]

neighbors_index, neighbors_row_splits, _ = ops.invert_neighbors_list(
Expand Down Expand Up @@ -793,6 +825,10 @@ def call(self,
out_features += self.bias
out_features = self.activation(out_features)

if out_positions_split is not None:
out_features = tf.RaggedTensor.from_row_splits(
values=out_features, row_splits=out_positions_split)

return out_features

def compute_output_shape(self, inp_features_shape):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# ----------------------------------------------------------------------------
# The MIT License (MIT)
#
# Copyright (c) 2020 www.open3d.org
# Copyright (c) 2018-2021 www.open3d.org
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -34,6 +34,8 @@ class FixedRadiusSearch(tf.keras.layers.Layer):
"""Fixed radius search for 3D point clouds.
This layer computes the neighbors for a fixed radius on a point cloud.
For batch support, you can either pass 'points' and 'queries' as RaggedTensor,
or pass the 'row_splits' information.
Example:
This example shows a neighbor search that returns the indices to the
Expand Down Expand Up @@ -89,10 +91,10 @@ def call(self,
Arguments:
points: The 3D positions of the input points. *This argument must be
given as a positional argument!*
points: The 3D positions of the input points. It can be a RaggedTensor.
*This argument must be given as a positional argument!*
queries: The 3D positions of the query points.
queries: The 3D positions of the query points. It can be a RaggedTensor.
radius: A scalar with the neighborhood radius
Expand Down Expand Up @@ -129,6 +131,13 @@ def call(self,
Note that the distances are squared if metric is L2.
This is a zero length Tensor if 'return_distances' is False.
"""
if isinstance(points, tf.RaggedTensor):
points_row_splits = points.row_splits
points = points.values
if isinstance(queries, tf.RaggedTensor):
queries_row_splits = queries.row_splits
queries = queries.values

if points_row_splits is None:
points_row_splits = tf.cast(tf.stack([0, tf.shape(points)[0]]),
dtype=tf.int64)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# ----------------------------------------------------------------------------
# The MIT License (MIT)
#
# Copyright (c) 2020 www.open3d.org
# Copyright (c) 2018-2021 www.open3d.org
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand Down
Loading

0 comments on commit f4bc97a

Please sign in to comment.