| 10 | class CARLA_Data(Dataset): |
| 11 | |
| 12 | def __init__(self, root, data_folders, img_aug = False): |
| 13 | self.root = root |
| 14 | self.img_aug = img_aug |
| 15 | self._batch_read_number = 0 |
| 16 | |
| 17 | self.front_img = [] |
| 18 | self.x = [] |
| 19 | self.y = [] |
| 20 | self.command = [] |
| 21 | self.target_command = [] |
| 22 | self.target_gps = [] |
| 23 | self.theta = [] |
| 24 | self.speed = [] |
| 25 | |
| 26 | |
| 27 | self.value = [] |
| 28 | self.feature = [] |
| 29 | self.action = [] |
| 30 | self.action_mu = [] |
| 31 | self.action_sigma = [] |
| 32 | |
| 33 | self.future_x = [] |
| 34 | self.future_y = [] |
| 35 | self.future_theta = [] |
| 36 | |
| 37 | self.future_feature = [] |
| 38 | self.future_action = [] |
| 39 | self.future_action_mu = [] |
| 40 | self.future_action_sigma = [] |
| 41 | self.future_only_ap_brake = [] |
| 42 | |
| 43 | self.x_command = [] |
| 44 | self.y_command = [] |
| 45 | self.command = [] |
| 46 | self.only_ap_brake = [] |
| 47 | |
| 48 | for sub_root in data_folders: |
| 49 | data = np.load(os.path.join(sub_root, "packed_data.npy"), allow_pickle=True).item() |
| 50 | |
| 51 | self.x_command += data['x_target'] |
| 52 | self.y_command += data['y_target'] |
| 53 | self.command += data['target_command'] |
| 54 | |
| 55 | self.front_img += data['front_img'] |
| 56 | self.x += data['input_x'] |
| 57 | self.y += data['input_y'] |
| 58 | self.theta += data['input_theta'] |
| 59 | self.speed += data['speed'] |
| 60 | |
| 61 | self.future_x += data['future_x'] |
| 62 | self.future_y += data['future_y'] |
| 63 | self.future_theta += data['future_theta'] |
| 64 | |
| 65 | self.future_feature += data['future_feature'] |
| 66 | self.future_action += data['future_action'] |
| 67 | self.future_action_mu += data['future_action_mu'] |
| 68 | self.future_action_sigma += data['future_action_sigma'] |
| 69 | self.future_only_ap_brake += data['future_only_ap_brake'] |