From 1b074dcbf0b99815b60233cb69deaec2a3c094a0 Mon Sep 17 00:00:00 2001 From: vnmsklnk Date: Wed, 5 Apr 2023 22:53:51 +0300 Subject: [PATCH 01/16] Renaming files with metrics --- vprdb/metrics/{frames_coverage.py => frames_coverage_.py} | 0 vprdb/metrics/{recall.py => recall_.py} | 0 vprdb/metrics/{spatial_coverage.py => spatial_coverage_.py} | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename vprdb/metrics/{frames_coverage.py => frames_coverage_.py} (100%) rename vprdb/metrics/{recall.py => recall_.py} (100%) rename vprdb/metrics/{spatial_coverage.py => spatial_coverage_.py} (100%) diff --git a/vprdb/metrics/frames_coverage.py b/vprdb/metrics/frames_coverage_.py similarity index 100% rename from vprdb/metrics/frames_coverage.py rename to vprdb/metrics/frames_coverage_.py diff --git a/vprdb/metrics/recall.py b/vprdb/metrics/recall_.py similarity index 100% rename from vprdb/metrics/recall.py rename to vprdb/metrics/recall_.py diff --git a/vprdb/metrics/spatial_coverage.py b/vprdb/metrics/spatial_coverage_.py similarity index 100% rename from vprdb/metrics/spatial_coverage.py rename to vprdb/metrics/spatial_coverage_.py From b271f53bc2ee9b903d0147fa7b5c3f2a3f2ebd43 Mon Sep 17 00:00:00 2001 From: vnmsklnk Date: Wed, 5 Apr 2023 22:55:11 +0300 Subject: [PATCH 02/16] Additional docs for database --- vprdb/core/database.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/vprdb/core/database.py b/vprdb/core/database.py index 240f118..afa1a18 100644 --- a/vprdb/core/database.py +++ b/vprdb/core/database.py @@ -25,6 +25,11 @@ @dataclass(frozen=True) class Database: + """ + Class for easy storage and processing of color images, depth images + and trajectory and their further use for the VPR task + """ + color_images: list[ColorImageProvider] point_clouds: list[DepthImageProvider | PointCloudProvider] trajectory: list[NDArray[Shape["4, 4"], Float]] @@ -44,6 +49,15 @@ def from_depth_images( intrinsics: NDArray[Shape["3, 3"], Float], trajectory: list[NDArray[Shape["4, 4"], Float]], ): + """ + The method allows to construct the Database from depth images + :param color_images_paths: List of paths to color images + :param depth_images_paths: List of paths to depth images + :param depth_scale: Depth scale for transforming depth image into point clouds + :param intrinsics: Intrinsic camera parameters + :param trajectory: List of camera poses + :return: Constructed database + """ color_images_providers = [ ColorImageProvider(path_to_image) for path_to_image in color_images_paths ] @@ -60,6 +74,13 @@ def from_point_clouds( point_clouds_paths: list[Path], trajectory: list[NDArray[Shape["4, 4"], Float]], ): + """ + The method allows to construct the Database from point clouds + :param color_images_paths: List of paths to color images + :param point_clouds_paths: List of paths to point clouds + :param trajectory: List of camera poses + :return: Constructed database + """ color_images_providers = [ ColorImageProvider(path_to_image) for path_to_image in color_images_paths ] From eb6c3a755c0ac32cb2da2abaa860410fe6d1c11b Mon Sep 17 00:00:00 2001 From: vnmsklnk Date: Wed, 5 Apr 2023 22:56:11 +0300 Subject: [PATCH 03/16] Additional docs for providers --- vprdb/providers/color_image_provider.py | 3 +++ vprdb/providers/depth_image_provider.py | 5 +++++ vprdb/providers/point_cloud_provider.py | 3 +++ 3 files changed, 11 insertions(+) diff --git a/vprdb/providers/color_image_provider.py b/vprdb/providers/color_image_provider.py index 13984d1..4b0dfbc 100644 --- a/vprdb/providers/color_image_provider.py +++ b/vprdb/providers/color_image_provider.py @@ -20,8 +20,11 @@ @dataclass(frozen=True) class ColorImageProvider: + """ Color image provider is a wrapper for color images """ path: Path + """ Path to file on hard drive""" @property def color_image(self) -> NDArray[Shape["*, *, 3"], UInt8]: + """ Returns image in OpenCV format""" return cv2.imread(str(self.path), cv2.IMREAD_COLOR) diff --git a/vprdb/providers/depth_image_provider.py b/vprdb/providers/depth_image_provider.py index 923ca33..2594291 100644 --- a/vprdb/providers/depth_image_provider.py +++ b/vprdb/providers/depth_image_provider.py @@ -21,12 +21,17 @@ @dataclass(frozen=True) class DepthImageProvider: + """ Depth image provider is a wrapper for depth images """ path: Path + """ Path to file on hard drive """ intrinsics: NDArray[Shape["3, 3"], Float] + """ Intrinsic camera parameters """ depth_scale: int + """ Depth scale for transforming depth """ @property def point_cloud(self) -> o3d.geometry.PointCloud: + """ Returns Open3D point cloud """ depth_image = cv2.imread(str(self.path), cv2.IMREAD_ANYDEPTH) height, width = depth_image.shape depth_image = o3d.geometry.Image(depth_image) diff --git a/vprdb/providers/point_cloud_provider.py b/vprdb/providers/point_cloud_provider.py index 686d607..83c41bc 100644 --- a/vprdb/providers/point_cloud_provider.py +++ b/vprdb/providers/point_cloud_provider.py @@ -19,8 +19,11 @@ @dataclass(frozen=True) class PointCloudProvider: + """ Point provider is a wrapper for point clouds """ path: Path + """ Path to file on hard drive """ @property def point_cloud(self) -> o3d.geometry.PointCloud: + """ Returns Open3D point cloud """ return o3d.io.read_point_cloud(str(self.path)) From 0f79ce977ced926e87bf98cf29c2f03430ab0e28 Mon Sep 17 00:00:00 2001 From: vnmsklnk Date: Wed, 5 Apr 2023 22:57:04 +0300 Subject: [PATCH 04/16] Additional docs for global localization pipeline --- vprdb/global_localization/global_localization.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/vprdb/global_localization/global_localization.py b/vprdb/global_localization/global_localization.py index 5417a59..a2f3cc6 100644 --- a/vprdb/global_localization/global_localization.py +++ b/vprdb/global_localization/global_localization.py @@ -21,6 +21,11 @@ class GlobalLocalization: + """ + Allows you to create a predictor based on a given database + and one of the methods of global localization. + Results can be improved with SuperGlue. + """ def __init__( self, global_extractor: CosPlace | NetVLAD, From 19075ffc5732ae7900c0d9d18622bc7a3f8a2476 Mon Sep 17 00:00:00 2001 From: vnmsklnk Date: Wed, 5 Apr 2023 22:58:04 +0300 Subject: [PATCH 05/16] Fix codestyle for global localization --- vprdb/global_localization/global_localization.py | 1 + 1 file changed, 1 insertion(+) diff --git a/vprdb/global_localization/global_localization.py b/vprdb/global_localization/global_localization.py index a2f3cc6..d635521 100644 --- a/vprdb/global_localization/global_localization.py +++ b/vprdb/global_localization/global_localization.py @@ -26,6 +26,7 @@ class GlobalLocalization: and one of the methods of global localization. Results can be improved with SuperGlue. """ + def __init__( self, global_extractor: CosPlace | NetVLAD, From f47520a196801261321a51217b9c632279df4907 Mon Sep 17 00:00:00 2001 From: vnmsklnk Date: Wed, 5 Apr 2023 22:59:43 +0300 Subject: [PATCH 06/16] Additional docs for VPR systems --- vprdb/vpr_systems/cos_place/cos_place.py | 4 ++++ vprdb/vpr_systems/netvlad/netvlad.py | 4 ++++ vprdb/vpr_systems/superglue/superglue.py | 5 +++++ 3 files changed, 13 insertions(+) diff --git a/vprdb/vpr_systems/cos_place/cos_place.py b/vprdb/vpr_systems/cos_place/cos_place.py index 339e181..5e409fc 100644 --- a/vprdb/vpr_systems/cos_place/cos_place.py +++ b/vprdb/vpr_systems/cos_place/cos_place.py @@ -36,6 +36,10 @@ class CosPlace: + """ + Realisation of [CosPlace](https://github.com/gmberton/CosPlace) global localization method. + """ + def __init__(self, backbone: str, fc_output_dim: int, path_to_weights: str): self.backbone = backbone self.fc_output_dim = fc_output_dim diff --git a/vprdb/vpr_systems/netvlad/netvlad.py b/vprdb/vpr_systems/netvlad/netvlad.py index 8092e8e..7a6ad32 100644 --- a/vprdb/vpr_systems/netvlad/netvlad.py +++ b/vprdb/vpr_systems/netvlad/netvlad.py @@ -46,6 +46,10 @@ class NetVLAD: + """ + Realisation of [NetVLAD](https://github.com/QVPR/Patch-NetVLAD) global localization method. + """ + def __init__( self, path_to_weights: str, diff --git a/vprdb/vpr_systems/superglue/superglue.py b/vprdb/vpr_systems/superglue/superglue.py index 06b6e54..73f13cc 100644 --- a/vprdb/vpr_systems/superglue/superglue.py +++ b/vprdb/vpr_systems/superglue/superglue.py @@ -53,6 +53,11 @@ class SuperGlue: + """ + Realisation of [SuperGlue](https://github.com/magicleap/SuperGluePretrainedNetwork) + matcher with SuperPoint extractor. + """ + def __init__( self, path_to_sp_weights, From 03a26437578b8ad2b4b4c28e7e9e6d7dfd40811e Mon Sep 17 00:00:00 2001 From: vnmsklnk Date: Wed, 5 Apr 2023 23:07:16 +0300 Subject: [PATCH 07/16] New init files for correct pdoc work --- vprdb/__init__.py | 16 +++++++++++++ vprdb/core/__init__.py | 6 +++++ vprdb/global_localization/__init__.py | 5 ++++ vprdb/io/__init__.py | 32 +++++++++++++++++++++++++ vprdb/metrics/__init__.py | 12 +++++++--- vprdb/providers/__init__.py | 3 +++ vprdb/reduction_methods/__init__.py | 2 ++ vprdb/vpr_systems/__init__.py | 3 +++ vprdb/vpr_systems/cos_place/__init__.py | 2 ++ vprdb/vpr_systems/netvlad/__init__.py | 2 ++ vprdb/vpr_systems/superglue/__init__.py | 2 ++ 11 files changed, 82 insertions(+), 3 deletions(-) diff --git a/vprdb/__init__.py b/vprdb/__init__.py index e69de29..9e1eaad 100644 --- a/vprdb/__init__.py +++ b/vprdb/__init__.py @@ -0,0 +1,16 @@ +# Copyright (c) 2023, Ivan Moskalenko, Anastasiia Kornilova +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +""" +.. include:: ../README.md +""" diff --git a/vprdb/core/__init__.py b/vprdb/core/__init__.py index be9a9ff..9277982 100644 --- a/vprdb/core/__init__.py +++ b/vprdb/core/__init__.py @@ -11,6 +11,12 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +""" +`core` submodule contains a Database class for easy storage and processing of +color images, depth images and trajectory and their further use for the VPR task. + +`VoxelGrid` and `utils` provide various operations on point clouds. +""" from vprdb.core.database import Database from vprdb.core.utils import ( calculate_iou, diff --git a/vprdb/global_localization/__init__.py b/vprdb/global_localization/__init__.py index 9290bf1..2fc7bf2 100644 --- a/vprdb/global_localization/__init__.py +++ b/vprdb/global_localization/__init__.py @@ -11,4 +11,9 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +""" +Pipeline for global localization allows to build matches between two databases using different VPR systems. +""" from vprdb.global_localization.global_localization import GlobalLocalization + +__all__ = ["GlobalLocalization"] diff --git a/vprdb/io/__init__.py b/vprdb/io/__init__.py index 0536e39..a3d146e 100644 --- a/vprdb/io/__init__.py +++ b/vprdb/io/__init__.py @@ -11,5 +11,37 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +""" +The `io` submodule allows you to read datasets from the hard disk and export them. +## Datasets format +To use the tool, your data must be in a specific format +* Color images in any format +* Depth images in 16-bit grayscale format or point clouds in `.pcd` format. +The depth images must match the color images pixel by pixel (and therefore have the same resolution). +You should also know the intrinsic parameters of the camera and the depth scale if you use depth images +* The trajectory containing one pose in each line in `timestamp tx ty tz qx qy qz qw` format. +Timestamp is an optional argument that is not used in the library + +Thus, the tool supports the [TUM](https://cvg.cit.tum.de/data/datasets/rgbd-dataset/file_formats) format for datasets. + +The correspondence between poses, depth images, and color images +is determined based on the order of lines in the trajectory file and the alphabetical order of the files. + +Therefore, the structure of the dataset should look like this: +``` +Example dataset +├── color +| ├── 001.png +| ├── 002.png +| ├── ... +├── depth +| ├── 001.pcd or 001.png +| ├── 002.pcd or 002.png +| ├── ... +└── CameraTrajectory.txt +``` +The number of color images, depth images (or PCDs) and poses +in the trajectory file must be the same. The names of folders and the trajectory file are configurable. +""" from vprdb.io.export_utils import export from vprdb.io.read_utils import read_dataset_from_depth, read_dataset_from_point_clouds diff --git a/vprdb/metrics/__init__.py b/vprdb/metrics/__init__.py index ade1af0..d5daa4e 100644 --- a/vprdb/metrics/__init__.py +++ b/vprdb/metrics/__init__.py @@ -11,6 +11,12 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from vprdb.metrics.frames_coverage import frames_coverage -from vprdb.metrics.recall import recall -from vprdb.metrics.spatial_coverage import spatial_coverage +""" +Metrics allow you to evaluate the quality of created databases, +as well as to estimate the accuracy of various VPR systems. +""" +from vprdb.metrics.frames_coverage_ import frames_coverage +from vprdb.metrics.recall_ import recall +from vprdb.metrics.spatial_coverage_ import spatial_coverage + +__all__ = ["frames_coverage", "recall", "spatial_coverage"] diff --git a/vprdb/providers/__init__.py b/vprdb/providers/__init__.py index 18d8a0a..9f192b5 100644 --- a/vprdb/providers/__init__.py +++ b/vprdb/providers/__init__.py @@ -11,6 +11,9 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +""" +Providers are designed as wrappers over various types of heavy data, to load them into RAM only when needed. +""" from vprdb.providers.color_image_provider import ColorImageProvider from vprdb.providers.depth_image_provider import DepthImageProvider from vprdb.providers.point_cloud_provider import PointCloudProvider diff --git a/vprdb/reduction_methods/__init__.py b/vprdb/reduction_methods/__init__.py index 5b0c0ed..3d17edf 100644 --- a/vprdb/reduction_methods/__init__.py +++ b/vprdb/reduction_methods/__init__.py @@ -15,3 +15,5 @@ from vprdb.reduction_methods.distance_vector import DistanceVector from vprdb.reduction_methods.dominating_set import DominatingSet from vprdb.reduction_methods.every_nth import EveryNth + +__all__ = ["CubeDivision", "DistanceVector", "DominatingSet", "EveryNth"] diff --git a/vprdb/vpr_systems/__init__.py b/vprdb/vpr_systems/__init__.py index 4e3880f..3ae2430 100644 --- a/vprdb/vpr_systems/__init__.py +++ b/vprdb/vpr_systems/__init__.py @@ -11,6 +11,9 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +""" The `vpr_systems` contains a set of tools for the VPR task. """ from vprdb.vpr_systems.cos_place import CosPlace from vprdb.vpr_systems.netvlad import NetVLAD from vprdb.vpr_systems.superglue import SuperGlue + +__all__ = ["CosPlace", "NetVLAD", "SuperGlue"] diff --git a/vprdb/vpr_systems/cos_place/__init__.py b/vprdb/vpr_systems/cos_place/__init__.py index 2acf742..5b52196 100644 --- a/vprdb/vpr_systems/cos_place/__init__.py +++ b/vprdb/vpr_systems/cos_place/__init__.py @@ -12,3 +12,5 @@ # See the License for the specific language governing permissions and # limitations under the License. from vprdb.vpr_systems.cos_place.cos_place import CosPlace + +__all__ = ["CosPlace"] diff --git a/vprdb/vpr_systems/netvlad/__init__.py b/vprdb/vpr_systems/netvlad/__init__.py index 133dd68..e5c05d0 100644 --- a/vprdb/vpr_systems/netvlad/__init__.py +++ b/vprdb/vpr_systems/netvlad/__init__.py @@ -12,3 +12,5 @@ # See the License for the specific language governing permissions and # limitations under the License. from vprdb.vpr_systems.netvlad.netvlad import NetVLAD + +__all__ = ["NetVLAD"] diff --git a/vprdb/vpr_systems/superglue/__init__.py b/vprdb/vpr_systems/superglue/__init__.py index ff851b4..6bc220e 100644 --- a/vprdb/vpr_systems/superglue/__init__.py +++ b/vprdb/vpr_systems/superglue/__init__.py @@ -12,3 +12,5 @@ # See the License for the specific language governing permissions and # limitations under the License. from vprdb.vpr_systems.superglue.superglue import SuperGlue + +__all__ = ["SuperGlue"] From 045dc31390ae0cd63bf02892ffc52e119b61a8e5 Mon Sep 17 00:00:00 2001 From: vnmsklnk Date: Wed, 5 Apr 2023 23:12:55 +0300 Subject: [PATCH 08/16] Fix codestyle in provider files --- vprdb/providers/color_image_provider.py | 5 +++-- vprdb/providers/depth_image_provider.py | 5 +++-- vprdb/providers/point_cloud_provider.py | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/vprdb/providers/color_image_provider.py b/vprdb/providers/color_image_provider.py index 4b0dfbc..4d7218e 100644 --- a/vprdb/providers/color_image_provider.py +++ b/vprdb/providers/color_image_provider.py @@ -20,11 +20,12 @@ @dataclass(frozen=True) class ColorImageProvider: - """ Color image provider is a wrapper for color images """ + """Color image provider is a wrapper for color images""" + path: Path """ Path to file on hard drive""" @property def color_image(self) -> NDArray[Shape["*, *, 3"], UInt8]: - """ Returns image in OpenCV format""" + """Returns image in OpenCV format""" return cv2.imread(str(self.path), cv2.IMREAD_COLOR) diff --git a/vprdb/providers/depth_image_provider.py b/vprdb/providers/depth_image_provider.py index 2594291..b36bd9c 100644 --- a/vprdb/providers/depth_image_provider.py +++ b/vprdb/providers/depth_image_provider.py @@ -21,7 +21,8 @@ @dataclass(frozen=True) class DepthImageProvider: - """ Depth image provider is a wrapper for depth images """ + """Depth image provider is a wrapper for depth images""" + path: Path """ Path to file on hard drive """ intrinsics: NDArray[Shape["3, 3"], Float] @@ -31,7 +32,7 @@ class DepthImageProvider: @property def point_cloud(self) -> o3d.geometry.PointCloud: - """ Returns Open3D point cloud """ + """Returns Open3D point cloud""" depth_image = cv2.imread(str(self.path), cv2.IMREAD_ANYDEPTH) height, width = depth_image.shape depth_image = o3d.geometry.Image(depth_image) diff --git a/vprdb/providers/point_cloud_provider.py b/vprdb/providers/point_cloud_provider.py index 83c41bc..14cacc9 100644 --- a/vprdb/providers/point_cloud_provider.py +++ b/vprdb/providers/point_cloud_provider.py @@ -19,11 +19,12 @@ @dataclass(frozen=True) class PointCloudProvider: - """ Point provider is a wrapper for point clouds """ + """Point provider is a wrapper for point clouds""" + path: Path """ Path to file on hard drive """ @property def point_cloud(self) -> o3d.geometry.PointCloud: - """ Returns Open3D point cloud """ + """Returns Open3D point cloud""" return o3d.io.read_point_cloud(str(self.path)) From 9831dc3708349850c51ae8d0fd3f0baa4dd468d2 Mon Sep 17 00:00:00 2001 From: vnmsklnk Date: Wed, 5 Apr 2023 23:55:11 +0300 Subject: [PATCH 09/16] Workflow for publishing docs --- .github/workflows/docs.yml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/docs.yml diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000..d7ab879 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,32 @@ +name: Docs website + +# build the documentation whenever there are new commits on docs +on: + push: + branches: + - docs + +jobs: + # Build the documentation and upload the static HTML files as an artifact. + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Set up Python 3.10 + uses: actions/setup-python@v3 + with: + python-version: "3.10" + + - run: pip install pdocs + - run: pdoc ./vprdb -o ./docs + + - name: Deploy + uses: s0/git-publish-subdir-action@develop + env: + REPO: self + BRANCH: gh-pages + FOLDER: ./docs + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + TARGET_DIR: ./docs + MESSAGE: "Updating the website with documentation" From 31a1a4c849714b43c40b43d681584b336bab4d5f Mon Sep 17 00:00:00 2001 From: vnmsklnk Date: Wed, 5 Apr 2023 23:59:10 +0300 Subject: [PATCH 10/16] Remove typo in pip package name --- .github/workflows/docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index d7ab879..f4862c3 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -18,7 +18,7 @@ jobs: with: python-version: "3.10" - - run: pip install pdocs + - run: pip install pdoc - run: pdoc ./vprdb -o ./docs - name: Deploy From aa1cb1e34c3e277be38ea1edea9aaf1a54b1fe80 Mon Sep 17 00:00:00 2001 From: vnmsklnk Date: Thu, 6 Apr 2023 00:01:43 +0300 Subject: [PATCH 11/16] Update install dependencies step for docs workflow --- .github/workflows/docs.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index f4862c3..e55426d 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -18,7 +18,12 @@ jobs: with: python-version: "3.10" - - run: pip install pdoc + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + pip install pdoc + - run: pdoc ./vprdb -o ./docs - name: Deploy From 233ae41b71d58b123f088d8e7a9b48118a3e669d Mon Sep 17 00:00:00 2001 From: vnmsklnk Date: Thu, 6 Apr 2023 15:21:33 +0300 Subject: [PATCH 12/16] new README --- README.md | 52 ++++++++++++++++++++++++---------------------------- 1 file changed, 24 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index 3da3f52..4fe1012 100644 --- a/README.md +++ b/README.md @@ -1,34 +1,30 @@ # PlaceRecognitionDB -PlaceRecognitionDB is a tool for creating optimally sized databases (containing the minimum number of frames covering the scene) for place recognition task from RGBD and LiDAR data. +[![Lint&Tests](https://github.com/prime-slam/place-recognition-db/actions/workflows/ci.yml/badge.svg)](https://github.com/prime-slam/place-recognition-db/actions/workflows/ci.yml) +[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) -The tool supports several basic methods for creating databases, as well as the DominatingSet method for creating optimal databases. +PlaceRecognitionDB is a tool for creating optimally sized databases +(containing the minimum number of frames covering the scene) for place recognition task from RGBD and LiDAR data. + +The tool supports several basic methods for creating databases, +as well as the DominatingSet method for creating optimal databases. + +The tool also contains a global Localization pipeline with [CosPlace](https://github.com/gmberton/CosPlace) +and [NetVLAD](https://github.com/QVPR/Patch-NetVLAD). +The models of these neural networks can be fine-tuned for a particular previously created database. +The results of global localization can also be improved with [SuperGlue](https://github.com/magicleap/SuperGluePretrainedNetwork). + +We have also developed a set of metrics that can be used to evaluate +the quality of created databases and the accuracy of VPR systems. + +For more, please visit the [PlaceRecognitionDB documentation](https://prime-slam.github.io/place-recognition-db/docs/). +You can also find full information about our research on the [website](https://prime-slam.github.io/place-recognition-db/). ## Datasets format -To use the tool, your data must be in a specific format -* Color images in any format -* Depth images in 16-bit grayscale format or point clouds in `.pcd` format. The depth images must match the color images -pixel by pixel (and therefore have the same resolution). You should also know the intrinsic parameters of the camera and the depth scale if you use depth images -* The trajectory containing one pose in each line in `timestamp tx ty tz qx qy qz qw` format. Timestamp is an optional argument that is not used in the library - -Thus, the tool supports the [TUM](https://cvg.cit.tum.de/data/datasets/rgbd-dataset/file_formats) format for datasets. - -The correspondence between poses, depth images, and color images is determined based on the order of lines in the trajectory file and the alphabetical order of the files. - -Therefore, the structure of the dataset should look like this: -``` -Example dataset -├── color -| ├── 001.png -| ├── 002.png -| ├── ... -├── depth -| ├── 001.pcd or 001.png -| ├── 002.pcd or 002.png -| ├── ... -└── CameraTrajectory.txt -``` -The number of color images, depth images (or PCDs) and poses -in the trajectory file must be the same. The names of folders and the trajectory file are configurable. +You can find detailed information about the data format used in the tool [here](https://prime-slam.github.io/place-recognition-db/docs/vprdb/io.html#datasets-format). ## Usage -Please, check `example.ipynb` with usage example. +Please check `example.ipynb` with a small example on creating a database. + +## License +This project is licensed under the Apache License — +see the [LICENSE](https://github.com/prime-slam/place-recognition-db/blob/master/LICENSE) file for details. From 2614d2780e513663ff2ed715eacd22d03d2c4f5d Mon Sep 17 00:00:00 2001 From: vnmsklnk Date: Thu, 6 Apr 2023 15:40:38 +0300 Subject: [PATCH 13/16] Added master target branch in docs workflow --- .github/workflows/docs.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index e55426d..a62414b 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -5,6 +5,7 @@ on: push: branches: - docs + - master jobs: # Build the documentation and upload the static HTML files as an artifact. From b8892f110e38843d93356308a6909916fe5d6550 Mon Sep 17 00:00:00 2001 From: vnmsklnk Date: Thu, 6 Apr 2023 18:33:17 +0300 Subject: [PATCH 14/16] update README --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4fe1012..814ba11 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ # PlaceRecognitionDB [![Lint&Tests](https://github.com/prime-slam/place-recognition-db/actions/workflows/ci.yml/badge.svg)](https://github.com/prime-slam/place-recognition-db/actions/workflows/ci.yml) +[![Docs](https://github.com/prime-slam/place-recognition-db/actions/workflows/docs.yml/badge.svg)](https://prime-slam.github.io/place-recognition-db/docs/) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) PlaceRecognitionDB is a tool for creating optimally sized databases @@ -7,11 +8,14 @@ PlaceRecognitionDB is a tool for creating optimally sized databases The tool supports several basic methods for creating databases, as well as the DominatingSet method for creating optimal databases. +A detailed description of all methods for creating databases can be found in our [paper](https://arxiv.org/abs/2303.05123). -The tool also contains a global Localization pipeline with [CosPlace](https://github.com/gmberton/CosPlace) +The tool also contains a global localization pipeline with [CosPlace](https://github.com/gmberton/CosPlace) and [NetVLAD](https://github.com/QVPR/Patch-NetVLAD). The models of these neural networks can be fine-tuned for a particular previously created database. The results of global localization can also be improved with [SuperGlue](https://github.com/magicleap/SuperGluePretrainedNetwork). +More details about the available configurations for global localization and the results +are available in the [paper](https://arxiv.org/abs/2303.05123). We have also developed a set of metrics that can be used to evaluate the quality of created databases and the accuracy of VPR systems. From 5dbf23b4e60fab2605d9f48c63e33720fa32161f Mon Sep 17 00:00:00 2001 From: vnmsklnk Date: Thu, 6 Apr 2023 18:45:05 +0300 Subject: [PATCH 15/16] Fix docstrings --- vprdb/core/database.py | 4 ++-- vprdb/global_localization/__init__.py | 2 +- vprdb/global_localization/global_localization.py | 2 +- vprdb/io/__init__.py | 2 +- vprdb/metrics/__init__.py | 2 +- vprdb/providers/color_image_provider.py | 2 +- vprdb/providers/depth_image_provider.py | 8 ++++---- vprdb/providers/point_cloud_provider.py | 4 ++-- vprdb/vpr_systems/cos_place/cos_place.py | 2 +- vprdb/vpr_systems/netvlad/netvlad.py | 2 +- vprdb/vpr_systems/superglue/superglue.py | 2 +- 11 files changed, 16 insertions(+), 16 deletions(-) diff --git a/vprdb/core/database.py b/vprdb/core/database.py index afa1a18..0737d57 100644 --- a/vprdb/core/database.py +++ b/vprdb/core/database.py @@ -50,7 +50,7 @@ def from_depth_images( trajectory: list[NDArray[Shape["4, 4"], Float]], ): """ - The method allows to construct the Database from depth images + The method allows to construct the Database from scanning sequence :param color_images_paths: List of paths to color images :param depth_images_paths: List of paths to depth images :param depth_scale: Depth scale for transforming depth image into point clouds @@ -75,7 +75,7 @@ def from_point_clouds( trajectory: list[NDArray[Shape["4, 4"], Float]], ): """ - The method allows to construct the Database from point clouds + The method allows to construct the Database from point clouds, color images and trajectory :param color_images_paths: List of paths to color images :param point_clouds_paths: List of paths to point clouds :param trajectory: List of camera poses diff --git a/vprdb/global_localization/__init__.py b/vprdb/global_localization/__init__.py index 2fc7bf2..4fc4754 100644 --- a/vprdb/global_localization/__init__.py +++ b/vprdb/global_localization/__init__.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. """ -Pipeline for global localization allows to build matches between two databases using different VPR systems. +Pipeline for global localization allows to build matches between database and queries using different VPR systems. """ from vprdb.global_localization.global_localization import GlobalLocalization diff --git a/vprdb/global_localization/global_localization.py b/vprdb/global_localization/global_localization.py index d635521..3d77f62 100644 --- a/vprdb/global_localization/global_localization.py +++ b/vprdb/global_localization/global_localization.py @@ -22,7 +22,7 @@ class GlobalLocalization: """ - Allows you to create a predictor based on a given database + Allows to create a predictor based on a given database and one of the methods of global localization. Results can be improved with SuperGlue. """ diff --git a/vprdb/io/__init__.py b/vprdb/io/__init__.py index a3d146e..6f7320d 100644 --- a/vprdb/io/__init__.py +++ b/vprdb/io/__init__.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. """ -The `io` submodule allows you to read datasets from the hard disk and export them. +The `io` submodule allows to read datasets from the hard disk and export them. ## Datasets format To use the tool, your data must be in a specific format * Color images in any format diff --git a/vprdb/metrics/__init__.py b/vprdb/metrics/__init__.py index d5daa4e..a25f83f 100644 --- a/vprdb/metrics/__init__.py +++ b/vprdb/metrics/__init__.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. """ -Metrics allow you to evaluate the quality of created databases, +Metrics allow to evaluate the quality of created databases, as well as to estimate the accuracy of various VPR systems. """ from vprdb.metrics.frames_coverage_ import frames_coverage diff --git a/vprdb/providers/color_image_provider.py b/vprdb/providers/color_image_provider.py index 4d7218e..86d5174 100644 --- a/vprdb/providers/color_image_provider.py +++ b/vprdb/providers/color_image_provider.py @@ -23,7 +23,7 @@ class ColorImageProvider: """Color image provider is a wrapper for color images""" path: Path - """ Path to file on hard drive""" + """Path to the file on the hard drive""" @property def color_image(self) -> NDArray[Shape["*, *, 3"], UInt8]: diff --git a/vprdb/providers/depth_image_provider.py b/vprdb/providers/depth_image_provider.py index b36bd9c..483d899 100644 --- a/vprdb/providers/depth_image_provider.py +++ b/vprdb/providers/depth_image_provider.py @@ -24,15 +24,15 @@ class DepthImageProvider: """Depth image provider is a wrapper for depth images""" path: Path - """ Path to file on hard drive """ + """ Path to the file on the hard drive """ intrinsics: NDArray[Shape["3, 3"], Float] - """ Intrinsic camera parameters """ + """Intrinsic camera parameters""" depth_scale: int - """ Depth scale for transforming depth """ + """Depth scale for transforming depth""" @property def point_cloud(self) -> o3d.geometry.PointCloud: - """Returns Open3D point cloud""" + """Returns Open3D point cloud constructed from depth image""" depth_image = cv2.imread(str(self.path), cv2.IMREAD_ANYDEPTH) height, width = depth_image.shape depth_image = o3d.geometry.Image(depth_image) diff --git a/vprdb/providers/point_cloud_provider.py b/vprdb/providers/point_cloud_provider.py index 14cacc9..1b9ab2a 100644 --- a/vprdb/providers/point_cloud_provider.py +++ b/vprdb/providers/point_cloud_provider.py @@ -19,10 +19,10 @@ @dataclass(frozen=True) class PointCloudProvider: - """Point provider is a wrapper for point clouds""" + """PointCloudProvider provider is a wrapper for point clouds""" path: Path - """ Path to file on hard drive """ + """Path to the file on the hard drive""" @property def point_cloud(self) -> o3d.geometry.PointCloud: diff --git a/vprdb/vpr_systems/cos_place/cos_place.py b/vprdb/vpr_systems/cos_place/cos_place.py index 5e409fc..16a2b09 100644 --- a/vprdb/vpr_systems/cos_place/cos_place.py +++ b/vprdb/vpr_systems/cos_place/cos_place.py @@ -37,7 +37,7 @@ class CosPlace: """ - Realisation of [CosPlace](https://github.com/gmberton/CosPlace) global localization method. + Implementation of [CosPlace](https://github.com/gmberton/CosPlace) global localization method. """ def __init__(self, backbone: str, fc_output_dim: int, path_to_weights: str): diff --git a/vprdb/vpr_systems/netvlad/netvlad.py b/vprdb/vpr_systems/netvlad/netvlad.py index 7a6ad32..856489f 100644 --- a/vprdb/vpr_systems/netvlad/netvlad.py +++ b/vprdb/vpr_systems/netvlad/netvlad.py @@ -47,7 +47,7 @@ class NetVLAD: """ - Realisation of [NetVLAD](https://github.com/QVPR/Patch-NetVLAD) global localization method. + Implementation of [NetVLAD](https://github.com/QVPR/Patch-NetVLAD) global localization method. """ def __init__( diff --git a/vprdb/vpr_systems/superglue/superglue.py b/vprdb/vpr_systems/superglue/superglue.py index 73f13cc..45e5af8 100644 --- a/vprdb/vpr_systems/superglue/superglue.py +++ b/vprdb/vpr_systems/superglue/superglue.py @@ -54,7 +54,7 @@ class SuperGlue: """ - Realisation of [SuperGlue](https://github.com/magicleap/SuperGluePretrainedNetwork) + Implementation of [SuperGlue](https://github.com/magicleap/SuperGluePretrainedNetwork) matcher with SuperPoint extractor. """ From 3c327765f2cff4a3930414074419e9685da84e88 Mon Sep 17 00:00:00 2001 From: vnmsklnk Date: Thu, 6 Apr 2023 18:48:56 +0300 Subject: [PATCH 16/16] Fix codestyle for docstring --- vprdb/providers/depth_image_provider.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vprdb/providers/depth_image_provider.py b/vprdb/providers/depth_image_provider.py index 483d899..81e67ae 100644 --- a/vprdb/providers/depth_image_provider.py +++ b/vprdb/providers/depth_image_provider.py @@ -24,7 +24,7 @@ class DepthImageProvider: """Depth image provider is a wrapper for depth images""" path: Path - """ Path to the file on the hard drive """ + """Path to the file on the hard drive""" intrinsics: NDArray[Shape["3, 3"], Float] """Intrinsic camera parameters""" depth_scale: int