Python Crater Detection Algorithm (PyCDA) is a pipeline for crater detection; go from image to annotated crater stats in minutes.

crater, detection, astronomy, astrophysics, cda, crater-detection, machine-learning, neural-network, planetary, pre-alpha, pypi, python, science
pip install pycda==0.1.16


PyCDA: Simple Crater Detection

Go from image to crater annotations in minutes.

PyCDA is a crater detection algorithm (CDA) written in Python.

Inspired by research in applying convolutional neural networks to crater detection (Benedix et al.) and crater candidate classification (Cohen et al.), PyCDA is aimed at making CDA research modular and usable.

The current release, pre-alpha "fun" 0.1.14, is a conceptual demonstration; its general performance on some datasets is too poor for use; however, it will yield crater detections.

Getting Started

At its most basic level, PyCDA is built to be easy to use, and that should start with installation; pre-alpha "fun" version 0.1.14 is now available via PyPI with:

pip install pycda


PyCDA currently supports Python 3.6; we recommend using a virtual environment or environment manager such as conda, as PyCDA has not been tested on previous versions of its dependencies.


PyCDA's current release, "fun" 0.1.14, is a prototype pre-release. However, it is available for download via PyPi for the adventurous. From your python 3.6 environment, install with pip via the command line:

pip install pycda

Using PyCDA

For a quick prediction "out of the box," use the commands:

from pycda import CDA, load_image

cda = CDA()
image = load_image('my_image_filepath.png')
detections = cda.predict(image)

The output of the call to .predict is a pandas dataframe, with columns 'lat' (crater location from top of image), 'long' (crater location from left edge of image), and diameter' (crater diameter in pixels).

PyCDA currently handles image using PIL; image files from disc must therefore be in the formats that PIL supports. Numpy arrays of raster images are also supported; pass them in as you would an image object.

PyCDA provides visualization and error analysis tools as well; check out the demo notebook for a peek at these features!

Documentation on the entire project is available here.

Running the tests

Test your installation with, available from this repo. With wget:


Then, run



PyCDA follows something like SemVer guidelines, the current release is "fun" 0.1.14 and is still in early development. I fixed the data file loading issues that came with 'super top secret pre-alpha release 0.1.1', and we finally have something that does something "out of the box."



PyCDA is a community project and we welcome anybody in the CDA research community, planetary scientists, or Python developers to the fold. Please reach out to Michael Klear at:


to contribute!


This project is licensed under the MIT License - see the file for details