diff --git a/metadrive/base_class/base_object.py b/metadrive/base_class/base_object.py index 7fa20f663..bc2f886fc 100644 --- a/metadrive/base_class/base_object.py +++ b/metadrive/base_class/base_object.py @@ -8,10 +8,9 @@ from typing import Dict import numpy as np -import seaborn as sns from panda3d.bullet import BulletWorld, BulletBodyNode, BulletVehicle from panda3d.core import LVector3, NodePath, PandaNode -from metadrive.constants import Semantics, CameraTagStateKey +from metadrive.constants import Semantics, CameraTagStateKey, COLOR_PALETTE from metadrive.base_class.base_runnable import BaseRunnable from metadrive.constants import ObjectState from metadrive.engine.asset_loader import AssetLoader @@ -151,8 +150,8 @@ def __init__(self, name=None, random_seed=None, config=None, escape_random_seed_ self.loader.__init__() # add color setting for visualization - color = sns.color_palette("colorblind") - color.remove(color[2]) # Remove the green and leave it for special vehicle + color = COLOR_PALETTE.copy() + color.pop(2) # Remove the green and leave it for special vehicle idx = get_np_random().randint(len(color)) rand_c = color[idx] self._panda_color = rand_c diff --git a/metadrive/component/vehicle/base_vehicle.py b/metadrive/component/vehicle/base_vehicle.py index f6890b89a..642650d2f 100644 --- a/metadrive/component/vehicle/base_vehicle.py +++ b/metadrive/component/vehicle/base_vehicle.py @@ -4,7 +4,6 @@ from typing import Union, Optional import numpy as np -import seaborn as sns from panda3d._rplight import RPSpotLight from panda3d.bullet import BulletVehicle, BulletBoxShape, ZUp from panda3d.core import Material, Vec3, TransformState @@ -17,7 +16,7 @@ from metadrive.component.lane.straight_lane import StraightLane from metadrive.component.navigation_module.node_network_navigation import NodeNetworkNavigation from metadrive.component.pg_space import VehicleParameterSpace, ParameterSpace -from metadrive.constants import CamMask +from metadrive.constants import CamMask, COLOR_PALETTE from metadrive.constants import MetaDriveType, CollisionGroup from metadrive.constants import Semantics from metadrive.engine.asset_loader import AssetLoader @@ -992,7 +991,7 @@ def lane_index(self): def panda_color(self): c = super(BaseVehicle, self).panda_color if self._use_special_color: - color = sns.color_palette("colorblind") + color = COLOR_PALETTE rand_c = color[2] # A pretty green c = rand_c return c diff --git a/metadrive/constants.py b/metadrive/constants.py index 00f5cc5bd..55c84f28e 100644 --- a/metadrive/constants.py +++ b/metadrive/constants.py @@ -546,3 +546,15 @@ class CameraTagStateKey: DEFAULT_SENSOR_OFFSET = (0., 0.8, 1.5) DEFAULT_SENSOR_HPR = (0., 0.0, 0.0) + +COLOR_PALETTE = [(0.00392156862745098, 0.45098039215686275, 0.6980392156862745), + (0.8705882352941177, 0.5607843137254902, 0.0196078431372549), + (0.00784313725490196, 0.6196078431372549, 0.45098039215686275), + (0.8352941176470589, 0.3686274509803922, 0.0), + (0.8, 0.47058823529411764, 0.7372549019607844), + (0.792156862745098, 0.5686274509803921, 0.3803921568627451), + (0.984313725490196, 0.6862745098039216, 0.8941176470588236), + (0.5803921568627451, 0.5803921568627451, 0.5803921568627451), + (0.9254901960784314, 0.8823529411764706, 0.2), + (0.33725490196078434, 0.7058823529411765, 0.9137254901960784)] + diff --git a/metadrive/tests/test_env/test_metadrive_env.py b/metadrive/tests/test_env/test_metadrive_env.py index 0a140753d..73a8fa567 100644 --- a/metadrive/tests/test_env/test_metadrive_env.py +++ b/metadrive/tests/test_env/test_metadrive_env.py @@ -1,12 +1,11 @@ import copy -import seaborn as sns import os import numpy as np import pytest from metadrive import MetaDriveEnv -from metadrive.constants import TerminationState +from metadrive.constants import TerminationState, COLOR_PALETTE # Key: scenario name, value: environmental config blackbox_test_configs = dict( @@ -60,7 +59,7 @@ def test_pgdrive_env_blackbox(config): env = MetaDriveEnv(config=cfg) try: obs, _ = env.reset() - assert env.agent.panda_color == sns.color_palette("colorblind")[2] + assert env.agent.panda_color == COLOR_PALETTE[2] assert env.observation_space.contains(obs) _act(env, env.action_space.sample()) for x in [-1, 0, 1]: diff --git a/metadrive/tests/test_env/test_waymo_env.py b/metadrive/tests/test_env/test_waymo_env.py index f95085447..76372edec 100644 --- a/metadrive/tests/test_env/test_waymo_env.py +++ b/metadrive/tests/test_env/test_waymo_env.py @@ -1,7 +1,7 @@ import pytest -import seaborn as sns import numpy as np +from metadrive.constants import COLOR_PALETTE from metadrive.engine.asset_loader import AssetLoader from metadrive.envs.scenario_env import ScenarioEnv from metadrive.policy.idm_policy import TrajectoryIDMPolicy @@ -38,7 +38,7 @@ def test_waymo_env(policy, render=False, num_scenarios=3): if i == 999: raise ValueError("Can not arrive dest") - assert env.agent.panda_color == sns.color_palette("colorblind")[2] + assert env.agent.panda_color == COLOR_PALETTE[2] finally: env.close() diff --git a/setup.py b/setup.py index da5e82984..7b547baa5 100644 --- a/setup.py +++ b/setup.py @@ -45,7 +45,6 @@ def is_win(): "pygame", "tqdm", "yapf", - "seaborn", "tqdm", "progressbar", # "panda3d==1.10.8",