Skip to content

Commit

Permalink
Add automatic configuration of model input given the selected features
Browse files Browse the repository at this point in the history
  • Loading branch information
mmattamala committed Feb 3, 2024
1 parent 5814cd0 commit b617745
Show file tree
Hide file tree
Showing 3 changed files with 230 additions and 204 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,3 @@ verbose: true

extraction_store_folder: "nan"
exp: "nan"
use_binary_only: true
14 changes: 9 additions & 5 deletions wild_visual_navigation_ros/scripts/wvn_feature_extractor_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ def __init__(self, node_name):
self._last_image_ts = rospy.get_time()
self._last_checkpoint_ts = rospy.get_time()

# Load model
self._model = get_model(self._params.model).to(self._ros_params.device)
self._model.eval()

# Setup modules
self._feature_extractor = FeatureExtractor(
self._ros_params.device,
Expand All @@ -55,6 +51,15 @@ def __init__(self, node_name):
slic_num_components=self._ros_params.slic_num_components,
)

# Load model
# We manually update the input size to the models depending on the chosen features
self._params.model.simple_mlp_cfg.input_size = self._feature_extractor.feature_dim
self._params.model.double_mlp_cfg.input_size = self._feature_extractor.feature_dim
self._params.model.simple_gcn_cfg.input_size = self._feature_extractor.feature_dim
self._params.model.linear_rnvp_cfg.input_size = self._feature_extractor.feature_dim
self._model = get_model(self._params.model).to(self._ros_params.device)
self._model.eval()

if not self.anomaly_detection:
self._confidence_generator = ConfidenceGenerator(
method=self._params.loss.method,
Expand Down Expand Up @@ -132,7 +137,6 @@ def setup_ros(self, setup_fully=True):
self._ros_params.camera_topics[cam]["name"] = cam

# Add to scheduler
rospy.logwarn(self._ros_params.camera_topics)
self._camera_scheduler.add_process(cam, self._ros_params.camera_topics[cam]["scheduler_weight"])

# Camera info
Expand Down
Loading

0 comments on commit b617745

Please sign in to comment.