Skip to main content

Added pygdal to requirements

Project description

A collection of Machine Learning (ML) Tools for object detection and classification on DG imagery.

mltools is MIT licenced.

The purpose of this repository is to enable fast prototyping of object detection and classification solutions.

At the moment, there are four modules:

  • data_extractors: functions to get pixels from georeferenced imagery;

  • feature_extractors: functions to derive feature vectors;

  • crowdsourcing: interface with Tomnod to obtain training/test/target data and to write machine output to Tomnod DB;

  • json_tools: functions to manipulate json and geojson files.

A ML algorithm (MLA) is a class with train and classify/detect functions. At the moment, the repo contains the PolygonClassifier MLA which can classify a set of polygons overlayed on a DG image.

An MLA is typically employed in a script which: - retrieves training data from Tomnod - trains the MLA - tests the MLA and computes accuracy metrics - deploys the MLA for detection or classification - writes the MLA results back to the Tomnod database.

Example scripts can be found under /examples.


Start with a fresh Ubuntu EC2 instance:

sudo apt-get update

sudo apt-get upgrade

sudo apt-get install git python-virtualenv libpq-dev python-dev libatlas-base-dev gfortran libfreetype6-dev libpng-dev

Install GDAL drivers:

sudo apt-get install gdal-bin

sudo apt-get install libgdal-dev

Note: This should install gdal version 1.10.1 for which pygdal will work. Confirm that this is the case with the command:

gdal-config –version

If for whatever reason you have another version of gdal you might run into problems.

Create a python virtual environment in your project directory:

cd my_project

virtualenv venv

. venv/bin/activate

Install GDAL:

pip install GDAL==$(gdal-config –version) –global-option=build_ext –global-option=”-I/usr/include/gdal”

Install mltools:

pip install mltools

You can now use the scripts found in /examples or create your own. Keep in mind that the imagery has to be in your project folder. Imagery in the format required by a MLA (e.g., pansharpened, multi-spectral or orthorectified) can be obtained with the gbdxtools package ( You need GBDX credentials to use gbdxtools.


Clone the repo:

git clone

cd mltools

virtualenv venv

. venv/bin/activate

Generate key:

ssh-keygen -t rsa

more .ssh/

Copy this key to deploy keys for the mltools repo.

Install the requirements:

pip install -r requirements.txt


mltools is developed as part of an effort to standardize MLA design and implementation.

Here is a slide with some ideas:

The vision is to employ MLA as part of a Crowd+Machine system along the lines of this document:

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mltools-1.0.1.tar.gz (9.3 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page