Mars craters detection and classification
Current events on this problem

RAMP on Mars craters detection

Alexandre Boucaud (CDS), Joris van den Bossche (CDS), Balazs Kegl (CDS), Frédéric Schmidt (GEOPS), Anthony Lagain (GEOPS)


Impact craters in planetary science are used to date planetary surfaces, to characterize surface processes and to study the upper crust of terrestrial bodies in our Solar System (Melosh, 1989). Thanks to the Martian crater morphology, a wide amount of information could be deduced on the geological history of Mars, as for example the evolution of the surface erosion rate, the presence of liquid water in the past, the volcanic episodes or the volatiles layer in the subsurface (Carr & Head, 2010). These studies are widely facilitated by the availability of reference crater databases.

Surveying impact craters is therefore an important task which traditionally has been achieved by means of visual inspection of images. The enormous number of craters smaller than one kilometer in diameter, present on high resolution images, makes visual counting of such craters impractical. In order to overcome this problem, several algorithms have been developed to automatically detect impact structures on planetary images (Bandeira et al., 2007 ; Martins et al., 2009). Nevertheless, these methods allow to detect only 70-80 % of craters (Urbach & Stepinski, 2009).

The prediction task

This challenge proposes to design the best algorithm to detect crater position and size starting from the most complete Martian crater database containing 384 584 verified impact structures larger than one kilometer of diameter (Lagain et al. 2017). We give to the users a subset of this large dataset in order to test and calibrate their algorithms.

Example of THEMIS reprojected data

We provide THEMIS nightime dataset (Christensen et al., 2003) already projected to avoid distortion, sampled at various scales and positions in form 224x224 pixels images. Using an appropriate metric, we will compare the true solution to the estimation. The goal is to provide detection of more than 90% (crater center and diameter) with a minimum number of wrong detection.


  1. Bandeira, L.; Saraiva, J. & Pina, P., Impact Crater Recognition on Mars Based on a Probability Volume Created by Template Matching, IEEE Transactions on Geoscience and Remote Sensing, Institute of Electrical and Electronics Engineers (IEEE), 2007, 45, 4008-4015

  2. Carr, M. H. and Head, J. W. III. (2010) Geologic history of Mars. Earth and Planetary Science Letters, 294, 185-203.

  3. Christensen, P. R.; Bandfield, J. L.; Bell, J. F.; Gorelick, N.; Hamilton, V. E.; Ivanov, A.; Jakosky, B. M.; Kieffer, H. H.; Lane, M. D.; Malin, M. C.; McConnochie, T.; McEwen, A. S.; McSween, H. Y.; Mehall, G. L.; Moersch, J. E.; Nealson, K. H.; Rice, J. W.; Richardson, M. I.; Ruff, S. W.; Smith, M. D.; Titus, T. N. & Wyatt, M. B., Morphology and Composition of the Surface of Mars: Mars Odyssey THEMIS Results, Science, 2003, 300, 2056-2061

  4. Lagain, A., Marmo, C., Delaa, O., Bouley, S., Baratoux, D., Costard, F. et al. (2017) Martian crater database: 1. Reviewing and adapting to surface ages measurement. Submission to the Journal of Geophysical Research planned to November 2017.

  5. Martins, R.; Pina, P.; Marques, J.S & Silveira, M., Crater Detection by a Boosting Approach, IEEE Geoscience and Remote Sensing Letters, Institute of Electrical and Electronics Engineers (IEEE), 2009, 6, 127-131

  6. Melosh, H. J. (1989) Impact cratering: a geologic process. Oxford University Press.

  7. Urbach, E. and Stepinski, T. (2009) Automatic detection of sub-km craters in high resolution planetary images. Planetary and Space Science, 57, 880-887.


From raw data to local quadrangles

The full THEMIS map of Mars has been saved in a cylindrical projection. Raw visualization of the full map is thus quite difficult.

Raw THEMIS data

