{'fraction_non_alphanumeric': 0.03323070908468944, 'fraction_numerical': 0.01883887992962909, 'mean_word_length': 4.661502282473371, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 2, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Lunar Crater Identification via Deep Learning

Crater counting on the Moon and other bodies is crucial to constrain the dynamical history of the Solar System. This has traditionally been done by visual inspection of images, thus limiting the scope, efficiency, and/or accuracy of retrieval. In this paper we demonstrate the viability of using convolutional neural networks (CNNs) to determine the positions and sizes of craters from Lunar digital elevation maps (DEMs). We recover 92% of craters from the human-generated test set and almost double the total number of crater detections. Of these new craters, 15% are smaller in diameter than the minimum crater size in the ground-truth dataset. Our median fractional longitude, latitude and radius errors are 11% or less, representing good agreement with the human-generated datasets. From a manual inspection of 361 new craters we estimate the false positive rate of new craters to be 11%. Moreover, our Moon-trained CNN performs well when tested on DEM images of Mercury, detecting a large fraction of craters in each map. Our results suggest that deep learning will be a useful tool for rapidly and automatically extracting craters on various Solar System bodies. We make our code and data publicly available at https://github.com/silburt/DeepMoon.git and https://doi.org/10.5281/zenodo.1133969 .


Introduction
Craters formed by small impactors constitute an important surface property for many bodies in the Solar System. On airless bodies like the Moon, Mercury, Ceres, and Vesta, weather based erosion, tectonics and volcanic activity have been largely non-existent resulting in the accumulation of impact craters over time. However, other eroding factors such as micrometeorite bombardment can affect smaller craters.
Crater densities permit the geological history of a body to be examined, and the relative chronology of a region to be assessed remotely. In addition, when in-situ samples are recovered from a body, absolute chronologies can be determined too. Inferred temporal variation in cratering rates have been used to make inferences about the dynamical history of the Solar System, including the (debated) possibility of a Late Heavy Bombardment, (e.g., Hartmann 1970;Ryder 2002;Gomes et al. 2005;Chapman et al. 2007;Bottke and Norman 2017). Crater records and chronology are thus central to any formation theory about the Solar System. In addition, the size distribution of craters directly probes the dynamics and size distribution of the impactor population (Strom et al., 2005). For example from the size distribution of craters on the Lunar highlands, Minton et al. (2015) argued that the impactor population contained comparatively fewer large bodies than the asteroid belt does today.
Traditionally, crater detection has been done manually via visual inspection of images. However this approach is not practical for the vast numbers of kilometre and sub-kilometre sized craters on the Moon (and other Solar System bodies), resulting in human-generated databases that are either spatially comprehensive but restricted to the largest craters, or size comprehensive but limited to a very specific geographic region Bandeira et al., 2012). In addition, manual crater counting by experts can yield disagreements as high as 40% (Greeley and Gault, 1970;Kirchoff et al., 2011;Robbins et al., 2014).
For example, Di et al. (2014) used a boosting algorithm to box the cratercontaining region, then a Hough transform to delimit the edges of the crater. Boukercha et al. (2014) used a similar approach where an initial detection algorithm provided crater candidates which were subsequently classified as true or false positives by a support-vector machine or polynomial classifier.
These CDAs tend to perform well on the datasets upon which they were trained, but not to generalize well on unseen patches or other bodies (see Stepinski et al. (2012) for a review and Chung et al. (2014) for a comparison between classical and machine learning based techniques.). The difficulty in designing robust CDAs stems from the complex nature of craters, having large variations in shape and illumination, orders of magnitude size differences, overlap and degradation. An algorithm capable of universally identifying craters on Solar System bodies would be invaluable to the community.
In this work we train a deep learning architecture known as a convolutional neural network (CNN) to perform crater identification 1 on Lunar digital elevation map (DEM) images, and transfer-learn our Moon-trained CNN to identify craters on Mercury. There are numerous reasons for using CNNs to detect craters. First, CNNs have demonstrated impressive performance on a variety of computer vision problems and other datasets where features are correlated (e.g. Long et al., 2015), demonstrating their versatility. This includes, in addition to images, sounds and signals. Second, CNNs engineer their own representation features, alleviating the need for a human to develop sophisticated pre-processing algorithms and custom input features. Finally, CNNs have been able to successfully classify objects that appear at multiple scales in a single image (Zhang et al., 2016;Zeng et al., 2017), a property very relevant to crater counting.

