diff --git a/.gitignore b/.gitignore index 1c1b3eb5..c7c9fc25 100644 --- a/.gitignore +++ b/.gitignore @@ -22,7 +22,7 @@ matches.txt map.png .vscode .project -videos/webcam +data/videos/webcam kf_info.log local_mapping.log diff --git a/README.md b/README.md index e48ec27e..aca86878 100644 --- a/README.md +++ b/README.md @@ -1,47 +1,47 @@ -# pySLAM v2.2.6 +# pySLAM v2.3.0 Author: **[Luigi Freda](https://www.luigifreda.com)** -- [pySLAM v2.2.6](#pyslam-v226) - - [1. Install](#1-install) - - [1.1. Main requirements](#11-main-requirements) - - [1.2. Ubuntu](#12-ubuntu) - - [1.3. MacOS](#13-macos) - - [1.4. Docker](#14-docker) - - [1.5. How to install non-free OpenCV modules](#15-how-to-install-non-free-opencv-modules) - - [1.6. Troubleshooting and performance issues](#16-troubleshooting-and-performance-issues) - - [2. Usage](#2-usage) - - [2.1. Feature tracking](#21-feature-tracking) - - [2.2. Loop closing](#22-loop-closing) - - [2.2.1. Vocabulary management](#221-vocabulary-management) - - [2.2.2. Vocabulary-free loop closing](#222-vocabulary-free-loop-closing) - - [2.3. Volumetric reconstruction pipeline](#23-volumetric-reconstruction-pipeline) - - [2.4. Depth prediction](#24-depth-prediction) - - [2.5. Save and reload a map](#25-save-and-reload-a-map) - - [2.6. Relocalization in a loaded map](#26-relocalization-in-a-loaded-map) - - [2.7. Trajectory saving](#27-trajectory-saving) - - [2.8. SLAM GUI](#28-slam-gui) - - [2.9. Monitor the logs for tracking, local mapping, and loop closing simultaneously](#29-monitor-the-logs-for-tracking-local-mapping-and-loop-closing-simultaneously) - - [3. Supported components and models](#3-supported-components-and-models) - - [3.1. Supported local features](#31-supported-local-features) - - [3.2. Supported matchers](#32-supported-matchers) - - [3.3. Supported global descriptors and local descriptor aggregation methods](#33-supported-global-descriptors-and-local-descriptor-aggregation-methods) - - [3.3.1. Local descriptor aggregation methods](#331-local-descriptor-aggregation-methods) - - [3.3.2. Global descriptors](#332-global-descriptors) - - [3.4. Supported depth prediction models](#34-supported-depth-prediction-models) - - [4. Datasets](#4-datasets) - - [4.1. KITTI Datasets](#41-kitti-datasets) - - [4.2. TUM Datasets](#42-tum-datasets) - - [4.3. EuRoC Datasets](#43-euroc-datasets) - - [4.4. Replica Datasets](#44-replica-datasets) - - [5. Camera Settings](#5-camera-settings) - - [6. Comparison pySLAM vs ORB-SLAM3](#6-comparison-pyslam-vs-orb-slam3) - - [7. Contributing to pySLAM](#7-contributing-to-pyslam) - - [8. References](#8-references) - - [9. Credits](#9-credits) - - [10. TODOs](#10-todos) +- [pySLAM v2.3.0](#pyslam-v230) + - [Install](#install) + - [Main requirements](#main-requirements) + - [Ubuntu](#ubuntu) + - [MacOS](#macos) + - [Docker](#docker) + - [How to install non-free OpenCV modules](#how-to-install-non-free-opencv-modules) + - [Troubleshooting and performance issues](#troubleshooting-and-performance-issues) + - [Usage](#usage) + - [Feature tracking](#feature-tracking) + - [Loop closing](#loop-closing) + - [Vocabulary management](#vocabulary-management) + - [Vocabulary-free loop closing](#vocabulary-free-loop-closing) + - [Volumetric reconstruction pipeline](#volumetric-reconstruction-pipeline) + - [Depth prediction](#depth-prediction) + - [Save and reload a map](#save-and-reload-a-map) + - [Relocalization in a loaded map](#relocalization-in-a-loaded-map) + - [Trajectory saving](#trajectory-saving) + - [SLAM GUI](#slam-gui) + - [Monitor the logs for tracking, local mapping, and loop closing simultaneously](#monitor-the-logs-for-tracking-local-mapping-and-loop-closing-simultaneously) + - [Supported components and models](#supported-components-and-models) + - [Supported local features](#supported-local-features) + - [Supported matchers](#supported-matchers) + - [Supported global descriptors and local descriptor aggregation methods](#supported-global-descriptors-and-local-descriptor-aggregation-methods) + - [Local descriptor aggregation methods](#local-descriptor-aggregation-methods) + - [Global descriptors](#global-descriptors) + - [Supported depth prediction models](#supported-depth-prediction-models) + - [Datasets](#datasets) + - [KITTI Datasets](#kitti-datasets) + - [TUM Datasets](#tum-datasets) + - [EuRoC Datasets](#euroc-datasets) + - [Replica Datasets](#replica-datasets) + - [Camera Settings](#camera-settings) + - [Comparison pySLAM vs ORB-SLAM3](#comparison-pyslam-vs-orb-slam3) + - [Contributing to pySLAM](#contributing-to-pyslam) + - [References](#references) + - [Credits](#credits) + - [TODOs](#todos) @@ -104,19 +104,19 @@ Then, use the available specific install procedure according to your OS. The pro * Kornia 0.7.3 * Rerun -If you encounter any issues or performance problems, refer to the [TROUBLESHOOTING](./TROUBLESHOOTING.md) file for assistance. +If you encounter any issues or performance problems, refer to the [TROUBLESHOOTING](./docs/TROUBLESHOOTING.md) file for assistance. ### Ubuntu -Follow the instructions reported [here](./PYTHON-VIRTUAL-ENVS.md) for creating a new virtual environment `pyslam` with **venv**. The procedure has been tested on *Ubuntu 18.04*, *20.04*, *22.04* and *24.04*. +Follow the instructions reported [here](./docs/PYTHON-VIRTUAL-ENVS.md) for creating a new virtual environment `pyslam` with **venv**. The procedure has been tested on *Ubuntu 18.04*, *20.04*, *22.04* and *24.04*. -If you prefer **conda**, run the scripts described in this other [file](./CONDA.md). +If you prefer **conda**, run the scripts described in this other [file](./docs/CONDA.md). ### MacOS -Follow the instructions in this [file](./MAC.md). The reported procedure was tested under *Sequoia 15.1.1* and *Xcode 16.1*. +Follow the instructions in this [file](./docs/MAC.md). The reported procedure was tested under *Sequoia 15.1.1* and *Xcode 16.1*. ### Docker @@ -130,7 +130,7 @@ If you prefer docker or you have an OS that is not supported yet, you can use [r The provided install scripts will install a recent opencv version (>=**4.10**) with non-free modules enabled (see the provided scripts [install_pip3_packages.sh](./install_pip3_packages.sh) and [install_opencv_python.sh](./install_opencv_python.sh)). To quickly verify your installed opencv version run: `$ . pyenv-activate.sh ` -`$ ./opencv_check.py` +`$ ./scripts/opencv_check.py` or use the following command: `$ python3 -c "import cv2; print(cv2.__version__)"` How to check if you have non-free OpenCV module support (no errors imply success): @@ -139,7 +139,7 @@ How to check if you have non-free OpenCV module support (no errors imply success ### Troubleshooting and performance issues -If you run into issues or errors during the installation process or at run-time, please, check the [TROUBLESHOOTING.md](./TROUBLESHOOTING.md) file. +If you run into issues or errors during the installation process or at run-time, please, check the [docs/TROUBLESHOOTING.md](./docs/TROUBLESHOOTING.md) file. --- ## Usage @@ -149,14 +149,14 @@ Once you have run the script `install_all_venv.sh` (follow the instructions abov $ . pyenv-activate.sh # Activate pyslam python virtual environment. This is only needed once in a new terminal. $ ./main_vo.py ``` -This will process a default [KITTI](http://www.cvlibs.net/datasets/kitti/eval_odometry.php) video (available in the folder `videos`) by using its corresponding camera calibration file (available in the folder `settings`), and its groundtruth (available in the same `videos` folder). If matplotlib windows are used, you can stop `main_vo.py` by focusing/clicking on one of them and pressing the key 'Q'. +This will process a default [KITTI](http://www.cvlibs.net/datasets/kitti/eval_odometry.php) video (available in the folder `data/videos`) by using its corresponding camera calibration file (available in the folder `settings`), and its groundtruth (available in the same `data/videos` folder). If matplotlib windows are used, you can stop `main_vo.py` by focusing/clicking on one of them and pressing the key 'Q'. **Note**: As explained above, the basic script `main_vo.py` **strictly requires a ground truth**. In order to process a different **dataset**, you need to set the file `config.yaml`: * Select your dataset `type` in the section `DATASET` (further details in the section *[Datasets](#datasets)* below for further details). This identifies a corresponding dataset section (e.g. `KITTI_DATASET`, `TUM_DATASET`, etc). * Select the `sensor_type` (`mono`, `stereo`, `rgbd`) in the chosen dataset section. * Select the camera `settings` file in the dataset section (further details in the section *[Camera Settings](#camera-settings)* below). -* The `groudtruth_file` accordingly (further details in the section *[Datasets](#datasets)* below and check the files `ground_truth.py` and `convert_groundtruth.py`). +* The `groudtruth_file` accordingly (further details in the section *[Datasets](#datasets)* below and check the files `io/ground_truth.py` and `io/convert_groundtruth.py`). Similarly, you can test `main_slam.py` by running: ```bash @@ -164,7 +164,7 @@ $ . pyenv-activate.sh # Activate pyslam python virtual environment. This is o $ ./main_slam.py ``` -This will process a default [KITTI]((http://www.cvlibs.net/datasets/kitti/eval_odometry.php)) video (available in the folder `videos`) by using its corresponding camera calibration file (available in the folder `settings`). You can stop it by focusing/clicking on one of the opened matplotlib windows and pressing the key 'Q'. +This will process a default [KITTI]((http://www.cvlibs.net/datasets/kitti/eval_odometry.php)) video (available in the folder `data/videos`) by using its corresponding camera calibration file (available in the folder `settings`). You can stop it by focusing/clicking on one of the opened matplotlib windows and pressing the key 'Q'. **Note**: Due to information loss in video compression, `main_slam.py` tracking may peform worse with the available KITTI videos than with the original KITTI image sequences. The available videos are intended to be used for a first quick test. Please, download and use the original KITTI image sequences as explained [below](#datasets). ### Feature tracking @@ -441,7 +441,7 @@ $ python associate.py PATH_TO_SEQUENCE/rgb.txt PATH_TO_SEQUENCE/depth.txt > asso ### EuRoC Datasets 1. Download a sequence (ASL format) from http://projects.asl.ethz.ch/datasets/doku.php?id=kmavvisualinertialdatasets (check this direct [link](http://robotics.ethz.ch/~asl-datasets/ijrr_euroc_mav_dataset/)) -2. Use the script `groundtruth/generate_euroc_groundtruths_as_tum.sh` to generate the TUM-like groundtruth files `path + '/' + name + '/mav0/state_groundtruth_estimate0/data.tum'` that are required by the `EurocGroundTruth` class. +2. Use the script `io/generate_euroc_groundtruths_as_tum.sh` to generate the TUM-like groundtruth files `path + '/' + name + '/mav0/state_groundtruth_estimate0/data.tum'` that are required by the `EurocGroundTruth` class. 3. Select the corresponding calibration settings file (parameter `EUROC_DATASET: cam_settings:` in the file `config.yaml`). diff --git a/config.py b/config.py index 4b901fd0..123ce995 100644 --- a/config.py +++ b/config.py @@ -25,7 +25,7 @@ import os import yaml import numpy as np -from utils_sys import Printer, locally_configure_qt_environment +from utilities.utils_sys import Printer, locally_configure_qt_environment import math diff --git a/config.yaml b/config.yaml index 23401b40..466d3998 100644 --- a/config.yaml +++ b/config.yaml @@ -7,6 +7,14 @@ CORE_LIB_PATHS: orb_features: thirdparty/orbslam2_features/lib pyslam_utils: cpp/utils/lib thirdparty: thirdparty # considering the folders in thirdparty as modules + utilities: utilities + depth_estimation: depth_estimation + local_features: local_features + loop_closing: loop_closing + slam: slam + viz: viz + io: io + dense: dense LIB_PATHS: # The following libs are explicitely imported on demand by using, for instance: @@ -47,10 +55,10 @@ LIB_PATHS: DATASET: # select your dataset (decomment only one of the following lines) #type: EUROC_DATASET - #type: KITTI_DATASET + type: KITTI_DATASET #type: TUM_DATASET #type: REPLICA_DATASET - type: VIDEO_DATASET + #type: VIDEO_DATASET #type: FOLDER_DATASET #type: LIVE_DATASET # Not recommended for current development stage @@ -121,15 +129,15 @@ VIDEO_DATASET: type: video sensor_type: mono # Here, 'sensor_type' can be only 'mono' # - #base_path: ./videos/kitti00 + #base_path: ./data/videos/kitti00 #settings: settings/KITTI00-02.yaml #name: video.mp4 # - base_path: ./videos/kitti06 + base_path: ./data/videos/kitti06 settings: settings/KITTI04-12.yaml name: video_color.mp4 # - #base_path: ./videos/webcam + #base_path: ./data/videos/webcam #settings: settings/WEBCAM.yaml #name: video.mp4 # diff --git a/parameters.py b/config_parameters.py similarity index 97% rename from parameters.py rename to config_parameters.py index b8764662..0a227fb6 100644 --- a/parameters.py +++ b/config_parameters.py @@ -171,7 +171,7 @@ class Parameters: kGBAUseRobustKernel = True # Volume Integration - kUseVolumetricIntegration = False # To enable/disable volumetric integration (dense mapping) + kUseVolumetricIntegration = True # To enable/disable volumetric integration (dense mapping) kVolumetricIntegrationDebugAndPrintToFile = True kVolumetricIntegrationExtractMesh = False # Extract mesh or point cloud as output kVolumetricIntegrationVoxelLength = 0.015 # [m] @@ -180,7 +180,7 @@ class Parameters: kVolumetricIntegrationDepthTruncOutdoor = 10.0 # [m] kVolumetricIntegrationMinNumLBATimes = 1 # We integrate only the keyframes that have been processed by LBA at least kVolumetricIntegrationMinNumLBATimes times. kVolumetricIntegrationOutputTimeInterval = 1.0 # [s] - kVolumetricIntegrationUseDepthEstimator = False # Use depth estimator for volumetric integration in the back-end. + kVolumetricIntegrationUseDepthEstimator = True # Use depth estimator for volumetric integration in the back-end. # Since the depth inference time is above 1 second, this is very slow. # NOTE: the depth estimator estimates a metric depth (with an absolute scale). You can't combine it with a MONOCULAR SLAM since the SLAM map scale will be not consistent. kVolumetricIntegrationDepthEstimatorType = "DEPTH_RAFT_STEREO" # "DEPTH_PRO","DEPTH_ANYTHING_V2, "DEPTH_SGBM", "DEPTH_RAFT_STEREO", "DEPTH_CRESTEREO_PYTORCH" (see depth_estimator_factory.py) diff --git a/videos/kitti00/00.txt b/data/videos/kitti00/00.txt similarity index 100% rename from videos/kitti00/00.txt rename to data/videos/kitti00/00.txt diff --git a/videos/kitti00/groundtruth.txt b/data/videos/kitti00/groundtruth.txt similarity index 100% rename from videos/kitti00/groundtruth.txt rename to data/videos/kitti00/groundtruth.txt diff --git a/videos/kitti00/times.txt b/data/videos/kitti00/times.txt similarity index 100% rename from videos/kitti00/times.txt rename to data/videos/kitti00/times.txt diff --git a/videos/kitti00/video.mp4 b/data/videos/kitti00/video.mp4 similarity index 100% rename from videos/kitti00/video.mp4 rename to data/videos/kitti00/video.mp4 diff --git a/videos/kitti06/06.txt b/data/videos/kitti06/06.txt similarity index 100% rename from videos/kitti06/06.txt rename to data/videos/kitti06/06.txt diff --git a/videos/kitti06/groundtruth.txt b/data/videos/kitti06/groundtruth.txt similarity index 100% rename from videos/kitti06/groundtruth.txt rename to data/videos/kitti06/groundtruth.txt diff --git a/videos/kitti06/times.txt b/data/videos/kitti06/times.txt similarity index 100% rename from videos/kitti06/times.txt rename to data/videos/kitti06/times.txt diff --git a/videos/kitti06/video.mp4 b/data/videos/kitti06/video.mp4 similarity index 100% rename from videos/kitti06/video.mp4 rename to data/videos/kitti06/video.mp4 diff --git a/videos/kitti06/video_color.mp4 b/data/videos/kitti06/video_color.mp4 similarity index 100% rename from videos/kitti06/video_color.mp4 rename to data/videos/kitti06/video_color.mp4 diff --git a/volumetric_integrator.py b/dense/volumetric_integrator.py similarity index 99% rename from volumetric_integrator.py rename to dense/volumetric_integrator.py index ae365603..f8190955 100644 --- a/volumetric_integrator.py +++ b/dense/volumetric_integrator.py @@ -38,7 +38,7 @@ from timer import TimerFps -from parameters import Parameters +from config_parameters import Parameters import traceback @@ -66,8 +66,8 @@ kScriptPath = os.path.realpath(__file__) kScriptFolder = os.path.dirname(kScriptPath) kRootFolder = kScriptFolder -kDataFolder = kRootFolder + '/data' -kLogsFolder = kRootFolder + '/logs' +kDataFolder = kRootFolder + '/../data' +kLogsFolder = kRootFolder + '/../logs' kVolumetricIntegratorProcessName = 'VolumetricIntegratorProcess' diff --git a/depth_estimator_base.py b/depth_estimation/depth_estimator_base.py similarity index 99% rename from depth_estimator_base.py rename to depth_estimation/depth_estimator_base.py index f92a2fb1..0b15e580 100644 --- a/depth_estimator_base.py +++ b/depth_estimation/depth_estimator_base.py @@ -32,7 +32,7 @@ kScriptPath = os.path.realpath(__file__) kScriptFolder = os.path.dirname(kScriptPath) -kRootFolder = kScriptFolder +kRootFolder = kScriptFolder + '/..' # Base class for depth estimators via inference. diff --git a/depth_estimator_crestereo.py b/depth_estimation/depth_estimator_crestereo.py similarity index 99% rename from depth_estimator_crestereo.py rename to depth_estimation/depth_estimator_crestereo.py index 3d167503..d4f0e8cb 100644 --- a/depth_estimator_crestereo.py +++ b/depth_estimation/depth_estimator_crestereo.py @@ -38,7 +38,7 @@ kScriptPath = os.path.realpath(__file__) kScriptFolder = os.path.dirname(kScriptPath) -kRootFolder = kScriptFolder +kRootFolder = kScriptFolder + '/..' def enforce_megengine_linking(): diff --git a/depth_estimator_crestereo_pytorch.py b/depth_estimation/depth_estimator_crestereo_pytorch.py similarity index 99% rename from depth_estimator_crestereo_pytorch.py rename to depth_estimation/depth_estimator_crestereo_pytorch.py index 332dba87..21fca5fe 100644 --- a/depth_estimator_crestereo_pytorch.py +++ b/depth_estimation/depth_estimator_crestereo_pytorch.py @@ -41,7 +41,7 @@ kScriptPath = os.path.realpath(__file__) kScriptFolder = os.path.dirname(kScriptPath) -kRootFolder = kScriptFolder +kRootFolder = kScriptFolder + '/..' # Stereo depth prediction using the Crestereo model with pytorch. diff --git a/depth_estimator_depth_anything_v2.py b/depth_estimation/depth_estimator_depth_anything_v2.py similarity index 99% rename from depth_estimator_depth_anything_v2.py rename to depth_estimation/depth_estimator_depth_anything_v2.py index 7545de57..fa092588 100644 --- a/depth_estimator_depth_anything_v2.py +++ b/depth_estimation/depth_estimator_depth_anything_v2.py @@ -43,7 +43,7 @@ kScriptPath = os.path.realpath(__file__) kScriptFolder = os.path.dirname(kScriptPath) -kRootFolder = kScriptFolder +kRootFolder = kScriptFolder + '/..' # Monocular depth estimator using the DepthAnythingV2 model. diff --git a/depth_estimator_depth_pro.py b/depth_estimation/depth_estimator_depth_pro.py similarity index 98% rename from depth_estimator_depth_pro.py rename to depth_estimation/depth_estimator_depth_pro.py index 76665439..57876c15 100644 --- a/depth_estimator_depth_pro.py +++ b/depth_estimation/depth_estimator_depth_pro.py @@ -41,7 +41,7 @@ kScriptPath = os.path.realpath(__file__) kScriptFolder = os.path.dirname(kScriptPath) -kRootFolder = kScriptFolder +kRootFolder = kScriptFolder + '/..' # Moncocular depth estimator using the DepthPro model. diff --git a/depth_estimator_factory.py b/depth_estimation/depth_estimator_factory.py similarity index 99% rename from depth_estimator_factory.py rename to depth_estimation/depth_estimator_factory.py index ad17f5ec..59f99a67 100644 --- a/depth_estimator_factory.py +++ b/depth_estimation/depth_estimator_factory.py @@ -41,7 +41,7 @@ kScriptPath = os.path.realpath(__file__) kScriptFolder = os.path.dirname(kScriptPath) -kRootFolder = kScriptFolder +kRootFolder = kScriptFolder + '/..' @register_class diff --git a/depth_estimator_raft_stereo.py b/depth_estimation/depth_estimator_raft_stereo.py similarity index 99% rename from depth_estimator_raft_stereo.py rename to depth_estimation/depth_estimator_raft_stereo.py index 3236c833..ebdedccc 100644 --- a/depth_estimator_raft_stereo.py +++ b/depth_estimation/depth_estimator_raft_stereo.py @@ -43,7 +43,7 @@ kScriptPath = os.path.realpath(__file__) kScriptFolder = os.path.dirname(kScriptPath) -kRootFolder = kScriptFolder +kRootFolder = kScriptFolder + '/..' class DepthEstimatorRaftStereoConfiguration: diff --git a/CONDA.md b/docs/CONDA.md similarity index 100% rename from CONDA.md rename to docs/CONDA.md diff --git a/MAC.md b/docs/MAC.md similarity index 100% rename from MAC.md rename to docs/MAC.md diff --git a/PYTHON-VIRTUAL-ENVS.md b/docs/PYTHON-VIRTUAL-ENVS.md similarity index 97% rename from PYTHON-VIRTUAL-ENVS.md rename to docs/PYTHON-VIRTUAL-ENVS.md index 1bf6d64d..3a37bce8 100644 --- a/PYTHON-VIRTUAL-ENVS.md +++ b/docs/PYTHON-VIRTUAL-ENVS.md @@ -1,8 +1,8 @@ -# pySLAM2 Virtual Environment +# Install pyslam virtual environment -- [pySLAM2 Virtual Environment](#pyslam2-virtual-environment) +- [Install pyslam virtual environment](#install-pyslam-virtual-environment) - [Installation](#installation) - [Usage](#usage) - [Create a `pyslam` python virtual environment](#create-a-pyslam-python-virtual-environment) diff --git a/TROUBLESHOOTING.md b/docs/TROUBLESHOOTING.md similarity index 85% rename from TROUBLESHOOTING.md rename to docs/TROUBLESHOOTING.md index 2978cb1f..fbd6c171 100644 --- a/TROUBLESHOOTING.md +++ b/docs/TROUBLESHOOTING.md @@ -21,9 +21,9 @@ This page contains a small collections of issues/errors that may be experienced along with their fixes. -**FIRST OF ALL**: did you read the main [README](./README.md) page? did you use the provided **INSTALL SCRIPTS**? If not then go back on the [README](./README.md) page, read the few lines in the install section and launch the **REQUIRED** install script. The install scripts were created in order to perform all the required install operations for you and make the install process itself as painless as possible. +**FIRST OF ALL**: did you read the main [README](./../README.md) page? did you use the provided **INSTALL SCRIPTS**? If not then go back on the [README](./../README.md) page, read the few lines in the install section and launch the **REQUIRED** install script. The install scripts were created in order to perform all the required install operations for you and make the install process itself as painless as possible. -If you work under **Ubuntu 20.04** or **MacOS**, check the specific installation procedures reported in the main [README](./README.md) page. +If you work under **Ubuntu 20.04** or **MacOS**, check the specific installation procedures reported in the main [README](./../README.md) page. ## Bad tracking performances @@ -44,17 +44,15 @@ this will solve the problem. ## SURF error -In order to use [non-free OpenCV features](https://stackoverflow.com/questions/50467696/pycharm-installation-of-non-free-opencv-modules-for-operations-like-sift-surf) (i.e. **SURF**, etc.), you need to install the module `opencv-contrib-python` built with the enabled option `OPENCV_ENABLE_NONFREE`. You can find SURF availalble in `opencv-contrib-python 3.4.2.16`: this can be installed by running -``` -$ pip3 uninstall opencv-contrib-python -$ pip3 install opencv-contrib-python==3.4.2.16 -``` +In order to use [non-free OpenCV features](https://stackoverflow.com/questions/50467696/pycharm-installation-of-non-free-opencv-modules-for-operations-like-sift-surf) (i.e. **SURF**, etc.), you need to install the module `opencv-contrib-python` built with the enabled option `OPENCV_ENABLE_NONFREE`. -For a more advanced OpenCV installation procedure, you can take a look [here](https://docs.opencv.org/master/d2/de6/tutorial_py_setup_in_ubuntu.html). -How to check your installed OpenCV version: -``` -$ python3 -c "import cv2; print(cv2.__version__)" -``` +The provided install scripts will install a recent opencv version (>=**4.10**) with non-free modules enabled (see the provided scripts [install_pip3_packages.sh](./../install_pip3_packages.sh) and [install_opencv_python.sh](./../install_opencv_python.sh)). To quickly verify your installed opencv version run: +`$ . pyenv-activate.sh ` +`$ ./scripts/opencv_check.py` +or use the following command: +`$ python3 -c "import cv2; print(cv2.__version__)"` +How to check if you have non-free OpenCV module support (no errors imply success): +`$ python3 -c "import cv2; detector = cv2.xfeatures2d.SURF_create()"` ## g2o Errors @@ -70,7 +68,7 @@ that's because you did not run the script ``` $ ./install_thirdparty.sh ``` -as explained in the main [README](./README.md) file. That's required in order to properly build and install the required thirdparty libs. +as explained in the main [README](./../README.md) file. That's required in order to properly build and install the required thirdparty libs. Please,follow these steps: - check you are on the correct pyslam branch according to your OS - use the pyslam install scripts @@ -86,9 +84,9 @@ If you get an error message like import g2o ModuleNotFoundError: No module named 'g2o' error ``` -First of all, check if you have a compiled `thirdparty/g2opy/lib/g2o.cpython-*-linux-gnu.so`. If not, Did you use one of the install_all scripts? Depending on your selected working environment (native, conda, python3-venv), you need to launch its companion install_all script in order to actually install all the required libraries (including g2o). Please, read the install instruction in the main [README](./README.md) file. +First of all, check if you have a compiled `thirdparty/g2opy/lib/g2o.cpython-*-linux-gnu.so`. If not, Did you use one of the install_all scripts? Depending on your selected working environment (native, conda, python3-venv), you need to launch its companion install_all script in order to actually install all the required libraries (including g2o). Please, read the install instruction in the main [README](./../README.md) file. -On the other hand, if you already have a compiled `thirdparty/g2opy/lib/g2o.cpython-*-linux-gnu.so`, it's very likely you have libraries compiled in a 'mixed' way. Then, try to clean everything with the script `clean.sh`, and follow the installation procedure again (see the main [README](./README.md) file). +On the other hand, if you already have a compiled `thirdparty/g2opy/lib/g2o.cpython-*-linux-gnu.so`, it's very likely you have libraries compiled in a 'mixed' way. Then, try to clean everything with the script `clean.sh`, and follow the installation procedure again (see the main [README](./../README.md) file). Last but not least, please recall that you need to activate your `pyenv`/`conda` environment before launching any pySLAM script. diff --git a/install_all.sh b/install_all.sh index 9988e054..44c3c63e 100755 --- a/install_all.sh +++ b/install_all.sh @@ -5,7 +5,7 @@ set -e -echo This script is deprecated. Read the instructions in PYTHON-VIRTUAL-ENVS.md and use the command: . install_all_venv.sh +echo This script is deprecated. Read the instructions in docs/PYTHON-VIRTUAL-ENVS.md and use the command: . install_all_venv.sh exit 1 diff --git a/convert_groundtruth.py b/io/convert_groundtruth.py similarity index 100% rename from convert_groundtruth.py rename to io/convert_groundtruth.py diff --git a/dataset.py b/io/dataset.py similarity index 100% rename from dataset.py rename to io/dataset.py diff --git a/groundtruth/generate_euroc_groundtruths_as_tum.sh b/io/generate_euroc_groundtruths_as_tum.sh similarity index 100% rename from groundtruth/generate_euroc_groundtruths_as_tum.sh rename to io/generate_euroc_groundtruths_as_tum.sh diff --git a/ground_truth.py b/io/ground_truth.py similarity index 99% rename from ground_truth.py rename to io/ground_truth.py index 2767fa0d..8702b68f 100644 --- a/ground_truth.py +++ b/io/ground_truth.py @@ -442,13 +442,13 @@ class EurocGroundTruth(GroundTruth): def __init__(self, path, name, associations=None, start_frame_id=0, type = GroundTruthType.EUROC): super().__init__(path, name, associations, start_frame_id, type) self.scale = kScaleEuroc - self.filename = path + '/' + name + '/mav0/state_groundtruth_estimate0/data.tum' # NOTE: Use the script groundtruth/generate_euroc_groundtruths_as_tum.sh to generate these groundtruth files + self.filename = path + '/' + name + '/mav0/state_groundtruth_estimate0/data.tum' # NOTE: Use the script io/generate_euroc_groundtruths_as_tum.sh to generate these groundtruth files base_path = os.path.dirname(self.filename) print('base_path: ', base_path) if not os.path.isfile(self.filename): - error_message = f'ERROR: Groundtruth file not found: {self.filename}. Use the script groundtruth/generate_euroc_groundtruths_as_tum.sh to generate these groundtruth files!' + error_message = f'ERROR: Groundtruth file not found: {self.filename}. Use the script io/generate_euroc_groundtruths_as_tum.sh to generate these groundtruth files!' Printer.red(error_message) sys.exit(error_message) diff --git a/groundtruth/multiply_timestamps.py b/io/multiply_timestamps.py similarity index 100% rename from groundtruth/multiply_timestamps.py rename to io/multiply_timestamps.py diff --git a/trajectory_writer.py b/io/trajectory_writer.py similarity index 100% rename from trajectory_writer.py rename to io/trajectory_writer.py diff --git a/feature_aliked.py b/local_features/feature_aliked.py similarity index 100% rename from feature_aliked.py rename to local_features/feature_aliked.py diff --git a/feature_contextdesc.py b/local_features/feature_contextdesc.py similarity index 100% rename from feature_contextdesc.py rename to local_features/feature_contextdesc.py diff --git a/feature_d2net.py b/local_features/feature_d2net.py similarity index 100% rename from feature_d2net.py rename to local_features/feature_d2net.py diff --git a/feature_delf.py b/local_features/feature_delf.py similarity index 100% rename from feature_delf.py rename to local_features/feature_delf.py diff --git a/feature_disk.py b/local_features/feature_disk.py similarity index 100% rename from feature_disk.py rename to local_features/feature_disk.py diff --git a/feature_geodesc.py b/local_features/feature_geodesc.py similarity index 100% rename from feature_geodesc.py rename to local_features/feature_geodesc.py diff --git a/feature_hardnet.py b/local_features/feature_hardnet.py similarity index 100% rename from feature_hardnet.py rename to local_features/feature_hardnet.py diff --git a/feature_keynet.py b/local_features/feature_keynet.py similarity index 100% rename from feature_keynet.py rename to local_features/feature_keynet.py diff --git a/feature_keynet_affnet_hardnet.py b/local_features/feature_keynet_affnet_hardnet.py similarity index 100% rename from feature_keynet_affnet_hardnet.py rename to local_features/feature_keynet_affnet_hardnet.py diff --git a/feature_l2net.py b/local_features/feature_l2net.py similarity index 100% rename from feature_l2net.py rename to local_features/feature_l2net.py diff --git a/feature_l2net_keras.py b/local_features/feature_l2net_keras.py similarity index 100% rename from feature_l2net_keras.py rename to local_features/feature_l2net_keras.py diff --git a/feature_lfnet.py b/local_features/feature_lfnet.py similarity index 100% rename from feature_lfnet.py rename to local_features/feature_lfnet.py diff --git a/feature_lightglue_sift.py b/local_features/feature_lightglue_sift.py similarity index 100% rename from feature_lightglue_sift.py rename to local_features/feature_lightglue_sift.py diff --git a/feature_logpolar.py b/local_features/feature_logpolar.py similarity index 100% rename from feature_logpolar.py rename to local_features/feature_logpolar.py diff --git a/feature_manager.py b/local_features/feature_manager.py similarity index 99% rename from feature_manager.py rename to local_features/feature_manager.py index 2949efb4..6fbbed3b 100644 --- a/feature_manager.py +++ b/local_features/feature_manager.py @@ -24,7 +24,7 @@ from collections import Counter -from parameters import Parameters +from config_parameters import Parameters from feature_types import FeatureDetectorTypes, FeatureDescriptorTypes, FeatureInfo diff --git a/feature_manager_adaptors.py b/local_features/feature_manager_adaptors.py similarity index 100% rename from feature_manager_adaptors.py rename to local_features/feature_manager_adaptors.py diff --git a/feature_manager_configs.py b/local_features/feature_manager_configs.py similarity index 98% rename from feature_manager_configs.py rename to local_features/feature_manager_configs.py index 02325eca..924c5f06 100644 --- a/feature_manager_configs.py +++ b/local_features/feature_manager_configs.py @@ -20,7 +20,7 @@ from feature_manager import feature_manager_factory from feature_types import FeatureDetectorTypes, FeatureDescriptorTypes -from parameters import Parameters +from config_parameters import Parameters kNumFeatures=Parameters.kNumFeatures diff --git a/feature_matcher.py b/local_features/feature_matcher.py similarity index 99% rename from feature_matcher.py rename to local_features/feature_matcher.py index 5e5d9d31..5c7e4a55 100644 --- a/feature_matcher.py +++ b/local_features/feature_matcher.py @@ -25,7 +25,7 @@ from utils_sys import Printer, import_from from utils_data import AtomicCounter from utils_serialization import SerializableEnum, register_class -from parameters import Parameters +from config_parameters import Parameters from collections import defaultdict @@ -47,7 +47,7 @@ kScriptPath = os.path.realpath(__file__) kScriptFolder = os.path.dirname(kScriptPath) kRootFolder = kScriptFolder -kLogsFolder = kRootFolder + '/logs' +kLogsFolder = kRootFolder + '/../logs' diff --git a/feature_orbslam2.py b/local_features/feature_orbslam2.py similarity index 100% rename from feature_orbslam2.py rename to local_features/feature_orbslam2.py diff --git a/feature_r2d2.py b/local_features/feature_r2d2.py similarity index 100% rename from feature_r2d2.py rename to local_features/feature_r2d2.py diff --git a/feature_root_sift.py b/local_features/feature_root_sift.py similarity index 100% rename from feature_root_sift.py rename to local_features/feature_root_sift.py diff --git a/feature_shitomasi.py b/local_features/feature_shitomasi.py similarity index 98% rename from feature_shitomasi.py rename to local_features/feature_shitomasi.py index 048f84f6..cd783721 100644 --- a/feature_shitomasi.py +++ b/local_features/feature_shitomasi.py @@ -22,7 +22,7 @@ import cv2 -from parameters import Parameters +from config_parameters import Parameters class ShiTomasiDetector(object): diff --git a/feature_sosnet.py b/local_features/feature_sosnet.py similarity index 100% rename from feature_sosnet.py rename to local_features/feature_sosnet.py diff --git a/feature_superpoint.py b/local_features/feature_superpoint.py similarity index 100% rename from feature_superpoint.py rename to local_features/feature_superpoint.py diff --git a/feature_tfeat.py b/local_features/feature_tfeat.py similarity index 100% rename from feature_tfeat.py rename to local_features/feature_tfeat.py diff --git a/feature_tracker.py b/local_features/feature_tracker.py similarity index 99% rename from feature_tracker.py rename to local_features/feature_tracker.py index 55f9d778..6f32ca43 100644 --- a/feature_tracker.py +++ b/local_features/feature_tracker.py @@ -27,7 +27,7 @@ from utils_serialization import SerializableEnum, register_class from utils_sys import Printer, import_from from utils_geom import hamming_distance, hamming_distances, l2_distance, l2_distances -from parameters import Parameters +from config_parameters import Parameters from typing import TYPE_CHECKING if TYPE_CHECKING: diff --git a/feature_tracker_configs.py b/local_features/feature_tracker_configs.py similarity index 99% rename from feature_tracker_configs.py rename to local_features/feature_tracker_configs.py index 38cb1fd4..d66867c2 100644 --- a/feature_tracker_configs.py +++ b/local_features/feature_tracker_configs.py @@ -22,7 +22,7 @@ from feature_types import FeatureDetectorTypes, FeatureDescriptorTypes, FeatureInfo from feature_matcher import FeatureMatcherTypes -from parameters import Parameters +from config_parameters import Parameters # some default parameters diff --git a/feature_types.py b/local_features/feature_types.py similarity index 100% rename from feature_types.py rename to local_features/feature_types.py diff --git a/feature_xfeat.py b/local_features/feature_xfeat.py similarity index 100% rename from feature_xfeat.py rename to local_features/feature_xfeat.py diff --git a/keyframe_database.py b/loop_closing/keyframe_database.py similarity index 100% rename from keyframe_database.py rename to loop_closing/keyframe_database.py diff --git a/loop_closing.py b/loop_closing/loop_closing.py similarity index 99% rename from loop_closing.py rename to loop_closing/loop_closing.py index 1dd8ffa6..83ded0e5 100644 --- a/loop_closing.py +++ b/loop_closing/loop_closing.py @@ -52,7 +52,7 @@ from loop_detecting_process import LoopDetectingProcess from loop_detector_base import LoopDetectorTask, LoopDetectorTaskType, LoopDetectorOutput -from parameters import Parameters +from config_parameters import Parameters from relocalizer import Relocalizer @@ -76,7 +76,7 @@ kScriptPath = os.path.realpath(__file__) kScriptFolder = os.path.dirname(kScriptPath) kRootFolder = kScriptFolder -kLogsFolder = kRootFolder + '/logs' +kLogsFolder = kRootFolder + '/../logs' if kVerbose: diff --git a/loop_detecting_process.py b/loop_closing/loop_detecting_process.py similarity index 99% rename from loop_detecting_process.py rename to loop_closing/loop_detecting_process.py index b0a6005b..efe40555 100644 --- a/loop_detecting_process.py +++ b/loop_closing/loop_detecting_process.py @@ -33,7 +33,7 @@ from utils_mp import MultiprocessingManager from utils_data import empty_queue -from parameters import Parameters +from config_parameters import Parameters from feature_types import FeatureInfo from timer import TimerFps @@ -61,7 +61,7 @@ kScriptPath = os.path.realpath(__file__) kScriptFolder = os.path.dirname(kScriptPath) kRootFolder = kScriptFolder -kDataFolder = kRootFolder + '/data' +kDataFolder = kRootFolder + '/../data' if Parameters.kLoopClosingDebugAndPrintToFile: diff --git a/loop_detector_base.py b/loop_closing/loop_detector_base.py similarity index 99% rename from loop_detector_base.py rename to loop_closing/loop_detector_base.py index 7eb573fe..d9d7370c 100644 --- a/loop_detector_base.py +++ b/loop_closing/loop_detector_base.py @@ -30,7 +30,7 @@ from utils_img import float_to_color, LoopCandidateImgs from utils_serialization import NumpyB64Json -from parameters import Parameters +from config_parameters import Parameters from feature_types import FeatureInfo from keyframe import KeyFrame @@ -53,8 +53,8 @@ kScriptPath = os.path.realpath(__file__) kScriptFolder = os.path.dirname(kScriptPath) kRootFolder = kScriptFolder -kDataFolder = kRootFolder + '/data' -kLogsFolder = kRootFolder + '/logs' +kDataFolder = kRootFolder + '/../data' +kLogsFolder = kRootFolder + '/../logs' if kVerbose: diff --git a/loop_detector_configs.py b/loop_closing/loop_detector_configs.py similarity index 99% rename from loop_detector_configs.py rename to loop_closing/loop_detector_configs.py index 56cbc34b..606c04af 100644 --- a/loop_detector_configs.py +++ b/loop_closing/loop_detector_configs.py @@ -27,7 +27,7 @@ from utils_serialization import SerializableEnum, register_class from utils_sys import Printer -from parameters import Parameters +from config_parameters import Parameters from feature_manager import feature_manager_factory from feature_manager_configs import FeatureManagerConfigs @@ -57,7 +57,7 @@ kScriptPath = os.path.realpath(__file__) kScriptFolder = os.path.dirname(kScriptPath) kRootFolder = kScriptFolder -kDataFolder = kRootFolder + '/data' +kDataFolder = kRootFolder + '/../data' @register_class diff --git a/loop_detector_database.py b/loop_closing/loop_detector_database.py similarity index 99% rename from loop_detector_database.py rename to loop_closing/loop_detector_database.py index 27527a53..350b42f4 100644 --- a/loop_detector_database.py +++ b/loop_closing/loop_detector_database.py @@ -32,7 +32,7 @@ from typing import List -from parameters import Parameters +from config_parameters import Parameters import torch if platform.system() != 'Darwin': @@ -55,7 +55,7 @@ kScriptPath = os.path.realpath(__file__) kScriptFolder = os.path.dirname(kScriptPath) kRootFolder = kScriptFolder -kDataFolder = kRootFolder + '/data' +kDataFolder = kRootFolder + '/../data' if Parameters.kLoopClosingDebugAndPrintToFile: diff --git a/loop_detector_dbow2.py b/loop_closing/loop_detector_dbow2.py similarity index 99% rename from loop_detector_dbow2.py rename to loop_closing/loop_detector_dbow2.py index 5f4d2065..f8675564 100644 --- a/loop_detector_dbow2.py +++ b/loop_closing/loop_detector_dbow2.py @@ -30,7 +30,7 @@ from utils_sys import getchar, Printer from utils_features import transform_float_to_binary_descriptor -from parameters import Parameters +from config_parameters import Parameters from feature_types import FeatureInfo from timer import TimerFps @@ -57,7 +57,7 @@ kScriptPath = os.path.realpath(__file__) kScriptFolder = os.path.dirname(kScriptPath) kRootFolder = kScriptFolder -kDataFolder = kRootFolder + '/data' +kDataFolder = kRootFolder + '/../data' if Parameters.kLoopClosingDebugAndPrintToFile: diff --git a/loop_detector_dbow3.py b/loop_closing/loop_detector_dbow3.py similarity index 99% rename from loop_detector_dbow3.py rename to loop_closing/loop_detector_dbow3.py index 89b1c352..fc0d39f6 100644 --- a/loop_detector_dbow3.py +++ b/loop_closing/loop_detector_dbow3.py @@ -29,7 +29,7 @@ from utils_sys import getchar, Printer from utils_features import transform_float_to_binary_descriptor -from parameters import Parameters +from config_parameters import Parameters from feature_types import FeatureInfo from timer import TimerFps @@ -56,7 +56,7 @@ kScriptPath = os.path.realpath(__file__) kScriptFolder = os.path.dirname(kScriptPath) kRootFolder = kScriptFolder -kDataFolder = kRootFolder + '/data' +kDataFolder = kRootFolder + '/../data' if Parameters.kLoopClosingDebugAndPrintToFile: diff --git a/loop_detector_ibow.py b/loop_closing/loop_detector_ibow.py similarity index 99% rename from loop_detector_ibow.py rename to loop_closing/loop_detector_ibow.py index 06e33aa8..bc3cc30d 100644 --- a/loop_detector_ibow.py +++ b/loop_closing/loop_detector_ibow.py @@ -28,7 +28,7 @@ from utils_sys import getchar, Printer from utils_features import transform_float_to_binary_descriptor -from parameters import Parameters +from config_parameters import Parameters from feature_types import FeatureInfo from timer import TimerFps @@ -58,7 +58,7 @@ kScriptPath = os.path.realpath(__file__) kScriptFolder = os.path.dirname(kScriptPath) kRootFolder = kScriptFolder -kDataFolder = kRootFolder + '/data' +kDataFolder = kRootFolder + '/../data' if Parameters.kLoopClosingDebugAndPrintToFile: diff --git a/loop_detector_obindex2.py b/loop_closing/loop_detector_obindex2.py similarity index 99% rename from loop_detector_obindex2.py rename to loop_closing/loop_detector_obindex2.py index bab00864..c195b030 100644 --- a/loop_detector_obindex2.py +++ b/loop_closing/loop_detector_obindex2.py @@ -28,7 +28,7 @@ from utils_sys import getchar, Printer from utils_features import transform_float_to_binary_descriptor -from parameters import Parameters +from config_parameters import Parameters from feature_types import FeatureInfo from timer import TimerFps @@ -57,7 +57,7 @@ kScriptPath = os.path.realpath(__file__) kScriptFolder = os.path.dirname(kScriptPath) kRootFolder = kScriptFolder -kDataFolder = kRootFolder + '/data' +kDataFolder = kRootFolder + '/../data' if Parameters.kLoopClosingDebugAndPrintToFile: diff --git a/loop_detector_score.py b/loop_closing/loop_detector_score.py similarity index 98% rename from loop_detector_score.py rename to loop_closing/loop_detector_score.py index 0928995f..4dcbe6aa 100644 --- a/loop_detector_score.py +++ b/loop_closing/loop_detector_score.py @@ -30,7 +30,7 @@ from typing import List -from parameters import Parameters +from config_parameters import Parameters import torch import traceback @@ -46,7 +46,7 @@ kScriptPath = os.path.realpath(__file__) kScriptFolder = os.path.dirname(kScriptPath) kRootFolder = kScriptFolder -kDataFolder = kRootFolder + '/data' +kDataFolder = kRootFolder + '/../data' if Parameters.kLoopClosingDebugAndPrintToFile: diff --git a/loop_detector_vlad.py b/loop_closing/loop_detector_vlad.py similarity index 99% rename from loop_detector_vlad.py rename to loop_closing/loop_detector_vlad.py index 64ba81fc..360b4be6 100644 --- a/loop_detector_vlad.py +++ b/loop_closing/loop_detector_vlad.py @@ -29,7 +29,7 @@ from typing import List -from parameters import Parameters +from config_parameters import Parameters from feature_types import FeatureInfo from timer import TimerFps @@ -56,7 +56,7 @@ kScriptPath = os.path.realpath(__file__) kScriptFolder = os.path.dirname(kScriptPath) kRootFolder = kScriptFolder -kDataFolder = kRootFolder + '/data' +kDataFolder = kRootFolder + '/../data' if Parameters.kLoopClosingDebugAndPrintToFile: diff --git a/loop_detector_vocabulary.py b/loop_closing/loop_detector_vocabulary.py similarity index 98% rename from loop_detector_vocabulary.py rename to loop_closing/loop_detector_vocabulary.py index 3429d4ee..4082b223 100644 --- a/loop_detector_vocabulary.py +++ b/loop_closing/loop_detector_vocabulary.py @@ -26,7 +26,7 @@ from utils_sys import getchar, Printer -from parameters import Parameters +from config_parameters import Parameters from utils_files import gdrive_download_lambda from feature_types import FeatureDetectorTypes, FeatureDescriptorTypes @@ -38,7 +38,7 @@ kScriptPath = os.path.realpath(__file__) kScriptFolder = os.path.dirname(kScriptPath) kRootFolder = kScriptFolder -kDataFolder = kRootFolder + '/data' +kDataFolder = kRootFolder + '/../data' if Parameters.kLoopClosingDebugAndPrintToFile: diff --git a/loop_detector_vpr.py b/loop_closing/loop_detector_vpr.py similarity index 99% rename from loop_detector_vpr.py rename to loop_closing/loop_detector_vpr.py index d45f9fc8..21585fb1 100644 --- a/loop_detector_vpr.py +++ b/loop_closing/loop_detector_vpr.py @@ -29,7 +29,7 @@ from typing import List -from parameters import Parameters +from config_parameters import Parameters from feature_types import FeatureInfo from timer import TimerFps @@ -57,7 +57,7 @@ kScriptPath = os.path.realpath(__file__) kScriptFolder = os.path.dirname(kScriptPath) kRootFolder = kScriptFolder -kDataFolder = kRootFolder + '/data' +kDataFolder = kRootFolder + '/../data' if Parameters.kLoopClosingDebugAndPrintToFile: diff --git a/vlad.py b/loop_closing/vlad.py similarity index 100% rename from vlad.py rename to loop_closing/vlad.py diff --git a/main_depth_prediction.py b/main_depth_prediction.py index b50fc36b..c82311cb 100755 --- a/main_depth_prediction.py +++ b/main_depth_prediction.py @@ -38,7 +38,7 @@ from feature_tracker import feature_tracker_factory, FeatureTrackerTypes from feature_tracker_configs import FeatureTrackerConfigs -from parameters import Parameters +from config_parameters import Parameters import torch import time diff --git a/main_map_viewer.py b/main_map_viewer.py index ba9105a0..dc8bef0c 100755 --- a/main_map_viewer.py +++ b/main_map_viewer.py @@ -38,7 +38,7 @@ from feature_tracker_configs import FeatureTrackerConfigs -from parameters import Parameters +from config_parameters import Parameters if __name__ == "__main__": diff --git a/main_slam.py b/main_slam.py index b02627a9..94662273 100755 --- a/main_slam.py +++ b/main_slam.py @@ -49,7 +49,7 @@ from depth_estimator_factory import depth_estimator_factory, DepthEstimatorType from utils_depth import img_from_depth, filter_shadow_points -from parameters import Parameters +from config_parameters import Parameters from rerun_interface import Rerun diff --git a/main_vo.py b/main_vo.py index 5bd75e59..7c7d3544 100755 --- a/main_vo.py +++ b/main_vo.py @@ -32,7 +32,7 @@ from dataset import dataset_factory from mplot_thread import Mplot2d, Mplot3d -from qtplot_thread import Qplot2d +from qplot_thread import Qplot2d from feature_tracker import feature_tracker_factory, FeatureTrackerTypes from feature_tracker_configs import FeatureTrackerConfigs diff --git a/requirements-conda-nobuilds.yml b/requirements-conda-nobuilds.yml deleted file mode 100644 index 347498cd..00000000 --- a/requirements-conda-nobuilds.yml +++ /dev/null @@ -1,115 +0,0 @@ -name: pyslam -channels: - - conda-forge - - defaults -dependencies: - - _libgcc_mutex=0.1 - - _tflow_select=2.1.0 - - absl-py=0.9.0 - - astor=0.8.0 - - blas=1.0 - - bzip2=1.0.8 - - c-ares=1.15.0 - - ca-certificates=2020.1.1 - - cairo=1.16.0 - - certifi=2019.11.28 - - cudatoolkit=10.1.243 - - cudnn=7.6.5 - - cupti=10.1.168 - - dbus=1.13.6 - - expat=2.2.9 - - ffmpeg=4.1.3 - - fontconfig=2.13.1 - - freetype=2.10.1 - - gast=0.3.3 - - gettext=0.19.8.1 - - giflib=5.2.1 - - glib=2.58.3 - - gmp=6.2.0 - - gnutls=3.6.5 - - google-pasta=0.1.8 - - graphite2=1.3.13 - - grpcio=1.27.2 - - gst-plugins-base=1.14.5 - - gstreamer=1.14.5 - - h5py=2.8.0 - - harfbuzz=2.4.0 - - hdf5=1.10.2 - - icu=64.2 - - jasper=1.900.1 - - jpeg=9c - - keras-applications=1.0.8 - - keras-preprocessing=1.1.0 - - lame=3.100 - - ld_impl_linux-64=2.33.1 - - libblas=3.8.0 - - libcblas=3.8.0 - - libclang=9.0.1 - - libedit=3.1.20181209 - - libffi=3.2.1 - - libgcc-ng=9.1.0 - - libgfortran-ng=7.3.0 - - libiconv=1.15 - - liblapack=3.8.0 - - liblapacke=3.8.0 - - libllvm9=9.0.1 - - libopenblas=0.3.7 - - libpng=1.6.37 - - libprotobuf=3.11.4 - - libstdcxx-ng=9.1.0 - - libtiff=4.1.0 - - libuuid=2.32.1 - - libwebp=1.0.2 - - libxcb=1.13 - - libxkbcommon=0.10.0 - - libxml2=2.9.10 - - lz4-c=1.8.3 - - markdown=3.1.1 - - ncurses=6.2 - - nettle=3.4.1 - - nspr=4.25 - - nss=3.47 - - numpy=1.18.1 - - opencv=3.4.1 - - openh264=1.8.0 - - openssl=1.1.1e - - pcre=8.44 - - pip=20.0.2 - - pixman=0.38.0 - - protobuf=3.11.4 - - pthread-stubs=0.4 - - python=3.6.10 - - python_abi=3.6 - - qt=5.12.5 - - readline=7.0 - - scipy=1.4.1 - - setuptools=46.0.0 - - six=1.14.0 - - sqlite=3.31.1 - - tensorboard=1.14.0 - - tensorflow=1.14.0 - - tensorflow-base=1.14.0 - - tensorflow-estimator=1.14.0 - - tensorflow-gpu=1.14.0 - - termcolor=1.1.0 - - tk=8.6.8 - - werkzeug=1.0.0 - - wheel=0.34.2 - - wrapt=1.12.1 - - x264=1!152.20180806 - - xorg-kbproto=1.0.7 - - xorg-libice=1.0.10 - - xorg-libsm=1.2.3 - - xorg-libx11=1.6.9 - - xorg-libxau=1.0.9 - - xorg-libxdmcp=1.1.3 - - xorg-libxext=1.3.4 - - xorg-libxrender=0.9.10 - - xorg-renderproto=0.11.1 - - xorg-xextproto=7.3.0 - - xorg-xproto=7.0.31 - - xz=5.2.4 - - zlib=1.2.11 - - zstd=1.4.4 -prefix: /home/luigi/anaconda3/envs/pyslam - diff --git a/requirements-conda-pip.txt b/requirements-conda-pip.txt deleted file mode 100644 index a116b5d6..00000000 --- a/requirements-conda-pip.txt +++ /dev/null @@ -1,24 +0,0 @@ -#cycler==0.10.0 -#decorator==4.4.2 -#imageio==2.8.0 -#kiwisolver==1.1.0 -#Markdown==3.2.1 -matplotlib==3.2.1 -#networkx==2.4 -opencv-contrib-python #==3.4.2.16 -#opencv-python==4.2.0.32 -ordered-set==3.1.1 -#Pillow==7.0.0 -pybind11==2.4.3 -pygame==1.9.6 -PyOpenGL==3.1.5 -#pyparsing==2.4.6 -python-dateutil==2.8.1 -PyWavelets==1.1.1 -#PyYAML==5.3.1 -scikit-image==0.16.2 -#six==1.14.0 -tb-nightly==1.14.0a20190603 -torch==1.4.0 -torchvision==0.5.0 -tqdm==4.43.0 diff --git a/requirements-conda.txt b/requirements-conda.txt deleted file mode 100644 index 6eac5ae1..00000000 --- a/requirements-conda.txt +++ /dev/null @@ -1,112 +0,0 @@ -# This file may be used to create an environment using: -# $ conda create --name --file -# platform: linux-64 -_libgcc_mutex=0.1=main -_tflow_select=2.1.0=gpu -absl-py=0.9.0=py36_0 -astor=0.8.0=py36_0 -blas=1.0=openblas -bzip2=1.0.8=h516909a_2 -c-ares=1.15.0=h7b6447c_1001 -ca-certificates=2020.1.1=0 -cairo=1.16.0=hcf35c78_1003 -certifi=2019.11.28=py36_1 -cudatoolkit=10.1.243=h6bb024c_0 -cudnn=7.6.5=cuda10.1_0 -cupti=10.1.168=0 -dbus=1.13.6=he372182_0 -expat=2.2.9=he1b5a44_2 -ffmpeg=4.1.3=h167e202_0 -fontconfig=2.13.1=h86ecdb6_1001 -freetype=2.10.1=he06d7ca_0 -gast=0.3.3=py_0 -gettext=0.19.8.1=hc5be6a0_1002 -giflib=5.2.1=h516909a_2 -glib=2.58.3=py36hd3ed26a_1003 -gmp=6.2.0=he1b5a44_2 -gnutls=3.6.5=hd3a4fd2_1002 -google-pasta=0.1.8=py_0 -graphite2=1.3.13=he1b5a44_1001 -grpcio=1.27.2=py36hf8bcb03_0 -gst-plugins-base=1.14.5=h0935bb2_2 -gstreamer=1.14.5=h36ae1b5_2 -h5py=2.8.0=py36h989c5e5_3 -harfbuzz=2.4.0=h9f30f68_3 -hdf5=1.10.2=hba1933b_1 -icu=64.2=he1b5a44_1 -jasper=1.900.1=h07fcdf6_1006 -jpeg=9c=h14c3975_1001 -keras-applications=1.0.8=py_0 -keras-preprocessing=1.1.0=py_1 -lame=3.100=h14c3975_1001 -ld_impl_linux-64=2.33.1=h53a641e_7 -libblas=3.8.0=14_openblas -libcblas=3.8.0=14_openblas -libclang=9.0.1=default_hde54327_0 -libedit=3.1.20181209=hc058e9b_0 -libffi=3.2.1=hd88cf55_4 -libgcc-ng=9.1.0=hdf63c60_0 -libgfortran-ng=7.3.0=hdf63c60_5 -libiconv=1.15=h516909a_1006 -liblapack=3.8.0=14_openblas -liblapacke=3.8.0=14_openblas -libllvm9=9.0.1=hc9558a2_0 -libopenblas=0.3.7=h5ec1e0e_6 -libpng=1.6.37=hed695b0_1 -libprotobuf=3.11.4=hd408876_0 -libstdcxx-ng=9.1.0=hdf63c60_0 -libtiff=4.1.0=hc3755c2_3 -libuuid=2.32.1=h14c3975_1000 -libwebp=1.0.2=h56121f0_5 -libxcb=1.13=h14c3975_1002 -libxkbcommon=0.10.0=he1b5a44_0 -libxml2=2.9.10=hee79883_0 -lz4-c=1.8.3=he1b5a44_1001 -markdown=3.1.1=py36_0 -ncurses=6.2=he6710b0_0 -nettle=3.4.1=h1bed415_1002 -nspr=4.25=he1b5a44_0 -nss=3.47=he751ad9_0 -numpy=1.18.1=py36h7314795_1 -opencv=3.4.1=py36h6fd60c2_1 -openh264=1.8.0=hdbcaa40_1000 -openssl=1.1.1e=h7b6447c_0 -pcre=8.44=he1b5a44_0 -pip=20.0.2=py36_1 -pixman=0.38.0=h516909a_1003 -protobuf=3.11.4=py36he6710b0_0 -pthread-stubs=0.4=h14c3975_1001 -python=3.6.10=h0371630_0 -python_abi=3.6=1_cp36m -qt=5.12.5=hd8c4c69_1 -readline=7.0=h7b6447c_5 -scipy=1.4.1=py36habc2bb6_0 -setuptools=46.0.0=py36_0 -six=1.14.0=py36_0 -sqlite=3.31.1=h7b6447c_0 -tensorboard=1.14.0=py36hf484d3e_0 -tensorflow=1.14.0=gpu_py36h3fb9ad6_0 -tensorflow-base=1.14.0=gpu_py36he45bfe2_0 -tensorflow-estimator=1.14.0=py_0 -tensorflow-gpu=1.14.0=h0d30ee6_0 -termcolor=1.1.0=py36_1 -tk=8.6.8=hbc83047_0 -werkzeug=1.0.0=py_0 -wheel=0.34.2=py36_0 -wrapt=1.12.1=py36h7b6447c_1 -x264=1!152.20180806=h14c3975_0 -xorg-kbproto=1.0.7=h14c3975_1002 -xorg-libice=1.0.10=h516909a_0 -xorg-libsm=1.2.3=h84519dc_1000 -xorg-libx11=1.6.9=h516909a_0 -xorg-libxau=1.0.9=h14c3975_0 -xorg-libxdmcp=1.1.3=h516909a_0 -xorg-libxext=1.3.4=h516909a_0 -xorg-libxrender=0.9.10=h516909a_1002 -xorg-renderproto=0.11.1=h14c3975_1002 -xorg-xextproto=7.3.0=h14c3975_1002 -xorg-xproto=7.0.31=h14c3975_1007 -xz=5.2.4=h14c3975_4 -zlib=1.2.11=h7b6447c_3 -zstd=1.4.4=h3b9ef0a_2 -yacs=0.1.6 diff --git a/requirements-conda.yml b/requirements-conda.yml deleted file mode 100644 index a4f18725..00000000 --- a/requirements-conda.yml +++ /dev/null @@ -1,128 +0,0 @@ -name: pyslam -channels: - - anaconda - - conda-forge - - defaults -dependencies: - - _libgcc_mutex=0.1=main - - _tflow_select=2.1.0=gpu - - absl-py=0.9.0=py36_0 - - astor=0.8.0=py36_0 - - blas=1.0=openblas - - bzip2=1.0.8=h516909a_2 - - c-ares=1.15.0=h7b6447c_1001 - - ca-certificates=2020.1.1=0 - - cairo=1.16.0=hcf35c78_1003 - - certifi=2020.4.5.1=py36_0 - - cudatoolkit=10.1.243=h6bb024c_0 - - cudnn=7.6.5=cuda10.1_0 - - cupti=10.1.168=0 - - cycler=0.10.0=py36_0 - - dbus=1.13.6=he372182_0 - - decorator=4.4.2=py_0 - - expat=2.2.9=he1b5a44_2 - - ffmpeg=4.1.3=h167e202_0 - - fontconfig=2.13.1=h86ecdb6_1001 - - freetype=2.10.1=he06d7ca_0 - - gast=0.3.3=py_0 - - gettext=0.19.8.1=hc5be6a0_1002 - - giflib=5.2.1=h516909a_2 - - glib=2.58.3=py36hd3ed26a_1003 - - gmp=6.2.0=he1b5a44_2 - - gnutls=3.6.5=hd3a4fd2_1002 - - google-pasta=0.1.8=py_0 - - graphite2=1.3.13=he1b5a44_1001 - - grpcio=1.27.2=py36hf8bcb03_0 - - gst-plugins-base=1.14.5=h0935bb2_2 - - gstreamer=1.14.5=h36ae1b5_2 - - h5py=2.8.0=py36h989c5e5_3 - - harfbuzz=2.4.0=h9f30f68_3 - - hdf5=1.10.2=hba1933b_1 - - icu=64.2=he1b5a44_1 - - imageio=2.8.0=py_0 - - jasper=1.900.1=h07fcdf6_1006 - - jpeg=9c=h14c3975_1001 - - keras-applications=1.0.8=py_0 - - keras-preprocessing=1.1.0=py_1 - - kiwisolver=1.2.0=py36hfd86e86_0 - - lame=3.100=h14c3975_1001 - - ld_impl_linux-64=2.33.1=h53a641e_7 - - libblas=3.8.0=14_openblas - - libcblas=3.8.0=14_openblas - - libclang=9.0.1=default_hde54327_0 - - libedit=3.1.20181209=hc058e9b_0 - - libffi=3.2.1=hd88cf55_4 - - libgcc-ng=9.1.0=hdf63c60_0 - - libgfortran-ng=7.3.0=hdf63c60_5 - - libiconv=1.15=h516909a_1006 - - liblapack=3.8.0=14_openblas - - liblapacke=3.8.0=14_openblas - - libllvm9=9.0.1=hc9558a2_0 - - libopenblas=0.3.7=h5ec1e0e_6 - - libpng=1.6.37=hed695b0_1 - - libprotobuf=3.11.4=hd408876_0 - - libstdcxx-ng=9.1.0=hdf63c60_0 - - libtiff=4.1.0=hc3755c2_3 - - libuuid=2.32.1=h14c3975_1000 - - libwebp=1.0.2=h56121f0_5 - - libxcb=1.13=h14c3975_1002 - - libxkbcommon=0.10.0=he1b5a44_0 - - libxml2=2.9.10=hee79883_0 - - lz4-c=1.8.3=he1b5a44_1001 - - markdown=3.1.1=py36_0 - - ncurses=6.2=he6710b0_0 - - nettle=3.4.1=h1bed415_1002 - - networkx=2.4=py_0 - - nspr=4.25=he1b5a44_0 - - nss=3.47=he751ad9_0 - - numpy=1.18.1=py36h7314795_1 - - olefile=0.46=py36_0 - - openblas=0.3.7=he1df0ab_6 - - opencv=3.4.1=py36h6fd60c2_1 - - openh264=1.8.0=hdbcaa40_1000 - - openssl=1.1.1g=h7b6447c_0 - - pcre=8.44=he1b5a44_0 - - pillow=7.1.2=py36hb39fc2d_0 - - pip=20.0.2=py36_1 - - pixman=0.38.0=h516909a_1003 - - protobuf=3.11.4=py36he6710b0_0 - - pthread-stubs=0.4=h14c3975_1001 - - pyparsing=2.4.7=py_0 - - python=3.6.10=h0371630_0 - - python_abi=3.6=1_cp36m - - pyyaml=5.3.1=py36h8c4c3a4_0 - - qt=5.12.5=hd8c4c69_1 - - readline=7.0=h7b6447c_5 - - scipy=1.4.1=py36habc2bb6_0 - - setuptools=46.0.0=py36_0 - - six=1.14.0=py36_0 - - sqlite=3.31.1=h7b6447c_0 - - tensorboard=1.14.0=py36hf484d3e_0 - - tensorflow=1.14.0=gpu_py36h3fb9ad6_0 - - tensorflow-base=1.14.0=gpu_py36he45bfe2_0 - - tensorflow-estimator=1.14.0=py_0 - - tensorflow-gpu=1.14.0=h0d30ee6_0 - - termcolor=1.1.0=py36_1 - - tk=8.6.8=hbc83047_0 - - werkzeug=1.0.0=py_0 - - wheel=0.34.2=py36_0 - - wrapt=1.12.1=py36h7b6447c_1 - - x264=1!152.20180806=h14c3975_0 - - xorg-kbproto=1.0.7=h14c3975_1002 - - xorg-libice=1.0.10=h516909a_0 - - xorg-libsm=1.2.3=h84519dc_1000 - - xorg-libx11=1.6.9=h516909a_0 - - xorg-libxau=1.0.9=h14c3975_0 - - xorg-libxdmcp=1.1.3=h516909a_0 - - xorg-libxext=1.3.4=h516909a_0 - - xorg-libxrender=0.9.10=h516909a_1002 - - xorg-renderproto=0.11.1=h14c3975_1002 - - xorg-xextproto=7.3.0=h14c3975_1002 - - xorg-xproto=7.0.31=h14c3975_1007 - - xz=5.2.4=h14c3975_4 - - yacs=0.1.6=py_0 - - yaml=0.2.5=h516909a_0 - - zlib=1.2.11=h7b6447c_3 - - zstd=1.4.4=h3b9ef0a_2 -prefix: /home/luigi/anaconda3/envs/pyslam - diff --git a/requirements-mac-pip3.txt b/requirements-mac-pip3.txt deleted file mode 100644 index b99cc505..00000000 --- a/requirements-mac-pip3.txt +++ /dev/null @@ -1,93 +0,0 @@ -absl-py==1.4.0 -astor==0.8.1 -astunparse==1.6.3 -cachetools==5.4.0 -certifi==2024.7.4 -cffi==1.16.0 -charset-normalizer==3.3.2 -contourpy==1.1.1 -cryptography==43.0.0 -cycler==0.10.0 -Cython==3.0.10 -decorator==4.4.2 -filelock==3.15.4 -flatbuffers==24.3.25 -fonttools==4.53.1 -fsspec==2024.6.1 -gast==0.3.3 -google-auth==2.32.0 -google-auth-oauthlib==1.0.0 -google-pasta==0.2.0 -grpcio==1.56.2 -h5py==3.11.0 -idna==3.7 -imageio==2.34.2 -importlib_metadata==8.0.0 -importlib_resources==6.4.0 -Jinja2==3.1.4 -joblib==1.4.2 -keras==2.13.1 -Keras-Applications==1.0.8 -Keras-Preprocessing==1.1.2 -kiwisolver==1.0.1 -kornia==0.7.3 -kornia-moons==0.2.9 -kornia_rs==0.1.5 -lazy_loader==0.4 -libclang==18.1.1 -Markdown==3.1.1 -MarkupSafe==2.1.5 -matplotlib==3.7.5 -mpmath==1.3.0 -networkx==3.1 -numpy==1.23.5 -oauthlib==3.2.2 -#opencv-contrib-python==4.10.0.84 -#opencv-python==4.10.0.84 -opt-einsum==3.3.0 -ordered-set==4.1.0 -packaging==24.1 -pandas==2.0.3 -pillow==10.4.0 -protobuf==3.20.3 -psutil==5.5.1 -pyasn1==0.6.0 -pyasn1_modules==0.4.0 -pybind11==2.13.1 -pycparser==2.22 -pygame==2.6.0 -PyOpenGL==3.1.7 -pyOpenSSL==19.0.0 -pyparsing==2.4.6 -python-dateutil==2.8.2 -pytz==2024.1 -PyWavelets==1.4.1 -PyYAML==6.0.1 -requests==2.32.3 -requests-oauthlib==2.0.0 -rsa==4.9 -scikit-image==0.21.0 -scikit-learn==1.3.2 -scipy==1.10.1 -seaborn==0.13.2 -six==1.14.0 -sklearn-pandas==1.8.0 -sympy==1.13.1 -tensorboard==2.13.0 -tensorboard-data-server==0.7.2 -tensorflow==2.13.0 -tensorflow-estimator==2.13.0 -tensorflow-macos==2.13.0 -termcolor==2.4.0 -tf-slim==1.1.0 -threadpoolctl==3.5.0 -tifffile==2023.7.10 -torch==2.1.2 -tqdm==4.66.4 -typing_extensions==4.5.0 -tzdata==2024.1 -urllib3==2.2.2 -Werkzeug==2.2.2 -wrapt==1.11.2 -yacs==0.1.8 -zipp==3.19.2 diff --git a/groundtruth/install_evo.sh b/scripts/install_evo.sh similarity index 100% rename from groundtruth/install_evo.sh rename to scripts/install_evo.sh diff --git a/scripts/launch_main_slam.sh b/scripts/launch_main_slam.sh index 4612edfd..1ab5008e 100755 --- a/scripts/launch_main_slam.sh +++ b/scripts/launch_main_slam.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# NOTE: This script is expected to be used under mac. See the file `MAC.md`. +# NOTE: This script is expected to be used under mac. See the file `docs/MAC.md`. SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) ROOT_DIR="$SCRIPT_DIR/.." diff --git a/scripts/launch_main_vo.sh b/scripts/launch_main_vo.sh index 5e192509..5bb8ccc2 100755 --- a/scripts/launch_main_vo.sh +++ b/scripts/launch_main_vo.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# NOTE: This script is expected to be used under mac. See the file `MAC.md`. +# NOTE: This script is expected to be used under mac. See the file `docs/MAC.md`. SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) ROOT_DIR="$SCRIPT_DIR/.." diff --git a/scripts/launch_tmux_slam.sh b/scripts/launch_tmux_slam.sh index a12b2997..65f05d97 100755 --- a/scripts/launch_tmux_slam.sh +++ b/scripts/launch_tmux_slam.sh @@ -1,7 +1,5 @@ #!/usr/bin/env bash -# NOTE: This script is expected to be used under mac. See the file `MAC.md`. - SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) ROOT_DIR="$SCRIPT_DIR/.." ROOT_DIR=$(realpath $ROOT_DIR) diff --git a/opencv_check.py b/scripts/opencv_check.py similarity index 100% rename from opencv_check.py rename to scripts/opencv_check.py diff --git a/camera.py b/slam/camera.py similarity index 100% rename from camera.py rename to slam/camera.py diff --git a/camera_pose.py b/slam/camera_pose.py similarity index 100% rename from camera_pose.py rename to slam/camera_pose.py diff --git a/frame.py b/slam/frame.py similarity index 99% rename from frame.py rename to slam/frame.py index 30274fcb..a6689946 100644 --- a/frame.py +++ b/slam/frame.py @@ -29,7 +29,7 @@ from timer import Timer from dataset import SensorType -from parameters import Parameters +from config_parameters import Parameters from camera import Camera, PinholeCamera from camera_pose import CameraPose diff --git a/global_bundle_adjustment.py b/slam/global_bundle_adjustment.py similarity index 99% rename from global_bundle_adjustment.py rename to slam/global_bundle_adjustment.py index 8dc25924..9c8fc7a8 100644 --- a/global_bundle_adjustment.py +++ b/slam/global_bundle_adjustment.py @@ -30,7 +30,7 @@ from enum import Enum import traceback -from parameters import Parameters +from config_parameters import Parameters from map import Map from timer import TimerFps @@ -58,7 +58,7 @@ kScriptPath = os.path.realpath(__file__) kScriptFolder = os.path.dirname(kScriptPath) kRootFolder = kScriptFolder -kLogsFolder = kRootFolder + '/logs' +kLogsFolder = kRootFolder + '/../logs' if kVerbose: diff --git a/initializer.py b/slam/initializer.py similarity index 99% rename from initializer.py rename to slam/initializer.py index f7f7ab5b..54490c96 100644 --- a/initializer.py +++ b/slam/initializer.py @@ -33,7 +33,7 @@ from camera import Camera, PinholeCamera from utils_sys import Printer from utils_features import ImageGrid -from parameters import Parameters +from config_parameters import Parameters from dataset import SensorType from rotation_histogram import filter_matches_with_histogram_orientation diff --git a/keyframe.py b/slam/keyframe.py similarity index 99% rename from keyframe.py rename to slam/keyframe.py index a48895dc..0691a635 100644 --- a/keyframe.py +++ b/slam/keyframe.py @@ -27,7 +27,7 @@ from threading import RLock -from parameters import Parameters +from config_parameters import Parameters from utils_sys import Printer from collections import defaultdict, OrderedDict, Counter diff --git a/keyframe_data.py b/slam/keyframe_data.py similarity index 100% rename from keyframe_data.py rename to slam/keyframe_data.py diff --git a/local_mapping.py b/slam/local_mapping.py similarity index 99% rename from local_mapping.py rename to slam/local_mapping.py index 12328a0d..279e84ee 100644 --- a/local_mapping.py +++ b/slam/local_mapping.py @@ -30,7 +30,7 @@ from threading import RLock, Thread, Condition from queue import Queue -from parameters import Parameters +from config_parameters import Parameters from dataset import SensorType from frame import compute_frame_matches @@ -68,7 +68,7 @@ kScriptPath = os.path.realpath(__file__) kScriptFolder = os.path.dirname(kScriptPath) kRootFolder = kScriptFolder -kLogsFolder = kRootFolder + '/logs' +kLogsFolder = kRootFolder + '/../logs' if kVerbose: diff --git a/map.py b/slam/map.py similarity index 99% rename from map.py rename to slam/map.py index b1481382..75ea14e9 100644 --- a/map.py +++ b/slam/map.py @@ -31,7 +31,7 @@ from threading import RLock, Thread from utils_geom import poseRt, add_ones, add_ones_1D -from parameters import Parameters +from config_parameters import Parameters from frame import Frame, FrameShared, FrameBase from keyframe import KeyFrame from map_point import MapPoint, MapPointBase diff --git a/map_point.py b/slam/map_point.py similarity index 99% rename from map_point.py rename to slam/map_point.py index dfcf4cef..0f9a540f 100644 --- a/map_point.py +++ b/slam/map_point.py @@ -26,7 +26,7 @@ from frame import Frame, FrameShared from utils_sys import Printer -from parameters import Parameters +from config_parameters import Parameters class MapPointBase(object): diff --git a/motion_model.py b/slam/motion_model.py similarity index 100% rename from motion_model.py rename to slam/motion_model.py diff --git a/optimizer_g2o.py b/slam/optimizer_g2o.py similarity index 100% rename from optimizer_g2o.py rename to slam/optimizer_g2o.py diff --git a/relocalizer.py b/slam/relocalizer.py similarity index 99% rename from relocalizer.py rename to slam/relocalizer.py index 89064774..175efa6b 100644 --- a/relocalizer.py +++ b/slam/relocalizer.py @@ -11,7 +11,7 @@ from search_points import search_frame_by_projection from timer import TimerFps -from parameters import Parameters +from config_parameters import Parameters import logging @@ -26,7 +26,7 @@ kScriptPath = os.path.realpath(__file__) kScriptFolder = os.path.dirname(kScriptPath) kRootFolder = kScriptFolder -kLogsFolder = kRootFolder + '/logs' +kLogsFolder = kRootFolder + '/../logs' if kVerbose: if Parameters.kRelocalizationDebugAndPrintToFile: diff --git a/search_points.py b/slam/search_points.py similarity index 99% rename from search_points.py rename to slam/search_points.py index f01cc6d3..e4f020c7 100644 --- a/search_points.py +++ b/slam/search_points.py @@ -29,7 +29,7 @@ from utils_geom import skew, add_ones, normalize_vector, computeF12, check_dist_epipolar_line, Sim3Pose from utils_draw import draw_lines, draw_points from utils_sys import Printer, getchar -from parameters import Parameters +from config_parameters import Parameters from timer import Timer from rotation_histogram import RotationHistogram diff --git a/search_points_test.py b/slam/search_points_test.py similarity index 99% rename from search_points_test.py rename to slam/search_points_test.py index 65b1749a..c7f76889 100644 --- a/search_points_test.py +++ b/slam/search_points_test.py @@ -26,7 +26,7 @@ from utils_geom import skew, add_ones, normalize_vector, computeF12, check_dist_epipolar_line from utils_draw import draw_lines, draw_points from utils_sys import Printer, getchar -from parameters import Parameters +from config_parameters import Parameters from timer import Timer diff --git a/slam.py b/slam/slam.py similarity index 99% rename from slam.py rename to slam/slam.py index 435abe41..9a8f44d8 100755 --- a/slam.py +++ b/slam/slam.py @@ -25,7 +25,7 @@ #import json import ujson as json -from parameters import Parameters +from config_parameters import Parameters from frame import Frame, FrameShared, match_frames from keyframe import KeyFrame diff --git a/slam_commons.py b/slam/slam_commons.py similarity index 100% rename from slam_commons.py rename to slam/slam_commons.py diff --git a/slam_dynamic_config.py b/slam/slam_dynamic_config.py similarity index 98% rename from slam_dynamic_config.py rename to slam/slam_dynamic_config.py index d8f3c980..cefed40d 100644 --- a/slam_dynamic_config.py +++ b/slam/slam_dynamic_config.py @@ -4,7 +4,7 @@ from utils_features import descriptor_sigma_mad from utils_sys import Printer -from parameters import Parameters +from config_parameters import Parameters from frame import FrameShared # experimental diff --git a/tracking.py b/slam/tracking.py similarity index 99% rename from tracking.py rename to slam/tracking.py index 04605940..5faab57c 100644 --- a/tracking.py +++ b/slam/tracking.py @@ -31,7 +31,7 @@ import cv2 import g2o -from parameters import Parameters +from config_parameters import Parameters from frame import Frame, FrameShared, match_frames from keyframe import KeyFrame @@ -102,7 +102,7 @@ kScriptPath = os.path.realpath(__file__) kScriptFolder = os.path.dirname(kScriptPath) kRootFolder = kScriptFolder -kLogsFolder = kRootFolder + '/logs' +kLogsFolder = kRootFolder + '/../logs' if not kVerbose: diff --git a/visual_odometry.py b/slam/visual_odometry.py similarity index 100% rename from visual_odometry.py rename to slam/visual_odometry.py diff --git a/test/cv/test_img_blocks.py b/test/cv/test_img_blocks.py index 11ed89c6..558651e1 100644 --- a/test/cv/test_img_blocks.py +++ b/test/cv/test_img_blocks.py @@ -1,5 +1,6 @@ import sys sys.path.append("../../") +from config import Config import cv2 import numpy as np diff --git a/test/cv/test_img_pyramid.py b/test/cv/test_img_pyramid.py index be8a4a54..9d48b74f 100644 --- a/test/cv/test_img_pyramid.py +++ b/test/cv/test_img_pyramid.py @@ -1,5 +1,6 @@ import sys sys.path.append("../../") +from config import Config import time import cv2 diff --git a/test/cv/test_img_pyramid_generator.py b/test/cv/test_img_pyramid_generator.py index cac2fba7..93a521db 100644 --- a/test/cv/test_img_pyramid_generator.py +++ b/test/cv/test_img_pyramid_generator.py @@ -1,5 +1,6 @@ import sys sys.path.append("../../") +from config import Config import time import cv2 diff --git a/test/cv/test_search_for_triangulation.py b/test/cv/test_search_for_triangulation.py index fd433257..8916e06f 100644 --- a/test/cv/test_search_for_triangulation.py +++ b/test/cv/test_search_for_triangulation.py @@ -5,7 +5,6 @@ from matplotlib import pyplot as plt sys.path.append("../../") - from config import Config from mplot_figure import MPlotFigure @@ -28,7 +27,7 @@ from dataset import dataset_factory from timer import Timer -from parameters import Parameters +from config_parameters import Parameters from feature_tracker_configs import FeatureTrackerConfigs diff --git a/test/depth_estimation/test_crestereo_pytorch.py b/test/depth_estimation/test_crestereo_pytorch.py index b9cbac14..1e4a632d 100644 --- a/test/depth_estimation/test_crestereo_pytorch.py +++ b/test/depth_estimation/test_crestereo_pytorch.py @@ -1,6 +1,5 @@ import sys sys.path.append("../../") - from config import Config import numpy as np diff --git a/test/depth_estimation/test_dataset_depth_anything_v2.py b/test/depth_estimation/test_dataset_depth_anything_v2.py index 885cf721..a7aa117f 100644 --- a/test/depth_estimation/test_dataset_depth_anything_v2.py +++ b/test/depth_estimation/test_dataset_depth_anything_v2.py @@ -1,7 +1,6 @@ import os import sys sys.path.append("../../") - from config import Config config = Config() config.set_lib('depth_anything_v2') @@ -17,7 +16,7 @@ from feature_tracker import feature_tracker_factory, FeatureTrackerTypes from feature_tracker_configs import FeatureTrackerConfigs -from parameters import Parameters +from config_parameters import Parameters from utils_depth import depth2pointcloud, img_from_depth, filter_shadow_points, PointCloud diff --git a/test/depth_estimation/test_dataset_depth_pro.py b/test/depth_estimation/test_dataset_depth_pro.py index ee4949e9..9b1e0966 100644 --- a/test/depth_estimation/test_dataset_depth_pro.py +++ b/test/depth_estimation/test_dataset_depth_pro.py @@ -19,7 +19,7 @@ from feature_tracker import feature_tracker_factory, FeatureTrackerTypes from feature_tracker_configs import FeatureTrackerConfigs -from parameters import Parameters +from config_parameters import Parameters import torch import depth_pro diff --git a/test/geom/test_align_trajs.py b/test/geom/test_align_trajs.py index 699ea033..500cbd05 100644 --- a/test/geom/test_align_trajs.py +++ b/test/geom/test_align_trajs.py @@ -8,6 +8,7 @@ from mpl_toolkits import mplot3d sys.path.append("../../") +from config import Config from utils_geom import align_trajs_with_svd, yaw_matrix, roll_matrix, pitch_matrix, poseRt diff --git a/test/geom/test_quaternion.py b/test/geom/test_quaternion.py index 045ce3f5..37a8c6bf 100644 --- a/test/geom/test_quaternion.py +++ b/test/geom/test_quaternion.py @@ -2,11 +2,10 @@ import sys sys.path.append("../../") +from config import Config from utils_geom import qvec2rotmat, rotmat2qvec - - if __name__ == "__main__": # Test quaternion qvec = [0.1, 0.2, 0.3, 0.9] diff --git a/test/loopclosing/test_loop_detecting_process.py b/test/loopclosing/test_loop_detecting_process.py index 0fca6d2b..9533491d 100644 --- a/test/loopclosing/test_loop_detecting_process.py +++ b/test/loopclosing/test_loop_detecting_process.py @@ -19,7 +19,7 @@ from feature_tracker import feature_tracker_factory, FeatureTrackerTypes from feature_tracker_configs import FeatureTrackerConfigs -from parameters import Parameters +from config_parameters import Parameters Parameters.kLoopClosingDebugAndPrintToFile = False Parameters.kLoopClosingDebugWithSimmetryMatrix = True Parameters.kLoopClosingDebugWithLoopDetectionImages = True diff --git a/test/loopclosing/test_loop_detector.py b/test/loopclosing/test_loop_detector.py index 6d62b3c3..784659a5 100644 --- a/test/loopclosing/test_loop_detector.py +++ b/test/loopclosing/test_loop_detector.py @@ -18,7 +18,7 @@ from feature_tracker import feature_tracker_factory, FeatureTrackerTypes from feature_tracker_configs import FeatureTrackerConfigs -from parameters import Parameters +from config_parameters import Parameters Parameters.kLoopClosingDebugAndPrintToFile = False Parameters.kLoopClosingDebugWithSimmetryMatrix = True Parameters.kLoopClosingDebugWithLoopDetectionImages = True diff --git a/test/loopclosing/test_pydbow3.py b/test/loopclosing/test_pydbow3.py index a1dbe9b6..891df004 100644 --- a/test/loopclosing/test_pydbow3.py +++ b/test/loopclosing/test_pydbow3.py @@ -13,7 +13,7 @@ import cv2 import numpy as np -from parameters import Parameters +from config_parameters import Parameters from dataset import dataset_factory from feature_tracker import feature_tracker_factory, FeatureTrackerTypes from feature_tracker_configs import FeatureTrackerConfigs diff --git a/test/matplotlib/test_mplot_thread.py b/test/matplotlib/test_mplot_thread.py index 041ac76a..b04db8f1 100644 --- a/test/matplotlib/test_mplot_thread.py +++ b/test/matplotlib/test_mplot_thread.py @@ -22,6 +22,7 @@ import math import time sys.path.append("../../") +from config import Config import torch.multiprocessing as mp diff --git a/test/matplotlib/test_plot3d.py b/test/matplotlib/test_plot3d.py index 73ebda0b..106a2aeb 100644 --- a/test/matplotlib/test_plot3d.py +++ b/test/matplotlib/test_plot3d.py @@ -21,7 +21,9 @@ import numpy as np import math import time + sys.path.append("../../") +from config import Config import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D diff --git a/test/multiprocessing/test_logger_queue.py b/test/multiprocessing/test_logger_queue.py index a5edf883..76a98725 100644 --- a/test/multiprocessing/test_logger_queue.py +++ b/test/multiprocessing/test_logger_queue.py @@ -3,6 +3,7 @@ import sys sys.path.append("../../") +from config import Config from utils_sys import LoggerQueue diff --git a/test/multiprocessing/test_logger_queue2.py b/test/multiprocessing/test_logger_queue2.py index 1b00d2b6..29f2b2e9 100644 --- a/test/multiprocessing/test_logger_queue2.py +++ b/test/multiprocessing/test_logger_queue2.py @@ -3,6 +3,7 @@ import sys sys.path.append("../../") +from config import Config from utils_sys import LoggerQueue diff --git a/test/open3d/test_volume_integration.py b/test/open3d/test_volume_integration.py index b0975989..6638d256 100644 --- a/test/open3d/test_volume_integration.py +++ b/test/open3d/test_volume_integration.py @@ -49,7 +49,7 @@ from loop_detector_configs import LoopDetectorConfigs -from parameters import Parameters +from config_parameters import Parameters from rerun_interface import Rerun diff --git a/test/open3d/test_volume_integration_with_viewer3d.py b/test/open3d/test_volume_integration_with_viewer3d.py index 953cab87..97d202f9 100644 --- a/test/open3d/test_volume_integration_with_viewer3d.py +++ b/test/open3d/test_volume_integration_with_viewer3d.py @@ -28,7 +28,6 @@ import sys sys.path.append("../../") - from config import Config from slam import Slam, SlamState @@ -49,7 +48,7 @@ from loop_detector_configs import LoopDetectorConfigs -from parameters import Parameters +from config_parameters import Parameters from rerun_interface import Rerun diff --git a/test/pyqtgraph/test_qtplot_thread.py b/test/pyqtgraph/test_qtplot_thread.py index d152ee3a..9c559132 100644 --- a/test/pyqtgraph/test_qtplot_thread.py +++ b/test/pyqtgraph/test_qtplot_thread.py @@ -6,7 +6,7 @@ import sys sys.path.append("../../") -from qtplot_thread import Qplot2d, Qplot3d +from qplot_thread import Qplot2d, Qplot3d if __name__ == "__main__": diff --git a/moving_average.py b/utilities/moving_average.py similarity index 100% rename from moving_average.py rename to utilities/moving_average.py diff --git a/pyramid.py b/utilities/pyramid.py similarity index 100% rename from pyramid.py rename to utilities/pyramid.py diff --git a/rotation_histogram.py b/utilities/rotation_histogram.py similarity index 100% rename from rotation_histogram.py rename to utilities/rotation_histogram.py diff --git a/timer.py b/utilities/timer.py similarity index 100% rename from timer.py rename to utilities/timer.py diff --git a/utils_data.py b/utilities/utils_data.py similarity index 86% rename from utils_data.py rename to utilities/utils_data.py index af0392e3..fa1ed26d 100644 --- a/utils_data.py +++ b/utilities/utils_data.py @@ -1,3 +1,22 @@ +""" +* This file is part of PYSLAM +* +* Copyright (C) 2016-present Luigi Freda +* +* PYSLAM is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* PYSLAM is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with PYSLAM. If not, see . +""" + import torch.multiprocessing as mp import threading as th diff --git a/utils_depth.py b/utilities/utils_depth.py similarity index 82% rename from utils_depth.py rename to utilities/utils_depth.py index dffa005d..8b18e74c 100644 --- a/utils_depth.py +++ b/utilities/utils_depth.py @@ -1,3 +1,22 @@ +""" +* This file is part of PYSLAM +* +* Copyright (C) 2016-present Luigi Freda +* +* PYSLAM is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* PYSLAM is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with PYSLAM. If not, see . +""" + import numpy as np diff --git a/utils_draw.py b/utilities/utils_draw.py similarity index 100% rename from utils_draw.py rename to utilities/utils_draw.py diff --git a/utils_features.py b/utilities/utils_features.py similarity index 99% rename from utils_features.py rename to utilities/utils_features.py index 9a647b1f..02bdbd44 100644 --- a/utils_features.py +++ b/utilities/utils_features.py @@ -39,7 +39,7 @@ kPySlamUtilsAvailable = False Printer.orange('WARNING: cannot import pyslam_utils') -from parameters import Parameters +from config_parameters import Parameters diff --git a/utils_files.py b/utilities/utils_files.py similarity index 100% rename from utils_files.py rename to utilities/utils_files.py diff --git a/utils_geom.py b/utilities/utils_geom.py similarity index 100% rename from utils_geom.py rename to utilities/utils_geom.py diff --git a/utils_img.py b/utilities/utils_img.py similarity index 100% rename from utils_img.py rename to utilities/utils_img.py diff --git a/utils_mp.py b/utilities/utils_mp.py similarity index 100% rename from utils_mp.py rename to utilities/utils_mp.py diff --git a/utils_serialization.py b/utilities/utils_serialization.py similarity index 94% rename from utils_serialization.py rename to utilities/utils_serialization.py index fc95d85e..91208374 100644 --- a/utils_serialization.py +++ b/utilities/utils_serialization.py @@ -1,3 +1,21 @@ +""" +* This file is part of PYSLAM +* +* Copyright (C) 2016-present Luigi Freda +* +* PYSLAM is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* PYSLAM is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with PYSLAM. If not, see . +""" import sys import numpy as np diff --git a/utils_sys.py b/utilities/utils_sys.py similarity index 99% rename from utils_sys.py rename to utilities/utils_sys.py index 4cafd31e..7b04d49f 100644 --- a/utils_sys.py +++ b/utilities/utils_sys.py @@ -353,7 +353,7 @@ def import_from(module, name, method=None): except: if method is not None: name = name + '.' + method - Printer.orange('WARNING: cannot import ' + name + ' from ' + module + ', check the file TROUBLESHOOTING.md') + Printer.orange('WARNING: cannot import ' + name + ' from ' + module + ', check the file docs/TROUBLESHOOTING.md') return None diff --git a/utils_tf.py b/utilities/utils_tf.py similarity index 100% rename from utils_tf.py rename to utilities/utils_tf.py diff --git a/utils_torch.py b/utilities/utils_torch.py similarity index 100% rename from utils_torch.py rename to utilities/utils_torch.py diff --git a/video.py b/utilities/video.py similarity index 100% rename from video.py rename to utilities/video.py diff --git a/display2D.py b/viz/display2D.py similarity index 100% rename from display2D.py rename to viz/display2D.py diff --git a/mplot2d.py b/viz/mplot2d.py similarity index 100% rename from mplot2d.py rename to viz/mplot2d.py diff --git a/mplot3d.py b/viz/mplot3d.py similarity index 100% rename from mplot3d.py rename to viz/mplot3d.py diff --git a/mplot_figure.py b/viz/mplot_figure.py similarity index 100% rename from mplot_figure.py rename to viz/mplot_figure.py diff --git a/mplot_thread.py b/viz/mplot_thread.py similarity index 99% rename from mplot_thread.py rename to viz/mplot_thread.py index 2e5ae79e..bd7c0a5d 100644 --- a/mplot_thread.py +++ b/viz/mplot_thread.py @@ -50,7 +50,7 @@ kScriptPath = os.path.realpath(__file__) kScriptFolder = os.path.dirname(kScriptPath) kRootFolder = kScriptFolder -kLogsFolder = kRootFolder + '/logs' +kLogsFolder = kRootFolder + '/../logs' if kVerbose and kDebugAndPrintToFile: diff --git a/qimage_thread.py b/viz/qimage_thread.py similarity index 100% rename from qimage_thread.py rename to viz/qimage_thread.py diff --git a/qtplot_thread.py b/viz/qplot_thread.py similarity index 99% rename from qtplot_thread.py rename to viz/qplot_thread.py index f5e36f9b..3851bee3 100644 --- a/qtplot_thread.py +++ b/viz/qplot_thread.py @@ -30,9 +30,9 @@ import os import logging - import sys -sys.path.append("../../") +sys.path.append("../") +from config import Config #import multiprocessing as mp import torch.multiprocessing as mp @@ -46,7 +46,7 @@ kScriptPath = os.path.realpath(__file__) kScriptFolder = os.path.dirname(kScriptPath) kRootFolder = kScriptFolder -kLogsFolder = kRootFolder + '/logs' +kLogsFolder = kRootFolder + '/../logs' if kVerbose and kDebugAndPrintToFile: diff --git a/rerun_interface.py b/viz/rerun_interface.py similarity index 100% rename from rerun_interface.py rename to viz/rerun_interface.py diff --git a/slam_plot_drawer.py b/viz/slam_plot_drawer.py similarity index 99% rename from slam_plot_drawer.py rename to viz/slam_plot_drawer.py index 7a264a73..68f3b42a 100644 --- a/slam_plot_drawer.py +++ b/viz/slam_plot_drawer.py @@ -29,12 +29,12 @@ from viewer3D import Viewer3D from dataset import SensorType from mplot_thread import Mplot2d -from qtplot_thread import Qplot2d +from qplot_thread import Qplot2d import matplotlib.colors as mcolors from utils_geom import AlignmentEstimatedAndGroundTruthData, Sim3Pose -kUseQtplot2d = False +kUseQtplot2d = True if platform.system() == 'Darwin': kUseQtplot2d = True # Under mac force the usage of Qtplot2d: It is smoother diff --git a/viewer3D.py b/viz/viewer3D.py similarity index 100% rename from viewer3D.py rename to viz/viewer3D.py