In order to correct for the distortions and recover the circularity of the craters, the map has to be reprojected locally. For that, we use a partitions known as quadrangles. 140 quadrangles are used to cover the whole Mars surface from which we selected some (the colored quadrangles) for this exercice.

Longitude vs latitude quadrangle division in the raw THEMIS projection.
Challenge datasets have been constructed using random patches from these quadrangles.
Numbers indicate quadrangle IDs and colors refer to the train/test and public/private distinction.

We use the boundaries of the quadrangle to extract the relevant pixels from the raw THEMIS map (above). Here we choose the quadrangle #77, close to the equator, and thus only slightly distorted.

Quadrangle 77

Then we reproject the pixels to the local stereographic projection in order to correct for the distortions. The result can be seen below.

Quadrangle 77 reprojected

For illustration, we use the crater database to project the labeled craters per category on the reprojected map.

Quadrangle 77 reprojected with labelled craters

From quadrangles to input data

After selecting a common shape for the input of image processing models 224x224, we start from the reprojected quadrangles and decide to create the patches from a tiling with overlap to cover the craters falling on the edges. The tiling is also performed on downsampled versions of the quadrangles, until all craters can be detected for all sizes of craters present. With the current set up, the craters contained in every image have radii that span the range of 5 to 28 pixels.

With no further do, let's have a look at the data.

Required dependencies and downloads

Installation of libraries and ramp-workflow

To get this notebook running and test your models locally using the ramp_test_submission, we recommend that you use the Python distribution from Anaconda or Miniconda.

In [1]:
# !conda env create -f environment.yml   # use the environment.yml file to create the 'mars-craters' env
# !source activate mars-craters          # activate the virtual environment

OR if you have Python already installed but are not using Anaconda, you'll want to use pip

In [2]:
# !pip install -r requirements.txt

Download script (optional)

If the data has not yet been downloaded locally, uncomment the following cell and run it.

There are ~700Mb of images.

In [3]:
# !python

The input data

In [4]:
from __future__ import division, print_function

import os
import numpy as np
import pandas as pd
import rampwf as rw

import matplotlib.pyplot as plt
from matplotlib import cm
from matplotlib.patches import Circle
%matplotlib inline
In [6]:
X_train = np.load('data/data_train.npy', mmap_mode='r')

print("The training data is made of {} images of {}x{} pixels".format(

n_img = len(X_train)
The training data is made of 9000 images of 224x224 pixels

Here we display 3 randomly select images. You can play around with the values.

In [11]:
idx_list = [30, 3470, 7030]
In [12]:
fig, axes = plt.subplots(ncols=3, figsize=(15, 5))
for i, idx in enumerate(idx_list):
    axes[i].imshow(X_train[idx], cmap='Greys_r')
    axes[i].set_title('%d' % idx)

Most images have some craters but we only label a crater if their diameter is superior to 10 pixels.

In [13]:
y_train = pd.read_csv('data/labels_train.csv')
In [14]:
i row_p col_p radius_p
0 0 154.0 51.0 15.75
1 2 46.0 47.0 6.70
2 2 85.0 176.0 5.15
3 2 21.0 156.0 8.50
4 2 150.0 95.0 10.60

The labels consist of a pandas.DataFrame containing the list of craters. For each craters, the columns are

  • id: index of the image it belongs to
  • row_p, col_p : pixel position
  • radius_p : pixel radius

Let's visualize some.

In [15]:
fig, axes = plt.subplots(nrows=2, ncols=3, figsize=(15, 10))
for i, idx in enumerate(idx_list):
    img = X_train[idx]
    lab = y_train[y_train['i'] == idx][['row_p', 'col_p', 'radius_p']].values
    # First row images only
    axes[0, i].imshow(img, cmap='Greys_r')
    axes[0, i].set_title('%d' % idx)
    # Second row, labels overlaid on the image
    axes[1, i].imshow(img, cmap='Greys_r')
    if lab.size != 0:
        for y, x, radius in lab:
            crater = Circle((x, y), radius, color='r', ec=None, alpha=0.5)
            axes[1, i].add_patch(crater)