Methods
The code to generate the data set (Section 2.1), train our model (Section 2.7), and extract the resulting crater distribution (Section 2.4 and Section 2.5) is available at https://github.com/silburt/DeepMoon.git. The data used to train, validate and test our model, the global DEM used to make our input images, our best model and final test set crater distribution can be found at https://doi.org/10.5281/zenodo.1133969. We use Keras (Chollet, 2015) version 1.2.2 with Tensorflow (Abadi et al., 2016) version 0.10 to build and train our model, but our code is also compatible with Keras 2.0.2 and Tensorflow 1.0.

Data Preparation
Our input data was generated by randomly cropping digital elevation map (DEM) images from the Lunar Reconnaisance Orbiter (LRO) and Kaguya merged digital elevation model, which spans ±60 degrees in latitude (and the full range in longitude) and has a resolution of 512 pixels/degree, or 59 m/pixel (Barker et al. 2016;available at LOLA Team and Kaguya Team 2015). This global grayscale map is a Plate Carree projection with a resolution of 184320 × 61440 pixels and a bit depth of 16 bits/pixel; we downsampled it to 92160 × 30720 pixels and 8 bits/pixel. We use an elevation map, rather than an optical one, because a crater's appearance in an elevation map is not affected by the direction of incident sunlight. This reduces variation in appearance between craters, making it easier to train a CNN to identify them.
Each input DEM image is generated by a) randomly cropping a square area of the global map, b) downsampling the cropped image to 256 × 256 pixels, c) transforming the image to an orthographic projection using the Cartopy Python package (UK Met. Office, 2015) in order to minimize image distortion, and d) linearly rescaling image intensity to boost contrast.
The position of the cropped region in a) is randomly selected with a uniform distribution, and its length is randomly selected from a log-uniform distribution with minimum and maximum bounds of 500 and 6500 pixels (59 km and 770 km), respectively. The transformation in step c) for our input data often produces non-square images that are padded with zeros; these are the black bars on the sides of the Moon DEM in Figure 1. 2 For each input image, we generate a corresponding ground-truth "output target" that is also 256 × 256 pixels. Craters are encoded in the targets as rings with thicknesses of 1 pixel, and with radii and centers derived from craters' physical locations and diameters in the catalog, described below. All target pixel values are binary, including at ring intersections. Any craters with diameter D pix < 1 pix are excluded. We experimented with other target formats, including density maps, and binary and non-binary filled circles. We found, however, that out of all of these formats binary ring targets were best reproduced by the CNN, particularly for situations with many overlapping craters. While the rings highlight crater edges, the CNN still uses information about the interior of craters to generate the ring masks. We tested this on a limited sample following the method of Zeiler and Fergus (2013); Shallue and Vanderburg (2018) by perturbing the pixels of input DEMs, and found that we could prevent a crater detection by only increasing the pixels within its interior, without modifying its rim. This demonstrates that the interiors of craters are being used by our network.
The data used to construct the targets was obtained by merging two human-generated crater catalogs. For 5 − 20 km craters we used the global crater dataset assembled by Povilaitis et al. (2017) using the LRO Wide Angle Camera (WAC) Global Lunar DEM at 100 m/pixel (303 pixels/degree) resolution (GLD100; Scholten et al. 2012), and for > 20 km craters we used the global crater dataset assembled by Head et al. (2010) using the LOLA DEM with a resolution of 64 pixels/degree (472 m/pixel). Merging these two datasets in this way was intended by Povilaitis et al. (2017), who explicitly designed their dataset as a continuation of that of Head et al. (2010) to smaller sizes. The methods used to assemble these datasets are described in Head et al. (2010) and Povilaitis et al. (2017) and are typical for human generated datasets. 3 We split our input image/output target pairs into three separate datasets to be used for training, validating and testing our CNN (see Section 2.7 for their uses). The three datasets are sampled from equal sized and mutu- Our human-generated crater dataset is incomplete and contains many apparent missed identifications. Fassett et al. (2012) estimated an incompleteness of 12% for the Head et al. (2010) dataset. The incompleteness of the Povilaitis et al. (2017) dataset is unknown at this time, but appears to be comparable or higher. For the sample DEM image/target pair shown in Figure 1, we highlight features that appear to be craters but are missing from the Head et al. (2010) and Povilaitis et al. (2017) datasets as red circles in the right panel. It is unclear at this time why these craters were missed. In addition, the right panel of Figure 1 shows how our binary ring targets do not match the rims of non-circular craters. Together, these hinder the training of our CNN since genuine crater rims will be present in our dataset with no corresponding target rings, potentially confusing the CNN (see Section 4 for a discussion).

