Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ The toolbox supports the most comprehensive 6 datasets \& benchmarks and 10+ pop
The toolbox supports the most advanced high-quality navigation dataset, InternData-N1, which includes 3k+ scenes and 830k VLN data covering diverse embodiments and scenes, and the first dual-system navigation foundation model with leading performance on all the benchmarks and zero-shot generalization capability in the real world, InternVLA-N1.

## 🔥
- [2025/10] Add a simple [inference-only demo](scripts/eval/inference_only_demo.ipynb) of InternVLA-N1.
- [2025/10] Add a simple [inference-only demo](scripts/notebooks/inference_only_demo.ipynb) of InternVLA-N1.
- [2025/10] InternVLA-N1 [technique report](https://internrobotics.github.io/internvla-n1.github.io/static/pdfs/InternVLA_N1.pdf) is released. Please check our [homepage](https://internrobotics.github.io/internvla-n1.github.io/).
- [2025/09] Real-world deployment code of InternVLA-N1 is released.- [2025/09] Real-world deployment code of InternVLA-N1 is released.
- [2025/09] Real-world deployment code of InternVLA-N1 is released.
- [2025/07] We are hosting 🏆IROS 2025 Grand Challenge, stay tuned at [official website](https://internrobotics.shlab.org.cn/challenge/2025/).
- [2025/07] InternNav v0.1.1 released.

Expand Down
Binary file not shown.
Binary file not shown.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@
MAP_SHORTEST_PATH_WAYPOINT = 14

TOP_DOWN_MAP_COLORS = np.full((256, 3), 150, dtype=np.uint8)
TOP_DOWN_MAP_COLORS[15:] = cv2.applyColorMap(
np.arange(241, dtype=np.uint8), cv2.COLORMAP_JET
).squeeze(1)[:, ::-1]
TOP_DOWN_MAP_COLORS[15:] = cv2.applyColorMap(np.arange(241, dtype=np.uint8), cv2.COLORMAP_JET).squeeze(1)[:, ::-1]
TOP_DOWN_MAP_COLORS[MAP_INVALID_POINT] = [255, 255, 255] # White
TOP_DOWN_MAP_COLORS[MAP_VALID_POINT] = [150, 150, 150] # Light Grey
TOP_DOWN_MAP_COLORS[MAP_BORDER_INDICATOR] = [50, 50, 50] # Grey
Expand Down Expand Up @@ -73,9 +71,7 @@ def colorize_top_down_map(
# Only desaturate valid points as only valid points get revealed
desat_mask = top_down_map != MAP_INVALID_POINT

_map[desat_mask] = (
_map * fog_of_war_desat_values[fog_of_war_mask]
).astype(np.uint8)[desat_mask]
_map[desat_mask] = (_map * fog_of_war_desat_values[fog_of_war_mask]).astype(np.uint8)[desat_mask]

return _map

Expand Down Expand Up @@ -205,9 +201,7 @@ def draw_reference_path(
pt_from = pt_to

for pt in shortest_path_points:
drawpoint(
img, (pt[1], pt[0]), MAP_SHORTEST_PATH_WAYPOINT, meters_per_px
)
drawpoint(img, (pt[1], pt[0]), MAP_SHORTEST_PATH_WAYPOINT, meters_per_px)


def draw_straight_shortest_path_points(
Expand All @@ -219,10 +213,7 @@ def draw_straight_shortest_path_points(
"""Draws the shortest path from start to goal assuming a standard
discrete action space.
"""
shortest_path_points = [
habitat_maps.to_grid(p[2], p[0], img.shape[0:2], sim)[::-1]
for p in shortest_path_points
]
shortest_path_points = [habitat_maps.to_grid(p[2], p[0], img.shape[0:2], sim)[::-1] for p in shortest_path_points]

habitat_maps.draw_path(
img,
Expand All @@ -232,9 +223,7 @@ def draw_straight_shortest_path_points(
)


def draw_source_and_target(
img: np.ndarray, sim: Simulator, episode: VLNEpisode, meters_per_px: float
) -> None:
def draw_source_and_target(img: np.ndarray, sim: Simulator, episode: VLNEpisode, meters_per_px: float) -> None:
s_x, s_y = habitat_maps.to_grid(
episode.start_position[2],
episode.start_position[0],
Expand Down Expand Up @@ -285,18 +274,14 @@ def get_nearest_node(graph: nx.Graph, current_position: List[float]) -> str:
for node in graph:
node_pos = graph.nodes[node]["position"]
node_pos = np.take(node_pos, (0, 2))
cur_dist = np.linalg.norm(
np.array(node_pos) - np.array(current_position), ord=2
)
cur_dist = np.linalg.norm(np.array(node_pos) - np.array(current_position), ord=2)
if cur_dist < dist:
dist = cur_dist
nearest = node
return nearest


def update_nearest_node(
graph: nx.Graph, nearest_node: str, current_position: np.ndarray
) -> str:
def update_nearest_node(graph: nx.Graph, nearest_node: str, current_position: np.ndarray) -> str:
"""Determine the closest MP3D node to the agent's current position as
given by a [x,z] position vector. The selected node must be reachable
from the previous MP3D node as specified in the nav-graph edges.
Expand All @@ -309,9 +294,7 @@ def update_nearest_node(
for node in [nearest_node] + [e[1] for e in graph.edges(nearest_node)]:
node_pos = graph.nodes[node]["position"]
node_pos = np.take(node_pos, (0, 2))
cur_dist = np.linalg.norm(
np.array(node_pos) - np.array(current_position), ord=2
)
cur_dist = np.linalg.norm(np.array(node_pos) - np.array(current_position), ord=2)
if cur_dist < dist:
dist = cur_dist
nearest = node
Expand All @@ -325,18 +308,14 @@ def draw_mp3d_nodes(
graph: nx.Graph,
meters_per_px: float,
) -> None:
n = get_nearest_node(
graph, (episode.start_position[0], episode.start_position[2])
)
n = get_nearest_node(graph, (episode.start_position[0], episode.start_position[2]))
starting_height = graph.nodes[n]["position"][1]
for node in graph:
pos = graph.nodes[node]["position"]

# no obvious way to differentiate between floors. Use this for now.
if abs(pos[1] - starting_height) < 1.0:
r_x, r_y = habitat_maps.to_grid(
pos[2], pos[0], img.shape[0:2], sim
)
r_x, r_y = habitat_maps.to_grid(pos[2], pos[0], img.shape[0:2], sim)

# only paint if over a valid point
if img[r_x, r_y]:
Expand Down Expand Up @@ -388,4 +367,4 @@ def image_resize(
img = img.permute(0, 1, 3, 4, 2)
if no_batch_dim:
img = img.squeeze(dim=0) # Removes the batch dimension
return img
return img
Original file line number Diff line number Diff line change
@@ -1,23 +1,15 @@
import gzip
import json
import pickle
from typing import Any, List, Union

import numpy as np

# from dtw import dtw
# from fastdtw import fastdtw
# from habitat.config import Config
from habitat.core.dataset import Episode
from habitat.core.embodied_task import Action, EmbodiedTask, Measure
from habitat.core.logging import logger
from habitat.core.embodied_task import EmbodiedTask, Measure
from habitat.core.registry import registry
from habitat.core.simulator import Simulator
from habitat.core.utils import try_cv2_import
from habitat.tasks.nav.nav import DistanceToGoal, Success
from habitat.tasks.utils import cartesian_to_polar
from habitat.utils.geometry_utils import quaternion_rotate_vector
from habitat.utils.visualizations import fog_of_war
from habitat.utils.visualizations import maps as habitat_maps
from habitat.tasks.nav.nav import DistanceToGoal
from numpy import ndarray

# from utils import maps
Expand All @@ -26,9 +18,7 @@
cv2 = try_cv2_import()


def euclidean_distance(
pos_a: Union[List[float], ndarray], pos_b: Union[List[float], ndarray]
) -> float:
def euclidean_distance(pos_a: Union[List[float], ndarray], pos_b: Union[List[float], ndarray]) -> float:
return np.linalg.norm(np.array(pos_b) - np.array(pos_a), ord=2)


Expand All @@ -54,9 +44,7 @@ def reset_metric(self, *args: Any, **kwargs: Any):

def update_metric(self, *args: Any, **kwargs: Any):
current_position = self._sim.get_agent_state().position
self._metric += euclidean_distance(
current_position, self._previous_position
)
self._metric += euclidean_distance(current_position, self._previous_position)
self._previous_position = current_position


Expand All @@ -73,16 +61,12 @@ def _get_uuid(self, *args: Any, **kwargs: Any) -> str:
return self.cls_uuid

def reset_metric(self, *args: Any, task: EmbodiedTask, **kwargs: Any):
task.measurements.check_measure_dependencies(
self.uuid, [DistanceToGoal.cls_uuid]
)
task.measurements.check_measure_dependencies(self.uuid, [DistanceToGoal.cls_uuid])
self._metric = float("inf")
self.update_metric(task=task)

def update_metric(self, *args: Any, task: EmbodiedTask, **kwargs: Any):
distance_to_target = task.measurements.measures[
DistanceToGoal.cls_uuid
].get_metric()
distance_to_target = task.measurements.measures[DistanceToGoal.cls_uuid].get_metric()
self._metric = min(self._metric, distance_to_target)


Expand All @@ -105,9 +89,7 @@ def _get_uuid(self, *args: Any, **kwargs: Any) -> str:
return self.cls_uuid

def reset_metric(self, *args: Any, task: EmbodiedTask, **kwargs: Any):
task.measurements.check_measure_dependencies(
self.uuid, [DistanceToGoal.cls_uuid]
)
task.measurements.check_measure_dependencies(self.uuid, [DistanceToGoal.cls_uuid])
self._metric = 0.0
self.update_metric(task=task)

Expand Down
Loading