зеркало из https://github.com/microsoft/torchgeo.git
IDTReeS: remove support for plotting lidar point cloud (#2428)
This commit is contained in:
Родитель
7b814f039f
Коммит
a34f00abe6
|
@ -34,8 +34,6 @@ jobs:
|
||||||
path: ${{ env.pythonLocation }}
|
path: ${{ env.pythonLocation }}
|
||||||
key: ${{ runner.os }}-${{ runner.arch }}-Python-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('requirements/required.txt', 'requirements/datasets.txt', 'requirements/tests.txt') }}
|
key: ${{ runner.os }}-${{ runner.arch }}-Python-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('requirements/required.txt', 'requirements/datasets.txt', 'requirements/tests.txt') }}
|
||||||
if: ${{ runner.os != 'macOS' }}
|
if: ${{ runner.os != 'macOS' }}
|
||||||
- name: Setup headless display for pyvista
|
|
||||||
uses: pyvista/setup-headless-display-action@v3
|
|
||||||
- name: Install pip dependencies
|
- name: Install pip dependencies
|
||||||
if: steps.cache.outputs.cache-hit != 'true'
|
if: steps.cache.outputs.cache-hit != 'true'
|
||||||
run: |
|
run: |
|
||||||
|
@ -68,8 +66,6 @@ jobs:
|
||||||
with:
|
with:
|
||||||
path: ${{ env.pythonLocation }}
|
path: ${{ env.pythonLocation }}
|
||||||
key: ${{ runner.os }}-${{ runner.arch }}-Python-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('requirements/min-reqs.old') }}
|
key: ${{ runner.os }}-${{ runner.arch }}-Python-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('requirements/min-reqs.old') }}
|
||||||
- name: Setup headless display for pyvista
|
|
||||||
uses: pyvista/setup-headless-display-action@v3
|
|
||||||
- name: Install pip dependencies
|
- name: Install pip dependencies
|
||||||
if: steps.cache.outputs.cache-hit != 'true'
|
if: steps.cache.outputs.cache-hit != 'true'
|
||||||
run: |
|
run: |
|
||||||
|
|
|
@ -28,7 +28,6 @@ repos:
|
||||||
- numpy>=1.22
|
- numpy>=1.22
|
||||||
- pillow>=10.4.0
|
- pillow>=10.4.0
|
||||||
- pytest>=6.1.2
|
- pytest>=6.1.2
|
||||||
- pyvista>=0.34.2
|
|
||||||
- scikit-image>=0.22.0
|
- scikit-image>=0.22.0
|
||||||
- torch>=2.3
|
- torch>=2.3
|
||||||
- torchmetrics>=0.10
|
- torchmetrics>=0.10
|
||||||
|
|
|
@ -115,7 +115,6 @@ intersphinx_mapping = {
|
||||||
'numpy': ('https://numpy.org/doc/stable/', None),
|
'numpy': ('https://numpy.org/doc/stable/', None),
|
||||||
'python': ('https://docs.python.org/3', None),
|
'python': ('https://docs.python.org/3', None),
|
||||||
'lightning': ('https://lightning.ai/docs/pytorch/stable/', None),
|
'lightning': ('https://lightning.ai/docs/pytorch/stable/', None),
|
||||||
'pyvista': ('https://docs.pyvista.org/version/stable/', None),
|
|
||||||
'rasterio': ('https://rasterio.readthedocs.io/en/stable/', None),
|
'rasterio': ('https://rasterio.readthedocs.io/en/stable/', None),
|
||||||
'rtree': ('https://rtree.readthedocs.io/en/stable/', None),
|
'rtree': ('https://rtree.readthedocs.io/en/stable/', None),
|
||||||
'segmentation_models_pytorch': ('https://smp.readthedocs.io/en/stable/', None),
|
'segmentation_models_pytorch': ('https://smp.readthedocs.io/en/stable/', None),
|
||||||
|
|
|
@ -93,8 +93,6 @@ datasets = [
|
||||||
"pandas[parquet]>=2",
|
"pandas[parquet]>=2",
|
||||||
# pycocotools 2.0.7+ required for wheels
|
# pycocotools 2.0.7+ required for wheels
|
||||||
"pycocotools>=2.0.7",
|
"pycocotools>=2.0.7",
|
||||||
# pyvista 0.34.2+ required to avoid ImportError in CI
|
|
||||||
"pyvista>=0.34.2",
|
|
||||||
# scikit-image 0.19+ required for Python 3.10 wheels
|
# scikit-image 0.19+ required for Python 3.10 wheels
|
||||||
"scikit-image>=0.19",
|
"scikit-image>=0.19",
|
||||||
# scipy 1.7.2+ required for Python 3.10 wheels
|
# scipy 1.7.2+ required for Python 3.10 wheels
|
||||||
|
|
|
@ -4,6 +4,5 @@ laspy==2.5.4
|
||||||
opencv-python==4.11.0.86
|
opencv-python==4.11.0.86
|
||||||
pandas[parquet]==2.2.3
|
pandas[parquet]==2.2.3
|
||||||
pycocotools==2.0.8
|
pycocotools==2.0.8
|
||||||
pyvista==0.44.2
|
|
||||||
scikit-image==0.25.0
|
scikit-image==0.25.0
|
||||||
scipy==1.15.1
|
scipy==1.15.1
|
||||||
|
|
|
@ -27,10 +27,8 @@ laspy==2.0.0
|
||||||
opencv-python==4.5.4.58
|
opencv-python==4.5.4.58
|
||||||
pycocotools==2.0.7
|
pycocotools==2.0.7
|
||||||
pyarrow==15.0.0 # Remove when we upgrade min version of pandas to `pandas[parquet]>=2`
|
pyarrow==15.0.0 # Remove when we upgrade min version of pandas to `pandas[parquet]>=2`
|
||||||
pyvista==0.34.2
|
|
||||||
scikit-image==0.19.0
|
scikit-image==0.19.0
|
||||||
scipy==1.7.2
|
scipy==1.7.2
|
||||||
vtk==9.3.1 # PyVista is not yet compatible with VTK 9.4+
|
|
||||||
|
|
||||||
# tests
|
# tests
|
||||||
pytest==7.3.0
|
pytest==7.3.0
|
||||||
|
|
|
@ -95,11 +95,3 @@ class TestIDTReeS:
|
||||||
x['prediction_label'] = x['label']
|
x['prediction_label'] = x['label']
|
||||||
dataset.plot(x, show_titles=False)
|
dataset.plot(x, show_titles=False)
|
||||||
plt.close()
|
plt.close()
|
||||||
|
|
||||||
def test_plot_las(self, dataset: IDTReeS) -> None:
|
|
||||||
pyvista = pytest.importorskip('pyvista', minversion='0.34.2')
|
|
||||||
pyvista.OFF_SCREEN = True
|
|
||||||
|
|
||||||
# Test point cloud without colors
|
|
||||||
point_cloud = dataset.plot_las(index=0)
|
|
||||||
pyvista.plot(point_cloud, scalars=point_cloud.points, cpos='yz', cmap='viridis')
|
|
||||||
|
|
|
@ -92,10 +92,9 @@ class IDTReeS(NonGeoDataset):
|
||||||
|
|
||||||
* https://doi.org/10.1101/2021.08.06.453503
|
* https://doi.org/10.1101/2021.08.06.453503
|
||||||
|
|
||||||
This dataset requires the following additional libraries to be installed:
|
This dataset requires the following additional library to be installed:
|
||||||
|
|
||||||
* `laspy <https://pypi.org/project/laspy/>`_ to read lidar point clouds
|
* `laspy <https://pypi.org/project/laspy/>`_ to read lidar point clouds
|
||||||
* `pyvista <https://pypi.org/project/pyvista/>`_ to plot lidar point clouds
|
|
||||||
|
|
||||||
.. versionadded:: 0.2
|
.. versionadded:: 0.2
|
||||||
"""
|
"""
|
||||||
|
@ -552,36 +551,3 @@ class IDTReeS(NonGeoDataset):
|
||||||
plt.suptitle(suptitle)
|
plt.suptitle(suptitle)
|
||||||
|
|
||||||
return fig
|
return fig
|
||||||
|
|
||||||
def plot_las(self, index: int) -> 'pyvista.Plotter': # type: ignore[name-defined] # noqa: F821
|
|
||||||
"""Plot a sample point cloud at the index.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
index: index to plot
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
pyvista.PolyData object. Run pyvista.plot(point_cloud, ...) to display
|
|
||||||
|
|
||||||
Raises:
|
|
||||||
DependencyNotFoundError: If laspy or pyvista are not installed.
|
|
||||||
|
|
||||||
.. versionchanged:: 0.4
|
|
||||||
Ported from Open3D to PyVista, *colormap* parameter removed.
|
|
||||||
"""
|
|
||||||
laspy = lazy_import('laspy')
|
|
||||||
pyvista = lazy_import('pyvista')
|
|
||||||
path = self.images[index]
|
|
||||||
path = path.replace('RGB', 'LAS').replace('.tif', '.las')
|
|
||||||
las = laspy.read(path)
|
|
||||||
points: np.typing.NDArray[np.int_] = np.stack(
|
|
||||||
[las.x, las.y, las.z], axis=0
|
|
||||||
).transpose((1, 0))
|
|
||||||
point_cloud = pyvista.PolyData(points)
|
|
||||||
|
|
||||||
# Some point cloud files have no color->points mapping
|
|
||||||
if hasattr(las, 'red'):
|
|
||||||
colors = np.stack([las.red, las.green, las.blue], axis=0)
|
|
||||||
colors = colors.transpose((1, 0)) / np.iinfo(np.uint16).max
|
|
||||||
point_cloud['colors'] = colors
|
|
||||||
|
|
||||||
return point_cloud
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче