MCPcopy Create free account
hub / github.com/OpenDriveLab/ReSim / __init__

Method __init__

sat/data_multi.py:8–61  ·  view source on GitHub ↗
(self, data_dir, 
                 skip_frms_num=0, 
                 token_json=None, 
                 p_drop_traj=0.0,
                 p_drop_traj_carla=None,
                 prefix_prompt="",
                 prefix_prompt_carla=None,
                 scene_tensor_json_folder=None,
                 with_human_drive_token=False,  # * True for nuPlan and YouTube, False for Carla
                 **kwargs)

Source from the content-addressed store, hash-verified

6
7class MultiSourceDataset(Dataset):
8 def __init__(self, data_dir,
9 skip_frms_num=0,
10 token_json=None,
11 p_drop_traj=0.0,
12 p_drop_traj_carla=None,
13 prefix_prompt="",
14 prefix_prompt_carla=None,
15 scene_tensor_json_folder=None,
16 with_human_drive_token=False, # * True for nuPlan and YouTube, False for Carla
17 **kwargs):
18 # Initialize the appropriate dataset based on `data_dir` or other conditions
19 if "youtube" in data_dir.lower():
20 print("!!!Initializing YouTubeDataset!!!")
21 self.dataset = YouTubeDataset(
22 data_dir=data_dir,
23 prefix_prompt=prefix_prompt,
24
25 p_drop_traj=p_drop_traj,
26
27 with_human_drive_token=with_human_drive_token,
28 **kwargs
29 )
30 elif "navsim" in data_dir.lower():
31 print("!!!Initializing nuPlanDataset!!!")
32 self.dataset = nuPlanDataset(
33 data_dir=data_dir,
34 prefix_prompt=prefix_prompt,
35
36 p_drop_traj=p_drop_traj,
37
38 # * Only nuplan uses them.
39 skip_frms_num=skip_frms_num,
40 token_json=token_json,
41 scene_tensor_json_folder=scene_tensor_json_folder,
42 with_human_drive_token=with_human_drive_token,
43
44 **kwargs
45 )
46 elif "carla" in data_dir.lower():
47 print("!!!Initializing CarlaDataset!!!")
48 self.dataset = CarlaDataset(
49 data_dir=data_dir,
50 prefix_prompt=prefix_prompt_carla or prefix_prompt,
51
52
53 p_drop_traj=p_drop_traj_carla or p_drop_traj,
54
55
56 with_human_drive_token=False, # * Always False for Carla
57 **kwargs
58 )
59
60 else:
61 raise ValueError("Invalid data_dir: should contain either 'youtube' or 'nuplan'.")
62
63 # # Delegate attribute and method calls to the dataset instance
64 def __getattr__(self, name):

Callers

nothing calls this directly

Calls 4

YouTubeDatasetClass · 0.90
nuPlanDatasetClass · 0.90
CarlaDatasetClass · 0.90
printFunction · 0.50

Tested by

no test coverage detected