display_zones_info.py 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. # main imports
  2. import os, sys
  3. import argparse
  4. import pickle
  5. import numpy as np
  6. # processing imports
  7. import matplotlib.pyplot as plt
  8. # modules imports
  9. sys.path.insert(0, '') # trick to enable import of main folder module
  10. import custom_config as cfg
  11. from modules.utils import data as dt
  12. def main():
  13. parser = argparse.ArgumentParser(description="Compute and prepare data augmentation of scenes")
  14. parser.add_argument('--data', type=str, help="object filename saved using pickle", required=True)
  15. parser.add_argument('--scene', type=str, help="scene name to display click information", required=True, choices=cfg.scenes_names)
  16. args = parser.parse_args()
  17. p_data = args.data
  18. p_scene = args.scene
  19. # load data extracted by zones
  20. fileObject = open(p_data, 'rb')
  21. scenes_data = pickle.load(fileObject)
  22. scene_data = scenes_data[p_scene]
  23. # set title and zone axis
  24. plt.title(p_scene, 'with data :', p_data)
  25. for x_i, x in enumerate(cfg.zone_coodinates):
  26. plt.plot([x_i * 200, x_i * 200], [0, 800], color='red')
  27. for y_i, y in enumerate(cfg.zone_coodinates):
  28. plt.plot([0, 800], [y_i * 200, y_i * 200], color='red')
  29. x_points = []
  30. y_points = []
  31. for index, zone in scene_data.items():
  32. x_points = np.append(x_points, zone['x'])
  33. y_points = np.append(y_points, zone['y'])
  34. plt.scatter(x_points, y_points)
  35. plt.show()
  36. if __name__== "__main__":
  37. main()