Convolutional Neural Networks (CNNs)
In this section we provide a brief, heuristic background to convolutional neural networks (CNNs) before introducing our network architecture. More in depth descriptions of the theory and mathematics of CNNs can be found in references such as Goodfellow et al. (2016) Chapter 9.
Machine learning algorithms in general can be thought of as universal function approximators, and neural networks (NNs) are a type of machine learning algorithm that uses "neurons" (loosely modelled after the human brain) to make such approximations. A neuron can be represented mathematically by: where x j are a set of input values that are linearly combined with a set of weights w j , and added to a bias offset b. This linear combination is then fed through a (typically non-linear) "activation function" f , which returns output y. Depending on the choice of f (z), where z = j w j x j +b, a neuron is able to represent a number of simple functions, eg. f (z) = z for a line, or f (z) = 1/ (1 + exp(−z)) for a sigmoid function. Varying the weights w j and bias b to best approximate a set of known y values given a corresponding set of x j values is thus equivalent to linear regression when f (z) is linear, and logistic regression when f (z) is sigmoidal.
A neural network contains sets, or layers, of neurons {y i }, where y i represents the output of the i-th neuron in the layer. Neurons within each layer are independent of one another, but different layers are stacked on top of one another, with the output of one layer serving as the input to the next. 4 Input data is fed into the first layer, while the network's "prediction", or predicted output target, comes from the last. A network is "trained" by tuning the weights of all neurons in all layers so that the network best approximates a set of known, or ground-truth, targets given corresponding input. This tuning is typically done via backpropagation (Rumelhart et al., 1986), and goodness of fit is defined through a loss function, e.g. mean squared error between the known targets and network predictions. Much like adding terms to a Taylor series, increasing the number of layers and/or the number of neurons per layer allows the network to approximate functions of increasing complexity. However, this added complexity comes at the cost of more tunable parameters and the potential for errors to be amplified from one layer to the next; both make network optimization more difficult.
In computer vision problems, the input is typically pixel intensities from images, while the target is typically either a single class label for the image or another array of pixel intensities. In the latter case (which used in this work), the approximated function is a mapping from one type of image to another. Since the input and output are two-dimensional, we may represent the neuron in the i-th row and j-th column of one layer as where, for the NN's first layer, x kl represents input image pixel intensities.
Classical NNs, however, place no restrictions on w ij,kl , and allow weights of different neurons in a layer to vary independently of one another. For images, this means any number of pixels in any orientation can be connected, and there is no guarantee the spatial information of the image is preserved from one layer to the next.
CNNs primarily differ from traditional NNs in that their neurons are only locally connected to the previous input volume ( LeCun et al., 1989), and layers are structured to perform a discrete convolution between their inputs and a kernel, or "filter", which is represented by the weights. In the context of Equation 2, this means w ij,kl is zero other than a few adjacent values of k, l, and the weights for one neuron are just index-shifted versions of the weights for another. Convolutional layers hence embed the spatial continuity of images directly into the architecture of the network. Also, since there are only a few non-zero weights that are shared between all the neurons, only a small number of weights need to be stored in memory and adjusted during training, simplifying network optimization. The weightsharing also exploits the property that weights useful to one section of an image might also be useful to another.
The main components of CNNs relevant to our work are convolutional layers, pooling layers, and merge layers. Convolutional layers, the primary component of a CNN, contain neurons that convolve an input with a filter in the manner described above. The output of this convolution (i.e. y ij in Equation 2) is called a "feature map". In practice, a single convolutional layer can contain a large number of filters, each acting on the layer's input to produce its own feature map. We make use of these "filter banks" in our In recent years CNNs have demonstrated impressive performance on image-related tasks, including classifying individual pixels (aka "segmentation" in computer vision terminology) (Long et al., 2015). A particularly successful network for pixel-wise classification (image to image mapping) is the UNET architecture (Ronneberger et al., 2015), which was originally designed for biomedical segmentation problems. A novel aspect of the UNET architecture is the use of numerous "skip connections" which merge deep and shallow layers together, providing both spatial and semantic classification information for future convolutions.

