From 523091102e897ea885eeb7f78dc4615be6c719ae Mon Sep 17 00:00:00 2001 From: Jonas Frey Date: Sun, 18 Feb 2024 18:58:15 +0100 Subject: [PATCH 1/2] updated cfg --- .../wild_visual_navigation/default.yaml | 63 +++++++++---------- 1 file changed, 29 insertions(+), 34 deletions(-) diff --git a/wild_visual_navigation_ros/config/wild_visual_navigation/default.yaml b/wild_visual_navigation_ros/config/wild_visual_navigation/default.yaml index d7a9ae5e..339111e5 100644 --- a/wild_visual_navigation_ros/config/wild_visual_navigation/default.yaml +++ b/wild_visual_navigation_ros/config/wild_visual_navigation/default.yaml @@ -1,5 +1,3 @@ -# TODO split into three configuration files - shared - learning - feature_extractor - # Input topics robot_state_topic: "/wild_visual_navigation_node/robot_state" desired_twist_topic: "/twist_mux/twist" @@ -9,45 +7,46 @@ fixed_frame: odom base_frame: base footprint_frame: footprint -# Robot size +# Robot size used to project the footprint robot_length: 0.8 robot_width: 0.3 robot_height: 0.3 -# Traversability estimation params -traversability_radius: 3.0 # meters -image_graph_dist_thr: 0.2 # meters -supervision_graph_dist_thr: 0.1 # meters -network_input_image_height: 224 # 448 -network_input_image_width: 224 # 448 -segmentation_type: "stego" # Options: slic, grid, random, stego -feature_type: "stego" # Options: dino, dinov2, stego -dino_patch_size: 8 # 8 or 16; 8 is finer -dino_backbone: vit_small -slic_num_components: 100 -confidence_std_factor: 4.0 - -min_samples_for_training: 5 -prediction_per_pixel: True -vis_node_index: 10 +# Traversability estimation parameters +traversability_radius: 3.0 # Maximum distance in meters of the supervision graph +image_graph_dist_thr: 0.2 # Minimum distance between mission nodes being added +supervision_graph_dist_thr: 0.1 # Minimum distance between supervision nodes being added +network_input_image_height: 224 # Unput image height +network_input_image_width: 224 # Input image width +segmentation_type: "stego" # Options: slic, grid, random, stego +feature_type: "stego" # Options: dino, dinov2, stego +dino_patch_size: 8 # Options: 8, 16; We found 8 is sufficient and faster +dino_backbone: vit_small # Options: vit_small +slic_num_components: 100 # Number of segments for slic +confidence_std_factor: 4.0 # Tuning parameter to change the confidence computation / explained in confidence_generator.py +min_samples_for_training: 5 # Minimum number of mission nodes with successfull reprojection before start training +prediction_per_pixel: True # If true, trained network is inferenced for each pixel, otherwise per segment +vis_node_index: 10 # Defines node which is used for visualization, can help to debug the projected footprint + # 1 -> indicates latest added mission node; 10 -> indicates the node added 10 steps in the past # Supervision Generator -untraversable_thr: 0.01 -mission_name: "test" -mission_timestamp: True +untraversable_thr: 0.0 # Threshold for untraversable area -> this threshold is used to spawn special "collision walls" -> not used in the paper +mission_name: "test" # Name of the mission_folder used for logging +mission_timestamp: True # If true current timestamp is used as a prefix for the mission_folder # Threads -image_callback_rate: 10 # hertz -supervision_callback_rate: 10 # hertz -learning_thread_rate: 10 # hertz -logging_thread_rate: 2 # hertz -status_thread_rate: 0.5 # hertz -load_save_checkpoint_rate: 0.2 # hertz, 1/0.2 = 5 sec equivalent +image_callback_rate: 10 # Maximum rate at which images are processed in hertz +supervision_callback_rate: 10 # Maximum rate at which supervision_signals are processed in hertz +learning_thread_rate: 10 # Gradient steps per second in hertz +logging_thread_rate: 2 # Logging of learning_node in hertz +status_thread_rate: 0.5 # Status of feature_extractor_node in hertz +load_save_checkpoint_rate: 0.2 # Rate at which checkpoints are saved / loaded between learning and feature extraction + # Runtime options device: "cuda" -mode: "online" # check out comments in the class WVNMode +mode: "online" # Options: "online", "debug", "extract_labels"; Sets operation mode of both nodes colormap: "RdYlBu" print_image_callback_time: false @@ -55,9 +54,7 @@ print_supervision_callback_time: false log_time: false log_confidence: false verbose: true - extraction_store_folder: "nan" -exp: "nan" # TODO: What do we add here for sim or for rosbags? # camera_topics: @@ -76,6 +73,4 @@ exp: "nan" # publish_input_image: true # scheduler_weight: 1 -# Provides 1080 (height) x 1920 (width) images -network_input_image_height: 224 # 448 -network_input_image_width: 224 # 448 \ No newline at end of file +# Provides 1080 (height) x 1920 (width) images \ No newline at end of file From 42643cd2113d9297e6982e2f6923e43841254c91 Mon Sep 17 00:00:00 2001 From: Jonas Frey Date: Sun, 18 Feb 2024 18:58:23 +0100 Subject: [PATCH 2/2] black formatting --- tests/test_feature_extractor.py | 2 +- wild_visual_navigation/__init__.py | 4 ++-- wild_visual_navigation/cfg/__init__.py | 4 ++-- wild_visual_navigation/cfg/experiment_params.py | 4 ++-- wild_visual_navigation/cfg/global_params.py | 4 ++-- wild_visual_navigation/cfg/ros_params.py | 4 ++-- wild_visual_navigation/feature_extractor/__init__.py | 4 ++-- .../feature_extractor/dino_interface.py | 4 ++-- .../feature_extractor/dino_trt_interface.py | 4 ++-- .../feature_extractor/feature_extractor.py | 4 ++-- .../feature_extractor/segment_extractor.py | 4 ++-- .../feature_extractor/stego_interface.py | 4 ++-- .../feature_extractor/torchvision_interface.py | 4 ++-- wild_visual_navigation/image_projector/__init__.py | 4 ++-- .../image_projector/image_projector.py | 4 ++-- wild_visual_navigation/model/__init__.py | 4 ++-- wild_visual_navigation/model/linear_rnvp.py | 6 +++--- wild_visual_navigation/model/network_register.py | 4 ++-- wild_visual_navigation/model/simple_gcn.py | 4 ++-- wild_visual_navigation/model/simple_mlp.py | 6 +++--- .../supervision_generator/__init__.py | 4 ++-- .../supervision_generator/supervision_generator.py | 4 ++-- .../supervision_generator/twist_dataset.py | 4 ++-- .../traversability_estimator/__init__.py | 4 ++-- .../traversability_estimator/graphs.py | 4 ++-- .../traversability_estimator/nodes.py | 4 ++-- .../traversability_estimator.py | 4 ++-- wild_visual_navigation/utils/__init__.py | 4 ++-- wild_visual_navigation/utils/confidence_generator.py | 12 ++++++------ .../utils/create_experiment_folder.py | 5 ++--- wild_visual_navigation/utils/data.py | 6 +++--- wild_visual_navigation/utils/flatten_dict.py | 4 ++-- wild_visual_navigation/utils/get_confidence.py | 4 ++-- wild_visual_navigation/utils/get_logger.py | 4 ++-- wild_visual_navigation/utils/gpu_monitor.py | 4 ++-- wild_visual_navigation/utils/kalman_filter.py | 4 ++-- wild_visual_navigation/utils/loading.py | 8 +++++--- wild_visual_navigation/utils/loss.py | 4 ++-- wild_visual_navigation/utils/meshes.py | 4 ++-- wild_visual_navigation/utils/operation_modes.py | 4 ++-- wild_visual_navigation/utils/testing.py | 4 ++-- wild_visual_navigation/visu/__init__.py | 4 ++-- wild_visual_navigation/visu/image_functionality.py | 4 ++-- wild_visual_navigation/visu/paper_colors.py | 4 ++-- wild_visual_navigation/visu/plotting.py | 4 ++-- wild_visual_navigation/visu/visualizer.py | 4 ++-- .../scripts/anymal_msg_converter_node.py | 4 ++-- .../scripts/anymal_msg_with_latent_converter_node.py | 4 ++-- .../convert_to_public_format.py | 4 ++-- .../open_source_rosbag_converter/encoding_fixer.py | 4 ++-- .../scripts/policy_debug_info_converter_node.py | 4 ++-- wild_visual_navigation_ros/scripts/overlay_images.py | 4 ++-- wild_visual_navigation_ros/scripts/smart_carrot.py | 2 +- .../scripts/wvn_feature_extractor_node.py | 4 ++-- .../scripts/wvn_learning_node.py | 4 ++-- wild_visual_navigation_ros/setup.py | 4 ++-- 56 files changed, 120 insertions(+), 119 deletions(-) diff --git a/tests/test_feature_extractor.py b/tests/test_feature_extractor.py index abce5bf6..c0785f42 100644 --- a/tests/test_feature_extractor.py +++ b/tests/test_feature_extractor.py @@ -12,7 +12,7 @@ def test_feature_extractor(): device = "cuda" if torch.cuda.is_available() else "cpu" segmentation_types = ["none", "grid", "slic", "random", "stego"] feature_types = ["dino", "dinov2", "stego"] - backbone_types = ["vit_small", "vit_base"] # "vit_small_reg", "vit_base_reg"] + backbone_types = ["vit_small", "vit_base"] # "vit_small_reg", "vit_base_reg"] for seg_type, feat_type, back_type in itertools.product(segmentation_types, feature_types, backbone_types): if seg_type == "stego" and feat_type != "stego": diff --git a/wild_visual_navigation/__init__.py b/wild_visual_navigation/__init__.py index 3cd7a002..1c859e93 100644 --- a/wild_visual_navigation/__init__.py +++ b/wild_visual_navigation/__init__.py @@ -1,8 +1,8 @@ -# +# # Copyright (c) 2022-2024, ETH Zurich, Jonas Frey, Matias Mattamala. # All rights reserved. Licensed under the MIT license. # See LICENSE file in the project root for details. -# +# import os WVN_ROOT_DIR = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) diff --git a/wild_visual_navigation/cfg/__init__.py b/wild_visual_navigation/cfg/__init__.py index cbb1c7e1..590af461 100644 --- a/wild_visual_navigation/cfg/__init__.py +++ b/wild_visual_navigation/cfg/__init__.py @@ -1,8 +1,8 @@ -# +# # Copyright (c) 2022-2024, ETH Zurich, Jonas Frey, Matias Mattamala. # All rights reserved. Licensed under the MIT license. # See LICENSE file in the project root for details. -# +# from .global_params import get_global_env_params, GlobalEnvironmentParams from .experiment_params import ExperimentParams from .ros_params import RosLearningNodeParams, RosFeatureExtractorNodeParams diff --git a/wild_visual_navigation/cfg/experiment_params.py b/wild_visual_navigation/cfg/experiment_params.py index 37c63d2d..a6cbb4cc 100644 --- a/wild_visual_navigation/cfg/experiment_params.py +++ b/wild_visual_navigation/cfg/experiment_params.py @@ -1,8 +1,8 @@ -# +# # Copyright (c) 2022-2024, ETH Zurich, Jonas Frey, Matias Mattamala. # All rights reserved. Licensed under the MIT license. # See LICENSE file in the project root for details. -# +# from dataclasses import dataclass, field from typing import List, Optional from typing import Any diff --git a/wild_visual_navigation/cfg/global_params.py b/wild_visual_navigation/cfg/global_params.py index f88e3240..159edd1f 100644 --- a/wild_visual_navigation/cfg/global_params.py +++ b/wild_visual_navigation/cfg/global_params.py @@ -1,8 +1,8 @@ -# +# # Copyright (c) 2022-2024, ETH Zurich, Jonas Frey, Matias Mattamala. # All rights reserved. Licensed under the MIT license. # See LICENSE file in the project root for details. -# +# from dataclasses import dataclass diff --git a/wild_visual_navigation/cfg/ros_params.py b/wild_visual_navigation/cfg/ros_params.py index e6b42037..64a057d3 100644 --- a/wild_visual_navigation/cfg/ros_params.py +++ b/wild_visual_navigation/cfg/ros_params.py @@ -1,8 +1,8 @@ -# +# # Copyright (c) 2022-2024, ETH Zurich, Jonas Frey, Matias Mattamala. # All rights reserved. Licensed under the MIT license. # See LICENSE file in the project root for details. -# +# from dataclasses import dataclass from typing import Dict from typing import Any diff --git a/wild_visual_navigation/feature_extractor/__init__.py b/wild_visual_navigation/feature_extractor/__init__.py index 8b3be17c..ba75ba13 100644 --- a/wild_visual_navigation/feature_extractor/__init__.py +++ b/wild_visual_navigation/feature_extractor/__init__.py @@ -1,8 +1,8 @@ -# +# # Copyright (c) 2022-2024, ETH Zurich, Jonas Frey, Matias Mattamala. # All rights reserved. Licensed under the MIT license. # See LICENSE file in the project root for details. -# +# from .dino_interface import DinoInterface, run_dino_interfacer from .torchvision_interface import TorchVisionInterface diff --git a/wild_visual_navigation/feature_extractor/dino_interface.py b/wild_visual_navigation/feature_extractor/dino_interface.py index aa43a0a8..816ad25e 100644 --- a/wild_visual_navigation/feature_extractor/dino_interface.py +++ b/wild_visual_navigation/feature_extractor/dino_interface.py @@ -1,8 +1,8 @@ -# +# # Copyright (c) 2022-2024, ETH Zurich, Jonas Frey, Matias Mattamala. # All rights reserved. Licensed under the MIT license. # See LICENSE file in the project root for details. -# +# from os.path import join import torch.nn.functional as F import torch diff --git a/wild_visual_navigation/feature_extractor/dino_trt_interface.py b/wild_visual_navigation/feature_extractor/dino_trt_interface.py index 9882335c..adfcbc09 100644 --- a/wild_visual_navigation/feature_extractor/dino_trt_interface.py +++ b/wild_visual_navigation/feature_extractor/dino_trt_interface.py @@ -1,8 +1,8 @@ -# +# # Copyright (c) 2022-2024, ETH Zurich, Jonas Frey, Matias Mattamala. # All rights reserved. Licensed under the MIT license. # See LICENSE file in the project root for details. -# +# from wild_visual_navigation import WVN_ROOT_DIR from os.path import join from omegaconf import DictConfig diff --git a/wild_visual_navigation/feature_extractor/feature_extractor.py b/wild_visual_navigation/feature_extractor/feature_extractor.py index 10065b9b..053a2e82 100644 --- a/wild_visual_navigation/feature_extractor/feature_extractor.py +++ b/wild_visual_navigation/feature_extractor/feature_extractor.py @@ -1,8 +1,8 @@ -# +# # Copyright (c) 2022-2024, ETH Zurich, Jonas Frey, Matias Mattamala. # All rights reserved. Licensed under the MIT license. # See LICENSE file in the project root for details. -# +# from wild_visual_navigation.feature_extractor import ( StegoInterface, DinoInterface, diff --git a/wild_visual_navigation/feature_extractor/segment_extractor.py b/wild_visual_navigation/feature_extractor/segment_extractor.py index afd1716e..7095bfdb 100644 --- a/wild_visual_navigation/feature_extractor/segment_extractor.py +++ b/wild_visual_navigation/feature_extractor/segment_extractor.py @@ -1,8 +1,8 @@ -# +# # Copyright (c) 2022-2024, ETH Zurich, Jonas Frey, Matias Mattamala. # All rights reserved. Licensed under the MIT license. # See LICENSE file in the project root for details. -# +# # author: Jonas Frey import torch diff --git a/wild_visual_navigation/feature_extractor/stego_interface.py b/wild_visual_navigation/feature_extractor/stego_interface.py index e4f5aaca..d399603a 100644 --- a/wild_visual_navigation/feature_extractor/stego_interface.py +++ b/wild_visual_navigation/feature_extractor/stego_interface.py @@ -1,8 +1,8 @@ -# +# # Copyright (c) 2022-2024, ETH Zurich, Jonas Frey, Matias Mattamala. # All rights reserved. Licensed under the MIT license. # See LICENSE file in the project root for details. -# +# from os.path import join import torch.nn.functional as F import torch diff --git a/wild_visual_navigation/feature_extractor/torchvision_interface.py b/wild_visual_navigation/feature_extractor/torchvision_interface.py index dc274812..bccf80cd 100644 --- a/wild_visual_navigation/feature_extractor/torchvision_interface.py +++ b/wild_visual_navigation/feature_extractor/torchvision_interface.py @@ -1,8 +1,8 @@ -# +# # Copyright (c) 2022-2024, ETH Zurich, Jonas Frey, Matias Mattamala. # All rights reserved. Licensed under the MIT license. # See LICENSE file in the project root for details. -# +# from wild_visual_navigation import WVN_ROOT_DIR from os.path import join diff --git a/wild_visual_navigation/image_projector/__init__.py b/wild_visual_navigation/image_projector/__init__.py index 23c44b27..3c571a78 100644 --- a/wild_visual_navigation/image_projector/__init__.py +++ b/wild_visual_navigation/image_projector/__init__.py @@ -1,6 +1,6 @@ -# +# # Copyright (c) 2022-2024, ETH Zurich, Jonas Frey, Matias Mattamala. # All rights reserved. Licensed under the MIT license. # See LICENSE file in the project root for details. -# +# from .image_projector import ImageProjector, run_image_projector diff --git a/wild_visual_navigation/image_projector/image_projector.py b/wild_visual_navigation/image_projector/image_projector.py index ba585290..f1d8a3c2 100644 --- a/wild_visual_navigation/image_projector/image_projector.py +++ b/wild_visual_navigation/image_projector/image_projector.py @@ -1,8 +1,8 @@ -# +# # Copyright (c) 2022-2024, ETH Zurich, Jonas Frey, Matias Mattamala. # All rights reserved. Licensed under the MIT license. # See LICENSE file in the project root for details. -# +# from pytictac import Timer from os.path import join import torch diff --git a/wild_visual_navigation/model/__init__.py b/wild_visual_navigation/model/__init__.py index 7af1f4a7..d21a5c70 100644 --- a/wild_visual_navigation/model/__init__.py +++ b/wild_visual_navigation/model/__init__.py @@ -1,8 +1,8 @@ -# +# # Copyright (c) 2022-2024, ETH Zurich, Jonas Frey, Matias Mattamala. # All rights reserved. Licensed under the MIT license. # See LICENSE file in the project root for details. -# +# from .simple_mlp import SimpleMLP, DoubleMLP from .simple_gcn import SimpleGCN from .linear_rnvp import LinearRnvp diff --git a/wild_visual_navigation/model/linear_rnvp.py b/wild_visual_navigation/model/linear_rnvp.py index ac65eda1..fa63b286 100644 --- a/wild_visual_navigation/model/linear_rnvp.py +++ b/wild_visual_navigation/model/linear_rnvp.py @@ -1,12 +1,12 @@ -# +# # Copyright (c) 2022-2024, ETH Zurich, Jonas Frey, Matias Mattamala. # All rights reserved. Licensed under the MIT license. # See LICENSE file in the project root for details. -# +# +from wild_visual_navigation.utils import Data import copy import torch from torch import nn, distributions -from wild_visual_navigation.utils import Data class LinearBatchNorm(nn.Module): diff --git a/wild_visual_navigation/model/network_register.py b/wild_visual_navigation/model/network_register.py index d8c6409a..fb991df8 100644 --- a/wild_visual_navigation/model/network_register.py +++ b/wild_visual_navigation/model/network_register.py @@ -1,8 +1,8 @@ -# +# # Copyright (c) 2022-2024, ETH Zurich, Jonas Frey, Matias Mattamala. # All rights reserved. Licensed under the MIT license. # See LICENSE file in the project root for details. -# +# from wild_visual_navigation.model import * import inspect import torch diff --git a/wild_visual_navigation/model/simple_gcn.py b/wild_visual_navigation/model/simple_gcn.py index e68b6a19..419e4f24 100644 --- a/wild_visual_navigation/model/simple_gcn.py +++ b/wild_visual_navigation/model/simple_gcn.py @@ -1,8 +1,8 @@ -# +# # Copyright (c) 2022-2024, ETH Zurich, Jonas Frey, Matias Mattamala. # All rights reserved. Licensed under the MIT license. # See LICENSE file in the project root for details. -# +# import torch import torch.nn.functional as F diff --git a/wild_visual_navigation/model/simple_mlp.py b/wild_visual_navigation/model/simple_mlp.py index cb04a9a2..bbf0a28a 100644 --- a/wild_visual_navigation/model/simple_mlp.py +++ b/wild_visual_navigation/model/simple_mlp.py @@ -1,10 +1,10 @@ -# +# # Copyright (c) 2022-2024, ETH Zurich, Jonas Frey, Matias Mattamala. # All rights reserved. Licensed under the MIT license. # See LICENSE file in the project root for details. -# -import torch +# from wild_visual_navigation.utils import Data +import torch class SimpleMLP(torch.nn.Module): diff --git a/wild_visual_navigation/supervision_generator/__init__.py b/wild_visual_navigation/supervision_generator/__init__.py index 9e6213e3..cb5e5f91 100644 --- a/wild_visual_navigation/supervision_generator/__init__.py +++ b/wild_visual_navigation/supervision_generator/__init__.py @@ -1,7 +1,7 @@ -# +# # Copyright (c) 2022-2024, ETH Zurich, Jonas Frey, Matias Mattamala. # All rights reserved. Licensed under the MIT license. # See LICENSE file in the project root for details. -# +# from .twist_dataset import TwistDataset, TwistDataModule from .supervision_generator import SupervisionGenerator, run_supervision_generator diff --git a/wild_visual_navigation/supervision_generator/supervision_generator.py b/wild_visual_navigation/supervision_generator/supervision_generator.py index 560cb9c5..be32f62a 100644 --- a/wild_visual_navigation/supervision_generator/supervision_generator.py +++ b/wild_visual_navigation/supervision_generator/supervision_generator.py @@ -1,8 +1,8 @@ -# +# # Copyright (c) 2022-2024, ETH Zurich, Jonas Frey, Matias Mattamala. # All rights reserved. Licensed under the MIT license. # See LICENSE file in the project root for details. -# +# from wild_visual_navigation import WVN_ROOT_DIR from wild_visual_navigation.traversability_estimator.graphs import DistanceWindowGraph from wild_visual_navigation.traversability_estimator.nodes import TwistNode diff --git a/wild_visual_navigation/supervision_generator/twist_dataset.py b/wild_visual_navigation/supervision_generator/twist_dataset.py index 11c9c6b2..2e0c906c 100644 --- a/wild_visual_navigation/supervision_generator/twist_dataset.py +++ b/wild_visual_navigation/supervision_generator/twist_dataset.py @@ -1,8 +1,8 @@ -# +# # Copyright (c) 2022-2024, ETH Zurich, Jonas Frey, Matias Mattamala. # All rights reserved. Licensed under the MIT license. # See LICENSE file in the project root for details. -# +# from wild_visual_navigation import WVN_ROOT_DIR import os import torch diff --git a/wild_visual_navigation/traversability_estimator/__init__.py b/wild_visual_navigation/traversability_estimator/__init__.py index 5210f307..f3c6973a 100644 --- a/wild_visual_navigation/traversability_estimator/__init__.py +++ b/wild_visual_navigation/traversability_estimator/__init__.py @@ -1,8 +1,8 @@ -# +# # Copyright (c) 2022-2024, ETH Zurich, Jonas Frey, Matias Mattamala. # All rights reserved. Licensed under the MIT license. # See LICENSE file in the project root for details. -# +# from .graphs import ( BaseGraph, TemporalWindowGraph, diff --git a/wild_visual_navigation/traversability_estimator/graphs.py b/wild_visual_navigation/traversability_estimator/graphs.py index 690d1dd7..d4709001 100644 --- a/wild_visual_navigation/traversability_estimator/graphs.py +++ b/wild_visual_navigation/traversability_estimator/graphs.py @@ -1,8 +1,8 @@ -# +# # Copyright (c) 2022-2024, ETH Zurich, Jonas Frey, Matias Mattamala. # All rights reserved. Licensed under the MIT license. # See LICENSE file in the project root for details. -# +# from .nodes import BaseNode import networkx as nx import random diff --git a/wild_visual_navigation/traversability_estimator/nodes.py b/wild_visual_navigation/traversability_estimator/nodes.py index 8daa5f30..42a9ac0b 100644 --- a/wild_visual_navigation/traversability_estimator/nodes.py +++ b/wild_visual_navigation/traversability_estimator/nodes.py @@ -1,8 +1,8 @@ -# +# # Copyright (c) 2022-2024, ETH Zurich, Jonas Frey, Matias Mattamala. # All rights reserved. Licensed under the MIT license. # See LICENSE file in the project root for details. -# +# from wild_visual_navigation.image_projector import ImageProjector from wild_visual_navigation.utils import ( make_box, diff --git a/wild_visual_navigation/traversability_estimator/traversability_estimator.py b/wild_visual_navigation/traversability_estimator/traversability_estimator.py index d5434704..7d2aebf9 100644 --- a/wild_visual_navigation/traversability_estimator/traversability_estimator.py +++ b/wild_visual_navigation/traversability_estimator/traversability_estimator.py @@ -1,8 +1,8 @@ -# +# # Copyright (c) 2022-2024, ETH Zurich, Jonas Frey, Matias Mattamala. # All rights reserved. Licensed under the MIT license. # See LICENSE file in the project root for details. -# +# from wild_visual_navigation.feature_extractor import FeatureExtractor from wild_visual_navigation.image_projector import ImageProjector from wild_visual_navigation.model import get_model diff --git a/wild_visual_navigation/utils/__init__.py b/wild_visual_navigation/utils/__init__.py index 9c491315..b44f8835 100644 --- a/wild_visual_navigation/utils/__init__.py +++ b/wild_visual_navigation/utils/__init__.py @@ -1,8 +1,8 @@ -# +# # Copyright (c) 2022-2024, ETH Zurich, Jonas Frey, Matias Mattamala. # All rights reserved. Licensed under the MIT license. # See LICENSE file in the project root for details. -# +# from .data import Data, Batch from .flatten_dict import flatten_dict from .get_logger import get_logger, get_neptune_run diff --git a/wild_visual_navigation/utils/confidence_generator.py b/wild_visual_navigation/utils/confidence_generator.py index 5ffb70c3..5c35d2ff 100644 --- a/wild_visual_navigation/utils/confidence_generator.py +++ b/wild_visual_navigation/utils/confidence_generator.py @@ -1,8 +1,8 @@ -# +# # Copyright (c) 2022-2024, ETH Zurich, Jonas Frey, Matias Mattamala. # All rights reserved. Licensed under the MIT license. # See LICENSE file in the project root for details. -# +# from wild_visual_navigation.utils import KalmanFilter from wild_visual_navigation import WVN_ROOT_DIR import torch @@ -115,10 +115,10 @@ def update_running_mean(self, x: torch.tensor, x_positive: torch.tensor): # confidence = torch.exp(-(((x - self.mean) / (self.std * self.std_factor)) ** 2) * 0.5) # confidence[x < self.mean] = 1.0 - shifted_mean = self.mean + self.std*self.std_factor + shifted_mean = self.mean + self.std * self.std_factor interval_min = shifted_mean - 2 * self.std interval_max = shifted_mean + 2 * self.std - x = torch.clip( x , interval_min, interval_max) + x = torch.clip(x, interval_min, interval_max) confidence = 1 - ((x - interval_min) / (interval_max - interval_min)) return confidence.type(torch.float32) @@ -197,10 +197,10 @@ def inference_without_update(self, x: torch.tensor): confidence = (x - torch.min(x)) / (torch.max(x) - torch.min(x)) else: - shifted_mean = self.mean + self.std*self.std_factor + shifted_mean = self.mean + self.std * self.std_factor interval_min = shifted_mean - 2 * self.std interval_max = shifted_mean + 2 * self.std - x = torch.clip( x , interval_min, interval_max) + x = torch.clip(x, interval_min, interval_max) confidence = 1 - ((x - interval_min) / (interval_max - interval_min)) # confidence = torch.exp(-(((x - self.mean) / (self.std * self.std_factor)) ** 2) * 0.5) diff --git a/wild_visual_navigation/utils/create_experiment_folder.py b/wild_visual_navigation/utils/create_experiment_folder.py index 67b74c29..a879fd8b 100644 --- a/wild_visual_navigation/utils/create_experiment_folder.py +++ b/wild_visual_navigation/utils/create_experiment_folder.py @@ -1,15 +1,14 @@ -# +# # Copyright (c) 2022-2024, ETH Zurich, Jonas Frey, Matias Mattamala. # All rights reserved. Licensed under the MIT license. # See LICENSE file in the project root for details. -# +# import datetime import os import shutil from pathlib import Path from pytorch_lightning.utilities import rank_zero_only from wild_visual_navigation.cfg import ExperimentParams -from typing import Union from omegaconf import read_write from wild_visual_navigation import WVN_ROOT_DIR diff --git a/wild_visual_navigation/utils/data.py b/wild_visual_navigation/utils/data.py index c1a3fb86..a6aa28af 100644 --- a/wild_visual_navigation/utils/data.py +++ b/wild_visual_navigation/utils/data.py @@ -1,9 +1,9 @@ -# +# # Copyright (c) 2022-2024, ETH Zurich, Jonas Frey, Matias Mattamala. # All rights reserved. Licensed under the MIT license. # See LICENSE file in the project root for details. -# -from typing import Any, List, Optional, Type, Union +# +from typing import List from typing_extensions import Self import torch diff --git a/wild_visual_navigation/utils/flatten_dict.py b/wild_visual_navigation/utils/flatten_dict.py index 970771b3..6e788635 100644 --- a/wild_visual_navigation/utils/flatten_dict.py +++ b/wild_visual_navigation/utils/flatten_dict.py @@ -1,8 +1,8 @@ -# +# # Copyright (c) 2022-2024, ETH Zurich, Jonas Frey, Matias Mattamala. # All rights reserved. Licensed under the MIT license. # See LICENSE file in the project root for details. -# +# import collections __all__ = ["flatten_dict"] diff --git a/wild_visual_navigation/utils/get_confidence.py b/wild_visual_navigation/utils/get_confidence.py index fa90917a..dee10778 100644 --- a/wild_visual_navigation/utils/get_confidence.py +++ b/wild_visual_navigation/utils/get_confidence.py @@ -1,8 +1,8 @@ -# +# # Copyright (c) 2022-2024, ETH Zurich, Jonas Frey, Matias Mattamala. # All rights reserved. Licensed under the MIT license. # See LICENSE file in the project root for details. -# +# import torch.nn.functional as F import torch diff --git a/wild_visual_navigation/utils/get_logger.py b/wild_visual_navigation/utils/get_logger.py index 681dea06..c1154622 100644 --- a/wild_visual_navigation/utils/get_logger.py +++ b/wild_visual_navigation/utils/get_logger.py @@ -1,8 +1,8 @@ -# +# # Copyright (c) 2022-2024, ETH Zurich, Jonas Frey, Matias Mattamala. # All rights reserved. Licensed under the MIT license. # See LICENSE file in the project root for details. -# +# from pytorch_lightning.loggers.neptune import NeptuneLogger from pytorch_lightning.loggers import TensorBoardLogger, WandbLogger from wild_visual_navigation.utils import flatten_dict diff --git a/wild_visual_navigation/utils/gpu_monitor.py b/wild_visual_navigation/utils/gpu_monitor.py index b7788d58..a553349e 100644 --- a/wild_visual_navigation/utils/gpu_monitor.py +++ b/wild_visual_navigation/utils/gpu_monitor.py @@ -1,8 +1,8 @@ -# +# # Copyright (c) 2022-2024, ETH Zurich, Jonas Frey, Matias Mattamala. # All rights reserved. Licensed under the MIT license. # See LICENSE file in the project root for details. -# +# import torch import os import pandas as pd diff --git a/wild_visual_navigation/utils/kalman_filter.py b/wild_visual_navigation/utils/kalman_filter.py index 3ba2ed41..1486cb05 100644 --- a/wild_visual_navigation/utils/kalman_filter.py +++ b/wild_visual_navigation/utils/kalman_filter.py @@ -1,8 +1,8 @@ -# +# # Copyright (c) 2022-2024, ETH Zurich, Jonas Frey, Matias Mattamala. # All rights reserved. Licensed under the MIT license. # See LICENSE file in the project root for details. -# +# import torch import torch.nn as nn diff --git a/wild_visual_navigation/utils/loading.py b/wild_visual_navigation/utils/loading.py index 59c6e03c..e31da012 100644 --- a/wild_visual_navigation/utils/loading.py +++ b/wild_visual_navigation/utils/loading.py @@ -1,11 +1,13 @@ -# +# # Copyright (c) 2022-2024, ETH Zurich, Jonas Frey, Matias Mattamala. # All rights reserved. Licensed under the MIT license. # See LICENSE file in the project root for details. -# +# +from wild_visual_navigation import WVN_ROOT_DIR + import os import yaml -from wild_visual_navigation import WVN_ROOT_DIR + __all__ = ["file_path", "load_yaml"] diff --git a/wild_visual_navigation/utils/loss.py b/wild_visual_navigation/utils/loss.py index e1a1218c..ed6cf0e1 100644 --- a/wild_visual_navigation/utils/loss.py +++ b/wild_visual_navigation/utils/loss.py @@ -1,8 +1,8 @@ -# +# # Copyright (c) 2022-2024, ETH Zurich, Jonas Frey, Matias Mattamala. # All rights reserved. Licensed under the MIT license. # See LICENSE file in the project root for details. -# +# from wild_visual_navigation.utils import ConfidenceGenerator import torch.nn.functional as F diff --git a/wild_visual_navigation/utils/meshes.py b/wild_visual_navigation/utils/meshes.py index 91e57d95..383e4596 100644 --- a/wild_visual_navigation/utils/meshes.py +++ b/wild_visual_navigation/utils/meshes.py @@ -1,8 +1,8 @@ -# +# # Copyright (c) 2022-2024, ETH Zurich, Jonas Frey, Matias Mattamala. # All rights reserved. Licensed under the MIT license. # See LICENSE file in the project root for details. -# +# import torch from kornia.geometry.linalg import transform_points diff --git a/wild_visual_navigation/utils/operation_modes.py b/wild_visual_navigation/utils/operation_modes.py index a052e22e..6fd761e3 100644 --- a/wild_visual_navigation/utils/operation_modes.py +++ b/wild_visual_navigation/utils/operation_modes.py @@ -1,8 +1,8 @@ -# +# # Copyright (c) 2022-2024, ETH Zurich, Jonas Frey, Matias Mattamala. # All rights reserved. Licensed under the MIT license. # See LICENSE file in the project root for details. -# +# from enum import Enum diff --git a/wild_visual_navigation/utils/testing.py b/wild_visual_navigation/utils/testing.py index d87b9e2a..03ef26a1 100644 --- a/wild_visual_navigation/utils/testing.py +++ b/wild_visual_navigation/utils/testing.py @@ -1,8 +1,8 @@ -# +# # Copyright (c) 2022-2024, ETH Zurich, Jonas Frey, Matias Mattamala. # All rights reserved. Licensed under the MIT license. # See LICENSE file in the project root for details. -# +# import os import cv2 import torch diff --git a/wild_visual_navigation/visu/__init__.py b/wild_visual_navigation/visu/__init__.py index b71a666a..e6172047 100644 --- a/wild_visual_navigation/visu/__init__.py +++ b/wild_visual_navigation/visu/__init__.py @@ -1,8 +1,8 @@ -# +# # Copyright (c) 2022-2024, ETH Zurich, Jonas Frey, Matias Mattamala. # All rights reserved. Licensed under the MIT license. # See LICENSE file in the project root for details. -# +# from .paper_colors import ( paper_colors_rgb_u8, paper_colors_rgba_u8, diff --git a/wild_visual_navigation/visu/image_functionality.py b/wild_visual_navigation/visu/image_functionality.py index 002bdb03..ef4ba477 100644 --- a/wild_visual_navigation/visu/image_functionality.py +++ b/wild_visual_navigation/visu/image_functionality.py @@ -1,8 +1,8 @@ -# +# # Copyright (c) 2022-2024, ETH Zurich, Jonas Frey, Matias Mattamala. # All rights reserved. Licensed under the MIT license. # See LICENSE file in the project root for details. -# +# # TODO: Jonas doc strings import os import imageio diff --git a/wild_visual_navigation/visu/paper_colors.py b/wild_visual_navigation/visu/paper_colors.py index d83f1566..c5b934e9 100644 --- a/wild_visual_navigation/visu/paper_colors.py +++ b/wild_visual_navigation/visu/paper_colors.py @@ -1,8 +1,8 @@ -# +# # Copyright (c) 2022-2024, ETH Zurich, Jonas Frey, Matias Mattamala. # All rights reserved. Licensed under the MIT license. # See LICENSE file in the project root for details. -# +# paper_colors_rgb_u8 = { "orange": (251, 151, 39), "mangenta": (150, 36, 145), diff --git a/wild_visual_navigation/visu/plotting.py b/wild_visual_navigation/visu/plotting.py index 67fb4cf6..c3559716 100644 --- a/wild_visual_navigation/visu/plotting.py +++ b/wild_visual_navigation/visu/plotting.py @@ -1,8 +1,8 @@ -# +# # Copyright (c) 2022-2024, ETH Zurich, Jonas Frey, Matias Mattamala. # All rights reserved. Licensed under the MIT license. # See LICENSE file in the project root for details. -# +# from matplotlib.backends.backend_agg import FigureCanvasAgg from PIL import Image import numpy as np diff --git a/wild_visual_navigation/visu/visualizer.py b/wild_visual_navigation/visu/visualizer.py index 1936287e..d67fbc35 100644 --- a/wild_visual_navigation/visu/visualizer.py +++ b/wild_visual_navigation/visu/visualizer.py @@ -1,8 +1,8 @@ -# +# # Copyright (c) 2022-2024, ETH Zurich, Jonas Frey, Matias Mattamala. # All rights reserved. Licensed under the MIT license. # See LICENSE file in the project root for details. -# +# # TODO: Jonas doc strings, rework visualiation functions import os diff --git a/wild_visual_navigation_anymal/scripts/anymal_msg_converter_node.py b/wild_visual_navigation_anymal/scripts/anymal_msg_converter_node.py index 7a05373d..8f101291 100644 --- a/wild_visual_navigation_anymal/scripts/anymal_msg_converter_node.py +++ b/wild_visual_navigation_anymal/scripts/anymal_msg_converter_node.py @@ -1,9 +1,9 @@ #!/usr/bin/python3 -# +# # Copyright (c) 2022-2024, ETH Zurich, Matias Mattamala, Jonas Frey. # All rights reserved. Licensed under the MIT license. # See LICENSE file in the project root for details. -# +# from wild_visual_navigation_msgs.msg import CustomState, RobotState from anymal_msgs.msg import AnymalState import rospy diff --git a/wild_visual_navigation_anymal/scripts/anymal_msg_with_latent_converter_node.py b/wild_visual_navigation_anymal/scripts/anymal_msg_with_latent_converter_node.py index 9e950eac..2b47ce57 100644 --- a/wild_visual_navigation_anymal/scripts/anymal_msg_with_latent_converter_node.py +++ b/wild_visual_navigation_anymal/scripts/anymal_msg_with_latent_converter_node.py @@ -1,9 +1,9 @@ #!/usr/bin/python3 -# +# # Copyright (c) 2022-2024, ETH Zurich, Matias Mattamala, Jonas Frey. # All rights reserved. Licensed under the MIT license. # See LICENSE file in the project root for details. -# +# from wild_visual_navigation_msgs.msg import CustomState, RobotState from anymal_msgs.msg import AnymalState from std_msgs.msg import Float32MultiArray diff --git a/wild_visual_navigation_anymal/scripts/open_source_rosbag_converter/convert_to_public_format.py b/wild_visual_navigation_anymal/scripts/open_source_rosbag_converter/convert_to_public_format.py index a24aa053..586f0402 100644 --- a/wild_visual_navigation_anymal/scripts/open_source_rosbag_converter/convert_to_public_format.py +++ b/wild_visual_navigation_anymal/scripts/open_source_rosbag_converter/convert_to_public_format.py @@ -1,9 +1,9 @@ #!/usr/bin/env python -# +# # Copyright (c) 2022-2024, ETH Zurich, Matias Mattamala, Jonas Frey. # All rights reserved. Licensed under the MIT license. # See LICENSE file in the project root for details. -# +# import rospy from anymal_msgs.msg import AnymalState diff --git a/wild_visual_navigation_anymal/scripts/open_source_rosbag_converter/encoding_fixer.py b/wild_visual_navigation_anymal/scripts/open_source_rosbag_converter/encoding_fixer.py index 7945b045..48d2f2a1 100644 --- a/wild_visual_navigation_anymal/scripts/open_source_rosbag_converter/encoding_fixer.py +++ b/wild_visual_navigation_anymal/scripts/open_source_rosbag_converter/encoding_fixer.py @@ -1,9 +1,9 @@ #!/env/bin/python3 -# +# # Copyright (c) 2022-2024, ETH Zurich, Matias Mattamala, Jonas Frey. # All rights reserved. Licensed under the MIT license. # See LICENSE file in the project root for details. -# +# from __future__ import print_function diff --git a/wild_visual_navigation_anymal/scripts/policy_debug_info_converter_node.py b/wild_visual_navigation_anymal/scripts/policy_debug_info_converter_node.py index eddfb37b..82773fb5 100644 --- a/wild_visual_navigation_anymal/scripts/policy_debug_info_converter_node.py +++ b/wild_visual_navigation_anymal/scripts/policy_debug_info_converter_node.py @@ -1,8 +1,8 @@ -# +# # Copyright (c) 2022-2024, ETH Zurich, Matias Mattamala, Jonas Frey. # All rights reserved. Licensed under the MIT license. # See LICENSE file in the project root for details. -# +# import rospy from geometry_msgs.msg import TwistStamped from std_msgs.msg import Float32MultiArray diff --git a/wild_visual_navigation_ros/scripts/overlay_images.py b/wild_visual_navigation_ros/scripts/overlay_images.py index 7d0cdd2d..b5c32371 100644 --- a/wild_visual_navigation_ros/scripts/overlay_images.py +++ b/wild_visual_navigation_ros/scripts/overlay_images.py @@ -1,8 +1,8 @@ -# +# # Copyright (c) 2022-2024, ETH Zurich, Matias Mattamala, Jonas Frey. # All rights reserved. Licensed under the MIT license. # See LICENSE file in the project root for details. -# +# import message_filters import rospy from sensor_msgs.msg import Image # , CameraInfo # , CompressedImage diff --git a/wild_visual_navigation_ros/scripts/smart_carrot.py b/wild_visual_navigation_ros/scripts/smart_carrot.py index 7db3758b..e46e0d63 100644 --- a/wild_visual_navigation_ros/scripts/smart_carrot.py +++ b/wild_visual_navigation_ros/scripts/smart_carrot.py @@ -169,4 +169,4 @@ def callback(self, msg): rospy.init_node("wild_visual_navigation_smart_carrot") print("Start") wvn = SmartCarrotNode() - rospy.spin() \ No newline at end of file + rospy.spin() diff --git a/wild_visual_navigation_ros/scripts/wvn_feature_extractor_node.py b/wild_visual_navigation_ros/scripts/wvn_feature_extractor_node.py index bf0154f9..ba0f5b91 100644 --- a/wild_visual_navigation_ros/scripts/wvn_feature_extractor_node.py +++ b/wild_visual_navigation_ros/scripts/wvn_feature_extractor_node.py @@ -1,8 +1,8 @@ -# +# # Copyright (c) 2022-2024, ETH Zurich, Matias Mattamala, Jonas Frey. # All rights reserved. Licensed under the MIT license. # See LICENSE file in the project root for details. -# +# from wild_visual_navigation import WVN_ROOT_DIR from wild_visual_navigation.feature_extractor import FeatureExtractor from wild_visual_navigation.cfg import ExperimentParams, RosFeatureExtractorNodeParams diff --git a/wild_visual_navigation_ros/scripts/wvn_learning_node.py b/wild_visual_navigation_ros/scripts/wvn_learning_node.py index ee31198e..2e063afd 100644 --- a/wild_visual_navigation_ros/scripts/wvn_learning_node.py +++ b/wild_visual_navigation_ros/scripts/wvn_learning_node.py @@ -1,8 +1,8 @@ -# +# # Copyright (c) 2022-2024, ETH Zurich, Matias Mattamala, Jonas Frey. # All rights reserved. Licensed under the MIT license. # See LICENSE file in the project root for details. -# +# from wild_visual_navigation import WVN_ROOT_DIR from wild_visual_navigation.image_projector import ImageProjector from wild_visual_navigation.supervision_generator import SupervisionGenerator diff --git a/wild_visual_navigation_ros/setup.py b/wild_visual_navigation_ros/setup.py index cdfffc9f..33c335b0 100644 --- a/wild_visual_navigation_ros/setup.py +++ b/wild_visual_navigation_ros/setup.py @@ -1,8 +1,8 @@ -# +# # Copyright (c) 2022-2024, ETH Zurich, Matias Mattamala, Jonas Frey. # All rights reserved. Licensed under the MIT license. # See LICENSE file in the project root for details. -# +# from setuptools import setup from catkin_pkg.python_setup import generate_distutils_setup