Skip to content

Commit

Permalink
Merge pull request #292 from leggedrobotics/dev/open_source_jf_config…
Browse files Browse the repository at this point in the history
…_explained

Dev/open source jf config explained
  • Loading branch information
JonasFrey96 authored Feb 18, 2024
2 parents 6834bea + 42643cd commit 18edcb5
Show file tree
Hide file tree
Showing 57 changed files with 149 additions and 153 deletions.
2 changes: 1 addition & 1 deletion tests/test_feature_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down
4 changes: 2 additions & 2 deletions wild_visual_navigation/__init__.py
Original file line number Diff line number Diff line change
@@ -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__)))
Expand Down
4 changes: 2 additions & 2 deletions wild_visual_navigation/cfg/__init__.py
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions wild_visual_navigation/cfg/experiment_params.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions wild_visual_navigation/cfg/global_params.py
Original file line number Diff line number Diff line change
@@ -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


Expand Down
4 changes: 2 additions & 2 deletions wild_visual_navigation/cfg/ros_params.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions wild_visual_navigation/feature_extractor/__init__.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
4 changes: 2 additions & 2 deletions wild_visual_navigation/feature_extractor/dino_interface.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions wild_visual_navigation/feature_extractor/feature_extractor.py
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
4 changes: 2 additions & 2 deletions wild_visual_navigation/feature_extractor/segment_extractor.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions wild_visual_navigation/feature_extractor/stego_interface.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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

Expand Down
4 changes: 2 additions & 2 deletions wild_visual_navigation/image_projector/__init__.py
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions wild_visual_navigation/image_projector/image_projector.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions wild_visual_navigation/model/__init__.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 3 additions & 3 deletions wild_visual_navigation/model/linear_rnvp.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down
4 changes: 2 additions & 2 deletions wild_visual_navigation/model/network_register.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions wild_visual_navigation/model/simple_gcn.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
6 changes: 3 additions & 3 deletions wild_visual_navigation/model/simple_mlp.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down
4 changes: 2 additions & 2 deletions wild_visual_navigation/supervision_generator/__init__.py
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions wild_visual_navigation/supervision_generator/twist_dataset.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions wild_visual_navigation/traversability_estimator/__init__.py
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
4 changes: 2 additions & 2 deletions wild_visual_navigation/traversability_estimator/graphs.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions wild_visual_navigation/traversability_estimator/nodes.py
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions wild_visual_navigation/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
12 changes: 6 additions & 6 deletions wild_visual_navigation/utils/confidence_generator.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
5 changes: 2 additions & 3 deletions wild_visual_navigation/utils/create_experiment_folder.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
6 changes: 3 additions & 3 deletions wild_visual_navigation/utils/data.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
4 changes: 2 additions & 2 deletions wild_visual_navigation/utils/flatten_dict.py
Original file line number Diff line number Diff line change
@@ -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"]
Expand Down
Loading

0 comments on commit 18edcb5

Please sign in to comment.