CNN Architecture
In this work we implement a custom version of the UNET architecture (Ronneberger et al., 2015), shown in Figure   For each set, its maps' dimensions are indicated on its lower left, and its number of maps are indicated above it. Half-grey boxes represent sets for which half of their maps are copied. The leftmost map is a 256 × 256 grayscale image sampled from the digital elevation map, and the rightmost the CNN's binary ring mask prediction. Arrows represent operations, specified by the legend -notably, blue arrows represent convolutions, while gray ones represent copying (skip connections).
The contracting and expansive paths each contain 3 convolutional blocks.
A block in the contracting path consists of two convolutional layers followed by a max-pooling layer with a 2x2 pool size. A block in the expansive path consists of a 2x2 upsampling layer, a concatenation with the corresponding block from the contracting path (i.e. a merge layer), a dropout layer (Srivastava et al., 2014), and two convolutional layers. The connecting path consists of two convolutional layers. Lastly, the final output layer is a 1x1 convolutional layer with a sigmoid activation and a single filter to output pixel-wise class scores. In the contracting path, each convolutional layer in blocks 1, 2 and 3 contain 112, 224 and 448 filters, respectively, while in the expansive path blocks 5, 6 and 7 contain 224, 122 and 122, respectively. Each convolutional layer in the connecting path contains 448 filters. Our CNN differs from the original UNET by the number of filters in each convolution layer (which we selected for the model to fit into GPU memory) and the use of dropout in the expansive path.

Crater Extraction
A 256 × 256 DEM image passed though the CNN will output a 256 × 256 target with activated pixels corresponding to the locations of the crater rims. However, the CNN does not explicitly extract crater position and size from these rims. Instead, this must be done separately using a custom pipeline that relies heavily on the match template algorithm from scikit-image (Van der Walt et al., 2014) 6 . This algorithm iteratively slides generated rings through the targets and calculates a match probability at each (x, y, r) coordinate where (x, y) is the centroid of the generated ring and r is the radius.
Our custom crater extraction pipeline is as follows. For each CNNpredicted target we apply a binary threshold B such that pixel intensities greater than B are set to 1 and those otherwise are set to 0. We then apply Scikit's match template algorithm over a radius range r min to r max and classify any (x,y,r) ring with a match probability greater than P m as a crater. Two craters i and j that fulfill the following criteria are flagged as duplicates if they satisfy both of the following conditions: where D x,y and D r are tunable hyperparameters. For duplicates we keep only the crater with the highest match probability P m . This process is repeated for all CNN-predicted targets.
As is standard practice in machine learning, our hyperparameters are tuned by measuring the performance of various combinations on the vali-6 Although template matching is an expensive technique done in a brute force manner we found it far more accurate than others including the Hough transform (Duda and Hart, 1972) and Canny edge detection (Canny, 1986) with enclosed circle fitting. dation data and picking the optimal set. After training our CNN (see Section 2.7), we perform a randomly sampled grid search of size 210 on the validation data over the following hyperparameter ranges: We find B = 0.1, P m = 0.5, D x,y = 1.8 and D r = 1.0 yields the optimal F 1 score (see Equation 9) of 0.74. We set r min = 5 to minimize errors (see Section 2.8) and set r max = 40.

