Skip to content
Code for "Automated crater detection on Mars using Deep Learning"
Jupyter Notebook Python TeX Other
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

DeepMars - Mars Crater Counting Through Deep Learning

DeepMars is a TensorFLow based pipeline for training a UNET to recognize craters on Mars, and determine their location and radius using a circle matching algorithm.

Getting Started


The Crater Detection Algorithm uses a trained neural network to detect ring structures from Digital Elevation Models (DEM) of Mars. Once these ring structures are found a Fourier based template matching algorithm identifies the circles and determines their position and size based on the image parameters. The code to train the neural network is also included - In the included code about 30,000 images of craters on Mars are used, along with the Robbins and Hynek (2012) crater list to train the CNN to identify craters as ring structures.


DeepMars requires the follows

  • Python version 2.7 or 3.5+, tested on 3.6
  • Cartopy >= 0.14.2. Cartopy itself has a number of dependencies, including the GEOS and Proj.4.x libraries. (For Ubuntu systems, these can be installed through the libgeos++-dev and libproj-dev packages, respectively.)
  • h5py >= 2.6.0
  • Keras 1.2.2 (documentation); also tested with Keras >= 2.0.2
  • Numpy >= 1.12
  • OpenCV >=
  • Pandas >= 0.19.1
  • Pillow >= 3.1.2
  • PyTables >=3.4.2
  • TensorFlow 0.10.0rc0, also tested with TensorFlow >= 1.0

Data Sources

Digital Elevation Models

We use the MOLA+HRSC combined DEM. The DEM is created from two partial DEMs of Mars and is intended to have 200m/pixel resolution. Approximately 45% of the DEM is at this resolution or higher, and the remainder is at the 400m/pixel resolution of MOLA. The source DEM at 16bit/pixel is used by the algorithm to retain the full topographic resolution.

Crater Catalogue

We use the Robbins and Hynek (2012) crater catalogue to provide the ground-truth / training data used in the CNN and for comparison with all of the craters found by the CDA. The catalogue is available as a comma separated file (CSV).

Running DeepMars

Each stage of the DeepMars pipeline has an executable script. deepmars/data/ creates the crater dataset by sampling the input DEM and crater catalogue and outputing randomly or systematically sampled craters in HDF5 files. deepmars/models/ trains the CNN using the created dataset, using either ring based algorithm and binary cross entropy or a disk based algorthim with intersection-over-union metrics. deepmars/models/ makes predictions from images using the CNN and template matching as needed, individual parts of the algorithm can be run on the whole dataset or single images for testing.


DeepMars is based on the DeepMoon CDA developed by Silburt et al [2019]. The core code is largely un-modified from DeepMoon. The main differences here are the the structure of the code, with clearer separation of functions in to files and adding arguments to executable code, the use of a 16 bit image inside Python instead of converting to 8-bit PNGs externally, and the addition of a disk finding algorithm and intersection-over-union metric.

Christopher Lee - Modifications and re-formatting for DeepMars eelsirhc

DeepMoon authours - Ari Silburt. Charles Zhu


Copyright 2018-2019 Christopher Lee, Ari Silburt, Charles Zhu and contributors.

You can’t perform that action at this time.