| import json |
| import matplotlib.pyplot as plt |
|
|
| |
| with open('action_val.json', 'r') as file: |
| data = json.load(file) |
|
|
| |
| scene_data = data[1] |
| action_pred = scene_data["action_pred"] |
| action_gt = scene_data["action_gt"] |
|
|
| |
| pred_steering_angles = [a[0] for a in action_pred] |
| pred_speeds = [a[1] for a in action_pred] |
|
|
| gt_steering_angles = [a[0] for a in action_gt] |
| gt_speeds = [a[1] for a in action_gt] |
|
|
| |
| plt.figure(figsize=(12, 5)) |
|
|
| |
| plt.subplot(1, 2, 1) |
| plt.plot(pred_steering_angles, label='Predicted Steering Angle', color='blue', marker='o') |
| plt.plot(gt_steering_angles, label='Ground Truth Steering Angle', color='orange', marker='o') |
| plt.title("Steering Angle") |
| plt.xlabel("Time Step") |
| plt.ylabel("Angle") |
| plt.legend() |
|
|
| |
| plt.subplot(1, 2, 2) |
| plt.plot(pred_speeds, label='Predicted Speed', color='blue', marker='o') |
| plt.plot(gt_speeds, label='Ground Truth Speed', color='orange', marker='o') |
| plt.title("Speed") |
| plt.xlabel("Time Step") |
| plt.ylabel("Speed") |
| plt.legend() |
|
|
| plt.tight_layout() |
| plt.savefig('val.jpg') |
|
|