Post-Processing
Since our dataset contains DEM images with a log-uniform distribution of magnifications and uniform distribution of locations, a single crater will appear on average in 120 ± 30 different DEM images. This increases the likelihood of detection but also yields many duplicates across targets which must be filtered. Therefore, in a final post-processing step we aggregate crater detections across all targets, convert from pixel coordinates to degrees and kilometers, and filter out duplicates.
Using the known properties of each DEM image, craters are converted from pixel coordinates (x, y, r) to degrees and kilometer coordinates (L, L, R): is a kilometer-to-degree conversion factor, where R Moon is the radius of the Moon in km.
We then employ a similar filtering strategy as Section 2.4, classifying craters i and j as duplicates if they satisfy both of the following conditions: where L = 1 2 (L i + L j ). D R and D L,L are hyperparameters which, like in We find D L,L = 2.6 and D R = 1.8 yields the optimal F 1 score (see Equation 9) of 0.67.

Accuracy Metrics
To train our network we use the pixel-wise binary cross-entropy, (Abadi et al., 2016;Chollet, 2015), a standard loss function used for segmentation problems: where z i is the ground-truth output target value of pixel i and x i is the CNN-predicted one.
To optimize the hyperparameters in our crater extraction and postprocessing routines (Sections 2.4 and 2.5) we use the precision, P , and recall, R, to measure accuracy, calculated according to: where T p are true positives, F p are false positives and F n are false negatives.
There is always a trade-off between precision and recall. For example, a machine that only classifies craters when extremely certain will have a high precision but low recall, while a machine that classifiers craters when only moderately certain will have a higher recall but lower precision. A common single-parameter metric that balances precision and recall is the F 1 score: Implicitly encoded into our accuracy metrics is the assumption that our ground-truth datasets of Head et al. (2010) and Povilaitis et al. (2017) are complete. However, as mentioned in Section 2.1 this is incorrect. As a result, genuine new craters identified by our CNN will be interpreted as false positives, penalizing these loss functions vs. improving them. This is an unavoidable consequence of using an incomplete ground truth (see Section 4 for further discussion).
To measure the accuracy of identified craters (Sections 2.4 and 2.5) we calculate the fractional errors in longitude, L, latitude, L, and radius, R, according to: where subscript P corresponds to our CNN-predicted craters, subscript G corresponds to our ground-truth craters and L = 1 2 (L P + L G ). Finally, our pipeline discovers thousands of new craters (as will be shown in Section 3). We measure the new crater percentage, P , according to: where N is the number of CNN-predicted craters without a corresponding match from the ground truth (i.e. they are either genuine new craters or false positives), and G is the number of ground-truth craters. A "match" between a CNN-predicted and ground-truth crater is determined via Eq. 3 and Eq. 6 for post-CNN (Section 2.4) and post-processed (Section 2.5) craters, respectively.

Training
A recurring theme in machine learning is "overfitting", which occurs when a model latches onto overly-complex and/or irrelevant features during training. Overfit models typically achieve high accuracy on the training set but low accuracy (poor generalization) on new data. Many algo-rithms control for overfitting by penalizing overly-complex models, retaining only the essential characteristics from the training data that will gener- The hyperparameters of our best model are weight regularization = 10 −5 , learning rate = 10 −4 , dropout = 15%, 3 × 3 filter sizes, and a depth of 3.

Errors
A few sources of error affect the final extracted (L, L, R) coordinates of each detected crater. First, craters can only be detected in pixel increments, and converting from pixels to degrees yields a quantization error, E q , of: where C offset ≤ 1 is a constant of order unity representing typical subpixel offsets. Setting C offset = 1, and considering our largest DEM images (6500 pixels) where ∆L ≈ 25 • , we find a maximum quantization error of E q ≈ 0.1 • , or ∼ 3 km. In principle this error could be reduced by increasing the pixel resolution of each DEM image, though doing so would be memory-intensive.
Second, objects within an orthographic projection become more distorted further from the central longitude and latitude (L 0 , L 0 ), which changes the size of smaller craters, and introduces non-circular deformations in larger ones. Along the central vertical axis, the deviation of the distorted radius from our estimated value using Equation 4 is For our largest DEM images, L − L 0 ≈ 12 • , F rd ≈ 1.02, so deviations are at most 2% of a crater's radius.
Third, the longitude and latitude estimates in Equation 4 neglect higher order terms (including the distortion described above) and cross-terms containing both L and L. To quantify this effect we passed the crater pixel positions from the ground-truth test dataset through Equation 4 to obtain L C and L C . We then subtracted the ground truth's longitude and latitude values from L C and L C , respectively, and normalized by the longitude/latitude extent of our DEM images. We found median relative offsets of 0.13% and 0.28% in longitude and latitude, but, for the largest DEM images, maximum relative offsets can reach 1.0% in longitude and 1.9% in latitude. For a 6500 pixel DEM image, this translates to 0.25 • in longitude and 0.5 • in latitude. We also calculated the fractional error using Equation 10, replacing L P and L P with L C and L C , and find median fractional errors of 3% in longitude and 5% in latitude.
To help offset these errors we impose a minimum search radius, r min = 5, for our crater extraction pipeline (Section 2.4). This prevents quantization and projection errors from ever being a significant fraction of the crater's radius. This comes at a cost of not being able to probe the smallest craters in each DEM image, yielding fewer new crater detections than we otherwise would obtain.

