diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 82c447d..b83e279 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -28,4 +28,4 @@ pip_package: stage: build script: - VERBOSE=1 pip install --verbose . - - mapmos_pipeline --help \ No newline at end of file + - mapmos_pipeline --help diff --git a/README.md b/README.md index 9454352..ef059e3 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@
Click here for qualitative results! - + [![MapMOS](https://github.com/PRBonn/MapMOS/assets/38326482/a4238431-bd2d-4b2c-991b-7ff5e9378a8e)](https://github.com/PRBonn/MapMOS/assets/38326482/04c7e5a2-dd44-431a-95b0-c42d5605078a) Our predictions for the KITTI Tracking sequence 19 with true positives (green), false positives (red), and false negatives (blue). @@ -54,7 +54,7 @@ Just type ```bash mapmos_pipeline --help ``` -to see how to run MapMOS. +to see how to run MapMOS.
This is what you should see @@ -62,7 +62,7 @@ to see how to run MapMOS.
-Check the [Download](#downloads) section for a pre-trained model. Like [KISS-ICP](https://github.com/PRBonn/kiss-icp), our pipeline runs on a variety of point cloud data formats like `bin`, `pcd`, `ply`, `xyz`, `rosbags`, and more. To visualize these, just type +Check the [Download](#downloads) section for a pre-trained model. Like [KISS-ICP](https://github.com/PRBonn/kiss-icp), our pipeline runs on a variety of point cloud data formats like `bin`, `pcd`, `ply`, `xyz`, `rosbags`, and more. To visualize these, just type ```bash mapmos_pipeline --visualize /path/to/weights.ckpt /path/to/data @@ -122,7 +122,7 @@ by replacing the paths and the config file names. To evaluate for example on the mapmos_pipeline /path/to/weights.ckpt /path/to/HeLiMOS --dataloader helimos -s Velodyne/test.txt ``` -Note that our sequence `-s` encodes both the sensor type `Velodyne` and split `test.txt`, just replace these with `Ouster`, `Aeva`, or `Avia` and/or `train.txt` or `val.txt` to run MapMOS on different sensors and/or splits. +Note that our sequence `-s` encodes both the sensor type `Velodyne` and split `test.txt`, just replace these with `Ouster`, `Aeva`, or `Avia` and/or `train.txt` or `val.txt` to run MapMOS on different sensors and/or splits. ## Downloads You can download the post-processed and labeled [Apollo dataset](https://www.ipb.uni-bonn.de/html/projects/apollo_dataset/LiDAR-MOS.zip) and [KITTI Tracking sequence 19](https://www.ipb.uni-bonn.de/html/projects/kitti-tracking/post-processed/kitti-tracking.zip) from our website. diff --git a/config/apollo.yaml b/config/apollo.yaml index 9abcccb..a67b286 100644 --- a/config/apollo.yaml +++ b/config/apollo.yaml @@ -1,5 +1,5 @@ data: - deskew: False + deskew: False mos: max_range_mos: -1.0 # No limit diff --git a/config/kitti-tracking.yaml b/config/kitti-tracking.yaml index e72273c..0afdfa2 100644 --- a/config/kitti-tracking.yaml +++ b/config/kitti-tracking.yaml @@ -1,5 +1,5 @@ data: - deskew: True + deskew: True mos: max_range_mos: -1.0 # No limit diff --git a/config/kitti.yaml b/config/kitti.yaml index 9abcccb..a67b286 100644 --- a/config/kitti.yaml +++ b/config/kitti.yaml @@ -1,5 +1,5 @@ data: - deskew: False + deskew: False mos: max_range_mos: -1.0 # No limit diff --git a/scripts/cache_to_ply.py b/scripts/cache_to_ply.py index 7aefa75..d56d09b 100755 --- a/scripts/cache_to_ply.py +++ b/scripts/cache_to_ply.py @@ -21,19 +21,19 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -import os -import typer import importlib +import os +from pathlib import Path +from typing import List, Optional import numpy as np import torch -from typing import List, Optional +import typer from torch.utils.data import DataLoader from tqdm import tqdm -from pathlib import Path -from mapmos.datasets.mapmos_dataset import MapMOSDataset, collate_fn from mapmos.config import load_config +from mapmos.datasets.mapmos_dataset import MapMOSDataset, collate_fn def cache_to_ply( diff --git a/scripts/precache.py b/scripts/precache.py index e5b27fd..25f5a0f 100755 --- a/scripts/precache.py +++ b/scripts/precache.py @@ -21,10 +21,11 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -from tqdm import tqdm from pathlib import Path from typing import List, Optional + import typer +from tqdm import tqdm from mapmos.config import load_config @@ -62,6 +63,7 @@ def precache( ), ): from torch.utils.data import DataLoader + from mapmos.datasets.mapmos_dataset import MapMOSDataset, collate_fn cfg = load_config(config) diff --git a/scripts/train.py b/scripts/train.py index 7733a81..bcf2288 100755 --- a/scripts/train.py +++ b/scripts/train.py @@ -22,18 +22,19 @@ # SOFTWARE. import os +from pathlib import Path +from typing import Optional + import torch import typer -from typing import Optional -from pathlib import Path from pytorch_lightning import Trainer from pytorch_lightning import loggers as pl_loggers from pytorch_lightning.callbacks import LearningRateMonitor, ModelCheckpoint +from mapmos.config import load_config from mapmos.datasets.mapmos_dataset import MapMOSDataModule from mapmos.training_module import TrainingModule from mapmos.utils.seed import set_seed -from mapmos.config import load_config def train( diff --git a/src/mapmos/cli.py b/src/mapmos/cli.py index 9688276..22bcaf9 100644 --- a/src/mapmos/cli.py +++ b/src/mapmos/cli.py @@ -35,6 +35,7 @@ import typer from kiss_icp.tools.cmd import guess_dataloader + from mapmos.datasets import ( available_dataloaders, jumpable_dataloaders, diff --git a/src/mapmos/config/config.py b/src/mapmos/config/config.py index 71e1f42..52f0911 100644 --- a/src/mapmos/config/config.py +++ b/src/mapmos/config/config.py @@ -21,6 +21,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. from typing import List + from pydantic import BaseModel, Field diff --git a/src/mapmos/config/parser.py b/src/mapmos/config/parser.py index 71a56f4..618832b 100644 --- a/src/mapmos/config/parser.py +++ b/src/mapmos/config/parser.py @@ -25,18 +25,12 @@ import importlib import sys - from pathlib import Path from typing import Any, Dict, Optional from pydantic_settings import BaseSettings, SettingsConfigDict -from mapmos.config.config import ( - DataConfig, - OdometryConfig, - MOSConfig, - TrainingConfig, -) +from mapmos.config.config import DataConfig, MOSConfig, OdometryConfig, TrainingConfig class MapMOSConfig(BaseSettings): diff --git a/src/mapmos/datasets/apollo.py b/src/mapmos/datasets/apollo.py index 8d8fc8c..49ed10a 100644 --- a/src/mapmos/datasets/apollo.py +++ b/src/mapmos/datasets/apollo.py @@ -21,6 +21,7 @@ # SOFTWARE. import numpy as np + from mapmos.datasets.kitti import SemanticKITTIDataset diff --git a/src/mapmos/datasets/helimos.py b/src/mapmos/datasets/helimos.py index fe8a8a7..9d4d476 100644 --- a/src/mapmos/datasets/helimos.py +++ b/src/mapmos/datasets/helimos.py @@ -22,6 +22,7 @@ import glob import os + import numpy as np diff --git a/src/mapmos/datasets/kitti.py b/src/mapmos/datasets/kitti.py index c6263b1..9dfcaa9 100644 --- a/src/mapmos/datasets/kitti.py +++ b/src/mapmos/datasets/kitti.py @@ -22,6 +22,7 @@ import glob import os + import numpy as np from kiss_icp.datasets.kitti import KITTIOdometryDataset diff --git a/src/mapmos/datasets/kitti_tracking.py b/src/mapmos/datasets/kitti_tracking.py index a25e932..a7aa4af 100644 --- a/src/mapmos/datasets/kitti_tracking.py +++ b/src/mapmos/datasets/kitti_tracking.py @@ -21,6 +21,7 @@ # SOFTWARE. import numpy as np + from mapmos.datasets.kitti import SemanticKITTIDataset diff --git a/src/mapmos/datasets/mapmos_dataset.py b/src/mapmos/datasets/mapmos_dataset.py index 8696ef9..1e2d518 100644 --- a/src/mapmos/datasets/mapmos_dataset.py +++ b/src/mapmos/datasets/mapmos_dataset.py @@ -21,18 +21,19 @@ # SOFTWARE. import os -import torch -import numpy as np -from typing import Dict from pathlib import Path -from torch.utils.data import Dataset, DataLoader +from typing import Dict + +import numpy as np +import torch from pytorch_lightning import LightningDataModule +from torch.utils.data import DataLoader, Dataset -from mapmos.utils.cache import get_cache, memoize -from mapmos.config import MapMOSConfig, DataConfig, OdometryConfig -from mapmos.odometry import Odometry -from mapmos.mapping import VoxelHashMap +from mapmos.config import DataConfig, MapMOSConfig, OdometryConfig from mapmos.datasets import dataset_factory, sequence_dataloaders +from mapmos.mapping import VoxelHashMap +from mapmos.odometry import Odometry +from mapmos.utils.cache import get_cache, memoize def collate_fn(batch): diff --git a/src/mapmos/datasets/nuscenes.py b/src/mapmos/datasets/nuscenes.py index d62400e..67b2868 100644 --- a/src/mapmos/datasets/nuscenes.py +++ b/src/mapmos/datasets/nuscenes.py @@ -25,9 +25,10 @@ import sys from pathlib import Path from typing import List + +import numpy as np from nuscenes.utils.geometry_utils import transform_matrix from pyquaternion import Quaternion -import numpy as np class NuScenesDataset: diff --git a/src/mapmos/mapmos_net.py b/src/mapmos/mapmos_net.py index 001d569..0f9420b 100644 --- a/src/mapmos/mapmos_net.py +++ b/src/mapmos/mapmos_net.py @@ -20,9 +20,10 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -import torch import copy + import MinkowskiEngine as ME +import torch from pytorch_lightning import LightningModule from mapmos.minkunet import CustomMinkUNet14 diff --git a/src/mapmos/mapping.py b/src/mapmos/mapping.py index beb407e..b92edaf 100644 --- a/src/mapmos/mapping.py +++ b/src/mapmos/mapping.py @@ -21,6 +21,7 @@ # SOFTWARE. import numpy as np + from mapmos.pybind import mapmos_pybind diff --git a/src/mapmos/minkunet.py b/src/mapmos/minkunet.py index 390b3d5..3892a21 100644 --- a/src/mapmos/minkunet.py +++ b/src/mapmos/minkunet.py @@ -22,8 +22,8 @@ # Please cite "4D Spatio-Temporal ConvNets: Minkowski Convolutional Neural # Networks", CVPR'19 (https://arxiv.org/abs/1904.08755) if you use any part # of the code. -import torch.nn as nn import MinkowskiEngine as ME +import torch.nn as nn class BasicBlock(nn.Module): diff --git a/src/mapmos/odometry.py b/src/mapmos/odometry.py index a5ff20e..b9ecbea 100644 --- a/src/mapmos/odometry.py +++ b/src/mapmos/odometry.py @@ -20,14 +20,15 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -import numpy as np -from mapmos.config import DataConfig, OdometryConfig from typing import Type +import numpy as np from kiss_icp.config import KISSConfig from kiss_icp.kiss_icp import KissICP, get_registration -from mapmos.registration import get_registration + +from mapmos.config import DataConfig, OdometryConfig from mapmos.mapping import VoxelHashMap +from mapmos.registration import get_registration def parse_config(config_data: DataConfig, config_odometry: OdometryConfig): diff --git a/src/mapmos/paper_pipeline.py b/src/mapmos/paper_pipeline.py index 8536ef3..76841d2 100644 --- a/src/mapmos/paper_pipeline.py +++ b/src/mapmos/paper_pipeline.py @@ -23,8 +23,9 @@ import time from pathlib import Path from typing import Optional -import torch + import numpy as np +import torch from tqdm.auto import trange from mapmos.mapping import VoxelHashMap diff --git a/src/mapmos/pipeline.py b/src/mapmos/pipeline.py index 009e723..f33a300 100644 --- a/src/mapmos/pipeline.py +++ b/src/mapmos/pipeline.py @@ -22,23 +22,23 @@ import os import time +from collections import deque from pathlib import Path from typing import Optional -from collections import deque -import torch -import numpy as np -from tqdm.auto import trange +import numpy as np +import torch from kiss_icp.pipeline import OdometryPipeline +from tqdm.auto import trange +from mapmos.config import load_config from mapmos.mapmos_net import MapMOSNet -from mapmos.odometry import Odometry from mapmos.mapping import VoxelHashMap from mapmos.metrics import get_confusion_matrix -from mapmos.utils.visualizer import MapMOSVisualizer, StubVisualizer +from mapmos.odometry import Odometry from mapmos.utils.pipeline_results import MOSPipelineResults -from mapmos.utils.save import PlyWriter, KITTIWriter, StubWriter -from mapmos.config import load_config +from mapmos.utils.save import KITTIWriter, PlyWriter, StubWriter +from mapmos.utils.visualizer import MapMOSVisualizer, StubVisualizer class MapMOSPipeline(OdometryPipeline): diff --git a/src/mapmos/registration.py b/src/mapmos/registration.py index 277a53a..d972b99 100644 --- a/src/mapmos/registration.py +++ b/src/mapmos/registration.py @@ -21,8 +21,8 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. import numpy as np - from kiss_icp.config.parser import KISSConfig + from mapmos.mapping import VoxelHashMap from mapmos.pybind import mapmos_pybind diff --git a/src/mapmos/training_module.py b/src/mapmos/training_module.py index 6c29219..9dc3acb 100644 --- a/src/mapmos/training_module.py +++ b/src/mapmos/training_module.py @@ -20,24 +20,18 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -import torch import numpy as np - +import torch from pytorch_lightning import LightningModule -from mapmos.mapmos_net import MapMOSNet + from mapmos.config import MapMOSConfig +from mapmos.mapmos_net import MapMOSNet +from mapmos.metrics import get_confusion_matrix, get_iou, get_precision, get_recall from mapmos.utils.augmentation import ( - rotate_point_cloud, random_flip_point_cloud, random_scale_point_cloud, rotate_perturbation_point_cloud, -) - -from mapmos.metrics import ( - get_confusion_matrix, - get_iou, - get_precision, - get_recall, + rotate_point_cloud, ) diff --git a/src/mapmos/utils/pipeline_results.py b/src/mapmos/utils/pipeline_results.py index 03931b6..5220eda 100644 --- a/src/mapmos/utils/pipeline_results.py +++ b/src/mapmos/utils/pipeline_results.py @@ -21,15 +21,10 @@ # SOFTWARE. import numpy as np +from kiss_icp.metrics import absolute_trajectory_error, sequence_error from kiss_icp.tools.pipeline_results import PipelineResults -from kiss_icp.metrics import sequence_error, absolute_trajectory_error -from mapmos.metrics import ( - get_stats, - get_iou, - get_recall, - get_f1, - get_precision, -) + +from mapmos.metrics import get_f1, get_iou, get_precision, get_recall, get_stats class MOSPipelineResults(PipelineResults): diff --git a/src/mapmos/utils/save.py b/src/mapmos/utils/save.py index de18775..1c75569 100644 --- a/src/mapmos/utils/save.py +++ b/src/mapmos/utils/save.py @@ -20,11 +20,12 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -import numpy as np -import os import importlib +import os from pathlib import Path +import numpy as np + class StubWriter: def __init__(self) -> None: diff --git a/src/mapmos/utils/seed.py b/src/mapmos/utils/seed.py index bfb5817..6c99677 100644 --- a/src/mapmos/utils/seed.py +++ b/src/mapmos/utils/seed.py @@ -20,11 +20,12 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. +import os import random + +import numpy as np import torch import torch.backends.cudnn -import numpy as np -import os def set_seed(seed):