Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev/repair develop #270

Closed
wants to merge 49 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
467149e
formatting problems
JonasFrey96 Aug 16, 2023
a4268d3
improved feature extraction node to cont. log
JonasFrey96 Aug 16, 2023
81825ba
added valid nodes to state - dino working
JonasFrey96 Aug 16, 2023
42055b6
integrated anomaly detection
JonasFrey96 Aug 16, 2023
018310b
Add fix to also extract labels with python Bagtransformer
RobinSchmid7 Aug 23, 2023
5be5be7
Do not use dropout, use 384 dim feat vector, no non-linear projection…
RobinSchmid7 Aug 24, 2023
70e2a25
Fixes to loss, traversability estimation
RobinSchmid7 Aug 24, 2023
5385241
Fix camera yaml files
RobinSchmid7 Aug 24, 2023
d33f610
Added comments, changes to default rnvp config
RobinSchmid7 Aug 29, 2023
d2283e2
Changed resolution to 224
RobinSchmid7 Aug 29, 2023
12bb9df
finalize PR
JonasFrey96 Aug 29, 2023
1cacd24
fixed sampling the batch
JonasFrey96 Aug 29, 2023
85d2103
started to update the confidence generator
JonasFrey96 Aug 29, 2023
112aa61
Fixes to recent commits
RobinSchmid7 Aug 30, 2023
70e49f2
Add DINO dim param
RobinSchmid7 Aug 30, 2023
19ba166
Add DINO dim param
RobinSchmid7 Aug 30, 2023
89746f6
Remove mean kernel, did not help
RobinSchmid7 Aug 30, 2023
b11a435
updates for dodo
Aug 31, 2023
2877f28
Remove unnecessary libraries, added visu for learning trajectory
RobinSchmid7 Sep 1, 2023
9030cd2
:Merge branch 'dev/repair_develop' of github.com:leggedrobotics/wild_…
RobinSchmid7 Sep 1, 2023
274768c
Robot changes
Sep 4, 2023
df1116f
Added replay function for wide angle camera
RobinSchmid7 Sep 4, 2023
d1a4044
Change visu color of overlay
RobinSchmid7 Sep 4, 2023
cf7e0d7
Update rviz layout
RobinSchmid7 Sep 4, 2023
9a43494
Merge branch 'dev/repair_develop' into dev/repair_develop_robot
RobinSchmid7 Sep 4, 2023
6a58467
Merge pull request #278 from leggedrobotics/dev/repair_develop_robot
RobinSchmid7 Sep 4, 2023
a5abfc9
New procman
JonasFrey96 Sep 5, 2023
5fab913
Change procman script
JonasFrey96 Sep 5, 2023
b8dd68f
Merge branch 'dev/repair_develop' of github.com:leggedrobotics/wild_v…
JonasFrey96 Sep 5, 2023
04a58b7
Add recording yaml
JonasFrey96 Sep 5, 2023
ce6f3b2
Remove unnecessary param
RobinSchmid7 Sep 6, 2023
e015a7d
Add missing dep, fix default overlay param, add procman replay, add r…
RobinSchmid7 Sep 6, 2023
4f72574
Fix overlay, fix elevation map semantic layer
RobinSchmid7 Sep 6, 2023
ecb4191
Add new rviz for dodo
RobinSchmid7 Sep 7, 2023
498d18f
Add semantic elevation map for anymal D config
RobinSchmid7 Sep 7, 2023
4430fd8
Add semantic elevation map for anymal D config
RobinSchmid7 Sep 7, 2023
4f2d0d6
Changed rviz
RobinSchmid7 Sep 7, 2023
4fe42cc
Changes from jetson
Sep 7, 2023
91fccea
Merge branch 'dev/repair_develop' of github.com:leggedrobotics/wild_v…
Sep 7, 2023
929beb2
Cleanup procman and yaml files
RobinSchmid7 Sep 8, 2023
8602f1d
Rechange color
RobinSchmid7 Sep 8, 2023
e32a91f
Fix running mean
RobinSchmid7 Sep 8, 2023
ad1a69b
Added moving average
RobinSchmid7 Sep 8, 2023
fa0c7cf
Added moving average
RobinSchmid7 Sep 8, 2023
892a2da
Fix running mean, change some configs
RobinSchmid7 Sep 11, 2023
e7e5e69
Fix running mean, change some configs
RobinSchmid7 Sep 11, 2023
f10882f
Add HDR cam to recording yaml file
Oct 6, 2023
144463b
Fix merge
Oct 6, 2023
fb9d35f
Change rviz config
RobinSchmid7 Dec 20, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions environment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,6 @@ dependencies:
- git+https://github.com/kornia/kornia#egg=kornia
- git+https://github.com/mmattamala/liegroups#egg=liegroups
- --editable git+https://github.com/leggedrobotics/stego.git#egg=stego==0.0.1
- pytictac
- prettytable
- termcolor
25 changes: 20 additions & 5 deletions scripts/dataset_generation/extract_binary_images_and_labels.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,11 @@ def do(n, dry_run):