Crater Identification on the Moon
We apply our trained CNN and optimized crater identification pipeline on the test set and list our various accuracy metrics in Table 3.1 for the validation and test sets. "Post-CNN" statistics were generated on an imageby-image basis after Section 2.4 of the pipeline with an averaged mean and standard deviation taken across all predicted targets. "Post-processed" statistics were generated after Section 2.5 of the pipeline, and hence represent our final crater distribution after combining extracted craters from each target into one distribution and removing duplicates. Together, these statistics convey how our pipeline is performing at various stages.
The similarity between our validation and test set statistics in  Table 1: Accuracy metrics on the validation and test sets. "Post-CNN" statistics were generated after Section 2.4 of the pipeline with a mean and standard deviation taken across targets, while "post-processed" statistics were generated after Section 2.5 of the pipeline, after combining extracted craters into a single global distribution. Precision and recall are calculated according to Eq. 8, new crater percentage according to Eq. 11, fractional longitude, latitude and radius errors according to Eq. 10 with a median and interquartile range (IQR) taken across all detections. The false positive rate of new craters is estimated by four different scientists classifying 361 new craters and averaging the results. We note that precision drops at the post-processed stage because many new craters (absent in the ground truth) are identified. a discussion). Restricting to craters with a pixel radius r less than 15 pixels, our post-CNN test recall improves to 83% ± 16%. Wetzler et al. (2005) estimated a human recall of 75% when re-classifying crater images, making our post-CNN recall consistent with human performance for r < 15 pixels.  crater detections from our pipeline (without a corresponding ground-truth match), and purple circles represent ground-truth craters missed by our pipeline. As can be visually seen, our pipeline recovers many more craters than the ground truth, with overall few false positives and duplicates. Our median post-processed and post-CNN fractional errors in longitude, latitude and radius are 11% or less, representing overall good agreement with the ground truth despite the sources of error mentioned in Section 2.8.

Lunar Crater Size Distribution
In Figure 4 we show the cumulative size-frequency distribution (CSFD) of the craters recovered by our CNN as compared with the CSFD of craters in the human counted set. This is constructed following the recommendations in NASA Technical Memorandum (79730, 1978). In this case the surface area, A, used to normalise the number of craters is the area of the Moon between latitudes of 60 • North and South. We note that another widely used method to visualize crater distributions is R plots (as for example used in Head et al. (2010)), however we refrain from using these due to their significant dependency on data binning that can be completely avoided using CSFDs, where each crater is its own bin (Weaver et al., 2015).
As we can see, between roughly 5 and 20 km diameters the CNN de-

