Clone wiki

TrafficIntelligence / Install and Use the Python Modules and Scripts

  • In order to program in Python and use the provided Python libraries, read the information on the PolyWikiTI.
  • The requirements of the Python tools (the required modules) are the following:
    • the essential modules are Matplotlib and Numpy
    • the following libraries are optional. They are necessary for (sometimes very) specific classes/functions:
      • Computer Vision (cvutils.py): OpenCV (to be installed from source preferrably), scikit-image
      • Statistics and machine learning (ml.py): scipy, scikit-learn
      • Moving object geometry (moving.py) and plotting shapely polygons (utils.py): shapely
      • Tabular data loading/processing (storage.py): pandas
      • Metadata (metadata.py): sqlalchemy
      • Optimization: munkres
    • You can install all required (essential and optional) using the python-requirements.txt file with pip: sudo -H pip3 install -r python-requirements.txt --upgrade.
  • Download the current reporitory version or clone (using mercurial, see the button at the top of the Source page and instructions on PolyWikiTI).
  • Installation can now be done using the provided setup.py or pip and more simply through the Makefile: $ sudo make installpython. Otherwise, if for example you do not have system installation rights (sudo), you should look into the PYTHONPATH environment variable (see again PolyWikiTI).
  • To test your installation, start a python interpreter (or even better, ipython) and try to import the cvutils and storage modules by typing the following:
>>> from trafficintelligence import cvutils
>>> from trafficintelligence import storage
  • The provided Python modules are in the subdirectory trafficintelligence and the executable scripts, e.g. display-trajectories.py or compute-homography.py, in the subdirectory scripts.

If there are no errors, you are all set and can start programming in Python using the provided libraries (see the other guides on the homepage).

Updated