valid_topics = ["/state_estimator/anymal_state", "/wide_angle_camera_front/img_out"]

rosbags = ["/home/rschmid/RosBags/6/images.bag",
"/home/rschmid/RosBags/6/2023-03-02-11-13-08_anymal-d020-lpc_mission_0.bag",
"/home/rschmid/RosBags/6/2023-03-02-11-13-08_anymal-d020-lpc_mission_1.bag"]
rosbags = [
"/home/rschmid/RosBags/6/images.bag",
"/home/rschmid/RosBags/6/2023-03-02-11-13-08_anymal-d020-lpc_mission_0.bag",
"/home/rschmid/RosBags/6/2023-03-02-11-13-08_anymal-d020-lpc_mission_1.bag",
]

output_bag_wvn = s + "_wvn.bag"
output_bag_tf = s + "_tf.bag"
Expand Down Expand Up @@ -115,7 +117,20 @@ def do(n, dry_run):
info_msg.distortion_model = "equidistant"
info_msg.D = [0.4316922809468283, 0.09279900476637248, -0.4010909691803734, 0.4756163338479413]
info_msg.K = [575.6050407221768, 0.0, 745.7312198525915, 0.0, 578.564849365178, 519.5207040671075, 0.0, 0.0, 1.0]
info_msg.P = [575.6050407221768, 0.0, 745.7312198525915, 0.0, 0.0, 578.564849365178, 519.5207040671075, 0.0, 0.0, 0.0, 1.0, 0.0]
info_msg.P = [
575.6050407221768,
0.0,
745.7312198525915,
0.0,
0.0,
578.564849365178,
519.5207040671075,
0.0,
0.0,
0.0,
1.0,
0.0,
]
info_msg.R = [1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0]

rosbag_info_dict = get_bag_info(output_bag_wvn)
Expand Down Expand Up @@ -150,7 +165,7 @@ def do(n, dry_run):

info_msg.header = msg.header
camera_options = {}
camera_options['name'] = "wide_angle_camera_front"
camera_options["name"] = "wide_angle_camera_front"
camera_options["use_for_training"] = True

info_msg.header = msg.header
Expand Down
24 changes: 21 additions & 3 deletions wild_visual_navigation/cfg/experiment_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,18 @@ class LossParams:
w_reco: float = 0.5
w_temp: float = 0.0 # 0.75
method: str = "latest_measurment"
confidence_std_factor: float = 1.0
confidence_std_factor: float = 0.5
trav_cross_entropy: bool = False

loss: LossParams = LossParams()

@dataclass
class LossAnomalyParams:
method: str = "running_mean" # "latest_measurment", "running_mean", "moving_average"
confidence_std_factor: float = 0.5

loss_anomaly: LossAnomalyParams = LossAnomalyParams()

@dataclass
class TrainerParams:
precision: int = 32
Expand Down Expand Up @@ -84,12 +91,12 @@ class AblationDataModuleParams:

@dataclass
class ModelParams:
name: str = "SimpleMLP"
name: str = "LinearRnvp" # LinearRnvp, SimpleMLP, SimpleGCN, DoubleMLP
load_ckpt: Optional[str] = None

@dataclass
class SimpleMlpCfgParams:
input_size: int = 90
input_size: int = 384
hidden_sizes: List[int] = field(default_factory=lambda: [256, 32, 1])
reconstruction: bool = True

Expand All @@ -110,6 +117,17 @@ class SimpleGcnCfgParams:

simple_gcn_cfg: SimpleGcnCfgParams = SimpleGcnCfgParams()

@dataclass
class LinearRnvpCfgParams:
input_dim: int = 384
coupling_topology: List[int] = field(default_factory=lambda: [200])
mask_type: str = "odds"
conditioning_size: int = 0
use_permutation: bool = True
single_function: bool = False

linear_rnvp_cfg: LinearRnvpCfgParams = LinearRnvpCfgParams()

model: ModelParams = ModelParams()

@dataclass
Expand Down
11 changes: 7 additions & 4 deletions wild_visual_navigation/feature_extractor/dino_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from omegaconf import DictConfig
from torchvision import transforms as T
from stego.src.train_segmentation import DinoFeaturizer
from kornia.filters import filter2d


class DinoInterface:
Expand All @@ -16,16 +17,19 @@ def __init__(
input_interp: str = "bilinear",
model_type: str = "vit_small",
patch_size: int = 8,
dim: int = 384,
projection_type: str = None, # nonlinear or None
dropout: bool = False, # True or False
):
self.dim = 90
self.dim = dim
self.cfg = DictConfig(
{
"dino_patch_size": patch_size,
"dino_feat_type": "feat",
"model_type": model_type,
"projection_type": "nonlinear",
"projection_type": projection_type,
"pretrained_weights": None,
"dropout": True,
"dropout": dropout,
}
)

Expand Down Expand Up @@ -136,7 +140,6 @@ def inference(self, img: torch.tensor, interpolate: bool = False):
pad = int((W - H) / 2)
features = F.interpolate(features, new_size, mode="bilinear", align_corners=True)
features = F.pad(features, pad=[pad, pad, 0, 0])

return features

@property
Expand Down
21 changes: 10 additions & 11 deletions wild_visual_navigation/feature_extractor/feature_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@

class FeatureExtractor:
def __init__(
self, device: str, segmentation_type: str = "slic", feature_type: str = "dino", input_size: int = 448, **kwargs
):
self, device: str, segmentation_type: str = "slic", feature_type: str = "dino", input_size: int = 448, **kwargs):
"""Feature extraction from image

Args:
Expand All @@ -40,7 +39,7 @@ def __init__(
elif self._feature_type == "dino":
self._feature_dim = 90

self.extractor = DinoInterface(device=device, input_size=input_size, patch_size=kwargs.get("patch_size", 8))
self.extractor = DinoInterface(device=device, input_size=input_size, patch_size=kwargs.get("patch_size", 8), dim=kwargs.get("dino_dim", 384))
elif self._feature_type == "sift":
self._feature_dim = 128
self.extractor = DenseSIFTDescriptor().to(device)
Expand All @@ -66,7 +65,7 @@ def __init__(
pass

def extract(self, img, **kwargs):
if kwargs.get("fast_random", False):
if self._segmentation_type == "random":
dense_feat = self.compute_features(img, None, None, **kwargs)

H, W = img.shape[2:]
Expand All @@ -83,16 +82,16 @@ def extract(self, img, **kwargs):
return None, feat, seg, None

# Compute segments, their centers, and edges connecting them (graph structure)
with Timer("feature_extractor - compute_segments"):
edges, seg, center = self.compute_segments(img, **kwargs)
# with Timer("feature_extractor - compute_segments"):
edges, seg, center = self.compute_segments(img, **kwargs)

# Compute features
with Timer("feature_extractor - compute_features"):
dense_feat = self.compute_features(img, seg, center, **kwargs)
# with Timer("feature_extractor - compute_features"):
dense_feat = self.compute_features(img, seg, center, **kwargs)

with Timer("feature_extractor - compute_features"):
# Sparsify features to match the centers if required
feat = self.sparsify_features(dense_feat, seg)
# with Timer("feature_extractor - compute_features"):
# Sparsify features to match the centers if required
feat = self.sparsify_features(dense_feat, seg)

if kwargs.get("return_dense_features", False):
return edges, feat, seg, center, dense_feat
Expand Down
1 change: 1 addition & 0 deletions wild_visual_navigation/learning/model/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from .simple_mlp import SimpleMLP, DoubleMLP
from .simple_gcn import SimpleGCN
from .linear_rnvp import LinearRnvp
from .network_register import get_model
Loading
Loading