Post-Processed Craters
Ground-Truth Craters Moon DEM  Red is the human-generated test set (the ground truth), compared to what our CNN predicts postprocessing (blue). Our CNN recover the same slope as the GT for craters smaller than 20 km while detecting significantly more craters in this range. The shaded region inside 5 km however should not be physically interpreted due to data incompleteness. rived CSFD is systematically higher than the human derived CSFD, but runs essentially parallel to it. This indicates that while the CNN finds a substantially larger number of craters than the human crater counters, the craters newly identified by the CNN follow the same size distribution as the human identified craters, which reassures us that they are likely to be real.
At 20 km however there is a slight kink and upturn in the human dataset whereas the CNN prediction continues smoothly. The CNN prediction then curves downward gradually before cutting off more sharply at diameters of around 200 km, resulting in increasing divergence between the CNN prediction and the human classifications for these larger craters.
There are several factors that might contribute to the divergence between the CSFDs of the CNN prediction and the human classified dataset at large crater sizes. Firstly, as we describe in detail in Section 4, our CNN can struggle with identifying craters that have a radius of more than around 15 pixels in the input images. While this is somewhat ameliorated by sampling images at many different magnification levels (such that an r > 15 pix crater in one image will have r < 15 pix in another) it can still slightly hinder the detection of craters with diameters larger than around 50 km. This is likely responsible for some of the downward curvature of the CNN CSFD at larger sizes and is probably the cause of the cut-off at ∼200 km.
The location of the kink in the human classified CSFD at which the mismatch between the CNN prediction and the human classification begins is also notable. This kink appears at the boundary between the two compo-nent datasets of our human classified ground truth, that of Povilaitis et al. (2017) and Head et al. (2010). It is possible that there is a systematic difference between the crater classifications of the two groups. Indeed some level of difference would be unsurprising given the findings of Greeley and Gault (1970), Kirchoff et al. (2011) and Robbins et al. (2014). The systematic offset between the CSFDs of our CNN predictions and the human classifications in the range where the two are parallel already indicates that the human datasets are not complete, as was also found by Fassett et al. (2012) for the Head et al. (2010) dataset. Since the Povilaitis et al. (2017) dataset contains around four times as many craters it is inevitable that if there are any systematic differences in the human classification that lead to size-dependent completeness effects, the CNN will tend to follow Povilaitis et al. (2017).
Another consideration is that 20 km is roughly the diameter at which craters on the Moon transition from simple to complex (e.g. Pike, 1980;Grieve, 1981;Stoffler, 2006). Above this size crater morphologies change, with crater floors becoming flatter and the appearance of features like central peaks. It is conceivable that this morphological transition could hinder the detection of larger craters by the CNN. In particular, since smaller, simple craters dominate the human dataset, if the morphological differences make it difficult to simultaneously optimise to detect both simple and complex craters it is inevitable that the CNN will favour simple craters, just as it would favour Povilaitis et al. (2017) over Head et al. (2010) in the case of differences in their counting methods. In Section 4 we discuss how one could attempt to disentangle these possible effects.
Below around 5 km diameter the CNN prediction begins to roll over.
This is due to incompleteness in the sampling of the lunar surface at the smallest scales/largest image magnifications. Despite incompleteness in the sampling and the lack of craters in the training set at these small sizes the CNN still finds many craters <5 km diameter.

Transfer Learning on Mercury
Domain shift is a common problem in machine learning that arises when a model is used to predict on data with different properties than its training set, and typically results in decreased performance. We briefly evaluate the sensitivity to domain shift for our network by taking our Moon-trained CNN and transfer learning to Mercury. Mercury has different properties than the Moon, including a different gravitational acceleration, surface composition, terrain, and impact history. In addition, we also use the Mercury MES-SENGER Global DEM with a resolution of 64 pixel/degree, or 665 m/pixel (Becker et al. 2016; available at USGS Astrogeology Science Center 2016), which has different image properties than our Moon DEM. All these affect the distribution and appearance of impact craters.
To evaluate our CNN on Mercury, we prepared DEM images from the Mercury MESSENGER Global DEM in a similar manner as described in Section 2.1 (except that we do not use a corresponding human-generated crater catalog). We then passed these DEM images through our Moontrained CNN with no alterations to the architecture or weights. Figure 5 shows

