Closed jiawenquan closed 4 years ago
# @njit(fastmath=True, cache=True) # 计算加速
def _insert(cells_xyz, cells_rgb, aabmin, inv_aabb_size, cell_count, xyz, rgb, spacing, shift, force=False):
keys = xyz_to_key(xyz, cell_count, aabmin, inv_aabb_size, shift)
if force:
# allocate this one once and for all
for k in np.unique(keys):
idx = np.where(keys - k == 0)
cells_xyz[k] = np.concatenate((cells_xyz[k], xyz[idx]))
cells_rgb[k] = np.concatenate((cells_rgb[k], rgb[idx]))
else:
notinserted = np.full(len(xyz), False)
needs_balance = False
for i in range(len(xyz)):
k = keys[i]
if cells_xyz[k].shape[0] == 0 or is_point_far_enough(cells_xyz[k], xyz[i], spacing):
cells_xyz[k] = np.concatenate((cells_xyz[k], xyz[i].reshape(1, 3)))
cells_rgb[k] = np.concatenate((cells_rgb[k], rgb[i].reshape(1, 3)))
if cell_count[0] < 8:
needs_balance = needs_balance or cells_xyz[k].shape[0] > 200000
else:
notinserted[i] = True
return xyz[notinserted], rgb[notinserted], needs_balance
The numba
njit
runs normally after I close it
But that's not a good idea
I'm sorry
The numba
and numpy
defaults Installation issues
Windows 10,Python 3.6 environment . A matching version needs to be installed manually
(newpy3dtiles) E:\GitProject\py3dtiles\py3dtiles>py3dtiles convert ../exp/Tile_1.las --jobs 1 --overwrite 1 --out /tmp/destination args: Namespace(benchmark=None, cache_size=1631, color_scale=None, command='convert', files=['../exp/Tile_1.las'], fraction=100, graph=True, jobs=1, out='/tmp/destination', overwrite=True, rgb=True, srs_in=None, srs_out=None, verbose=1) Summary:
Submit next portion ('../exp/Tile_1.las', (15000000, 15214249)) 0.0 % points in 0.7 sec [1 tasks, 1 nodes, 214249 wip] 0.0 % points in 0.7 sec [1 tasks, 2 nodes, 214249 wip] OH NO. b'6' Failed at nopython (nopython frontend) Unknown attribute 'unique' of type Module(<module 'numpy' from 'd:\programdata\anaconda3\envs\newpy3dtiles\lib\site-packages\numpy\init.py'>) File "points\points_grid.py", line 14 [1] During: typing of get attribute at e:\gitproject\py3dtiles\py3dtiles\points\points_grid.py (14) Traceback (most recent call last): File "e:\gitproject\py3dtiles\py3dtiles\points\task\node_process.py", line 156, in run result, data = _process(node, octree_metadata, name, filenames, queue, begin, log_file) File "e:\gitproject\py3dtiles\py3dtiles\points\task\node_process.py", line 108, in _process node.insert(node_catalog, octree_metadata.scale, data['xyz'], data['rgb'], halt_at_depth == 0) File "e:\gitproject\py3dtiles\py3dtiles\points\node.py", line 73, in insert self._split(node_catalog, scale) File "e:\gitproject\py3dtiles\py3dtiles\points\node.py", line 155, in _split self.insert(node_catalog, scale, xyz, rgb) File "e:\gitproject\py3dtiles\py3dtiles\points\node.py", line 80, in insert self.aabb[0], self.inv_aabb_size, xyz, rgb) File "e:\gitproject\py3dtiles\py3dtiles\points\points_grid.py", line 62, in insert int(self.cell_count[0] - 1).bit_length(), force) File "d:\programdata\anaconda3\envs\newpy3dtiles\lib\site-packages\numba\dispatcher.py", line 330, in _compile_for_args raise e File "d:\programdata\anaconda3\envs\newpy3dtiles\lib\site-packages\numba\dispatcher.py", line 307, in _compile_for_args return self.compile(tuple(argtypes)) File "d:\programdata\anaconda3\envs\newpy3dtiles\lib\site-packages\numba\dispatcher.py", line 579, in compile cres = self._compiler.compile(args, return_type) File "d:\programdata\anaconda3\envs\newpy3dtiles\lib\site-packages\numba\dispatcher.py", line 80, in compile flags=flags, locals=self.locals) File "d:\programdata\anaconda3\envs\newpy3dtiles\lib\site-packages\numba\compiler.py", line 763, in compile_extra return pipeline.compile_extra(func) File "d:\programdata\anaconda3\envs\newpy3dtiles\lib\site-packages\numba\compiler.py", line 360, in compile_extra return self._compile_bytecode() File "d:\programdata\anaconda3\envs\newpy3dtiles\lib\site-packages\numba\compiler.py", line 722, in _compile_bytecode return self._compile_core() File "d:\programdata\anaconda3\envs\newpy3dtiles\lib\site-packages\numba\compiler.py", line 709, in _compile_core res = pm.run(self.status) File "d:\programdata\anaconda3\envs\newpy3dtiles\lib\site-packages\numba\compiler.py", line 246, in run raise patched_exception File "d:\programdata\anaconda3\envs\newpy3dtiles\lib\site-packages\numba\compiler.py", line 238, in run stage() File "d:\programdata\anaconda3\envs\newpy3dtiles\lib\site-packages\numba\compiler.py", line 452, in stage_nopython_frontend self.locals) File "d:\programdata\anaconda3\envs\newpy3dtiles\lib\site-packages\numba\compiler.py", line 865, in type_inference_stage infer.propagate() File "d:\programdata\anaconda3\envs\newpy3dtiles\lib\site-packages\numba\typeinfer.py", line 844, in propagate raise errors[0] File "d:\programdata\anaconda3\envs\newpy3dtiles\lib\site-packages\numba\typeinfer.py", line 137, in propagate constraint(typeinfer) File "d:\programdata\anaconda3\envs\newpy3dtiles\lib\site-packages\numba\typeinfer.py", line 519, in call raise UntypedAttributeError(ty, self.attr, loc=self.inst.loc) numba.errors.UntypedAttributeError: Failed at nopython (nopython frontend) Unknown attribute 'unique' of type Module(<module 'numpy' from 'd:\programdata\anaconda3\envs\newpy3dtiles\lib\site-packages\numpy\init.py'>) File "points\points_grid.py", line 14 [1] During: typing of get attribute at e:\gitproject\py3dtiles\py3dtiles\points\points_grid.py (14)