Discussion
There are many reasons to believe our CNN has learned the complex features that define a crater. First, despite the Moon's large structure variations across its surface our CNN was able to recover 92% of craters on a face previously unseen by our CNN. Second, the similarity in accuracy metrics between the validation and test sets in  Figure 5).
As mentioned in Section 2.1 and shown in Figure 1, our training data is incomplete, containing many missed craters as well as target rings that differ from true crater rims. Despite these shortcomings our CNN was still able to understand our training objective and correlate the binary ring targets with the true rims of the craters. Proof of this can be seen in the middle panel of Figure 5, where some CNN-predictions are non-circular and better match the true crater rims than a circular ring could 7 . Together, these highlight the robustness and flexibility of deep learning solutions. Our CNN robustly detects craters from each DEM image with radii below 15 pixels, but tends to miss larger craters. An example of this can be seen in Figure 5, where a large crater with coordinates (x = 130, y = 78, r = 42 pix) is only partially recognized by the CNN and missed by our crater extraction pipeline. We believe that this largely stems from the scale that is imposed when using small 3x3 filters in our convolutional chain, yielding a receptive field that is too small for large craters. Larger filter sizes were attempted, but this dramatically increases both the number of trainable parameters and network size, making model-optimization more difficult.
Dilated Convolutions (Yu and Koltun, 2015), larger convolution strides, and/or deeper networks are possible avenues for improvement. However, increasing the receptive field likely accomplishes the same effect as reduc-ing the magnification of an image, which we have already shown to be a successful remedy, achieving a post-processed recall of 92% (see Table 3.1).
In addition, as we noted in Section 3.2, there are potential external effects that may be feeding into the apparent size dependence of the ability of the CNN to recover larger craters. One possibility is that there is a systematic difference in the two human counted datasets that we have stitched together to form our ground truth. Another is that the physical transition between simple and complex craters makes it difficult for the CNN to adapt to detect both with equal efficiency. In both cases the CNN would tend to adapt itself to better identify craters in the larger population, which is the Povilaitis et al. (2017) dataset that consists of craters below the ∼20 km simple to complex transition. To disentangle these two possible effects requires a uniformly generated human dataset of both simple and complex craters. We would then be able to train the CNN on DEMs of solely simple craters, solely complex craters, or both and then test it on DEMs of all physical scales/crater morphologies. This requires a substantial new human counting effort and so we leave it for future work.
Our estimated post-processed false positive rate of new craters is 11% ± 7%, which, although generally low, is likely too high for our catalog to be used to produce high-precision crater catalogs. Our primary false positives are a) ambiguous circular looking depressions that may or may not be true craters (further analysis required), and b) overlapping craters that activate enough pixels in the region to breach the match probability threshold P m , creating a "ghost" detection in our crater extraction pipeline (Section 2.4).
In addition, Table 3.1 shows that roughly 25% of post-processed craters have coordinates that differ from the ground truth by 20% or more, and examples of this can be seen in Figure 3. This higher-error tail is not present in the post-CNN errors, so they arise from the post-processing methods, whose sources of error are detailed in Section 2.8. These issues indicate the need for further refinements to our overall crater identification pipeline in order to produce precision crater catalogs, which we save for future work.

Conclusions and Future Work
In this work we have demonstrated the successful performance of a convolutional neural network (CNN) in recognizing Lunar craters from digital elevation map images. In particular, we recovered 92% of craters from our test set, and almost doubled the number of total crater identifications.
Furthermore, we have shown that our Moon-trained CNN can accurately detect craters on the substantially different DEM images of Mercury. This implies that the CNN has learned to robustly detect craters, and not features particular to the planetary surface on which it was trained.
Two primary advantages of a deep learning solution over human crater identification are consistency and speed. A CNN will classify an image identically each time, but the same is not true for humans (Wetzler et al., 2005). In addition, different humans will use slightly different criteria, which adds to the error budget (Robbins et al., 2014). Once trained, our CNN greatly increases the speed of crater identification, taking minutes to generate predictions for tens of thousands of Lunar DEMs and a few hours to extract a post-processed crater distribution from those DEMs. This is of course all done passively, freeing the scientist to do other tasks. Our CNN could also be used to assist human experts, generating initial suggestions for the human expert to verify.
DEMs are available for many other Solar System bodies, including Mercury (Becker et al., 2016), Venus (Magellan Science Team, 2014), Mars (Fergason et al., 2017), Vesta (Preusker et al., 2014) and Ceres (Preusker et al., 2016 Our current work detected craters down to roughly 3 km diameter, but since our CNN accepts images of arbitrary magnification we can transferlearn to kilometer and sub-kilometer scales on the Moon. We anticipate that the uncharted territory of systematic small-size crater identification will provide important new information about the size distribution of Lunar impactors and the formation history of the Moon.